ATLAS Offline Software
Loading...
Searching...
No Matches
TrigCostAnalysis.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#define BOOST_BIND_GLOBAL_PLACEHOLDERS // silence Boost pragma message (fixed in Boost 1.76)
6#include <boost/property_tree/json_parser.hpp>
7
9
11
12#include "TrigCostAnalysis.h"
13#include "CostData.h"
14
22#include <format>
23
24TrigCostAnalysis::TrigCostAnalysis( const std::string& name, ISvcLocator* pSvcLocator ) :
25 AthAlgorithm(name, pSvcLocator),
26 m_metadataTree(nullptr),
29}
30
31
33 ATH_MSG_VERBOSE("In initialize()");
34
35 ATH_MSG_DEBUG("Reading from " << m_costDataKey.key() << ", " << m_HLTMenuKey.key());
36 ATH_CHECK( m_costDataKey.initialize() );
37 ATH_CHECK( m_HLTMenuKey.initialize() );
38
40
41
42 if (!m_enhancedBiasTool.name().empty()) {
43 ATH_CHECK( m_enhancedBiasTool.retrieve() );
44 } else {
45 ATH_MSG_DEBUG("No EnhancedBiasTool. Not doing additional weighting.");
46 if (m_useEBWeights) {
47 ATH_MSG_FATAL("Configured to use Enhanced Bias weights. Must supply weighting tool.");
48 return StatusCode::FAILURE;
49 }
50 }
51
53
54 if (not m_additionalHashMap.empty()) {
55 std::string hashFile = PathResolverFindCalibFile( m_additionalHashMap );
56 if (hashFile.empty()) {
57 ATH_MSG_WARNING("Could not retrieve " << m_additionalHashMap << ", won't load additional hash maps.");
58 } else {
60 }
61 }
62
63 ATH_CHECK( m_histSvc->regTree("/COSTSTREAM/metadata", std::make_unique<TTree>("metadata", "metadata")) );
64 ATH_CHECK( m_histSvc->getTree("/COSTSTREAM/metadata", m_metadataTree) );
65
66 return StatusCode::SUCCESS;
67}
68
71 ATH_CHECK( hltMenuHandle.isValid() );
72 ATH_MSG_INFO("Configuring from " << m_HLTMenuKey << " with " << hltMenuHandle->size() << " chains");
73 using boost::property_tree::ptree;
74
75 // Populate the reverse-hashing dictionary with all ALG NAMES.
76 // Obtain a mapping from NAME to TYPE from the configuration JSON
77 m_storeIdentifiers.clear();
78 const ptree& menuData = hltMenuHandle->data();
79 for (const auto& sequencer : menuData.get_child("sequencers")) {
80 ATH_MSG_VERBOSE("Found Sequencer:" << sequencer.first);
81 for (const auto& alg : sequencer.second) {
82 // Data stored in Gaudi format of "AlgClassType/AlgInstanceName"
83 size_t breakPoint = alg.second.data().find('/');
84 std::string algType = alg.second.data().substr(0, breakPoint);
85 std::string algName = alg.second.data().substr(breakPoint+1, alg.second.data().size());
86 std::replace(algType.begin(), algType.end(), ':', '_');
87 std::replace(algName.begin(), algName.end(), ':', '_');
88 m_algTypeMap[ TrigConf::HLTUtils::string2hash(algName, "ALG") ] = algType;
89 ATH_MSG_VERBOSE("AlgType:" << algType << ", AlgName:" << algName );
90 if (algType.find("EventViewCreatorAlgorithm") != std::string::npos) {
91 ATH_MSG_VERBOSE(algType << " is identified as a ViewCreator");
92 m_storeIdentifiers.insert(std::move(algName));
93 }
94 }
95 }
96
97 // Call TrigConf::HLTUtils::string2hash(chain.name()) for all the chains to cache the hash to name mapping
98 std::vector<TrigConf::Chain> chains;
99 ATH_CHECK( m_algToChainTool->getAllChains(chains));
100 for (const TrigConf::Chain& chain : chains) {
101 HLT::Identifier(chain.name());
103
104 // Populate legs' names
105 const size_t legsSize {chain.legMultiplicities().size()};
106 for (size_t counter = 0; legsSize > 1 && counter < legsSize; ++counter){
107 HLT::Identifier l = TrigCompositeUtils::createLegName(chain.namehash(), counter);
109 }
110 }
111
112 // Save identifiers and classes for additional HLTJobOptions map
113 if (not m_additionalHashList.empty()){
114 for (const std::string& entry : m_additionalHashList){
115 size_t breakPoint = entry.find('/');
116 if (breakPoint != std::string::npos){
117 std::string algType = entry.substr(0, breakPoint);
118 const std::string algName = entry.substr(breakPoint+1, entry.size());
119 std::replace(algType.begin(), algType.end(), ':', '_');
120 m_algTypeMap[ TrigConf::HLTUtils::string2hash(algName, "ALG") ] = std::move(algType);
121 } else {
123 }
124 }
125 }
126
127 // As an initial guess, 25 should be a good uper maximum for the number of expected View instances.
129 return StatusCode::SUCCESS;
130}
131
132// TODO. Do a proper atomic check of m_maxViewsNumber. Call this from within the Monitor code.
134 if (max <= m_maxViewsNumber) {
135 return StatusCode::SUCCESS;
136 }
137
138 const size_t current = m_maxViewsNumber;
140
141 ATH_MSG_DEBUG(std::format("Extending maximum View instances from {} to {}", current, max));
142
143 for (size_t viewID = current; viewID <= m_maxViewsNumber; ++viewID) {
144 // Allow for this many individual View instances
145 for (const std::string& store : m_storeIdentifiers) {
147 std::format("{}_view_{}", store, viewID), "STORE");
148 }
149
150 // And this many global Slots. Though, in general, it will be the Views which are driving this.
152 std::format("{}_StoreGateSvc_Impl", viewID), "STORE");
153 }
154
155 return StatusCode::SUCCESS;
156}
157
158float TrigCostAnalysis::getWeight(const EventContext& context) {
159 // TODO Prescale of CostMon chain for P1
160 double ebWeight = 1.0;
161 if (m_useEBWeights) {
162 ebWeight = m_enhancedBiasTool->getEBWeight(context);
163 ATH_MSG_DEBUG("EB Weight is " << ebWeight);
164 }
165 return m_baseEventWeight * ebWeight;
166}
167
168
169TH1* TrigCostAnalysis::bookGetPointer(TH1* hist, const std::string& tDir) const {
170 std::string histName(hist->GetName());
171 std::string bookingString = "/COSTSTREAM/" + tDir + "/" + histName;
172
173 if (!((m_histSvc->regHist(bookingString, hist)).isSuccess())) {
174 ATH_MSG_WARNING( "Problem registering histogram with name " << histName);
175 return nullptr;
176 }
177
178 return hist;
179}
180
181
182StatusCode TrigCostAnalysis::execute(const EventContext& ctx) {
183 const EventContext& context = ctx;
184
185 MonitoredRange* range = nullptr;
186 ATH_CHECK(getRange(context, range));
187
188 if (!range) {
189
190 ATH_MSG_DEBUG("Not monitoring event");
191 return StatusCode::SUCCESS;
192
193 }
194
195 ATH_MSG_DEBUG("Monitoring event " << context.eventID().event_number() << " in LB " << context.eventID().lumi_block() << " in range " << range->getName());
196
198 ATH_CHECK( costDataHandle.isValid() );
199
200 if (!m_metadataDataKey.empty()){
202 if (metadataDataHandle.isValid()){
203 for (const xAOD::TrigComposite* tc : *metadataDataHandle) {
204 try {
205 std::lock_guard<std::mutex> lock(m_addHostnameMutex);
206 m_hostnames.insert(tc->getDetail<std::string>("hostname"));
207 } catch ( const std::exception& ) {
208 ATH_MSG_WARNING("Missing HLT_RuntimeMetadata EDM hostname for event " << context.eventID().event_number());
209 }
210
211 }
212 }
213 else {
214 ATH_MSG_DEBUG("Not valid HLT_RuntimeMetadata handle for the event " << context.eventID().event_number());
215 }
216 }
217
218 // Save indexes of algorithm in costDataHandle
219 std::map<std::string, std::set<size_t>> chainToAlgIdx;
220 std::map<std::string, std::set<size_t>> chainToUniqAlgs; // List for unique algorithms for each chain
221 std::map<std::string, std::map<int16_t, std::set<size_t>>> seqToAlgIdx; // Map of algorithms split in views
222 std::map<std::string, std::set<std::string>> algToChain;
223 m_algToChainTool->cacheSGKeys(context);
224 ATH_CHECK( m_algToChainTool->getChainsForAllAlgs(context, algToChain) );
225
226 // Retrieve active sequences and algorithms
227 std::map<std::string, std::string> algToSeq;
228 ATH_CHECK(m_algToChainTool->getAllActiveSequences(context, algToSeq));
229
230 for (const xAOD::TrigComposite* tc : *costDataHandle) {
231 const uint32_t nameHash = tc->getDetail<TrigConf::HLTHash>("alg");
232 const std::string algName = TrigConf::HLTUtils::hash2string(nameHash, "ALG");
233
234 size_t i = 0;
235 if(m_excludeAlgsFromChain.find(algName) != m_excludeAlgsFromChain.end()) continue;
236
237 for (const std::string& chain : algToChain[algName]){
238 chainToAlgIdx[chain].insert(tc->index());
239 ++i;
240 }
241
242 if (i == 1){
243 ATH_MSG_DEBUG("Algorithm " << algName << " executed uniquely for " << *algToChain[algName].begin() << " chain");
244 chainToUniqAlgs[*algToChain[algName].begin()].insert(tc->index());
245 }
246
247 if (algToSeq.count(algName)){
248 const int16_t view = tc->getDetail<int16_t>("view");
249 seqToAlgIdx[algToSeq[algName]][view].insert(tc->index());
250 }
251 }
252
253 const std::set<TrigCompositeUtils::DecisionID> seededChains = m_algToChainTool->retrieveActiveChains(context, "HLTNav_L1");
254 std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo> seededChainsInfo;
255
256 // Skip empty events, where only cost chain was active
257 bool skipMonitoringThisEvent = false;
258 if ((seededChains.size() == 1 && seededChains.count(TrigConf::HLTUtils::string2hash("HLT_noalg_CostMonDS_L1All")))
259 || (seededChains.size() == 2 && seededChains.count(TrigConf::HLTUtils::string2hash("HLT_noalg_CostMonDS_L1All")) && seededChains.count(TrigConf::HLTUtils::string2hash("HLT_noalg_L1All"))) ){
260 skipMonitoringThisEvent = true;
261 }
262
263 for (auto id : seededChains){
265 ATH_CHECK(m_algToChainTool->getChainInfo(context, id, chainInfo));
266 seededChainsInfo.push_back(std::move(chainInfo));
267 }
268
269 const uint32_t onlineSlot = getOnlineSlot( costDataHandle.get() );
270 CostData costData;
271 ATH_CHECK( costData.set(costDataHandle.get(), onlineSlot) );
272 costData.setChainToAlgMap(chainToAlgIdx);
273 costData.setChainToUniqAlgMap(chainToUniqAlgs);
274 costData.setSequencersMap(seqToAlgIdx);
275 costData.setSeededChains(seededChainsInfo);
276 costData.setLb( context.eventID().lumi_block() );
277 costData.setTypeMap( m_algTypeMap );
278 if (!m_enhancedBiasTool.name().empty() && !m_enhancedBiasTool->isMC()) {
279 double liveTime = m_enhancedBiasTool->getEBLiveTime(context);
280 bool liveTimeIsPerEvent = true;
281 if (liveTime == 0.0) { // Note: This comes from a direct "return 0.", hence no delta
282 liveTime = m_enhancedBiasTool->getLBLength(context);
283 liveTimeIsPerEvent = false;
284 }
285 costData.setLivetime( liveTime, liveTimeIsPerEvent );
286 }
287
288 ATH_CHECK( range->newEvent( costData, getWeight(context), skipMonitoringThisEvent ) );
289
290 if (checkDoFullEventDump(context, costData)) {
291 ATH_CHECK( dumpEvent(context) );
292 }
293
294 return StatusCode::SUCCESS;
295}
296
297
298bool TrigCostAnalysis::checkDoFullEventDump(const EventContext& context, const CostData& costData) {
299 if (costData.isMasterSlot()
301 and context.eventID().event_number() % m_fullEventDumpProbability == 0)
302 {
304 return true;
305 }
306 return false;
307}
308
309
311 ATH_CHECK(range != nullptr);
313 ATH_CHECK( range->addMonitor(std::make_unique<MonitorAlgorithm>("Algorithm_HLT", range)) );
314 ATH_MSG_DEBUG("Registering Algorithm_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
315 }
317 ATH_CHECK( range->addMonitor(std::make_unique<MonitorAlgorithmClass>("Algorithm_Class_HLT", range)) );
318 ATH_MSG_DEBUG("Registering Algorithm_Class_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
319 }
320 if (m_doMonitorGlobal) {
321 ATH_CHECK( range->addMonitor(std::make_unique<MonitorGlobal>("Global_HLT", range)) );
322 ATH_MSG_DEBUG("Registering Global_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
323 }
325 ATH_CHECK( range->addMonitor(std::make_unique<MonitorThreadOccupancy>("Thread_Occupancy_HLT", range)) );
326 ATH_MSG_DEBUG("Registering Thread_Occupancy_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
327 }
328 if (m_doMonitorChain) {
329 ATH_CHECK( range->addMonitor(std::make_unique<MonitorChain>("Chain_HLT", range)) );
330 ATH_MSG_DEBUG("Registering Chain_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
331 }
333 ATH_CHECK( range->addMonitor(std::make_unique<MonitorChainAlgorithm>("Chain_Algorithm_HLT", range)) );
334 ATH_MSG_DEBUG("Registering Chain_Algorihtm_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
335 }
337 ATH_CHECK( range->addMonitor(std::make_unique<MonitorSequence>("Sequence_HLT", range)) );
338 ATH_MSG_DEBUG("Registering Sequence_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
339 }
340 // if (m_do...) {}
341
342 // Set the verbosity for the monitors
343 for (const std::unique_ptr<MonitorBase>& monitor : range->getMonitors()){
344 monitor->msg().setLevel(msg().level());
345 }
346
347 return StatusCode::SUCCESS;
348}
349
350
351StatusCode TrigCostAnalysis::getRange(const EventContext& context, MonitoredRange*& range)
352{
353 range = nullptr;
354 constexpr bool includeEndOfLB = false;
355
356 std::string rangeName;
357 if (m_singleTimeRange) {
358 rangeName = m_singleTimeRangeName;
359 } else {
360 const auto lumiBlock = context.eventID().lumi_block();
361 const size_t start = lumiBlock - (lumiBlock % m_TimeRangeLengthLB);
362 const size_t stop = start + m_TimeRangeLengthLB - 1;
363
364 if (includeEndOfLB && stop != start) {
365 rangeName = std::format("LumiBlock_{:05}_{}", start, stop);
366 } else {
367 rangeName = std::format("LumiBlock_{:05}", start);
368 }
369 }
370
371 // Fast path — range already exists
372 if (auto it = m_monitoredRanges.find(rangeName); it != m_monitoredRanges.end()) {
373 range = it->second.get();
374 return StatusCode::SUCCESS;
375 }
376
377 // We don't have this range yet — check if we are allowed to create more
378 if (m_monitoredRanges.size() >= m_maxTimeRange) {
379 return StatusCode::SUCCESS; // range stays nullptr
380 }
381
382 auto [it, inserted] = m_monitoredRanges.try_emplace(
383 rangeName,
384 std::make_unique<MonitoredRange>(rangeName, this)
385 );
386
387 if (!inserted) {
388 range = it->second.get();
389 return StatusCode::SUCCESS;
390 }
391
392 ATH_CHECK(registerMonitors(it->second.get()));
393 range = it->second.get();
394 return StatusCode::SUCCESS;
395}
396
398 // Online, Slot 0 can be configured as the master-slot. In this mode, events in Slot 0
399 // hoover up data about algorithm executions in other slots too.
400 // This all-slots data stored in the master slot is exploited by dumpEvent, and some specialist monitors.
401 // Other monitors will want to avoid it for fear of double-counting
402 if (costCollection->size() == 0) {
403 return 0;
404 }
405 const uint32_t initialSlot = costCollection->at(0)->getDetail<uint32_t>("slot");
406 for ( const xAOD::TrigComposite* tc : *costCollection ) {
407 const uint32_t algSlot = tc->getDetail<uint32_t>("slot");
408 if (algSlot == 0 or algSlot != initialSlot) {
409 return 0; // If we see a zero, or two different slot numbers, then we're in the master slot
410 }
411 }
412 // If we saw exclusivly one non-zero slot, then we're in that slot
413 return initialSlot;
414}
415
416
417StatusCode TrigCostAnalysis::dumpEvent(const EventContext& context) const {
420
421 std::stringstream ss;
422 size_t algID = 0;
423
424 for ( const xAOD::TrigComposite* tc : *costDataHandle ) {
425 const uint64_t start = tc->getDetail<uint64_t>("start"); // in mus
426 const uint64_t stop = tc->getDetail<uint64_t>("stop"); // in mus
427 const uint32_t slot = tc->getDetail<uint32_t>("slot");
428 const uint64_t start_ms_round = std::llround( start * 1e-3 ); // in ms
429 const uint64_t stop_ms_round = std::llround( stop * 1e-3 ); // in ms
430 const uint32_t threadID = tc->getDetail<uint32_t>("thread");
431
432 ss << "{id:" << algID++;
433 ss << ", group:" << threadID;
434 ss << ", className:'slot" << slot << "'";
435 ss << ", content:'" << TrigConf::HLTUtils::hash2string( tc->getDetail<TrigConf::HLTHash>("alg"), "ALG");
436 ss << "<br>" << TrigConf::HLTUtils::hash2string( tc->getDetail<TrigConf::HLTHash>("store"), "STORE") << "'";
437 ss << ", duration:" << (stop - start); // For tooltip display: in mus
438 ss << ", start:" << start_ms_round; // in ms
439 if (stop_ms_round > start_ms_round) {
440 ss << ", end:" << stop_ms_round;
441 } else {
442 ss << ", type:'point'";
443 }
444 ss << "},\n";
445 }
446
447 ATH_MSG_DEBUG("Full Event Summary for event " << context.eventID().event_number());
448 ATH_MSG_DEBUG(ss.str());
449 // TODO Persist this
450
451 return StatusCode::SUCCESS;
452}
453
454
456 ATH_MSG_VERBOSE("In finalize()");
457
459 return StatusCode::SUCCESS;
460}
461
462
464 if (!m_metadataTree) {
465 return;
466 }
467
468 auto runNumber = m_enhancedBiasTool->getRunNumber();
469 m_metadataTree->Branch("runNumber", &runNumber);
470
471 std::string hostnamesList = "";
472 if (m_hostnames.size() > 1){
473 ATH_MSG_DEBUG("Found many hostnames for this run");
474 for (const auto& name : m_hostnames) hostnamesList += name + ",";
475 hostnamesList.pop_back();
476 } else if (m_hostnames.size() == 1) {
477 hostnamesList = *m_hostnames.begin();
478 }
479 m_metadataTree->Branch("hostname", &hostnamesList);
480
482 std::string menuStr;
483 if ( hltMenuHandle.isValid() ){
484 std::stringstream ss;
485 boost::property_tree::json_parser::write_json(ss, hltMenuHandle->data());
486 menuStr = ss.str();
487 m_metadataTree->Branch("HLTMenu", &menuStr);
488 }
489
490 bool ChainMonitor = m_doMonitorChain;
491 bool ChainAlgorithmMonitor = m_doMonitorChainAlgorithm;
492 bool AlgorithmMonitor = m_doMonitorAlgorithm;
493 bool AlgorithmClassMonitor = m_doMonitorAlgorithmClass;
494 bool GlobalsMonitor = m_doMonitorGlobal;
495 bool ThreadMonitor = m_doMonitorThreadOccupancy;
496
497 m_metadataTree->Branch("ChainMonitor", &ChainMonitor);
498 m_metadataTree->Branch("ChainAlgorithmMonitor", &ChainAlgorithmMonitor);
499 m_metadataTree->Branch("AlgorithmMonitor", &AlgorithmMonitor);
500 m_metadataTree->Branch("AlgorithmClassMonitor", &AlgorithmClassMonitor);
501 m_metadataTree->Branch("GlobalsMonitor", &GlobalsMonitor);
502 m_metadataTree->Branch("ThreadMonitor", &ThreadMonitor);
503
504 float BaseEventWeight = m_baseEventWeight;
505 std::string AdditionalHashMap = m_additionalHashMap;
506 bool DoEBWeighting = m_useEBWeights;
507
508 m_metadataTree->Branch("AdditionalHashMap", &AdditionalHashMap);
509 m_metadataTree->Branch("DoEBWeighting", &DoEBWeighting);
510 m_metadataTree->Branch("BaseEventWeight", &BaseEventWeight);
511
512 std::string atlasProject = std::getenv("AtlasProject");
513 std::string atlasVersion = std::getenv("AtlasVersion");
514 m_metadataTree->Branch("AtlasProject", &atlasProject);
515 m_metadataTree->Branch("AtlasVersion", &atlasVersion);
516
517
518 std::string processedRanges;
520 processedRanges = m_singleTimeRangeName;
521 }
522 else {
523 std::stringstream ss;
524 for(const auto& rangePair : m_monitoredRanges){
525 ss << rangePair.first << ": ";
526 std::string lbrange = rangePair.first.substr(strlen("LumiBlock_"));
527 ss << " Lumiblocks " << std::stoi(lbrange) << " to " << std::stoi(lbrange) + m_TimeRangeLengthLB << ", ";
528 }
529 processedRanges = ss.str();
530 ATH_MSG_INFO("Processed ranges: " << processedRanges);
531 }
532
533 m_metadataTree->Branch("ProcessedRanges", &processedRanges);
534
535 m_metadataTree->Fill();
536}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
boost::property_tree::ptree ptree
static Double_t ss
static Double_t tc
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
#define max(a, b)
Definition cfImp.cxx:41
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Caches and propagates event data to be used by monitoring algorithms.
Definition CostData.h:26
bool isMasterSlot() const
Definition CostData.cxx:79
void setLb(uint32_t lb)
Setter of effective P1 walltime represented by the current event.
Definition CostData.cxx:37
void setSequencersMap(const std::map< std::string, std::map< int16_t, std::set< size_t > > > &seqToAlg)
Set the sequence to alg idx map.
Definition CostData.cxx:114
void setTypeMap(const std::unordered_map< uint32_t, std::string > &typeMap)
Set internal type map pointer.
Definition CostData.cxx:102
void setChainToAlgMap(const std::map< std::string, std::set< size_t > > &algToChains)
Set the alg name to chains map.
Definition CostData.cxx:106
void setSeededChains(const std::vector< TrigCompositeUtils::AlgToChainTool::ChainInfo > &seededChains)
Set the seeded chains set.
Definition CostData.cxx:135
StatusCode set(const xAOD::TrigCompositeContainer *costCollection, uint32_t onlineSlot)
Cache the cost and ros collections, after formally requesting it from storegate.
Definition CostData.cxx:19
void setLivetime(float time, bool liveTimeIsPerEvent)
Setter of effective P1 walltime represented by the current event, or the current lumi block.
Definition CostData.cxx:45
void setChainToUniqAlgMap(const std::map< std::string, std::set< size_t > > &algToChains)
Set the chain to its unique alg names map.
Definition CostData.cxx:110
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
Container which represents a time range and holds a collection of Monitors which monitor this range.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
static HLTHash string2hash(std::string_view, const std::string &category=s_defaultCategory)
hash function translating TE names into identifiers
static const std::string hash2string(HLTHash, const std::string &category=s_defaultCategory)
hash function translating identifiers into names (via internal dictionary)
static void file2hashes(const std::string &fileName="hashes2string.txt")
debugging output of internal dictionary
Gaudi::Property< bool > m_useEBWeights
uint32_t getOnlineSlot(const xAOD::TrigCompositeContainer *costCollection) const
Return the slot used to process the event online.
std::unordered_map< std::string, std::unique_ptr< MonitoredRange > > m_monitoredRanges
Owned storage of Ranges.
Gaudi::Property< bool > m_singleTimeRange
Gaudi::Property< std::set< std::string > > m_excludeAlgsFromChain
Gaudi::Property< std::vector< std::string > > m_additionalHashList
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_metadataDataKey
Gaudi::Property< bool > m_doMonitorAlgorithm
Gaudi::Property< bool > m_doMonitorChainAlgorithm
virtual StatusCode finalize() final
Currently a noop for this algorithm.
Gaudi::Property< float > m_baseEventWeight
TH1 * bookGetPointer(TH1 *hist, const std::string &tDir="") const
Public method forwarded to this class' AthHistogramAlgorithm::bookGetPointer base.
ServiceHandle< ITHistSvc > m_histSvc
Gaudi::Property< bool > m_doMonitorSequence
std::atomic< size_t > m_maxViewsNumber
What is the maximum number of View instances we've so far cached string hashes to cover?
virtual StatusCode start()
Retrieve menu handle.
virtual StatusCode execute(const EventContext &ctx) final
Monitor event, unless max range limit reached and event outside of all ranges.
void writeMetadata()
Write to outpute tree (if any) the metadata needed downstream.
ToolHandle< IEnhancedBiasWeighter > m_enhancedBiasTool
Gaudi::Property< size_t > m_maxFullEventDumps
Gaudi::Property< std::string > m_additionalHashMap
std::mutex m_addHostnameMutex
Mutex to update set below.
StatusCode getRange(const EventContext &context, MonitoredRange *&range)
Return or construct and return a Range for the Context.
std::unordered_map< uint32_t, std::string > m_algTypeMap
Cache of algorithm's type, read from configuration data.
Gaudi::Property< size_t > m_maxTimeRange
Gaudi::Property< bool > m_doMonitorThreadOccupancy
StatusCode registerMonitors(MonitoredRange *range)
Populate a newly minted Range object with all configured Monitors.
Gaudi::Property< bool > m_doMonitorGlobal
Gaudi::Property< size_t > m_TimeRangeLengthLB
StatusCode checkUpdateMaxView(const size_t max)
High watermark for pre-cached string hashes for the SLOT category.
virtual StatusCode initialize() final
Retrieve tools and initialise read handles.
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_costDataKey
TTree * m_metadataTree
Used to write out some metadata needed by post-processing (e.g.
TrigCostAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
Construct TrigCostAnalysis.
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
ToolHandle< TrigCompositeUtils::AlgToChainTool > m_algToChainTool
std::set< std::string > m_storeIdentifiers
Identifiers of object stores, needed to cache STORE string-hash values.
Gaudi::Property< bool > m_doMonitorChain
StatusCode dumpEvent(const EventContext &context) const
Dump event algorithm execution data in ASCII format.
Gaudi::Property< bool > m_doMonitorAlgorithmClass
Gaudi::Property< uint64_t > m_fullEventDumpProbability
std::atomic< size_t > m_fullEventDumps
Counter to keep track of how many events have been full-dumped.
Gaudi::Property< std::string > m_singleTimeRangeName
float getWeight(const EventContext &context)
Compute global event weight to correct for online prescales.
bool checkDoFullEventDump(const EventContext &context, const CostData &costData)
Check if event dumping should be performed for the current event.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.