Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
d
e
f
l
m
o
p
s
t
u
v
Related Functions
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Package Documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
HeterogeneousCore
SonicCore
interface
SonicOneEDAnalyzer.h
Go to the documentation of this file.
1
#ifndef HeterogeneousCore_SonicCore_SonicOneEDAnalyzer
2
#define HeterogeneousCore_SonicCore_SonicOneEDAnalyzer
3
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/one/EDAnalyzer.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
#include "
HeterogeneousCore/SonicCore/interface/SonicClientBase.h
"
11
#include "
HeterogeneousCore/SonicCore/interface/sonic_utils.h
"
12
13
#include <string>
14
#include <chrono>
15
16
//this is a one analyzer to enable writing trees/histograms for analysis users with results from inference as a service
17
template
<
typename
Client,
typename
... Capabilities>
18
class
SonicOneEDAnalyzer
:
public
edm::one::EDAnalyzer
<Capabilities...> {
19
public
:
20
//typedefs to simplify usage
21
typedef
typename
Client::Input
Input
;
22
typedef
typename
Client::Output
Output
;
23
//constructor
24
SonicOneEDAnalyzer
(
edm::ParameterSet
const
&
cfg
,
const
std::string
& debugName)
25
:
clientPset_
(
cfg
.
getParameterSet
(
"Client"
)),
debugName_
(debugName) {
26
//ExternalWork is not compatible with one modules, so Sync mode is enforced
27
if
(
clientPset_
.
getParameter
<
std::string
>(
"mode"
) !=
"Sync"
) {
28
edm::LogWarning
(
"ResetClientMode"
) <<
"Resetting client mode to Sync for SonicOneEDAnalyzer"
;
29
clientPset_
.
addParameter
<
std::string
>(
"mode"
,
"Sync"
);
30
}
31
}
32
//destructor
33
~SonicOneEDAnalyzer
()
override
=
default
;
34
35
//construct client at beginning of job
36
//in case client constructor depends on operations happening in derived module constructors
37
void
beginJob
()
override
{
makeClient
(); }
38
39
//derived classes still use a dedicated acquire() interface that incorporates client_->input() for consistency
40
virtual
void
acquire
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup,
Input
& iInput) = 0;
41
//derived classes use a dedicated analyze() interface that incorporates client_->output()
42
void
analyze
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup)
final
{
43
auto
t0
=
std::chrono::high_resolution_clock::now
();
44
acquire
(
iEvent
, iSetup,
client_
->input());
45
sonic_utils::printDebugTime
(
debugName_
,
"acquire() time: "
,
t0
);
46
47
//pattern similar to ExternalWork, but blocking
48
auto
t1
=
std::chrono::high_resolution_clock::now
();
49
client_
->dispatch();
50
51
//measure time between acquire and produce
52
sonic_utils::printDebugTime
(
debugName_
,
"dispatch() time: "
,
t1
);
53
54
auto
t2
=
std::chrono::high_resolution_clock::now
();
55
analyze
(
iEvent
, iSetup,
client_
->output());
56
sonic_utils::printDebugTime
(
debugName_
,
"analyze() time: "
,
t2
);
57
58
//reset client data
59
client_
->reset();
60
}
61
virtual
void
analyze
(
edm::Event
const
&
iEvent
,
edm::EventSetup
const
& iSetup,
Output
const
& iOutput) = 0;
62
63
protected
:
64
//helper
65
void
makeClient
() {
client_
= std::make_unique<Client>(
clientPset_
,
debugName_
); }
66
67
//members
68
edm::ParameterSet
clientPset_
;
69
std::unique_ptr<Client>
client_
;
70
std::string
debugName_
;
71
};
72
73
#endif
RandomServiceHelper.t2
t2
Definition:
RandomServiceHelper.py:257
EDAnalyzer.h
MessageLogger.h
SonicOneEDAnalyzer::client_
std::unique_ptr< Client > client_
Definition:
SonicOneEDAnalyzer.h:69
sonic_utils.h
submitPVValidationJobs.now
now
Definition:
submitPVValidationJobs.py:639
SonicOneEDAnalyzer::debugName_
std::string debugName_
Definition:
SonicOneEDAnalyzer.h:70
sonic_utils::printDebugTime
void printDebugTime(std::string_view debugName, std::string_view msg, const TimePoint &t0)
Definition:
sonic_utils.cc:8
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
GetRecoTauVFromDQM_MC_cff.Output
Output
Definition:
GetRecoTauVFromDQM_MC_cff.py:12
RandomServiceHelper.t1
t1
Definition:
RandomServiceHelper.py:256
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition:
FrontierCondition_GT_autoExpress_cfi.py:149
SonicOneEDAnalyzer::Input
Client::Input Input
Definition:
SonicOneEDAnalyzer.h:21
SonicOneEDAnalyzer
Definition:
SonicOneEDAnalyzer.h:18
SonicOneEDAnalyzer::clientPset_
edm::ParameterSet clientPset_
Definition:
SonicOneEDAnalyzer.h:68
SonicOneEDAnalyzer::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &iSetup) final
Definition:
SonicOneEDAnalyzer.h:42
SonicOneEDAnalyzer::Output
Client::Output Output
Definition:
SonicOneEDAnalyzer.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
SonicOneEDAnalyzer::SonicOneEDAnalyzer
SonicOneEDAnalyzer(edm::ParameterSet const &cfg, const std::string &debugName)
Definition:
SonicOneEDAnalyzer.h:24
SonicOneEDAnalyzer::makeClient
void makeClient()
Definition:
SonicOneEDAnalyzer.h:65
Event.h
WaitingTaskWithArenaHolder.h
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition:
ParameterSet.h:135
iEvent
int iEvent
Definition:
GenABIO.cc:224
SonicClientBase.h
edm::EventSetup
Definition:
EventSetup.h:58
looper.cfg
cfg
Definition:
looper.py:297
SonicOneEDAnalyzer::beginJob
void beginJob() override
Definition:
SonicOneEDAnalyzer.h:37
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition:
ParameterSet.cc:862
TrackCandidateTopBottomHitFilter_cfi.Input
Input
Definition:
TrackCandidateTopBottomHitFilter_cfi.py:4
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
ParameterSet.h
edm::Event
Definition:
Event.h:73
SonicOneEDAnalyzer::acquire
virtual void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, Input &iInput)=0
SonicOneEDAnalyzer::~SonicOneEDAnalyzer
~SonicOneEDAnalyzer() override=default
Generated for CMSSW Reference Manual by
1.8.16