forked from sPHENIX-Collaboration/coresoftware
/
PHG4PhenixEventAction.cc
59 lines (46 loc) · 1.64 KB
/
PHG4PhenixEventAction.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "PHG4PhenixEventAction.h"
#include "PHG4EventAction.h"
#include <phool/PHTimer.h> // for PHTimer
#include <iostream> // for operator<<, endl, basic_ostream, cout
const int VERBOSE = 0;
PHG4PhenixEventAction::PHG4PhenixEventAction() :
_timer( PHTimeServer::get()->insert_new( "PHG4PhenixEventAction" ) )
{}
PHG4PhenixEventAction::~PHG4PhenixEventAction()
{
while (actions_.begin() != actions_.end())
{
delete actions_.back();
actions_.pop_back();
}
}
//_________________________________________________________________
void PHG4PhenixEventAction::BeginOfEventAction( const G4Event* event )
{
_timer.get()->restart();
if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::BeginOfEventAction" << std::endl;
// loop over registered actions, and process
for( ActionList::const_iterator iter = actions_.begin(); iter != actions_.end(); ++iter )
{
if(*iter)
{
if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::BeginOfEventAction - processing " << *iter << std::endl;
(*iter)->BeginOfEventAction( event );
}
}
}
//_________________________________________________________________
void PHG4PhenixEventAction::EndOfEventAction( const G4Event* event )
{
if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::EndOfEventAction" << std::endl;
// loop over registered actions, and process
for( ActionList::const_iterator iter = actions_.begin(); iter != actions_.end(); ++iter )
{
if(*iter)
{
if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::EndOfEventAction - processing " << *iter << std::endl;
(*iter)->EndOfEventAction( event );
}
}
_timer.get()->stop();
}