EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4PhenixEventAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4PhenixEventAction.cc
2 #include "PHG4EventAction.h"
3 
4 #include <phool/PHTimer.h> // for PHTimer
5 
6 #include <iostream> // for operator<<, endl, basic_ostream, cout
7 
8 const int VERBOSE = 0;
9 
11  _timer( PHTimeServer::get()->insert_new( "PHG4PhenixEventAction" ) )
12 {}
13 
15 {
16  while (actions_.begin() != actions_.end())
17  {
18  delete actions_.back();
19  actions_.pop_back();
20  }
21 }
22 
23 //_________________________________________________________________
24 void PHG4PhenixEventAction::BeginOfEventAction( const G4Event* event )
25 {
26  _timer.get()->restart();
27 
28  if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::BeginOfEventAction" << std::endl;
29 
30  // loop over registered actions, and process
31  for( ActionList::const_iterator iter = actions_.begin(); iter != actions_.end(); ++iter )
32  {
33  if(*iter)
34  {
35  if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::BeginOfEventAction - processing " << *iter << std::endl;
36  (*iter)->BeginOfEventAction( event );
37  }
38  }
39 
40 }
41 
42 //_________________________________________________________________
43 void PHG4PhenixEventAction::EndOfEventAction( const G4Event* event )
44 {
45 
46  if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::EndOfEventAction" << std::endl;
47 
48  // loop over registered actions, and process
49  for( ActionList::const_iterator iter = actions_.begin(); iter != actions_.end(); ++iter )
50  {
51  if(*iter)
52  {
53  if ( VERBOSE ) std::cout << "PHG4PhenixEventAction::EndOfEventAction - processing " << *iter << std::endl;
54  (*iter)->EndOfEventAction( event );
55  }
56  }
57 
58  _timer.get()->stop();
59 }