]>
Commit | Line | Data |
---|---|---|
676fb573 | 1 | // $Id$ |
2 | // Category: run | |
3 | // | |
7005154f | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class AliRunMessenger | |
7 | // --------------------- | |
676fb573 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "AliRunMessenger.h" | |
11 | #include "AliFiles.h" | |
12 | #include "AliGlobals.h" | |
13 | #include "AliRun.h" | |
14 | ||
15 | #include <G4UIdirectory.hh> | |
16 | #include <G4UIcmdWithAnInteger.hh> | |
17 | #include <G4UIcmdWithoutParameter.hh> | |
e67066b2 | 18 | #include <G4UIcmdWithAString.hh> |
19 | ||
78ca1e9c | 20 | //_____________________________________________________________________________ |
676fb573 | 21 | AliRunMessenger::AliRunMessenger() |
22 | { | |
23 | // | |
24 | fRunDirectory = new G4UIdirectory("/aliRun/"); | |
25 | fRunDirectory->SetGuidance("AliRun control commands."); | |
26 | ||
e67066b2 | 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); | |
32 | ||
676fb573 | 33 | fInitializeCmd = new G4UIcmdWithoutParameter("/aliRun/initialize", this); |
34 | fInitializeCmd->SetGuidance("Initialize AliRun"); | |
35 | fInitializeCmd->AvailableForStates(PreInit); | |
36 | ||
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); | |
43 | ||
44 | fLegoCmd = new G4UIcmdWithoutParameter("/aliRun/lego", this); | |
45 | fLegoCmd->SetGuidance("Lego run"); | |
46 | fLegoCmd->AvailableForStates(Idle); | |
47 | } | |
48 | ||
78ca1e9c | 49 | //_____________________________________________________________________________ |
676fb573 | 50 | AliRunMessenger::AliRunMessenger(const AliRunMessenger& right) { |
51 | // | |
52 | AliGlobals::Exception("AliRunMessenger is protected from copying."); | |
53 | } | |
54 | ||
78ca1e9c | 55 | //_____________________________________________________________________________ |
676fb573 | 56 | AliRunMessenger::~AliRunMessenger() { |
57 | // | |
58 | delete fRunDirectory; | |
e67066b2 | 59 | delete fConfigCmd; |
676fb573 | 60 | delete fInitializeCmd; |
61 | delete fBeamOnCmd; | |
62 | delete fLegoCmd; | |
63 | } | |
64 | ||
65 | // operators | |
66 | ||
78ca1e9c | 67 | //_____________________________________________________________________________ |
676fb573 | 68 | AliRunMessenger& AliRunMessenger::operator=(const AliRunMessenger &right) |
69 | { | |
70 | // check assignement to self | |
71 | if (this == &right) return *this; | |
72 | ||
73 | AliGlobals::Exception("AliRunMessenger is protected from assigning."); | |
74 | ||
75 | return *this; | |
76 | } | |
77 | ||
78 | // public methods | |
79 | ||
78ca1e9c | 80 | //_____________________________________________________________________________ |
676fb573 | 81 | void AliRunMessenger::SetNewValue(G4UIcommand* command, |
82 | G4String newValue) | |
83 | { | |
84 | // Applies command to the associated object. | |
85 | // --- | |
86 | ||
87 | // test gAlice | |
88 | if (!gAlice) { | |
89 | AliGlobals::Exception( | |
90 | "AliRunMessenger: gAlice has not been instantiated yet."); | |
91 | } | |
92 | ||
e67066b2 | 93 | if(command == fConfigCmd) { |
94 | AliFiles::Instance()->SetMacroName(newValue); | |
95 | } | |
96 | else if(command == fInitializeCmd) { | |
97 | gAlice->Init(AliFiles::Instance()->GetRootMacroPath()); | |
676fb573 | 98 | } |
99 | else if(command == fBeamOnCmd) { | |
100 | gAlice->Run(fBeamOnCmd->GetNewIntValue(newValue)); | |
101 | } | |
102 | else if(command == fLegoCmd) { | |
7005154f | 103 | //gAlice->SetDebug(1); |
676fb573 | 104 | gAlice->RunLego(); |
105 | } | |
106 | } |