| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

FakeEventTime.cpp

Go to the documentation of this file.
00001 // $Id: FakeEventTime.cpp,v 1.1 2006/09/26 10:45:48 marcocle Exp $
00002 // Include files 
00003 
00004 // from Gaudi
00005 #include "GaudiKernel/ToolFactory.h"
00006 #include "GaudiKernel/MsgStream.h"
00007 #include "GaudiKernel/IDataProviderSvc.h"
00008 
00009 // local
00010 #include "FakeEventTime.h"
00011 
00012 //-----------------------------------------------------------------------------
00013 // Implementation file for class : FakeEventTime
00014 //
00015 // 2006-09-21 : Marco Clemencic
00016 //-----------------------------------------------------------------------------
00017 
00018 // Declaration of the Tool Factory
00019 DECLARE_TOOL_FACTORY( FakeEventTime );
00020 
00021 
00022 //=============================================================================
00023 // Standard constructor, initializes variables
00024 //=============================================================================
00025 FakeEventTime::FakeEventTime( const std::string& type,
00026                               const std::string& name,
00027                               const IInterface* parent )
00028   : AlgTool ( type, name , parent )
00029 {
00030   declareInterface<IEventTimeDecoder>(this);
00031 
00032   declareProperty("EventDataSvc",     m_evtDataProviderName = "EventDataSvc"    );
00033 
00034   // properties used to generate fake times
00035   declareProperty("StartTime",       m_startTime = 0);
00036   declareProperty("TimeStep",        m_timeStep  = 0);
00037 }
00038 //=============================================================================
00039 // Destructor
00040 //=============================================================================
00041 FakeEventTime::~FakeEventTime() {} 
00042 
00043 //=========================================================================
00044 //  Initialization
00045 //=========================================================================
00046 StatusCode FakeEventTime::initialize ( ) {
00047   // base class initialization
00048         StatusCode sc = AlgTool::initialize();
00049         if (!sc.isSuccess()) return sc;
00050   
00051   // local initialization
00052         MsgStream log(msgSvc(),name());
00053         log << MSG::DEBUG << "--- initialize ---" << endmsg;
00054 
00055   // Not really needed, just an example.
00056   sc = service(m_evtDataProviderName,m_evtDataProvider,true);
00057   if (!sc.isSuccess()) {
00058     log << MSG::ERROR << "Unable to get a handle to the event data service" << endmsg;
00059     return sc;
00060   } else {
00061     log << MSG::DEBUG << "Got pointer to IDataProviderSvc \"" << m_evtDataProviderName << '"' << endmsg;
00062   }
00063 
00064   log << MSG::INFO << "Event times generated from " << m_startTime << " with steps of " << m_timeStep << endmsg;
00065 
00066   return StatusCode::SUCCESS;
00067 }
00068 
00069 //=========================================================================
00070 //  Finalization
00071 //=========================================================================
00072 StatusCode FakeEventTime::finalize ( ) {
00073         // local finalization
00074         MsgStream log(msgSvc(),name());
00075         log << MSG::DEBUG << "--- finalize ---" << endmsg;
00076 
00077         // release the interfaces used
00078         if (m_evtDataProvider != NULL) m_evtDataProvider->release();
00079 
00080   return AlgTool::finalize();
00081 }
00082 
00083 
00084 //=========================================================================
00085 //  Return the time of current event
00086 //=========================================================================
00087 Gaudi::Time FakeEventTime::getTime ( ) const {
00088 
00089   // Here we should get the time from the EventDataSvc
00090   Gaudi::Time currentTime(m_startTime);
00091 
00092  // increment for the next event
00093   FakeEventTime *myPtr = const_cast<FakeEventTime *>(this);
00094   myPtr->m_startTime += m_timeStep;
00095 
00096   return currentTime;
00097 }
00098 //=============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:42 2011 for DetDescSvc by doxygen 1.4.7