1#include "GaudiKernel/MsgStream.h"
2#include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/SmartDataPtr.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/PropertyMgr.h"
7#include "GaudiKernel/Bootstrap.h"
9#include "EventModel/EventModel.h"
10#include "EventModel/Event.h"
11#include "EventModel/EventHeader.h"
13#include "RunEventNumberAlg/RunEventNumber.h"
23 Algorithm(name, pSvcLocator) {
26 declareProperty(
"Period", m_period = 0);
32 MsgStream log(
msgSvc(), name());
34 log << MSG::INFO <<
"in initialize()" << endmsg;
41 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
42 return StatusCode::SUCCESS;
49 MsgStream log(
msgSvc(), name());
50 log << MSG::INFO <<
"in execute()" << endreq;
54 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
55 int runNum=eventHeader->runNumber();
56 int eventNum=eventHeader->eventNumber();
58 if(runNum != prevRun) {
63 if((m_period != 0)&&(numEvents % m_period == 0)) {
65 std::cout <<
" RunEventNumberAlg: Run, event, time = "
66 << runNum <<
", " << eventNum <<
", " << asctime(localtime(&
rawtime));
69 return StatusCode::SUCCESS;
76 MsgStream log(
msgSvc(), name());
77 log << MSG::INFO <<
"in finalize()" << endmsg;
79 std::cout << std::endl;
80 std::cout <<
" RunEventNumberAlg: Number of processed runs = " << numRuns << std::endl;
81 std::cout <<
" RunEventNumberAlg: Number of processed events = " << numEvents << std::endl;
82 std::cout << std::endl;
84 return StatusCode::SUCCESS;
RunEventNumber(const std::string &name, ISvcLocator *pSvcLocator)