BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
RunEventNumber.cxx
Go to the documentation of this file.
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"
8
10#include "EventModel/Event.h"
12
14#include <time.h>
15
16time_t rawtime;
17
18
19/////////////////////////////////////////////////////////////////////////////
20
21
22RunEventNumber::RunEventNumber(const std::string& name, ISvcLocator* pSvcLocator) :
23 Algorithm(name, pSvcLocator) {
24
25 //Declare the properties
26 declareProperty("Period", m_period = 0);
27
28}
29
30// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
32 MsgStream log(msgSvc(), name());
33
34 log << MSG::INFO << "in initialize()" << endmsg;
35 StatusCode sc;
36
37 numEvents = 0;
38 numRuns = 0;
39 prevRun = 0;
40
41 log << MSG::INFO << "successfully return from initialize()" <<endmsg;
42 return StatusCode::SUCCESS;
43
44}
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
48
49 MsgStream log(msgSvc(), name());
50 log << MSG::INFO << "in execute()" << endreq;
51
52 numEvents++;
53
54 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
55 int runNum=eventHeader->runNumber();
56 int eventNum=eventHeader->eventNumber();
57
58 if(runNum != prevRun) {
59 numRuns++;
60 prevRun = runNum;
61 }
62
63 if((m_period != 0)&&(numEvents % m_period == 0)) {
64 time ( &rawtime );
65 std::cout << " RunEventNumberAlg: Run, event, time = "
66 << runNum << ", " << eventNum << ", " << asctime(localtime(&rawtime));
67 }
68
69 return StatusCode::SUCCESS;
70}
71
72
73// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
75
76 MsgStream log(msgSvc(), name());
77 log << MSG::INFO << "in finalize()" << endmsg;
78
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;
83
84 return StatusCode::SUCCESS;
85}
86
Double_t time
time_t rawtime
IMessageSvc * msgSvc()
StatusCode initialize()
StatusCode execute()
RunEventNumber(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode finalize()