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.2 2001/07/09 11:46:08 morsch
19 Conversion code moved to AliG3toRoot
21 Revision 1.1 2000/07/13 16:19:10 fca
22 Mainly coding conventions + some small bug fixes
24 Revision 1.8 2000/07/12 08:56:32 fca
25 Coding convention correction and warning removal
27 Revision 1.7 2000/06/28 21:27:45 morsch
28 Most coding rule violations corrected.
29 Still to do: Split the file (on file per class) ? Avoid the global variables.
30 Copy constructors and assignment operators (dummy ?)
32 Revision 1.6 2000/04/14 11:07:46 morsch
33 Correct volume to medium assignment in case several media are asigned to the
36 Revision 1.5 2000/03/20 15:11:03 fca
37 Mods to make the code compile on HP
39 Revision 1.4 2000/01/18 16:12:08 morsch
40 Bug in calculation of number of volume divisions and number of positionings corrected
41 Browser for Material and Media properties added
43 Revision 1.3 1999/11/14 14:31:14 fca
44 Correct small error and remove compilation warnings on HP
46 Revision 1.2 1999/11/10 16:53:35 fca
47 The new geometry viewer from A.Morsch
53 * Written by Andreas Morsch
57 * For questions critics and suggestions to this part of the code
58 * contact andreas.morsch@cern.ch
60 **************************************************************************/
68 #include <TGTextBuffer.h>
69 #include <TGTextEntry.h>
75 #include <TApplication.h>
76 #include <TGFileDialog.h>
77 #include <TGListTree.h>
80 #include <TGeometry.h>
82 #include <TGeometry.h>
87 #include "AliGuiGeomMain.h"
88 #include "AliGuiGeomDialog.h"
89 #include "AliG3Volume.h"
90 #include "AliG3Medium.h"
92 #include "AliG3Material.h"
96 ClassImp(AliGuiGeomMain)
98 static Int_t gCurrentParticle = 1;
99 static Int_t gCurrentProcess = 1;
101 const Text_t* kLabelTextP[19] =
102 {"PAIR ", "COMP ", "PHOT ", "PFIS ", "DRAY ", "ANNI ", "BREM ",
103 "HADR ", "MUNU ", "DCAY ", "LOSS ", "MULS ", "GHCOR1", "BIRK1 ",
104 "BIRK2 ", "BIRK3 ", "LABS ", "SYNC ", "STRA "};
107 const Text_t* kLabelTextC[10] =
108 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
109 "DCUTE ", "DCUTM ", "PPCUTM"};
111 const Text_t* kLabelTextPart[24] =
112 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-",
113 "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton",
114 "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
115 "Xi0", "Xi-", "Omega-"};
117 const Text_t* kLabelTextMechanism[24] =
118 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
119 "HADG", "INEG", "ELAG", "FISG", "CAPG",
120 "LOSS", "PHOT", "ANNI", "COMP", "BREM",
121 "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
122 "MUNU", "RANG", "STEP", "MUON"};
127 enum ETestCommandIdentifiers {
152 Int_t mbButtonId[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
153 kMBRetry, kMBIgnore, kMBCancel,
154 kMBClose, kMBDismiss };
156 EMsgBoxIcon mbIcon[4] = { kMBIconStop, kMBIconQuestion,
157 kMBIconExclamation, kMBIconAsterisk };
159 const char *kFileTypes[] = { "All files", "*",
160 "ROOT files", "*.root",
161 "ROOT macros", "*.C",
167 TGListTreeItem* AliGuiGeomMain::
168 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
170 // Add item to the list tree
171 return fLt->AddItem(parent, name, obj, open, closed);
174 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
175 : TGMainFrame(p, w, h)
177 // Create test main frame. A TGMainFrame is a top level window.
178 // Create menubar and popup menus. The hint objects are used to place
179 // and group the different menu widgets with respect to eachother.
182 fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
184 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
185 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
187 fMenuFile = new TGPopupMenu(gClient->GetRoot());
188 fMenuFile->AddEntry("&Open...", kFileOpen);
189 fMenuFile->AddEntry("&Save", kFileSave);
190 fMenuFile->AddEntry("S&ave as...", kFileSaveAs);
191 fMenuFile->AddEntry("&Close", -1);
192 fMenuFile->AddSeparator();
193 fMenuFile->AddEntry("E&xit", kFileExit);
195 fMenuFile->DisableEntry(kFileSaveAs);
196 fMenuFile->DisableEntry(kFileOpen);
197 fMenuFile->DisableEntry(kFileSave);
201 fMenuTest = new TGPopupMenu(this);
202 fMenuTest->AddLabel("Draw");
203 fMenuTest->AddSeparator();
204 fMenuTest->AddEntry("&Volume Draw Control", kTestDlg);
205 fMenuTest->AddSeparator();
206 fMenuTest->Associate(this);
209 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
210 fMenuHelp->AddEntry("&Contents", kHelpContents);
211 fMenuHelp->AddEntry("&Search...", kHelpSearch);
212 fMenuHelp->AddSeparator();
213 fMenuHelp->AddEntry("&About", kHelpAbout);
215 fMenuFile->DisableEntry(kHelpContents);
216 fMenuFile->DisableEntry(kHelpSearch);
217 fMenuFile->DisableEntry(kHelpAbout);
218 // Menu button messages are handled by the main frame (i.e. "this")
219 // ProcessMessage() method.
220 fMenuFile->Associate(this);
221 fMenuTest->Associate(this);
222 fMenuHelp->Associate(this);
224 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
225 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
226 fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
227 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
229 AddFrame(fMenuBar, fMenuBarLayout);
234 fTab = new TGTab(this, 400, 400);
235 TGCompositeFrame *tf = fTab->AddTab("Volumes");
236 TGLayoutHints *lTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
237 kLHintsExpandY, 2, 2, 5, 1);
238 AddFrame(fTab, lTab);
240 // Create TGCanvas and a canvas container which uses a tile layout manager
241 fCanvasWindow = new TGCanvas(tf, 400, 240);
243 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
245 fLt->Associate(this);
246 fCanvasWindow->SetContainer(fLt);
249 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
250 tf->AddFrame(fCanvasWindow, lo);
254 tf = fTab->AddTab("Materials");
255 fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
256 fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
257 // ComboBox for materials
258 fMaterialCombo = new TGComboBox(fF2, 1);
259 fF2->AddFrame(fMaterialCombo, fL2);
261 // text labels with material properties
263 Text_t* labelText[6] =
269 "Absorption Length"};
272 new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
273 TGLayoutHints* bFly1 =
274 new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
275 fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
276 fF2->AddFrame(fF21,fL2);
277 { //Begin local scope for i
278 for (Int_t i=0; i<6; i++) {
280 fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
281 fF21->AddFrame(fHframe[i], bly);
282 fTbh[i] = new TGTextBuffer(10);
283 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
284 fTeh[i]->Associate(this);
285 fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
286 fHframe[i]->AddFrame(fLabel[i], bFly1);
287 fHframe[i]->AddFrame(fTeh[i], bFly1);
289 } //End local scope for i
290 tf->AddFrame(fF2, fL2);
291 fMaterialCombo->Resize(200, 20);
292 fMaterialCombo->Associate(this);
297 tf = fTab->AddTab("Media");
298 fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
299 // ComboBox for tracking media
300 fMediaCombo = new TGComboBox(fF3, 2);
301 fF3->AddFrame(fMediaCombo, fL2);
303 // text labels with material properties
305 Text_t* labelTextM[8] =
306 {"Sensitivity Flag ",
307 "Magnetic Field Flag ",
309 "Max. Ang. Deviation ",
311 "Max. Frac. Energy Loss",
312 "Crossing Precission ",
313 "Minimum Step Size "};
315 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
316 fF3->AddFrame(fF31,fL2);
317 { //Begin local scope for i
318 for (Int_t i=0; i<8; i++) {
320 fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
321 fF31->AddFrame(fHframeM[i], bly);
322 fTbhM[i] = new TGTextBuffer(10);
323 fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
324 fTehM[i]->Associate(this);
325 fLabelM[i] = new TGLabel(fHframeM[i], labelTextM[i]);
326 fHframeM[i]->AddFrame(fLabelM[i], bFly1);
327 fHframeM[i]->AddFrame(fTehM[i], bFly1);
329 } //End local scope for i
330 tf->AddFrame(fF3, fL2);
331 fMediaCombo->Resize(200, 20);
332 fMediaCombo->Associate(this);
335 tf = fTab->AddTab("Processes");
336 fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
337 fProcessLB = new TGListBox(fF4, 1);
338 fF4->AddFrame(fProcessLB, fL2);
339 tf->AddFrame(fF4, fL2);
340 fProcessLB->Resize(150, 350);
341 fProcessLB->Associate(this);
345 tf = fTab->AddTab("Cuts");
346 fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
347 fCutsLB = new TGListBox(fF5, 1);
348 fF5->AddFrame(fCutsLB, fL2);
349 tf->AddFrame(fF5, fL2);
350 fCutsLB->Resize(150, 350);
353 // de/dx and cross-sections
354 tf = fTab->AddTab("DE/DX and X-Sections");
355 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
357 // ComboBox for particles
358 fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
359 fF6->AddFrame(fF61, fL2);
360 fParticleCombo = new TGComboBox(fF61, 3);
361 fF61->AddFrame(fParticleCombo, fL2);
362 { //Begin local scope for i
363 for (Int_t i = 0; i < 24; i++) {
365 sprintf(tmp, "%s", kLabelTextPart[i]);
366 fParticleCombo->AddEntry(tmp, i+1);
368 } //End local scope for i
369 fParticleCombo->Select(1);
370 fParticleCombo->Resize(100, 20);
371 fParticleCombo->Associate(this);
373 // ComboBox for mechanisms
374 fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
375 fF6->AddFrame(fF63, fL2);
376 fMechanismCombo = new TGComboBox(fF63, 4);
377 fF63->AddFrame(fMechanismCombo, fL2);
378 { //Begin local scope for i
379 for (Int_t i = 0; i < 24; i++) {
381 sprintf(tmp, "%s", kLabelTextMechanism[i]);
382 fMechanismCombo->AddEntry(tmp, i+1);
384 } //End local scope for i
385 fMechanismCombo->Select(1);
386 fMechanismCombo->Resize(100, 20);
387 fMechanismCombo->Associate(this);
392 fTbh61 = new TGTextBuffer(10);
393 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
394 fTbh61->AddText(0, " 100");
395 fTeh61->Associate(this);
397 fTbh62 = new TGTextBuffer(10);
398 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
399 fTbh62->AddText(0, "0.001");
400 fTeh62->Associate(this);
402 fTbh63 = new TGTextBuffer(10);
403 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
404 fTbh63->AddText(0, "10.");
405 fTeh63->Associate(this);
411 fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
412 bFly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
413 fF61->AddFrame(fSLabel61, bFly1);
414 fF61->AddFrame(fTeh61, bFly1);
415 fF61->AddFrame(fTeh62, bFly1);
416 fF61->AddFrame(fTeh63, bFly1);
419 fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
420 fF6->AddFrame(fF62, fL2);
421 fPlotButton = new TGTextButton(fF62, "Plot", 1);
422 fPlotButton -> Associate(this);
423 fF62->AddFrame(fPlotButton);
425 tf->AddFrame(fF6, fL2);
426 // Window name and final mapping
428 SetWindowName("AliRoot Geometry Browser");
430 // We need to use GetDefault...() to initialize the layout algorithm...
431 Resize(GetDefaultSize());
435 AliGuiGeomMain::~AliGuiGeomMain()
437 // Delete all created widgets.
439 delete fCanvasWindow;
441 delete fMenuBarLayout;
442 delete fMenuBarItemLayout;
443 delete fMenuBarHelpLayout;
450 void AliGuiGeomMain::Streamer(TBuffer &)
456 void AliGuiGeomMain::Plot()
458 // plot de/dx or cross-sections
459 const Float_t kAvo=0.60221367;
460 Float_t *tkin = new Float_t[fNbins];
461 Float_t *value = new Float_t[fNbins];
462 Float_t *pcut = new Float_t[fNbins];
464 Int_t imate = gCurrentMaterial->Id();
465 Float_t z = gCurrentMaterial->GetZ();
466 Float_t a = gCurrentMaterial->GetA();
467 Float_t density = gCurrentMaterial->GetDensity();
469 Int_t ipart=gCurrentParticle;
470 const char *kChMeca= kLabelTextMechanism[gCurrentProcess-1];
473 strncpy(tmp, kChMeca, 4);
476 Float_t de=(fEmax-fEmin)/fNbins;
477 { //Begin local scope for i
478 for (Int_t i=0; i<kdim; i++) {
479 tkin[i]=fEmin+Float_t(i)*de;
482 } //End local scope for i
483 if (kChMeca!="MUON") {
484 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
486 for (Int_t i=0; i<kdim; i++) {
487 Float_t ekin=tkin[i];
488 value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
489 value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
490 value[i]*=1000.*kAvo*density/a;
495 TGraph *graph = new TGraph(kdim,tkin,value);
496 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
500 graph->SetFillColor(42);
501 graph->SetMarkerColor(4);
502 graph->SetMarkerStyle(21);
504 graph->GetHistogram()->SetXTitle("Energy (GeV)");
505 if (kChMeca == "RANG" || kChMeca == "STEP") {
506 graph->GetHistogram()->SetYTitle
508 } else if (kChMeca == "LOSS" || kChMeca == "MUON") {
509 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
511 graph->GetHistogram()->SetYTitle
512 ("Macroscopic X-Section (1/cm)");
523 void AliGuiGeomMain::Update()
530 Int_t imat=gCurrentVolume->Material();
531 Int_t nmat=fComboMaterialEntries->GetEntriesFast();
533 for (i=0; i<nmat; i++) {
534 gCurrentMaterial = (AliG3Material*)
535 (fComboMaterialEntries->UncheckedAt(i));
536 if ((gCurrentMaterial->Id())==imat) break;
538 Int_t imed = gCurrentVolume->Medium();
539 Int_t nmed=fComboMediaEntries->GetEntriesFast();
540 for (i=0; i<nmed; i++) {
541 gCurrentMedium = (AliG3Medium*)
542 (fComboMediaEntries->UncheckedAt(i));
543 if (gCurrentMedium->Id()==imed) break;
551 void AliGuiGeomMain::UpdateCombo()
555 Int_t imat = gCurrentMaterial->Id();
556 Float_t a = gCurrentMaterial->GetA();
557 Float_t z = gCurrentMaterial->GetZ();
558 Float_t dens = gCurrentMaterial->GetDensity();
559 Float_t radl = gCurrentMaterial->GetRadLength();
560 Float_t absl = gCurrentMaterial->GetInterLength();
561 Int_t entry = gCurrentMaterial->GetNumber();
564 fMaterialCombo->Select(entry);
565 fMediaCombo->Select(entry);
568 sprintf(buf, "%10i", imat);
570 fTbh[0]->AddText(0, buf);
571 gClient->NeedRedraw(fTeh[0]);
572 sprintf(buf, "%10.2e", a);
574 fTbh[1]->AddText(0, buf);
575 gClient->NeedRedraw(fTeh[1]);
577 sprintf(buf, "%10.2e", z);
579 fTbh[2]->AddText(0, buf);
580 gClient->NeedRedraw(fTeh[2]);
582 sprintf(buf, "%10.2e", dens);
584 fTbh[3]->AddText(0, buf);
585 gClient->NeedRedraw(fTeh[3]);
587 sprintf(buf, "%10.2e", radl);
589 fTbh[4]->AddText(0, buf);
590 gClient->NeedRedraw(fTeh[4]);
592 sprintf(buf, "%10.2e", absl);
594 fTbh[5]->AddText(0, buf);
595 gClient->NeedRedraw(fTeh[5]);
598 sprintf(buf, "%10i", gCurrentMedium->Isvol());
600 fTbhM[0]->AddText(0, buf);
601 gClient->NeedRedraw(fTehM[0]);
604 sprintf(buf, "%10i", gCurrentMedium->Ifield());
606 fTbhM[1]->AddText(0, buf);
607 gClient->NeedRedraw(fTehM[1]);
609 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
611 fTbhM[2]->AddText(0, buf);
612 gClient->NeedRedraw(fTehM[2]);
614 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
616 fTbhM[3]->AddText(0, buf);
617 gClient->NeedRedraw(fTehM[3]);
619 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
621 fTbhM[4]->AddText(0, buf);
622 gClient->NeedRedraw(fTehM[4]);
624 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
626 fTbhM[5]->AddText(0, buf);
627 gClient->NeedRedraw(fTehM[5]);
629 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
631 fTbhM[6]->AddText(0, buf);
632 gClient->NeedRedraw(fTehM[6]);
634 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
636 fTbhM[7]->AddText(0, buf);
637 gClient->NeedRedraw(fTehM[7]);
640 void AliGuiGeomMain::UpdateListBox()
642 // Update the list box
644 fProcessLB->RemoveEntries(1,19);
645 for (i=11; i < 30; i++) {
646 Float_t p=gCurrentMedium->GetPar(i);
648 sprintf(tmp, "%6s%5d", kLabelTextP[i-11], Int_t(p));
649 fProcessLB->AddEntry(tmp, i-10);
651 fProcessLB->MapSubwindows();
652 fProcessLB->Layout();
654 fCutsLB->RemoveEntries(1,10);
655 for (i=1; i < 11; i++) {
656 Float_t p=gCurrentMedium->GetPar(i);
658 sprintf(tmp, "%6s%10.3e", kLabelTextC[i-1], p);
659 fCutsLB->AddEntry(tmp,i);
661 fCutsLB->MapSubwindows();
666 void AliGuiGeomMain::CloseWindow()
668 // Got close message for this MainFrame. Calls parent CloseWindow()
669 // (which destroys the window) and terminate the application.
670 // The close message is generated by the window manager when its close
671 // window menu item is selected.
673 TGMainFrame::CloseWindow();
674 gApplication->Terminate(0);
677 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
679 // Process messages to widgets
680 switch (GET_MSG(msg)) {
682 // Text entries for binning of cross-section plots
684 switch (GET_SUBMSG(msg)) {
685 case kTE_TEXTCHANGED:
688 fNbins=(Int_t) atof(fTbh61->GetString());
691 fEmin= atof(fTbh62->GetString());
694 fEmax= atof(fTbh63->GetString());
700 // ListTree for volumes
702 switch (GET_SUBMSG(msg)) {
704 // Handle mouse click
707 // Button 1: Select volume
708 if (parm1 == kButton1) {
709 TGListTreeItem *item;
710 if ((item = fLt->GetSelected()))
712 gCurrentVolume=((AliG3Volume *) item->GetUserData());
717 // Button 2: Draw volume specifications
719 if (parm1 == kButton2) {
720 TGListTreeItem *item;
721 if ((item = fLt->GetSelected()))
724 ((AliG3Volume *) item->GetUserData())->DrawSpec();
726 gCurrentVolume=((AliG3Volume *) item->GetUserData());
731 // Button 3: Draw Volume
732 if (parm1 == kButton3) {
733 TGListTreeItem *item;
734 if ((item = fLt->GetSelected()))
736 ((AliG3Volume *) item->GetUserData())->Draw();
737 gCurrentVolume=((AliG3Volume *) item->GetUserData());
744 case kCT_ITEMDBLCLICK:
745 if (parm1 == kButton1) {
746 if (fLt->GetSelected() != 0) {
747 gClient->NeedRedraw(fLt);
756 switch (GET_SUBMSG(msg)) {
766 // Combo box bindings
771 gCurrentMaterial=(AliG3Material*)
772 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
773 gCurrentMedium=(AliG3Medium*)
774 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
781 gCurrentMedium=(AliG3Medium*)
782 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
783 gCurrentMaterial=(AliG3Material*)
784 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
791 gCurrentParticle=Int_t(parm2);
796 gCurrentProcess=Int_t(parm2);
809 fi.fFileTypes = (char **)kFileTypes;
810 new TGFileDialog(gClient->GetRoot(), this, kFDOpen,&fi);
815 fDialog = new AliGuiGeomDialog
816 (gClient->GetRoot(), this, 400, 200);
820 printf("kFileSave\n");
824 CloseWindow(); // this also terminates theApp
838 void AliGuiGeomMain::AddMaterial(AliG3Material *Material, Int_t i)
840 // Add material to material combo
842 tmp=Material->GetName();
845 strncpy(mName, tmp, 20);
848 // Material->SetItemId(i);
849 fMaterialCombo->AddEntry(mName, i);
850 fMaterialCombo->Select(i);
851 fMaterialCombo->Resize(200, 20);
854 void AliGuiGeomMain::AddMedium(AliG3Medium *Medium, Int_t i)
856 // Add medium to medium combo
858 tmp=Medium->GetName();
860 strncpy(mName, tmp, 20);
862 Medium->SetItemId(i);
863 fMediaCombo->AddEntry(mName, i);
864 fMediaCombo->Select(i);
865 fMediaCombo->Resize(200, 20);
868 void AliGuiGeomMain::SetMaterialComboEntries(TClonesArray *entries)
870 // Set the material combo entries
872 fComboMaterialEntries = entries;
873 Int_t nent = fComboMaterialEntries->GetEntriesFast();
874 for (Int_t i=0; i < nent; i++)
876 AddMaterial((AliG3Material*)fComboMaterialEntries->At(i), i);
877 gCurrentMaterial = (AliG3Material*)fComboMaterialEntries->At(i);
882 void AliGuiGeomMain::SetMediaComboEntries(TClonesArray *entries)
884 // Set the media combo entries
886 fComboMediaEntries = entries;
887 Int_t nent = fComboMediaEntries->GetEntriesFast();
888 for (Int_t i=0; i < nent; i++)
890 AddMedium((AliG3Medium*)fComboMediaEntries->At(i), i);
891 gCurrentMedium = (AliG3Medium*)fComboMediaEntries->At(i);
895 void AliGuiGeomMain::AddFoldersRecursively(TFolder* folder, TGListTreeItem* parent)
897 // Display geometry represented by TFolders in List Tree
899 const TGPicture* kFolder = gClient->GetPicture("folder_t.xpm");
900 const TGPicture* kOpenFolder = gClient->GetPicture("ofolder_t.xpm");
901 const TGPicture* kDocument = gClient->GetPicture("doc_t.xpm");
903 AliG3Volume* volume = ((AliG3Volume *) folder->FindObject(folder->GetName()));
904 volume->SetItem(folder);
906 TList* folders = (TList*) folder->GetListOfFolders();
909 TGListTreeItem* nParent = 0;
910 if (folders->GetSize() > 1) {
911 nParent = fLt->AddItem(parent, folder->GetName(), volume, kOpenFolder, kFolder);
913 nParent = fLt->AddItem(parent, folder->GetName(), volume, kDocument, kDocument);
916 while ((obj = next()))
918 if ((AliG3Volume*) obj == volume) continue;
919 TFolder* item = (TFolder*) obj;
920 AddFoldersRecursively(item, nParent);