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.3 2001/07/17 09:50:21 morsch
19 Index on media and material arrays corrected
21 Revision 1.2 2001/07/09 11:46:08 morsch
22 Conversion code moved to AliG3toRoot
24 Revision 1.1 2000/07/13 16:19:10 fca
25 Mainly coding conventions + some small bug fixes
27 Revision 1.8 2000/07/12 08:56:32 fca
28 Coding convention correction and warning removal
30 Revision 1.7 2000/06/28 21:27:45 morsch
31 Most coding rule violations corrected.
32 Still to do: Split the file (on file per class) ? Avoid the global variables.
33 Copy constructors and assignment operators (dummy ?)
35 Revision 1.6 2000/04/14 11:07:46 morsch
36 Correct volume to medium assignment in case several media are asigned to the
39 Revision 1.5 2000/03/20 15:11:03 fca
40 Mods to make the code compile on HP
42 Revision 1.4 2000/01/18 16:12:08 morsch
43 Bug in calculation of number of volume divisions and number of positionings corrected
44 Browser for Material and Media properties added
46 Revision 1.3 1999/11/14 14:31:14 fca
47 Correct small error and remove compilation warnings on HP
49 Revision 1.2 1999/11/10 16:53:35 fca
50 The new geometry viewer from A.Morsch
56 * Written by Andreas Morsch
60 * For questions critics and suggestions to this part of the code
61 * contact andreas.morsch@cern.ch
63 **************************************************************************/
71 #include <TGTextBuffer.h>
72 #include <TGTextEntry.h>
78 #include <TApplication.h>
79 #include <TGFileDialog.h>
80 #include <TGListTree.h>
83 #include <TGeometry.h>
85 #include <TGeometry.h>
90 #include "AliGuiGeomMain.h"
91 #include "AliGuiGeomDialog.h"
92 #include "AliG3Volume.h"
93 #include "AliG3Medium.h"
95 #include "AliG3Material.h"
99 ClassImp(AliGuiGeomMain)
101 static Int_t gCurrentParticle = 1;
102 static Int_t gCurrentProcess = 1;
104 const Text_t* kLabelTextP[19] =
105 {"PAIR ", "COMP ", "PHOT ", "PFIS ", "DRAY ", "ANNI ", "BREM ",
106 "HADR ", "MUNU ", "DCAY ", "LOSS ", "MULS ", "GHCOR1", "BIRK1 ",
107 "BIRK2 ", "BIRK3 ", "LABS ", "SYNC ", "STRA "};
110 const Text_t* kLabelTextC[10] =
111 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
112 "DCUTE ", "DCUTM ", "PPCUTM"};
114 const Text_t* kLabelTextPart[24] =
115 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-",
116 "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton",
117 "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
118 "Xi0", "Xi-", "Omega-"};
120 const Text_t* kLabelTextMechanism[24] =
121 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
122 "HADG", "INEG", "ELAG", "FISG", "CAPG",
123 "LOSS", "PHOT", "ANNI", "COMP", "BREM",
124 "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
125 "MUNU", "RANG", "STEP", "MUON"};
130 enum ETestCommandIdentifiers {
155 Int_t mbButtonId[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
156 kMBRetry, kMBIgnore, kMBCancel,
157 kMBClose, kMBDismiss };
159 EMsgBoxIcon mbIcon[4] = { kMBIconStop, kMBIconQuestion,
160 kMBIconExclamation, kMBIconAsterisk };
162 const char *kFileTypes[] = { "All files", "*",
163 "ROOT files", "*.root",
164 "ROOT macros", "*.C",
170 TGListTreeItem* AliGuiGeomMain::
171 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
173 // Add item to the list tree
174 return fLt->AddItem(parent, name, obj, open, closed);
177 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
178 : TGMainFrame(p, w, h)
180 // Create test main frame. A TGMainFrame is a top level window.
181 // Create menubar and popup menus. The hint objects are used to place
182 // and group the different menu widgets with respect to eachother.
185 fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
187 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
188 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
190 fMenuFile = new TGPopupMenu(gClient->GetRoot());
191 fMenuFile->AddEntry("&Open...", kFileOpen);
192 fMenuFile->AddEntry("&Save", kFileSave);
193 fMenuFile->AddEntry("S&ave as...", kFileSaveAs);
194 fMenuFile->AddEntry("&Close", -1);
195 fMenuFile->AddSeparator();
196 fMenuFile->AddEntry("E&xit", kFileExit);
198 fMenuFile->DisableEntry(kFileSaveAs);
199 fMenuFile->DisableEntry(kFileOpen);
200 fMenuFile->DisableEntry(kFileSave);
204 fMenuTest = new TGPopupMenu(this);
205 fMenuTest->AddLabel("Draw");
206 fMenuTest->AddSeparator();
207 fMenuTest->AddEntry("&Volume Draw Control", kTestDlg);
208 fMenuTest->AddSeparator();
209 fMenuTest->Associate(this);
212 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
213 fMenuHelp->AddEntry("&Contents", kHelpContents);
214 fMenuHelp->AddEntry("&Search...", kHelpSearch);
215 fMenuHelp->AddSeparator();
216 fMenuHelp->AddEntry("&About", kHelpAbout);
218 fMenuFile->DisableEntry(kHelpContents);
219 fMenuFile->DisableEntry(kHelpSearch);
220 fMenuFile->DisableEntry(kHelpAbout);
221 // Menu button messages are handled by the main frame (i.e. "this")
222 // ProcessMessage() method.
223 fMenuFile->Associate(this);
224 fMenuTest->Associate(this);
225 fMenuHelp->Associate(this);
227 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
228 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
229 fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
230 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
232 AddFrame(fMenuBar, fMenuBarLayout);
237 fTab = new TGTab(this, 400, 400);
238 TGCompositeFrame *tf = fTab->AddTab("Volumes");
239 TGLayoutHints *lTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
240 kLHintsExpandY, 2, 2, 5, 1);
241 AddFrame(fTab, lTab);
243 // Create TGCanvas and a canvas container which uses a tile layout manager
244 fCanvasWindow = new TGCanvas(tf, 400, 240);
246 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
248 fLt->Associate(this);
249 fCanvasWindow->SetContainer(fLt);
252 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
253 tf->AddFrame(fCanvasWindow, lo);
257 tf = fTab->AddTab("Materials");
258 fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
259 fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
260 // ComboBox for materials
261 fMaterialCombo = new TGComboBox(fF2, 1);
262 fF2->AddFrame(fMaterialCombo, fL2);
264 // text labels with material properties
266 Text_t* labelText[6] =
272 "Absorption Length"};
275 new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
276 TGLayoutHints* bFly1 =
277 new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
278 fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
279 fF2->AddFrame(fF21,fL2);
280 { //Begin local scope for i
281 for (Int_t i=0; i<6; i++) {
283 fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
284 fF21->AddFrame(fHframe[i], bly);
285 fTbh[i] = new TGTextBuffer(10);
286 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
287 fTeh[i]->Associate(this);
288 fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
289 fHframe[i]->AddFrame(fLabel[i], bFly1);
290 fHframe[i]->AddFrame(fTeh[i], bFly1);
292 } //End local scope for i
293 tf->AddFrame(fF2, fL2);
294 fMaterialCombo->Resize(200, 20);
295 fMaterialCombo->Associate(this);
300 tf = fTab->AddTab("Media");
301 fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
302 // ComboBox for tracking media
303 fMediaCombo = new TGComboBox(fF3, 2);
304 fF3->AddFrame(fMediaCombo, fL2);
306 // text labels with material properties
308 Text_t* labelTextM[8] =
309 {"Sensitivity Flag ",
310 "Magnetic Field Flag ",
312 "Max. Ang. Deviation ",
314 "Max. Frac. Energy Loss",
315 "Crossing Precission ",
316 "Minimum Step Size "};
318 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
319 fF3->AddFrame(fF31,fL2);
320 { //Begin local scope for i
321 for (Int_t i=0; i<8; i++) {
323 fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
324 fF31->AddFrame(fHframeM[i], bly);
325 fTbhM[i] = new TGTextBuffer(10);
326 fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
327 fTehM[i]->Associate(this);
328 fLabelM[i] = new TGLabel(fHframeM[i], labelTextM[i]);
329 fHframeM[i]->AddFrame(fLabelM[i], bFly1);
330 fHframeM[i]->AddFrame(fTehM[i], bFly1);
332 } //End local scope for i
333 tf->AddFrame(fF3, fL2);
334 fMediaCombo->Resize(200, 20);
335 fMediaCombo->Associate(this);
338 tf = fTab->AddTab("Processes");
339 fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
340 fProcessLB = new TGListBox(fF4, 1);
341 fF4->AddFrame(fProcessLB, fL2);
342 tf->AddFrame(fF4, fL2);
343 fProcessLB->Resize(150, 350);
344 fProcessLB->Associate(this);
348 tf = fTab->AddTab("Cuts");
349 fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
350 fCutsLB = new TGListBox(fF5, 1);
351 fF5->AddFrame(fCutsLB, fL2);
352 tf->AddFrame(fF5, fL2);
353 fCutsLB->Resize(150, 350);
356 // de/dx and cross-sections
357 tf = fTab->AddTab("DE/DX and X-Sections");
358 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
360 // ComboBox for particles
361 fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
362 fF6->AddFrame(fF61, fL2);
363 fParticleCombo = new TGComboBox(fF61, 3);
364 fF61->AddFrame(fParticleCombo, fL2);
365 { //Begin local scope for i
366 for (Int_t i = 0; i < 24; i++) {
368 sprintf(tmp, "%s", kLabelTextPart[i]);
369 fParticleCombo->AddEntry(tmp, i+1);
371 } //End local scope for i
372 fParticleCombo->Select(1);
373 fParticleCombo->Resize(100, 20);
374 fParticleCombo->Associate(this);
376 // ComboBox for mechanisms
377 fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
378 fF6->AddFrame(fF63, fL2);
379 fMechanismCombo = new TGComboBox(fF63, 4);
380 fF63->AddFrame(fMechanismCombo, fL2);
381 { //Begin local scope for i
382 for (Int_t i = 0; i < 24; i++) {
384 sprintf(tmp, "%s", kLabelTextMechanism[i]);
385 fMechanismCombo->AddEntry(tmp, i+1);
387 } //End local scope for i
388 fMechanismCombo->Select(1);
389 fMechanismCombo->Resize(100, 20);
390 fMechanismCombo->Associate(this);
395 fTbh61 = new TGTextBuffer(10);
396 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
397 fTbh61->AddText(0, " 100");
398 fTeh61->Associate(this);
400 fTbh62 = new TGTextBuffer(10);
401 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
402 fTbh62->AddText(0, "0.001");
403 fTeh62->Associate(this);
405 fTbh63 = new TGTextBuffer(10);
406 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
407 fTbh63->AddText(0, "10.");
408 fTeh63->Associate(this);
414 fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
415 bFly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
416 fF61->AddFrame(fSLabel61, bFly1);
417 fF61->AddFrame(fTeh61, bFly1);
418 fF61->AddFrame(fTeh62, bFly1);
419 fF61->AddFrame(fTeh63, bFly1);
422 fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
423 fF6->AddFrame(fF62, fL2);
424 fPlotButton = new TGTextButton(fF62, "Plot", 1);
425 fPlotButton -> Associate(this);
426 fF62->AddFrame(fPlotButton);
428 tf->AddFrame(fF6, fL2);
429 // Window name and final mapping
431 SetWindowName("AliRoot Geometry Browser");
433 // We need to use GetDefault...() to initialize the layout algorithm...
434 Resize(GetDefaultSize());
438 AliGuiGeomMain::~AliGuiGeomMain()
440 // Delete all created widgets.
442 delete fCanvasWindow;
444 delete fMenuBarLayout;
445 delete fMenuBarItemLayout;
446 delete fMenuBarHelpLayout;
453 void AliGuiGeomMain::Streamer(TBuffer &)
459 void AliGuiGeomMain::Plot()
461 // plot de/dx or cross-sections
462 const Float_t kAvo=0.60221367;
463 Float_t *tkin = new Float_t[fNbins];
464 Float_t *value = new Float_t[fNbins];
465 Float_t *pcut = new Float_t[fNbins];
467 Int_t imate = gCurrentMaterial->Id();
468 Float_t z = gCurrentMaterial->GetZ();
469 Float_t a = gCurrentMaterial->GetA();
470 Float_t density = gCurrentMaterial->GetDensity();
472 Int_t ipart=gCurrentParticle;
473 const char *kChMeca= kLabelTextMechanism[gCurrentProcess-1];
476 strncpy(tmp, kChMeca, 4);
479 Float_t de=(fEmax-fEmin)/fNbins;
480 { //Begin local scope for i
481 for (Int_t i=0; i<kdim; i++) {
482 tkin[i]=fEmin+Float_t(i)*de;
485 } //End local scope for i
486 if (kChMeca!="MUON") {
487 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
489 for (Int_t i=0; i<kdim; i++) {
490 Float_t ekin=tkin[i];
491 value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
492 value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
493 value[i]*=1000.*kAvo*density/a;
498 TGraph *graph = new TGraph(kdim,tkin,value);
499 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
503 graph->SetFillColor(42);
504 graph->SetMarkerColor(4);
505 graph->SetMarkerStyle(21);
507 graph->GetHistogram()->SetXTitle("Energy (GeV)");
508 if (kChMeca == "RANG" || kChMeca == "STEP") {
509 graph->GetHistogram()->SetYTitle
511 } else if (kChMeca == "LOSS" || kChMeca == "MUON") {
512 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
514 graph->GetHistogram()->SetYTitle
515 ("Macroscopic X-Section (1/cm)");
526 void AliGuiGeomMain::Update()
533 Int_t imat=gCurrentVolume->Material();
534 Int_t nmat=fComboMaterialEntries->GetEntriesFast();
536 for (i=0; i<nmat; i++) {
537 gCurrentMaterial = (AliG3Material*)
538 (fComboMaterialEntries->UncheckedAt(i));
539 if ((gCurrentMaterial->Id())==imat) break;
541 Int_t imed = gCurrentVolume->Medium();
542 Int_t nmed=fComboMediaEntries->GetEntriesFast();
543 for (i=0; i<nmed; i++) {
544 gCurrentMedium = (AliG3Medium*)
545 (fComboMediaEntries->UncheckedAt(i));
546 if (gCurrentMedium->Id()==imed) break;
554 void AliGuiGeomMain::UpdateCombo()
558 Int_t imat = gCurrentMaterial->Id();
559 Float_t a = gCurrentMaterial->GetA();
560 Float_t z = gCurrentMaterial->GetZ();
561 Float_t dens = gCurrentMaterial->GetDensity();
562 Float_t radl = gCurrentMaterial->GetRadLength();
563 Float_t absl = gCurrentMaterial->GetInterLength();
564 Int_t entry = gCurrentMaterial->GetNumber();
567 fMaterialCombo->Select(entry);
568 fMediaCombo->Select(entry);
571 sprintf(buf, "%10i", imat);
573 fTbh[0]->AddText(0, buf);
574 gClient->NeedRedraw(fTeh[0]);
575 sprintf(buf, "%10.2e", a);
577 fTbh[1]->AddText(0, buf);
578 gClient->NeedRedraw(fTeh[1]);
580 sprintf(buf, "%10.2e", z);
582 fTbh[2]->AddText(0, buf);
583 gClient->NeedRedraw(fTeh[2]);
585 sprintf(buf, "%10.2e", dens);
587 fTbh[3]->AddText(0, buf);
588 gClient->NeedRedraw(fTeh[3]);
590 sprintf(buf, "%10.2e", radl);
592 fTbh[4]->AddText(0, buf);
593 gClient->NeedRedraw(fTeh[4]);
595 sprintf(buf, "%10.2e", absl);
597 fTbh[5]->AddText(0, buf);
598 gClient->NeedRedraw(fTeh[5]);
601 sprintf(buf, "%10i", gCurrentMedium->Isvol());
603 fTbhM[0]->AddText(0, buf);
604 gClient->NeedRedraw(fTehM[0]);
607 sprintf(buf, "%10i", gCurrentMedium->Ifield());
609 fTbhM[1]->AddText(0, buf);
610 gClient->NeedRedraw(fTehM[1]);
612 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
614 fTbhM[2]->AddText(0, buf);
615 gClient->NeedRedraw(fTehM[2]);
617 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
619 fTbhM[3]->AddText(0, buf);
620 gClient->NeedRedraw(fTehM[3]);
622 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
624 fTbhM[4]->AddText(0, buf);
625 gClient->NeedRedraw(fTehM[4]);
627 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
629 fTbhM[5]->AddText(0, buf);
630 gClient->NeedRedraw(fTehM[5]);
632 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
634 fTbhM[6]->AddText(0, buf);
635 gClient->NeedRedraw(fTehM[6]);
637 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
639 fTbhM[7]->AddText(0, buf);
640 gClient->NeedRedraw(fTehM[7]);
643 void AliGuiGeomMain::UpdateListBox()
645 // Update the list box
647 fProcessLB->RemoveEntries(1,19);
648 for (i=11; i < 30; i++) {
649 Float_t p=gCurrentMedium->GetPar(i);
651 sprintf(tmp, "%6s%5d", kLabelTextP[i-11], Int_t(p));
652 fProcessLB->AddEntry(tmp, i-10);
654 fProcessLB->MapSubwindows();
655 fProcessLB->Layout();
657 fCutsLB->RemoveEntries(1,10);
658 for (i=1; i < 11; i++) {
659 Float_t p=gCurrentMedium->GetPar(i);
661 sprintf(tmp, "%6s%10.3e", kLabelTextC[i-1], p);
662 fCutsLB->AddEntry(tmp,i);
664 fCutsLB->MapSubwindows();
669 void AliGuiGeomMain::CloseWindow()
671 // Got close message for this MainFrame. Calls parent CloseWindow()
672 // (which destroys the window) and terminate the application.
673 // The close message is generated by the window manager when its close
674 // window menu item is selected.
676 TGMainFrame::CloseWindow();
677 gApplication->Terminate(0);
680 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
682 // Process messages to widgets
683 switch (GET_MSG(msg)) {
685 // Text entries for binning of cross-section plots
687 switch (GET_SUBMSG(msg)) {
688 case kTE_TEXTCHANGED:
691 fNbins=(Int_t) atof(fTbh61->GetString());
694 fEmin= atof(fTbh62->GetString());
697 fEmax= atof(fTbh63->GetString());
703 // ListTree for volumes
705 switch (GET_SUBMSG(msg)) {
707 // Handle mouse click
710 // Button 1: Select volume
711 if (parm1 == kButton1) {
712 TGListTreeItem *item;
713 if ((item = fLt->GetSelected()))
715 gCurrentVolume=((AliG3Volume *) item->GetUserData());
720 // Button 2: Draw volume specifications
722 if (parm1 == kButton2) {
723 TGListTreeItem *item;
724 if ((item = fLt->GetSelected()))
727 ((AliG3Volume *) item->GetUserData())->DrawSpec();
729 gCurrentVolume=((AliG3Volume *) item->GetUserData());
734 // Button 3: Draw Volume
735 if (parm1 == kButton3) {
736 TGListTreeItem *item;
737 if ((item = fLt->GetSelected()))
739 ((AliG3Volume *) item->GetUserData())->Draw();
740 gCurrentVolume=((AliG3Volume *) item->GetUserData());
747 case kCT_ITEMDBLCLICK:
748 if (parm1 == kButton1) {
749 if (fLt->GetSelected() != 0) {
750 gClient->NeedRedraw(fLt);
759 switch (GET_SUBMSG(msg)) {
769 // Combo box bindings
774 gCurrentMaterial=(AliG3Material*)
775 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
776 gCurrentMedium=(AliG3Medium*)
777 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
784 gCurrentMedium=(AliG3Medium*)
785 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
786 gCurrentMaterial=(AliG3Material*)
787 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
794 gCurrentParticle=Int_t(parm2);
799 gCurrentProcess=Int_t(parm2);
810 printf("kFileOpen not yet implemented \n");
815 fDialog = new AliGuiGeomDialog
816 (gClient->GetRoot(), this, 400, 200);
820 printf("kFileSave not yet implemented \n");
824 // printf("kFileExit not yet implemented \n");
825 CloseWindow(); // this also terminates theApp
839 void AliGuiGeomMain::AddMaterial(AliG3Material *Material, Int_t i)
841 // Add material to material combo
843 tmp=Material->GetName();
846 strncpy(mName, tmp, 20);
849 // Material->SetItemId(i);
850 fMaterialCombo->AddEntry(mName, i);
851 fMaterialCombo->Select(i);
852 fMaterialCombo->Resize(200, 20);
855 void AliGuiGeomMain::AddMedium(AliG3Medium *Medium, Int_t i)
857 // Add medium to medium combo
859 tmp=Medium->GetName();
861 strncpy(mName, tmp, 20);
863 Medium->SetItemId(i);
864 fMediaCombo->AddEntry(mName, i);
865 fMediaCombo->Select(i);
866 fMediaCombo->Resize(200, 20);
869 void AliGuiGeomMain::SetMaterialComboEntries(TClonesArray *entries)
871 // Set the material combo entries
873 fComboMaterialEntries = entries;
874 Int_t nent = fComboMaterialEntries->GetEntriesFast();
875 for (Int_t i=0; i < nent; i++)
877 AddMaterial((AliG3Material*)fComboMaterialEntries->At(i), i);
878 gCurrentMaterial = (AliG3Material*)fComboMaterialEntries->At(i);
883 void AliGuiGeomMain::SetMediaComboEntries(TClonesArray *entries)
885 // Set the media combo entries
887 fComboMediaEntries = entries;
888 Int_t nent = fComboMediaEntries->GetEntriesFast();
889 for (Int_t i=0; i < nent; i++)
891 AddMedium((AliG3Medium*)fComboMediaEntries->At(i), i);
892 gCurrentMedium = (AliG3Medium*)fComboMediaEntries->At(i);
896 void AliGuiGeomMain::AddFoldersRecursively(TFolder* folder, TGListTreeItem* parent)
898 // Display geometry represented by TFolders in List Tree
900 const TGPicture* kFolder = gClient->GetPicture("folder_t.xpm");
901 const TGPicture* kOpenFolder = gClient->GetPicture("ofolder_t.xpm");
902 const TGPicture* kDocument = gClient->GetPicture("doc_t.xpm");
904 AliG3Volume* volume = ((AliG3Volume *) folder->FindObject(folder->GetName()));
905 volume->SetItem(folder);
907 TList* folders = (TList*) folder->GetListOfFolders();
910 TGListTreeItem* nParent = 0;
911 if (folders->GetSize() > 1) {
912 nParent = fLt->AddItem(parent, folder->GetName(), volume, kOpenFolder, kFolder);
914 nParent = fLt->AddItem(parent, folder->GetName(), volume, kDocument, kDocument);
917 while ((obj = next()))
919 if ((AliG3Volume*) obj == volume) continue;
920 TFolder* item = (TFolder*) obj;
921 AddFoldersRecursively(item, nParent);