File indexing completed on 2025-08-05 08:18:10
0001 #include "PHG4PhenixEventAction.h"
0002 #include "PHG4EventAction.h"
0003
0004 #include <phool/PHTimer.h> // for PHTimer
0005
0006 #include <iostream> // for operator<<, endl, basic_ostream, cout
0007
0008 const int VERBOSE = 0;
0009
0010 PHG4PhenixEventAction::PHG4PhenixEventAction()
0011 : _timer(PHTimeServer::get()->insert_new("PHG4PhenixEventAction"))
0012 {
0013 }
0014
0015 PHG4PhenixEventAction::~PHG4PhenixEventAction()
0016 {
0017 while (actions_.begin() != actions_.end())
0018 {
0019 delete actions_.back();
0020 actions_.pop_back();
0021 }
0022 }
0023
0024
0025 void PHG4PhenixEventAction::BeginOfEventAction(const G4Event* event)
0026 {
0027 _timer.get()->restart();
0028
0029 if (VERBOSE)
0030 {
0031 std::cout << "PHG4PhenixEventAction::BeginOfEventAction" << std::endl;
0032 }
0033
0034
0035 for (ActionList::const_iterator iter = actions_.begin(); iter != actions_.end(); ++iter)
0036 {
0037 if (*iter)
0038 {
0039 if (VERBOSE)
0040 {
0041 std::cout << "PHG4PhenixEventAction::BeginOfEventAction - processing " << *iter << std::endl;
0042 }
0043 (*iter)->BeginOfEventAction(event);
0044 }
0045 }
0046 }
0047
0048
0049 void PHG4PhenixEventAction::EndOfEventAction(const G4Event* event)
0050 {
0051 if (VERBOSE)
0052 {
0053 std::cout << "PHG4PhenixEventAction::EndOfEventAction" << std::endl;
0054 }
0055
0056
0057 for (ActionList::const_iterator iter = actions_.begin(); iter != actions_.end(); ++iter)
0058 {
0059 if (*iter)
0060 {
0061 if (VERBOSE)
0062 {
0063 std::cout << "PHG4PhenixEventAction::EndOfEventAction - processing " << *iter << std::endl;
0064 }
0065 (*iter)->EndOfEventAction(event);
0066 }
0067 }
0068
0069 _timer.get()->stop();
0070 }