4 // Author: I. Hrivnacova
6 // Class AliRunMessenger
7 // ---------------------
8 // See the class description in the header file.
10 #include "AliRunMessenger.h"
12 #include "AliGlobals.h"
15 #include <G4UIdirectory.hh>
16 #include <G4UIcmdWithAnInteger.hh>
17 #include <G4UIcmdWithoutParameter.hh>
18 #include <G4UIcmdWithAString.hh>
20 //_____________________________________________________________________________
21 AliRunMessenger::AliRunMessenger()
24 fRunDirectory = new G4UIdirectory("/aliRun/");
25 fRunDirectory->SetGuidance("AliRun control commands.");
27 fConfigCmd = new G4UIcmdWithAString("/aliRun/setConfig", this);
28 fConfigCmd->SetGuidance("Set configuration macro name");
29 fConfigCmd->SetParameterName("ConfigName", true);
30 fConfigCmd->SetDefaultValue("Config");
31 fConfigCmd->AvailableForStates(PreInit);
33 fInitializeCmd = new G4UIcmdWithoutParameter("/aliRun/initialize", this);
34 fInitializeCmd->SetGuidance("Initialize AliRun");
35 fInitializeCmd->AvailableForStates(PreInit);
37 fBeamOnCmd = new G4UIcmdWithAnInteger("/aliRun/beamOn", this);
38 fBeamOnCmd->SetGuidance("Run the specified number of events");
39 fBeamOnCmd->SetParameterName("NofEvents", true);
40 fBeamOnCmd->SetDefaultValue(1);
41 fBeamOnCmd->SetRange("NofEvents >= 0");
42 fBeamOnCmd->AvailableForStates(Idle);
44 fLegoCmd = new G4UIcmdWithoutParameter("/aliRun/lego", this);
45 fLegoCmd->SetGuidance("Lego run");
46 fLegoCmd->AvailableForStates(Idle);
49 //_____________________________________________________________________________
50 AliRunMessenger::AliRunMessenger(const AliRunMessenger& right) {
52 AliGlobals::Exception("AliRunMessenger is protected from copying.");
55 //_____________________________________________________________________________
56 AliRunMessenger::~AliRunMessenger() {
60 delete fInitializeCmd;
67 //_____________________________________________________________________________
68 AliRunMessenger& AliRunMessenger::operator=(const AliRunMessenger &right)
70 // check assignement to self
71 if (this == &right) return *this;
73 AliGlobals::Exception("AliRunMessenger is protected from assigning.");
80 //_____________________________________________________________________________
81 void AliRunMessenger::SetNewValue(G4UIcommand* command,
84 // Applies command to the associated object.
89 AliGlobals::Exception(
90 "AliRunMessenger: gAlice has not been instantiated yet.");
93 if(command == fConfigCmd) {
94 AliFiles::Instance()->SetMacroName(newValue);
96 else if(command == fInitializeCmd) {
97 gAlice->Init(AliFiles::Instance()->GetRootMacroPath());
99 else if(command == fBeamOnCmd) {
100 gAlice->Run(fBeamOnCmd->GetNewIntValue(newValue));
102 else if(command == fLegoCmd) {
103 //gAlice->SetDebug(1);