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 AliModuleConstructionMessenger::AliModuleConstructionMessenger(
19 AliModuleConstruction* moduleConstruction, G4String moduleName)
20 : fModuleConstruction(moduleConstruction)
23 G4String dirName = "/aliDet/";
24 dirName = dirName + moduleName + "/";
25 fModuleDirectory = new G4UIdirectory(dirName);
26 G4String guidance = "AlSubDetConstruction ";
27 guidance = guidance + moduleName + " control commands.";
28 fModuleDirectory->SetGuidance(guidance);
30 G4String commandPath = dirName + "setFrame";
31 fSetFrameCmd= new G4UIcmdWithAString(commandPath, this);
32 fSetFrameCmd ->SetGuidance("Set detector frame");
33 fSetFrameCmd->SetParameterName("frameName", false);
34 fSetFrameCmd->AvailableForStates(PreInit, Idle);
36 commandPath = dirName + "list";
37 fListCmd = new G4UIcmdWithoutParameter(commandPath, this);
38 guidance = "List all logical volumes of ";
39 guidance = guidance + moduleName + " detector";
40 fListCmd->SetGuidance(guidance);
41 fListCmd->AvailableForStates(PreInit,Idle);
43 commandPath = dirName + "listLong";
44 fListLongCmd = new G4UIcmdWithoutParameter(commandPath, this);
46 ->SetGuidance("List all logical volumes and number of its physical volumes");
47 guidance = "of " + moduleName + " detector";
48 fListLongCmd->SetGuidance(guidance);
49 fListLongCmd->AvailableForStates(PreInit,Idle);
51 commandPath = dirName + "listDaughters";
52 fListDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
53 fListDaughtersCmd->SetGuidance("List daughters of the given logical volumes");
54 fListDaughtersCmd->SetParameterName("lvName", false);
55 fListDaughtersCmd->AvailableForStates(PreInit,Idle);
57 commandPath = dirName + "listLongDaughters";
58 fListLongDaughtersCmd = new G4UIcmdWithAString(commandPath, this);
60 ->SetGuidance("List daughters of the given logical volumes");
61 fListLongDaughtersCmd->SetGuidance("and number of its physical volumes");
62 fListLongDaughtersCmd->SetParameterName("lvName", false);
63 fListLongDaughtersCmd->AvailableForStates(PreInit,Idle);
65 #ifdef ALICE_VISUALIZE
68 commandPath = dirName + "setVolume";
69 fSetCurrentLVCmd = new G4UIcmdWithAString(commandPath, this);
70 fSetCurrentLVCmd->SetGuidance("Set the current logical volume.");
71 fSetCurrentLVCmd->SetParameterName("curVolume", false);
72 fSetCurrentLVCmd->AvailableForStates(PreInit,Idle);
74 commandPath = dirName + "setVisibility";
75 fSetDetVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
77 guidance = guidance + moduleName + " detector visible/invisible.";
78 fSetDetVisibilityCmd->SetGuidance(guidance);
79 fSetDetVisibilityCmd->SetParameterName("detVisibility", false);
80 fSetDetVisibilityCmd->AvailableForStates(PreInit,Idle);
82 commandPath = dirName + "setLVTreeVisibility";
83 fSetLVTreeVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
84 fSetLVTreeVisibilityCmd
85 ->SetGuidance("Make current volume tree visible/invisible.");
86 fSetLVTreeVisibilityCmd->SetParameterName("volVisibility", false);
87 fSetLVTreeVisibilityCmd->AvailableForStates(PreInit,Idle);
89 commandPath = dirName + "setVolVisibility";
90 fSetVolVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
92 ->SetGuidance("Make current volume visible/invisible.");
93 fSetVolVisibilityCmd->SetParameterName("volVisibility", false);
94 fSetVolVisibilityCmd->AvailableForStates(PreInit,Idle);
96 commandPath = dirName + "setColour";
97 fSetDetColourCmd = new G4UIcmdWithAString(commandPath, this);
98 AliColourStore* pColours = AliColourStore::Instance();
99 guidance = "Set colour for all ";
100 guidance = guidance + moduleName + " detector volumes.";
101 fSetDetColourCmd->SetGuidance(guidance);
102 fSetDetColourCmd->SetGuidance("Available colours:");
103 fSetDetColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
104 fSetDetColourCmd->SetParameterName("detColour", false);
105 G4String candidatesList = pColours->GetColoursList();
106 fSetDetColourCmd->SetCandidates(candidatesList);
107 fSetDetColourCmd->AvailableForStates(PreInit,Idle);
109 commandPath = dirName + "setLVTreeColour";
110 fSetLVTreeColourCmd = new G4UIcmdWithAString(commandPath, this);
111 fSetLVTreeColourCmd->SetGuidance("Set colour for the current volume tree.");
112 fSetLVTreeColourCmd->SetGuidance("Available colours:");
113 fSetLVTreeColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
114 fSetLVTreeColourCmd->SetParameterName("volColour", false);
115 candidatesList = pColours->GetColoursList();
116 fSetLVTreeColourCmd->SetCandidates(candidatesList);
117 fSetLVTreeColourCmd->AvailableForStates(PreInit,Idle);
119 commandPath = dirName + "setVolColour";
120 fSetVolColourCmd = new G4UIcmdWithAString(commandPath, this);
121 fSetVolColourCmd->SetGuidance("Set colour for the current volume.");
122 fSetVolColourCmd->SetGuidance("Available colours:");
123 fSetVolColourCmd->SetGuidance(pColours->GetColoursListWithCommas());
124 fSetVolColourCmd->SetParameterName("volColour", false);
125 candidatesList = pColours->GetColoursList();
126 fSetVolColourCmd->SetCandidates(candidatesList);
127 fSetVolColourCmd->AvailableForStates(PreInit,Idle);
128 #endif //ALICE_VISUALIZE
131 AliModuleConstructionMessenger::AliModuleConstructionMessenger() {
135 AliModuleConstructionMessenger::AliModuleConstructionMessenger(
136 const AliModuleConstructionMessenger& right)
139 AliGlobals::Exception(
140 "AliModuleConstructionMessenger is protected from copying.");
143 AliModuleConstructionMessenger::~AliModuleConstructionMessenger()
146 delete fModuleDirectory;
150 delete fListDaughtersCmd;
151 delete fListLongDaughtersCmd;
152 #ifdef ALICE_VISUALIZE
153 delete fSetDetVisibilityCmd;
154 delete fSetDetColourCmd;
155 delete fSetCurrentLVCmd;
156 delete fSetVolVisibilityCmd;
157 delete fSetVolColourCmd;
158 delete fSetLVTreeVisibilityCmd;
159 delete fSetLVTreeColourCmd;
160 #endif //ALICE_VISUALIZE
165 AliModuleConstructionMessenger&
166 AliModuleConstructionMessenger::operator=(
167 const AliModuleConstructionMessenger& right)
169 // check assignement to self
170 if (this == &right) return *this;
172 AliGlobals::Exception(
173 "AliModuleConstructionMessenger is protected from assigning.");
180 void AliModuleConstructionMessenger::SetNewValue(G4UIcommand* command,
183 // Applies command to the associated object.
186 if (command == fSetFrameCmd) {
187 fModuleConstruction->SetDetFrame(newValues);
189 else if (command == fListCmd) {
190 fModuleConstruction->ListAllLVTree();
192 else if (command == fListLongCmd) {
193 fModuleConstruction->ListAllLVTreeLong();
195 else if (command == fListDaughtersCmd) {
196 fModuleConstruction->ListLVTree(newValues);
198 else if (command == fListLongDaughtersCmd) {
199 fModuleConstruction->ListLVTreeLong(newValues);
201 #ifdef ALICE_VISUALIZE
202 if (command == fSetCurrentLVCmd) {
203 fCurrentVolume = fModuleConstruction->FindLogicalVolume(newValues);
205 else if (command == fSetDetVisibilityCmd) {
207 ->SetDetVisibility(fSetDetVisibilityCmd->GetNewBoolValue(newValues));
209 else if (command == fSetLVTreeVisibilityCmd) {
211 ->SetLVTreeVisibility(fCurrentVolume,
212 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
214 else if (command == fSetVolVisibilityCmd) {
216 ->SetVolumeVisibility(fCurrentVolume,
217 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
219 else if (command == fSetDetColourCmd) {
221 ->SetDetColour(newValues);
223 else if (command == fSetLVTreeColourCmd) {
225 ->SetLVTreeColour(fCurrentVolume, newValues);
227 else if (command == fSetVolColourCmd) {
229 ->SetVolumeColour(fCurrentVolume, newValues);
231 #endif //ALICE_VISUALIZE