MdModuleRejector.h
Go to the documentation of this file.
1 
9 #ifndef _MdModuleRejectorAG_MdModuleRejector_h_
10 #define _MdModuleRejectorAG_MdModuleRejector_h_
11 
12 #include <fwk/VModule.h>
13 #include <utl/TimeStamp.h>
14 #include <map>
15 #include <utility>
16 #include <boost/tuple/tuple.hpp>
17 
18 namespace evt {
19  class Event;
20 }
21 
22 namespace utl {
23  class TimeStamp;
24 }
25 
26 namespace MdModuleRejectorAG {
27 
45  class MdModuleRejector : public fwk::VModule {
46 
47  public:
51 
52  private:
53 
54  // Data structure holding: start timestamp, end timestamp, counter id, and module id
55  typedef std::multimap< utl::TimeStamp, boost::tuple<utl::TimeStamp, size_t, size_t> > ParentMap;
56 
57  class TimeRangeMap : public ParentMap
58  {
59  public:
60  typedef std::vector< std::pair<size_t,size_t> > IdCollection; // counter id and module id
61 
63  GetBadStations(const utl::TimeStamp& time)
64  const
65  {
66  ParentMap::const_iterator it = upper_bound(time); // first key larger than time
67 
68  if (it == begin())
69  return IdCollection();
70 
72  do {
73  --it;
74  if (it->first <= time && time <= it->second.get<0>()) {
75  size_t counterId = it->second.get<1>();
76  size_t moduleId = it->second.get<2>();
77  ids.push_back(std::make_pair(counterId, moduleId));
78  }
79  } while (it!=begin());
80  return ids;
81  }
82  };
83 
85 
86  REGISTER_MODULE("MdModuleRejectorAG", MdModuleRejector);
87 
88  };
89 
90 }
91 
92 #endif
93 
94 // Configure (x)emacs for this file ...
95 // Local Variables:
96 // mode: c++
97 // End:
std::multimap< utl::TimeStamp, boost::tuple< utl::TimeStamp, size_t, size_t > > ParentMap
Filters out the MD modules specified in the configuration file This is achieved by setting the module...
std::vector< std::pair< size_t, size_t > > IdCollection
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
const double second
Definition: GalacticUnits.h:32
Module interface.
Definition: VModule.h:53
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
REGISTER_MODULE("MdModuleRejectorAG", MdModuleRejector)

, generated on Tue Sep 26 2023.