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