ATLAS Offline Software
TrigCostAnalysis.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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  for (const std::string& chain : algToChain[algName]){
243  chainToAlgIdx[chain].insert(tc->index());
244  ++i;
245  }
246 
247  if (i == 1){
248  ATH_MSG_DEBUG("Algorithm " << algName << " executed uniquely for " << *algToChain[algName].begin() << " chain");
249  chainToUniqAlgs[*algToChain[algName].begin()].insert(tc->index());
250  }
251 
252  if (algToSeq.count(algName)){
253  const int16_t view = tc->getDetail<int16_t>("view");
254  seqToAlgIdx[algToSeq[algName]][view].insert(tc->index());
255  }
256  }
257 
258  const std::set<TrigCompositeUtils::DecisionID> seededChains = m_algToChainTool->retrieveActiveChains(context, "HLTNav_L1");
259  std::vector<TrigCompositeUtils::AlgToChainTool::ChainInfo> seededChainsInfo;
260 
261  // Skip empty events, where only cost chain was active
262  bool skipMonitoringThisEvent = false;
263  if ((seededChains.size() == 1 && seededChains.count(TrigConf::HLTUtils::string2hash("HLT_noalg_CostMonDS_L1All")))
264  || (seededChains.size() == 2 && seededChains.count(TrigConf::HLTUtils::string2hash("HLT_noalg_CostMonDS_L1All")) && seededChains.count(TrigConf::HLTUtils::string2hash("HLT_noalg_L1All"))) ){
265  skipMonitoringThisEvent = true;
266  }
267 
268  for (auto id : seededChains){
270  ATH_CHECK(m_algToChainTool->getChainInfo(context, id, chainInfo));
271  seededChainsInfo.push_back(chainInfo);
272  }
273 
274  const uint32_t onlineSlot = getOnlineSlot( costDataHandle.get() );
275  CostData costData;
276  ATH_CHECK( costData.set(costDataHandle.get(), rosDataHandle.get(), onlineSlot) );
277  costData.setCostROSData(m_costROSData);
278  costData.setChainToAlgMap(chainToAlgIdx);
279  costData.setChainToUniqAlgMap(chainToUniqAlgs);
280  costData.setSequencersMap(seqToAlgIdx);
281  costData.setSeededChains(seededChainsInfo);
282  costData.setLb( context.eventID().lumi_block() );
283  costData.setTypeMap( m_algTypeMap );
284  if (!m_enhancedBiasTool.name().empty() && !m_enhancedBiasTool->isMC()) {
285  double liveTime = m_enhancedBiasTool->getEBLiveTime(context);
286  bool liveTimeIsPerEvent = true;
287  if (liveTime == 0.0) { // Note: This comes from a direct "return 0.", hence no delta
288  liveTime = m_enhancedBiasTool->getLBLength(context);
289  liveTimeIsPerEvent = false;
290  }
291  costData.setLivetime( liveTime, liveTimeIsPerEvent );
292  }
293 
294  ATH_CHECK( range->newEvent( costData, getWeight(context), skipMonitoringThisEvent ) );
295 
296  if (checkDoFullEventDump(context, costData)) {
297  ATH_CHECK( dumpEvent(context) );
298  }
299 
300  return StatusCode::SUCCESS;
301 }
302 
303 
304 bool TrigCostAnalysis::checkDoFullEventDump(const EventContext& context, const CostData& costData) {
305  if (costData.isMasterSlot()
307  and context.eventID().event_number() % m_fullEventDumpProbability == 0)
308  {
310  return true;
311  }
312  return false;
313 }
314 
315 
317  ATH_CHECK(range != nullptr);
318  if (m_doMonitorAlgorithm) {
319  ATH_CHECK( range->addMonitor(std::make_unique<MonitorAlgorithm>("Algorithm_HLT", range)) );
320  ATH_MSG_DEBUG("Registering Algorithm_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
321  }
323  ATH_CHECK( range->addMonitor(std::make_unique<MonitorAlgorithmClass>("Algorithm_Class_HLT", range)) );
324  ATH_MSG_DEBUG("Registering Algorithm_Class_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
325  }
326  if (m_doMonitorGlobal) {
327  ATH_CHECK( range->addMonitor(std::make_unique<MonitorGlobal>("Global_HLT", range)) );
328  ATH_MSG_DEBUG("Registering Global_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
329  }
331  ATH_CHECK( range->addMonitor(std::make_unique<MonitorThreadOccupancy>("Thread_Occupancy_HLT", range)) );
332  ATH_MSG_DEBUG("Registering Thread_Occupancy_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
333  }
334  if (m_doMonitorROS) {
335  ATH_CHECK( range->addMonitor(std::make_unique<MonitorROS>("ROS_HLT", range)) );
336  ATH_MSG_DEBUG("Registering ROS_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
337  }
338  if (m_doMonitorChain) {
339  ATH_CHECK( range->addMonitor(std::make_unique<MonitorChain>("Chain_HLT", range)) );
340  ATH_MSG_DEBUG("Registering Chain_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
341  }
343  ATH_CHECK( range->addMonitor(std::make_unique<MonitorChainAlgorithm>("Chain_Algorithm_HLT", range)) );
344  ATH_MSG_DEBUG("Registering Chain_Algorihtm_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
345  }
346  if (m_doMonitorSequence) {
347  ATH_CHECK( range->addMonitor(std::make_unique<MonitorSequence>("Sequence_HLT", range)) );
348  ATH_MSG_DEBUG("Registering Sequence_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size());
349  }
350  // if (m_do...) {}
351 
352  // Set the verbosity for the monitors
353  for (const std::unique_ptr<MonitorBase>& monitor : range->getMonitors()){
354  monitor->msg().setLevel(msg().level());
355  }
356 
357  return StatusCode::SUCCESS;
358 }
359 
360 
362  std::string rangeName;
363  range = nullptr;
364  bool includeEndOfLB = false;
365 
366  if (m_singleTimeRange) {
367  rangeName = m_singleTimeRangeName;
368  } else {
369  const EventIDBase::number_type lumiBlock = context.eventID().lumi_block();
370  const size_t lumiBlockRangeStart = lumiBlock - (lumiBlock % m_TimeRangeLengthLB);
371  const size_t lumiBlockRangeStop = lumiBlockRangeStart + m_TimeRangeLengthLB - 1;
372  std::stringstream ss;
373  ss << "LumiBlock_" << std::setfill('0') << std::setw(5) << lumiBlockRangeStart;
374  if (includeEndOfLB && lumiBlockRangeStop != lumiBlockRangeStart) {
375  ss << "_" << lumiBlockRangeStop;
376  }
377  rangeName = ss.str();
378  }
379 
380  std::unordered_map<std::string, std::unique_ptr<MonitoredRange>>::iterator it;
381  it = m_monitoredRanges.find(rangeName);
382 
383  // If we don't have a MonitoredRange with this name, try and make one.
384  if (it == m_monitoredRanges.end()) {
385  if (m_monitoredRanges.size() < m_maxTimeRange) {
386  auto result = m_monitoredRanges.insert(
387  std::make_pair(rangeName, std::make_unique<MonitoredRange>(rangeName, this))
388  );
389  it = result.first; // Returns pair. First: map iterator. Second: insertion boolean
390  ATH_CHECK(registerMonitors( it->second.get() ));
391  } else {
392  range = nullptr; // Not monitoring any more ranges
393  return StatusCode::SUCCESS;
394  }
395  }
396 
397  range = it->second.get(); // Pointer to MonitoredRange
398  return StatusCode::SUCCESS;
399 }
400 
402  // Online, Slot 0 can be configured as the master-slot. In this mode, events in Slot 0
403  // hoover up data about algorithm executions in other slots too.
404  // This all-slots data stored in the master slot is exploited by dumpEvent, and some specialist monitors.
405  // Other monitors will want to avoid it for fear of double-counting
406  if (costCollection->size() == 0) {
407  return 0;
408  }
409  const uint32_t initialSlot = costCollection->at(0)->getDetail<uint32_t>("slot");
410  for ( const xAOD::TrigComposite* tc : *costCollection ) {
411  const uint32_t algSlot = tc->getDetail<uint32_t>("slot");
412  if (algSlot == 0 or algSlot != initialSlot) {
413  return 0; // If we see a zero, or two different slot numbers, then we're in the master slot
414  }
415  }
416  // If we saw exclusivly one non-zero slot, then we're in that slot
417  return initialSlot;
418 }
419 
420 
421 StatusCode TrigCostAnalysis::dumpEvent(const EventContext& context) const {
424 
425  std::stringstream ss;
426  size_t algID = 0;
427 
428  for ( const xAOD::TrigComposite* tc : *costDataHandle ) {
429  const uint64_t start = tc->getDetail<uint64_t>("start"); // in mus
430  const uint64_t stop = tc->getDetail<uint64_t>("stop"); // in mus
431  const uint32_t slot = tc->getDetail<uint32_t>("slot");
432  const uint64_t start_ms_round = std::llround( start * 1e-3 ); // in ms
433  const uint64_t stop_ms_round = std::llround( stop * 1e-3 ); // in ms
434  const uint32_t threadID = tc->getDetail<uint32_t>("thread");
435 
436  ss << "{id:" << algID++;
437  ss << ", group:" << threadID;
438  ss << ", className:'slot" << slot << "'";
439  ss << ", content:'" << TrigConf::HLTUtils::hash2string( tc->getDetail<TrigConf::HLTHash>("alg"), "ALG");
440  ss << "<br>" << TrigConf::HLTUtils::hash2string( tc->getDetail<TrigConf::HLTHash>("store"), "STORE") << "'";
441  ss << ", duration:" << (stop - start); // For tooltip display: in mus
442  ss << ", start:" << start_ms_round; // in ms
443  if (stop_ms_round > start_ms_round) {
444  ss << ", end:" << stop_ms_round;
445  } else {
446  ss << ", type:'point'";
447  }
448  ss << "}," << std::endl;
449  }
450 
451  ATH_MSG_DEBUG("Full Event Summary for event " << context.eventID().event_number());
452  ATH_MSG_DEBUG(ss.str());
453  // TODO Persist this
454 
455  return StatusCode::SUCCESS;
456 }
457 
458 
460  ATH_MSG_VERBOSE("In finalize()");
461 
462  writeMetadata();
463  return StatusCode::SUCCESS;
464 }
465 
466 
468  if (!m_metadataTree) {
469  return;
470  }
471 
472  auto runNumber = m_enhancedBiasTool->getRunNumber();
473  m_metadataTree->Branch("runNumber", &runNumber);
474 
475  std::string hostnamesList = "";
476  if (m_hostnames.size() > 1){
477  ATH_MSG_DEBUG("Found many hostnames for this run");
478  for (const auto& name : m_hostnames) hostnamesList += name + ",";
479  hostnamesList.pop_back();
480  } else if (m_hostnames.size() == 1) {
481  hostnamesList = *m_hostnames.begin();
482  }
483  m_metadataTree->Branch("hostname", &hostnamesList);
484 
486  std::string menuStr;
487  if ( hltMenuHandle.isValid() ){
488  std::stringstream ss;
489  boost::property_tree::json_parser::write_json(ss, hltMenuHandle->data());
490  menuStr = ss.str();
491  m_metadataTree->Branch("HLTMenu", &menuStr);
492  }
493 
494  bool ChainMonitor = (const bool&) m_doMonitorChain;
495  bool ChainAlgorithmMonitor = (const bool&) m_doMonitorChainAlgorithm;
496  bool AlgorithmMonitor = (const bool&) m_doMonitorAlgorithm;
497  bool AlgorithmClassMonitor = (const bool&) m_doMonitorAlgorithmClass;
498  bool ROSMonitor = (const bool&) m_doMonitorROS;
499  bool GlobalsMonitor = (const bool&) m_doMonitorGlobal;
500  bool ThreadMonitor = (const bool&) m_doMonitorThreadOccupancy;
501 
502  m_metadataTree->Branch("ChainMonitor", &ChainMonitor);
503  m_metadataTree->Branch("ChainAlgorithmMonitor", &ChainAlgorithmMonitor);
504  m_metadataTree->Branch("AlgorithmMonitor", &AlgorithmMonitor);
505  m_metadataTree->Branch("AlgorithmClassMonitor", &AlgorithmClassMonitor);
506  m_metadataTree->Branch("ROSMonitor", &ROSMonitor);
507  m_metadataTree->Branch("GlobalsMonitor", &GlobalsMonitor);
508  m_metadataTree->Branch("ThreadMonitor", &ThreadMonitor);
509 
510  float BaseEventWeight = (const float&) m_baseEventWeight;
511  std::string AdditionalHashMap = (const std::string&) m_additionalHashMap;
512  bool DoEBWeighting = (const bool&) m_useEBWeights;
513 
514  m_metadataTree->Branch("AdditionalHashMap", &AdditionalHashMap);
515  m_metadataTree->Branch("DoEBWeighting", &DoEBWeighting);
516  m_metadataTree->Branch("BaseEventWeight", &BaseEventWeight);
517 
518  std::string atlasProject = std::getenv("AtlasProject");
519  std::string atlasVersion = std::getenv("AtlasVersion");
520  m_metadataTree->Branch("AtlasProject", &atlasProject);
521  m_metadataTree->Branch("AtlasVersion", &atlasVersion);
522 
523 
524  std::string processedRanges;
525  if (m_singleTimeRange){
526  processedRanges = m_singleTimeRangeName;
527  }
528  else {
529  std::stringstream ss;
530  for(const auto& rangePair : m_monitoredRanges){
531  ss << rangePair.first << ": ";
532  std::string lbrange = rangePair.first.substr(strlen("LumiBlock_"));
533  ss << " Lumiblocks " << std::stoi(lbrange) << " to " << std::stoi(lbrange) + m_TimeRangeLengthLB << ", ";
534  }
535  processedRanges = ss.str();
536  ATH_MSG_INFO("Processed ranges: " << processedRanges);
537  }
538 
539  m_metadataTree->Branch("ProcessedRanges", &processedRanges);
540 
541  m_metadataTree->Fill();
542 }
TrigCostAnalysis::finalize
virtual StatusCode finalize() final
Currently a noop for this algorithm.
Definition: TrigCostAnalysis.cxx:459
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
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
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:138
TrigCostAnalysis::m_fullEventDumps
std::atomic< size_t > m_fullEventDumps
Counter to keep track of how many events have been full-dumped.
Definition: TrigCostAnalysis.h:217
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:141
TrigCostAnalysis::m_storeIdentifiers
std::set< std::string > m_storeIdentifiers
Identifiers of object stores, needed to cache STORE string-hash values.
Definition: TrigCostAnalysis.h:214
SGout2dot.alg
alg
Definition: SGout2dot.py:243
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:218
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
max
#define max(a, b)
Definition: cfImp.cxx:41
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:467
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:401
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:70
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:396
AtlasMcWeight::number_type
unsigned int number_type
Definition: AtlasMcWeight.h:20
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
TrigCostAnalysis::m_algTypeMap
std::unordered_map< uint32_t, std::string > m_algTypeMap
Cache of algorithm's type, read from configuration data.
Definition: TrigCostAnalysis.h:213
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
TrigCostAnalysis::m_algToChainTool
ToolHandle< TrigCompositeUtils::AlgToChainTool > m_algToChainTool
Definition: TrigCostAnalysis.h:153
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:150
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:219
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:222
calibdata.exception
exception
Definition: calibdata.py:496
TrigCostAnalysis::m_metadataTree
TTree * m_metadataTree
Used to write out some metadata needed by post-processing (e.g.
Definition: TrigCostAnalysis.h:215
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
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:52
TrigCompositeUtils::AlgToChainTool::ChainInfo
Definition: AlgToChainTool.h:29
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:20
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:316
TrigCostAnalysis::m_monitoredRanges
std::unordered_map< std::string, std::unique_ptr< MonitoredRange > > m_monitoredRanges
Owned storage of Ranges.
Definition: TrigCostAnalysis.h:212
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:221
python.output.AtlRunQueryRoot.lbrange
lbrange
Definition: AtlRunQueryRoot.py:989
TrigCostAnalysis::m_metadataDataKey
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_metadataDataKey
Definition: TrigCostAnalysis.h:144
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)
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:431
TrigCostAnalysis::start
virtual StatusCode start()
Retrieve menu handle.
Definition: TrigCostAnalysis.cxx:74
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
TrigCostAnalysis::m_HLTMenuKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_HLTMenuKey
Definition: TrigCostAnalysis.h:147
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:327
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:30
TrigCostAnalysis::getRange
StatusCode getRange(const EventContext &context, MonitoredRange *&range)
Return or construct and return a Range for the Context.
Definition: TrigCostAnalysis.cxx:361
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:421
TrigCostAnalysis::checkDoFullEventDump
bool checkDoFullEventDump(const EventContext &context, const CostData &costData)
Check if event dumping should be performed for the current event.
Definition: TrigCostAnalysis.cxx:304
drawFromPickle.view
view
Definition: drawFromPickle.py:294