1 /* *************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictlSy for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.4 2001/07/18 14:59:13 morsch
19 Unactive code in dialog removed (caused compiling problems with ROOT 3.01/06)
21 Revision 1.3 2001/07/17 09:50:21 morsch
22 Index on media and material arrays corrected
24 Revision 1.2 2001/07/09 11:46:08 morsch
25 Conversion code moved to AliG3toRoot
27 Revision 1.1 2000/07/13 16:19:10 fca
28 Mainly coding conventions + some small bug fixes
30 Revision 1.8 2000/07/12 08:56:32 fca
31 Coding convention correction and warning removal
33 Revision 1.7 2000/06/28 21:27:45 morsch
34 Most coding rule violations corrected.
35 Still to do: Split the file (on file per class) ? Avoid the global variables.
36 Copy constructors and assignment operators (dummy ?)
38 Revision 1.6 2000/04/14 11:07:46 morsch
39 Correct volume to medium assignment in case several media are asigned to the
42 Revision 1.5 2000/03/20 15:11:03 fca
43 Mods to make the code compile on HP
45 Revision 1.4 2000/01/18 16:12:08 morsch
46 Bug in calculation of number of volume divisions and number of positionings corrected
47 Browser for Material and Media properties added
49 Revision 1.3 1999/11/14 14:31:14 fca
50 Correct small error and remove compilation warnings on HP
52 Revision 1.2 1999/11/10 16:53:35 fca
53 The new geometry viewer from A.Morsch
59 * Written by Andreas Morsch
63 * For questions critics and suggestions to this part of the code
64 * contact andreas.morsch@cern.ch
66 **************************************************************************/
74 #include <TGTextBuffer.h>
75 #include <TGTextEntry.h>
81 #include <TApplication.h>
82 #include <TGFileDialog.h>
83 #include <TGListTree.h>
86 #include <TGeometry.h>
88 #include <TGeometry.h>
93 #include "AliGuiGeomMain.h"
94 #include "AliGuiGeomDialog.h"
95 #include "AliG3Volume.h"
96 #include "AliG3Medium.h"
97 #include "AliG3Material.h"
101 ClassImp(AliGuiGeomMain)
103 static Int_t gCurrentParticle = 1;
104 static Int_t gCurrentProcess = 1;
106 const Text_t* kLabelTextP[19] =
107 {"PAIR ", "COMP ", "PHOT ", "PFIS ", "DRAY ", "ANNI ", "BREM ",
108 "HADR ", "MUNU ", "DCAY ", "LOSS ", "MULS ", "GHCOR1", "BIRK1 ",
109 "BIRK2 ", "BIRK3 ", "LABS ", "SYNC ", "STRA "};
112 const Text_t* kLabelTextC[10] =
113 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
114 "DCUTE ", "DCUTM ", "PPCUTM"};
116 const Text_t* kLabelTextPart[24] =
117 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-",
118 "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton",
119 "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
120 "Xi0", "Xi-", "Omega-"};
122 const Text_t* kLabelTextMechanism[24] =
123 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
124 "HADG", "INEG", "ELAG", "FISG", "CAPG",
125 "LOSS", "PHOT", "ANNI", "COMP", "BREM",
126 "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
127 "MUNU", "RANG", "STEP", "MUON"};
132 enum ETestCommandIdentifiers {
157 Int_t mbButtonId[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
158 kMBRetry, kMBIgnore, kMBCancel,
159 kMBClose, kMBDismiss };
161 EMsgBoxIcon mbIcon[4] = { kMBIconStop, kMBIconQuestion,
162 kMBIconExclamation, kMBIconAsterisk };
164 const char *kFileTypes[] = { "All files", "*",
165 "ROOT files", "*.root",
166 "ROOT macros", "*.C",
172 TGListTreeItem* AliGuiGeomMain::
173 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
175 // Add item to the list tree
176 return fLt->AddItem(parent, name, obj, open, closed);
179 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
180 : TGMainFrame(p, w, h)
182 // Create test main frame. A TGMainFrame is a top level window.
183 // Create menubar and popup menus. The hint objects are used to place
184 // and group the different menu widgets with respect to eachother.
187 fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
189 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
190 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
192 fMenuFile = new TGPopupMenu(gClient->GetRoot());
193 fMenuFile->AddEntry("&Open...", kFileOpen);
194 fMenuFile->AddEntry("&Save", kFileSave);
195 fMenuFile->AddEntry("S&ave as...", kFileSaveAs);
196 fMenuFile->AddEntry("&Close", -1);
197 fMenuFile->AddSeparator();
198 fMenuFile->AddEntry("E&xit", kFileExit);
200 fMenuFile->DisableEntry(kFileSaveAs);
201 fMenuFile->DisableEntry(kFileOpen);
202 fMenuFile->DisableEntry(kFileSave);
206 fMenuTest = new TGPopupMenu(this);
207 fMenuTest->AddLabel("Draw");
208 fMenuTest->AddSeparator();
209 fMenuTest->AddEntry("&Volume Draw Control", kTestDlg);
210 fMenuTest->AddSeparator();
211 fMenuTest->Associate(this);
214 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
215 fMenuHelp->AddEntry("&Contents", kHelpContents);
216 fMenuHelp->AddEntry("&Search...", kHelpSearch);
217 fMenuHelp->AddSeparator();
218 fMenuHelp->AddEntry("&About", kHelpAbout);
220 fMenuFile->DisableEntry(kHelpContents);
221 fMenuFile->DisableEntry(kHelpSearch);
222 fMenuFile->DisableEntry(kHelpAbout);
223 // Menu button messages are handled by the main frame (i.e. "this")
224 // ProcessMessage() method.
225 fMenuFile->Associate(this);
226 fMenuTest->Associate(this);
227 fMenuHelp->Associate(this);
229 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
230 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
231 fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
232 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
234 AddFrame(fMenuBar, fMenuBarLayout);
239 fTab = new TGTab(this, 400, 400);
240 TGCompositeFrame *tf = fTab->AddTab("Volumes");
241 TGLayoutHints *lTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
242 kLHintsExpandY, 2, 2, 5, 1);
243 AddFrame(fTab, lTab);
245 // Create TGCanvas and a canvas container which uses a tile layout manager
246 fCanvasWindow = new TGCanvas(tf, 400, 240);
248 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
250 fLt->Associate(this);
251 fCanvasWindow->SetContainer(fLt);
254 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
255 tf->AddFrame(fCanvasWindow, lo);
259 tf = fTab->AddTab("Materials");
260 fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
261 fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
262 // ComboBox for materials
263 fMaterialCombo = new TGComboBox(fF2, 1);
264 fF2->AddFrame(fMaterialCombo, fL2);
266 // text labels with material properties
268 Text_t* labelText[6] =
274 "Absorption Length"};
277 new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
278 TGLayoutHints* bFly1 =
279 new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
280 fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
281 fF2->AddFrame(fF21,fL2);
282 { //Begin local scope for i
283 for (Int_t i=0; i<6; i++) {
285 fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
286 fF21->AddFrame(fHframe[i], bly);
287 fTbh[i] = new TGTextBuffer(10);
288 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
289 fTeh[i]->Associate(this);
290 fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
291 fHframe[i]->AddFrame(fLabel[i], bFly1);
292 fHframe[i]->AddFrame(fTeh[i], bFly1);
294 } //End local scope for i
295 tf->AddFrame(fF2, fL2);
296 fMaterialCombo->Resize(200, 20);
297 fMaterialCombo->Associate(this);
302 tf = fTab->AddTab("Media");
303 fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
304 // ComboBox for tracking media
305 fMediaCombo = new TGComboBox(fF3, 2);
306 fF3->AddFrame(fMediaCombo, fL2);
308 // text labels with material properties
310 Text_t* labelTextM[8] =
311 {"Sensitivity Flag ",
312 "Magnetic Field Flag ",
314 "Max. Ang. Deviation ",
316 "Max. Frac. Energy Loss",
317 "Crossing Precission ",
318 "Minimum Step Size "};
320 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
321 fF3->AddFrame(fF31,fL2);
322 { //Begin local scope for i
323 for (Int_t i=0; i<8; i++) {
325 fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
326 fF31->AddFrame(fHframeM[i], bly);
327 fTbhM[i] = new TGTextBuffer(10);
328 fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
329 fTehM[i]->Associate(this);
330 fLabelM[i] = new TGLabel(fHframeM[i], labelTextM[i]);
331 fHframeM[i]->AddFrame(fLabelM[i], bFly1);
332 fHframeM[i]->AddFrame(fTehM[i], bFly1);
334 } //End local scope for i
335 tf->AddFrame(fF3, fL2);
336 fMediaCombo->Resize(200, 20);
337 fMediaCombo->Associate(this);
340 tf = fTab->AddTab("Processes");
341 fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
342 fProcessLB = new TGListBox(fF4, 1);
343 fF4->AddFrame(fProcessLB, fL2);
344 tf->AddFrame(fF4, fL2);
345 fProcessLB->Resize(150, 350);
346 fProcessLB->Associate(this);
350 tf = fTab->AddTab("Cuts");
351 fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
352 fCutsLB = new TGListBox(fF5, 1);
353 fF5->AddFrame(fCutsLB, fL2);
354 tf->AddFrame(fF5, fL2);
355 fCutsLB->Resize(150, 350);
358 // de/dx and cross-sections
359 tf = fTab->AddTab("DE/DX and X-Sections");
360 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
362 // ComboBox for particles
363 fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
364 fF6->AddFrame(fF61, fL2);
365 fParticleCombo = new TGComboBox(fF61, 3);
366 fF61->AddFrame(fParticleCombo, fL2);
367 { //Begin local scope for i
368 for (Int_t i = 0; i < 24; i++) {
370 sprintf(tmp, "%s", kLabelTextPart[i]);
371 fParticleCombo->AddEntry(tmp, i+1);
373 } //End local scope for i
374 fParticleCombo->Select(1);
375 fParticleCombo->Resize(100, 20);
376 fParticleCombo->Associate(this);
378 // ComboBox for mechanisms
379 fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
380 fF6->AddFrame(fF63, fL2);
381 fMechanismCombo = new TGComboBox(fF63, 4);
382 fF63->AddFrame(fMechanismCombo, fL2);
383 { //Begin local scope for i
384 for (Int_t i = 0; i < 24; i++) {
386 sprintf(tmp, "%s", kLabelTextMechanism[i]);
387 fMechanismCombo->AddEntry(tmp, i+1);
389 } //End local scope for i
390 fMechanismCombo->Select(1);
391 fMechanismCombo->Resize(100, 20);
392 fMechanismCombo->Associate(this);
397 fTbh61 = new TGTextBuffer(10);
398 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
399 fTbh61->AddText(0, " 100");
400 fTeh61->Associate(this);
402 fTbh62 = new TGTextBuffer(10);
403 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
404 fTbh62->AddText(0, "0.001");
405 fTeh62->Associate(this);
407 fTbh63 = new TGTextBuffer(10);
408 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
409 fTbh63->AddText(0, "10.");
410 fTeh63->Associate(this);
416 fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
417 bFly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
418 fF61->AddFrame(fSLabel61, bFly1);
419 fF61->AddFrame(fTeh61, bFly1);
420 fF61->AddFrame(fTeh62, bFly1);
421 fF61->AddFrame(fTeh63, bFly1);
424 fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
425 fF6->AddFrame(fF62, fL2);
426 fPlotButton = new TGTextButton(fF62, "Plot", 1);
427 fPlotButton -> Associate(this);
428 fF62->AddFrame(fPlotButton);
430 tf->AddFrame(fF6, fL2);
431 // Window name and final mapping
433 SetWindowName("AliRoot Geometry Browser");
435 // We need to use GetDefault...() to initialize the layout algorithm...
436 Resize(GetDefaultSize());
440 AliGuiGeomMain::~AliGuiGeomMain()
442 // Delete all created widgets.
444 delete fCanvasWindow;
446 delete fMenuBarLayout;
447 delete fMenuBarItemLayout;
448 delete fMenuBarHelpLayout;
455 void AliGuiGeomMain::Streamer(TBuffer &)
461 void AliGuiGeomMain::Plot()
463 // plot de/dx or cross-sections
464 const Float_t kAvo=0.60221367;
465 Float_t *tkin = new Float_t[fNbins];
466 Float_t *value = new Float_t[fNbins];
467 Float_t *pcut = new Float_t[fNbins];
469 Int_t imate = gCurrentMaterial->Id();
470 Float_t z = gCurrentMaterial->GetZ();
471 Float_t a = gCurrentMaterial->GetA();
472 Float_t density = gCurrentMaterial->GetDensity();
474 Int_t ipart=gCurrentParticle;
475 const char *kChMeca= kLabelTextMechanism[gCurrentProcess-1];
478 strncpy(tmp, kChMeca, 4);
481 Float_t de=(fEmax-fEmin)/fNbins;
482 { //Begin local scope for i
483 for (Int_t i=0; i<kdim; i++) {
484 tkin[i]=fEmin+Float_t(i)*de;
487 } //End local scope for i
488 if (kChMeca!="MUON") {
489 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
491 for (Int_t i=0; i<kdim; i++) {
492 Float_t ekin=tkin[i];
493 value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
494 value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
495 value[i]*=1000.*kAvo*density/a;
500 TGraph *graph = new TGraph(kdim,tkin,value);
501 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
505 graph->SetFillColor(42);
506 graph->SetMarkerColor(4);
507 graph->SetMarkerStyle(21);
509 graph->GetHistogram()->SetXTitle("Energy (GeV)");
510 if (kChMeca == "RANG" || kChMeca == "STEP") {
511 graph->GetHistogram()->SetYTitle
513 } else if (kChMeca == "LOSS" || kChMeca == "MUON") {
514 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
516 graph->GetHistogram()->SetYTitle
517 ("Macroscopic X-Section (1/cm)");
528 void AliGuiGeomMain::Update()
535 Int_t imat=gCurrentVolume->Material();
536 Int_t nmat=fComboMaterialEntries->GetEntriesFast();
538 for (i=0; i<nmat; i++) {
539 gCurrentMaterial = (AliG3Material*)
540 (fComboMaterialEntries->UncheckedAt(i));
541 if ((gCurrentMaterial->Id())==imat) break;
543 Int_t imed = gCurrentVolume->Medium();
544 Int_t nmed=fComboMediaEntries->GetEntriesFast();
545 for (i=0; i<nmed; i++) {
546 gCurrentMedium = (AliG3Medium*)
547 (fComboMediaEntries->UncheckedAt(i));
548 if (gCurrentMedium->Id()==imed) break;
556 void AliGuiGeomMain::UpdateCombo()
560 Int_t imat = gCurrentMaterial->Id();
561 Float_t a = gCurrentMaterial->GetA();
562 Float_t z = gCurrentMaterial->GetZ();
563 Float_t dens = gCurrentMaterial->GetDensity();
564 Float_t radl = gCurrentMaterial->GetRadLength();
565 Float_t absl = gCurrentMaterial->GetInterLength();
566 Int_t entry = gCurrentMaterial->GetNumber();
569 fMaterialCombo->Select(entry);
570 fMediaCombo->Select(entry);
573 sprintf(buf, "%10i", imat);
575 fTbh[0]->AddText(0, buf);
576 gClient->NeedRedraw(fTeh[0]);
577 sprintf(buf, "%10.2e", a);
579 fTbh[1]->AddText(0, buf);
580 gClient->NeedRedraw(fTeh[1]);
582 sprintf(buf, "%10.2e", z);
584 fTbh[2]->AddText(0, buf);
585 gClient->NeedRedraw(fTeh[2]);
587 sprintf(buf, "%10.2e", dens);
589 fTbh[3]->AddText(0, buf);
590 gClient->NeedRedraw(fTeh[3]);
592 sprintf(buf, "%10.2e", radl);
594 fTbh[4]->AddText(0, buf);
595 gClient->NeedRedraw(fTeh[4]);
597 sprintf(buf, "%10.2e", absl);
599 fTbh[5]->AddText(0, buf);
600 gClient->NeedRedraw(fTeh[5]);
603 sprintf(buf, "%10i", gCurrentMedium->Isvol());
605 fTbhM[0]->AddText(0, buf);
606 gClient->NeedRedraw(fTehM[0]);
609 sprintf(buf, "%10i", gCurrentMedium->Ifield());
611 fTbhM[1]->AddText(0, buf);
612 gClient->NeedRedraw(fTehM[1]);
614 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
616 fTbhM[2]->AddText(0, buf);
617 gClient->NeedRedraw(fTehM[2]);
619 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
621 fTbhM[3]->AddText(0, buf);
622 gClient->NeedRedraw(fTehM[3]);
624 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
626 fTbhM[4]->AddText(0, buf);
627 gClient->NeedRedraw(fTehM[4]);
629 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
631 fTbhM[5]->AddText(0, buf);
632 gClient->NeedRedraw(fTehM[5]);
634 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
636 fTbhM[6]->AddText(0, buf);
637 gClient->NeedRedraw(fTehM[6]);
639 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
641 fTbhM[7]->AddText(0, buf);
642 gClient->NeedRedraw(fTehM[7]);
645 void AliGuiGeomMain::UpdateListBox()
647 // Update the list box
649 fProcessLB->RemoveEntries(1,19);
650 for (i=11; i < 30; i++) {
651 Float_t p=gCurrentMedium->GetPar(i);
653 sprintf(tmp, "%6s%5d", kLabelTextP[i-11], Int_t(p));
654 fProcessLB->AddEntry(tmp, i-10);
656 fProcessLB->MapSubwindows();
657 fProcessLB->Layout();
659 fCutsLB->RemoveEntries(1,10);
660 for (i=1; i < 11; i++) {
661 Float_t p=gCurrentMedium->GetPar(i);
663 sprintf(tmp, "%6s%10.3e", kLabelTextC[i-1], p);
664 fCutsLB->AddEntry(tmp,i);
666 fCutsLB->MapSubwindows();
671 void AliGuiGeomMain::CloseWindow()
673 // Got close message for this MainFrame. Calls parent CloseWindow()
674 // (which destroys the window) and terminate the application.
675 // The close message is generated by the window manager when its close
676 // window menu item is selected.
678 TGMainFrame::CloseWindow();
679 gApplication->Terminate(0);
682 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
684 // Process messages to widgets
685 switch (GET_MSG(msg)) {
687 // Text entries for binning of cross-section plots
689 switch (GET_SUBMSG(msg)) {
690 case kTE_TEXTCHANGED:
693 fNbins=(Int_t) atof(fTbh61->GetString());
696 fEmin= atof(fTbh62->GetString());
699 fEmax= atof(fTbh63->GetString());
705 // ListTree for volumes
707 switch (GET_SUBMSG(msg)) {
709 // Handle mouse click
712 // Button 1: Select volume
713 if (parm1 == kButton1) {
714 TGListTreeItem *item;
715 if ((item = fLt->GetSelected()))
717 gCurrentVolume=((AliG3Volume *) item->GetUserData());
722 // Button 2: Draw volume specifications
724 if (parm1 == kButton2) {
725 TGListTreeItem *item;
726 if ((item = fLt->GetSelected()))
729 ((AliG3Volume *) item->GetUserData())->DrawSpec();
731 gCurrentVolume=((AliG3Volume *) item->GetUserData());
736 // Button 3: Draw Volume
737 if (parm1 == kButton3) {
738 TGListTreeItem *item;
739 if ((item = fLt->GetSelected()))
741 ((AliG3Volume *) item->GetUserData())->Draw();
742 gCurrentVolume=((AliG3Volume *) item->GetUserData());
749 case kCT_ITEMDBLCLICK:
750 if (parm1 == kButton1) {
751 if (fLt->GetSelected() != 0) {
752 gClient->NeedRedraw(fLt);
761 switch (GET_SUBMSG(msg)) {
771 // Combo box bindings
776 gCurrentMaterial=(AliG3Material*)
777 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
778 gCurrentMedium=(AliG3Medium*)
779 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
786 gCurrentMedium=(AliG3Medium*)
787 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
788 gCurrentMaterial=(AliG3Material*)
789 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
796 gCurrentParticle=Int_t(parm2);
801 gCurrentProcess=Int_t(parm2);
812 printf("kFileOpen not yet implemented \n");
817 fDialog = new AliGuiGeomDialog
818 (gClient->GetRoot(), this, 400, 200);
822 printf("kFileSave not yet implemented \n");
826 // printf("kFileExit not yet implemented \n");
827 CloseWindow(); // this also terminates theApp
841 void AliGuiGeomMain::AddMaterial(AliG3Material *Material, Int_t i)
843 // Add material to material combo
845 tmp=Material->GetName();
848 strncpy(mName, tmp, 20);
851 // Material->SetItemId(i);
852 fMaterialCombo->AddEntry(mName, i);
853 fMaterialCombo->Select(i);
854 fMaterialCombo->Resize(200, 20);
857 void AliGuiGeomMain::AddMedium(AliG3Medium *Medium, Int_t i)
859 // Add medium to medium combo
861 tmp=Medium->GetName();
863 strncpy(mName, tmp, 20);
865 Medium->SetItemId(i);
866 fMediaCombo->AddEntry(mName, i);
867 fMediaCombo->Select(i);
868 fMediaCombo->Resize(200, 20);
871 void AliGuiGeomMain::SetMaterialComboEntries(TClonesArray *entries)
873 // Set the material combo entries
875 fComboMaterialEntries = entries;
876 Int_t nent = fComboMaterialEntries->GetEntriesFast();
877 for (Int_t i=0; i < nent; i++)
879 AddMaterial((AliG3Material*)fComboMaterialEntries->At(i), i);
880 gCurrentMaterial = (AliG3Material*)fComboMaterialEntries->At(i);
885 void AliGuiGeomMain::SetMediaComboEntries(TClonesArray *entries)
887 // Set the media combo entries
889 fComboMediaEntries = entries;
890 Int_t nent = fComboMediaEntries->GetEntriesFast();
891 for (Int_t i=0; i < nent; i++)
893 AddMedium((AliG3Medium*)fComboMediaEntries->At(i), i);
894 gCurrentMedium = (AliG3Medium*)fComboMediaEntries->At(i);
898 void AliGuiGeomMain::AddFoldersRecursively(TFolder* folder, TGListTreeItem* parent)
900 // Display geometry represented by TFolders in List Tree
902 const TGPicture* kFolder = gClient->GetPicture("folder_t.xpm");
903 const TGPicture* kOpenFolder = gClient->GetPicture("ofolder_t.xpm");
904 const TGPicture* kDocument = gClient->GetPicture("doc_t.xpm");
906 AliG3Volume* volume = ((AliG3Volume *) folder->FindObject(folder->GetName()));
907 volume->SetItem(folder);
909 TList* folders = (TList*) folder->GetListOfFolders();
912 TGListTreeItem* nParent = 0;
913 if (folders->GetSize() > 1) {
914 nParent = fLt->AddItem(parent, folder->GetName(), volume, kOpenFolder, kFolder);
916 nParent = fLt->AddItem(parent, folder->GetName(), volume, kDocument, kDocument);
919 while ((obj = next()))
921 if ((AliG3Volume*) obj == volume) continue;
922 TFolder* item = (TFolder*) obj;
923 AddFoldersRecursively(item, nParent);