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>
15 AliRunMessenger::AliRunMessenger()
18 fRunDirectory = new G4UIdirectory("/aliRun/");
19 fRunDirectory->SetGuidance("AliRun control commands.");
21 fInitializeCmd = new G4UIcmdWithoutParameter("/aliRun/initialize", this);
22 fInitializeCmd->SetGuidance("Initialize AliRun");
23 fInitializeCmd->AvailableForStates(PreInit);
25 fBeamOnCmd = new G4UIcmdWithAnInteger("/aliRun/beamOn", this);
26 fBeamOnCmd->SetGuidance("Run the specified number of events");
27 fBeamOnCmd->SetParameterName("NofEvents", true);
28 fBeamOnCmd->SetDefaultValue(1);
29 fBeamOnCmd->SetRange("NofEvents >= 0");
30 fBeamOnCmd->AvailableForStates(Idle);
32 fLegoCmd = new G4UIcmdWithoutParameter("/aliRun/lego", this);
33 fLegoCmd->SetGuidance("Lego run");
34 fLegoCmd->AvailableForStates(Idle);
37 AliRunMessenger::AliRunMessenger(const AliRunMessenger& right) {
39 AliGlobals::Exception("AliRunMessenger is protected from copying.");
42 AliRunMessenger::~AliRunMessenger() {
45 delete fInitializeCmd;
52 AliRunMessenger& AliRunMessenger::operator=(const AliRunMessenger &right)
54 // check assignement to self
55 if (this == &right) return *this;
57 AliGlobals::Exception("AliRunMessenger is protected from assigning.");
64 void AliRunMessenger::SetNewValue(G4UIcommand* command,
67 // Applies command to the associated object.
72 AliGlobals::Exception(
73 "AliRunMessenger: gAlice has not been instantiated yet.");
76 if(command == fInitializeCmd) {
77 gAlice->Init(AliFiles::Config());
79 else if(command == fBeamOnCmd) {
80 gAlice->Run(fBeamOnCmd->GetNewIntValue(newValue));
82 else if(command == fLegoCmd) {