]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliModuleConstructionMessenger.cxx
Updated class description: added class title, author;
[u/mrichter/AliRoot.git] / AliGeant4 / AliModuleConstructionMessenger.cxx
CommitLineData
676fb573 1// $Id$
2// Category: geometry
3//
7005154f 4// Author: I. Hrivnacova
5//
6// Class AliModuleConstructionMessenger
7// ------------------------------------
676fb573 8// See the class description in the header file.
9
10#include "AliModuleConstructionMessenger.h"
11#include "AliModuleConstruction.h"
12#include "AliGlobals.h"
13#ifdef ALICE_VISUALIZE
14#include "AliColourStore.h"
15#endif
16
7005154f 17#include "TG4GeometryServices.h"
18
676fb573 19#include <G4UIdirectory.hh>
20#include <G4UIcmdWithABool.hh>
21#include <G4UIcmdWithAString.hh>
22#include <G4UIcmdWithoutParameter.hh>
676fb573 23
78ca1e9c 24//_____________________________________________________________________________
676fb573 25AliModuleConstructionMessenger::AliModuleConstructionMessenger(
7005154f 26 AliModuleConstruction* moduleConstruction, const G4String& moduleName)
676fb573 27 : fModuleConstruction(moduleConstruction)
28{
29//
30 G4String dirName = "/aliDet/";
31 dirName = dirName + moduleName + "/";
32 fModuleDirectory = new G4UIdirectory(dirName);
33 G4String guidance = "AlSubDetConstruction ";
34 guidance = guidance + moduleName + " control commands.";
35 fModuleDirectory->SetGuidance(guidance);
36
37 G4String commandPath = dirName + "setFrame";
38 fSetFrameCmd= new G4UIcmdWithAString(commandPath, this);
39 fSetFrameCmd ->SetGuidance("Set detector frame");
40 fSetFrameCmd->SetParameterName("frameName", false);
41 fSetFrameCmd->AvailableForStates(PreInit, Idle);
42
43 commandPath = dirName + "list";
44 fListCmd = new G4UIcmdWithoutParameter(commandPath, this);
45 guidance = "List all logical volumes of ";
46 guidance = guidance + moduleName + " detector";
47 fListCmd->SetGuidance(guidance);
48 fListCmd->AvailableForStates(PreInit,Idle);
49
50 commandPath = dirName + "listLong";
51 fListLongCmd = new G4UIcmdWithoutParameter(commandPath, this);
52 fListLongCmd
53 ->SetGuidance("List all logical volumes and number of its physical volumes");
54 guidance = "of " + moduleName + " detector";
55 fListLongCmd->SetGuidance(guidance);
56 fListLongCmd->AvailableForStates(PreInit,Idle);
57
58 commandPath = dirName + "listDaughters";
59 fListDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
60 fListDaughtersCmd->SetGuidance("List daughters of the given logical volumes");
61 fListDaughtersCmd->SetParameterName("lvName", false);
62 fListDaughtersCmd->AvailableForStates(PreInit,Idle);
63
64 commandPath = dirName + "listLongDaughters";
65 fListLongDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
66 fListLongDaughtersCmd
67 ->SetGuidance("List daughters of the given logical volumes");
68 fListLongDaughtersCmd->SetGuidance("and number of its physical volumes");
69 fListLongDaughtersCmd->SetParameterName("lvName", false);
70 fListLongDaughtersCmd->AvailableForStates(PreInit,Idle);
71
72#ifdef ALICE_VISUALIZE
73 fCurrentVolume = 0;
74
75 commandPath = dirName + "setVolume";
76 fSetCurrentLVCmd = new G4UIcmdWithAString(commandPath, this);
77 fSetCurrentLVCmd->SetGuidance("Set the current logical volume.");
78 fSetCurrentLVCmd->SetParameterName("curVolume", false);
79 fSetCurrentLVCmd->AvailableForStates(PreInit,Idle);
80
81 commandPath = dirName + "setVisibility";
82 fSetDetVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
83 guidance = "Make ";
84 guidance = guidance + moduleName + " detector visible/invisible.";
85 fSetDetVisibilityCmd->SetGuidance(guidance);
86 fSetDetVisibilityCmd->SetParameterName("detVisibility", false);
87 fSetDetVisibilityCmd->AvailableForStates(PreInit,Idle);
88
89 commandPath = dirName + "setLVTreeVisibility";
90 fSetLVTreeVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
91 fSetLVTreeVisibilityCmd
92 ->SetGuidance("Make current volume tree visible/invisible.");
93 fSetLVTreeVisibilityCmd->SetParameterName("volVisibility", false);
94 fSetLVTreeVisibilityCmd->AvailableForStates(PreInit,Idle);
95
96 commandPath = dirName + "setVolVisibility";
97 fSetVolVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
98 fSetVolVisibilityCmd
99 ->SetGuidance("Make current volume visible/invisible.");
100 fSetVolVisibilityCmd->SetParameterName("volVisibility", false);
101 fSetVolVisibilityCmd->AvailableForStates(PreInit,Idle);
102
103 commandPath = dirName + "setColour";
104 fSetDetColourCmd = new G4UIcmdWithAString(commandPath, this);
105 AliColourStore* pColours = AliColourStore::Instance();
106 guidance = "Set colour for all ";
107 guidance = guidance + moduleName + " detector volumes.";
108 fSetDetColourCmd->SetGuidance(guidance);
109 fSetDetColourCmd->SetGuidance("Available colours:");
110 fSetDetColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
111 fSetDetColourCmd->SetParameterName("detColour", false);
112 G4String candidatesList = pColours->GetColoursList();
113 fSetDetColourCmd->SetCandidates(candidatesList);
114 fSetDetColourCmd->AvailableForStates(PreInit,Idle);
115
116 commandPath = dirName + "setLVTreeColour";
117 fSetLVTreeColourCmd = new G4UIcmdWithAString(commandPath, this);
118 fSetLVTreeColourCmd->SetGuidance("Set colour for the current volume tree.");
119 fSetLVTreeColourCmd->SetGuidance("Available colours:");
120 fSetLVTreeColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
121 fSetLVTreeColourCmd->SetParameterName("volColour", false);
122 candidatesList = pColours->GetColoursList();
123 fSetLVTreeColourCmd->SetCandidates(candidatesList);
124 fSetLVTreeColourCmd->AvailableForStates(PreInit,Idle);
125
126 commandPath = dirName + "setVolColour";
127 fSetVolColourCmd = new G4UIcmdWithAString(commandPath, this);
128 fSetVolColourCmd->SetGuidance("Set colour for the current volume.");
129 fSetVolColourCmd->SetGuidance("Available colours:");
130 fSetVolColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
131 fSetVolColourCmd->SetParameterName("volColour", false);
132 candidatesList = pColours->GetColoursList();
133 fSetVolColourCmd->SetCandidates(candidatesList);
134 fSetVolColourCmd->AvailableForStates(PreInit,Idle);
135#endif //ALICE_VISUALIZE
136}
137
78ca1e9c 138//_____________________________________________________________________________
676fb573 139AliModuleConstructionMessenger::AliModuleConstructionMessenger() {
140//
141}
142
78ca1e9c 143//_____________________________________________________________________________
676fb573 144AliModuleConstructionMessenger::AliModuleConstructionMessenger(
145 const AliModuleConstructionMessenger& right)
146{
147//
148 AliGlobals::Exception(
149 "AliModuleConstructionMessenger is protected from copying.");
150}
151
78ca1e9c 152//_____________________________________________________________________________
676fb573 153AliModuleConstructionMessenger::~AliModuleConstructionMessenger()
154{
155//
156 delete fModuleDirectory;
157 delete fSetFrameCmd;
158 delete fListCmd;
159 delete fListLongCmd;
160 delete fListDaughtersCmd;
161 delete fListLongDaughtersCmd;
162#ifdef ALICE_VISUALIZE
163 delete fSetDetVisibilityCmd;
164 delete fSetDetColourCmd;
165 delete fSetCurrentLVCmd;
166 delete fSetVolVisibilityCmd;
167 delete fSetVolColourCmd;
168 delete fSetLVTreeVisibilityCmd;
169 delete fSetLVTreeColourCmd;
170#endif //ALICE_VISUALIZE
171}
172
173// operators
174
78ca1e9c 175//_____________________________________________________________________________
676fb573 176AliModuleConstructionMessenger&
177AliModuleConstructionMessenger::operator=(
178 const AliModuleConstructionMessenger& right)
179{
180 // check assignement to self
181 if (this == &right) return *this;
182
183 AliGlobals::Exception(
184 "AliModuleConstructionMessenger is protected from assigning.");
185
186 return *this;
187}
188
189// public methods
190
78ca1e9c 191//_____________________________________________________________________________
676fb573 192void AliModuleConstructionMessenger::SetNewValue(G4UIcommand* command,
193 G4String newValues)
194{
195// Applies command to the associated object.
196// ---
197
198 if (command == fSetFrameCmd) {
199 fModuleConstruction->SetDetFrame(newValues);
200 }
201 else if (command == fListCmd) {
202 fModuleConstruction->ListAllLVTree();
203 }
204 else if (command == fListLongCmd) {
205 fModuleConstruction->ListAllLVTreeLong();
206 }
207 else if (command == fListDaughtersCmd) {
208 fModuleConstruction->ListLVTree(newValues);
209 }
210 else if (command == fListLongDaughtersCmd) {
211 fModuleConstruction->ListLVTreeLong(newValues);
212 }
213#ifdef ALICE_VISUALIZE
214 if (command == fSetCurrentLVCmd) {
7005154f 215 fCurrentVolume
216 = TG4GeometryServices::Instance()->FindLogicalVolume(newValues);
676fb573 217 }
218 else if (command == fSetDetVisibilityCmd) {
219 fModuleConstruction
220 ->SetDetVisibility(fSetDetVisibilityCmd->GetNewBoolValue(newValues));
221 }
222 else if (command == fSetLVTreeVisibilityCmd) {
223 fModuleConstruction
224 ->SetLVTreeVisibility(fCurrentVolume,
225 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
226 }
227 else if (command == fSetVolVisibilityCmd) {
228 fModuleConstruction
229 ->SetVolumeVisibility(fCurrentVolume,
230 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
231 }
232 else if (command == fSetDetColourCmd) {
233 fModuleConstruction
234 ->SetDetColour(newValues);
235 }
236 else if (command == fSetLVTreeColourCmd) {
237 fModuleConstruction
238 ->SetLVTreeColour(fCurrentVolume, newValues);
239 }
240 else if (command == fSetVolColourCmd) {
241 fModuleConstruction
242 ->SetVolumeColour(fCurrentVolume, newValues);
243 }
244#endif //ALICE_VISUALIZE
245}
246