![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "TDirectory.h"
19 #include "Gaudi/Interfaces/IOptionsSvc.h"
20 #include "GaudiKernel/IMessageSvc.h"
21 #include "GaudiKernel/ISvcLocator.h"
22 #include "GaudiKernel/ITHistSvc.h"
23 #include "GaudiKernel/MsgStream.h"
24 #include "Gaudi/Property.h"
25 #include "GaudiKernel/ServiceHandle.h"
77 typedef std::map<std::string,TObject*>
ObjMap_t;
199 std::string strToLower(
const std::string&
str );
255 std::string lcstr( strToLower(
str) );
257 if( lcstr ==
"user" )
259 else if( lcstr ==
"nooutput" )
261 else if( lcstr ==
"online" )
263 else if( lcstr ==
"tier0" )
265 else if( lcstr ==
"tier0raw" )
267 else if( lcstr ==
"tier0esd" )
269 else if( lcstr ==
"aod" )
271 else if( lcstr ==
"altprod" )
277 if(
sc.isSuccess() ) {
278 MsgStream
log(
ms,
"AthenaMonManager::envStringToEnum()" );
279 log << MSG::WARNING <<
"Unknown AthenaMonManager::Environment_t \""
280 <<
str <<
"\", returning \"user\"" <<
endmsg;
292 std::string lcstr( strToLower(
str) );
294 if( lcstr ==
"userdefined" )
296 else if( lcstr ==
"montecarlo" )
298 else if( lcstr ==
"collisions" )
300 else if( lcstr ==
"cosmics" )
302 else if( lcstr ==
"heavyioncollisions" )
308 if(
sc.isSuccess() ) {
309 MsgStream
log(
ms,
"AthenaMonManager::dataTypeStringToEnum()" );
310 log << MSG::WARNING <<
"Unknown AthenaMonManager::DataType_t \""
311 <<
str <<
"\", returning \"userDefined\"" <<
endmsg;
323 return Imp::s_environment;
327 return Imp::s_LBsLowStat;
330 return Imp::s_LBsMedStat;
333 return Imp::s_LBsHigStat;
340 return Imp::s_dataType;
354 if (Imp::s_runLBOverridden) {
355 return Imp::s_lumiBlock;
357 return Gaudi::Hive::currentContext().eventID().lumi_block();
366 if (Imp::s_runLBOverridden) {
369 return Gaudi::Hive::currentContext().eventID().run_number();
402 if( !
sc.isSuccess() ) {
403 msg(MSG::ERROR) <<
"!! Unable to locate the THistSvc service !!" <<
endmsg;
414 #if 0 // The two branches of the conditional are identical.
450 Imp::s_runLBOverridden =
true;
452 msg(
MSG::DEBUG) <<
" --> using run = " << Imp::s_run <<
", lumiBlock = " << Imp::s_lumiBlock <<
endmsg;
455 msg(
MSG::DEBUG) <<
" --> using run = " << Imp::s_run <<
", lumiBlock = " << Imp::s_lumiBlock <<
endmsg;
468 const std::string
client =
name() + std::string(
"Properties");
480 if( !
sc.isSuccess() ) {
491 ToolHandle<IMonitorToolBase>&
tool = *
i;
500 tb->m_bench_alginit_retrieve = bench_tmp;
506 return StatusCode::SUCCESS;
515 pid_t currPID=getpid();
530 if (
name() ==
"HLTMonManager") {
531 ATH_MSG_DEBUG(
"HLTMonManager is obtaining the TrigNavigationThinningSvc lock in slot "
532 << Gaudi::Hive::currentContext().slot() <<
" for event " << Gaudi::Hive::currentContext().eventID().event_number() );
540 ToolHandle<IMonitorToolBase>&
tool = *
i;
545 if(
tool->preSelector() ) {
549 if( !
sc.isSuccess() ) {
550 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::fillHists() unsuccessful" <<
endmsg;
558 tb->m_bench_algexec_fillHists += bench_tmp;
570 ToolHandle<IMonitorToolBase>&
tool = *
i;
576 sc =
tool->checkHists(
false);
580 tb->m_bench_algexec_checkHists += bench_tmp;
582 if( !
sc.isSuccess() ) {
583 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::checkHists() unsuccessful" <<
endmsg;
594 return StatusCode::SUCCESS;
602 return StatusCode::SUCCESS;
616 ToolHandle<IMonitorToolBase>&
tool = *
i;
620 if( !
sc.isSuccess() ) {
621 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::runStat() unsuccessful" <<
endmsg;
626 tb->m_bench_algfin_finalHists.startMeasurement();
629 tb->m_bench_algfin_finalHists.finishMeasurement();
630 if( !
sc.isSuccess() ) {
631 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::finalHists() unsuccessful" <<
endmsg;
634 tb->m_bench_algfin_checkHists.startMeasurement();
635 sc =
tool->checkHists(
true);
637 tb->m_bench_algfin_checkHists.finishMeasurement();
638 if( !
sc.isSuccess() ) {
639 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::checkHists() unsuccessful" <<
endmsg;
642 tb->m_bench_algfin_convertLWHists.startMeasurement();
643 sc =
tool->convertLWHists();
645 tb->m_bench_algfin_convertLWHists.finishMeasurement();
646 if( !
sc.isSuccess() ) {
647 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::convertLWHists() unsuccessful" <<
endmsg;
654 msg(
MSG::DEBUG) <<
" --> Done calling IMonitorToolBase::finalHists() and IMonitorToolBase::checkHists()" <<
endmsg;
657 return StatusCode::SUCCESS;
672 ToolHandle<IMonitorToolBase>&
tool = *
i;
681 tb->m_bench_algexec_bookHists += bench_tmp;
683 if( !
sc.isSuccess() ) {
684 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::bookHists() unsuccessful" <<
endmsg;
693 return StatusCode::SUCCESS;
709 Imp::ObjMap_t::value_type valToInsert(
key,
h );
718 Imp::ObjMapLW_t::value_type valToInsert(
key,
h );
752 LWHist * lwhist =iLW->second;
773 bool doRecursiveReferenceDelete = gROOT->MustClean();
774 gROOT->SetMustClean(
false);
775 TDirectory*
dir =
h->GetDirectory();
783 if( !
sc.isSuccess() )
785 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"AthenaMonManager::WriteAndDeleteHist(): Failure to deReg( TObject* )" <<
endmsg;
792 gROOT->SetMustClean(doRecursiveReferenceDelete);
811 LWHist * lwhist =iLW->second;
832 bool doRecursiveReferenceDelete = gROOT->MustClean();
833 gROOT->SetMustClean(
false);
834 TDirectory*
dir =
h->GetDirectory();
842 if( !
sc.isSuccess() )
844 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"AthenaMonManager::WriteAndDeleteHist(): Failure to deReg( TObject* )" <<
endmsg;
859 gROOT->SetMustClean(doRecursiveReferenceDelete);
877 TObject* o =
i->second;
878 TH1*
h =
dynamic_cast<TH1*
>( o );
884 bool doRecursiveReferenceDelete = gROOT->MustClean();
885 gROOT->SetMustClean(
false);
886 TDirectory*
dir =
h->GetDirectory();
894 if( !
sc.isSuccess() ) {
895 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"AthenaMonManager::WriteAndDeleteHist(): Failure to deReg( TObject* )" <<
endmsg;
898 gROOT->SetMustClean(doRecursiveReferenceDelete);
914 std::string strToLower(
const std::string&
str )
916 std::string lstr(
str);
917 std::string::const_iterator from =
str.begin();
918 std::string::const_iterator strend =
str.end();
920 while( from != strend ) {
virtual LWHist * ownedLWHistOfKey(const std::string &key) const
JetConstituentVector::iterator iterator
static std::string s_dataTypeStr ATLAS_THREAD_SAFE
virtual LWHist * writeAndDeleteLWHist(const std::string &key, const std::string &streamName)
static long nActiveLWHists()
Imp(AthenaMonManager *man, const std::string &name)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
virtual LWHist * writeAndResetLWHist(const std::string &key, const std::string &streamName)
std::map< IMonitorToolBase *, ToolBench * > m_toolbenchmarks
static unsigned int runNumber()
virtual std::string fileKey() const
std::map< std::string, TObject * > ObjMap_t
virtual void passOwnership(TObject *h, const std::string &key)
Pass ownership of a TObject/LWHist to this manager so that it will be deleted appropriately.
virtual StatusCode finalize()
static Environment_t envStringToEnum(const std::string &str)
Converts a string to an Environment_t of the same name.
bool msgLvl(const MSG::Level lvl) const
static std::atomic< bool > s_staticDataAreInit
DataType_t
An enumeration of the different types of data the monitoring application may be running over.
static std::atomic< ISvcLocator * > s_svcLocator
virtual void setFakeCurrentAlg(const std::string &)
void toolAudStart(const T &tool)
static unsigned int getLBsLowStat()
virtual void clearFakeCurrentAlg()
unsigned m_mgcopies_initval
static Environment_t environment()
Returns the running environment of the monitoring application to help ManagedMonitorToolBase objects ...
static const std::string & streamName(LWHist *)
static unsigned int fillNumber()
std::string m_environmentProp
static unsigned int getLBsMedStat()
bool usingROOTBackend() const
std::string m_dataTypeProp
unsigned int m_LBsLowStatProp
static DataType_t dataType()
Returns the data type that the monitoring application is running over to help ManagedMonitorToolBase ...
virtual StatusCode start()
An Algorithm that manages a set of modules, each inheriting from ManagedMonitorToolBase,...
static const std::string & key(LWHist *)
static DataType_t dataTypeStringToEnum(const std::string &str)
Converts a string to a DataType_t of the same name.
static std::mutex s_mutex
unsigned m_nMonGroupCopies
::StatusCode StatusCode
StatusCode definition for legacy code.
void tolower(std::string &s)
virtual void writeAndDelete(const std::string &key)
If the TObject is owned by this manager, its Write() method is called and it is deleted.
bool m_manualDataTypeSetupProp
static void setROOTBackend(bool)
ToolHandleArray< IMonitorToolBase > m_monTools
Environment_t
An enumeration of the different types of running environment the monitoring application may be in.
unsigned int m_LBsMedStatProp
std::map< std::string, LWHist * > ObjMapLW_t
static const MSG::Level s_resourceMonThreshold
static unsigned int getLBsHigStat()
virtual StatusCode execute()
std::string m_fileKeyProp
AthenaMonManager * m_theManager
virtual StatusCode stop()
ToolBench * getToolBench(IMonitorToolBase *t)
void setOwnsROOTHisto(bool b)
static void deleteLWHist(LWHist *)
AthenaMonManager(const std::string &name, ISvcLocator *pSvcLocator)
unsigned int m_lumiBlockProp
unsigned int m_LBsHigStatProp
LWHistLeakChecker(Imp *d)
static unsigned int lumiBlockNumber()
def load(f, use_proxy=1, key=None)
Define macros for attributes used to control the static checker.
virtual ~AthenaMonManager()
virtual TH1 * getROOTHistBase()=0
virtual StatusCode initialize()