#include <GtTimeratorTool.h>
Inheritance diagram for GtTimeratorTool:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
GtTimeratorTool (const std::string &type, const std::string &name, const IInterface *parent) | |
virtual | ~GtTimeratorTool () |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | mutate (HepMC::GenEvent &event) |
Modify the event. | |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | evtColSvc () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | evtSvc () const |
IIncidentSvc * | incSvc () const |
IChronoStatSvc * | chronoSvc () const |
IHistogramSvc * | histoSvc () const |
IAlgContextSvc * | contextSvc () const |
DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
DataObject * | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
virtual unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
virtual unsigned long | addRef () |
virtual const std::string & | name () const |
virtual const std::string & | type () const |
virtual const IInterface * | parent () const |
virtual StatusCode | configure () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | terminate () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysStart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
PropertyMgr * | getPropertyMgr () |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
IMessageSvc * | msgSvc () const |
IToolSvc * | toolSvc () const |
StatusCode | setProperties () |
StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const |
StatusCode | service (const std::string &type, const std::string &name, T *&svc) const |
void | declInterface (const InterfaceID &, void *) |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IAuditorSvc * | auditorSvc () const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
virtual const std::string & | type () const =0 |
virtual const IInterface * | parent () const =0 |
virtual StatusCode | configure ()=0 |
virtual StatusCode | start ()=0 |
virtual StatusCode | stop ()=0 |
virtual StatusCode | terminate ()=0 |
virtual StatusCode | reinitialize ()=0 |
virtual StatusCode | restart ()=0 |
virtual Gaudi::StateMachine::State | FSMState () const =0 |
virtual StatusCode | sysInitialize ()=0 |
virtual StatusCode | sysStart ()=0 |
virtual StatusCode | sysStop ()=0 |
virtual StatusCode | sysFinalize ()=0 |
virtual StatusCode | sysReinitialize ()=0 |
virtual StatusCode | sysRestart ()=0 |
virtual unsigned long | refCount () const =0 |
virtual const std::string & | name () const =0 |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)=0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Retrieve interface ID. | |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
int | outputLevel () const |
virtual unsigned long | refCount () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Attributes | |
std::string | m_distrib |
Exponential - has lifetime (1/rate) LifeTime (m_lifetime) Uniform - events uniformly separated, with event length LifeTime (m_lifetime). | |
double | m_lifetime |
Specify the life time (1/rate) for exponential distribution or the event length for uniform distribution. | |
std::string | m_mode |
Absolut - each vertex in one event will be given the exact time, Relative - The generated time will be added to the actual vertex time \ usefull for generators such as uranium or LiHe. | |
Rndm::Numbers | m_rand |
This works by selecting a time interval from a specified distribution with a "lifetime" given by the property LifeTime. Each new absolute time will set by adding this duration to the last absolute time.
bv@bnl.gov 2007/12/31.
Definition at line 21 of file GtTimeratorTool.h.
GtTimeratorTool::GtTimeratorTool | ( | const std::string & | type, | |
const std::string & | name, | |||
const IInterface * | parent | |||
) |
Definition at line 11 of file GtTimeratorTool.cc.
00014 : GaudiTool(type,name,parent) 00015 { 00016 declareInterface<IHepMCEventMutator>(this); 00017 00018 declareProperty("Mode",m_mode="Absolut","Mode for time calculation method."); 00019 declareProperty("Distribution",m_distrib="Exponential","Event timing distribution"); 00020 declareProperty("LifeTime",m_lifetime=0,"Life time for distribution."); 00021 }
GtTimeratorTool::~GtTimeratorTool | ( | ) | [virtual] |
StatusCode GtTimeratorTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 27 of file GtTimeratorTool.cc.
00028 { 00029 info () << "initialize timer tool with mean delta time of " 00030 << m_lifetime/CLHEP::second << endreq; 00031 00032 // Non-positive lifetimes are meaningless and cause problems, particularly for 00033 // the Sim15 method 00034 if ( m_lifetime <= 0 ) 00035 { 00036 fatal() << "Non-positive lifetime specified. This is meaningless." << endreq; 00037 return StatusCode::FAILURE; 00038 } 00039 00040 // Unfortunately GaudiTool doesn't provide a short cut for us 00041 IRndmGenSvc *rgs = 0; 00042 if (service("RndmGenSvc",rgs,true).isFailure()) { 00043 fatal() << "Failed to get random service" << endreq; 00044 return StatusCode::FAILURE; 00045 } 00046 00047 StatusCode sc; 00048 if (m_rand.initialize(rgs, Rndm::Flat(0,1)).isFailure()) { 00049 fatal() << "Failed to initialize flat random numbers" << endreq; 00050 return StatusCode::FAILURE; 00051 } 00052 00053 return StatusCode::SUCCESS; 00054 }
StatusCode GtTimeratorTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 56 of file GtTimeratorTool.cc.
00057 { 00058 return StatusCode::SUCCESS; 00059 }
StatusCode GtTimeratorTool::mutate | ( | HepMC::GenEvent & | event | ) | [virtual] |
Modify the event.
Implements IHepMCEventMutator.
Definition at line 61 of file GtTimeratorTool.cc.
00062 { 00063 // Exponential Distribution: t(n) = t(n-1) * exp(-t/tL) 00064 // random t(n) = -ln(U)*tL + t(n-1) 00065 00066 double u = m_rand(); 00067 double dt = 0; 00068 00069 if (m_distrib == "Exponential") dt = ((-1.0 * log(u)) * m_lifetime); 00070 else if (m_distrib == "Uniform") dt = m_lifetime; 00071 else { 00072 fatal() << "Not a recognized event timing distribution option" << endreq; 00073 return StatusCode::FAILURE; 00074 } 00075 00076 debug() << "Incrementing current time of by " 00077 << dt/CLHEP::second << " seconds" 00078 << endreq; 00079 00080 double event_time = dt; 00081 00082 HepMC::GenEvent::vertex_iterator vtx, done = event.vertices_end(); 00083 for (vtx = event.vertices_begin(); vtx != done; ++vtx) { 00084 HepMC::FourVector position = (*vtx)->position(); 00085 double vertex_time = event_time; 00086 if (m_mode == "Relative") 00087 vertex_time += position.t(); 00088 position.setT(vertex_time); 00089 (*vtx)->set_position(position); 00090 } 00091 return StatusCode::SUCCESS; 00092 }
const InterfaceID & IHepMCEventMutator::interfaceID | ( | ) | [static, inherited] |
Retrieve interface ID.
Reimplemented from IAlgTool.
Definition at line 8 of file IHepMCEventMutator.cc.
00009 { 00010 return IID_IHepMCEventMutator; 00011 }
std::string GtTimeratorTool::m_distrib [private] |
Exponential - has lifetime (1/rate) LifeTime (m_lifetime) Uniform - events uniformly separated, with event length LifeTime (m_lifetime).
Definition at line 41 of file GtTimeratorTool.h.
double GtTimeratorTool::m_lifetime [private] |
Specify the life time (1/rate) for exponential distribution or the event length for uniform distribution.
Definition at line 46 of file GtTimeratorTool.h.
std::string GtTimeratorTool::m_mode [private] |
Absolut - each vertex in one event will be given the exact time, Relative - The generated time will be added to the actual vertex time \ usefull for generators such as uranium or LiHe.
Definition at line 53 of file GtTimeratorTool.h.
Rndm::Numbers GtTimeratorTool::m_rand [private] |
Definition at line 55 of file GtTimeratorTool.h.