 |
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "TDirectory.h"
15 #include "Gaudi/Interfaces/IOptionsSvc.h"
16 #include "GaudiKernel/IMessageSvc.h"
17 #include "GaudiKernel/ISvcLocator.h"
18 #include "GaudiKernel/ITHistSvc.h"
19 #include "GaudiKernel/MsgStream.h"
20 #include "Gaudi/Property.h"
21 #include "GaudiKernel/ServiceHandle.h"
71 typedef std::map<std::string,TObject*>
ObjMap_t;
185 std::string strToLower(
const std::string&
str );
197 , m_THistSvc(
"THistSvc",
name)
233 std::string lcstr( strToLower(
str) );
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" )
255 MsgStream
log(
ms,
"AthenaMonManager::envStringToEnum()" );
256 log << MSG::WARNING <<
"Unknown AthenaMonManager::Environment_t \""
257 <<
str <<
"\", returning \"user\"" <<
endmsg;
269 std::string lcstr( strToLower(
str) );
271 if( lcstr ==
"userdefined" )
273 else if( lcstr ==
"montecarlo" )
275 else if( lcstr ==
"collisions" )
277 else if( lcstr ==
"cosmics" )
279 else if( lcstr ==
"heavyioncollisions" )
285 MsgStream
log(
ms,
"AthenaMonManager::dataTypeStringToEnum()" );
286 log << MSG::WARNING <<
"Unknown AthenaMonManager::DataType_t \""
287 <<
str <<
"\", returning \"userDefined\"" <<
endmsg;
299 return Imp::s_environment;
303 return Imp::s_LBsLowStat;
306 return Imp::s_LBsMedStat;
309 return Imp::s_LBsHigStat;
316 return Imp::s_dataType;
330 if (Imp::s_runLBOverridden) {
331 return Imp::s_lumiBlock;
333 return Gaudi::Hive::currentContext().eventID().lumi_block();
342 if (Imp::s_runLBOverridden) {
345 return Gaudi::Hive::currentContext().eventID().run_number();
378 #if 0 // The two branches of the conditional are identical.
414 Imp::s_runLBOverridden =
true;
416 msg(
MSG::DEBUG) <<
" --> using run = " << Imp::s_run <<
", lumiBlock = " << Imp::s_lumiBlock <<
endmsg;
419 msg(
MSG::DEBUG) <<
" --> using run = " << Imp::s_run <<
", lumiBlock = " << Imp::s_lumiBlock <<
endmsg;
432 const std::string
client =
name() + std::string(
"Properties");
447 ToolHandle<IMonitorToolBase>&
tool = *
i;
456 tb->m_bench_alginit_retrieve = bench_tmp;
462 return StatusCode::SUCCESS;
471 pid_t currPID=getpid();
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() );
496 ToolHandle<IMonitorToolBase>&
tool = *
i;
501 if(
tool->preSelector() ) {
505 if( !
sc.isSuccess() ) {
506 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::fillHists() unsuccessful" <<
endmsg;
514 tb->m_bench_algexec_fillHists += bench_tmp;
526 ToolHandle<IMonitorToolBase>&
tool = *
i;
532 sc =
tool->checkHists(
false);
536 tb->m_bench_algexec_checkHists += bench_tmp;
538 if( !
sc.isSuccess() ) {
539 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::checkHists() unsuccessful" <<
endmsg;
550 return StatusCode::SUCCESS;
558 return StatusCode::SUCCESS;
572 ToolHandle<IMonitorToolBase>&
tool = *
i;
576 if( !
sc.isSuccess() ) {
577 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::runStat() unsuccessful" <<
endmsg;
582 tb->m_bench_algfin_finalHists.startMeasurement();
585 tb->m_bench_algfin_finalHists.finishMeasurement();
586 if( !
sc.isSuccess() ) {
587 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::finalHists() unsuccessful" <<
endmsg;
590 tb->m_bench_algfin_checkHists.startMeasurement();
591 sc =
tool->checkHists(
true);
593 tb->m_bench_algfin_checkHists.finishMeasurement();
594 if( !
sc.isSuccess() ) {
595 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::checkHists() unsuccessful" <<
endmsg;
602 msg(
MSG::DEBUG) <<
" --> Done calling IMonitorToolBase::finalHists() and IMonitorToolBase::checkHists()" <<
endmsg;
605 return StatusCode::SUCCESS;
620 ToolHandle<IMonitorToolBase>&
tool = *
i;
629 tb->m_bench_algexec_bookHists += bench_tmp;
631 if( !
sc.isSuccess() ) {
632 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"IMonitorToolBase::bookHists() unsuccessful" <<
endmsg;
641 return StatusCode::SUCCESS;
657 Imp::ObjMap_t::value_type valToInsert(
key,
h );
671 TObject* o =
i->second;
672 TH1*
h =
dynamic_cast<TH1*
>( o );
678 bool doRecursiveReferenceDelete = gROOT->MustClean();
679 gROOT->SetMustClean(
false);
680 TDirectory*
dir =
h->GetDirectory();
688 if( !
sc.isSuccess() ) {
689 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"AthenaMonManager::WriteAndDeleteHist(): Failure to deReg( TObject* )" <<
endmsg;
692 gROOT->SetMustClean(doRecursiveReferenceDelete);
708 std::string strToLower(
const std::string&
str )
710 std::string lstr(
str);
711 std::string::const_iterator from =
str.begin();
712 std::string::const_iterator strend =
str.end();
714 while( from != strend ) {
JetConstituentVector::iterator iterator
static std::string s_dataTypeStr ATLAS_THREAD_SAFE
Imp(AthenaMonManager *man, const std::string &name)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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 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
SmartIF< ISGAudSvc > m_sgAudSvc
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
void toolAudStart(const T &tool)
static unsigned int getLBsLowStat()
static Environment_t environment()
Returns the running environment of the monitoring application to help ManagedMonitorToolBase objects ...
static unsigned int fillNumber()
std::string m_environmentProp
static unsigned int getLBsMedStat()
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 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
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
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)
AthenaMonManager(const std::string &name, ISvcLocator *pSvcLocator)
unsigned int m_lumiBlockProp
unsigned int m_LBsHigStatProp
static unsigned int lumiBlockNumber()
unsigned m_mgcopies_initval
Define macros for attributes used to control the static checker.
virtual ~AthenaMonManager()
ServiceHandle< ITHistSvc > m_THistSvc
virtual StatusCode initialize()