ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigIDR4Monitoring
src
TrigIDR4Mon.cxx
Go to the documentation of this file.
1
11
12
#include "
TrigInDetAnalysisExample/ChainString.h
"
13
#include "
TrigInDetAnalysisExample/TIDAHistogram.h
"
14
#include "
TrigDecisionTool/ChainGroup.h
"
15
#include "
TrigDecisionTool/TrigDecisionTool.h
"
16
17
#include "
TrigIDR4Mon.h
"
18
#include "
Utils.h
"
19
20
#include "
MsgMacros.h
"
21
22
23
TrigIDR4Mon::TrigIDR4Mon
(
const
std::string & name, ISvcLocator* pSvcLocator)
24
:
AthMonitorAlgorithm
(name, pSvcLocator),
25
m_tdt
(
"Trig::TrigDecisionTool/TrigDecisionTool"
),
26
m_sliceTag
(
""
)
27
{
28
# ifdef USE_DATE_TIME_STAMP
29
MY_MSG_INFO
<<
"TrigIDR4Mon::TrigIDR4Mon() compiled: "
<< __DATE__ <<
" "
<< __TIME__ <<
endmsg
;
30
# endif
31
32
declareProperty
(
"SliceTag"
,
m_sliceTag
=
""
);
33
34
MY_MSG_DEBUG
<<
"TrigIDR4Mon::TrigIDR4Mon() exiting "
<< gDirectory->GetName() <<
endmsg
;
35
36
}
37
38
39
40
TrigIDR4Mon::~TrigIDR4Mon
() { }
41
42
43
44
StatusCode
TrigIDR4Mon::initialize
() {
45
46
MY_MSG_DEBUG
<<
" ----- enter initialize() ----- "
<<
endmsg
;
47
48
MY_MSG_INFO
<<
"TrigIDR4Mon::initialize() "
<< gDirectory->GetName() <<
" "
<<
m_sliceTag
<<
endmsg
;
49
53
54
MY_MSG_DEBUG
<<
"TrigIDR4Mon::name: "
<< name() <<
endmsg
;
55
MY_MSG_DEBUG
<<
"TrigIDR4Mon::SliceTag: "
<<
m_sliceTag
<<
endmsg
;
56
57
ATH_CHECK
(
m_monTools
.retrieve());
58
59
MY_MSG_INFO
<<
"TrigIDR4Mon::initialize() retrieved "
<<
m_monTools
.size() <<
" MonTools"
<<
endmsg
;
60
61
ATH_CHECK
(
m_tdt
.retrieve());
62
63
ATH_CHECK
(
bookHistograms
());
64
65
MY_MSG_DEBUG
<<
" ----- exit init() ----- "
<<
endmsg
;
66
67
return
AthMonitorAlgorithm::initialize
();
68
69
}
70
71
72
StatusCode
TrigIDR4Mon::bookHistograms
() {
73
74
MY_MSG_DEBUG
<<
" ----- enter book() ----- "
<<
endmsg
;
75
76
// MY_MSG_INFO << " TrigIDR4Mon::book() " << gDirectory->GetName() << endmsg;
77
79
// "^[[91;1m"
80
// "^[[m"
81
82
MY_MSG_DEBUG
<<
"^[[91;1m"
<< name() <<
"\t:AnalysisConfig "
<<
"^[[m"
<<
endmsg
;
83
84
std::string lastvtx =
""
;
85
88
89
std::vector<std::string> chains;
90
91
chains.reserve(
m_monTools
.size() );
92
95
98
// std::vector<ToolHandle<GenericMonitoringTool>*> monTools;
99
std::vector<IDTPM2::TrackAnalysis*> monTools;
100
101
monTools.reserve(
m_monTools
.size());
102
103
ToolHandleArray<IDTPM2::TrackAnalysis>::iterator toolitr =
m_monTools
.begin();
104
105
std::vector<GenericMonitoringTool*>
tools
;
// not tool hanldes ?? no, because we are creating these on the fly
106
107
// sort out all the chain stuff
108
109
int
chaincount = 0;
110
111
112
while
( toolitr!=
m_monTools
.end() ) {
113
114
std::string toolname = toolitr->name();
115
116
if
( toolname.find(
":"
)==std::string::npos ) toolname =
":"
+toolname;
117
119
ChainString
chainName = toolname;
120
122
123
if
( chainName.
head
() ==
""
) {
124
125
std::string selectChain = chainName.
raw
();
126
127
// toolitr->setPath( m_sliceTag+"/"+chainName );
128
130
if
( std::find(chains.begin(), chains.end(), selectChain) == chains.end()) {
// deduplicate
131
MY_MSG_DEBUG
<<
"TrigIDR4Mon::bookHistograms() adding offline tool: "
<< selectChain <<
endmsg
;
132
chains.push_back( selectChain );
133
monTools.push_back( toolitr->get() );
134
136
if
( (*toolitr)->isInitialized() ) {
137
if
( !(*toolitr)->refTracks().empty() )
ATH_CHECK
(
initializeKeys
( (*toolitr)->refTracks() ) );
138
if
( !(*toolitr)->refTracks_tag().empty() )
ATH_CHECK
(
initializeKeys
( (*toolitr)->refTracks_tag() ) );
139
}
140
141
}
142
toolitr++;
//cppcheck-suppress postfixOperator
143
}
144
else
{
145
147
148
if
( chainName.
head
().find(
"HLT_"
)==std::string::npos && chainName.
head
().find(
"EF_"
)==std::string::npos ) {
149
// with the O2 optimisation that ATLAS uses, unevaluated pre- and postfix operators produce identical code - I prefer the postfix
150
toolitr++;
//cppcheck-suppress postfixOperator
151
continue
;
152
}
153
155
156
std::string selectChain = chainName.
head
();
157
159
160
MY_MSG_DEBUG
<<
"checking chain: "
<< chainName.
head
() <<
endmsg
;
161
162
if
( selectChain==
""
) {
163
MY_MSG_WARNING
<<
"^[[91;1m"
<<
"No chain matched\tchain input "
<< chainName.
head
() <<
" : "
<< chainName.
tail
() <<
"^[[m"
<<
endmsg
;
164
// with the O2 optimisation that ATLAS uses, unevaluated pre- and postfix operators produce identical code - I prefer the postfix
165
toolitr++;
//cppcheck-suppress postfixOperator
166
continue
;
167
}
168
170
171
selectChain = chainName.
subs
( selectChain );
172
173
if
( std::find(chains.begin(), chains.end(), selectChain) == chains.end() ) {
// deduplicate
174
175
MY_MSG_DEBUG
<<
"TrigIDR4Mon::bookHistograms() adding trigger tool: "
<< selectChain <<
endmsg
;
176
177
chains.push_back( selectChain );
178
179
// (*toolitr)->setTDT( m_tdt );
180
monTools.push_back( toolitr->get() );
181
// monTools.push_back( new TrackAnalysis( "TrackAnalysis", toolitr->name(), this ) );
182
// monTools.back()->addHistograms( (*toolitr) );
183
// monTools.back()->addHistograms( (*toolitr) );
184
185
if
( (*toolitr)->isInitialized() ) {
186
if
( !(*toolitr)->refTracks().empty() )
ATH_CHECK
(
initializeKeys
( (*toolitr)->refTracks() ) );
187
if
( !(*toolitr)->refTracks_tag().empty() )
ATH_CHECK
(
initializeKeys
( (*toolitr)->refTracks_tag() ) );
188
}
189
190
chaincount++;
191
192
}
193
194
// with the O2 optimisation that ATLAS uses, unevaluated pre- and postfix operators produce identical code - I prefer the postfix
195
//cppcheck-suppress postfixOperator^
196
toolitr++;
//cppcheck-suppress postfixOperator
197
}
198
199
}
200
201
m_chainNames
= chains;
202
203
m_tools
= monTools;
204
205
MY_MSG_INFO
<<
" configured "
<< chaincount <<
" ("
<<
m_tools
.size() <<
") analyses"
<<
endmsg
;
206
207
MY_MSG_DEBUG
<<
" ----- exit book() ----- "
<<
endmsg
;
208
209
return
StatusCode::SUCCESS;
210
211
}
212
213
214
215
216
217
StatusCode
TrigIDR4Mon::execute
(
const
EventContext& context)
const
{
218
219
MY_MSG_DEBUG
<<
" ----- enter fill() ----- "
<<
endmsg
;
220
MY_MSG_DEBUG
<<
"TrigIDR4Mon::execute() "
<<
IDTPM2::stime
() <<
"\tm_tools.size() = "
<<
m_tools
.size() <<
endmsg
;
221
222
static
thread_local
long
allcounts = 0;
223
224
if
( allcounts && allcounts%1000==0 ) {
225
MY_MSG_INFO
<<
"TrigIDR4Mon::execute() "
<<
IDTPM2::stime
() <<
"\tcounts: "
<< allcounts <<
"\tm_tools.size() = "
<<
m_tools
.size() <<
endmsg
;
226
}
227
allcounts++;
228
229
const
Trig::ChainGroup
* chainGroup =
m_tdt
->getChainGroup(
"HLT_.*, EF_.*"
);
230
const
std::vector<std::string> selectChains = chainGroup->
getListOfTriggers
();
231
242
243
#if 1
245
for
(
size_t
itools=
m_tools
.size() ; itools-- ; ) {
246
MY_MSG_DEBUG
<<
"TrigIDR4Mon::fillHistograms() calling execute() on tool "
<< itools <<
" : "
<<
m_tools
[itools]->name() <<
endmsg
;
247
m_tools
[itools]->execute(context);
248
}
249
#endif
250
251
#if 0
253
255
257
static
std::once_flag flag;
258
std::call_once(flag, [&]() {
259
for
(
unsigned
i=0 ; i<selectChains.size() ; i++ ) {
260
MY_MSG_DEBUG
<<
"\tchain "
<< selectChains[i] <<
" from TDT"
<<
endmsg
;
261
}
262
263
for
(
size_t
i=selectChains.size() ; i-- ; ) {
264
if
( i>5 ) i=5;
265
MY_MSG_INFO
<<
"^[[91;1m"
<<
"configured chain "
<< selectChains[i] <<
"^[[m"
<<
endmsg
;
266
}
267
});
268
269
if
(
msgLvl
(MSG::DEBUG)) {
270
const
std::vector<bool> isPassed = chainGroup->
isPassedForEach
();
271
for
(
unsigned
i=0 ; i<selectChains.size() ; i++ ) {
272
if
( isPassed[i] ) {
273
MY_MSG_DEBUG
<<
"chain "
<< selectChains[i] <<
"\tpass: "
<< isPassed[i] <<
"\tprescale: "
<<
m_tdt
->getPrescale(selectChains[i]) <<
endmsg
;
274
}
275
}
276
}
277
278
#endif
279
280
MY_MSG_DEBUG
<<
" ----- exit fill() ----- "
<<
endmsg
;
281
282
return
StatusCode::SUCCESS;
283
}
284
285
286
287
288
289
// bool newEventsBlock, bool newLumiBlock, bool newRun are protected varibales
290
// correctly set before this is called
291
StatusCode
TrigIDR4Mon::finalize
() {
292
293
MY_MSG_INFO
<<
"finalize() "
<< name() <<
endmsg
;
294
295
for
(
size_t
itools=
m_tools
.size() ; itools-- ; ) {
296
MY_MSG_DEBUG
<<
"TrigIDR4Mon::finalize() calling finalize() on tool "
<< itools <<
" : "
<<
m_tools
[itools]->name() <<
endmsg
;
297
if
( (
m_tools
[itools]->
finalize
()).isFailure() ) {
298
MY_MSG_DEBUG
<<
"finalize() failed on tool"
<<
m_tools
[itools]->name() <<
endmsg
;
299
}
300
}
301
302
MY_MSG_DEBUG
<<
"finalize() out"
<< name() <<
endmsg
;
303
304
return
StatusCode::SUCCESS;
305
}
306
307
308
309
310
311
312
313
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ChainGroup.h
ChainString.h
MsgMacros.h
emacs: this is -*- c++ -*-
MY_MSG_DEBUG
#define MY_MSG_DEBUG
Definition
MsgMacros.h:25
MY_MSG_INFO
#define MY_MSG_INFO
Definition
MsgMacros.h:24
MY_MSG_WARNING
#define MY_MSG_WARNING
Definition
MsgMacros.h:23
TIDAHistogram.h
emacs: this is -* c++ -*-
TrigDecisionTool.h
TrigIDR4Mon.h
emacs: this is -*- c++ -*-
Utils.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition
AthCommonMsg.h:30
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition
AthMonitorAlgorithm.cxx:22
AthMonitorAlgorithm::AthMonitorAlgorithm
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthMonitorAlgorithm.cxx:8
ChainString
Definition
ChainString.h:23
ChainString::subs
std::string subs(std::string s) const
Definition
ChainString.cxx:127
ChainString::raw
const std::string & raw() const
Definition
ChainString.h:42
ChainString::head
const std::string & head() const
Definition
ChainString.h:33
ChainString::tail
const std::string & tail() const
Definition
ChainString.h:34
TrigIDR4Mon::initializeKeys
StatusCode initializeKeys(std::string keyvalue)
Definition
TrigIDR4Mon.h:91
TrigIDR4Mon::m_tdt
ToolHandle< Trig::TrigDecisionTool > m_tdt
Definition
TrigIDR4Mon.h:69
TrigIDR4Mon::execute
virtual StatusCode execute(const EventContext &context) const override
Applies filters and trigger requirements.
Definition
TrigIDR4Mon.cxx:217
TrigIDR4Mon::m_sliceTag
std::string m_sliceTag
additional string for the histogram directory
Definition
TrigIDR4Mon.h:74
TrigIDR4Mon::~TrigIDR4Mon
virtual ~TrigIDR4Mon()
Definition
TrigIDR4Mon.cxx:40
TrigIDR4Mon::bookHistograms
virtual StatusCode bookHistograms()
Definition
TrigIDR4Mon.cxx:72
TrigIDR4Mon::m_chainNames
std::vector< std::string > m_chainNames
Definition
TrigIDR4Mon.h:66
TrigIDR4Mon::finalize
virtual StatusCode finalize() override
Definition
TrigIDR4Mon.cxx:291
TrigIDR4Mon::initialize
virtual StatusCode initialize() override
initialize
Definition
TrigIDR4Mon.cxx:44
TrigIDR4Mon::m_monTools
ToolHandleArray< IDTPM2::TrackAnalysis > m_monTools
class structure items
Definition
TrigIDR4Mon.h:58
TrigIDR4Mon::TrigIDR4Mon
TrigIDR4Mon(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TrigIDR4Mon.cxx:23
TrigIDR4Mon::m_tools
std::vector< IDTPM2::TrackAnalysis * > m_tools
Definition
TrigIDR4Mon.h:60
Trig::ChainGroup
Definition
ChainGroup.h:54
Trig::ChainGroup::isPassedForEach
std::vector< bool > isPassedForEach(unsigned int condition=TrigDefs::Physics) const
return vector with isPassed decision for each chain
Definition
ChainGroup.cxx:198
Trig::ChainGroup::getListOfTriggers
std::vector< std::string > getListOfTriggers() const
Definition
ChainGroup.cxx:475
IDTPM2::stime
std::string stime()
this is as optimal as it gets because it allows ctime_r to construct the time string in place and exp...
Definition
Trigger/TrigMonitoring/TrigIDR4Monitoring/src/Utils.cxx:22
tools
Definition
DataQuality/ZLumiScripts/python/tools/__init__.py:1
Generated on
for ATLAS Offline Software by
1.17.0