Jpp  19.0.0
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 #include "JDAQ/JSupport.hh"
11 
13 #include "JSupport/JTreeScanner.hh"
14 
15 
16 /**
17  * \author mdejong
18  */
19 
20 namespace JSUPPORT {}
21 namespace JPP { using namespace JSUPPORT; }
22 
23 namespace JSUPPORT {
24 
28 
29 
30  /**
31  * File router for fast addressing of summary data.
32  *
33  * The member method update() should be used to update the internal router for a given event.
34  * The member method getRate(const JDAQPMTIdentifier&) const can subsequently be used to obtain
35  * the measured singles rate for a given PMT at the closest time of the event.
36  */
38  public JSummaryRouter,
39  public JTreeScanner<JDAQSummaryslice, JDAQEvaluator>
40  {
41  public:
42  /**
43  * Constructor.
44  *
45  * \param file_name file name
46  */
47  JSummaryFileRouter(const std::string& file_name) :
50  {}
51 
52 
53  /**
54  * Constructor.
55  *
56  * \param file_name file name
57  * \param rate_Hz default singles rate [Hz]
58  */
59  JSummaryFileRouter(const std::string& file_name,
60  const double rate_Hz) :
61  JSummaryRouter(rate_Hz),
63  {}
64 
65 
66  /**
67  * Update router.
68  *
69  * \param header header
70  */
71  void update(const JDAQHeader& header)
72  {
73  static Long64_t previous = -1;
74 
75  const Long64_t index = this->find(header);
76 
77  if (index != -1) {
78 
79  if (index != previous) {
80 
81  previous = index;
82 
83  JSummaryRouter::update(this->getEntry(index));
84  }
85  }
86  }
87  };
88 }
89 
90 #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.
ROOT TTree parameter settings.
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 time of DAQ objects.