4 // See the class description in the header file.
6 #include "AliRunMessenger.h"
8 #include "AliGlobals.h"
11 #include <G4UIdirectory.hh>
12 #include <G4UIcmdWithAnInteger.hh>
13 #include <G4UIcmdWithoutParameter.hh>
14 #include <G4UIcmdWithAString.hh>
16 //_____________________________________________________________________________
17 AliRunMessenger::AliRunMessenger()
20 fRunDirectory = new G4UIdirectory("/aliRun/");
21 fRunDirectory->SetGuidance("AliRun control commands.");
23 fConfigCmd = new G4UIcmdWithAString("/aliRun/setConfig", this);
24 fConfigCmd->SetGuidance("Set configuration macro name");
25 fConfigCmd->SetParameterName("ConfigName", true);
26 fConfigCmd->SetDefaultValue("Config");
27 fConfigCmd->AvailableForStates(PreInit);
29 fInitializeCmd = new G4UIcmdWithoutParameter("/aliRun/initialize", this);
30 fInitializeCmd->SetGuidance("Initialize AliRun");
31 fInitializeCmd->AvailableForStates(PreInit);
33 fBeamOnCmd = new G4UIcmdWithAnInteger("/aliRun/beamOn", this);
34 fBeamOnCmd->SetGuidance("Run the specified number of events");
35 fBeamOnCmd->SetParameterName("NofEvents", true);
36 fBeamOnCmd->SetDefaultValue(1);
37 fBeamOnCmd->SetRange("NofEvents >= 0");
38 fBeamOnCmd->AvailableForStates(Idle);
40 fLegoCmd = new G4UIcmdWithoutParameter("/aliRun/lego", this);
41 fLegoCmd->SetGuidance("Lego run");
42 fLegoCmd->AvailableForStates(Idle);
45 //_____________________________________________________________________________
46 AliRunMessenger::AliRunMessenger(const AliRunMessenger& right) {
48 AliGlobals::Exception("AliRunMessenger is protected from copying.");
51 //_____________________________________________________________________________
52 AliRunMessenger::~AliRunMessenger() {
56 delete fInitializeCmd;
63 //_____________________________________________________________________________
64 AliRunMessenger& AliRunMessenger::operator=(const AliRunMessenger &right)
66 // check assignement to self
67 if (this == &right) return *this;
69 AliGlobals::Exception("AliRunMessenger is protected from assigning.");
76 //_____________________________________________________________________________
77 void AliRunMessenger::SetNewValue(G4UIcommand* command,
80 // Applies command to the associated object.
85 AliGlobals::Exception(
86 "AliRunMessenger: gAlice has not been instantiated yet.");
89 if(command == fConfigCmd) {
90 AliFiles::Instance()->SetMacroName(newValue);
92 else if(command == fInitializeCmd) {
93 gAlice->Init(AliFiles::Instance()->GetRootMacroPath());
95 else if(command == fBeamOnCmd) {
96 gAlice->Run(fBeamOnCmd->GetNewIntValue(newValue));
98 else if(command == fLegoCmd) {