HeterogeneousCore
SonicCore
interface
SonicAcquirer.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_SonicCore_SonicAcquirer
2
#define HeterogeneousCore_SonicCore_SonicAcquirer
3
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/Concurrency/interface/WaitingTaskWithArenaHolder.h
"
8
#include "
HeterogeneousCore/SonicCore/interface/sonic_utils.h
"
9
10
#include <chrono>
11
#include <memory>
12
#include <string>
13
14
template
<
typename
Client,
typename
Module>
15
class
SonicAcquirer
:
public
Module {
16
public
:
17
//typedef to simplify usage
18
typedef
typename
Client::Input
Input
;
19
//constructor
20
SonicAcquirer
(
edm::ParameterSet
const
&
cfg
,
const
std::string
& debugName =
""
)
21
:
clientPset_
(
cfg
.
getParameterSet
(
"Client"
)),
debugName_
(debugName) {}
22
//destructor
23
~SonicAcquirer
()
override
=
default
;
24
25
//construct client at beginning of job
26
//in case client constructor depends on operations happening in derived module constructors
27
void
beginStream
(
edm::StreamID
)
override
{
makeClient
(); }
28
29
//derived classes use a dedicated acquire() interface that incorporates client_->input()
30
//(no need to interact with callback holder)
31
void
acquire
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup,
edm::WaitingTaskWithArenaHolder
holder)
final
{
32
auto
t0
=
std::chrono::high_resolution_clock::now
();
33
acquire
(
iEvent
, iSetup,
client_
->input());
34
sonic_utils::printDebugTime
(
debugName_
,
"acquire() time: "
,
t0
);
35
t_dispatch_
=
std::chrono::high_resolution_clock::now
();
36
client_
->dispatch(holder);
37
}
38
virtual
void
acquire
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup,
Input
& iInput) = 0;
39
40
protected
:
41
//helper
42
void
makeClient
() {
client_
= std::make_unique<Client>(
clientPset_
,
debugName_
); }
43
44
//members
45
edm::ParameterSet
clientPset_
;
46
std::unique_ptr<Client>
client_
;
47
std::string
debugName_
;
48
std::chrono::time_point<std::chrono::high_resolution_clock>
t_dispatch_
;
49
};
50
51
#endif
edm::StreamID
Definition:
StreamID.h:30
SonicAcquirer
Definition:
SonicAcquirer.h:15
sonic_utils.h
submitPVValidationJobs.now
now
Definition:
submitPVValidationJobs.py:639
SonicAcquirer::t_dispatch_
std::chrono::time_point< std::chrono::high_resolution_clock > t_dispatch_
Definition:
SonicAcquirer.h:48
sonic_utils::printDebugTime
void printDebugTime(std::string_view debugName, std::string_view msg, const TimePoint &t0)
Definition:
sonic_utils.cc:8
SonicAcquirer::clientPset_
edm::ParameterSet clientPset_
Definition:
SonicAcquirer.h:45
edm::WaitingTaskWithArenaHolder
Definition:
WaitingTaskWithArenaHolder.h:34
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition:
FrontierCondition_GT_autoExpress_cfi.py:149
SonicAcquirer::Input
Client::Input Input
Definition:
SonicAcquirer.h:18
SonicAcquirer::acquire
void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, edm::WaitingTaskWithArenaHolder holder) final
Definition:
SonicAcquirer.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
WaitingTaskWithArenaHolder.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
SonicAcquirer::SonicAcquirer
SonicAcquirer(edm::ParameterSet const &cfg, const std::string &debugName="")
Definition:
SonicAcquirer.h:20
SonicAcquirer::client_
std::unique_ptr< Client > client_
Definition:
SonicAcquirer.h:46
SonicAcquirer::~SonicAcquirer
~SonicAcquirer() override=default
edm::EventSetup
Definition:
EventSetup.h:58
SonicAcquirer::makeClient
void makeClient()
Definition:
SonicAcquirer.h:42
looper.cfg
cfg
Definition:
looper.py:297
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition:
ParameterSet.cc:862
TrackCandidateTopBottomHitFilter_cfi.Input
Input
Definition:
TrackCandidateTopBottomHitFilter_cfi.py:4
EventSetup.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
SonicAcquirer::debugName_
std::string debugName_
Definition:
SonicAcquirer.h:47
SonicAcquirer::beginStream
void beginStream(edm::StreamID) override
Definition:
SonicAcquirer.h:27
Generated for CMSSW Reference Manual by
1.8.16