CMS 3D CMS Logo

SonicAcquirer.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_SonicCore_SonicAcquirer
2 #define HeterogeneousCore_SonicCore_SonicAcquirer
3 
9 
10 #include <chrono>
11 
12 template <typename Client, typename Module>
13 class SonicAcquirer : public Module {
14 public:
15  //typedef to simplify usage
16  typedef typename Client::Input Input;
17  //constructor
18  SonicAcquirer(edm::ParameterSet const& cfg) : client_(cfg.getParameter<edm::ParameterSet>("Client")) {}
19  //destructor
20  ~SonicAcquirer() override = default;
21 
22  //derived classes use a dedicated acquire() interface that incorporates client_.input()
23  //(no need to interact with callback holder)
24  void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, edm::WaitingTaskWithArenaHolder holder) final {
26  acquire(iEvent, iSetup, client_.input());
27  sonic_utils::printDebugTime(client_.debugName(), "acquire() time: ", t0);
29  client_.dispatch(holder);
30  }
31  virtual void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) = 0;
32 
33 protected:
34  //for debugging
35  void setDebugName(const std::string& debugName) { client_.setDebugName(debugName); }
36  //members
37  Client client_;
38  std::chrono::time_point<std::chrono::high_resolution_clock> t_dispatch_;
39 };
40 
41 #endif
SonicAcquirer
Definition: SonicAcquirer.h:13
sonic_utils.h
submitPVValidationJobs.now
now
Definition: submitPVValidationJobs.py:639
edm
HLT enums.
Definition: AlignableModifier.h:19
SonicAcquirer::t_dispatch_
std::chrono::time_point< std::chrono::high_resolution_clock > t_dispatch_
Definition: SonicAcquirer.h:38
sonic_utils::printDebugTime
void printDebugTime(std::string_view debugName, std::string_view msg, const TimePoint &t0)
Definition: sonic_utils.cc:8
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:31
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
SonicAcquirer::Input
Client::Input Input
Definition: SonicAcquirer.h:16
SonicAcquirer::acquire
void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, edm::WaitingTaskWithArenaHolder holder) final
Definition: SonicAcquirer.h:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
WaitingTaskWithArenaHolder.h
SonicAcquirer::setDebugName
void setDebugName(const std::string &debugName)
Definition: SonicAcquirer.h:35
iEvent
int iEvent
Definition: GenABIO.cc:224
SonicAcquirer::~SonicAcquirer
~SonicAcquirer() override=default
edm::EventSetup
Definition: EventSetup.h:57
looper.cfg
cfg
Definition: looper.py:297
TrackCandidateTopBottomHitFilter_cfi.Input
Input
Definition: TrackCandidateTopBottomHitFilter_cfi.py:4
EventSetup.h
SonicAcquirer::SonicAcquirer
SonicAcquirer(edm::ParameterSet const &cfg)
Definition: SonicAcquirer.h:18
SonicAcquirer::client_
Client client_
Definition: SonicAcquirer.h:37
ParameterSet.h
edm::Event
Definition: Event.h:73