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>
17 #include <G4LogicalVolume.hh>
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 AliModuleConstructionMessenger::AliModuleConstructionMessenger() {
136 AliModuleConstructionMessenger::AliModuleConstructionMessenger(
137 const AliModuleConstructionMessenger& right)
140 AliGlobals::Exception(
141 "AliModuleConstructionMessenger is protected from copying.");
144 AliModuleConstructionMessenger::~AliModuleConstructionMessenger()
147 delete fModuleDirectory;
151 delete fListDaughtersCmd;
152 delete fListLongDaughtersCmd;
153 #ifdef ALICE_VISUALIZE
154 delete fSetDetVisibilityCmd;
155 delete fSetDetColourCmd;
156 delete fSetCurrentLVCmd;
157 delete fSetVolVisibilityCmd;
158 delete fSetVolColourCmd;
159 delete fSetLVTreeVisibilityCmd;
160 delete fSetLVTreeColourCmd;
161 #endif //ALICE_VISUALIZE
166 AliModuleConstructionMessenger&
167 AliModuleConstructionMessenger::operator=(
168 const AliModuleConstructionMessenger& right)
170 // check assignement to self
171 if (this == &right) return *this;
173 AliGlobals::Exception(
174 "AliModuleConstructionMessenger is protected from assigning.");
181 void AliModuleConstructionMessenger::SetNewValue(G4UIcommand* command,
184 // Applies command to the associated object.
187 if (command == fSetFrameCmd) {
188 fModuleConstruction->SetDetFrame(newValues);
190 else if (command == fListCmd) {
191 fModuleConstruction->ListAllLVTree();
193 else if (command == fListLongCmd) {
194 fModuleConstruction->ListAllLVTreeLong();
196 else if (command == fListDaughtersCmd) {
197 fModuleConstruction->ListLVTree(newValues);
199 else if (command == fListLongDaughtersCmd) {
200 fModuleConstruction->ListLVTreeLong(newValues);
202 #ifdef ALICE_VISUALIZE
203 if (command == fSetCurrentLVCmd) {
204 fCurrentVolume = fModuleConstruction->FindLogicalVolume(newValues);
206 else if (command == fSetDetVisibilityCmd) {
208 ->SetDetVisibility(fSetDetVisibilityCmd->GetNewBoolValue(newValues));
210 else if (command == fSetLVTreeVisibilityCmd) {
212 ->SetLVTreeVisibility(fCurrentVolume,
213 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
215 else if (command == fSetVolVisibilityCmd) {
217 ->SetVolumeVisibility(fCurrentVolume,
218 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
220 else if (command == fSetDetColourCmd) {
222 ->SetDetColour(newValues);
224 else if (command == fSetLVTreeColourCmd) {
226 ->SetLVTreeColour(fCurrentVolume, newValues);
228 else if (command == fSetVolColourCmd) {
230 ->SetVolumeColour(fCurrentVolume, newValues);
232 #endif //ALICE_VISUALIZE