HeterogeneousCore
SonicCore
interface
SonicEDProducer.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_SonicCore_SonicEDProducer
2
#define HeterogeneousCore_SonicCore_SonicEDProducer
3
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
6
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
7
#include "
FWCore/Framework/interface/EventSetup.h
"
8
#include "
FWCore/Concurrency/interface/WaitingTaskWithArenaHolder.h
"
9
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
10
11
#include <string>
12
#include <chrono>
13
14
//this is a stream producer because client operations are not multithread-safe in general
15
//it is designed such that the user never has to interact with the client or the acquire() callback directly
16
template
<
typename
Client,
typename
... Capabilities>
17
class
SonicEDProducer
:
public
edm::stream::EDProducer
<edm::ExternalWork, Capabilities...> {
18
public
:
19
//typedefs to simplify usage
20
typedef
typename
Client::Input
Input
;
21
typedef
typename
Client::Output
Output
;
22
//constructor
23
SonicEDProducer
(
edm::ParameterSet
const
&
cfg
) :
client_
(
cfg
.getParameter<
edm
::
ParameterSet
>(
"Client"
)) {}
24
//destructor
25
~SonicEDProducer
()
override
=
default
;
26
27
//derived classes use a dedicated acquire() interface that incorporates client_.input()
28
//(no need to interact with callback holder)
29
void
acquire
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup,
edm::WaitingTaskWithArenaHolder
holder)
final
{
30
auto
t0
=
std::chrono::high_resolution_clock::now
();
31
acquire
(
iEvent
, iSetup,
client_
.input());
32
auto
t1
=
std::chrono::high_resolution_clock::now
();
33
if
(!
client_
.debugName().empty())
34
edm::LogInfo
(
client_
.debugName()) <<
"Load time: "
35
<< std::chrono::duration_cast<std::chrono::microseconds>(
t1
-
t0
).count();
36
client_
.dispatch(holder);
37
}
38
virtual
void
acquire
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup,
Input
& iInput) = 0;
39
//derived classes use a dedicated produce() interface that incorporates client_.output()
40
void
produce
(
edm::Event
&
iEvent
,
edm::EventSetup
const
& iSetup)
final
{
41
//todo: measure time between acquire and produce
42
produce
(
iEvent
, iSetup,
client_
.output());
43
}
44
virtual
void
produce
(
edm::Event
&
iEvent
,
edm::EventSetup
const
& iSetup,
Output
const
& iOutput) = 0;
45
46
protected
:
47
//for debugging
48
void
setDebugName
(
const
std::string
& debugName) {
client_
.setDebugName(debugName); }
49
//members
50
Client
client_
;
51
};
52
53
#endif
MessageLogger.h
SonicEDProducer::acquire
void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, edm::WaitingTaskWithArenaHolder holder) final
Definition:
SonicEDProducer.h:29
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::LogInfo
Definition:
MessageLogger.h:254
EDProducer.h
SonicEDProducer::setDebugName
void setDebugName(const std::string &debugName)
Definition:
SonicEDProducer.h:48
SonicEDProducer::client_
Client client_
Definition:
SonicEDProducer.h:50
Input
#define Input(cl)
Definition:
vmac.h:190
fileCollector.now
now
Definition:
fileCollector.py:207
edm::WaitingTaskWithArenaHolder
Definition:
WaitingTaskWithArenaHolder.h:31
RandomServiceHelper.t1
t1
Definition:
RandomServiceHelper.py:256
SonicEDProducer::Input
Client::Input Input
Definition:
SonicEDProducer.h:20
SonicEDProducer::produce
void produce(edm::Event &iEvent, edm::EventSetup const &iSetup) final
Definition:
SonicEDProducer.h:40
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition:
FrontierCondition_GT_autoExpress_cfi.py:148
SonicEDProducer::SonicEDProducer
SonicEDProducer(edm::ParameterSet const &cfg)
Definition:
SonicEDProducer.h:23
SonicEDProducer::~SonicEDProducer
~SonicEDProducer() override=default
SonicEDProducer::Output
Client::Output Output
Definition:
SonicEDProducer.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
ParameterSet
Definition:
Functions.h:16
WaitingTaskWithArenaHolder.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:57
looper.cfg
cfg
Definition:
looper.py:297
SonicEDProducer
Definition:
SonicEDProducer.h:17
EventSetup.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
Output
#define Output(cl)
Definition:
vmac.h:194
Generated for CMSSW Reference Manual by
1.8.16