]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliLVTreeMessenger.cxx
Functions renamed to get a prefix PHOS
[u/mrichter/AliRoot.git] / AliGeant4 / AliLVTreeMessenger.cxx
CommitLineData
2f310734 1// $Id$
2// Category: geometry
3//
4// Author: I. Hrivnacova
5//
6// Class AliLVTreeMessenger
7// ------------------------------------
8// See the class description in the header file.
9
10#include "AliLVTreeMessenger.h"
11#include "AliLVTree.h"
12#include "AliGlobals.h"
2b49a442 13#ifdef G4VIS_USE
2f310734 14#include "AliColourStore.h"
15#endif
16
17#include "TG4GeometryServices.h"
18
19#include <G4UIdirectory.hh>
20#include <G4UIcmdWithABool.hh>
21#include <G4UIcmdWithAString.hh>
22#include <G4UIcmdWithoutParameter.hh>
23
24//_____________________________________________________________________________
25AliLVTreeMessenger::AliLVTreeMessenger(AliLVTree* lvTree)
26 : fLVTree(lvTree),
27 fCurrentVolume(0)
28{
29//
30 G4String dirName = "/aliTree/";
31 fDirectory = new G4UIdirectory(dirName);
32 fDirectory->SetGuidance("LV tree control commands.");
33
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);
39
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);
45
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);
52
53#ifdef G4VIS_USE
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);
60
61 commandPath = dirName + "setVolVisibility";
62 fSetVolVisibilityCmd = new G4UIcmdWithABool(commandPath, this);
63 fSetVolVisibilityCmd
64 ->SetGuidance("Make current volume visible/invisible.");
65 fSetVolVisibilityCmd->SetParameterName("volVisibility", false);
66 fSetVolVisibilityCmd->AvailableForStates(PreInit,Idle);
67
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);
78
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);
89#endif //G4VIS_USE
90}
91
92//_____________________________________________________________________________
93AliLVTreeMessenger::AliLVTreeMessenger() {
94//
95}
96
97//_____________________________________________________________________________
98AliLVTreeMessenger::AliLVTreeMessenger(const AliLVTreeMessenger& right)
99{
100//
101 AliGlobals::Exception(
102 "AliLVTreeMessenger is protected from copying.");
103}
104
105//_____________________________________________________________________________
106AliLVTreeMessenger::~AliLVTreeMessenger()
107{
108//
109 delete fDirectory;
110 delete fSetCurrentLVCmd;
111 delete fListCmd;
112 delete fListLongCmd;
113#ifdef G4VIS_USE
114 delete fSetLVTreeVisibilityCmd;
115 delete fSetVolVisibilityCmd;
116 delete fSetLVTreeColourCmd;
117 delete fSetVolColourCmd;
118#endif //G4VIS_USE
119}
120
121// operators
122
123//_____________________________________________________________________________
124AliLVTreeMessenger&
125AliLVTreeMessenger::operator=(const AliLVTreeMessenger& right)
126{
127 // check assignement to self
128 if (this == &right) return *this;
129
130 AliGlobals::Exception(
131 "AliLVTreeMessenger is protected from assigning.");
132
133 return *this;
134}
135
136// public methods
137
138//_____________________________________________________________________________
139void AliLVTreeMessenger::SetNewValue(G4UIcommand* command,
140 G4String newValues)
141{
142// Applies command to the associated object.
143// ---
144
145 G4String dirName = "/aliTree/";
146 fDirectory = new G4UIdirectory(dirName);
147 G4String guidance = "LV tree control commands ";
148 fDirectory->SetGuidance(guidance);
149
150 if (command == fSetCurrentLVCmd) {
151 fCurrentVolume
152 = TG4GeometryServices::Instance()->FindLogicalVolume(newValues);
153 }
154 else if (command == fListCmd) {
155 fLVTree->List(fCurrentVolume);
156 }
157 else if (command == fListLongCmd) {
158 fLVTree->ListLong(fCurrentVolume);
159 }
160#ifdef G4VIS_USE
161 if (command == fSetLVTreeVisibilityCmd) {
162 fLVTree
163 ->SetLVTreeVisibility(fCurrentVolume,
164 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
165 }
166 else if (command == fSetVolVisibilityCmd) {
167 fLVTree
168 ->SetVolumeVisibility(fCurrentVolume,
169 fSetVolVisibilityCmd->GetNewBoolValue(newValues));
170 }
171 else if (command == fSetLVTreeColourCmd) {
172 fLVTree
173 ->SetLVTreeColour(fCurrentVolume, newValues);
174 }
175 else if (command == fSetVolColourCmd) {
176 fLVTree
177 ->SetVolumeColour(fCurrentVolume, newValues);
178 }
179#endif //G4VIS_USE
180}
181