Jpp
 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 
4 #include "JDAQ/JDAQHeader.hh"
5 #include "JDAQ/JDAQEvent.hh"
6 
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace KM3NETDAQ {
13 
14  /**
15  * Auxiliary class to determine value of DAQ objects.
16  */
17  struct JDAQEvaluator {
18  /**
19  * Default constructor.
20  */
22  {}
23 
24 
25  /**
26  * Get value of object.
27  *
28  * \param object event
29  * \return value
30  */
31  inline double operator()(const JDAQHeader& object) const
32  {
33  return object.getTimesliceStart().getTimeNanoSecond();
34  }
35 
36 
37  /**
38  * Get value of event.
39  *
40  * \param object event
41  * \return value
42  */
43  inline double operator()(const JDAQEvent& object) const
44  {
45  return object.getTimesliceStart().getTimeNanoSecond() + object.getCounter() * getWeight();
46  }
47 
48 
49  /**
50  * Get relative weight for JDAQEvent evaluation.
51  *
52  * This value should be less than the ratio of
53  * the expected maximum number of events in a single data taking run and
54  * the frame duration in units of nano seconds.
55  *
56  * \return weigth [ns]
57  */
58  static double getWeight()
59  {
60  return 1e-6; // [ns]
61  }
62  };
63 
64 
65  /**
66  * Function object for evaluation of DAQ objects.
67  */
68  static const JDAQEvaluator getDAQValue;
69 }
70 
71 #endif
static const JDAQEvaluator getDAQValue
Function object for evaluation of DAQ objects.
JDAQEvaluator()
Default constructor.
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.