An Algorithm that manages a set of modules, each inheriting from ManagedMonitorToolBase, by setting common configuration variables and organizing the output data.
More...
#include <AthenaMonManager.h>
|
| enum | Environment_t {
user = 0
, noOutput
, online
, tier0
,
tier0Raw
, tier0ESD
, AOD
, altprod
} |
| | An enumeration of the different types of running environment the monitoring application may be in. More...
|
| enum | DataType_t {
userDefined = 0
, monteCarlo
, collisions
, cosmics
,
heavyIonCollisions
} |
| | An enumeration of the different types of data the monitoring application may be running over. More...
|
An Algorithm that manages a set of modules, each inheriting from ManagedMonitorToolBase, by setting common configuration variables and organizing the output data.
It provides all the functionality and behaviour of AthenaMon.
- Author
- Michael Wilson, CERN, January 2007
Definition at line 34 of file AthenaMonManager.h.
◆ StoreGateSvc_t
◆ DataType_t
An enumeration of the different types of data the monitoring application may be running over.
This can be used to select which histograms to produce, e.g., to prevent the production of colliding-beam histograms when running on cosmic-ray data. Strings of the same names may be given as jobOptions.
| Enumerator |
|---|
| userDefined | |
| monteCarlo | |
| collisions | |
| cosmics | |
| heavyIonCollisions | |
Definition at line 58 of file AthenaMonManager.h.
◆ Environment_t
An enumeration of the different types of running environment the monitoring application may be in.
The running environment may be used to select which histograms are produced, and where they are located in the output. For example, the output paths of the histograms are different for the "user", "online" and the various offline flags. The 'tier0Raw' and 'tier0ESD' are used to select sets of histograms for production either during the RAW --> ESD transform or during the ESD --> AOD transform (but not both!) Strings of the same names may be given as jobOptions.
| Enumerator |
|---|
| user | |
| noOutput | |
| online | |
| tier0 | |
| tier0Raw | |
| tier0ESD | |
| AOD | |
| altprod | |
Definition at line 49 of file AthenaMonManager.h.
◆ AthenaMonManager()
| AthenaMonManager::AthenaMonManager |
( |
const std::string & | name, |
|
|
ISvcLocator * | pSvcLocator ) |
Definition at line 193 of file AthenaMonManager.cxx.
198 ,
m_d(
new Imp(
this, name))
199{
213
216}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
static std::atomic< ISvcLocator * > s_svcLocator
ToolHandleArray< IMonitorToolBase > m_monTools
ServiceHandle< ITHistSvc > m_THistSvc
◆ ~AthenaMonManager()
| AthenaMonManager::~AthenaMonManager |
( |
| ) |
|
|
virtual |
◆ dataType()
Returns the data type that the monitoring application is running over to help ManagedMonitorToolBase objects determine which histograms to produce.
Definition at line 313 of file AthenaMonManager.cxx.
315{
316 return Imp::s_dataType;
317}
◆ dataTypeStringToEnum()
Converts a string to a DataType_t of the same name.
Definition at line 266 of file AthenaMonManager.cxx.
268{
269 std::string lcstr( strToLower(str) );
270
271 if( lcstr == "userdefined" )
273 else if( lcstr == "montecarlo" )
275 else if( lcstr == "collisions" )
277 else if( lcstr == "cosmics" )
279 else if( lcstr == "heavyioncollisions" )
281
285 MsgStream
log( ms,
"AthenaMonManager::dataTypeStringToEnum()" );
286 log << MSG::WARNING <<
"Unknown AthenaMonManager::DataType_t \""
287 <<
str <<
"\", returning \"userDefined\"" <<
endmsg;
288 }
289 }
290
292}
◆ declareGaudiProperty()
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
158 {
161 hndl.documentation());
162
163 }
◆ declareProperty()
Definition at line 145 of file AthCommonDataStore.h.
145 {
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
◆ detStore()
◆ environment()
Returns the running environment of the monitoring application to help ManagedMonitorToolBase objects determine which histograms to produce.
Definition at line 296 of file AthenaMonManager.cxx.
298{
299 return Imp::s_environment;
300}
◆ envStringToEnum()
Converts a string to an Environment_t of the same name.
static method (shared by all AthenaMonManager instances during run-time)
Definition at line 230 of file AthenaMonManager.cxx.
232{
233 std::string lcstr( strToLower(str) );
234
235 if( lcstr == "user" )
237 else if( lcstr == "nooutput" )
239 else if( lcstr == "online" )
241 else if( lcstr == "tier0" )
243 else if( lcstr == "tier0raw" )
245 else if( lcstr == "tier0esd" )
247 else if( lcstr == "aod" )
249 else if( lcstr == "altprod" )
251
255 MsgStream
log( ms,
"AthenaMonManager::envStringToEnum()" );
256 log << MSG::WARNING <<
"Unknown AthenaMonManager::Environment_t \""
257 <<
str <<
"\", returning \"user\"" <<
endmsg;
258 }
259 }
260
262}
◆ evtStore()
◆ execute()
| StatusCode AthenaMonManager::execute |
( |
| ) |
|
|
virtual |
Definition at line 467 of file AthenaMonManager.cxx.
469{
470 m_d->m_forkedProcess=
false;
471 pid_t currPID=getpid();
472
473 if (
m_d->m_lastPID!=0 &&
m_d->m_lastPID!=currPID) {
474 m_d->m_forkedProcess=
true;
476 }
477 m_d->m_lastPID=currPID;
478
480 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"AthenaMonManager::execute():" <<
endmsg;
481
482
483
484
486 if (
name() ==
"HLTMonManager") {
487 ATH_MSG_DEBUG(
"HLTMonManager is obtaining the TrigNavigationThinningSvc lock in slot "
488 << Gaudi::Hive::currentContext().slot() << " for event " << Gaudi::Hive::currentContext().eventID().event_number() );
489 hltLock.lock();
490 }
491
493
494 ToolHandleArray<IMonitorToolBase>::iterator monToolsEnd =
m_monTools.end();
495 for( ToolHandleArray<IMonitorToolBase>::iterator i =
m_monTools.begin(); i != monToolsEnd; ++i ) {
496 ToolHandle<IMonitorToolBase>&
tool = *
i;
497 m_d->toolAudStart(tool);
498 AthMonBench bench_tmp;
499 if (
m_d->m_doResourceMon)
501 if(
tool->preSelector() ) {
502
504
505 if( !
sc.isSuccess() ) {
506 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::fillHists() unsuccessful" <<
endmsg;
507 }
508 }
509
510
511 if (
m_d->m_doResourceMon) {
514 tb->m_bench_algexec_fillHists += bench_tmp;
515 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> m_doResourceMon is True" <<
endmsg;
516 }
518 }
519 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> Done calling IMonitorToolBase::fillHists()" <<
endmsg;
520
521 if(
m_d->m_eventCounter > 0 ) {
522 m_d->m_eventCounter--;
523 }
524 else if(
m_d->m_eventCounter == 0 ) {
525 for( ToolHandleArray<IMonitorToolBase>::iterator i =
m_monTools.begin(); i != monToolsEnd; ++i ) {
526 ToolHandle<IMonitorToolBase>&
tool = *
i;
527 m_d->toolAudStart(tool);
528 AthMonBench bench_tmp;
529
530 if (
m_d->m_doResourceMon)
532 sc =
tool->checkHists(
false);
533 if (
m_d->m_doResourceMon) {
536 tb->m_bench_algexec_checkHists += bench_tmp;
537 }
538 if( !
sc.isSuccess() ) {
539 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::checkHists() unsuccessful" <<
endmsg;
540 }
542 }
543 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> Done calling IMonitorToolBase::checkHists()" <<
endmsg;
544
545 m_d->m_eventCounter =
m_d->m_everyNevents;
546 }
547 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> Exiting successfully" <<
endmsg;
548
550 return StatusCode::SUCCESS;
551}
bool msgLvl(const MSG::Level lvl) const
static std::mutex s_mutex
::StatusCode StatusCode
StatusCode definition for legacy code.
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ extraOutputDeps()
| const DataObjIDColl & AthAlgorithm::extraOutputDeps |
( |
| ) |
const |
|
overridevirtualinherited |
Return the list of extra output dependencies.
This list is extended to include symlinks implied by inheritance relations.
Definition at line 50 of file AthAlgorithm.cxx.
51{
52
53
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects
◆ fileKey()
| std::string AthenaMonManager::fileKey |
( |
| ) |
const |
|
virtual |
◆ fillNumber()
| unsigned int AthenaMonManager::fillNumber |
( |
| ) |
|
|
static |
◆ finalize()
| StatusCode AthenaMonManager::finalize |
( |
| ) |
|
|
virtual |
◆ forkedProcess()
| bool AthenaMonManager::forkedProcess |
( |
| ) |
|
◆ getLBsHigStat()
| unsigned int AthenaMonManager::getLBsHigStat |
( |
| ) |
|
|
static |
◆ getLBsLowStat()
| unsigned int AthenaMonManager::getLBsLowStat |
( |
| ) |
|
|
static |
◆ getLBsMedStat()
| unsigned int AthenaMonManager::getLBsMedStat |
( |
| ) |
|
|
static |
◆ initialize()
| StatusCode AthenaMonManager::initialize |
( |
| ) |
|
|
virtual |
Definition at line 359 of file AthenaMonManager.cxx.
361{
363
364 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"AthenaMonManager::initialize():" <<
endmsg;
365
368
370
372 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> Initializing static data" <<
endmsg;
373
375 msg(MSG::DEBUG) <<
" * \"ManualDataTypeSetup\" = " <<
m_d->m_manualDataTypeSetupProp <<
endmsg;
376 }
377
378#if 0
379 if(
m_d->m_manualDataTypeSetupProp ) {
380 Imp::s_dataTypeStr =
m_d->m_dataTypeProp;
382 }
383 else
384#endif
385 {
386 Imp::s_dataTypeStr =
m_d->m_dataTypeProp;
388 }
389
390 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" * \"DataType\" = " << Imp::s_dataType <<
endmsg;
391
392 Imp::s_environmentStr =
m_d->m_environmentProp;
394
395 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" * \"Environment\" = " << Imp::s_environment <<
endmsg;
396
397 Imp::s_LBsLowStat =
m_d->m_LBsLowStatProp;
398 Imp::s_LBsMedStat =
m_d->m_LBsMedStatProp;
399 Imp::s_LBsHigStat =
m_d->m_LBsHigStatProp;
401 msg(MSG::DEBUG) <<
" * \"LBsInLowStatInterval\" = " << Imp::s_LBsLowStat <<
endmsg;
402 msg(MSG::DEBUG) <<
" * \"LBsInMediumStatInterval\" = " << Imp::s_LBsMedStat <<
endmsg;
403 msg(MSG::DEBUG) <<
" * \"LBsInHighStatInterval\" = " << Imp::s_LBsHigStat <<
endmsg;
404 }
405
406 m_d->m_isPrimaryManager =
true;
408
409 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" * \"ManualRunLBSetup\" = " <<
m_d->m_manualRunLBProp <<
endmsg;
410
411 if(
m_d->m_manualRunLBProp ) {
412 Imp::s_run =
m_d->m_runProp;
413 Imp::s_lumiBlock =
m_d->m_lumiBlockProp;
414 Imp::s_runLBOverridden = true;
416 msg(MSG::DEBUG) <<
" --> using run = " << Imp::s_run <<
", lumiBlock = " << Imp::s_lumiBlock <<
endmsg;
417 } else {
419 msg(MSG::DEBUG) <<
" --> using run = " << Imp::s_run <<
", lumiBlock = " << Imp::s_lumiBlock <<
endmsg;
420 }
421 }
422
423
424 m_d->m_dataTypeProp = Imp::s_dataTypeStr;
425 m_d->m_environmentProp = Imp::s_environmentStr;
426
427
428 ServiceHandle<Gaudi::Interfaces::IOptionsSvc> joSvc(
"JobOptionsSvc",
name());
431
432 const std::string
client =
name() + std::string(
"Properties");
433 ATH_MSG_DEBUG(
" --> Adding properties under name \"" << client <<
"\"");
434 joSvc->set( client +
".FileKey",
m_d->m_fileKeyProp );
435 joSvc->set( client +
".DataType",
m_d->m_dataTypeProp );
436 joSvc->set( client +
".Environment",
m_d->m_environmentProp );
437
440 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> Retrieved AthenaMonTools" <<
endmsg;
441 }
442
443 m_d->m_eventCounter =
m_d->m_everyNevents;
444
445 ToolHandleArray<IMonitorToolBase>::iterator monToolsEnd =
m_monTools.end();
446 for( ToolHandleArray<IMonitorToolBase>::iterator i =
m_monTools.begin(); i != monToolsEnd; ++i ) {
447 ToolHandle<IMonitorToolBase>&
tool = *
i;
448 AthMonBench bench_tmp;
449 IMonitorToolBase*
mon =
tool.operator->();
450 ManagedMonitorToolBase* managed =
dynamic_cast<ManagedMonitorToolBase*
>(
mon );
451 if( managed != 0 ) {
453 }
454 if (
m_d->m_doResourceMon) {
456 tb->m_bench_alginit_retrieve = bench_tmp;
457 }
458
459 }
460 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
" --> Exiting successfully" <<
endmsg;
461
462 return StatusCode::SUCCESS;
463}
#define ATH_CHECK
Evaluate an expression and check for errors.
static const MSG::Level s_resourceMonThreshold
static std::atomic< bool > s_staticDataAreInit
static Environment_t envStringToEnum(const std::string &str)
Converts a string to an Environment_t of the same name.
static DataType_t dataTypeStringToEnum(const std::string &str)
Converts a string to a DataType_t of the same name.
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ lumiBlockNumber()
| unsigned int AthenaMonManager::lumiBlockNumber |
( |
| ) |
|
|
static |
Definition at line 327 of file AthenaMonManager.cxx.
329{
330 if (Imp::s_runLBOverridden) {
331 return Imp::s_lumiBlock;
332 } else {
333 return Gaudi::Hive::currentContext().eventID().lumi_block();
334 }
335}
◆ msg()
◆ msgLvl()
| bool AthCommonMsg< Algorithm >::msgLvl |
( |
const MSG::Level | lvl | ) |
const |
|
inlineinherited |
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ passOwnership()
| void AthenaMonManager::passOwnership |
( |
TObject * | h, |
|
|
const std::string & | key ) |
|
virtual |
Pass ownership of a TObject to this manager so that it will be deleted appropriately.
Definition at line 654 of file AthenaMonManager.cxx.
656{
657 m_d->m_objMap.emplace( key, h );
658}
◆ renounce()
Definition at line 380 of file AthCommonDataStore.h.
381 {
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
◆ renounceArray()
◆ runNumber()
| unsigned int AthenaMonManager::runNumber |
( |
| ) |
|
|
static |
Definition at line 339 of file AthenaMonManager.cxx.
341{
342 if (Imp::s_runLBOverridden) {
343 return Imp::s_run;
344 } else {
345 return Gaudi::Hive::currentContext().eventID().run_number();
346 }
347}
◆ start()
| StatusCode AthenaMonManager::start |
( |
| ) |
|
|
virtual |
Definition at line 610 of file AthenaMonManager.cxx.
612{
614 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"AthenaMonManager::start():" <<
endmsg;
615
617
618 ToolHandleArray<IMonitorToolBase>::iterator monToolsEnd =
m_monTools.end();
619 for( ToolHandleArray<IMonitorToolBase>::iterator i =
m_monTools.begin(); i != monToolsEnd; ++i ) {
620 ToolHandle<IMonitorToolBase>&
tool = *
i;
621 m_d->toolAudStart(tool);
622 AthMonBench bench_tmp;
623 if (
m_d->m_doResourceMon)
626 if (
m_d->m_doResourceMon) {
629 tb->m_bench_algexec_bookHists += bench_tmp;
630 }
631 if( !
sc.isSuccess() ) {
632 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::bookHists() unsuccessful" <<
endmsg;
633 }
635 }
637 msg(MSG::DEBUG) <<
" --> Done calling IMonitorToolBase::bookHists()" <<
endmsg;
638 msg(MSG::DEBUG) <<
" --> Exiting successfully" <<
endmsg;
639 }
640
641 return StatusCode::SUCCESS;
642}
◆ stop()
| StatusCode AthenaMonManager::stop |
( |
| ) |
|
|
virtual |
Definition at line 562 of file AthenaMonManager.cxx.
564{
566 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"AthenaMonManager::finalize():" <<
endmsg;
567
569
570 ToolHandleArray<IMonitorToolBase>::iterator monToolsEnd =
m_monTools.end();
571 for( ToolHandleArray<IMonitorToolBase>::iterator i =
m_monTools.begin(); i != monToolsEnd; ++i ) {
572 ToolHandle<IMonitorToolBase>&
tool = *
i;
573 m_d->toolAudStart(tool);
574
576 if( !
sc.isSuccess() ) {
577 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::runStat() unsuccessful" <<
endmsg;
578 }
579
581 if (tb)
582 tb->m_bench_algfin_finalHists.startMeasurement();
584 if (tb)
585 tb->m_bench_algfin_finalHists.finishMeasurement();
586 if( !
sc.isSuccess() ) {
587 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::finalHists() unsuccessful" <<
endmsg;
588 }
589 if (tb)
590 tb->m_bench_algfin_checkHists.startMeasurement();
591 sc =
tool->checkHists(
true);
592 if (tb)
593 tb->m_bench_algfin_checkHists.finishMeasurement();
594 if( !
sc.isSuccess() ) {
595 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::checkHists() unsuccessful" <<
endmsg;
596 }
597 if (tb)
600 }
602 msg(MSG::DEBUG) <<
" --> Done calling IMonitorToolBase::finalHists() and IMonitorToolBase::checkHists()" <<
endmsg;
603 msg(MSG::DEBUG) <<
" --> Exiting successfully" <<
endmsg;
604 }
605 return StatusCode::SUCCESS;
606}
◆ sysInitialize()
| StatusCode AthAlgorithm::sysInitialize |
( |
| ) |
|
|
overridevirtualinherited |
Override sysInitialize.
Override sysInitialize from the base class.
Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc
Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc
Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.
Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.
Definition at line 66 of file AthAlgorithm.cxx.
66 {
68
71 }
72 ServiceHandle<ICondSvc> cs(
"CondSvc",
name());
74 if (
h->isCondition() &&
h->mode() == Gaudi::DataHandle::Writer) {
75
76 if ( cs.retrieve().isFailure() ) {
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR(
"unable to register WriteCondHandle " <<
h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
88}
#define ATH_MSG_WARNING(x)
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
Definition at line 308 of file AthCommonDataStore.h.
308 {
309
310
313 for (
auto k :
keys) {
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka
◆ writeAndDelete()
| void AthenaMonManager::writeAndDelete |
( |
const std::string & | key | ) |
|
|
virtual |
If the TObject is owned by this manager, its Write() method is called and it is deleted.
Definition at line 662 of file AthenaMonManager.cxx.
664{
665
666
667
668 Imp::ObjMap_t::iterator
i =
m_d->m_objMap.find( key );
669 if( i !=
m_d->m_objMap.end() ) {
670 TObject* o =
i->second;
671 TH1*
h =
dynamic_cast<TH1*
>( o );
672 if( h != 0 ) {
673
674
675
676
677 bool doRecursiveReferenceDelete = gROOT->MustClean();
678 gROOT->SetMustClean(false);
679 TDirectory*
dir =
h->GetDirectory();
681 if( dir )
685
687 if( !
sc.isSuccess() ) {
688 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"AthenaMonManager::WriteAndDeleteHist(): Failure to deReg( TObject* )" <<
endmsg;
689 }
690 delete o;
691 gROOT->SetMustClean(doRecursiveReferenceDelete);
692 m_d->m_objMap.erase( key );
693 }
694 }
695}
◆ m_d
| Imp* AthenaMonManager::m_d |
|
private |
◆ m_detStore
◆ m_evtStore
◆ m_extendedExtraObjects
| DataObjIDColl AthAlgorithm::m_extendedExtraObjects |
|
privateinherited |
◆ m_monTools
◆ m_THistSvc
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files: