Jpp  18.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDAQEvaluator.hh
Go to the documentation of this file.
1 #ifndef __JDAQEVALUATOR__
2 #define __JDAQEVALUATOR__
3 
7 
8 
9 /**
10  * \author mdejong
11  */
12 
13 namespace KM3NETDAQ {
14 
15  /**
16  * Auxiliary class to determine value of DAQ objects.
17  */
18  struct JDAQEvaluator {
19  /**
20  * Default constructor.
21  */
23  {}
24 
25 
26  /**
27  * Get value of object.
28  *
29  * \param object UTC time
30  * \return value
31  */
32  inline double operator()(const JDAQUTCExtended& object) const
33  {
34  return getTimeDifference(getUTC(), object) * 1.0e-9;
35  }
36 
37 
38  /**
39  * Get value of object.
40  *
41  * \param object event
42  * \return value
43  */
44  inline double operator()(const JDAQHeader& object) const
45  {
46  return(*this)(object.getTimesliceStart());
47  }
48 
49 
50  /**
51  * Get value of event.
52  *
53  * \param object event
54  * \return value
55  */
56  inline double operator()(const JDAQEvent& object) const
57  {
58  return getTimeDifference(getUTC(), object.getTimesliceStart()) * 1.0e-9 + object.getCounter() * getWeight();
59  }
60 
61 
62  /**
63  * Get relative weight for JDAQEvent evaluation.
64  *
65  * This value should be less than the ratio of
66  * the expected maximum number of events in a single data taking run and
67  * the frame duration in units of nano seconds.
68  *
69  * \return weigth [ns]
70  */
71  static double getWeight()
72  {
73  return 1.0e-6; // [ns]
74  }
75 
76 
77  /**
78  * Get arbitrary offset.
79  *
80  * \return UTC time
81  */
82  static const JDAQUTCExtended& getUTC()
83  {
84  static JDAQUTCExtended utc(1600000000, 0);
85 
86  return utc;
87  }
88  };
89 
90 
91  /**
92  * Function object for evaluation of DAQ objects.
93  */
94  static const JDAQEvaluator getDAQValue;
95 }
96 
97 #endif
double operator()(const JDAQUTCExtended &object) const
Get value of object.
static const JDAQEvaluator getDAQValue
Function object for evaluation of DAQ objects.
static const JDAQUTCExtended & getUTC()
Get arbitrary offset.
JDAQEvaluator()
Default constructor.
Data structure for UTC time.
double getTimeDifference(const JDAQChronometer &first, const JDAQChronometer &second)
Get time difference between two chronometers.
double operator()(const JDAQEvent &object) const
Get value of event.
Auxiliary class to determine value of DAQ objects.
double operator()(const JDAQHeader &object) const
Get value of object.
static double getWeight()
Get relative weight for JDAQEvent evaluation.