]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliRunMessenger.cxx
Put vacuum in beam-pipe not air.
[u/mrichter/AliRoot.git] / AliGeant4 / AliRunMessenger.cxx
CommitLineData
676fb573 1// $Id$
2// Category: run
3//
4// See the class description in the header file.
5
6#include "AliRunMessenger.h"
7#include "AliFiles.h"
8#include "AliGlobals.h"
9#include "AliRun.h"
10
11#include <G4UIdirectory.hh>
12#include <G4UIcmdWithAnInteger.hh>
13#include <G4UIcmdWithoutParameter.hh>
e67066b2 14#include <G4UIcmdWithAString.hh>
15
676fb573 16
17AliRunMessenger::AliRunMessenger()
18{
19//
20 fRunDirectory = new G4UIdirectory("/aliRun/");
21 fRunDirectory->SetGuidance("AliRun control commands.");
22
e67066b2 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);
28
676fb573 29 fInitializeCmd = new G4UIcmdWithoutParameter("/aliRun/initialize", this);
30 fInitializeCmd->SetGuidance("Initialize AliRun");
31 fInitializeCmd->AvailableForStates(PreInit);
32
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);
39
40 fLegoCmd = new G4UIcmdWithoutParameter("/aliRun/lego", this);
41 fLegoCmd->SetGuidance("Lego run");
42 fLegoCmd->AvailableForStates(Idle);
43}
44
45AliRunMessenger::AliRunMessenger(const AliRunMessenger& right) {
46//
47 AliGlobals::Exception("AliRunMessenger is protected from copying.");
48}
49
50AliRunMessenger::~AliRunMessenger() {
51//
52 delete fRunDirectory;
e67066b2 53 delete fConfigCmd;
676fb573 54 delete fInitializeCmd;
55 delete fBeamOnCmd;
56 delete fLegoCmd;
57}
58
59// operators
60
61AliRunMessenger& AliRunMessenger::operator=(const AliRunMessenger &right)
62{
63 // check assignement to self
64 if (this == &right) return *this;
65
66 AliGlobals::Exception("AliRunMessenger is protected from assigning.");
67
68 return *this;
69}
70
71// public methods
72
73void AliRunMessenger::SetNewValue(G4UIcommand* command,
74 G4String newValue)
75{
76// Applies command to the associated object.
77// ---
78
79 // test gAlice
80 if (!gAlice) {
81 AliGlobals::Exception(
82 "AliRunMessenger: gAlice has not been instantiated yet.");
83 }
84
e67066b2 85 if(command == fConfigCmd) {
86 AliFiles::Instance()->SetMacroName(newValue);
87 }
88 else if(command == fInitializeCmd) {
89 gAlice->Init(AliFiles::Instance()->GetRootMacroPath());
676fb573 90 }
91 else if(command == fBeamOnCmd) {
92 gAlice->Run(fBeamOnCmd->GetNewIntValue(newValue));
93 }
94 else if(command == fLegoCmd) {
95 gAlice->RunLego();
96 }
97}