4 // See the class description in the header file.
6 #include "AliModuleConstructionMessenger.h"
7 #include "AliModuleConstruction.h"
8 #include "AliGlobals.h"
10 #include "AliColourStore.h"
13 #include <G4UIdirectory.hh>
14 #include <G4UIcmdWithABool.hh>
15 #include <G4UIcmdWithAString.hh>
16 #include <G4UIcmdWithoutParameter.hh>
18 //_____________________________________________________________________________
19 AliModuleConstructionMessenger::AliModuleConstructionMessenger(
20 AliModuleConstruction* moduleConstruction, G4String moduleName)
21 : fModuleConstruction(moduleConstruction)
24 G4String dirName = "/aliDet/";
25 dirName = dirName + moduleName + "/";
26 fModuleDirectory = new G4UIdirectory(dirName);
27 G4String guidance = "AlSubDetConstruction ";
28 guidance = guidance + moduleName + " control commands.";
29 fModuleDirectory->SetGuidance(guidance);
31 G4String commandPath = dirName + "setFrame";
32 fSetFrameCmd= new G4UIcmdWithAString(commandPath, this);
33 fSetFrameCmd ->SetGuidance("Set detector frame");
34 fSetFrameCmd->SetParameterName("frameName", false);
35 fSetFrameCmd->AvailableForStates(PreInit, Idle);
37 commandPath = dirName + "list";
38 fListCmd = new G4UIcmdWithoutParameter(commandPath, this);
39 guidance = "List all logical volumes of ";
40 guidance = guidance + moduleName + " detector";
41 fListCmd->SetGuidance(guidance);
42 fListCmd->AvailableForStates(PreInit,Idle);
44 commandPath = dirName + "listLong";
45 fListLongCmd = new G4UIcmdWithoutParameter(commandPath, this);
47 ->SetGuidance("List all logical volumes and number of its physical volumes");
48 guidance = "of " + moduleName + " detector";
49 fListLongCmd->SetGuidance(guidance);
50 fListLongCmd->AvailableForStates(PreInit,Idle);
52 commandPath = dirName + "listDaughters";
53 fListDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
54 fListDaughtersCmd->SetGuidance("List daughters of the given logical volumes");
55 fListDaughtersCmd->SetParameterName("lvName", false);
56 fListDaughtersCmd->AvailableForStates(PreInit,Idle);
58 commandPath = dirName + "listLongDaughters";
59 fListLongDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
61 ->SetGuidance("List daughters of the given logical volumes");
62 fListLongDaughtersCmd->SetGuidance("and number of its physical volumes");
63 fListLongDaughtersCmd->SetParameterName("lvName", false);
64 fListLongDaughtersCmd->AvailableForStates(PreInit,Idle);
66 #ifdef ALICE_VISUALIZE
69 commandPath = dirName + "setVolume";
70 fSetCurrentLVCmd = new G4UIcmdWithAString(commandPath, this);
71 fSetCurrentLVCmd->SetGuidance("Set the current logical volume.");
72 fSetCurrentLVCmd->SetParameterName("curVolume", false);
73 fSetCurrentLVCmd->AvailableForStates(PreInit,Idle);
75 commandPath = dirName + "setVisibility";
76 fSetDetVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
78 guidance = guidance + moduleName + " detector visible/invisible.";
79 fSetDetVisibilityCmd->SetGuidance(guidance);
80 fSetDetVisibilityCmd->SetParameterName("detVisibility", false);
81 fSetDetVisibilityCmd->AvailableForStates(PreInit,Idle);
83 commandPath = dirName + "setLVTreeVisibility";
84 fSetLVTreeVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
85 fSetLVTreeVisibilityCmd
86 ->SetGuidance("Make current volume tree visible/invisible.");
87 fSetLVTreeVisibilityCmd->SetParameterName("volVisibility", false);
88 fSetLVTreeVisibilityCmd->AvailableForStates(PreInit,Idle);
90 commandPath = dirName + "setVolVisibility";
91 fSetVolVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
93 ->SetGuidance("Make current volume visible/invisible.");
94 fSetVolVisibilityCmd->SetParameterName("volVisibility", false);
95 fSetVolVisibilityCmd->AvailableForStates(PreInit,Idle);
97 commandPath = dirName + "setColour";
98 fSetDetColourCmd = new G4UIcmdWithAString(commandPath, this);
99 AliColourStore* pColours = AliColourStore::Instance();
100 guidance = "Set colour for all ";
101 guidance = guidance + moduleName + " detector volumes.";
102 fSetDetColourCmd->SetGuidance(guidance);
103 fSetDetColourCmd->SetGuidance("Available colours:");
104 fSetDetColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
105 fSetDetColourCmd->SetParameterName("detColour", false);
106 G4String candidatesList = pColours->GetColoursList();
107 fSetDetColourCmd->SetCandidates(candidatesList);
108 fSetDetColourCmd->AvailableForStates(PreInit,Idle);
110 commandPath = dirName + "setLVTreeColour";
111 fSetLVTreeColourCmd = new G4UIcmdWithAString(commandPath, this);
112 fSetLVTreeColourCmd->SetGuidance("Set colour for the current volume tree.");
113 fSetLVTreeColourCmd->SetGuidance("Available colours:");
114 fSetLVTreeColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
115 fSetLVTreeColourCmd->SetParameterName("volColour", false);
116 candidatesList = pColours->GetColoursList();
117 fSetLVTreeColourCmd->SetCandidates(candidatesList);
118 fSetLVTreeColourCmd->AvailableForStates(PreInit,Idle);
120 commandPath = dirName + "setVolColour";
121 fSetVolColourCmd = new G4UIcmdWithAString(commandPath, this);
122 fSetVolColourCmd->SetGuidance("Set colour for the current volume.");
123 fSetVolColourCmd->SetGuidance("Available colours:");
124 fSetVolColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
125 fSetVolColourCmd->SetParameterName("volColour", false);
126 candidatesList = pColours->GetColoursList();
127 fSetVolColourCmd->SetCandidates(candidatesList);
128 fSetVolColourCmd->AvailableForStates(PreInit,Idle);
129 #endif //ALICE_VISUALIZE
132 //_____________________________________________________________________________
133 AliModuleConstructionMessenger::AliModuleConstructionMessenger() {
137 //_____________________________________________________________________________
138 AliModuleConstructionMessenger::AliModuleConstructionMessenger(
139 const AliModuleConstructionMessenger& right)
142 AliGlobals::Exception(
143 "AliModuleConstructionMessenger is protected from copying.");
146 //_____________________________________________________________________________
147 AliModuleConstructionMessenger::~AliModuleConstructionMessenger()
150 delete fModuleDirectory;
154 delete fListDaughtersCmd;
155 delete fListLongDaughtersCmd;
156 #ifdef ALICE_VISUALIZE
157 delete fSetDetVisibilityCmd;
158 delete fSetDetColourCmd;
159 delete fSetCurrentLVCmd;
160 delete fSetVolVisibilityCmd;
161 delete fSetVolColourCmd;
162 delete fSetLVTreeVisibilityCmd;
163 delete fSetLVTreeColourCmd;
164 #endif //ALICE_VISUALIZE
169 //_____________________________________________________________________________
170 AliModuleConstructionMessenger&
171 AliModuleConstructionMessenger::operator=(
172 const AliModuleConstructionMessenger& right)
174 // check assignement to self
175 if (this == &right) return *this;
177 AliGlobals::Exception(
178 "AliModuleConstructionMessenger is protected from assigning.");
185 //_____________________________________________________________________________
186 void AliModuleConstructionMessenger::SetNewValue(G4UIcommand* command,
189 // Applies command to the associated object.
192 if (command == fSetFrameCmd) {
193 fModuleConstruction->SetDetFrame(newValues);
195 else if (command == fListCmd) {
196 fModuleConstruction->ListAllLVTree();
198 else if (command == fListLongCmd) {
199 fModuleConstruction->ListAllLVTreeLong();
201 else if (command == fListDaughtersCmd) {
202 fModuleConstruction->ListLVTree(newValues);
204 else if (command == fListLongDaughtersCmd) {
205 fModuleConstruction->ListLVTreeLong(newValues);
207 #ifdef ALICE_VISUALIZE
208 if (command == fSetCurrentLVCmd) {
209 fCurrentVolume = fModuleConstruction->FindLogicalVolume(newValues);
211 else if (command == fSetDetVisibilityCmd) {
213 ->SetDetVisibility(fSetDetVisibilityCmd->GetNewBoolValue(newValues));
215 else if (command == fSetLVTreeVisibilityCmd) {
217 ->SetLVTreeVisibility(fCurrentVolume,
218 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
220 else if (command == fSetVolVisibilityCmd) {
222 ->SetVolumeVisibility(fCurrentVolume,
223 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
225 else if (command == fSetDetColourCmd) {
227 ->SetDetColour(newValues);
229 else if (command == fSetLVTreeColourCmd) {
231 ->SetLVTreeColour(fCurrentVolume, newValues);
233 else if (command == fSetVolColourCmd) {
235 ->SetVolumeColour(fCurrentVolume, newValues);
237 #endif //ALICE_VISUALIZE