]>
Commit | Line | Data |
---|---|---|
78976106 | 1 | #ifndef ROOT_guitest |
2 | #define ROOT_guitest | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
9549377e | 5 | |
6 | /* $Id$ */ | |
7 | ||
78976106 | 8 | #include <TROOT.h> |
9 | #include <TVirtualX.h> | |
10 | #include <TGListBox.h> | |
11 | #include <TGListTree.h> | |
12 | #include <TGClient.h> | |
13 | #include <TGFrame.h> | |
14 | #include <TGIcon.h> | |
15 | #include <TGLabel.h> | |
16 | #include <TGButton.h> | |
17 | #include <TGTextEntry.h> | |
18 | #include <TGMsgBox.h> | |
19 | #include <TGMenu.h> | |
20 | #include <TGCanvas.h> | |
21 | #include <TGComboBox.h> | |
22 | #include <TGTab.h> | |
23 | #include <TGSlider.h> | |
24 | #include <TGDoubleSlider.h> | |
25 | #include <TGFileDialog.h> | |
26 | #include <TRootEmbeddedCanvas.h> | |
27 | #include <TCanvas.h> | |
28 | #include <TH1.h> | |
29 | #include <TH2.h> | |
30 | #include <TClonesArray.h> | |
31 | #include <TGeant3.h> | |
32 | ||
33 | class AliGuiGeomDialog; | |
34 | class AliGUISliders; | |
35 | class AliGuiGeomMain; | |
36 | class AliDrawVolume; | |
03894ac7 | 37 | class AliGUIMaterial; |
38 | class AliGUIMedium; | |
78976106 | 39 | |
40 | ||
41 | class AliGeant3GeometryGUI : public TObject { | |
42 | private: | |
03894ac7 | 43 | AliGuiGeomMain *fPanel; // the main gui panel |
44 | Int_t fNstack; // number of volumes | |
45 | TClonesArray *fVolumes; // array of volumes | |
46 | Int_t fNMaterials; // number of materials and media | |
47 | TClonesArray *fMaterials; // array of materials | |
48 | TClonesArray *fMedia; // array of materials | |
49 | // Zebra bank related information | |
50 | Int_t* fZlq; | |
51 | Float_t* fZq; | |
52 | Int_t* fZiq; | |
78976106 | 53 | Gclink_t* fGclink; |
03894ac7 | 54 | Gcnum_t* fGcnum; |
78976106 | 55 | public: |
56 | AliGeant3GeometryGUI(); | |
03894ac7 | 57 | // Reads the zebra geometry tree and put it into the ListTree |
78976106 | 58 | void ReadGeometryTree(); |
03894ac7 | 59 | // Read material and media information and put it into ComboBox |
60 | void ReadMaterials(); | |
61 | Float_t Cut(Int_t idmed, Int_t icut); | |
78976106 | 62 | private: |
63 | virtual AliDrawVolume* Volume(Int_t id) | |
64 | {return (AliDrawVolume *) (fVolumes->UncheckedAt(id));} | |
03894ac7 | 65 | // Return number of children for volume idvol |
78976106 | 66 | Int_t NChildren(Int_t idvol); |
03894ac7 | 67 | // Return child number idc of volume idvol |
78976106 | 68 | Int_t Child(Int_t idvol, Int_t idc); |
03894ac7 | 69 | // Return medium number for given volume idvol |
70 | Int_t Medium(Int_t idvol); | |
71 | // Return material number for given volume idvol | |
72 | Int_t Material(Int_t idvol); | |
73 | // | |
74 | ||
75 | ||
78976106 | 76 | ClassDef(AliGeant3GeometryGUI,1) // GUI for Geant3 geometry visualisation |
77 | }; | |
78 | ||
79 | ||
80 | class AliGuiGeomMain : public TGMainFrame { | |
81 | ||
82 | private: | |
03894ac7 | 83 | TGTab *fTab; |
84 | TGCanvas *fCanvasWindow; | |
85 | TGCompositeFrame *fContainer, *fF2, *fF21, *fF3, *fF31, *fF4, *fF5; | |
86 | TGCompositeFrame *fF6, *fF61, *fF62, *fF63; | |
87 | TGListTree *fLt; | |
88 | TGMenuBar *fMenuBar; | |
89 | TGPopupMenu *fMenuFile, *fMenuTest, *fMenuHelp; | |
90 | TGLayoutHints *fMenuBarItemLayout, *fMenuBarHelpLayout, | |
91 | *fMenuBarLayout, fLTab; | |
92 | TGLayoutHints *fL2; | |
93 | AliGuiGeomDialog *fDialog; //! no output please | |
94 | TGComboBox *fMaterialCombo; | |
95 | TGComboBox *fMechanismCombo; | |
96 | TGComboBox *fMediaCombo, *fParticleCombo; | |
97 | TGListBox *fProcessLB, *fCutsLB; | |
98 | TClonesArray *fComboEntries; | |
99 | TClonesArray *fComboMediaEntries; | |
100 | TGHorizontalFrame *fHframe[6],*fHframeM[8]; | |
101 | TGTextBuffer *fTbh[6], *fTbhM[8], *fTbh61, *fTbh62, *fTbh63; | |
102 | TGTextEntry *fTeh[6], *fTehM[8], *fTeh61, *fTeh62, *fTeh63; | |
103 | TGLabel *fLabel[6], *fLabelM[8], *fSLabel61; | |
104 | TGTextButton *fPlotButton; | |
105 | Float_t fEmin; | |
106 | Float_t fEmax; | |
107 | Int_t fNbins; | |
108 | ||
109 | public: | |
110 | AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h); | |
111 | virtual ~AliGuiGeomMain(); | |
112 | // Destroy the main window | |
113 | virtual void CloseWindow(); | |
114 | // Add item to ListTree | |
115 | virtual TGListTreeItem * | |
116 | AddItem(TObject *, TGListTreeItem* , | |
117 | const char*, const TGPicture*, const TGPicture*); | |
118 | // Add Material to ComboBox | |
119 | virtual void AddMaterial(AliGUIMaterial *Material, Int_t i); | |
120 | // Add Medium to ComboBox | |
121 | virtual void AddMedium(AliGUIMedium *Medium, Int_t i); | |
122 | // Process messages from this window | |
123 | virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t); | |
124 | // Update widgets | |
125 | virtual void Update(); | |
126 | // Update ComboBoxes | |
127 | virtual void UpdateCombo(); | |
128 | virtual void UpdateListBox(); | |
129 | // Relate objects to ComboEntries | |
130 | // Currently ComboBox Entries are strings only, hence we need this construction | |
131 | virtual void SetComboEntries(TClonesArray *entries) {fComboEntries=entries;} | |
132 | virtual void SetMediaComboEntries(TClonesArray *entries) | |
133 | {fComboMediaEntries=entries;} | |
134 | virtual void Plot(); | |
135 | ClassDef(AliGuiGeomMain,1) // MainFrame for Geometry Browser | |
78976106 | 136 | }; |
137 | ||
138 | ||
139 | class AliGuiGeomDialog : public TGTransientFrame { | |
140 | ||
141 | private: | |
142 | AliGUISliders *fF1; | |
143 | TGCompositeFrame *fFrame1, *fF2, *fF3, *fF4; | |
144 | TGButton *fOkButton, *fCancelButton; | |
145 | TGButton *fChk1, *fChk2, *fChk3; | |
146 | TGComboBox *fCombo, *fCombo2; | |
147 | TGLabel *fLabel1, *fLabel2; | |
148 | TGTab *fTab; | |
149 | TGLayoutHints *fL1, *fL2, *fL3, *fL4, *fBly, *fBfly1; | |
150 | TGHorizontalFrame *fHSframe1, *fHSframe2, *fHSframe3; | |
151 | TGTextBuffer *fTbh11, *fTbh12, *fTbh21, *fTbh22, *fTbh31, *fTbh32; | |
152 | TGTextEntry *fTeh11, *fTeh12, *fTeh21, *fTeh22, *fTeh31, *fTeh32; | |
153 | TGDoubleHSlider *fDslider1, *fDslider2, *fDslider3; | |
154 | TGLabel *fSLabel1, *fSLabel2, *fSLabel3; | |
03894ac7 | 155 | |
78976106 | 156 | public: |
157 | AliGuiGeomDialog(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, | |
158 | UInt_t options = kMainFrame | kVerticalFrame); | |
159 | virtual ~AliGuiGeomDialog(); | |
03894ac7 | 160 | // Destroy this window |
78976106 | 161 | virtual void CloseWindow(); |
03894ac7 | 162 | // Process messages from this window |
78976106 | 163 | virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); |
03894ac7 | 164 | // Update widgets |
78976106 | 165 | virtual void Update(); |
78976106 | 166 | }; |
167 | ||
168 | class AliGUISliders : public TGCompositeFrame { | |
169 | ||
170 | private: | |
171 | // | |
172 | TGHorizontalFrame *fHframe[8]; | |
173 | TGLayoutHints *fBly, *fBfly1; | |
174 | TGHSlider *fHslider[8]; | |
175 | TGTextEntry *fTeh[8]; | |
176 | TGTextBuffer *fTbh[8]; | |
177 | TGLabel *fLabel[8]; | |
178 | Text_t fLabelText[8]; | |
179 | public: | |
180 | AliGUISliders(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h); | |
181 | virtual ~AliGUISliders(); | |
78976106 | 182 | virtual void CloseWindow(); |
183 | virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); | |
184 | virtual void Update(); | |
185 | ||
03894ac7 | 186 | // ClassDef(AliGUISliders,1) // Window containing sliders |
78976106 | 187 | }; |
188 | ||
189 | class AliDrawVolume : public TObject | |
190 | { | |
191 | public: | |
192 | AliDrawVolume(char* name); | |
193 | virtual ~AliDrawVolume(){;} | |
03894ac7 | 194 | // Draw the volume |
f70a166f | 195 | virtual void Draw(Option_t * =0); |
03894ac7 | 196 | // Draw volume specs |
78976106 | 197 | virtual void DrawSpec(); |
03894ac7 | 198 | // Return volume name |
78976106 | 199 | virtual char* Name(); |
03894ac7 | 200 | // Set volume parameter i |
201 | virtual void SetParam(Int_t i, Float_t); | |
202 | // Get volume parameters i | |
203 | virtual Float_t GetParam(Int_t i); | |
204 | // Set volume id | |
78976106 | 205 | virtual void SetIdVolume(Int_t id) {fIdVolume = id;} |
03894ac7 | 206 | // Set volume copy number |
207 | virtual void SetIdCopy(Int_t id) {fIdCopy = id;} | |
208 | // Set volume medium number | |
209 | virtual void SetIdMedium(Int_t id) {fIdMedium = id;} | |
210 | // Set volume material number | |
211 | virtual void SetIdMaterial(Int_t id) {fIdMaterial = id;} | |
212 | // Get volume id | |
78976106 | 213 | virtual Int_t GetIdVolume() {return fIdVolume;} |
03894ac7 | 214 | // Get copy number |
78976106 | 215 | virtual Int_t GetIdCopy() {return fIdCopy;} |
03894ac7 | 216 | // Get medium number |
217 | virtual Int_t Medium() {return fIdMedium;} | |
218 | // Get material number | |
219 | virtual Int_t Material() {return fIdMaterial;} | |
220 | // Increase copy number by one | |
78976106 | 221 | virtual void AddCopy() {fIdCopy ++;} |
03894ac7 | 222 | // Set link to ListTree Item |
78976106 | 223 | virtual void SetItem(TGListTreeItem *item) {fItem = item;} |
03894ac7 | 224 | // Get link to ListTree Item |
78976106 | 225 | virtual TGListTreeItem* GetItem() {return fItem;} |
226 | ||
227 | private: | |
228 | char* fName; // name of the volume | |
229 | Float_t fTheta; // theta-angle for drawing | |
230 | Float_t fPhi; // phi-angle for drawing | |
231 | Float_t fPsi; // psi-angle for drawing | |
232 | Float_t fU; // u-position | |
233 | Float_t fV; // v-position | |
234 | Float_t fUscale; // u-scaling factor | |
235 | Float_t fVscale; // v-scaling factor | |
236 | Bool_t fHide; // hide flag | |
237 | Bool_t fShadow; // shadow flag | |
238 | Int_t fFill; // fill option 1-6 | |
239 | Int_t fSeen; // seen option -2 - 1 | |
240 | Bool_t fClip; // clipping flag | |
241 | Float_t fClipXmin; // clip box range xmin | |
242 | Float_t fClipXmax; // clip box range xmax | |
243 | Float_t fClipYmin; // clip box range ymin | |
244 | Float_t fClipYmax; // clip box range ymax | |
245 | Float_t fClipZmin; // clip box range zmin | |
246 | Float_t fClipZmax; // clip box range zmax | |
247 | Int_t fIdVolume; // geant volume id | |
03894ac7 | 248 | Int_t fIdMedium; // geant medium id |
249 | Int_t fIdMaterial; // geant material id | |
78976106 | 250 | Int_t fIdCopy; // copy flag |
251 | TGListTreeItem *fItem; | |
252 | ClassDef(AliDrawVolume,1) // Volume Object for Drawing | |
253 | }; | |
03894ac7 | 254 | |
255 | ||
256 | class AliGUIMaterial : public TObject | |
257 | { | |
258 | public: | |
259 | AliGUIMaterial(); | |
260 | AliGUIMaterial(Int_t imat, char* name, Float_t a, Float_t z, | |
261 | Float_t dens, Float_t radl, Float_t absl); | |
262 | virtual ~AliGUIMaterial(){;} | |
263 | // Dump material parameters | |
264 | virtual void Dump(); | |
265 | // Get material id | |
266 | virtual Int_t Id(); | |
267 | // Get material name | |
268 | virtual char* Name(); | |
269 | // Get mass number | |
270 | virtual Float_t A(); | |
271 | // Get charge number | |
272 | virtual Float_t Z(); | |
273 | // Get density | |
274 | virtual Float_t Density(); | |
275 | // Get radiation length | |
276 | virtual Float_t RadiationLength(); | |
277 | // Get absorption lenth | |
278 | virtual Float_t AbsorptionLength(); | |
279 | // Plot | |
280 | virtual void Plot(); | |
281 | // Set and get link to widget entry | |
282 | virtual Int_t ItemId() {return fItem;} | |
283 | virtual void SetItemId(Int_t id) {fItem=id;} | |
284 | private: | |
285 | Int_t fId; // Id number of the material | |
286 | char* fName; // name of the material | |
287 | Float_t fA; // mass number of the material | |
288 | Float_t fZ; // charge number of the material | |
289 | Float_t fDensity; // density of the material | |
290 | Float_t fRadl; // radiation length of the material | |
291 | Float_t fAbsl; // absorption length | |
292 | // | |
293 | Int_t fItem; // Link to Widget Entry | |
294 | ClassDef(AliGUIMaterial,1) // Material Object for GUI | |
295 | }; | |
296 | ||
9994c013 | 297 | |
298 | const static Int_t kNPars=33; | |
299 | ||
03894ac7 | 300 | class AliGUIMedium : public TObject |
301 | { | |
302 | public: | |
303 | AliGUIMedium(); | |
304 | AliGUIMedium(Int_t imed, Int_t imat, char* name, Int_t isvol, Int_t ifield, | |
305 | Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, | |
306 | Float_t epsil, Float_t stmin); | |
307 | ||
308 | virtual ~AliGUIMedium(){;} | |
309 | // Dump medium parameters | |
310 | virtual void Dump(); | |
311 | // Get id | |
312 | virtual Int_t Id(); | |
313 | // Get name | |
314 | virtual char* Name(); | |
315 | // Get parameters | |
316 | virtual Int_t IdMat() {return fIdMat;} | |
317 | virtual Int_t Isvol() {return fIsvol;} | |
318 | virtual Int_t Ifield() {return fIfield;} | |
319 | virtual Float_t Fieldm() {return fFieldm;} | |
320 | virtual Float_t Tmaxfd() {return fTmaxfd;} | |
321 | virtual Float_t Stemax() {return fStemax;} | |
322 | virtual Float_t Deemax() {return fDeemax;} | |
323 | virtual Float_t Epsil() {return fEpsil;} | |
324 | virtual Float_t Stmin() {return fStmin;} | |
325 | virtual void SetPar(Int_t ipar, Float_t par) {fPars[ipar-1]=par;} | |
326 | virtual Float_t GetPar(Int_t ipar); | |
327 | // Set and get link to widget entry | |
328 | virtual Int_t ItemId() {return fItem;} | |
329 | virtual void SetItemId(Int_t id) {fItem=id;} | |
330 | ||
331 | private: | |
9994c013 | 332 | Float_t fPars[kNPars]; // special medium parameters |
03894ac7 | 333 | Int_t fId; // Id number of the Medium |
334 | Int_t fIdMat; // Associated material | |
335 | char* fName; // Name of the Medium | |
336 | Int_t fIsvol; // Sensitivity flag | |
337 | Int_t fIfield; // Magnetic Field Flag | |
338 | Float_t fFieldm; // Maximum Field Strength | |
339 | Float_t fTmaxfd; // Max. Ang. Deviation | |
340 | Float_t fStemax; // Maximum Step | |
341 | Float_t fDeemax; // Max. Frac. Energy Loss", | |
342 | Float_t fEpsil; // Crossing Precission | |
343 | Float_t fStmin; // Minimum Step Size | |
344 | // | |
345 | Int_t fItem; // Link to Widget Entry | |
346 | ClassDef(AliGUIMedium,1) // Tracking Medium Object for GUI | |
347 | }; | |
348 | ||
78976106 | 349 | #endif |
350 | ||
351 | ||
352 | ||
353 | ||
354 | ||
355 | ||
356 | ||
03894ac7 | 357 |