ATLAS Offline Software
ManagedMonitorToolBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ManagedMonitorToolBase_CXX
6 #define ManagedMonitorToolBase_CXX
7 
9 
10 #include <cctype>
11 #include <ctime>
12 #include <sstream>
13 
14 #include "TGraph.h"
15 #include "TH1.h"
16 #include "TH2.h"
17 #include "TTree.h"
18 #include "TROOT.h"
19 #include "TFile.h"
20 #include "TEfficiency.h"
21 #include "AthMonBench.h"
23 
24 #include "Gaudi/Interfaces/IOptionsSvc.h"
25 #include "GaudiKernel/IHistogramSvc.h"
26 #include "GaudiKernel/IMessageSvc.h"
27 #include "GaudiKernel/ISvcLocator.h"
28 #include "GaudiKernel/MsgStream.h"
29 
32 #include "GaudiKernel/ITHistSvc.h"
33 
34 
35 //____________________________________________________________________
37 public:
38  inline static std::atomic<ISvcLocator*> s_svcLocator{nullptr};
41  m_doResourceMon(false),
43  ~Imp() {}
44 
45  //Data members:
47  //To warn against clients that reimplemented initialize without calling ManagedMonitorToolBase::initialze():
49 
50  //Internal methods and data members for detailed CPU/mem monitoring:
66  void benchFinalReport();
67  void benchReset();
68 };
69 
73 
74 //____________________________________________________________________
76 {
77  if (!m_doResourceMon)
78  return;
79  benchReset();
81 }
82 
83 //____________________________________________________________________
85 {
86  if (!m_doResourceMon)
87  return;
88  m_bench_book.finishMeasurement();
89  m_bench_total += m_bench_book;
90  m_benchNFillAfterbook = 0;
91 }
92 
93 //____________________________________________________________________
95 {
96  if (!m_doResourceMon)
97  return;
98  m_bench_tmp.reset();
99  m_bench_tmp.startMeasurement();
100 }
101 
102 //____________________________________________________________________
104 {
105  if (!m_doResourceMon)
106  return;
107  m_bench_tmp.finishMeasurement();
108  m_bench_total += m_bench_tmp;
109  ++m_benchNFillAfterbook;
110  if (m_benchNFillAfterbook==1) {
111  m_bench_fillfirst = m_bench_tmp;
112  } else {
113  m_bench_fillall += m_bench_tmp;
114  m_bench_filllast = m_bench_tmp;
115  }
116 }
117 
118 //____________________________________________________________________
120 {
121  if (!m_doResourceMon)
122  return;
123  m_bench_proc.startMeasurement();
124 }
125 
126 //____________________________________________________________________
128 {
129  if (!m_doResourceMon)
130  return;
131  m_bench_proc.finishMeasurement();
132  m_bench_total += m_bench_proc;
133  m_bench_fillall -= m_bench_filllast;
134  m_benchNFillAfterbook = 0;
135  benchFinalReport();
136  benchReset();
137 }
138 
139 //____________________________________________________________________
141 {
142  if (!m_doResourceMon)
143  return;
144  m_benchNFillAfterbook = 0;
145  m_bench_tmp.reset();
146  m_bench_book.reset();
147  m_bench_fillfirst.reset();
148  m_bench_fillall.reset();
149  m_bench_filllast.reset();
150  m_bench_proc.reset();
151  m_bench_total.reset();
152 
153 }
154 
155 //____________________________________________________________________
157 {
158  if (!m_doResourceMon)
159  return;
160  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> Result of dedicated mon-tool resource monitoring:"<<endmsg;
161  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> Book : "<<m_bench_book << endmsg;
162  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> First Fill : "<<m_bench_fillfirst << endmsg;
163  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> Last Fill : "<<m_bench_filllast << endmsg;
164  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> Other Fills : "<<m_bench_fillall << endmsg;
165  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> Proc : "<<m_bench_proc << endmsg;
166  m_bench_total.setUnitCount();//to avoid dividing by number of measurements
167  m_theclass->msg(AthMonBench::s_resourceMonThreshold) << "ResourceSummary --> Grand Total : "<<m_bench_total << endmsg;
168  //NB: Needs total also!
169 }
170 
171 
172 
176 
177 namespace {
178 
179  std::string strToLower( const std::string& str );
180 
181 } // unnamed namespace
182 
183 static std::atomic<unsigned> s_mmtb_mongroup_ncopies=0;
184 unsigned ManagedMonitorToolBase::MonGroup::ncopies() { return s_mmtb_mongroup_ncopies; }
185 void ManagedMonitorToolBase::MonGroup::badusage() { ++s_mmtb_mongroup_ncopies; }
186 
187 // *********************************************************************
188 // Public Methods
189 // *********************************************************************
192 regHist( TH1* h )
193 {
194  if( m_tool != 0 ) {
195  std::string hName( h->GetName() );
196  HistMap_t::value_type valToInsert( hName, h );
197  m_map.insert( valToInsert );
198  return m_tool->regHist( h, *this );
199  }
200 
201  return StatusCode::FAILURE;
202 }
203 
206 getHist( TH1*& h, const std::string& hName )
207 {
208  if( m_tool != 0 ) {
209  return m_tool->getHist( h, hName, *this );
210  }
211 
212  return StatusCode::FAILURE;
213 }
214 
215 
218 getHist( TH2*& h, const std::string& hName )
219 {
220  if( m_tool != 0 ) {
221  return m_tool->getHist( h, hName, *this );
222  }
223 
224  return StatusCode::FAILURE;
225 }
226 
227 
229  if( m_tool != 0 ) {
230  return m_tool->regEfficiency( e, *this );
231  }
232  return StatusCode::FAILURE;
233 }
234 
235 
238 regGraph( TGraph* g )
239 {
240  if( m_tool != 0 ) {
241  return m_tool->regGraph( g, *this );
242  }
243 
244  return StatusCode::FAILURE;
245 }
246 
247 
250 regTree( TTree* t )
251 {
252  if( m_tool != 0 ) {
253  return m_tool->regTree( t, *this );
254  }
255 
256  return StatusCode::FAILURE;
257 }
258 
259 
262 writeAndDelete( TH1* h )
263 {
264  if( m_tool != 0 ) {
265  std::string hName( h->GetName() );
266  m_map.erase( hName );
267  return m_tool->writeAndDelete( h, *this );
268  }
269 
270  return StatusCode::FAILURE;
271 }
272 
273 
276 deregHist( TH1* h )
277 {
278  if( m_tool != 0 ) {
279  std::string hName( h->GetName() );
280  m_map.erase( hName );
281  return m_tool->deregHist( h );
282  }
283 
284  return StatusCode::FAILURE;
285 }
286 
287 
290 deregGraph( TGraph* g )
291 {
292  if( m_tool != 0 ) {
293  return m_tool->deregGraph( g );
294  }
295 
296  return StatusCode::FAILURE;
297 }
298 
299 
302 deregObject( const std::string& objName )
303 {
304  if( m_tool != 0 ) {
305  return m_tool->deregObject( objName, *this );
306  }
307 
308  return StatusCode::FAILURE;
309 }
310 
311 
314 deregAll()
315 {
316  if( m_tool != 0 ) {
317  bool isSuccess(true);
318  StatusCode sc;
319 
320  typedef HistMap_t::const_iterator MapIter_t;
321  MapIter_t mapEnd = m_map.end();
322  for( MapIter_t i = m_map.begin(); i != mapEnd; ++i ) {
323  sc = m_tool->deregHist( i->second );
324  if( !sc.isSuccess() )
325  isSuccess = false;
326  }
327 
328  m_map.clear();
329 
330  if( isSuccess )
331  return StatusCode::SUCCESS;
332  }
333 
334  return StatusCode::FAILURE;
335 }
336 
337 
339 ManagedMonitorToolBase( const std::string & type, const std::string & name,
340  const IInterface* parent )
341  : AthAlgTool( type, name, parent )
342  , m_manager(0)
343  , m_managerNameProp("AthenaMonManager")
344  , m_fileKey("")
345  , m_dataTypeStr("userDefined")
346  , m_environmentStr("noOutput")
347  , m_detailLevel(1)
348  , m_dataType(AthenaMonManager::userDefined)
350  , m_streamNameFcn(0)
351  , m_THistSvc("THistSvc",name)
352  , m_procNEventsProp(0)
353  , m_path("")
354  , m_preScaleProp(0)
355  , m_triggerChainProp("")
356  , m_triggerGroupProp("")
357  , m_useTrigger(false)
358  , m_lastLumiBlock(0)
359  , m_lastRun(0)
363  , m_nEvents(1)
365  , m_nLumiBlocks(1)
367  , m_bookHistogramsInitial(false)
368  , m_useLumi(false)
369  , m_defaultLBDuration(60.)
370  , m_d(new Imp(this))
371 {
372 // ManagedMonitorToolBase_resetHistStatistics(this);
373  declareInterface<IMonitorToolBase>(this);
374  declareProperty( "ProcessNEvents", m_procNEventsProp );
375  declareProperty( "histoPathBase", m_path );
376  declareProperty( "PreScale", m_preScaleProp );
377  declareProperty( "TriggerChain", m_triggerChainProp );
378  declareProperty( "TriggerGroup", m_triggerGroupProp );
379 
380  // If a class would like to associate itself to a manager but cannot actually
381  // be referenced by it, the manager name can be set explicitly. Otherwise,
382  // it is set automatically.
383  declareProperty( "ManagerName", m_managerNameProp );
384 
385  // Enable luminosity tool?
386  declareProperty( "EnableLumi", m_useLumi );
387 
388  // How detailed should the monitoring be?
389  declareProperty( "DetailLevel", m_detailLevel );
390 
391  // If we don't know how long an LB is, here's the default
392  declareProperty( "DefaultLBDuration", m_defaultLBDuration );
393 
394  // Properties that are overridden in initialize()---settings via jobOptions are ignored!
395  declareProperty( "FileKey", m_fileKey );
396  declareProperty( "DataType", m_dataTypeStr );
397  declareProperty( "Environment", m_environmentStr );
398 
399  if( !Imp::s_svcLocator )
400  Imp::s_svcLocator = svcLoc();
401 
402  for (auto interval: { eventsBlock, lumiBlock, lowStat, run, all }) {
403  m_templateHistograms[interval] = std::vector< MgmtParams<TH1> >();
404  m_templateGraphs[interval] = std::vector< MgmtParams<TGraph> >();
405  m_templateTrees[interval] = std::vector< MgmtParams<TTree> >();
407  }
408 
409  newLowStatInterval = false;
410  newMedStatInterval = false;
411  newHigStatInterval = false;
412  newLowStat = false;
413  newLumiBlock = false;
414  newRun = false;
415  newEventsBlock = false;
416  endOfEventsBlock = false;
417  endOfLowStat = false;
418  endOfLumiBlock = false;
419  endOfRun = false;
420 
421  m_newLowStatInterval = false;
422  m_newMedStatInterval = false;
423  m_newHigStatInterval = false;
424  m_newLowStat = false;
425  m_newLumiBlock = false;
426  m_newRun = false;
427  m_newEventsBlock = false;
428  m_endOfEventsBlock = false;
429  m_endOfLowStat = false;
430  m_endOfLumiBlock = false;
431  m_endOfRun = false;
432 }
433 
434 
437 {
438 // ManagedMonitorToolBase_printHistStatistics(this);
439  delete m_streamNameFcn;
440 
443  i != mdend; ++i ) {
444  delete (i->second);
445  }
446  delete m_d;
447 }
448 
449 
453 {
454  if( m_streamNameFcn == 0 ) {
455  msg(MSG::ERROR) << "!! streamNameFunction() has not been initialized !!" << endmsg;
456  msg(MSG::ERROR) << " --> neither ManagedMonitorToolBase::initialize() nor" << endmsg;
457  msg(MSG::ERROR) << " --> ManagedMonitorToolBase::setMonManager() has been called." << endmsg;
458  msg(MSG::ERROR) << " --> Correct configuration cannot be guaranteed from this point." << endmsg;
460  }
461  return m_streamNameFcn;
462 }
463 
464 
465 /*
466 std::string
467 ManagedMonitorToolBase::
468 levelOfDetailEnumToString( LevelOfDetail_t level, bool useOnlineConventions )
469 {
470  std::string str("summary");
471 
472  switch( level ) {
473  case transient:
474  str = "transient";
475  break;
476  case debug:
477  str = "debug";
478  break;
479  case expert:
480  str = "expert";
481  break;
482  case shift:
483  str = "shift";
484  break;
485  case summary:
486  default:
487  if(useOnlineConventions)
488  str = "runstat";
489  else
490  str = "summary";
491  }
492 
493  if(useOnlineConventions)
494  str = strToUpper( str );
495 
496  return str;
497 }
498 */
499 
500 /*
501 ManagedMonitorToolBase::LevelOfDetail_t
502 ManagedMonitorToolBase::
503 levelOfDetailStringToEnum( const std::string& str )
504 {
505  std::string lcstr( strToLower(str) );
506 
507  if( lcstr == "summary" || lcstr == "runstat" )
508  return summary;
509  else if( lcstr == "shift" )
510  return shift;
511  else if( lcstr == "expert" )
512  return expert;
513  else if( lcstr == "debug" )
514  return debug;
515  else if( lcstr == "transient" )
516  return transient;
517 
518  // This is a static method (shared by all instances), so no "this" pointer
519  // is available (needed for msg). Have to use message service directly.
520  if( Imp::s_svcLocator!=0 ) {
521  IMessageSvc* ms(0);
522  StatusCode sc = Imp::s_svcLocator->service( "MessageSvc", ms, true );
523  if( sc.isSuccess() ) {
524  MsgStream log( ms, "ManagedMonitorToolBase::levelOfDetailStringToEnum()" );
525  log << MSG::WARNING << "Unknown ManagedMonitorToolBase::LevelOfDetail_t \""
526  << str << "\", returning \"transient\"" << endmsg;
527  }
528  }
529 
530  return transient;
531 }
532 */
533 
534 
535 std::string
538 {
539  std::string str("file");
540 
541  switch( interval ) {
542  case all:
543  str = "all";
544  break;
545  case fill:
546  str = "fill";
547  break;
548  case run:
549  str = "run";
550  break;
551  case lowStat:
552  str = "lowStat";
553  break;
554  case medStat:
555  str = "medStat";
556  break;
557  case higStat:
558  str = "higStat";
559  break;
560  case lumiBlock:
561  str = "lumiBlock";
562  break;
563  case eventsBlock:
564  str = "eventsBlock";
565  break;
566  case file:
567  str = "file";
568  break;
569  default:
570  str = "unknown";
571  }
572 
573  return str;
574 }
575 
576 
579 intervalStringToEnum( const std::string& str )
580 {
581  std::string lcstr( strToLower(str) );
582 
583  if( lcstr == "all" )
584  return all;
585  else if( lcstr == "fill" )
586  return fill;
587  else if( lcstr == "run" )
588  return run;
589  else if( lcstr == "lowStat" )
590  return lowStat;
591  else if( lcstr == "medStat" )
592  return medStat;
593  else if( lcstr == "higStat" )
594  return higStat;
595  else if( lcstr == "lumiBlock" )
596  return lumiBlock;
597  else if( lcstr == "eventsBlock" )
598  return eventsBlock;
599  else if( lcstr == "file" )
600  return file;
601 
602  if( Imp::s_svcLocator ) {
603  SmartIF<IMessageSvc> ms{Imp::s_svcLocator.load()->service( "MessageSvc" )};
604  if( ms.isValid() ) {
605  MsgStream log( ms, "ManagedMonitorToolBase::intervalStringToEnum()" );
606  log << MSG::WARNING << "Unknown ManagedMonitorToolBase::Interval_t \""
607  << str << "\", returning \"file\"" << endmsg;
608  }
609  }
610 
611  return file;
612 }
613 
614 
617 initialize()
618 {
620 
622  if( !sc.isSuccess() )
623  return StatusCode::FAILURE;
624 
625  ATH_MSG_DEBUG("ManagedMonitorToolBase::initialize():");
626 
628 
629  sc = m_THistSvc.retrieve();
630  if( !sc.isSuccess() ) {
631  msg(MSG::ERROR) << "!! Unable to locate the THistSvc service !!" << endmsg;
632  return sc;
633  }
634  ATH_MSG_DEBUG(" --> Found service \"THistSvc\"");
635 
636  if( !m_trigDecTool.empty() ) {
637  sc = m_trigDecTool.retrieve();
638  if( !sc.isSuccess() ) {
639  msg(MSG::ERROR) << "!! Unable to retrieve the TrigDecisionTool !!" << endmsg;
640  return sc;
641  }
642  ATH_MSG_DEBUG(" --> Found AlgTool \"TrigDecisionTool\"");
643 
644  if( !m_trigTranslator.empty() ) {
645  sc = m_trigTranslator.retrieve();
646  if ( !sc.isSuccess() ) {
647  ATH_MSG_ERROR(" Unable to retrieve the TrigTranslatorTool!" << endmsg);
648  return sc;
649  }
650  }
651 
652  if(m_triggerChainProp!="") {
653  ATH_MSG_DEBUG(" --> Found nonempty trigger chain list");
655  if(!sc.isSuccess()) {
656  msg(MSG::WARNING) << "Error parsing the trigger chain list, using empty list" << endmsg;
657  m_vTrigChainNames.clear();
658  }
659  if (!m_trigTranslator.empty()) {
661  }
662  }
663  else {
664  ATH_MSG_DEBUG(" --> trigger chain list empty");
665  }
666  if(m_triggerGroupProp!="") {
667  ATH_MSG_DEBUG(" --> Found nonempty trigger group list");
669  if(!sc.isSuccess()) {
670  msg(MSG::WARNING) << "Error parsing the trigger group names list, using empty list" << endmsg;
671  m_vTrigGroupNames.clear();
672  }
673  if (!m_trigTranslator.empty()) {
675  }
676  }
677  else {
678  ATH_MSG_DEBUG(" --> trigger group list empty");
679  }
680  }
681  else {
682  ATH_MSG_DEBUG(" --> no trigger decision tool specified");
683  }
684 
685  sc = m_DQFilterTools.retrieve();
686  if( !sc.isSuccess() ) {
687  ATH_MSG_ERROR("!! Unable to retrieve the Filter Tools !!");
688  return sc;
689  }
690 
691  ServiceHandle<Gaudi::Interfaces::IOptionsSvc> joSvc( "JobOptionsSvc", name() );
692  ATH_CHECK( joSvc.retrieve() );
693  ATH_MSG_DEBUG(" --> Found service \"JobOptionsSvc\"");
694 
695  const std::string client( m_managerNameProp + "Properties" );
696  ATH_MSG_DEBUG(" --> Asking for properties " << client);
697 
698  auto getProp = [this,joSvc](std::string& var, const std::string& name) {
699  if (joSvc->has(name))
700  var = joSvc->get(name);
701  else
702  ATH_MSG_DEBUG("Cannot read " << name); // on purpose not an ERROR (will be set by setMonManager)
703  };
704  getProp( m_fileKey, client + ".FileKey");
705  getProp( m_dataTypeStr, client + ".DataType");
706  getProp( m_environmentStr, client + ".Environment");
707 
708  ATH_MSG_DEBUG(" * Properties set from " << client << " to the values:\n"
709  << " FileKey: " << m_fileKey << "\n"
710  << " DataType: " << m_dataTypeStr << "\n"
711  << " Environment: " << m_environmentStr);
712 
715 
719 
720  delete m_streamNameFcn;
722 
723  ATH_MSG_DEBUG(" --> Exiting successfully");
724 
725  return StatusCode::SUCCESS;
726 }
727 
728 
731 bookHists()
732 {
733  // The Run/LumiBlock numbers are not set when beginRun() is called. Therefore,
734  // book histograms on the first call to fillHists(), which is called from execute().
735  return StatusCode::SUCCESS;
736 }
737 
738 
741 fillHists()
742 {
743 
746  msg(MSG::WARNING) << "ManagedMonitorToolBase::initialize() never called from reimplementation!" << endmsg;
747  }
748 
749 
750  bool isNewEventsBlock = ( m_procNEventsProp > 0 && ((m_nEvents % m_procNEventsProp) == 1) && m_haveClearedLastEventBlock );
751  if (isNewEventsBlock) m_haveClearedLastEventBlock = false;
752 
753  m_newLowStat = false;
754  m_newLumiBlock = false;
755  m_newRun = false;
756  newLowStat = false;
757  newLumiBlock = false;
758  newRun = false;
759 
760  m_newLowStatInterval = false;
761  m_newMedStatInterval = false;
762  m_newHigStatInterval = false;
763  newLowStatInterval = false;
764  newMedStatInterval = false;
765  newHigStatInterval = false;
766 
767  m_useTrigger = ( (m_triggerChainProp != "" || m_triggerGroupProp != "") && (!m_trigDecTool.empty()) );
768 
769  if( m_manager != 0 ) {
772  newLumiBlock = m_newLumiBlock;
773  newRun = m_newRun;
774 
775  if(m_newRun) {
776  m_newLumiBlock = true;
777  newLumiBlock = m_newLumiBlock;
778  isNewEventsBlock = true;
779  }
780 
781  m_newEventsBlock = isNewEventsBlock;
782  newEventsBlock = m_newEventsBlock;
783 
784  if( m_newLumiBlock ) {
785  // check if a new LB interval has started
786  // lowest lumiBlockNumber() is 1
787  // m_lastLowStatInterval is -1 initially
788  int currentLB = m_manager->lumiBlockNumber();
789  int LBsLowStat = m_manager->getLBsLowStat();
790  int LBsMedStat = m_manager->getLBsMedStat();
791  int LBsHigStat = m_manager->getLBsHigStat();
792 
793  if( LBsLowStat*LBsMedStat*LBsHigStat == 0) {
794  msg(MSG::WARNING) << "zero LBs requested for interval" << endmsg;
795  }
796  else {
797  if( ((currentLB-1)/LBsLowStat) != m_lastLowStatInterval ) m_newLowStatInterval = true;
798  if( ((currentLB-1)/LBsMedStat) != m_lastMedStatInterval ) m_newMedStatInterval = true;
799  if( ((currentLB-1)/LBsHigStat) != m_lastHigStatInterval ) m_newHigStatInterval = true;
800  newLowStatInterval = m_newLowStatInterval;
801  newMedStatInterval = m_newHigStatInterval;
802  newHigStatInterval = m_newHigStatInterval;
803  }
804  }
805 
806  // Allow inheriting classes the option of using the lastLumiBloc/lastRun values
807  // before updating them
808  }
809 
810 
811  StatusCode sc0( StatusCode::SUCCESS );
812  StatusCode sc1( StatusCode::SUCCESS );
813  StatusCode sc2( StatusCode::SUCCESS );
814  StatusCode sc3( StatusCode::SUCCESS );
815 
816  // Set end of LowStat, LumiBlock and Run variables
817  // These are needed to be used in procHistograms().
822  endOfEventsBlock = m_newEventsBlock;
823  endOfLowStat = m_newLowStatInterval;
824  endOfLumiBlock = m_newLumiBlock;
825  endOfRun = m_newRun;
826 
827  // just duplicates m_newLowStatInterval
829  newLowStat = m_newLowStatInterval;
830 
832  ATH_MSG_DEBUG("Interval transition processing");
833  // Process histograms from the previous lumiBlock/run
834  if( m_nEvents != 1 ) {
836  sc0 = procHistograms();
838  }
839  // Re-book new histograms
841 
843  sc1 = bookHistograms();
845  } else {
846  std::vector<Interval_t> intervals_to_process;
847  if (m_newEventsBlock) intervals_to_process.push_back(eventsBlock);
848  if (m_newLumiBlock) intervals_to_process.push_back(lumiBlock);
849  if (m_newLowStatInterval) intervals_to_process.push_back(lowStat);
850  if (m_newRun) intervals_to_process.push_back(run);
851  for (const auto interval: intervals_to_process) {
855  }
856  }
857  for (const auto& interval: std::vector<Interval_t>{ eventsBlock, lumiBlock, lowStat, run }) {
858  for (const auto& it: m_templateHistograms[interval]) {
859  // is histogram too small in x axis for LB range?
860  if (it.m_group.histo_mgmt() == ATTRIB_X_VS_LB) {
861  //ATH_MSG_WARNING("We are rebinning for " << it.m_templateHist->GetName());
862  while ( it.m_templateHist->GetXaxis()->GetXmax() <= AthenaMonManager::lumiBlockNumber() ) {
863  it.m_templateHist->LabelsInflate("X");
864  }
865  }
866  }
867  for (auto& it: m_templateEfficiencies[interval]) {
868  if (it.m_group.histo_mgmt() == ATTRIB_X_VS_LB) {
869  // get the underlying passed and total TH1's from the TEfficiency
870  TH1* passedHist = it.m_templateHist->GetCopyPassedHisto();
871  TH1* totalHist = it.m_templateHist->GetCopyTotalHisto();
872  // inflate them until they exceed the lumi-block number
873  while (passedHist->GetXaxis()->GetXmax() <= AthenaMonManager::lumiBlockNumber() ) {
874  passedHist->LabelsInflate("X");
875  totalHist->LabelsInflate("X");
876  }
877  // Replace them in the TEfficiency. First one has force ("f") option, since the
878  // histograms will not be consistent. This is corrected in the next line, so we
879  // do check for consistency then.
880  it.m_templateHist->SetPassedHistogram(*passedHist, "f");
881  it.m_templateHist->SetTotalHistogram(*totalHist, " ");
882  delete passedHist; // not owned by THistSvc, so need to be deleted.
883  delete totalHist;
884  }
885  }
886  }
887 
888  if (auto streamname = dynamic_cast<OfflineStream*>(streamNameFunction())) {
889  streamname->updateRunLB();
890  }
891 
892  sc3 = bookHistogramsRecurrent( );
893 
895 
896  }//end if new RUN/LB/Block
897 
898  // check filters
899  bool filterresult(true);
900  if (! m_DQFilterTools.empty()) {
901  ToolHandleArray<IDQFilterTool>::const_iterator ifilter(m_DQFilterTools.begin()), filterend(m_DQFilterTools.end());
902  for (; filterresult && (ifilter != filterend);
903  ++ifilter) {
904  filterresult = (filterresult && (*ifilter)->accept());
905  }
906  }
907 
908 
909  // ...and fill as normal
910  if(filterresult &&
911  (!m_useTrigger
914  ATH_MSG_DEBUG("Passed trigger, presumably");
916  fillHistograms().ignore();
919  ++m_nEvents;
920  } else { ATH_MSG_DEBUG("Failed trigger, presumably"); }
921 
923  if( m_newLumiBlock && (m_nEventsIgnoreTrigger != 1) ) {
924  ++m_nLumiBlocks;
925  }
926  if( m_manager != 0 ) {
928  if( m_newLumiBlock ) {
930 
931  int LBsLowStat = m_manager->getLBsLowStat();
932  int LBsMedStat = m_manager->getLBsMedStat();
933  int LBsHigStat = m_manager->getLBsHigStat();
934  if( LBsLowStat*LBsMedStat*LBsHigStat > 0) {
938  }
939  }
940  }
941 
942  return StatusCode::SUCCESS;
943 }
944 
947 registerMetadata(const std::string& streamName, const std::string& hName,
948  const MonGroup& group) {
950  TTree* metadata(0);
951  std::string mdStreamName( streamName );
952  size_t found=mdStreamName.rfind('/');
953 
954  if ( found != std::string::npos )
955  mdStreamName.replace( found, mdStreamName.length(), "/metadata" );
956 
957  MDMap_t::iterator i = m_metadataMap.find( mdStreamName );
958  if( i == m_metadataMap.end() ) {
959  metadata = new TTree( "metadata", "Monitoring Metadata" );
960  if (! metadata) return StatusCode::FAILURE;
961  StatusCode scmd = m_THistSvc->regTree( mdStreamName, metadata );
962  if (scmd == StatusCode::FAILURE) return StatusCode::FAILURE;
963  MDMap_t::value_type valToInsert( mdStreamName, new OutputMetadata(metadata) );
964  i = m_metadataMap.insert( valToInsert ).first;
965  }
966 
967  i->second->fill( hName, group.interval(), group.chain(), group.merge() );
968  }
969  return StatusCode::SUCCESS;
970 }
971 
972 StatusCode
974 regManagedHistograms(std::vector< MgmtParams<TH1> >& templateHistograms)
975 {
976  // The method registers histograms with the THistSvc and saves them to file.
977 
978  // The funky business with registering and deregistering the histogram is needed
979  // to get the correct directory when saving histograms. THistSvc deals with ROOT
980  // to set up proper TDirectory, so we rely on it.
981  // E.g.
982  // m_THistSvc->regHist( streamName, h ): sets the correct TDirectory with streamName
983  // m_THistSvc->deReg( h ) - deregister from THistSvc otherwise THistSvc will try to save it
984  // at the end of execution
985  // use passownership of the histogram and save it to file
986  // m_manager->passOwnership( h, genericName );
987  // m_manager->writeAndDelete( genericName );
988  bool allIsOk = true;
989 
990  for( std::vector< MgmtParams<TH1> >::iterator it = templateHistograms.begin(); it != templateHistograms.end(); ++it ) {
991  MonGroup& group = (*it).m_group;
992 
993  // Get a handle to the histogram
994  TH1* theHist = (*it).m_templateHist;
995 
996  // Clone the histogram
997  TH1* h = static_cast<TH1*>(theHist->Clone());
998  theHist->Reset();
999 
1000  // Get name
1001  std::string hName = h->GetName();
1002 
1003  // Get the streamName for the previous interval
1004  std::string streamName = streamNameFunction()->getStreamName( this, group, hName, true );
1005 
1006  // Register the histogram with the THistSvc
1007  StatusCode sc1 = m_THistSvc->deReg( theHist );
1008  if (sc1 == StatusCode::FAILURE) allIsOk = false;
1009 
1010  // Register clonned histogram under previous interval streamName
1011  StatusCode sc2 = m_THistSvc->regHist( streamName, h );
1012  if (sc2 == StatusCode::FAILURE) allIsOk = false;
1013 
1014  if( m_manager != 0 ) {
1015  std::string genericName = NoOutputStream().getStreamName( this, group, hName );
1016  m_manager->passOwnership( h, genericName );
1017  m_manager->writeAndDelete( genericName );
1018  }
1019 
1020  // Get streamName for the current interval
1021  streamName = streamNameFunction()->getStreamName( this, group, hName, false );
1022  // Register metadata information with the current interval streamname
1024  if (smd != StatusCode::SUCCESS) allIsOk = false;
1025 
1026  // Re-register the original histogram with the current interval streamName
1027  StatusCode sc3 = m_THistSvc->regHist( streamName, theHist );
1028  if (sc3 == StatusCode::FAILURE) allIsOk = false;
1029 
1030  }
1031 
1032  if (!allIsOk) return StatusCode::FAILURE;
1033 
1034  return StatusCode::SUCCESS;
1035 }
1036 
1037 StatusCode
1039 THistSvc_deReg_fixTGraph( TFile* file, TGraph* theGraph, std::string& directoryName)
1040 {
1041  // THistSvc employs TDirectory Append method when registering TGraph.
1042  // When deReg is used to de-register TGraph object, THistSvc only removes the object
1043  // from its internal management but forgets to delete from TDirectory.
1044  // The current method fixes this problem by removing the TGraph object manually
1045  // after THistSvc->deReg(TGraph* obj) is called.
1046 
1047  // Saves and restores gFile and gDirectory
1048  GlobalDirectoryRestore restore;
1049 
1050  // This check is true when TGraph object is removed successfully
1051  bool graphRemoved = false;
1052 
1053  file->cd("/");
1054  TDirectory* dir = file->GetDirectory(directoryName.c_str());
1055  if (dir != 0) {
1056  dir->cd();
1057  TObject* obj = dir->Remove(theGraph);
1058  if (obj != 0)
1059  graphRemoved = true;
1060  }
1061 
1062  if (!graphRemoved) {
1063  return StatusCode::FAILURE;
1064  }
1065 
1066  return StatusCode::SUCCESS;
1067 }
1068 
1069 StatusCode
1071 regManagedGraphs(std::vector< MgmtParams<TGraph> >& templateGraphs)
1072 {
1073  // See the description for the regManagedHistograms method
1074  bool allIsOk = true;
1075 
1076  for( std::vector< MgmtParams<TGraph> >::iterator it = templateGraphs.begin(); it != templateGraphs.end(); ++it ) {
1077  MonGroup group = (*it).m_group;
1078 
1079  // Get a handle to the graph
1080  TGraph* theGraph = (*it).m_templateHist;
1081 
1082  // Clone the graph
1083  TGraph* g = static_cast<TGraph*>(theGraph->Clone());
1084  theGraph->Set(0); // equivalent to Reset() for TH1
1085 
1086  // Get name
1087  std::string gName = g->GetName();
1088 
1089  // Get the streamName for the previous interval
1090  std::string streamName = streamNameFunction()->getStreamName( this, group, gName, true );
1091 
1092  // De-register the original graph with the THistSvc
1093  StatusCode sc1 = m_THistSvc->deReg( theGraph );
1094  if (sc1 == StatusCode::FAILURE)
1095  allIsOk = false;
1096 
1097  // *** begin ***
1098  // Fix THistSvc->deReg for TGraphs
1099  bool doneCleaning = false;
1100  std::string directoryName = streamNameFunction()->getDirectoryName( this, group, gName, true );
1101  TSeqCollection *filelist=gROOT->GetListOfFiles();
1102  for (int i=0; i<filelist->GetEntries(); i++) {
1103  ATH_MSG_DEBUG( "List of files: " << filelist->At(i)->GetName());
1104  TFile* file = static_cast<TFile*>(filelist->At(i));
1105  StatusCode sc2 = THistSvc_deReg_fixTGraph(file, theGraph, directoryName);
1106  if (sc2 == StatusCode::SUCCESS)
1107  doneCleaning = true;
1108  }
1109 
1110  // Check if TGraph fix has been applied successfully
1111  if (!doneCleaning) {
1112  ATH_MSG_ERROR("THistSvc_deReg_fixTGraph: failed to apply TGraph fix for the THist Svc!");
1113  allIsOk = false;
1114  }
1115  // *** end ***
1116 
1117  // Register clonned histogram under previous interval streamName
1118  StatusCode sc3 = m_THistSvc->regGraph( streamName, g );
1119  if (sc3 == StatusCode::FAILURE)
1120  allIsOk = false;
1121 
1122  // Get streamName for the current interval
1123  streamName = streamNameFunction()->getStreamName( this, group, gName, false );
1124  // Register metadata information with the current interval streamname
1126  if (smd != StatusCode::SUCCESS)
1127  allIsOk = false;
1128 
1129  // Re-register the original graph with the current interval streamName
1130  StatusCode sc4 = m_THistSvc->regGraph( streamName, theGraph );
1131  if (sc4 == StatusCode::FAILURE)
1132  allIsOk = false;
1133 
1134  }
1135 
1136  if (!allIsOk) return StatusCode::FAILURE;
1137 
1138  return StatusCode::SUCCESS;
1139 }
1140 
1142  bool allIsOk = true;
1143  for( auto& it : templateEfficiencies ) {
1144  // get components of MgmtParams and copy efficiency
1145  MonGroup group = it.m_group;
1146  TEfficiency* theEfficiency = it.m_templateHist;
1147  TEfficiency* e = static_cast<TEfficiency*>(theEfficiency->Clone());
1148  int nbins = theEfficiency->GetTotalHistogram()->GetNbinsX();
1149  int xlow = theEfficiency->GetTotalHistogram()->GetXaxis()->GetXmin();
1150  int xhigh = theEfficiency->GetTotalHistogram()->GetXaxis()->GetXmax();
1151  e->SetBins(nbins,xlow,xhigh); // reset histogram
1152  std::string name = e->GetName();
1153 
1154  // make TGraph casts of TEfficiencies
1155  TGraph* theGraph = reinterpret_cast<TGraph*>(theEfficiency);
1156  TGraph* g = reinterpret_cast<TGraph*>(e);
1157 
1158  // Get the streamName for the previous interval
1159  std::string streamName = streamNameFunction()->getStreamName( this, group, name, true );
1160 
1161  // RE-REGISTER
1162  // 1) De-register the original graph with the THistSvc
1163  StatusCode sc1 = m_THistSvc->deReg( theGraph );
1164  if (sc1 == StatusCode::FAILURE) allIsOk = false;
1165  // 2) Fix THistSvc->deReg for TGraphs
1166  bool doneCleaning = false;
1167  std::string directoryName = streamNameFunction()->getDirectoryName( this, group, name, true );
1168  TSeqCollection *filelist=gROOT->GetListOfFiles();
1169  for (int i=0; i<filelist->GetEntries(); i++) {
1170  ATH_MSG_DEBUG( "List of files: " << filelist->At(i)->GetName());
1171  TFile* file = static_cast<TFile*>(filelist->At(i));
1172  StatusCode sc2 = THistSvc_deReg_fixTGraph(file, theGraph, directoryName);
1173  if (sc2 == StatusCode::SUCCESS) doneCleaning = true;
1174  }
1175  // 3) Check if TGraph fix has been applied successfully
1176  if (!doneCleaning) {
1177  ATH_MSG_ERROR("THistSvc_deReg_fixTGraph: failed to apply TGraph fix for the THist Svc!");
1178  allIsOk = false;
1179  }
1180  // 4) Register cloned histogram under previous interval streamName
1181  StatusCode sc3 = m_THistSvc->regGraph( streamName, g );
1182  if (sc3 == StatusCode::FAILURE)
1183  allIsOk = false;
1184 
1185  // get streamname for interval
1186  streamName = streamNameFunction()->getStreamName( this, group, name, false );
1187  // store metadata
1189  if (smd != StatusCode::SUCCESS) allIsOk = false;
1190  // Re-register the original graph
1191  StatusCode sc4 = m_THistSvc->regGraph( streamName, theGraph );
1192  if (sc4 == StatusCode::FAILURE) allIsOk = false;
1193  }
1194 
1195  if (!allIsOk) return StatusCode::FAILURE;
1196  return StatusCode::SUCCESS;
1197 }
1198 
1199 
1200 StatusCode
1202 regManagedTrees(std::vector< MgmtParams<TTree> >& templateTrees)
1203 {
1204  // See the description for the regManagedHistograms method
1205  bool allIsOk = true;
1206 
1207  for( std::vector< MgmtParams<TTree> >::iterator it = templateTrees.begin(); it != templateTrees.end(); ++it ) {
1208  MonGroup group = (*it).m_group;
1209 
1210  // Get a handle to the original tree
1211  TTree* theTree = (*it).m_templateHist;
1212 
1213  // Clone the tree
1214  TTree* t = static_cast<TTree*>(theTree->Clone());
1215  theTree->Reset();
1216 
1217  // Dumping the tree
1218  std::string name = t->GetName();
1219 
1220  // Get the streamName for the previous interval
1221  std::string streamName = streamNameFunction()->getStreamName( this, group, name, true );
1222 
1223  // De-register original tree with the THistSvc
1224  StatusCode sc1 = m_THistSvc->deReg( theTree );
1225  if (sc1 == StatusCode::FAILURE) allIsOk = false;
1226 
1227  // Register clonned tree under previous interval streamName
1228  StatusCode sc2 = m_THistSvc->regTree( streamName, t );
1229  if (sc2 == StatusCode::FAILURE) allIsOk = false;
1230 
1231  if( m_manager != 0 ) {
1232  std::string genericName = NoOutputStream().getStreamName( this, group, name );
1233  m_manager->passOwnership( t, genericName );
1234  m_manager->writeAndDelete( genericName );
1235  }
1236 
1237  // Get streamName for the current interval
1238  streamName = streamNameFunction()->getStreamName( this, group, name, false );
1239  // Register metadata information with the current interval streamname
1241  if (smd != StatusCode::SUCCESS) allIsOk = false;
1242 
1243  // Re-register the original graph with the current interval streamName
1244  StatusCode sc3 = m_THistSvc->regTree( streamName, theTree );
1245  if (sc3 == StatusCode::FAILURE) allIsOk = false;
1246 
1247  }
1248 
1249  if (!allIsOk) return StatusCode::FAILURE;
1250 
1251  return StatusCode::SUCCESS;
1252 }
1253 
1254 
1255 StatusCode
1257 finalHists()
1258 {
1259 
1260  // This assumes that the end of a file will naturally end a run, which is not always true.
1261  // A merging application run afterwards should be able to put parts of a run together.
1262  if( m_nEvents != 1 ) {
1264 
1265  // Set end flags for the LowStat, LumiBlock and Run variables.
1266  // This is needed to be used in the procHistograms method below.
1267  m_endOfEventsBlock = true;
1268  m_endOfLowStat = true;
1269  m_endOfLumiBlock = true;
1270  m_endOfRun = true;
1271  endOfEventsBlock = true;
1272  endOfLowStat = true;
1273  endOfLumiBlock = true;
1274  endOfRun = true;
1275 
1277 
1279  return sc;
1280  }
1281  return StatusCode::SUCCESS;
1282 }
1283 
1284 
1285 StatusCode
1288 {
1289  if( m_newEventsBlock ) { }
1290  if( m_newLumiBlock ) { }
1291  if( m_newRun ) { }
1292 
1293  return StatusCode::SUCCESS;
1294 }
1295 
1296 
1297 StatusCode
1299 bookHistograms( )
1300 {
1301 
1302  return StatusCode::SUCCESS;
1303 }
1304 
1305 StatusCode
1308 {
1309  return StatusCode::SUCCESS;
1310 }
1311 
1312 
1313 StatusCode
1315 procHistograms( )
1316 {
1317  if( m_endOfEventsBlock ) { }
1318  if( m_endOfLowStat ) { }
1319  if( m_endOfLumiBlock ) { }
1320  if( m_endOfRun) { }
1321 
1322  return StatusCode::SUCCESS;
1323 }
1324 
1325 
1326 void
1329 {
1330  ATH_MSG_DEBUG( "ManagedMonitorToolBase::setMonManager():");
1331  m_manager = manager;
1332  if( m_manager != 0 ) {
1333  ATH_MSG_DEBUG( " --> Setting manager");
1334  m_managerNameProp = m_manager->name();
1338  delete m_streamNameFcn;
1340  }
1341  ATH_MSG_DEBUG( " --> Exiting successfully");
1342 }
1343 
1344 StatusCode
1346 regHist( TH1* h, const std::string& system,
1347  Interval_t interval, MgmtAttr_t histo_mgmt, const std::string& chain, const std::string& merge )
1348 {
1349  MonGroup group( this, system, interval, histo_mgmt, chain, merge );
1350  return regHist( h, group );
1351 }
1352 
1353 StatusCode
1355 regHist( TH1* h, const MonGroup& group )
1356 {
1357 // ManagedMonitorToolBase_addHistStatistics(this,h);
1358 
1359  if (!h)
1360  return StatusCode::FAILURE;
1361 
1362  // This part of the code deals with MANAGED type
1363  if ( group.histo_mgmt() != ATTRIB_UNMANAGED ) {
1364  /*
1365  Create an unmanaged group based on the original MonGroup instance passed
1366  It is needed because managed histogram is presented as a number of unmanaged
1367  histograms (one per each interval)
1368  Update (PUEO) - I don't think it actually matters, and need to keep
1369  track of "proper" attribute for X_VS_LB
1370  */
1371 
1372  if (group.histo_mgmt() == ATTRIB_X_VS_LB && group.merge().empty()) {
1373  ATH_MSG_WARNING("HEY! You're attempting to register " << h->GetName() << " as a per-LB histogram, but you're not setting the merge algorithm! This is a SUPER-BAD idea! Use \"merge\", at least.");
1374  }
1375 
1376  if (m_supportedIntervalsForRebooking.count(group.interval())) {
1377  m_templateHistograms[group.interval()].push_back( MgmtParams<TH1>(h, group) );
1378  } else {
1379  ATH_MSG_ERROR("Attempt to book managed histogram " << h->GetName() << " with invalid interval type " << intervalEnumToString(group.interval()));
1380  return StatusCode::FAILURE;
1381  }
1382 
1383  std::string hName = h->GetName();
1384  MonGroup group_unmanaged( this, group.system(), group.interval(), ATTRIB_UNMANAGED, group.chain(), group.merge());
1385  std::string streamName = streamNameFunction()->getStreamName( this, group_unmanaged, hName, false );
1386  registerMetadata(streamName, hName, group).ignore();
1387  return m_THistSvc->regHist( streamName, h );
1388  }
1389 
1390  // This part of the code deals with UNMANAGED type
1391  std::string hName = h->GetName();
1392 
1393  if( m_manager != 0 ) {
1394  std::string genericName = NoOutputStream().getStreamName( this, group, hName );
1395  m_manager->writeAndDelete( genericName );
1396  m_manager->passOwnership( h, genericName );
1397  }
1398 
1399  std::string streamName = streamNameFunction()->getStreamName( this, group, hName, false );
1400 
1402  if (smd != StatusCode::SUCCESS) return StatusCode::FAILURE;
1403 
1404  return m_THistSvc->regHist( streamName, h );
1405 }
1406 
1407 
1408 StatusCode
1410 getHist( TH1*& h, const std::string& hName, const std::string& system,
1412 {
1413  MonGroup group( this, system, interval );
1414  return getHist( h, hName, group );
1415 }
1416 
1417 
1418 StatusCode
1420 getHist( TH1*& h, const std::string& hName, const MonGroup& group )
1421 {
1422  std::string streamName = streamNameFunction()->getStreamName( this, group, hName );
1423  return m_THistSvc->getHist( streamName, h );
1424 }
1425 
1426 
1427 StatusCode
1429 getHist( TH2*& h, const std::string& hName, const std::string& system,
1431 {
1432  MonGroup group( this, system, interval );
1433  return getHist( h, hName, group );
1434 }
1435 
1436 
1437 StatusCode
1439 getHist( TH2*& h, const std::string& hName, const MonGroup& group )
1440 {
1441  std::string streamName = streamNameFunction()->getStreamName( this, group, hName );
1442  return m_THistSvc->getHist( streamName, h );
1443 }
1444 
1445 
1447  if (!e)
1448  return StatusCode::FAILURE;
1449 
1450  TGraph* g = reinterpret_cast<TGraph*>(e);
1451  std::string name = e->GetName();
1452 
1453  // MANAGED
1454  if ( group.histo_mgmt() != ATTRIB_UNMANAGED ) {
1455  // warn about not using merge algorithms
1456  if (group.histo_mgmt() == ATTRIB_X_VS_LB && group.merge().empty()) {
1457  ATH_MSG_WARNING("HEY! Attempting to register "<<name<<" as a per-LB histogram, but not setting the merge algorithm! Use \"merge\", at least.");
1458  }
1459  // add the efficiency to rebooking vector
1460  if (m_supportedIntervalsForRebooking.count(group.interval())) {
1461  m_templateEfficiencies[group.interval()].push_back( MgmtParams<TEfficiency>(e, group) );
1462  } else {
1463  ATH_MSG_ERROR("Attempt to book managed graph " << name << " with invalid interval type " << intervalEnumToString(group.interval()));
1464  return StatusCode::FAILURE;
1465  }
1466 
1467  MonGroup group_unmanaged( this, group.system(), group.interval(), ATTRIB_UNMANAGED, group.chain(), group.merge());
1468  std::string streamName = streamNameFunction()->getStreamName( this, group_unmanaged, name, false );
1469  registerMetadata(streamName, name, group).ignore();
1470  return m_THistSvc->regGraph( streamName, g );
1471  } else {
1472  // UNMANAGED
1473  if( m_manager != 0 ) {
1474  std::string genericName = NoOutputStream().getStreamName( this, group, name );
1475  m_manager->writeAndDelete( genericName );
1476  m_manager->passOwnership( e, genericName );
1477  }
1478 
1479  std::string streamName = streamNameFunction()->getStreamName( this, group, name, false );
1481  if (smd != StatusCode::SUCCESS)
1482  return StatusCode::FAILURE;
1483 
1484  return m_THistSvc->regGraph( streamName, g );
1485  }
1486 }
1487 
1488 
1489 StatusCode
1491 regGraph( TGraph* g, const std::string& system,
1492  Interval_t interval, MgmtAttr_t histo_mgmt, const std::string& chain, const std::string& merge )
1493 {
1494  MonGroup group( this, system, interval, histo_mgmt, chain, merge );
1495  return regGraph( g, group );
1496 }
1497 
1498 
1499 StatusCode
1501 regGraph( TGraph* g, const MonGroup& group )
1502 {
1503  if (!g)
1504  return StatusCode::FAILURE;
1505 
1506  // This part of the code deals with MANAGED type
1507  if ( group.histo_mgmt() != ATTRIB_UNMANAGED ) {
1508  // Create an unmanaged group based on the original MonGroup instance passed
1509  // This is needed because managed graph is presented as a number of unmanaged
1510  // graphs (one per each interval)
1511  MonGroup group_unmanaged( this, group.system(), group.interval(), ATTRIB_UNMANAGED, group.chain(), group.merge());
1512 
1513  if (m_supportedIntervalsForRebooking.count(group.interval())) {
1514  m_templateGraphs[group.interval()].push_back( MgmtParams<TGraph>(g, group_unmanaged) );
1515  } else {
1516  ATH_MSG_ERROR("Attempt to book managed graph " << g->GetName() << " with invalid interval type " << intervalEnumToString(group.interval()));
1517  return StatusCode::FAILURE;
1518  }
1519 
1520  std::string name = g->GetName();
1521  std::string streamName = streamNameFunction()->getStreamName( this, group_unmanaged, name, false );
1522  registerMetadata(streamName, name, group).ignore();
1523  return m_THistSvc->regGraph( streamName, g );
1524  //return m_THistSvc->regGraph( streamName );
1525  }
1526 
1527  // This part of the code deals with UNMANAGED type
1528  std::string gName = g->GetName();
1529 
1530  if( m_manager != 0 ) {
1531  std::string genericName = NoOutputStream().getStreamName( this, group, gName );
1532  m_manager->writeAndDelete( genericName );
1533  m_manager->passOwnership( g, genericName );
1534  }
1535 
1536  std::string streamName = streamNameFunction()->getStreamName( this, group, gName, false );
1537 
1539  if (smd != StatusCode::SUCCESS) return StatusCode::FAILURE;
1540 
1541  return m_THistSvc->regGraph( streamName, g );
1542 }
1543 
1544 
1545 StatusCode
1547 regTree( TTree* t, const std::string& system,
1548  Interval_t interval, MgmtAttr_t histo_mgmt, const std::string& chain, const std::string& merge )
1549 {
1550  MonGroup group( this, system, interval, histo_mgmt, chain, merge );
1551  return regTree( t, group );
1552 }
1553 
1554 
1555 StatusCode
1557 regTree( TTree* t, const MonGroup& group )
1558 {
1559 
1560  // This part of the code deals with MANAGED type
1561  if ( group.histo_mgmt() != ATTRIB_UNMANAGED ) {
1562  // Create an unmanaged group based on the original MonGroup instance passed
1563  // This is needed because managed tree is presented as a number of unmanaged
1564  // trees (one per each interval)
1565  MonGroup group_unmanaged( this, group.system(), group.interval(), ATTRIB_UNMANAGED, group.chain(), group.merge());
1566 
1567  if (m_supportedIntervalsForRebooking.count(group.interval())) {
1568  m_templateTrees[group.interval()].push_back( MgmtParams<TTree>(t, group_unmanaged) );
1569  } else {
1570  ATH_MSG_ERROR("Attempt to book managed tree " << t->GetName() << " with invalid interval type " << intervalEnumToString(group.interval()));
1571  return StatusCode::FAILURE;
1572  }
1573 
1574  std::string name = t->GetName();
1575  std::string genericName = NoOutputStream().getStreamName( this, group_unmanaged, name );
1576  std::string streamName = streamNameFunction()->getStreamName( this, group_unmanaged, name, false );
1577  registerMetadata(streamName, name, group).ignore();
1578  return m_THistSvc->regTree( streamName, t );
1579  }
1580 
1581 
1582  // This part of the code deals with UNMANAGED type
1583  std::string tName = t->GetName();
1584 
1585  if( m_manager != 0 ) {
1586  std::string genericName = NoOutputStream().getStreamName( this, group, tName );
1587  m_manager->writeAndDelete( genericName );
1588  m_manager->passOwnership( t, genericName );
1589  }
1590 
1591  std::string streamName = streamNameFunction()->getStreamName( this, group, tName, false );
1592 
1594  if (smd != StatusCode::SUCCESS) return StatusCode::FAILURE;
1595 
1596  return m_THistSvc->regTree( streamName, t );
1597 }
1598 
1599 
1600 StatusCode
1602 writeAndDelete( TH1* h, const MonGroup& group ) {
1603  if (!h)
1604  return StatusCode::FAILURE;
1605 
1606  std::string hName = h->GetName();
1607 
1608  if( m_manager != 0 ) {
1609  std::string genericName = NoOutputStream().getStreamName( this, group, hName );
1610  m_manager->writeAndDelete( genericName );
1611  }
1612  return StatusCode::SUCCESS;
1613 }
1614 
1615 
1616 StatusCode
1618 deregHist( TH1* h )
1619 {
1620  return m_THistSvc->deReg( h );
1621 }
1622 
1623 
1624 StatusCode
1626 deregGraph( TGraph* g )
1627 {
1628  return m_THistSvc->deReg( g );
1629 }
1630 
1631 
1632 StatusCode
1634 deregObject( const std::string& objName, const std::string& system,
1636 {
1637  MonGroup group( this, system, interval );
1638  return deregObject( objName, group );
1639 }
1640 
1641 
1642 StatusCode
1644 deregObject( const std::string& objName, const MonGroup& group )
1645 {
1646  std::string streamName = streamNameFunction()->getStreamName( this, group, objName );
1647  return m_THistSvc->deReg( streamName );
1648 }
1649 
1650 
1651 StatusCode
1653 setupOutputStreams( std::vector<std::string> )
1654 {
1655  // All instances should write to the stream(s) defined by the
1656  // AthenaMonManager.
1657 
1658  return StatusCode::SUCCESS;
1659 }
1660 
1661 
1662 StatusCode
1664 runStat()
1665 {
1666  return StatusCode::SUCCESS;
1667 }
1668 
1669 
1670 StatusCode
1672 checkHists( bool )
1673 {
1674  // Histograms will be checked using the data-quality monitoring framework (DQMF)
1675 
1676  return StatusCode::SUCCESS;
1677 }
1678 
1679 
1680 bool
1682 preSelector()
1683 {
1684  if( m_preScaleProp > 1 ) {
1685  return ( (m_nEvents % m_preScaleProp) == 1 );
1686  }
1687  return true;
1688 }
1689 
1690 
1691 // Average mu, i.e. <mu>
1692 float
1694 lbAverageInteractionsPerCrossing (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1695 {
1696  if (!m_lumiDataKey.empty()) {
1698  return lumi->lbAverageInteractionsPerCrossing();
1699  } else {
1700  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageInteractionsPerCrossing() can't work properly! ");
1701  ATH_MSG_DEBUG("Warning: lbAverageInteractionsPerCrossing() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
1702  return -1.0;
1703  }
1704  // not reached
1705 }
1706 
1707 // Instantaneous number of interactions, i.e. mu
1708 float
1710 lbInteractionsPerCrossing (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1711 {
1712  if (!m_lumiDataKey.empty()) {
1714  float muToLumi = lumi->muToLumi();
1715  if (muToLumi > 0) {
1716  return lumi->lbLuminosityPerBCIDVector().at (ctx.eventID().bunch_crossing_id()) / muToLumi;
1717  }
1718  return 0;
1719  } else {
1720  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbInteractionsPerCrossing() can't work properly! ");
1721  ATH_MSG_DEBUG("Warning: lbInteractionsPerCrossing() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
1722  return -1.0;
1723  }
1724  // not reached
1725 }
1726 
1727 // Average luminosity (in ub-1 s-1 => 10^30 cm-2 s-1)
1728 float
1730 lbAverageLuminosity (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1731 {
1732  if (!m_lumiDataKey.empty()) {
1734  return lumi->lbAverageLuminosity();
1735  } else {
1736  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageLuminosity() can't work properly! ");
1737  ATH_MSG_DEBUG("Warning: lbAverageLuminosity() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
1738  return -1.0;
1739  }
1740  // not reached
1741 }
1742 
1743 // Instantaneous luminosity
1744 float
1746 lbLuminosityPerBCID (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1747 {
1748  if (!m_lumiDataKey.empty()) {
1750  return lumi->lbLuminosityPerBCIDVector().at (ctx.eventID().bunch_crossing_id());
1751  } else {
1752  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbLuminosityPerBCID() can't work properly! ");
1753  ATH_MSG_DEBUG("Warning: lbLuminosityPerBCID() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
1754  return -1.0;
1755  }
1756  // not reached
1757 }
1758 
1759 
1760 // Average luminosity livefraction
1761 float
1763 lbAverageLivefraction (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1764 {
1766  return 1.0;
1767 
1770  return live->lbAverageLiveFraction();
1771  } else {
1772  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbAverageLivefraction() can't work properly! ");
1773  ATH_MSG_DEBUG("Warning: lbAverageLivefraction() - luminosity not availble (i.e. EnableLumi = False)");
1774  return -1.0;
1775  }
1776  // not reached
1777 }
1778 
1779 // Live Fraction per Bunch Crossing ID
1780 float
1782 livefractionPerBCID (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1783 {
1785  return 1.0;
1786 
1789  return live->l1LiveFractionVector().at (ctx.eventID().bunch_crossing_id());
1790  } else {
1791  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! livefractionPerBCID() can't work properly! ");
1792  ATH_MSG_DEBUG("Warning: livefractionPerBCID() - luminosity retrieved available (i.e. EnableLumi = False)");
1793  return -1.0;
1794  }
1795  // not reached
1796 }
1797 
1798 // Average Integrated Luminosity Live Fraction
1799 double
1801 lbLumiWeight (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1802 {
1803  if (!m_lumiDataKey.empty()) {
1804  return (lbAverageLuminosity(ctx)*lbDuration(ctx))*lbAverageLivefraction(ctx);
1805  } else{
1806  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbLumiWeight() can't work properly! ");
1807  ATH_MSG_DEBUG("Warning: lbLumiWeight() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
1808  return -1.0;
1809  }
1810  // not reached
1811 }
1812 
1813 
1814 // Luminosity block time (in seconds)
1815 double
1817 lbDuration (const EventContext& ctx /*= Gaudi::Hive::currentContext()*/) const
1818 {
1820  return m_defaultLBDuration;
1821  }
1822  if (!m_lbDurationDataKey.empty()) {
1824  return dur->lbDuration();
1825  } else {
1826  //ATH_MSG_FATAL("! Luminosity tool has been disabled ! lbDuration() can't work properly! ");
1827  ATH_MSG_DEBUG("Warning: lbDuration() - luminosity tools are not retrieved or turned on (i.e. EnableLumi = False)");
1828  return m_defaultLBDuration;
1829  }
1830  // not reached
1831 }
1832 
1833 
1834 // *********************************************************************
1835 // Protected Methods
1836 // *********************************************************************
1837 
1839  OutputMetadata( TTree* metadata )
1840  : m_charArrSize(100)
1841  , m_metadata(metadata)
1842  , m_nameData(0)
1843  //, m_levelData(0)
1844  , m_intervalData(0)
1845  , m_triggerData(0)
1846  , m_mergeData(0)
1847 {
1848  m_nameData = new char[m_charArrSize];
1849  //m_levelData = new char[m_charArrSize];
1850  m_intervalData = new char[m_charArrSize];
1851  m_triggerData = new char[m_charArrSize];
1852  m_mergeData = new char[m_charArrSize];
1853  m_metadata->Branch( "Name", m_nameData, "Name/C" );
1854  //m_metadata->Branch( "LevelOfDetail", m_levelData, "LevelOfDetail/C" );
1855  m_metadata->Branch( "Interval", m_intervalData, "Interval/C" );
1856  m_metadata->Branch( "TriggerChain", m_triggerData, "TriggerChain/C" );
1857  m_metadata->Branch( "MergeMethod", m_mergeData, "MergeMethod/C" );
1858 }
1859 
1860 
1863 {
1864  delete [] m_mergeData;
1865  delete [] m_triggerData;
1866  delete [] m_intervalData;
1867  //delete [] m_levelData;
1868  delete [] m_nameData;
1869 }
1870 
1871 
1872 void
1874 fill( const std::string& name,
1875  //LevelOfDetail_t level,
1877  std::string trigger,
1878  std::string merge )
1879 {
1880  // ROOT does not properly write empty strings to output files in all cases. I haven't reported
1881  // this to the ROOT developers yet because I don't have time to develope a simple test case
1882  // for them (independent of Atlas software).
1883  // --M.G.Wilson, 7 July 2008
1884  if( trigger.empty() )
1885  trigger = "<none>";
1886  if( merge.empty() )
1887  merge = "<default>";
1888 
1889  copyString( m_nameData, name );
1890  //copyString( m_levelData, ManagedMonitorToolBase::levelOfDetailEnumToString( level ) );
1891  copyString( m_intervalData, ManagedMonitorToolBase::intervalEnumToString( interval ) );
1892  copyString( m_triggerData, trigger );
1893  copyString( m_mergeData, merge );
1894  m_metadata->Fill();
1895 }
1896 
1897 
1898 void
1900 copyString( char* to, const std::string& from )
1901 {
1902  int i = 0;
1903  const char* f = from.c_str();
1904  while( (++i < m_charArrSize) && ((*to++ = *f++) != 0) ) {};
1905  if( i == m_charArrSize ) {
1906  *to = 0;
1907  }
1908 }
1909 
1910 
1911 std::string
1913 getStreamName( const ManagedMonitorToolBase*, const MonGroup& group, const std::string& objName, bool )
1914 {
1915  std::ostringstream streamName;
1916 
1917  streamName << "/" << m_fileKey << "/";
1918 
1919  streamName << group.system() << "/" << objName;
1920  return streamName.str();
1921 }
1922 
1923 std::string
1925 getDirectoryName( const ManagedMonitorToolBase* tool, const MonGroup& group, const std::string& objName, const bool usePreviousInterval )
1926 {
1927  std::string streamName = getStreamName(tool, group, objName, usePreviousInterval);
1928  std::string root, rem;
1929  parseString(streamName, root, rem);
1930  // Remove object name at the end
1931  // to obtain directory path
1932  rem.erase(rem.rfind('/'), rem.length());
1933  return rem;
1934 }
1935 
1936 
1937 std::string
1939 getStreamName( const ManagedMonitorToolBase*, const MonGroup& group, const std::string& objName, bool )
1940 {
1941  std::ostringstream streamName;
1942  streamName << group.system() << "/" << objName;
1943  return streamName.str();
1944 }
1945 
1946 
1947 std::string
1949 getDirectoryName( const ManagedMonitorToolBase* tool, const MonGroup& group, const std::string& objName, const bool usePreviousInterval )
1950 {
1951  return getStreamName(tool, group, objName, usePreviousInterval);
1952 }
1953 
1954 std::string
1956 getStreamName( const ManagedMonitorToolBase*, const MonGroup& group, const std::string& objName, bool )
1957 {
1958  std::ostringstream streamName;
1959  //if( group.level() != ManagedMonitorToolBase::transient ) {
1960  // streamName << "/" << ManagedMonitorToolBase::levelOfDetailEnumToString( group.level(), true ) << "/";
1961  //}
1962  streamName << "/"; // slash is required for online environment;
1963  // otherwise the output histograms are placed in 'temp' subdirectory
1964 
1965  streamName << group.system() << "/" << objName;
1966  return streamName.str();
1967 }
1968 
1969 std::string
1971 getDirectoryName( const ManagedMonitorToolBase* tool, const MonGroup& group, const std::string& objName, const bool usePreviousInterval )
1972 {
1973  return getStreamName(tool, group, objName, usePreviousInterval);
1974 }
1975 
1976 void
1978 getLBrange(int *start, int *end, int LB, int length) {
1979  if(start && end) {
1980  *start = ((LB-1)/length) * length + 1;
1981  *end = *start + length - 1;
1982  }
1983 }
1984 
1985 std::string
1987 getStreamName( const ManagedMonitorToolBase* tool, const MonGroup& group, const std::string& objName, bool usePreviousInterval )
1988 {
1989  std::ostringstream streamName;
1990 
1991  //bool isTemp = ( group.level() == ManagedMonitorToolBase::transient );
1992  bool isTemp = false;
1993 
1994  bool useRunFolders = group.interval() != all;
1995 
1996  bool useLBFolders = ( useRunFolders )
1997  && ( group.interval() == ManagedMonitorToolBase::lumiBlock );
1998 
1999  bool useLowStatInterval = ( useRunFolders )
2000  && ( group.interval() == ManagedMonitorToolBase::lowStat );
2001 
2002  bool useMedStatInterval = ( useRunFolders )
2003  && ( group.interval() == ManagedMonitorToolBase::medStat );
2004 
2005  bool useHigStatInterval = ( useRunFolders )
2006  && ( group.interval() == ManagedMonitorToolBase::higStat );
2007 
2008  bool useEBFolders = ( group.interval() == ManagedMonitorToolBase::eventsBlock );
2009 
2010  if( !isTemp ) {
2011  streamName << "/" << m_fileKey << "/";
2012  }
2013 
2014  if( useRunFolders ) {
2015  if (usePreviousInterval && (group.interval() == ManagedMonitorToolBase::run) )
2016  streamName << "run_" << m_prev_run_number << "/";
2017  else
2018  streamName << "run_" << AthenaMonManager::runNumber() << "/";
2019  }
2020 
2021  int currentLB = AthenaMonManager::lumiBlockNumber();
2022  if( useLBFolders ) {
2023  if (usePreviousInterval && (group.interval() == ManagedMonitorToolBase::lumiBlock) )
2024  streamName << "lb_" << m_prev_lumi_block << "/";
2025  else
2026  streamName << "lb_" << currentLB << "/";
2027  }
2028  else if( useLowStatInterval ) {
2029  int start, end;
2030  if (usePreviousInterval && (group.interval() == ManagedMonitorToolBase::lowStat) )
2031  getLBrange(&start, &end, m_prev_lumi_block, AthenaMonManager::getLBsLowStat());
2032  else
2033  getLBrange(&start, &end, currentLB, AthenaMonManager::getLBsLowStat());
2034  streamName << "lowStat_LB" << start << "-" << end << "/";
2035  }
2036  else if( useMedStatInterval ) {
2037  int start, end;
2038  getLBrange(&start, &end, currentLB, AthenaMonManager::getLBsMedStat());
2039  streamName << "medStat_LB" << start << "-" << end << "/";
2040  }
2041  else if( useHigStatInterval ) {
2042  int start, end;
2043  getLBrange(&start, &end, currentLB, AthenaMonManager::getLBsHigStat());
2044  streamName << "higStat_LB" << start << "-" << end << "/";
2045  }
2046  else if( useEBFolders ) {
2047  // The number of events in an EventsBlock can vary for each ManagedMonitorToolBase object,
2048  // so there is no global way to determine when an EventsBlock has rolled over.
2049 
2050  // determine an eventsBlock number
2051  long eventsBlockNumber = 1; // assign some dafault value
2052  long procNEventsProp = tool->get_procNEventsProp();
2053  unsigned int nEvents = tool->get_nEvents();
2054  if (procNEventsProp > 0) {
2055  eventsBlockNumber = (long) nEvents / procNEventsProp;
2056  if ((nEvents % procNEventsProp) != 0)
2057  eventsBlockNumber++;
2058  }
2059 
2060  // lower eventsBlock number by 1 if usePreviousInterval is true;
2061  if (usePreviousInterval) {
2062  eventsBlockNumber--;
2063  }
2064 
2065  streamName << "eb_" << eventsBlockNumber << "/";
2066  }
2067 
2068  streamName << group.system() << "/" << objName;
2069 
2070  return streamName.str();
2071 }
2072 
2073 std::string
2075 getDirectoryName( const ManagedMonitorToolBase* tool, const MonGroup& group, const std::string& objName, const bool usePreviousInterval )
2076 {
2077  std::string streamName = getStreamName(tool, group, objName, usePreviousInterval);
2078  std::string root, rem;
2079  parseString(streamName, root, rem);
2080  // Remove object name at the end
2081  // to obtain directory path
2082  rem.erase(rem.rfind('/'), rem.length());
2083  return rem;
2084 }
2085 
2086 void
2088 updateRunLB() {
2089  m_prev_run_number = AthenaMonManager::runNumber();
2090  m_prev_lumi_block = AthenaMonManager::lumiBlockNumber();
2091 }
2092 
2093 bool
2095 trigChainsArePassed(std::vector<std::string>& vTrigNames)
2096 {
2097  ATH_MSG_DEBUG( "ManagedMonitorToolBase::trigChainsArePassed:");
2098 
2099  for(unsigned int i=0; i<vTrigNames.size(); i++) {
2100  if( m_trigDecTool->isPassed(vTrigNames[i]) ) {
2101  ATH_MSG_DEBUG( " + \"" << vTrigNames[i] << "\" passed, returning \'true\'");
2102  return true;
2103  }
2104  else {
2105  ATH_MSG_DEBUG( " - \"" << vTrigNames[i] << "\" did not pass");
2106  }
2107  }
2108 
2109  return false;
2110 }
2111 
2112 StatusCode
2114 parseList(const std::string& line, std::vector<std::string>& result) {
2115  std::string item;
2116  std::stringstream ss(line);
2117 
2118  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "ManagedMonitorToolBase::parseList:";
2119 
2120  while ( std::getline(ss, item, ',') ) {
2121  std::stringstream iss(item); // remove
2122  iss >> item; // whitespace
2123  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " " << item;
2124  result.push_back(item);
2125  }
2126 
2127  msg(MSG::DEBUG) << endmsg;
2128  return StatusCode::SUCCESS;
2129 }
2130 
2131 void
2133 updateTriggersForGroups(std::vector<std::string>& vTrigChainNames) {
2134  for (size_t i = 0; i < vTrigChainNames.size(); ++i) {
2135  std::string& thisName = vTrigChainNames[i];
2136  if (thisName.compare(0, 9, "CATEGORY_") ==0) {
2137  ATH_MSG_DEBUG("Found a trigger category: " << thisName << ". We will unpack it.");
2138  std::vector<std::string> triggers = m_trigTranslator->translate(thisName.substr(9,std::string::npos));
2139  std::ostringstream oss;
2140  oss << "(";
2141  for (size_t itrig = 0; itrig < triggers.size(); ++itrig) {
2142  if (itrig != 0) {
2143  oss << "|";
2144  }
2145  oss << triggers[itrig];
2146  }
2147  oss << ")";
2148  // replace with new value
2149  std::string newval = oss.str();
2150  ATH_MSG_DEBUG("Replaced with " << newval);
2151  vTrigChainNames[i] = newval;
2152  }
2153  }
2154 }
2155 
2158 getNewStreamNameFcn() const
2159 {
2160  StreamNameFcn* fcn(0);
2161 
2162  switch( m_environment ) {
2164  fcn = new NoOutputStream();
2165  break;
2167  fcn = new OnlineStream();
2168  break;
2170  fcn = new DefaultStream( m_fileKey );
2171  break;
2175  case AthenaMonManager::AOD:
2177  default:
2179  }
2180 
2181  return fcn;
2182 }
2183 
2184 void
2186 parseString(const std::string& streamName, std::string& root, std::string& rem) {
2187  std::string::size_type pos = streamName.find('/');
2188 
2189  if (pos == std::string::npos) {
2190  root = "";
2191  rem = streamName;
2192  return;
2193  }
2194 
2195  if (pos == 0) {
2196  parseString(streamName.substr(1,streamName.length()),root,rem);
2197  } else {
2198  root = streamName.substr(0,pos);
2199  rem = streamName.substr(pos+1,streamName.length());
2200  }
2201 
2202 }
2203 
2204 // *********************************************************************
2205 // Private Methods
2206 // *********************************************************************
2207 
2208 // GlobalDirectoryRestore ctor
2212  m_gd = gDirectory;
2213  m_gf = gFile;
2214 }
2215 
2216 // GlobalDirectoryRestore dtor
2220  gDirectory = m_gd;
2221  gFile = m_gf;
2222 }
2223 
2224 namespace {
2225 
2226  std::string strToLower( const std::string& str )
2227  {
2228  std::string lstr(str);
2229  std::string::const_iterator from = str.begin();
2230  std::string::const_iterator strend = str.end();
2231  std::string::iterator to = lstr.begin();
2232  while( from != strend ) {
2233  *to++ = tolower(*from++);
2234  }
2235  return lstr;
2236  }
2237 
2238 
2239 #if 0
2240  std::string strToUpper( const std::string& str )
2241  {
2242  std::string ustr(str);
2243  std::string::const_iterator from = str.begin();
2244  std::string::const_iterator strend = str.end();
2245  std::string::iterator to = ustr.begin();
2246  while( from != strend ) {
2247  *to++ = toupper(*from++);
2248  }
2249  return ustr;
2250  }
2251 #endif
2252 
2253 } // unnamed namespace
2254 
2255 #endif
ManagedMonitorToolBase::m_nEvents
unsigned int m_nEvents
Definition: ManagedMonitorToolBase.h:863
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ManagedMonitorToolBase::THistSvc_deReg_fixTGraph
StatusCode THistSvc_deReg_fixTGraph(TFile *file, TGraph *theGraph, std::string &directoryName)
Fixes THistSvc->deReg(obj) when obj is TGraph instance.
Definition: ManagedMonitorToolBase.cxx:1039
ManagedMonitorToolBase::m_templateEfficiencies
std::map< Interval_t, std::vector< MgmtParams< TEfficiency > > > m_templateEfficiencies
Definition: ManagedMonitorToolBase.h:676
ManagedMonitorToolBase::streamNameFunction
virtual StreamNameFcn * streamNameFunction()
Returns the function object that converts logical paramters into a physical stream name.
Definition: ManagedMonitorToolBase.cxx:452
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
ManagedMonitorToolBase::Imp::m_bench_fillall
AthMonBench m_bench_fillall
Definition: ManagedMonitorToolBase.cxx:55
ManagedMonitorToolBase::m_newRun
bool m_newRun
Definition: ManagedMonitorToolBase.h:821
ManagedMonitorToolBase::MgmtParams< TH1 >
ManagedMonitorToolBase::StreamNameFcn
A function-object base class allowing the specific implementation of getStreamName to be decided at r...
Definition: ManagedMonitorToolBase.h:325
ManagedMonitorToolBase::m_supportedIntervalsForRebooking
std::set< Interval_t > m_supportedIntervalsForRebooking
Definition: ManagedMonitorToolBase.h:896
ManagedMonitorToolBase::preSelector
virtual bool preSelector()
Definition: ManagedMonitorToolBase.cxx:1682
ManagedMonitorToolBase::Interval_t
Interval_t
An enumeration describing how detailed a particular monitoring object is.
Definition: ManagedMonitorToolBase.h:113
defineDB.smd
string smd
Definition: JetTagCalibration/share/defineDB.py:44
ManagedMonitorToolBase::m_path
std::string m_path
Definition: ManagedMonitorToolBase.h:852
ManagedMonitorToolBase::m_dataTypeStr
std::string m_dataTypeStr
Definition: ManagedMonitorToolBase.h:834
ManagedMonitorToolBase::bookHistograms
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
Definition: ManagedMonitorToolBase.cxx:1299
ManagedMonitorToolBase::m_DQFilterTools
ToolHandleArray< IDQFilterTool > m_DQFilterTools
Definition: ManagedMonitorToolBase.h:849
checkFileSG.line
line
Definition: checkFileSG.py:75
ManagedMonitorToolBase::getHist
virtual StatusCode getHist(TH1 *&h, const std::string &hName, const std::string &system, Interval_t interval)
Returns a TH1 via the pointer passed as the first argument.
Definition: ManagedMonitorToolBase.cxx:1410
ManagedMonitorToolBase::m_newEventsBlock
bool m_newEventsBlock
Definition: ManagedMonitorToolBase.h:822
ManagedMonitorToolBase::Imp::benchPreProcHistograms
void benchPreProcHistograms()
Definition: ManagedMonitorToolBase.cxx:119
get_generator_info.result
result
Definition: get_generator_info.py:21
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
ManagedMonitorToolBase::Imp::m_bench_tmp
AthMonBench m_bench_tmp
Definition: ManagedMonitorToolBase.cxx:52
ManagedMonitorToolBase::Imp
Definition: ManagedMonitorToolBase.cxx:36
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ManagedMonitorToolBase::OutputMetadata::m_intervalData
char * m_intervalData
Definition: ManagedMonitorToolBase.h:719
CaloCellTimeCorrFiller.LB
LB
Definition: CaloCellTimeCorrFiller.py:37
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ManagedMonitorToolBase::MgmtAttr_t
MgmtAttr_t
An enumeration describing how the class handles the histogram.
Definition: ManagedMonitorToolBase.h:130
ManagedMonitorToolBase::higStat
@ higStat
Definition: ManagedMonitorToolBase.h:114
ManagedMonitorToolBase::fillHists
virtual StatusCode fillHists()
Calls fillHists( bool, bool, bool ); if an eventBlock,lumiBlock, or run has turned over,...
Definition: ManagedMonitorToolBase.cxx:741
ManagedMonitorToolBase::Imp::m_benchNFillAfterbook
unsigned m_benchNFillAfterbook
Definition: ManagedMonitorToolBase.cxx:59
ManagedMonitorToolBase::lumiBlock
@ lumiBlock
Definition: ManagedMonitorToolBase.h:113
ManagedMonitorToolBase::m_endOfLumiBlock
bool m_endOfLumiBlock
Definition: ManagedMonitorToolBase.h:823
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:73
ManagedMonitorToolBase::NoOutputStream
Definition: ManagedMonitorToolBase.h:738
ManagedMonitorToolBase::MonGroup::deregGraph
StatusCode deregGraph(TGraph *g)
De-registers a TGraph from the THistSvc, but does NOT delete the object.
Definition: ManagedMonitorToolBase.cxx:290
ManagedMonitorToolBase::m_THistSvc
ServiceHandle< ITHistSvc > m_THistSvc
Definition: ManagedMonitorToolBase.h:843
ManagedMonitorToolBase::m_procNEventsProp
long m_procNEventsProp
Definition: ManagedMonitorToolBase.h:851
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ManagedMonitorToolBase::regTree
virtual StatusCode regTree(TTree *t, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TTree to be included in the output stream using logical parameters that describe it.
Definition: ManagedMonitorToolBase.cxx:1547
AthenaMonManager::runNumber
static unsigned int runNumber()
Definition: AthenaMonManager.cxx:341
initialize
void initialize()
Definition: run_EoverP.cxx:894
ManagedMonitorToolBase::setupOutputStreams
virtual StatusCode setupOutputStreams(std::vector< std::string > Mapping=std::vector< std::string >())
This implementation does nothing—streams in this class should be managed by the AthenaMonManager.
Definition: ManagedMonitorToolBase.cxx:1653
AthenaMonManager::fileKey
virtual std::string fileKey() const
Definition: AthenaMonManager.cxx:648
ManagedMonitorToolBase::NoOutputStream::getStreamName
virtual std::string getStreamName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, bool usePreviousInterval=false)
A function that converts a MonGroup of logical parameters into a physical output stream name.
Definition: ManagedMonitorToolBase.cxx:1939
ManagedMonitorToolBase::m_environmentStr
std::string m_environmentStr
Definition: ManagedMonitorToolBase.h:835
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
ManagedMonitorToolBase::Imp::benchPreFillHistograms
void benchPreFillHistograms()
Definition: ManagedMonitorToolBase.cxx:94
AthenaMonManager::AOD
@ AOD
Definition: AthenaMonManager.h:49
ManagedMonitorToolBase::regManagedGraphs
StatusCode regManagedGraphs(std::vector< MgmtParams< TGraph > > &templateGraphs)
Definition: ManagedMonitorToolBase.cxx:1071
AthenaMonManager::passOwnership
virtual void passOwnership(TObject *h, const std::string &key)
Pass ownership of a TObject to this manager so that it will be deleted appropriately.
Definition: AthenaMonManager.cxx:656
ManagedMonitorToolBase::Imp::benchPostFillHistograms
void benchPostFillHistograms()
Definition: ManagedMonitorToolBase.cxx:103
ManagedMonitorToolBase::runStat
virtual StatusCode runStat()
This implementation does nothing; equivalent functionality may be provided by procHists( true,...
Definition: ManagedMonitorToolBase.cxx:1664
ManagedMonitorToolBase::writeAndDelete
virtual StatusCode writeAndDelete(TH1 *h, const MonGroup &group)
Write out histogram and delete it.
Definition: ManagedMonitorToolBase.cxx:1602
ManagedMonitorToolBase::livefractionPerBCID
virtual float livefractionPerBCID(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Livefraction per bunch crossing ID.
Definition: ManagedMonitorToolBase.cxx:1782
ManagedMonitorToolBase::regManagedHistograms
StatusCode regManagedHistograms(std::vector< MgmtParams< TH1 > > &templateHistograms)
Definition: ManagedMonitorToolBase.cxx:974
AthenaMonManager::envStringToEnum
static Environment_t envStringToEnum(const std::string &str)
Converts a string to an Environment_t of the same name.
Definition: AthenaMonManager.cxx:232
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
ManagedMonitorToolBase::Imp::m_bench_total
AthMonBench m_bench_total
Definition: ManagedMonitorToolBase.cxx:58
ManagedMonitorToolBase::lbDuration
virtual double lbDuration(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Luminosity block time (in seconds)
Definition: ManagedMonitorToolBase.cxx:1817
ManagedMonitorToolBase::m_trigDecTool
PublicToolHandle< Trig::ITrigDecisionTool > m_trigDecTool
Definition: ManagedMonitorToolBase.h:845
skel.it
it
Definition: skel.GENtoEVGEN.py:396
ManagedMonitorToolBase::Imp::~Imp
~Imp()
Definition: ManagedMonitorToolBase.cxx:43
ManagedMonitorToolBase::m_d
Imp * m_d
Definition: ManagedMonitorToolBase.h:899
ManagedMonitorToolBase::m_lastLowStatInterval
int m_lastLowStatInterval
Definition: ManagedMonitorToolBase.h:861
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
ManagedMonitorToolBase::OutputMetadata
Definition: ManagedMonitorToolBase.h:700
ManagedMonitorToolBase::m_triggerGroupProp
std::string m_triggerGroupProp
Definition: ManagedMonitorToolBase.h:855
ManagedMonitorToolBase::Imp::benchPostProcHistograms
void benchPostProcHistograms()
Definition: ManagedMonitorToolBase.cxx:127
ManagedMonitorToolBase::m_dataType
AthenaMonManager::DataType_t m_dataType
Definition: ManagedMonitorToolBase.h:838
ManagedMonitorToolBase::regGraph
virtual StatusCode regGraph(TGraph *g, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TGraph to be included in the output stream using logical parameters that describe the gra...
Definition: ManagedMonitorToolBase.cxx:1491
ManagedMonitorToolBase::m_useLumi
bool m_useLumi
Definition: ManagedMonitorToolBase.h:894
ManagedMonitorToolBase::m_newLowStatInterval
bool m_newLowStatInterval
Definition: ManagedMonitorToolBase.h:820
sendEI_SPB.root
root
Definition: sendEI_SPB.py:34
ManagedMonitorToolBase::fill
@ fill
Definition: ManagedMonitorToolBase.h:115
ManagedMonitorToolBase::parseList
StatusCode parseList(const std::string &, std::vector< std::string > &)
Definition: ManagedMonitorToolBase.cxx:2114
ManagedMonitorToolBase::regManagedEfficiencies
StatusCode regManagedEfficiencies(std::vector< MgmtParams< TEfficiency > > &templateEfficiencies)
Definition: ManagedMonitorToolBase.cxx:1141
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.TrigTLAMonitorAlgorithm.triggers
triggers
Definition: TrigTLAMonitorAlgorithm.py:196
ManagedMonitorToolBase::procHistograms
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
Definition: ManagedMonitorToolBase.cxx:1315
ManagedMonitorToolBase::MonGroup::badusage
static void badusage()
Definition: ManagedMonitorToolBase.cxx:185
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
ManagedMonitorToolBase::DefaultStream::getDirectoryName
virtual std::string getDirectoryName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, const bool usePreviousInterval)
A function that returns TDirectory path in a file that corresponds to a given MonGroup and object nam...
Definition: ManagedMonitorToolBase.cxx:1925
ManagedMonitorToolBase::Imp::m_bench_book
AthMonBench m_bench_book
Definition: ManagedMonitorToolBase.cxx:53
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
ManagedMonitorToolBase::GlobalDirectoryRestore
Private helper class.
Definition: ManagedMonitorToolBase.h:874
ManagedMonitorToolBase::Imp::benchFinalReport
void benchFinalReport()
Definition: ManagedMonitorToolBase.cxx:156
ManagedMonitorToolBase::regManagedTrees
StatusCode regManagedTrees(std::vector< MgmtParams< TTree > > &templateTrees)
Definition: ManagedMonitorToolBase.cxx:1202
ManagedMonitorToolBase::OutputMetadata::m_charArrSize
const int m_charArrSize
Definition: ManagedMonitorToolBase.h:715
ManagedMonitorToolBase::registerMetadata
StatusCode registerMetadata(const std::string &streamName, const std::string &hName, const MonGroup &group)
Definition: ManagedMonitorToolBase.cxx:947
AthenaMonManager::getLBsLowStat
static unsigned int getLBsLowStat()
Definition: AthenaMonManager.cxx:303
ManagedMonitorToolBase::checkHists
virtual StatusCode checkHists(bool calledFromFinalize)
This implementation does nothing; equivalent functionality may be provided by procHists(....
Definition: ManagedMonitorToolBase.cxx:1672
ManagedMonitorToolBase::m_newHigStatInterval
bool m_newHigStatInterval
Definition: ManagedMonitorToolBase.h:820
ReadCondHandle.h
ManagedMonitorToolBase::m_newMedStatInterval
bool m_newMedStatInterval
Definition: ManagedMonitorToolBase.h:820
TrigLiveFractionCondData::lbAverageLiveFraction
float lbAverageLiveFraction(bool highPriority=true) const
Luminosity-averaged live fraction over all physics BCIDs.
Definition: TrigLiveFractionCondData.cxx:66
ManagedMonitorToolBase::OutputMetadata::m_metadata
TTree * m_metadata
Definition: ManagedMonitorToolBase.h:716
ManagedMonitorToolBase::deregHist
virtual StatusCode deregHist(TH1 *h)
De-registers a TH1 from the THistSvc, but does NOT delete the object.
Definition: ManagedMonitorToolBase.cxx:1618
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
ManagedMonitorToolBase::lbLuminosityPerBCID
virtual float lbLuminosityPerBCID(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Instantaneous luminosity.
Definition: ManagedMonitorToolBase.cxx:1746
ManagedMonitorToolBase::Imp::m_bench_proc
AthMonBench m_bench_proc
Definition: ManagedMonitorToolBase.cxx:57
AthenaMonManager::environment
static Environment_t environment()
Returns the running environment of the monitoring application to help ManagedMonitorToolBase objects ...
Definition: AthenaMonManager.cxx:298
rerun_display.client
client
Definition: rerun_display.py:31
ManagedMonitorToolBase::OfflineStream::getStreamName
virtual std::string getStreamName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, bool usePreviousInterval=false)
A function that converts a MonGroup of logical parameters into a physical output stream name.
Definition: ManagedMonitorToolBase.cxx:1987
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
ManagedMonitorToolBase::OutputMetadata::fill
virtual void fill(const std::string &name, Interval_t interval, std::string trigger, std::string merge)
Definition: ManagedMonitorToolBase.cxx:1874
AthenaMonManager::getLBsMedStat
static unsigned int getLBsMedStat()
Definition: AthenaMonManager.cxx:306
ManagedMonitorToolBase::m_bookHistogramsInitial
bool m_bookHistogramsInitial
Definition: ManagedMonitorToolBase.h:893
ManagedMonitorToolBase::Imp::m_warnAboutMissingInitialize
bool m_warnAboutMissingInitialize
Definition: ManagedMonitorToolBase.cxx:48
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
ManagedMonitorToolBase::getNewStreamNameFcn
virtual StreamNameFcn * getNewStreamNameFcn() const
Definition: ManagedMonitorToolBase.cxx:2158
ManagedMonitorToolBase::m_preScaleProp
long m_preScaleProp
Definition: ManagedMonitorToolBase.h:853
ManagedMonitorToolBase::lbInteractionsPerCrossing
virtual float lbInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Instantaneous number of interactions, i.e.
Definition: ManagedMonitorToolBase.cxx:1710
ManagedMonitorToolBase::trigChainsArePassed
virtual bool trigChainsArePassed(std::vector< std::string > &)
Definition: ManagedMonitorToolBase.cxx:2095
ManagedMonitorToolBase.h
ManagedMonitorToolBase::m_fileKey
std::string m_fileKey
Definition: ManagedMonitorToolBase.h:833
ManagedMonitorToolBase::m_lastLumiBlock
unsigned int m_lastLumiBlock
Definition: ManagedMonitorToolBase.h:859
ManagedMonitorToolBase::MonGroup
A container of information describing a monitoring object.
Definition: ManagedMonitorToolBase.h:137
ManagedMonitorToolBase::m_vTrigGroupNames
std::vector< std::string > m_vTrigGroupNames
Definition: ManagedMonitorToolBase.h:680
ManagedMonitorToolBase::GlobalDirectoryRestore::GlobalDirectoryRestore
GlobalDirectoryRestore()
Definition: ManagedMonitorToolBase.cxx:2211
ManagedMonitorToolBase::Imp::m_bench_fillfirst
AthMonBench m_bench_fillfirst
Definition: ManagedMonitorToolBase.cxx:54
AthenaMonManager::tier0ESD
@ tier0ESD
Definition: AthenaMonManager.h:49
ManagedMonitorToolBase::lbAverageLivefraction
virtual float lbAverageLivefraction(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Average luminosity livefraction.
Definition: ManagedMonitorToolBase.cxx:1763
ManagedMonitorToolBase::m_templateGraphs
std::map< Interval_t, std::vector< MgmtParams< TGraph > > > m_templateGraphs
Definition: ManagedMonitorToolBase.h:668
AthenaMonManager::dataType
static DataType_t dataType()
Returns the data type that the monitoring application is running over to help ManagedMonitorToolBase ...
Definition: AthenaMonManager.cxx:315
ManagedMonitorToolBase::OutputMetadata::m_triggerData
char * m_triggerData
Definition: ManagedMonitorToolBase.h:720
AthenaMonManager
An Algorithm that manages a set of modules, each inheriting from ManagedMonitorToolBase,...
Definition: AthenaMonManager.h:34
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ManagedMonitorToolBase::m_manager
AthenaMonManager * m_manager
Definition: ManagedMonitorToolBase.h:829
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:617
ManagedMonitorToolBase::m_lumiDataKey
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
Definition: ManagedMonitorToolBase.h:887
AthenaMonManager::dataTypeStringToEnum
static DataType_t dataTypeStringToEnum(const std::string &str)
Converts a string to a DataType_t of the same name.
Definition: AthenaMonManager.cxx:268
ManagedMonitorToolBase::deregGraph
virtual StatusCode deregGraph(TGraph *g)
De-registers a TGraph from the THistSvc, but does NOT delete the object.
Definition: ManagedMonitorToolBase.cxx:1626
ManagedMonitorToolBase::m_streamNameFcn
StreamNameFcn * m_streamNameFcn
Definition: ManagedMonitorToolBase.h:841
ManagedMonitorToolBase::OutputMetadata::m_nameData
char * m_nameData
Definition: ManagedMonitorToolBase.h:717
ManagedMonitorToolBase::setMonManager
virtual void setMonManager(AthenaMonManager *manager)
Takes a pointer to a managing object to get information from it when needed.
Definition: ManagedMonitorToolBase.cxx:1328
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
ManagedMonitorToolBase::OutputMetadata::~OutputMetadata
virtual ~OutputMetadata()
Definition: ManagedMonitorToolBase.cxx:1862
lumiFormat.i
int i
Definition: lumiFormat.py:85
AthenaMonManager::tier0
@ tier0
Definition: AthenaMonManager.h:49
ITrigDecisionTool.h
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
ManagedMonitorToolBase::GlobalDirectoryRestore::~GlobalDirectoryRestore
~GlobalDirectoryRestore()
Definition: ManagedMonitorToolBase.cxx:2219
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthenaMonManager::online
@ online
Definition: AthenaMonManager.h:49
ManagedMonitorToolBase::file
@ file
Definition: ManagedMonitorToolBase.h:113
tolower
void tolower(std::string &s)
Definition: AthenaSummarySvc.cxx:111
AthenaMonManager::writeAndDelete
virtual void writeAndDelete(const std::string &key)
If the TObject is owned by this manager, its Write() method is called and it is deleted.
Definition: AthenaMonManager.cxx:665
getLatestRuns.interval
interval
Definition: getLatestRuns.py:24
ManagedMonitorToolBase::DefaultStream
Definition: ManagedMonitorToolBase.h:725
ManagedMonitorToolBase::ATTRIB_UNMANAGED
@ ATTRIB_UNMANAGED
Definition: ManagedMonitorToolBase.h:130
file
TFile * file
Definition: tile_monitor.h:29
ManagedMonitorToolBase::Imp::benchPostBookHistograms
void benchPostBookHistograms()
Definition: ManagedMonitorToolBase.cxx:84
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthenaMonManager::tier0Raw
@ tier0Raw
Definition: AthenaMonManager.h:49
ManagedMonitorToolBase::m_triggerChainProp
std::string m_triggerChainProp
Definition: ManagedMonitorToolBase.h:854
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ManagedMonitorToolBase::OnlineStream
Definition: ManagedMonitorToolBase.h:745
AthenaMonManager::user
@ user
Definition: AthenaMonManager.h:49
nEvents
int nEvents
Definition: fbtTestBasics.cxx:79
hist_file_dump.f
f
Definition: hist_file_dump.py:135
ManagedMonitorToolBase::MonGroup::ncopies
static unsigned ncopies()
Definition: ManagedMonitorToolBase.cxx:184
run
Definition: run.py:1
ManagedMonitorToolBase::OfflineStream
Definition: ManagedMonitorToolBase.h:752
ManagedMonitorToolBase::StreamNameFcn::getStreamName
virtual std::string getStreamName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, bool usePreviousInterval=false)=0
A function that converts a MonGroup of logical parameters into a physical output stream name.
ManagedMonitorToolBase::Imp::m_doResourceMon
bool m_doResourceMon
Definition: ManagedMonitorToolBase.cxx:51
ManagedMonitorToolBase::~ManagedMonitorToolBase
virtual ~ManagedMonitorToolBase()
Definition: ManagedMonitorToolBase.cxx:436
ManagedMonitorToolBase::ManagedMonitorToolBase
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ManagedMonitorToolBase.cxx:339
ManagedMonitorToolBase::medStat
@ medStat
Definition: ManagedMonitorToolBase.h:114
ManagedMonitorToolBase::MonGroup::deregObject
StatusCode deregObject(const std::string &objName)
De-registers a TObject from the THistSvc, but does NOT delete the object.
Definition: ManagedMonitorToolBase.cxx:302
ManagedMonitorToolBase::m_templateTrees
std::map< Interval_t, std::vector< MgmtParams< TTree > > > m_templateTrees
Definition: ManagedMonitorToolBase.h:672
ManagedMonitorToolBase::m_metadataMap
MDMap_t m_metadataMap
Definition: ManagedMonitorToolBase.h:827
ManagedMonitorToolBase::bookHists
virtual StatusCode bookHists()
Calls bookHists( true, true, true ) and initializes lumiBlock and run numbers.
Definition: ManagedMonitorToolBase.cxx:731
ManagedMonitorToolBase::Imp::benchReset
void benchReset()
Definition: ManagedMonitorToolBase.cxx:140
ManagedMonitorToolBase::m_endOfEventsBlock
bool m_endOfEventsBlock
Definition: ManagedMonitorToolBase.h:823
ManagedMonitorToolBase::m_trigLiveFractionDataKey
SG::ReadCondHandleKey< TrigLiveFractionCondData > m_trigLiveFractionDataKey
Definition: ManagedMonitorToolBase.h:891
TrigLiveFractionCondData::l1LiveFractionVector
const std::vector< float > & l1LiveFractionVector(bool highPriority=true) const
Return vector with all BCIDs indexed by BCID number.
Definition: TrigLiveFractionCondData.cxx:42
ManagedMonitorToolBase::m_environment
AthenaMonManager::Environment_t m_environment
Definition: ManagedMonitorToolBase.h:839
ManagedMonitorToolBase::MonGroup::regHist
StatusCode regHist(TH1 *h)
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Definition: ManagedMonitorToolBase.cxx:192
beamspotman.dir
string dir
Definition: beamspotman.py:623
ManagedMonitorToolBase::regEfficiency
virtual StatusCode regEfficiency(TEfficiency *e, const MonGroup &group)
Registers a TEfficiency to be included in the output stream using logical parameters that describe th...
Definition: ManagedMonitorToolBase.cxx:1446
LBDurationCondData::lbDuration
double lbDuration() const
Definition: LBDurationCondData.cxx:27
ManagedMonitorToolBase::OutputMetadata::OutputMetadata
OutputMetadata(TTree *metadata)
Definition: ManagedMonitorToolBase.cxx:1839
ManagedMonitorToolBase::m_lastRun
unsigned int m_lastRun
Definition: ManagedMonitorToolBase.h:860
ManagedMonitorToolBase::intervalStringToEnum
static Interval_t intervalStringToEnum(const std::string &str)
Converts a string to the corresponding Interval_t.
Definition: ManagedMonitorToolBase.cxx:579
ManagedMonitorToolBase::DefaultStream::getStreamName
virtual std::string getStreamName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, bool usePreviousInterval=false)
A function that converts a MonGroup of logical parameters into a physical output stream name.
Definition: ManagedMonitorToolBase.cxx:1913
ManagedMonitorToolBase::MonGroup::regEfficiency
StatusCode regEfficiency(TEfficiency *e)
Registers a TEfficiency to be included in the output stream.
Definition: ManagedMonitorToolBase.cxx:228
ManagedMonitorToolBase::m_newLumiBlock
bool m_newLumiBlock
Definition: ManagedMonitorToolBase.h:821
ManagedMonitorToolBase::m_endOfLowStat
bool m_endOfLowStat
Definition: ManagedMonitorToolBase.h:823
ManagedMonitorToolBase::m_lbDurationDataKey
SG::ReadCondHandleKey< LBDurationCondData > m_lbDurationDataKey
Definition: ManagedMonitorToolBase.h:889
ManagedMonitorToolBase::OfflineStream::updateRunLB
void updateRunLB()
Definition: ManagedMonitorToolBase.cxx:2088
ManagedMonitorToolBase::bookHistogramsRecurrent
virtual StatusCode bookHistogramsRecurrent()
An inheriting class should either override this function, bookHists() or bookHistograms().
Definition: ManagedMonitorToolBase.cxx:1287
AthMonBench::s_resourceMonThreshold
static const MSG::Level s_resourceMonThreshold
Definition: AthMonBench.h:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthMonBench.h
AthenaMonManager::getLBsHigStat
static unsigned int getLBsHigStat()
Definition: AthenaMonManager.cxx:309
AthMonBench::startMeasurement
void startMeasurement()
Definition: AthMonBench.h:76
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
ManagedMonitorToolBase::OfflineStream::getLBrange
void getLBrange(int *, int *, int, int)
Definition: ManagedMonitorToolBase.cxx:1978
ManagedMonitorToolBase::Imp::Imp
Imp(ManagedMonitorToolBase *tc)
Definition: ManagedMonitorToolBase.cxx:39
ManagedMonitorToolBase::OnlineStream::getDirectoryName
virtual std::string getDirectoryName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, const bool usePreviousInterval)
A function that returns TDirectory path in a file that corresponds to a given MonGroup and object nam...
Definition: ManagedMonitorToolBase.cxx:1971
ExtractEBRunDetails.endOfRun
endOfRun
Definition: ExtractEBRunDetails.py:245
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ManagedMonitorToolBase::OfflineStream::getDirectoryName
virtual std::string getDirectoryName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, const bool usePreviousInterval)
A function that returns TDirectory path in a file that corresponds to a given MonGroup and object nam...
Definition: ManagedMonitorToolBase.cxx:2075
item
Definition: ItemListSvc.h:43
DiTauRecTools::parseString
std::vector< TString > parseString(const TString &str, const TString &delim=",")
Definition: Reconstruction/DiTauRecTools/Root/HelperFunctions.cxx:19
WriteBchToCool.user
user
Definition: WriteBchToCool.py:76
ManagedMonitorToolBase::lowStat
@ lowStat
Definition: ManagedMonitorToolBase.h:114
ManagedMonitorToolBase::updateTriggersForGroups
void updateTriggersForGroups(std::vector< std::string > &)
Definition: ManagedMonitorToolBase.cxx:2133
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
ManagedMonitorToolBase::OnlineStream::getStreamName
virtual std::string getStreamName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, bool usePreviousInterval=false)
A function that converts a MonGroup of logical parameters into a physical output stream name.
Definition: ManagedMonitorToolBase.cxx:1956
ManagedMonitorToolBase::m_managerNameProp
std::string m_managerNameProp
Definition: ManagedMonitorToolBase.h:831
ManagedMonitorToolBase::lbLumiWeight
virtual double lbLumiWeight(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Average Integrated Luminosity Live Fraction.
Definition: ManagedMonitorToolBase.cxx:1801
ManagedMonitorToolBase::MonGroup::regGraph
StatusCode regGraph(TGraph *g)
Registers a TGraph to be included in the output stream using logical parameters that describe the his...
Definition: ManagedMonitorToolBase.cxx:238
ManagedMonitorToolBase::m_nEventsIgnoreTrigger
unsigned int m_nEventsIgnoreTrigger
Definition: ManagedMonitorToolBase.h:864
ManagedMonitorToolBase::run
@ run
Definition: ManagedMonitorToolBase.h:115
ManagedMonitorToolBase::m_endOfRun
bool m_endOfRun
Definition: ManagedMonitorToolBase.h:823
ManagedMonitorToolBase::m_newLowStat
bool m_newLowStat
Definition: ManagedMonitorToolBase.h:821
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
ManagedMonitorToolBase::MonGroup::writeAndDelete
StatusCode writeAndDelete(TH1 *h)
Write and delete a histogram.
Definition: ManagedMonitorToolBase.cxx:262
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
ManagedMonitorToolBase::StreamNameFcn::parseString
static void parseString(const std::string &streamName, std::string &root, std::string &rem)
A helper non-virtual function, parses id string.
Definition: ManagedMonitorToolBase.cxx:2186
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
h
ManagedMonitorToolBase::OutputMetadata::m_mergeData
char * m_mergeData
Definition: ManagedMonitorToolBase.h:721
AthenaMonManager::forkedProcess
bool forkedProcess()
Definition: AthenaMonManager.cxx:322
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
ManagedMonitorToolBase::m_lastHigStatInterval
int m_lastHigStatInterval
Definition: ManagedMonitorToolBase.h:861
ManagedMonitorToolBase::MonGroup::getHist
StatusCode getHist(TH1 *&h, const std::string &hName)
Returns a TH1 via the pointer passed as the first argument.
Definition: ManagedMonitorToolBase.cxx:206
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ManagedMonitorToolBase::Imp::benchPreBookHistograms
void benchPreBookHistograms()
Definition: ManagedMonitorToolBase.cxx:75
ManagedMonitorToolBase::m_nLumiBlocks
unsigned int m_nLumiBlocks
Definition: ManagedMonitorToolBase.h:865
AthenaMonManager::altprod
@ altprod
Definition: AthenaMonManager.h:49
ManagedMonitorToolBase::eventsBlock
@ eventsBlock
Definition: ManagedMonitorToolBase.h:113
ManagedMonitorToolBase::OutputMetadata::copyString
void copyString(char *to, const std::string &from)
Definition: ManagedMonitorToolBase.cxx:1900
python.envutil.filelist
filelist
print ("Checking files %s..." % fullfile)
Definition: envutil.py:133
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ManagedMonitorToolBase::Imp::m_theclass
ManagedMonitorToolBase * m_theclass
Definition: ManagedMonitorToolBase.cxx:46
DEBUG
#define DEBUG
Definition: page_access.h:11
ManagedMonitorToolBase::finalHists
virtual StatusCode finalHists()
Calls procHists( true, true, true ).
Definition: ManagedMonitorToolBase.cxx:1257
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ManagedMonitorToolBase::all
@ all
Definition: ManagedMonitorToolBase.h:115
ManagedMonitorToolBase::deregObject
virtual StatusCode deregObject(const std::string &objName, const std::string &system, Interval_t interval)
De-registers a TObject from the THistSvc, but does NOT delete the object.
Definition: ManagedMonitorToolBase.cxx:1634
ManagedMonitorToolBase::NoOutputStream::getDirectoryName
virtual std::string getDirectoryName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, const bool usePreviousInterval)
A function that returns TDirectory path in a file that corresponds to a given MonGroup and object nam...
Definition: ManagedMonitorToolBase.cxx:1949
ManagedMonitorToolBase::StreamNameFcn::getDirectoryName
virtual std::string getDirectoryName(const ManagedMonitorToolBase *tool, const MonGroup &group, const std::string &objName, const bool usePreviousInterval)=0
A function that returns TDirectory path in a file that corresponds to a given MonGroup and object nam...
ManagedMonitorToolBase::MonGroup::deregHist
StatusCode deregHist(TH1 *h)
De-registers a TH1 from the THistSvc, but does NOT delete the object.
Definition: ManagedMonitorToolBase.cxx:276
ManagedMonitorToolBase::fillHistograms
virtual StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition: ManagedMonitorToolBase.cxx:1307
ManagedMonitorToolBase::lbAverageLuminosity
virtual float lbAverageLuminosity(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Average luminosity (in ub-1 s-1 => 10^30 cm-2 s-1)
Definition: ManagedMonitorToolBase.cxx:1730
str
Definition: BTagTrackIpAccessor.cxx:11
python.Logging.manager
manager
Definition: PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/Logging.py:92
ManagedMonitorToolBase::m_useTrigger
bool m_useTrigger
Definition: ManagedMonitorToolBase.h:857
ManagedMonitorToolBase::m_detailLevel
unsigned int m_detailLevel
Definition: ManagedMonitorToolBase.h:836
ManagedMonitorToolBase::m_haveClearedLastEventBlock
bool m_haveClearedLastEventBlock
Definition: ManagedMonitorToolBase.h:866
AthenaMonManager::lumiBlockNumber
static unsigned int lumiBlockNumber()
Definition: AthenaMonManager.cxx:329
AthAlgTool
Definition: AthAlgTool.h:26
IDQFilterTool.h
ManagedMonitorToolBase::m_templateHistograms
std::map< Interval_t, std::vector< MgmtParams< TH1 > > > m_templateHistograms
Definition: ManagedMonitorToolBase.h:664
ManagedMonitorToolBase::Imp::m_bench_filllast
AthMonBench m_bench_filllast
Definition: ManagedMonitorToolBase.cxx:56
ManagedMonitorToolBase::ATTRIB_X_VS_LB
@ ATTRIB_X_VS_LB
Definition: ManagedMonitorToolBase.h:130
ManagedMonitorToolBase::Imp::s_svcLocator
static std::atomic< ISvcLocator * > s_svcLocator
Definition: ManagedMonitorToolBase.cxx:38
python.PyAthena.obj
obj
Definition: PyAthena.py:132
ManagedMonitorToolBase::m_trigTranslator
PublicToolHandle< ITriggerTranslatorTool > m_trigTranslator
Definition: ManagedMonitorToolBase.h:847
ManagedMonitorToolBase::m_lastMedStatInterval
int m_lastMedStatInterval
Definition: ManagedMonitorToolBase.h:861
ManagedMonitorToolBase::m_vTrigChainNames
std::vector< std::string > m_vTrigChainNames
Definition: ManagedMonitorToolBase.h:680
AthMonBench
Definition: AthMonBench.h:25
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
ManagedMonitorToolBase::MonGroup::deregAll
StatusCode deregAll()
De-registers all TH1 objects from the THistSvc, but does NOT delete the objects.
Definition: ManagedMonitorToolBase.cxx:314
ManagedMonitorToolBase::regHist
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Definition: ManagedMonitorToolBase.cxx:1346
merge
Definition: merge.py:1
AthenaMonManager::noOutput
@ noOutput
Definition: AthenaMonManager.h:49
AthenaMonManager::monteCarlo
@ monteCarlo
Definition: AthenaMonManager.h:58
ManagedMonitorToolBase::intervalEnumToString
static std::string intervalEnumToString(Interval_t interval)
Converts a LevelOfDetail_t to a string of the same name.
Definition: ManagedMonitorToolBase.cxx:537
ManagedMonitorToolBase::MonGroup::regTree
StatusCode regTree(TTree *t)
Registers a TTree to be included in the output stream using logical parameters that describe the hist...
Definition: ManagedMonitorToolBase.cxx:250
ManagedMonitorToolBase::m_defaultLBDuration
float m_defaultLBDuration
Definition: ManagedMonitorToolBase.h:895
ServiceHandle< Gaudi::Interfaces::IOptionsSvc >
ManagedMonitorToolBase::lbAverageInteractionsPerCrossing
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Average mu, i.e.
Definition: ManagedMonitorToolBase.cxx:1694