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>
24 AliRunAction::AliRunAction()
29 fMessenger = new AliRunActionMessenger(this);
33 AliRunAction::AliRunAction(const AliRunAction& right) {
35 AliGlobals::Exception("AliRunAction is protected from copying.");
38 AliRunAction::~AliRunAction() {
46 AliRunAction& AliRunAction::operator=(const AliRunAction &right)
48 // check assignement to self
49 if (this == &right) return *this;
51 AliGlobals::Exception("AliRunAction is protected from assigning.");
58 void AliRunAction::BeginOfRunAction(const G4Run* run)
60 // Called by G4 kernel at the beginning of run.
66 // store runID in the event header
67 gAlice->GetHeader()->SetRun(fRunID);
69 // clear remaining G3 tables
71 TG4GeometryManager::Instance()->ClearG3TablesFinal();
73 // create lego sensitive detectors
74 // if lego is instantiated
75 AliLego* lego = gAlice->Lego();
77 AliSDManager::Instance()->SetLego(lego);
78 G4UImanager::GetUIpointer()->ApplyCommand("/aliEvent/verbose 0");
79 G4UImanager::GetUIpointer()->ApplyCommand("/aliGenerator/set AliGenerator");
82 G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
86 void AliRunAction::EndOfRunAction(const G4Run* run)
88 // Called by G4 kernel at the end of run.
93 // delete lego sensitive detectors
94 // if lego is instantiated
95 AliLego* lego = gAlice->Lego();
97 AliSDManager::Instance()->UnsetLego();
98 G4UImanager::GetUIpointer()->ApplyCommand("/aliEvent/verbose 1");
101 G4cout << "Number of events = " << run->GetNumberOfEvent()
102 << " " << *fTimer << G4endl;