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"
24 Algorithm(name, pSvcLocator) {
27 declareProperty(
"Period", m_period = 0);
33 MsgStream log(
msgSvc(), name());
35 log << MSG::INFO <<
"in initialize()" << endmsg;
42 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
43 return StatusCode::SUCCESS;
50 MsgStream log(
msgSvc(), name());
51 log << MSG::INFO <<
"in execute()" << endreq;
55 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
56 int runNum=eventHeader->runNumber();
57 int eventNum=eventHeader->eventNumber();
59 if(runNum != prevRun) {
64 if((m_period != 0)&&(numEvents % m_period == 0)) {
66 std::cout <<
" RunEventNumberAlg: Run, event, time = "
67 << runNum <<
", " << eventNum <<
", " << asctime(localtime(&
rawtime));
70 return StatusCode::SUCCESS;
77 MsgStream log(
msgSvc(), name());
78 log << MSG::INFO <<
"in finalize()" << endmsg;
80 std::cout << std::endl;
81 std::cout <<
" RunEventNumberAlg: Number of processed runs = " << numRuns << std::endl;
82 std::cout <<
" RunEventNumberAlg: Number of processed events = " << numEvents << std::endl;
83 std::cout << std::endl;
85 return StatusCode::SUCCESS;