|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
Implements the common functionality between GaudiTools and GaudiAlgorithms. More...
#include <GaudiAlg/GaudiCommon.h>

Public Member Functions | |
| template<class TYPE > | |
| Gaudi::Utils::GetData< TYPE > ::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| Templated access to the data in Gaudi Transient Store. | |
| template<class TYPE > | |
| bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| Check the existence of a data object or container in the Gaudi Transient Event Store. | |
| template<class TYPE , class TYPE2 > | |
| Gaudi::Utils::GetData< TYPE > ::return_type | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
| Get the existing data object from Gaudi Event Transient store. | |
| DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const |
| Register a data object or container into Gaudi Event Transient Store. | |
| template<class TOOL > | |
| TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
| Useful method for the easy location of tools. | |
| template<class TOOL > | |
| TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
| A useful method for the easy location of tools. | |
| template<class SERVICE > | |
| SmartIF< SERVICE > | svc (const std::string &name, const bool create=true) const |
| A useful method for the easy location of services. | |
| IUpdateManagerSvc * | updMgrSvc () const |
| Short-cut to locate the Update Manager Service. | |
| StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
| Print the error message and return with the given StatusCode. | |
| StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
| Print the warning message and return with the given StatusCode. | |
| StatusCode | Info (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const size_t mx=10) const |
| Print the info message and return with the given StatusCode. | |
| StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
| Print the message and return with the given StatusCode. | |
| void | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Assertion - throw exception if the given condition is not fulfilled. | |
| void | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Assertion - throw exception if the given condition is not fulfilled. | |
| void | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Create and (re)-throw a given GaudiException. | |
| void | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Create and (re)-throw a given exception. | |
| void | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
| Create and throw an exception with the given message. | |
| MsgStream & | msgStream (const MSG::Level level) const |
| Predefined configurable message stream for the efficient printouts. | |
| MsgStream & | always () const |
| shortcut for the method msgStream ( MSG::ALWAYS ) | |
| MsgStream & | fatal () const |
| shortcut for the method msgStream ( MSG::FATAL ) | |
| MsgStream & | err () const |
| shortcut for the method msgStream ( MSG::ERROR ) | |
| MsgStream & | error () const |
| shortcut for the method msgStream ( MSG::ERROR ) | |
| MsgStream & | warning () const |
| shortcut for the method msgStream ( MSG::WARNING ) | |
| MsgStream & | info () const |
| shortcut for the method msgStream ( MSG::INFO ) | |
| MsgStream & | debug () const |
| shortcut for the method msgStream ( MSG::DEBUG ) | |
| MsgStream & | verbose () const |
| shortcut for the method msgStream ( MSG::VERBOSE ) | |
| MsgStream & | msg () const |
| shortcut for the method msgStream ( MSG::INFO ) | |
| const Statistics & | counters () const |
| accessor to all counters | |
| StatEntity & | counter (const std::string &tag) const |
| accessor to certain counter by name | |
| MSG::Level | msgLevel () const |
| The current message service output level. | |
| bool | msgLevel (const MSG::Level level) const |
| Test the output level. | |
| void | resetMsgStream () const |
| Reset (delete) the current message stream object. | |
| bool | typePrint () const |
| Insert the actual C++ type of the algorithm/tool in the messages ? | |
| bool | propsPrint () const |
| Print properties at initialization ? | |
| bool | statPrint () const |
| Print statistical counters at finalization ? | |
| bool | errorsPrint () const |
| Print error counters at finalization ? | |
| long | printStat (const MSG::Level level=MSG::ALWAYS) const |
| perform the actual printout of statistical counters | |
| long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
| perform the actual printout of error counters | |
| long | printProps (const MSG::Level level=MSG::ALWAYS) const |
| perform the actual printout of properties | |
| template<class CallerClass > | |
| void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
| register the current instance to the UpdateManagerSvc as a consumer for a condition. | |
| template<class CallerClass , class CondType > | |
| void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
| register the current instance to the UpdateManagerSvc as a consumer for a condition. | |
| template<class CallerClass > | |
| void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
| just to avoid conflicts with the version using a pointer to a template class. | |
| template<class CallerClass , class TargetClass > | |
| void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
| register the current instance to the UpdateManagerSvc as a consumer for a condition. | |
| StatusCode | runUpdate () |
| asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident. | |
| GaudiCommon (const std::string &name, ISvcLocator *pSvcLocator) | |
| Algorithm constructor. | |
| GaudiCommon (const std::string &type, const std::string &name, const IInterface *parent) | |
| Tool constructor. | |
| virtual StatusCode | initialize () |
| standard initialization method | |
| virtual StatusCode | finalize () |
| standard finalization method | |
| StatusCode | release (const IInterface *interface) const |
| Manual forced (and 'safe') release of the active tool or service. | |
| virtual unsigned long | release () |
| Un-hide IInterface::release (ICC warning #1125) | |
| const AlgTools & | tools () const |
| get the list of aquired tools | |
| const Services & | services () const |
| get the list of aquired services | |
| const std::string & | context () const |
| Returns the "context" string. Used to identify different processing states. | |
| const std::string & | rootInTES () const |
| Returns the "rootInTES" string. | |
| double | globalTimeOffset () const |
| Returns the "globalTimeOffset" double. | |
Protected Types | |
| typedef std::map< std::string, StatEntity > | Statistics |
| the actual type of general counters | |
| typedef std::map< std::string, unsigned int > | Counter |
| the actual type error/warning counter | |
| typedef std::vector< IAlgTool * > | AlgTools |
| storage for active tools | |
| typedef GaudiUtils::HashMap < std::string, SmartIF < IService > > | Services |
| storage for active services | |
Protected Member Functions | |
| virtual | ~GaudiCommon () |
| Destructor. | |
| StatusCode | releaseTool (const IAlgTool *tool) const |
| manual forced (and 'safe') release of the tool | |
| StatusCode | releaseSvc (const IInterface *svc) const |
| manual forced (and 'safe') release of the service | |
Protected Attributes | |
| ICounterSummarySvc * | m_counterSummarySvc |
| a pointer to the CounterSummarySvc | |
| std::vector< std::string > | m_counterList |
| list of counters to declare. Set by property CounterList. This can be a regular expression. | |
| std::vector< std::string > | m_statEntityList |
Static Protected Attributes | |
| static const bool | IgnoreRootInTES = false |
| Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. | |
| static const bool | UseRootInTES = true |
| Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods. | |
Private Member Functions | |
| void | msgLevelHandler (Property &theProp) |
| Handle method for changes in the Messaging levels. | |
| GaudiCommon () | |
| GaudiCommon (const GaudiCommon &) | |
| GaudiCommon & | operator= (const GaudiCommon &) |
| void | printErrorHandler (Property &) |
| handler for "ErrorPrint" property | |
| void | printPropsHandler (Property &) |
| handler for "PropertiesPrint" property | |
| void | printStatHandler (Property &) |
| handler for "StatPrint" property | |
| void | addToToolList (IAlgTool *tool) const |
| Add the given tool to the list of acquired tools. | |
| void | addToServiceList (const SmartIF< IService > &svc) const |
| Add the given service to the list of acquired services. | |
| void | initGaudiCommonConstructor (const IInterface *parent=0) |
| Constructor initializations. | |
| const std::string | fullTESLocation (const std::string &location, const bool useRootInTES) const |
| Returns the full correct event location given the rootInTes settings. | |
Private Attributes | |
| MSG::Level | m_msgLevel |
| The message level. | |
| MsgStream * | m_msgStream |
| The predefined message stream. | |
| AlgTools | m_tools |
| List of active tools. | |
| Services | m_services |
| List of active services. | |
| Counter | m_errors |
| Counter of errors. | |
| Counter | m_warnings |
| counter of warnings | |
| Counter | m_infos |
| counter of infos | |
| Counter | m_exceptions |
| Counter of exceptions. | |
| Statistics | m_counters |
| General counters. | |
| IUpdateManagerSvc * | m_updMgrSvc |
| Pointer to the Update Manager Service instance. | |
| bool | m_typePrint |
| insert the actual C++ type of the algorithm in the messages? | |
| bool | m_propsPrint |
| print properties at initialization? | |
| bool | m_statPrint |
| print counters at finalization ? | |
| bool | m_errorsPrint |
| print warning and error counters at finalization ? | |
| std::string | m_context |
| The context string. | |
| std::string | m_rootInTES |
| The rootInTES string. | |
| std::string | m_rootOnTES |
| The rootOnTES string. | |
| double | m_globalTimeOffset |
| The globalTimeOffset value. | |
| std::string | m_header |
| the header row | |
| std::string | m_format1 |
| format for regular statistical printout rows | |
| std::string | m_format2 |
| format for "efficiency" statistical printout rows | |
| bool | m_useEffFormat |
| flag to use the special "efficiency" format | |
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition at line 59 of file GaudiCommon.h.
typedef std::vector<IAlgTool*> GaudiCommon< PBASE >::AlgTools [protected] |
storage for active tools
Definition at line 92 of file GaudiCommon.h.
typedef std::map<std::string,unsigned int> GaudiCommon< PBASE >::Counter [protected] |
the actual type error/warning counter
Definition at line 90 of file GaudiCommon.h.
typedef GaudiUtils::HashMap<std::string, SmartIF<IService> > GaudiCommon< PBASE >::Services [protected] |
storage for active services
Definition at line 94 of file GaudiCommon.h.
typedef std::map<std::string,StatEntity> GaudiCommon< PBASE >::Statistics [protected] |
the actual type of general counters
Definition at line 88 of file GaudiCommon.h.
| GaudiCommon< PBASE >::GaudiCommon | ( | const std::string & | name, |
| ISvcLocator * | pSvcLocator | ||
| ) |
Algorithm constructor.
| GaudiCommon< PBASE >::GaudiCommon | ( | const std::string & | type, |
| const std::string & | name, | ||
| const IInterface * | parent | ||
| ) |
Tool constructor.
| virtual GaudiCommon< PBASE >::~GaudiCommon | ( | ) | [inline, protected, virtual] |
| GaudiCommon< PBASE >::GaudiCommon | ( | ) | [private] |
| GaudiCommon< PBASE >::GaudiCommon | ( | const GaudiCommon< PBASE > & | ) | [private] |
| void GaudiCommon< PBASE >::addToServiceList | ( | const SmartIF< IService > & | svc ) | const [private] |
Add the given service to the list of acquired services.
Definition at line 466 of file GaudiCommon.icpp.
{
if (svc.isValid()) {
m_services[svc->name()] = svc;
}
}
| void GaudiCommon< PBASE >::addToToolList | ( | IAlgTool * | tool ) | const [private] |
Add the given tool to the list of acquired tools.
Definition at line 448 of file GaudiCommon.icpp.
{
if( 0 != tool ) {
if ( this->msgLevel ( MSG::DEBUG ) ) {
this->debug() << "The tool of type '"
<< System::typeinfoName(typeid(*tool))
<< "' has been added with the name '"
<< tool->name() << "'" << endmsg ;
}
m_tools.push_back( tool ) ;
}
}
| MsgStream& GaudiCommon< PBASE >::always | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ALWAYS )
Definition at line 479 of file GaudiCommon.h.
{ return msgStream ( MSG::ALWAYS ) ; }
| void GaudiCommon< PBASE >::Assert | ( | const bool | ok, |
| const std::string & | message = "", |
||
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) |
||
| ) | const [inline] |
Assertion - throw exception if the given condition is not fulfilled.
| Exception | for invalid condition |
| ok | Condition which should be "true" |
| message | Message to be associated with the exception |
Reimplemented in ErrorTool.
Definition at line 219 of file GaudiCommonImp.h.
| void GaudiCommon< PBASE >::Assert | ( | const bool | ok, |
| const char * | message, | ||
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) |
||
| ) | const [inline] |
Assertion - throw exception if the given condition is not fulfilled.
| Exception | for invalid condition |
| ok | Condition which should be "true" |
| message | Message to be associated with the exception |
Definition at line 237 of file GaudiCommonImp.h.
| const std::string& GaudiCommon< PBASE >::context | ( | ) | const [inline] |
Returns the "context" string. Used to identify different processing states.
Definition at line 746 of file GaudiCommon.h.
{ return m_context; }
| StatEntity& GaudiCommon< PBASE >::counter | ( | const std::string & | tag ) | const [inline] |
accessor to certain counter by name
if ( OK ) { ++counter("OK") ; } // additive counter ('Flag') counter("#Tracks") += tracks->size() ; // multiplicative counter ('Weight') counter("ProbTot") *= probability ;
| tag | counter name |
Definition at line 518 of file GaudiCommon.h.
{ return m_counters[tag] ; }
| const Statistics& GaudiCommon< PBASE >::counters | ( | ) | const [inline] |
| MsgStream& GaudiCommon< PBASE >::debug | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::DEBUG )
Definition at line 491 of file GaudiCommon.h.
{ return msgStream ( MSG::DEBUG ) ; }
| MsgStream& GaudiCommon< PBASE >::err | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ERROR )
Definition at line 483 of file GaudiCommon.h.
{ return msgStream ( MSG::ERROR ) ; }
| MsgStream& GaudiCommon< PBASE >::error | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::ERROR )
Definition at line 485 of file GaudiCommon.h.
{ return msgStream ( MSG::ERROR ) ; }
| StatusCode GaudiCommon< PBASE >::Error | ( | const std::string & | msg, |
| const StatusCode | st = StatusCode::FAILURE, |
||
| const size_t | mx = 10 |
||
| ) | const |
Print the error message and return with the given StatusCode.
Also performs statistical analysis of the error messages and suppression after the defined number of error instances.
if( a < 0 ) { return Error("a is negative!") ;} if( b < 0 ) { return Error("b is illegal!" , StatusCode(25) ); if( c < 0 ) { return Error("c is negative" , StatusCode(35) , 50 );
| msg | Error message |
| st | StatusCode to return |
| mx | Maximum number of printouts for this message |
Reimplemented in ErrorTool.
Definition at line 482 of file GaudiCommon.icpp.
{
// increase local counter of errors
const size_t num = ++m_errors[msg] ;
// If suppressed, just return
if ( num > mx ) { return st ; }
else if ( num == mx ) // issue one-time suppression message
{ return Print ( "The ERROR message is suppressed : '" +
msg + "'" , st , MSG::ERROR ) ; }
// return message
return Print ( msg , st , MSG::ERROR ) ;
}
| bool GaudiCommon< PBASE >::errorsPrint | ( | ) | const [inline] |
Print error counters at finalization ?
Definition at line 544 of file GaudiCommon.h.
{ return m_errorsPrint ; }
| void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg, |
| const std::exception & | exc, | ||
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) |
||
| ) | const |
Create and (re)-throw a given exception.
| std::exception | always thrown! |
| msg | Exception message |
| exc | (previous) exception of type std::exception |
| sc | StatusCode |
Reimplemented in ErrorTool.
Definition at line 588 of file GaudiCommon.icpp.
{
// increase local counter of exceptions
++m_exceptions[ msg ];
Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL );
throw GaudiException( this->name() + ":: " + msg+"("+exc.what()+")", "", sc );
}
| void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg = "no message", |
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) |
||
| ) | const |
Create and throw an exception with the given message.
| GaudiException | always thrown! |
| msg | Exception message |
| sc | StatusCode |
Reimplemented in ErrorTool.
Definition at line 603 of file GaudiCommon.icpp.
{
// increase local counter of exceptions
++m_exceptions[ msg ];
Print ( "Exception throw: " + msg , sc , MSG::FATAL );
throw GaudiException( this->name() + ":: " + msg , "", sc );
}
| void GaudiCommon< PBASE >::Exception | ( | const std::string & | msg, |
| const GaudiException & | exc, | ||
| const StatusCode | sc = StatusCode(StatusCode::FAILURE, true) |
||
| ) | const |
Create and (re)-throw a given GaudiException.
| GaudiException | always thrown! |
| msg | Exception message |
| exc | (previous) exception of type GaudiException |
Reimplemented in ErrorTool.
Definition at line 573 of file GaudiCommon.icpp.
{
// increase local counter of exceptions
++m_exceptions[ msg ];
Print ( "Exception (re)throw: " + msg , sc , MSG::FATAL );
throw GaudiException( this->name() + ":: " + msg , this->name() , sc, exc);
}
| bool GaudiCommon< PBASE >::exist | ( | IDataProviderSvc * | svc, |
| const std::string & | location, | ||
| const bool | useRootInTES = true |
||
| ) | const [inline] |
Check the existence of a data object or container in the Gaudi Transient Event Store.
bool a1 = exist<DataObject>( evtSvc() , "/Event/MyObject" ) ; bool a2 = exist<MyHits> ( evtSvc() , "/Event/MyHits" ) ;
| svc | Pointer to data provider service |
| location | Address in Gaudi Transient Store |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
| true | Data object or container exists and implements a proper interface |
| true | Failed to locate the data object or container |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 72 of file GaudiCommonImp.h.
{
// check the environment
Assert( 0 != service , "exist():: IDataProvider* points to NULL!" ) ;
// check the data object
Gaudi::Utils::CheckData<TYPE> checker ;
return checker ( service,
fullTESLocation ( location , useRootInTES ) ) ;
}
| MsgStream& GaudiCommon< PBASE >::fatal | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::FATAL )
Definition at line 481 of file GaudiCommon.h.
{ return msgStream ( MSG::FATAL ) ; }
| StatusCode GaudiCommon< PBASE >::finalize | ( | ) | [virtual] |
standard finalization method
Reimplemented in GaudiAlgorithm, GaudiHistoAlg, GaudiHistoTool, GaudiSequencer, GaudiTool, GaudiTupleAlg, GaudiTupleTool, Prescaler, SequencerTimerTool, EqSolver, FuncMinimum, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, and GaudiTuples< GaudiHistoAlg >.
Definition at line 277 of file GaudiCommon.icpp.
{
StatusCode sc = StatusCode::SUCCESS;
// print the general information about statistical counters
if ( msgLevel(MSG::DEBUG) || (statPrint() && !counters().empty()) )
{
// print general statistical counters
printStat ( statPrint() ? MSG::ALWAYS : MSG::DEBUG ) ;
}
//add all counters to the CounterSummarySvc
if(m_counterSummarySvc && this->svcLoc()->existsService("CounterSummarySvc"))
{
if ( msgLevel(MSG::DEBUG) ) debug() << "adding counters to CounterSummarySvc" << endmsg;
for(Statistics::const_iterator i=this->counters().begin();
i!=this->counters().end();
i++)
{
if(Gaudi::Utils::RegEx::matchOr(i->first,m_statEntityList))
m_counterSummarySvc->addCounter(this->name(),i->first,i->second,
Gaudi::CounterSummary::SaveStatEntity);
else if(Gaudi::Utils::RegEx::matchOr(i->first,m_counterList))
m_counterSummarySvc->addCounter(this->name(),i->first,i->second);
}
}
// release all located tools and services
if ( msgLevel(MSG::DEBUG) )
{
debug() << "Tools to release :";
for ( AlgTools::const_iterator i = m_tools.begin();
i != m_tools.end(); ++i )
{
debug() << " " << (*i)->name();
}
debug() << endmsg;
}
while ( !m_tools.empty() ) { sc = sc && releaseTool( m_tools.back() ) ; }
// release all located services
if ( msgLevel(MSG::DEBUG) )
{
debug() << "Services to release :";
for ( Services::const_iterator i = m_services.begin();
i != m_services.end(); ++i )
{
debug() << " " << (*i).first;
}
debug() << endmsg;
}
while ( !m_services.empty() ) { sc = sc && releaseSvc( m_services.begin()->second ) ; }
//release the CounterSummarySvc manually
if(m_counterSummarySvc)
{
m_counterSummarySvc->release();
m_counterSummarySvc=NULL;
}
// format printout
if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() )
{
always() << "Exceptions/Errors/Warnings/Infos Statistics : "
<< m_exceptions .size () << "/"
<< m_errors .size () << "/"
<< m_warnings .size () << "/"
<< m_infos .size () << endmsg ;
if ( errorsPrint() ) { printErrors () ; }
}
// delete the MsgStream
resetMsgStream();
// clear *ALL* counters explicitly
m_counters .clear() ;
m_exceptions .clear() ;
m_infos .clear() ;
m_warnings .clear() ;
m_errors .clear() ;
m_counterList.clear() ;
m_statEntityList.clear() ;
// finalize base class
return sc && PBASE::finalize();
}
| const std::string GaudiCommon< PBASE >::fullTESLocation | ( | const std::string & | location, |
| const bool | useRootInTES | ||
| ) | const [inline, private] |
Returns the full correct event location given the rootInTes settings.
Definition at line 25 of file GaudiCommonImp.h.
{
// The logic is:
// if no R.I.T., give back location
// if R.I.T., this is the mapping:
// (note that R.I.T. contains a trailing '/')
// location -> result
// -------------------------------------------------
// "" -> R.I.T.[:-1] ("rit")
// "/Event" -> R.I.T.[:-1] ("rit")
// "/Event/MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
// "MyObj" -> R.I.T. + "MyObj" ("rit/MyObj")
return ( !useRootInTES || rootInTES().empty() ?
location
:
location.empty() || ( location == "/Event" ) ?
rootInTES().substr(0,rootInTES().size()-1)
:
0 == location.find("/Event/") ?
rootInTES() + location.substr(7)
:
rootInTES() + location );
}
| Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::get | ( | IDataProviderSvc * | svc, |
| const std::string & | location, | ||
| const bool | useRootInTES = true |
||
| ) | const [inline] |
Templated access to the data in Gaudi Transient Store.
Quick and safe access to the data in Gaudi transient store. The method located the data at given address and perform the debug printout about located data
// Will access MCHits from the given location MCHits* hits = get<MCHits>( evtSvc () , "MC/Hits" );
| GaudiException | for Invalid Data Provider Service |
| GaudiException | for invalid/unavailable data |
| svc | Pointer to data service (data provider) |
| location | data location/address in Gaudi Transient Store |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 55 of file GaudiCommonImp.h.
{
// check the environment
Assert( 0 != service , "get():: IDataProvider* points to NULL!" ) ;
// get the helper object:
Gaudi::Utils::GetData<TYPE> getter ;
return getter ( *this ,
service ,
fullTESLocation ( location , useRootInTES ) ) ;
}
| Gaudi::Utils::GetData< TYPE >::return_type GaudiCommon< PBASE >::getOrCreate | ( | IDataProviderSvc * | svc, |
| const std::string & | location, | ||
| const bool | useRootInTES = true |
||
| ) | const [inline] |
Get the existing data object from Gaudi Event Transient store.
Alternatively, create new object and register it in TES and return if object does not exist.
MyHits* hits = getOrCreate<MyHits,MyHits>( evtSvc() , "/Event/MyHits" ) ;
| GaudiException | for Invalid Data Provider Service |
| GaudiException | for invalid/unavailable data |
| svc | Pointer to data provider service |
| location | Location in Gaudi Transient Event Store |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 91 of file GaudiCommonImp.h.
{
// check the environment
Assert ( 0 != service , "getOrCreate():: svc points to NULL!" ) ;
// get the helper object
Gaudi::Utils::GetOrCreateData<TYPE,TYPE2> getter ;
return getter ( *this ,
service ,
fullTESLocation( location, useRootInTES ) ,
location ) ;
}
| double GaudiCommon< PBASE >::globalTimeOffset | ( | ) | const [inline] |
Returns the "globalTimeOffset" double.
Definition at line 752 of file GaudiCommon.h.
{ return m_globalTimeOffset; }
| StatusCode GaudiCommon< PBASE >::Info | ( | const std::string & | msg, |
| const StatusCode | st = StatusCode::SUCCESS, |
||
| const size_t | mx = 10 |
||
| ) | const |
Print the info message and return with the given StatusCode.
Also performs statistical analysis of the error messages and suppression after the defined number of instances.
| msg | Info message |
| st | StatusCode to return |
| mx | Maximum number of printouts for this message |
Definition at line 524 of file GaudiCommon.icpp.
{
// increase local counter of warnings
const size_t num = ++m_infos[msg] ;
// If suppressed, just return
if ( num > mx ) { return st ; }
else if ( num == mx ) // issue one-time suppression message
{ return Print ( "The INFO message is suppressed : '" +
msg + "'" , st , MSG::INFO ) ; }
// return message
return Print ( msg , st , MSG::INFO ) ;
}
| MsgStream& GaudiCommon< PBASE >::info | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::INFO )
Definition at line 489 of file GaudiCommon.h.
| void GaudiCommon< PBASE >::initGaudiCommonConstructor | ( | const IInterface * | parent = 0 ) |
[private] |
Constructor initializations.
< flag to use the special "efficiency" format
Definition at line 63 of file GaudiCommon.icpp.
{
// initialise data members
m_msgLevel = MSG::NIL;
m_msgStream = 0;
m_updMgrSvc = 0;
m_typePrint = true;
m_propsPrint = false;
m_statPrint = true;
m_errorsPrint = true;
m_context = "" ;
m_rootInTES = "" ;
m_globalTimeOffset = 0.0 ;
//data members for the CounterSummarySvc
m_counterSummarySvc=NULL;
m_counterList=std::vector<std::string>(1,".*");
m_statEntityList=std::vector<std::string>(0);
// printout of counters:
// the header row for counters printout
m_header = " | Counter | # | sum | mean/eff^* | rms/err^* | min | max |" ;
// format for regular statistical printout rows
m_format1 = " | %|-48.48s|%|50t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" ;
// format for "efficiency" statistical printout rows
m_format2 = " |*%|-48.48s|%|50t||%|10d| |%|11.5g| |(%|#9.6g| +- %|-#9.6g|)%%| ------- | ------- |" ;
// flag to use the special "efficiency" format
m_useEffFormat = true ;
// job options
// print error counters at finalization ?
this->declareProperty
( "ErrorsPrint" , m_errorsPrint ,
"Print the statistics of errors/warnings/exceptions")
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printErrorHandler, this ) ;
// print properties at initialization?
this->declareProperty
( "PropertiesPrint" , m_propsPrint ,
"Print the properties of the component ")
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printPropsHandler, this ) ;
// print statistical counters at finalization ?
this->declareProperty
( "StatPrint" , m_statPrint ,
"Print the table of counters" )
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printStatHandler, this ) ;
// insert the actual C++ type of the algorithm or tool in the messages?
this->declareProperty
( "TypePrint" , m_typePrint ,
"Add the actal C++ component type into the messages" ) ;
// context
this->declareProperty ( "Context" , m_context ) ;
// root in TES
this->declareProperty ( "RootInTES" , m_rootInTES ) ;
// root on TES ( temporary )
this->declareProperty ( "RootOnTES" , m_rootOnTES ) ;
// global time offset
this->declareProperty ( "GlobalTimeOffset", m_globalTimeOffset ) ;
// the header row for counters printout
this->declareProperty
( "StatTableHeader" , m_header ,
"The header row for the output Stat-table" ) ;
// format for regular statistical printout rows
this->declareProperty
( "RegularRowFormat" , m_format1 ,
"The format for the regular row in the output Stat-table" ) ;
// format for "efficiency" statistical printout rows
this->declareProperty
( "EfficiencyRowFormat" , m_format2 ,
"The format for the regular row in the output Stat-table" ) ;
// flag to use the special "efficiency" format
this->declareProperty
( "UseEfficiencyRowFormat" , m_useEffFormat ,
"Use the special format for printout of efficiency counters" ) ;
//declare the list of simple counters to write.
this->declareProperty(
"CounterList",
m_counterList=std::vector<std::string>(1,".*"),
"RegEx list, of simple integer counters for CounterSummary.");
//declare the list of stat entities to write.
this->declareProperty(
"StatEntityList",
m_statEntityList=std::vector<std::string>(0),
"RegEx list, of StatEntity counters for CounterSummary.");
// add handler for message level changes
this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this );
// setup context from parent if available
if ( parent )
{
if ( const GaudiAlgorithm* gAlg = dynamic_cast<const GaudiAlgorithm*>(parent) )
{
m_context = gAlg->context();
m_rootInTES = gAlg->rootInTES();
m_globalTimeOffset = gAlg->globalTimeOffset();
}
else if ( const GaudiTool* gTool = dynamic_cast<const GaudiTool*> (parent) )
{
m_context = gTool->context();
m_rootInTES = gTool->rootInTES();
m_globalTimeOffset = gTool->globalTimeOffset();
}
}
// Get the job option service
SmartIF<IJobOptionsSvc> jos(PBASE::service("JobOptionsSvc"));
if (!jos.isValid()) Exception("Cannot get JobOptionsSvc");
// Get the "Context" option if in the file...
const std::vector<const Property*>* myList = jos->getProperties( this->name() );
if ( 0 != myList )
{
// Iterate over the list to set the options
for ( std::vector<const Property*>::const_iterator iter = myList->begin();
iter != myList->end();
++iter )
{
const StringProperty* sp = dynamic_cast<const StringProperty*>(*iter);
if ( 0 != sp )
{
if ( "Context" == (*iter)->name() )
{
m_context = sp->value();
} else if ( "RootInTES" == (*iter)->name() ) {
m_rootInTES = sp->value();
} else if ( "GlobalTimeOffset" == (*iter)->name() ) {
m_globalTimeOffset = atof( sp->value().c_str() );
}
}
}
}
}
| StatusCode GaudiCommon< PBASE >::initialize | ( | ) | [virtual] |
standard initialization method
Reimplemented in GaudiAlgorithm, GaudiHistoAlg, GaudiHistoTool, GaudiSequencer, GaudiTool, GaudiTupleAlg, GaudiTupleTool, Prescaler, SequencerTimerTool, EqSolver, FuncMinimum, GaudiHistos< GaudiAlgorithm >, GaudiHistos< GaudiTool >, GaudiTuples< GaudiHistoTool >, and GaudiTuples< GaudiHistoAlg >.
Definition at line 215 of file GaudiCommon.icpp.
{
// initialize base class
const StatusCode sc = PBASE::initialize();
if ( sc.isFailure() )
{ return Error ( "Failed to initialise base class PBASE", sc ) ; }
// some debug printout
if ( msgLevel(MSG::DEBUG) )
{
debug() << "Initialize base class GaudiCommon<" << System::typeinfoName(typeid(PBASE)) << ">" << endmsg;
if ( !context().empty() )
debug() << "Created with context = '" << context() << "'" << endmsg;
}
// some temporary checks to see if people are using RootOnTES and warn if so
// TO BE REMOVED ASAP ...
if ( m_rootInTES.empty() && !m_rootOnTES.empty() )
{
m_rootInTES = m_rootOnTES;
Warning( "RootOnTES option is OBSOLETE -> Use RootInTES instead. RootInTES has been updated to "
+ m_rootInTES, StatusCode::SUCCESS ).ignore();
}
else if ( !m_rootInTES.empty() && !m_rootOnTES.empty() )
{
Warning( "Options RootOnTES AND RootInTES are defined ! Use RootInTES. RootOnTES is ignored",
StatusCode::SUCCESS ).ignore();
}
// Check rootInTES ends with a /
if ( !m_rootInTES.empty() &&
m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/";
//Set up the CounterSummarySvc May need to be changed
this->svcLoc()->service("CounterSummarySvc",m_counterSummarySvc,false).ignore() ;
if (msgLevel(MSG::DEBUG))
{
if (m_counterSummarySvc==NULL )
debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
else debug() << "found CounterSummarySvc OK" << endmsg;
}
// properties will be printed if asked for or in "MSG::DEBUG" mode
if ( propsPrint() ) { printProps(MSG::ALWAYS); }
else if ( msgLevel(MSG::DEBUG) ) { printProps(MSG::DEBUG); }
return sc;
}
| MsgStream& GaudiCommon< PBASE >::msg | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::INFO )
Definition at line 495 of file GaudiCommon.h.
| bool GaudiCommon< PBASE >::msgLevel | ( | const MSG::Level | level ) | const [inline] |
Test the output level.
| level | The message level to test against |
| true | Messages at level "level" will be printed |
| true | Messages at level "level" will NOT be printed |
Definition at line 531 of file GaudiCommon.h.
| MSG::Level GaudiCommon< PBASE >::msgLevel | ( | ) | const [inline] |
The current message service output level.
Definition at line 524 of file GaudiCommon.h.
{ return m_msgLevel ; }
| void GaudiCommon< PBASE >::msgLevelHandler | ( | Property & | theProp ) | [private] |
Handle method for changes in the Messaging levels.
Called whenever the property "OutputLevel" changes to perform all necessary actions locally.
| theProp | Reference to the Property that has changed |
Definition at line 731 of file GaudiCommon.icpp.
{
// Force a new MsgStream object, to pick up the new settings
resetMsgStream();
// adjust internal message level
m_msgLevel =
this->outputLevel() < (int) MSG::NIL ? MSG::NIL :
this->outputLevel() >= (int) MSG::NUM_LEVELS ? MSG::ALWAYS :
MSG::Level( this->outputLevel() ) ;
// Keep MessageSvc up to date if needed
if ( this->msgSvc()->outputLevel(this->name()) != this->outputLevel() )
{
this->msgSvc()->setOutputLevel( this->name(), this->outputLevel() );
}
// printout message
if ( msgLevel(MSG::DEBUG) )
{
debug() << "Property update for "
<< theProp.name() << " : new value = " << this->outputLevel() << endmsg;
}
}
| MsgStream & GaudiCommon< PBASE >::msgStream | ( | const MSG::Level | level ) | const [inline] |
Predefined configurable message stream for the efficient printouts.
if ( a < 0 ) { msgStream( MSG::ERROR ) << "a = " << endmsg ; }
Definition at line 209 of file GaudiCommonImp.h.
{
if ( !m_msgStream )
{ m_msgStream = new MsgStream ( PBASE::msgSvc() , this->name() ) ; }
return *m_msgStream << level ;
}
| GaudiCommon& GaudiCommon< PBASE >::operator= | ( | const GaudiCommon< PBASE > & | ) | [private] |
| StatusCode GaudiCommon< PBASE >::Print | ( | const std::string & | msg, |
| const StatusCode | st = StatusCode::SUCCESS, |
||
| const MSG::Level | lev = MSG::INFO |
||
| ) | const |
Print the message and return with the given StatusCode.
| msg | Message to print |
| st | StatusCode to return |
| lev | Printout level for the given message |
Reimplemented in ErrorTool.
Definition at line 544 of file GaudiCommon.icpp.
{
// perform printout ?
if ( !msgLevel( lvl ) ) { return st ; } // RETURN
// use the predefined stream
MsgStream& str = msgStream( lvl ) ;
if ( typePrint() ) { str << System::typeinfoName(typeid(*this)) << ":: " ; }
// print the message
str << msg ;
// test status code
if ( st.isSuccess() ) { }
else if ( StatusCode::FAILURE != st.getCode() )
{ str << " StatusCode=" << st.getCode() ; }
else
{ str << " StatusCode=FAILURE" ; }
// perform print operation
str << endmsg ;
// return
return st;
}
| void GaudiCommon< PBASE >::printErrorHandler | ( | Property & | ) | [private] |
handler for "ErrorPrint" property
Definition at line 798 of file GaudiCommon.icpp.
{
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> errorsPrint() ) { this -> printErrors () ; }
}
| long GaudiCommon< PBASE >::printErrors | ( | const MSG::Level | level = MSG::ALWAYS ) |
const |
perform the actual printout of error counters
| level | The message level to print at |
Definition at line 648 of file GaudiCommon.icpp.
{
// format for printout
boost::format ftm ( " %s = %|.8s| %|23t| Message = '%s'" );
{ // print exceptions
for ( Counter::const_iterator excp = m_exceptions.begin() ;
excp != m_exceptions.end() ; ++excp )
{
msgStream(level)
<< ( ftm % "#EXCEPTIONS" % excp->second % excp->first )
<< endmsg;
}
}
{ // print errors
for ( Counter::const_iterator error = m_errors.begin() ;
error != m_errors.end() ; ++error )
{
msgStream(level)
<< ( ftm % "#ERRORS " % error->second % error->first )
<< endmsg;
}
}
{ // print warnings
for ( Counter::const_iterator warning = m_warnings.begin() ;
warning != m_warnings.end() ; ++warning )
{
msgStream(level)
<< ( ftm % "#WARNINGS " % warning->second % warning->first )
<< endmsg;
}
}
{ // print warnings
for ( Counter::const_iterator info = m_infos.begin() ;
info != m_infos.end() ; ++info )
{
msgStream(level)
<< ( ftm % "#INFOS " % info->second % info->first )
<< endmsg;
}
}
// return total number of errors+warnings+exceptions
return
m_exceptions .size () +
m_errors .size () +
m_warnings .size () +
m_infos .size () ;
}
| long GaudiCommon< PBASE >::printProps | ( | const MSG::Level | level = MSG::ALWAYS ) |
const |
perform the actual printout of properties
perform the printout of properties
| level | The message level to print at |
Definition at line 705 of file GaudiCommon.icpp.
{
// print ALL properties
MsgStream& msg = msgStream ( level );
typedef std::vector<Property*> Properties;
const Properties& properties = this->getProperties() ;
msg << "List of ALL properties of "
<< System::typeinfoName( typeid( *this ) ) << "/" << this->name()
<< " #properties = " << properties.size() << endmsg ;
for ( Properties::const_reverse_iterator property
= properties.rbegin() ;
properties.rend() != property ; ++property )
{
msg << "Property ['Name': Value] = "
<< ( **property)
<< endmsg ;
}
return properties.size() ;
}
| void GaudiCommon< PBASE >::printPropsHandler | ( | Property & | ) | [private] |
handler for "PropertiesPrint" property
Definition at line 808 of file GaudiCommon.icpp.
{
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> propsPrint() ) { this -> printProps ( MSG::ALWAYS ) ; }
}
| long GaudiCommon< PBASE >::printStat | ( | const MSG::Level | level = MSG::ALWAYS ) |
const |
perform the actual printout of statistical counters
| level | The message level to print at |
Definition at line 617 of file GaudiCommon.icpp.
{
// print statistics
if ( counters().empty() ) { return 0 ; }
MsgStream& msg = msgStream ( level ) ;
//
msg << "Number of counters : " << counters().size() ;
//
if ( !counters().empty() ) { msg << std::endl << m_header ; }
//
for ( Statistics::const_iterator entry = counters().begin() ;
counters().end() != entry ; ++entry )
{
msg << std::endl
<< Gaudi::Utils::formatAsTableRow
( entry -> first ,
entry -> second ,
m_useEffFormat ,
m_format1 , m_format2 );
}
//
msg << endmsg ;
//
return counters().size() ;
}
| void GaudiCommon< PBASE >::printStatHandler | ( | Property & | ) | [private] |
handler for "StatPrint" property
Definition at line 818 of file GaudiCommon.icpp.
{
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> statPrint() ) { this -> printStat ( MSG::ALWAYS ) ; }
}
| bool GaudiCommon< PBASE >::propsPrint | ( | ) | const [inline] |
Print properties at initialization ?
Definition at line 540 of file GaudiCommon.h.
{ return m_propsPrint ; }
| DataObject * GaudiCommon< PBASE >::put | ( | IDataProviderSvc * | svc, |
| DataObject * | object, | ||
| const std::string & | location, | ||
| const bool | useRootInTES = true |
||
| ) | const |
Register a data object or container into Gaudi Event Transient Store.
| svc | Pointer to data provider service |
| object | Data object or container to be registered |
| location | Location in Gaudi Event Transient Store ("/Event" could be omitted ) |
| useRootInTES | Flag to turn on(TRUE) off(FALSE) the use of the RootInTES location property |
| GaudiException | for invalid event data service |
| GaudiException | for invalid object |
| GaudiException | for error result from event data service |
| StatusCode::SUCCESS | Data was successfully placed in the TES. |
| StatusCode::FAILURE | Failed to store data in the TES. |
Reimplemented in GaudiAlgorithm, and GaudiTool.
Definition at line 765 of file GaudiCommon.icpp.
{
// check arguments
Assert ( 0 != svc , "put():: Invalid 'service'!" ) ;
Assert ( 0 != object , "put():: Invalid 'Object'!" ) ;
Assert ( !location.empty() , "put():: Invalid 'address' = '' " ) ;
// final data location
const std::string & fullLocation = fullTESLocation( location, useRootInTES );
// register the object!
const StatusCode status = '/' == fullLocation[0] ?
svc -> registerObject( fullLocation , object ) :
svc -> registerObject( "/Event/" + fullLocation , object ) ;
// check the result!
if ( status.isFailure() )
{ Exception ( "put():: could not register '" +
System::typeinfoName( typeid( *object ) ) +
"' at address '" + fullLocation + "'" , status ) ; }
if ( msgLevel( MSG::DEBUG ) )
{ Print( "The object of type '" +
System::typeinfoName( typeid( *object ) ) +
"' is registered in TS at address '"
+ fullLocation + "'" , status , MSG::DEBUG ) ; }
return object;
}
| void GaudiCommon< PBASE >::registerCondition | ( | const std::string & | condition, |
| StatusCode(CallerClass::*)() | mf = NULL |
||
| ) | [inline] |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
| condition | the path inside the Transient Detector Store to the condition object. |
| mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method.
StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond"); // ... return StatusCode.SUCCESS; } |
Definition at line 587 of file GaudiCommon.h.
{
updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
}
| void GaudiCommon< PBASE >::registerCondition | ( | const std::string & | condition, |
| CondType *& | condPtrDest, | ||
| StatusCode(CallerClass::*)() | mf = NULL |
||
| ) | [inline] |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
This version of the method allow the user to specify where to put a copy of the pointer to the condition object.
| condition | the path inside the Transient Detector Store to the condition object. |
| condPtrDest | pointer to fill with the location of the condition object. Note: the pointer can be safely used only in the execute method or in the member function triggered by the update. |
| mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method.
class MyAlg: public GaudiAlgorithm { // ... public: virtual StatusCode i_CallBack(); private: Condition *m_MyCond; SpecialCondition *m_MyOtherCond; // ... }; StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",m_MyCond,&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond",m_MyOtherCond); // ... return StatusCode.SUCCESS; } |
Definition at line 621 of file GaudiCommon.h.
{
updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf,condPtrDest);
}
| void GaudiCommon< PBASE >::registerCondition | ( | TargetClass * | condition, |
| StatusCode(CallerClass::*)() | mf = NULL |
||
| ) | [inline] |
register the current instance to the UpdateManagerSvc as a consumer for a condition.
| condition | the path inside the Transient Detector Store to the condition object. |
| mf | optional pointer to the member function to call when the condition object is updated. If the pointer is omitted the user must explicitly provide the class name to the method.
StatusCode MyAlg::initialize(){ // ... registerCondition("/dd/Conditions/Readout/MyDet/MyCond",&MyAlg::i_CallBack); registerCondition<MyAlg>("/dd/Conditions/Readout/MyDet/MyOtherCond"); // ... return StatusCode.SUCCESS; } |
Definition at line 646 of file GaudiCommon.h.
{
updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),condition,mf);
}
| void GaudiCommon< PBASE >::registerCondition | ( | char * | condition, |
| StatusCode(CallerClass::*)() | mf = NULL |
||
| ) | [inline] |
just to avoid conflicts with the version using a pointer to a template class.
Definition at line 627 of file GaudiCommon.h.
{
updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(this),std::string(condition),mf);
}
| StatusCode GaudiCommon< PBASE >::release | ( | const IInterface * | interface ) | const |
Manual forced (and 'safe') release of the active tool or service.
IMyTool* mytool = tool<IMyTool>( .... ) ; mytool->spendCPUtime() ; release ( mytool ) ; IMySvc* msvc = svc<IMySvc>( .... ) ; msvc->spendCPUtime() ; release ( msvc ) ;
| interface | Interface pointer to the interface to be released |
| StatusCode::SUCCESS | Tool or service was successfully released |
| StatusCode::FAILURE | Error releasing too or service |
Definition at line 371 of file GaudiCommon.icpp.
{
if ( 0 == interface )
{ return Error ( "release(IInterface):: IInterface* points to NULL!" ) ; }
// dispatch between tools and services
const IAlgTool* algTool = dynamic_cast<const IAlgTool*>( interface ) ;
// perform the actual release
return 0 != algTool ? releaseTool( algTool ) : releaseSvc( interface ) ;
}
| virtual unsigned long GaudiCommon< PBASE >::release | ( | ) | [inline, virtual] |
Un-hide IInterface::release (ICC warning #1125)
Definition at line 725 of file GaudiCommon.h.
{ return PBASE::release(); }
| StatusCode GaudiCommon< PBASE >::releaseSvc | ( | const IInterface * | svc ) | const [protected] |
manual forced (and 'safe') release of the service
Definition at line 423 of file GaudiCommon.icpp.
{
if( 0 == Svc ) {
return Error ( "releaseSvc(IInterface):: IInterface* points to NULL!" ) ;
}
SmartIF<IService> svc(const_cast<IInterface*>(Svc));
if (svc.isValid()) {
Services::iterator it = m_services.find(svc->name());
if (it == m_services.end()) {
return Warning( "releaseSvc(IInterface):: IInterface* is not active" );
}
if ( msgLevel(MSG::DEBUG) ) {
debug() << "Releasing service '" << it->first << "'" << endmsg;
}
m_services.erase(it);
return StatusCode::SUCCESS;
}
return Warning( "releaseSvc(IInterface):: IInterface* is not a service" );
}
| StatusCode GaudiCommon< PBASE >::releaseTool | ( | const IAlgTool * | tool ) | const [protected] |
manual forced (and 'safe') release of the tool
Definition at line 386 of file GaudiCommon.icpp.
{
if( 0 == algTool )
{ return Error ( "releaseTool(IAlgTool):: IAlgTool* points to NULL!" ) ; }
if( this->toolSvc() == 0 )
{ return Error ( "releaseTool(IAlgTool):: IToolSvc* points to NULL!" ) ; }
// find a tool in the list of active tools
AlgTools::reverse_iterator it =
std::find( m_tools.rbegin() , m_tools.rend() , algTool ) ;
if( m_tools.rend() == it )
{ return Warning("releaseTool(IAlgTool):: IAlgTool* is not active" ) ; }
// get the tool
IAlgTool* t = *it ;
// cache name
const std::string name = t->name();
if ( msgLevel(MSG::DEBUG) )
{ debug() << "Releasing tool '" << name << "'" << endmsg; }
// remove the tool from the lists
m_tools.erase( --it.base() ) ;
// release tool
if ( msgLevel(MSG::DEBUG) ) {
this->debug() << "The tool '" << t->name() << "' of type '"
<< System::typeinfoName(typeid(*t))
<< "' is released" << endmsg;
}
const StatusCode sc = this->toolSvc()->releaseTool( t ) ;
if ( sc.isFailure() )
{ return Warning ( "releaseTool(IAlgTool):: error from IToolSvc whilst releasing "+name , sc ) ; }
// return final status code
return sc ;
}
| void GaudiCommon< PBASE >::resetMsgStream | ( | ) | const [inline] |
Reset (delete) the current message stream object.
Useful for example to force a new object following a change in the message level settings
Definition at line 229 of file GaudiCommonImp.h.
{
if ( 0 != m_msgStream ) { delete m_msgStream; m_msgStream = 0; }
}
| const std::string& GaudiCommon< PBASE >::rootInTES | ( | ) | const [inline] |
Returns the "rootInTES" string.
Used as the directory root in the TES for which all data access refers to (both saving and retrieving).
Definition at line 750 of file GaudiCommon.h.
{ return m_rootInTES; }
| StatusCode GaudiCommon< PBASE >::runUpdate | ( | ) | [inline] |
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next BeginEvent incident.
It is useful if the instance can be instantiated after a BeginEvent incident, and used before the next one (for example with tools).
StatusCode MyTool::initialize(){ // ... return runUpdate(); }
Definition at line 660 of file GaudiCommon.h.
| const Services& GaudiCommon< PBASE >::services | ( | ) | const [inline] |
get the list of aquired services
Definition at line 732 of file GaudiCommon.h.
{ return m_services ; } // get all services
| bool GaudiCommon< PBASE >::statPrint | ( | ) | const [inline] |
Print statistical counters at finalization ?
Definition at line 542 of file GaudiCommon.h.
{ return m_statPrint ; }
| SmartIF< SERVICE > GaudiCommon< PBASE >::svc | ( | const std::string & | name, |
| const bool | create = true |
||
| ) | const [inline] |
A useful method for the easy location of services.
IMyService* mySvc = svc<IMyService>( "MyServiceType" );
| GaudiException | for error in Algorithms::service |
| GaudiException | for invalid service |
| name | service type name |
| create | Flag for creation of non-existing services |
Definition at line 165 of file GaudiCommonImp.h.
{
Assert ( this->svcLoc() != 0, "ISvcLocator* points to NULL!" );
SmartIF<SERVICE> s;
// check if we already have this service
Services::iterator it = m_services.find(name);
if (it != m_services.end()) {
// Try to get the requested interface
s = it->second;
// check the results
if ( !s.isValid() ) {
Exception ("svc():: Could not retrieve Svc '" + name + "'", StatusCode::FAILURE);
}
} else {
SmartIF<IService>& baseSvc = this->svcLoc()->service(name, create);
// Try to get the requested interface
s = baseSvc;
// check the results
if ( !baseSvc.isValid() || !s.isValid() ) {
Exception ("svc():: Could not retrieve Svc '" + name + "'", StatusCode::FAILURE);
}
// add the tool into list of known tools, to be properly released
addToServiceList(baseSvc);
}
// return *VALID* located service
return s;
}
| TOOL * GaudiCommon< PBASE >::tool | ( | const std::string & | type, |
| const std::string & | name, | ||
| const IInterface * | parent = 0, |
||
| bool | create = true |
||
| ) | const [inline] |
Useful method for the easy location of tools.
IMyTool* myTool =
tool<IMyTool>( "MyToolType", "MyToolName", this );
| GaudiException | for invalid Tool Service |
| GaudiException | for error from Tool Service |
| GaudiException | for invalid tool |
| type | Tool type |
| name | Tool name |
| parent | Tool parent |
| create | Flag for creation of nonexisting tools |
Definition at line 109 of file GaudiCommonImp.h.
{
TOOL* Tool = 0 ;
// for empty names delegate to another method
if ( name.empty() )
{
Tool = tool<TOOL>( type , parent , create ) ;
}
else
{
Assert( this->toolSvc() != 0, "tool():: IToolSvc* points to NULL!" ) ;
// get the tool from Tool Service
const StatusCode sc =
this->toolSvc()->retrieveTool ( type , name , Tool , parent , create ) ;
if ( sc.isFailure() )
{ Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'", sc ) ; }
if ( 0 == Tool )
{ Exception("tool():: Could not retrieve Tool '" + type + "'/'" + name + "'" ) ; }
// add the tool into list of known tools to be properly released
addToToolList( Tool );
}
// return *VALID* located tool
return Tool ;
}
| TOOL * GaudiCommon< PBASE >::tool | ( | const std::string & | type, |
| const IInterface * | parent = 0, |
||
| bool | create = true |
||
| ) | const [inline] |
A useful method for the easy location of tools.
IMyTool* myTool = tool<IMyTool>( "PublicToolType" );
| GaudiException | for invalid Tool Service |
| GaudiException | for error from Tool Service |
| GaudiException | for invalid tool |
| type | Tool type, could be of "Type/Name" format |
| parent | Tool parent |
| create | Flag for creation of non-existing tools |
Definition at line 141 of file GaudiCommonImp.h.
{
// check the environment
Assert ( PBASE::toolSvc() != 0, "IToolSvc* points to NULL!" );
// retrieve the tool from Tool Service
TOOL* Tool = 0 ;
const StatusCode sc =
this->toolSvc() -> retrieveTool ( type, Tool, parent , create );
if ( sc.isFailure() )
{ Exception("tool():: Could not retrieve Tool '" + type + "'", sc ) ; }
if ( 0 == Tool )
{ Exception("tool():: Could not retrieve Tool '" + type + "'" ) ; }
// add the tool into the list of known tools to be properly released
addToToolList( Tool );
// return *VALID* located tool
return Tool ;
}
| const AlgTools& GaudiCommon< PBASE >::tools | ( | ) | const [inline] |
get the list of aquired tools
Definition at line 730 of file GaudiCommon.h.
{ return m_tools ; } // get all tools
| bool GaudiCommon< PBASE >::typePrint | ( | ) | const [inline] |
Insert the actual C++ type of the algorithm/tool in the messages ?
Definition at line 538 of file GaudiCommon.h.
{ return m_typePrint ; }
| IUpdateManagerSvc * GaudiCommon< PBASE >::updMgrSvc | ( | ) | const [inline] |
Short-cut to locate the Update Manager Service.
Definition at line 198 of file GaudiCommonImp.h.
{
if ( !m_updMgrSvc )
{ m_updMgrSvc = svc<IUpdateManagerSvc>("UpdateManagerSvc",true); }
return m_updMgrSvc ;
}
| MsgStream& GaudiCommon< PBASE >::verbose | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::VERBOSE )
Definition at line 493 of file GaudiCommon.h.
{ return msgStream ( MSG::VERBOSE ) ; }
| MsgStream& GaudiCommon< PBASE >::warning | ( | ) | const [inline] |
shortcut for the method msgStream ( MSG::WARNING )
Definition at line 487 of file GaudiCommon.h.
{ return msgStream ( MSG::WARNING ) ; }
| StatusCode GaudiCommon< PBASE >::Warning | ( | const std::string & | msg, |
| const StatusCode | st = StatusCode::FAILURE, |
||
| const size_t | mx = 10 |
||
| ) | const |
Print the warning message and return with the given StatusCode.
Also performs statistical analysis of the error messages and suppression after the defined number of error instances.
if( a < 0 ) { return Warning("a is negative!") ;} if( b < 0 ) { return Warning("b is illegal!" , StatusCode(25) ); if( c < 0 ) { return Warning("c is negative" , StatusCode(35) , 50 );
| msg | Warning message |
| st | StatusCode to return |
| mx | Maximum number of printouts for this message |
Reimplemented in ErrorTool.
Definition at line 503 of file GaudiCommon.icpp.
{
// increase local counter of warnings
const size_t num = ++m_warnings[msg] ;
// If suppressed, just return
if ( num > mx ) { return st ; }
else if ( num == mx ) // issue one-time suppression message
{ return Print ( "The WARNING message is suppressed : '" +
msg + "'" , st , MSG::WARNING ) ; }
// return message
return Print ( msg , st , MSG::WARNING ) ;
}
const bool GaudiCommon< PBASE >::IgnoreRootInTES = false [static, protected] |
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
If used with cause the RootInTES option to be IGNORED.
Useful to aid with code readability. e.g.
// Get data, ignoring the setting of rootInTES() MyData * data = get<MyData>( "/Event/MyData", IgnoreRootInTES );
Definition at line 71 of file GaudiCommon.h.
std::string GaudiCommon< PBASE >::m_context [private] |
The context string.
Definition at line 798 of file GaudiCommon.h.
std::vector<std::string> GaudiCommon< PBASE >::m_counterList [protected] |
list of counters to declare. Set by property CounterList. This can be a regular expression.
Definition at line 100 of file GaudiCommon.h.
Statistics GaudiCommon< PBASE >::m_counters [mutable, private] |
General counters.
Definition at line 783 of file GaudiCommon.h.
ICounterSummarySvc* GaudiCommon< PBASE >::m_counterSummarySvc [protected] |
a pointer to the CounterSummarySvc
Definition at line 98 of file GaudiCommon.h.
Counter GaudiCommon< PBASE >::m_errors [mutable, private] |
Counter of errors.
Definition at line 775 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_errorsPrint [private] |
print warning and error counters at finalization ?
Definition at line 795 of file GaudiCommon.h.
Counter GaudiCommon< PBASE >::m_exceptions [mutable, private] |
Counter of exceptions.
Definition at line 781 of file GaudiCommon.h.
std::string GaudiCommon< PBASE >::m_format1 [private] |
format for regular statistical printout rows
Definition at line 811 of file GaudiCommon.h.
std::string GaudiCommon< PBASE >::m_format2 [private] |
format for "efficiency" statistical printout rows
Definition at line 813 of file GaudiCommon.h.
double GaudiCommon< PBASE >::m_globalTimeOffset [private] |
The globalTimeOffset value.
Definition at line 806 of file GaudiCommon.h.
std::string GaudiCommon< PBASE >::m_header [private] |
the header row
Definition at line 809 of file GaudiCommon.h.
Counter GaudiCommon< PBASE >::m_infos [mutable, private] |
counter of infos
Definition at line 779 of file GaudiCommon.h.
MSG::Level GaudiCommon< PBASE >::m_msgLevel [private] |
The message level.
Definition at line 765 of file GaudiCommon.h.
MsgStream* GaudiCommon< PBASE >::m_msgStream [mutable, private] |
The predefined message stream.
Definition at line 768 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_propsPrint [private] |
print properties at initialization?
Definition at line 791 of file GaudiCommon.h.
std::string GaudiCommon< PBASE >::m_rootInTES [private] |
The rootInTES string.
Definition at line 800 of file GaudiCommon.h.
std::string GaudiCommon< PBASE >::m_rootOnTES [private] |
The rootOnTES string.
Note, this job option is OBSOLETE, but retained temporarily to allow easy migration. Please update your code to use RootInTES instead. This option will be removed at some point.
Definition at line 804 of file GaudiCommon.h.
Services GaudiCommon< PBASE >::m_services [mutable, private] |
List of active services.
Definition at line 772 of file GaudiCommon.h.
std::vector<std::string> GaudiCommon< PBASE >::m_statEntityList [protected] |
Definition at line 102 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_statPrint [private] |
print counters at finalization ?
Definition at line 793 of file GaudiCommon.h.
AlgTools GaudiCommon< PBASE >::m_tools [mutable, private] |
List of active tools.
Definition at line 770 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_typePrint [private] |
insert the actual C++ type of the algorithm in the messages?
Definition at line 789 of file GaudiCommon.h.
IUpdateManagerSvc* GaudiCommon< PBASE >::m_updMgrSvc [mutable, private] |
Pointer to the Update Manager Service instance.
Definition at line 786 of file GaudiCommon.h.
bool GaudiCommon< PBASE >::m_useEffFormat [private] |
flag to use the special "efficiency" format
Definition at line 815 of file GaudiCommon.h.
Counter GaudiCommon< PBASE >::m_warnings [mutable, private] |
counter of warnings
Definition at line 777 of file GaudiCommon.h.
const bool GaudiCommon< PBASE >::UseRootInTES = true [static, protected] |
Simple definition to be used with the new useRootInTES argument get<TYPE> and put methods.
If used with cause the RootInTES option to be USED
Useful to aid with code readability. e.g.
// Get data, using the setting of rootInTES() MyData * data = get<MyData>( "/Event/MyData", UseRootInTES ); // note the default setting is true, so this is equivalent to MyData * data = get<MyData>( "/Event/MyData" );
Definition at line 83 of file GaudiCommon.h.