4 // See the class description in the header file.
7 // in order to avoid the odd dependency for the
8 // times system function this include must be the first
10 #include "AliRunAction.h"
11 #include "AliRunActionMessenger.h"
12 #include "AliSDManager.h"
13 #include "AliGlobals.h"
17 #include "TG4GeometryManager.h"
20 #include <G4UImanager.hh>
22 AliRunAction::AliRunAction()
27 fMessenger = new AliRunActionMessenger(this);
31 AliRunAction::AliRunAction(const AliRunAction& right) {
33 AliGlobals::Exception("AliRunAction is protected from copying.");
36 AliRunAction::~AliRunAction() {
44 AliRunAction& AliRunAction::operator=(const AliRunAction &right)
46 // check assignement to self
47 if (this == &right) return *this;
49 AliGlobals::Exception("AliRunAction is protected from assigning.");
56 void AliRunAction::BeginOfRunAction(const G4Run* run)
58 // Called by G4 kernel at the beginning of run.
64 // store runID in the event header
65 gAlice->GetHeader()->SetRun(fRunID);
67 // clear remaining G3 tables
69 TG4GeometryManager::Instance()->ClearG3TablesFinal();
71 // create lego sensitive detectors
72 // if lego is instantiated
73 AliLego* lego = gAlice->Lego();
75 AliSDManager::Instance()->SetLego(lego);
76 G4UImanager::GetUIpointer()->ApplyCommand("/aliEvent/verbose 0");
77 G4UImanager::GetUIpointer()->ApplyCommand("/aliGenerator/set AliGenerator");
80 G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
84 void AliRunAction::EndOfRunAction(const G4Run* run)
86 // Called by G4 kernel at the end of run.
91 // delete lego sensitive detectors
92 // if lego is instantiated
93 AliLego* lego = gAlice->Lego();
95 AliSDManager::Instance()->UnsetLego();
96 G4UImanager::GetUIpointer()->ApplyCommand("/aliEvent/verbose 1");
99 G4cout << "Number of events = " << run->GetNumberOfEvent()
100 << " " << *fTimer << G4endl;