4 // Author: I. Hrivnacova
6 // Class AliLVTreeMessenger
7 // ------------------------------------
8 // See the class description in the header file.
10 #include "AliLVTreeMessenger.h"
11 #include "AliLVTree.h"
12 #include "AliGlobals.h"
14 #include "AliColourStore.h"
17 #include "TG4GeometryServices.h"
19 #include <G4UIdirectory.hh>
20 #include <G4UIcmdWithABool.hh>
21 #include <G4UIcmdWithAString.hh>
22 #include <G4UIcmdWithoutParameter.hh>
24 //_____________________________________________________________________________
25 AliLVTreeMessenger::AliLVTreeMessenger(AliLVTree* lvTree)
30 G4String dirName = "/aliTree/";
31 fDirectory = new G4UIdirectory(dirName);
32 fDirectory->SetGuidance("LV tree control commands.");
34 G4String commandPath = dirName + "setVolume";
35 fSetCurrentLVCmd = new G4UIcmdWithAString(commandPath, this);
36 fSetCurrentLVCmd->SetGuidance("Set the current logical volume.");
37 fSetCurrentLVCmd->SetParameterName("curVolume", false);
38 fSetCurrentLVCmd->AvailableForStates(PreInit,Idle);
40 commandPath = dirName + "list";
41 fListCmd = new G4UIcmdWithoutParameter(commandPath, this);
42 G4String guidance = "List LV tree of the current volume. ";
43 fListCmd->SetGuidance(guidance);
44 fListCmd->AvailableForStates(PreInit,Idle);
46 commandPath = dirName + "listLong";
47 fListLongCmd = new G4UIcmdWithoutParameter(commandPath, this);
48 guidance = "List LV tree of the current volume \n";
49 guidance = guidance + "including number of its daughters.";
50 fListLongCmd->SetGuidance(guidance);
51 fListLongCmd->AvailableForStates(PreInit,Idle);
54 commandPath = dirName + "setLVTreeVisibility";
55 fSetLVTreeVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
56 fSetLVTreeVisibilityCmd
57 ->SetGuidance("Make current volume tree visible/invisible.");
58 fSetLVTreeVisibilityCmd->SetParameterName("lvtreeVisibility", false);
59 fSetLVTreeVisibilityCmd->AvailableForStates(PreInit,Idle);
61 commandPath = dirName + "setVolVisibility";
62 fSetVolVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
64 ->SetGuidance("Make current volume visible/invisible.");
65 fSetVolVisibilityCmd->SetParameterName("volVisibility", false);
66 fSetVolVisibilityCmd->AvailableForStates(PreInit,Idle);
68 commandPath = dirName + "setLVTreeColour";
69 fSetLVTreeColourCmd = new G4UIcmdWithAString(commandPath, this);
70 fSetLVTreeColourCmd->SetGuidance("Set colour for the current volume tree.");
71 fSetLVTreeColourCmd->SetGuidance("Available colours:");
72 guidance = AliColourStore::Instance()->GetColoursListWithCommas();
73 fSetLVTreeColourCmd->SetGuidance(guidance);
74 fSetLVTreeColourCmd->SetParameterName("lvtreeColour", false);
75 G4String candidatesList = AliColourStore::Instance()->GetColoursList();
76 fSetLVTreeColourCmd->SetCandidates(candidatesList);
77 fSetLVTreeColourCmd->AvailableForStates(PreInit,Idle);
79 commandPath = dirName + "setVolColour";
80 fSetVolColourCmd = new G4UIcmdWithAString(commandPath, this);
81 fSetVolColourCmd->SetGuidance("Set colour for the current volume.");
82 fSetVolColourCmd->SetGuidance("Available colours:");
83 guidance = AliColourStore::Instance()->GetColoursListWithCommas();
84 fSetVolColourCmd->SetGuidance(guidance);
85 fSetVolColourCmd->SetParameterName("volColour", false);
86 candidatesList = AliColourStore::Instance()->GetColoursList();
87 fSetVolColourCmd->SetCandidates(candidatesList);
88 fSetVolColourCmd->AvailableForStates(PreInit,Idle);
92 //_____________________________________________________________________________
93 AliLVTreeMessenger::AliLVTreeMessenger() {
97 //_____________________________________________________________________________
98 AliLVTreeMessenger::AliLVTreeMessenger(const AliLVTreeMessenger& right)
101 AliGlobals::Exception(
102 "AliLVTreeMessenger is protected from copying.");
105 //_____________________________________________________________________________
106 AliLVTreeMessenger::~AliLVTreeMessenger()
110 delete fSetCurrentLVCmd;
114 delete fSetLVTreeVisibilityCmd;
115 delete fSetVolVisibilityCmd;
116 delete fSetLVTreeColourCmd;
117 delete fSetVolColourCmd;
123 //_____________________________________________________________________________
125 AliLVTreeMessenger::operator=(const AliLVTreeMessenger& right)
127 // check assignement to self
128 if (this == &right) return *this;
130 AliGlobals::Exception(
131 "AliLVTreeMessenger is protected from assigning.");
138 //_____________________________________________________________________________
139 void AliLVTreeMessenger::SetNewValue(G4UIcommand* command,
142 // Applies command to the associated object.
145 G4String dirName = "/aliTree/";
146 fDirectory = new G4UIdirectory(dirName);
147 G4String guidance = "LV tree control commands ";
148 fDirectory->SetGuidance(guidance);
150 if (command == fSetCurrentLVCmd) {
152 = TG4GeometryServices::Instance()->FindLogicalVolume(newValues);
154 else if (command == fListCmd) {
155 fLVTree->List(fCurrentVolume);
157 else if (command == fListLongCmd) {
158 fLVTree->ListLong(fCurrentVolume);
161 if (command == fSetLVTreeVisibilityCmd) {
163 ->SetLVTreeVisibility(fCurrentVolume,
164 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
166 else if (command == fSetVolVisibilityCmd) {
168 ->SetVolumeVisibility(fCurrentVolume,
169 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
171 else if (command == fSetLVTreeColourCmd) {
173 ->SetLVTreeColour(fCurrentVolume, newValues);
175 else if (command == fSetVolColourCmd) {
177 ->SetVolumeColour(fCurrentVolume, newValues);