Jpp  18.2.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JSummaryFileRouter.hh
Go to the documentation of this file.
1 #ifndef __JSUPPORT__JSUMMARYFILEROUTER__
2 #define __JSUPPORT__JSUMMARYFILEROUTER__
3 
4 #include <string>
5 
8 
9 #include "JDAQ/JDAQEvaluator.hh"
10 
12 #include "JSupport/JTreeScanner.hh"
13 
14 
15 /**
16  * \author mdejong
17  */
18 
19 namespace JSUPPORT {}
20 namespace JPP { using namespace JSUPPORT; }
21 
22 namespace JSUPPORT {
23 
27 
28 
29  /**
30  * File router for fast addressing of summary data.
31  *
32  * The member method update() should be used to update the internal router for a given event.
33  * The member method getRate(const JDAQPMTIdentifier&) const can subsequently be used to obtain
34  * the measured singles rate for a given PMT at the closest time of the event.
35  */
37  public JSummaryRouter,
38  public JTreeScanner<JDAQSummaryslice, JDAQEvaluator>
39  {
40  public:
41  /**
42  * Constructor.
43  *
44  * \param file_name file name
45  */
46  JSummaryFileRouter(const std::string& file_name) :
49  {}
50 
51 
52  /**
53  * Constructor.
54  *
55  * \param file_name file name
56  * \param rate_Hz default singles rate [Hz]
57  */
58  JSummaryFileRouter(const std::string& file_name,
59  const double rate_Hz) :
60  JSummaryRouter(rate_Hz),
62  {}
63 
64 
65  /**
66  * Update router.
67  *
68  * \param header header
69  */
70  void update(const JDAQHeader& header)
71  {
72  static Long64_t previous = -1;
73 
74  const Long64_t index = this->find(header);
75 
76  if (index != -1) {
77 
78  if (index != previous) {
79 
80  previous = index;
81 
82  JSummaryRouter::update(this->getEntry(index));
83  }
84  }
85  }
86  };
87 }
88 
89 #endif
void update(const JDAQSummaryslice *ps)
Update router.
void update(const JDAQHeader &header)
Update router.
Template definition for direct access of elements in ROOT TChain.
then awk string
File router for fast addressing of summary data.
JSummaryFileRouter(const std::string &file_name, const double rate_Hz)
Constructor.
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
JSummaryFileRouter(const std::string &file_name)
Constructor.
Auxiliary class to determine value of DAQ objects.