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.5 2002/03/19 09:36:17 morsch
19 Unnecessary includes removes, one included. (Jacek M. Holeczek)
21 Revision 1.4 2001/07/18 14:59:13 morsch
22 Unactive code in dialog removed (caused compiling problems with ROOT 3.01/06)
24 Revision 1.3 2001/07/17 09:50:21 morsch
25 Index on media and material arrays corrected
27 Revision 1.2 2001/07/09 11:46:08 morsch
28 Conversion code moved to AliG3toRoot
30 Revision 1.1 2000/07/13 16:19:10 fca
31 Mainly coding conventions + some small bug fixes
33 Revision 1.8 2000/07/12 08:56:32 fca
34 Coding convention correction and warning removal
36 Revision 1.7 2000/06/28 21:27:45 morsch
37 Most coding rule violations corrected.
38 Still to do: Split the file (on file per class) ? Avoid the global variables.
39 Copy constructors and assignment operators (dummy ?)
41 Revision 1.6 2000/04/14 11:07:46 morsch
42 Correct volume to medium assignment in case several media are asigned to the
45 Revision 1.5 2000/03/20 15:11:03 fca
46 Mods to make the code compile on HP
48 Revision 1.4 2000/01/18 16:12:08 morsch
49 Bug in calculation of number of volume divisions and number of positionings corrected
50 Browser for Material and Media properties added
52 Revision 1.3 1999/11/14 14:31:14 fca
53 Correct small error and remove compilation warnings on HP
55 Revision 1.2 1999/11/10 16:53:35 fca
56 The new geometry viewer from A.Morsch
62 * Written by Andreas Morsch
66 * For questions critics and suggestions to this part of the code
67 * contact andreas.morsch@cern.ch
69 **************************************************************************/
77 #include <TGTextBuffer.h>
78 #include <TGTextEntry.h>
84 #include <TApplication.h>
85 #include <TGFileDialog.h>
86 #include <TGListTree.h>
89 #include <TGeometry.h>
91 #include <TGeometry.h>
96 #include "AliGuiGeomMain.h"
97 #include "AliGuiGeomDialog.h"
98 #include "AliG3Volume.h"
99 #include "AliG3Medium.h"
100 #include "AliG3Material.h"
104 ClassImp(AliGuiGeomMain)
106 static Int_t gCurrentParticle = 1;
107 static Int_t gCurrentProcess = 1;
109 const Text_t* kLabelTextP[19] =
110 {"PAIR ", "COMP ", "PHOT ", "PFIS ", "DRAY ", "ANNI ", "BREM ",
111 "HADR ", "MUNU ", "DCAY ", "LOSS ", "MULS ", "GHCOR1", "BIRK1 ",
112 "BIRK2 ", "BIRK3 ", "LABS ", "SYNC ", "STRA "};
115 const Text_t* kLabelTextC[10] =
116 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
117 "DCUTE ", "DCUTM ", "PPCUTM"};
119 const Text_t* kLabelTextPart[24] =
120 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-",
121 "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton",
122 "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
123 "Xi0", "Xi-", "Omega-"};
125 const Text_t* kLabelTextMechanism[24] =
126 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
127 "HADG", "INEG", "ELAG", "FISG", "CAPG",
128 "LOSS", "PHOT", "ANNI", "COMP", "BREM",
129 "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
130 "MUNU", "RANG", "STEP", "MUON"};
135 enum ETestCommandIdentifiers {
160 Int_t mbButtonId[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
161 kMBRetry, kMBIgnore, kMBCancel,
162 kMBClose, kMBDismiss };
164 EMsgBoxIcon mbIcon[4] = { kMBIconStop, kMBIconQuestion,
165 kMBIconExclamation, kMBIconAsterisk };
167 const char *kFileTypes[] = { "All files", "*",
168 "ROOT files", "*.root",
169 "ROOT macros", "*.C",
175 TGListTreeItem* AliGuiGeomMain::
176 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
178 // Add item to the list tree
179 return fLt->AddItem(parent, name, obj, open, closed);
182 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
183 : TGMainFrame(p, w, h)
185 // Create test main frame. A TGMainFrame is a top level window.
186 // Create menubar and popup menus. The hint objects are used to place
187 // and group the different menu widgets with respect to eachother.
190 fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
192 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
193 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
195 fMenuFile = new TGPopupMenu(gClient->GetRoot());
196 fMenuFile->AddEntry("&Open...", kFileOpen);
197 fMenuFile->AddEntry("&Save", kFileSave);
198 fMenuFile->AddEntry("S&ave as...", kFileSaveAs);
199 fMenuFile->AddEntry("&Close", -1);
200 fMenuFile->AddSeparator();
201 fMenuFile->AddEntry("E&xit", kFileExit);
203 fMenuFile->DisableEntry(kFileSaveAs);
204 fMenuFile->DisableEntry(kFileOpen);
205 fMenuFile->DisableEntry(kFileSave);
209 fMenuTest = new TGPopupMenu(this);
210 fMenuTest->AddLabel("Draw");
211 fMenuTest->AddSeparator();
212 fMenuTest->AddEntry("&Volume Draw Control", kTestDlg);
213 fMenuTest->AddSeparator();
214 fMenuTest->Associate(this);
217 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
218 fMenuHelp->AddEntry("&Contents", kHelpContents);
219 fMenuHelp->AddEntry("&Search...", kHelpSearch);
220 fMenuHelp->AddSeparator();
221 fMenuHelp->AddEntry("&About", kHelpAbout);
223 fMenuFile->DisableEntry(kHelpContents);
224 fMenuFile->DisableEntry(kHelpSearch);
225 fMenuFile->DisableEntry(kHelpAbout);
226 // Menu button messages are handled by the main frame (i.e. "this")
227 // ProcessMessage() method.
228 fMenuFile->Associate(this);
229 fMenuTest->Associate(this);
230 fMenuHelp->Associate(this);
232 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
233 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
234 fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
235 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
237 AddFrame(fMenuBar, fMenuBarLayout);
242 fTab = new TGTab(this, 400, 400);
243 TGCompositeFrame *tf = fTab->AddTab("Volumes");
244 TGLayoutHints *lTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
245 kLHintsExpandY, 2, 2, 5, 1);
246 AddFrame(fTab, lTab);
248 // Create TGCanvas and a canvas container which uses a tile layout manager
249 fCanvasWindow = new TGCanvas(tf, 400, 240);
251 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
253 fLt->Associate(this);
254 fCanvasWindow->SetContainer(fLt);
257 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
258 tf->AddFrame(fCanvasWindow, lo);
262 tf = fTab->AddTab("Materials");
263 fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
264 fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
265 // ComboBox for materials
266 fMaterialCombo = new TGComboBox(fF2, 1);
267 fF2->AddFrame(fMaterialCombo, fL2);
269 // text labels with material properties
271 Text_t* labelText[6] =
277 "Absorption Length"};
280 new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
281 TGLayoutHints* bFly1 =
282 new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
283 fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
284 fF2->AddFrame(fF21,fL2);
285 { //Begin local scope for i
286 for (Int_t i=0; i<6; i++) {
288 fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
289 fF21->AddFrame(fHframe[i], bly);
290 fTbh[i] = new TGTextBuffer(10);
291 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
292 fTeh[i]->Associate(this);
293 fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
294 fHframe[i]->AddFrame(fLabel[i], bFly1);
295 fHframe[i]->AddFrame(fTeh[i], bFly1);
297 } //End local scope for i
298 tf->AddFrame(fF2, fL2);
299 fMaterialCombo->Resize(200, 20);
300 fMaterialCombo->Associate(this);
305 tf = fTab->AddTab("Media");
306 fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
307 // ComboBox for tracking media
308 fMediaCombo = new TGComboBox(fF3, 2);
309 fF3->AddFrame(fMediaCombo, fL2);
311 // text labels with material properties
313 Text_t* labelTextM[8] =
314 {"Sensitivity Flag ",
315 "Magnetic Field Flag ",
317 "Max. Ang. Deviation ",
319 "Max. Frac. Energy Loss",
320 "Crossing Precission ",
321 "Minimum Step Size "};
323 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
324 fF3->AddFrame(fF31,fL2);
325 { //Begin local scope for i
326 for (Int_t i=0; i<8; i++) {
328 fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
329 fF31->AddFrame(fHframeM[i], bly);
330 fTbhM[i] = new TGTextBuffer(10);
331 fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
332 fTehM[i]->Associate(this);
333 fLabelM[i] = new TGLabel(fHframeM[i], labelTextM[i]);
334 fHframeM[i]->AddFrame(fLabelM[i], bFly1);
335 fHframeM[i]->AddFrame(fTehM[i], bFly1);
337 } //End local scope for i
338 tf->AddFrame(fF3, fL2);
339 fMediaCombo->Resize(200, 20);
340 fMediaCombo->Associate(this);
343 tf = fTab->AddTab("Processes");
344 fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
345 fProcessLB = new TGListBox(fF4, 1);
346 fF4->AddFrame(fProcessLB, fL2);
347 tf->AddFrame(fF4, fL2);
348 fProcessLB->Resize(150, 350);
349 fProcessLB->Associate(this);
353 tf = fTab->AddTab("Cuts");
354 fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
355 fCutsLB = new TGListBox(fF5, 1);
356 fF5->AddFrame(fCutsLB, fL2);
357 tf->AddFrame(fF5, fL2);
358 fCutsLB->Resize(150, 350);
361 // de/dx and cross-sections
362 tf = fTab->AddTab("DE/DX and X-Sections");
363 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
365 // ComboBox for particles
366 fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
367 fF6->AddFrame(fF61, fL2);
368 fParticleCombo = new TGComboBox(fF61, 3);
369 fF61->AddFrame(fParticleCombo, fL2);
370 { //Begin local scope for i
371 for (Int_t i = 0; i < 24; i++) {
373 sprintf(tmp, "%s", kLabelTextPart[i]);
374 fParticleCombo->AddEntry(tmp, i+1);
376 } //End local scope for i
377 fParticleCombo->Select(1);
378 fParticleCombo->Resize(100, 20);
379 fParticleCombo->Associate(this);
381 // ComboBox for mechanisms
382 fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
383 fF6->AddFrame(fF63, fL2);
384 fMechanismCombo = new TGComboBox(fF63, 4);
385 fF63->AddFrame(fMechanismCombo, fL2);
386 { //Begin local scope for i
387 for (Int_t i = 0; i < 24; i++) {
389 sprintf(tmp, "%s", kLabelTextMechanism[i]);
390 fMechanismCombo->AddEntry(tmp, i+1);
392 } //End local scope for i
393 fMechanismCombo->Select(1);
394 fMechanismCombo->Resize(100, 20);
395 fMechanismCombo->Associate(this);
400 fTbh61 = new TGTextBuffer(10);
401 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
402 fTbh61->AddText(0, " 100");
403 fTeh61->Associate(this);
405 fTbh62 = new TGTextBuffer(10);
406 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
407 fTbh62->AddText(0, "0.001");
408 fTeh62->Associate(this);
410 fTbh63 = new TGTextBuffer(10);
411 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
412 fTbh63->AddText(0, "10.");
413 fTeh63->Associate(this);
419 fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
420 bFly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
421 fF61->AddFrame(fSLabel61, bFly1);
422 fF61->AddFrame(fTeh61, bFly1);
423 fF61->AddFrame(fTeh62, bFly1);
424 fF61->AddFrame(fTeh63, bFly1);
427 fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
428 fF6->AddFrame(fF62, fL2);
429 fPlotButton = new TGTextButton(fF62, "Plot", 1);
430 fPlotButton -> Associate(this);
431 fF62->AddFrame(fPlotButton);
433 tf->AddFrame(fF6, fL2);
434 // Window name and final mapping
436 SetWindowName("AliRoot Geometry Browser");
438 // We need to use GetDefault...() to initialize the layout algorithm...
439 Resize(GetDefaultSize());
443 AliGuiGeomMain::~AliGuiGeomMain()
445 // Delete all created widgets.
447 delete fCanvasWindow;
449 delete fMenuBarLayout;
450 delete fMenuBarItemLayout;
451 delete fMenuBarHelpLayout;
458 void AliGuiGeomMain::Streamer(TBuffer &)
464 void AliGuiGeomMain::Plot()
466 // plot de/dx or cross-sections
467 const Float_t kAvo=0.60221367;
468 Float_t *tkin = new Float_t[fNbins];
469 Float_t *value = new Float_t[fNbins];
470 Float_t *pcut = new Float_t[fNbins];
472 Int_t imate = gCurrentMaterial->Id();
473 Float_t z = gCurrentMaterial->GetZ();
474 Float_t a = gCurrentMaterial->GetA();
475 Float_t density = gCurrentMaterial->GetDensity();
477 Int_t ipart=gCurrentParticle;
478 const char *kChMeca= kLabelTextMechanism[gCurrentProcess-1];
481 strncpy(tmp, kChMeca, 4);
484 Float_t de=(fEmax-fEmin)/fNbins;
485 { //Begin local scope for i
486 for (Int_t i=0; i<kdim; i++) {
487 tkin[i]=fEmin+Float_t(i)*de;
490 } //End local scope for i
491 if (kChMeca!="MUON") {
492 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
494 for (Int_t i=0; i<kdim; i++) {
495 Float_t ekin=tkin[i];
496 value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
497 value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
498 value[i]*=1000.*kAvo*density/a;
503 TGraph *graph = new TGraph(kdim,tkin,value);
504 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
508 graph->SetFillColor(42);
509 graph->SetMarkerColor(4);
510 graph->SetMarkerStyle(21);
512 graph->GetHistogram()->SetXTitle("Energy (GeV)");
513 if (kChMeca == "RANG" || kChMeca == "STEP") {
514 graph->GetHistogram()->SetYTitle
516 } else if (kChMeca == "LOSS" || kChMeca == "MUON") {
517 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
519 graph->GetHistogram()->SetYTitle
520 ("Macroscopic X-Section (1/cm)");
531 void AliGuiGeomMain::Update()
538 Int_t imat=gCurrentVolume->Material();
539 Int_t nmat=fComboMaterialEntries->GetEntriesFast();
541 for (i=0; i<nmat; i++) {
542 gCurrentMaterial = (AliG3Material*)
543 (fComboMaterialEntries->UncheckedAt(i));
544 if ((gCurrentMaterial->Id())==imat) break;
546 Int_t imed = gCurrentVolume->Medium();
547 Int_t nmed=fComboMediaEntries->GetEntriesFast();
548 for (i=0; i<nmed; i++) {
549 gCurrentMedium = (AliG3Medium*)
550 (fComboMediaEntries->UncheckedAt(i));
551 if (gCurrentMedium->Id()==imed) break;
559 void AliGuiGeomMain::UpdateCombo()
563 Int_t imat = gCurrentMaterial->Id();
564 Float_t a = gCurrentMaterial->GetA();
565 Float_t z = gCurrentMaterial->GetZ();
566 Float_t dens = gCurrentMaterial->GetDensity();
567 Float_t radl = gCurrentMaterial->GetRadLength();
568 Float_t absl = gCurrentMaterial->GetInterLength();
569 Int_t entry = gCurrentMaterial->GetNumber();
572 fMaterialCombo->Select(entry);
573 fMediaCombo->Select(entry);
576 sprintf(buf, "%10i", imat);
578 fTbh[0]->AddText(0, buf);
579 gClient->NeedRedraw(fTeh[0]);
580 sprintf(buf, "%10.2e", a);
582 fTbh[1]->AddText(0, buf);
583 gClient->NeedRedraw(fTeh[1]);
585 sprintf(buf, "%10.2e", z);
587 fTbh[2]->AddText(0, buf);
588 gClient->NeedRedraw(fTeh[2]);
590 sprintf(buf, "%10.2e", dens);
592 fTbh[3]->AddText(0, buf);
593 gClient->NeedRedraw(fTeh[3]);
595 sprintf(buf, "%10.2e", radl);
597 fTbh[4]->AddText(0, buf);
598 gClient->NeedRedraw(fTeh[4]);
600 sprintf(buf, "%10.2e", absl);
602 fTbh[5]->AddText(0, buf);
603 gClient->NeedRedraw(fTeh[5]);
606 sprintf(buf, "%10i", gCurrentMedium->Isvol());
608 fTbhM[0]->AddText(0, buf);
609 gClient->NeedRedraw(fTehM[0]);
612 sprintf(buf, "%10i", gCurrentMedium->Ifield());
614 fTbhM[1]->AddText(0, buf);
615 gClient->NeedRedraw(fTehM[1]);
617 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
619 fTbhM[2]->AddText(0, buf);
620 gClient->NeedRedraw(fTehM[2]);
622 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
624 fTbhM[3]->AddText(0, buf);
625 gClient->NeedRedraw(fTehM[3]);
627 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
629 fTbhM[4]->AddText(0, buf);
630 gClient->NeedRedraw(fTehM[4]);
632 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
634 fTbhM[5]->AddText(0, buf);
635 gClient->NeedRedraw(fTehM[5]);
637 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
639 fTbhM[6]->AddText(0, buf);
640 gClient->NeedRedraw(fTehM[6]);
642 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
644 fTbhM[7]->AddText(0, buf);
645 gClient->NeedRedraw(fTehM[7]);
648 void AliGuiGeomMain::UpdateListBox()
650 // Update the list box
652 fProcessLB->RemoveEntries(1,19);
653 for (i=11; i < 30; i++) {
654 Float_t p=gCurrentMedium->GetPar(i);
656 sprintf(tmp, "%6s%5d", kLabelTextP[i-11], Int_t(p));
657 fProcessLB->AddEntry(tmp, i-10);
659 fProcessLB->MapSubwindows();
660 fProcessLB->Layout();
662 fCutsLB->RemoveEntries(1,10);
663 for (i=1; i < 11; i++) {
664 Float_t p=gCurrentMedium->GetPar(i);
666 sprintf(tmp, "%6s%10.3e", kLabelTextC[i-1], p);
667 fCutsLB->AddEntry(tmp,i);
669 fCutsLB->MapSubwindows();
674 void AliGuiGeomMain::CloseWindow()
676 // Got close message for this MainFrame. Calls parent CloseWindow()
677 // (which destroys the window) and terminate the application.
678 // The close message is generated by the window manager when its close
679 // window menu item is selected.
681 TGMainFrame::CloseWindow();
682 gApplication->Terminate(0);
685 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
687 // Process messages to widgets
688 switch (GET_MSG(msg)) {
690 // Text entries for binning of cross-section plots
692 switch (GET_SUBMSG(msg)) {
693 case kTE_TEXTCHANGED:
696 fNbins=(Int_t) atof(fTbh61->GetString());
699 fEmin= atof(fTbh62->GetString());
702 fEmax= atof(fTbh63->GetString());
708 // ListTree for volumes
710 switch (GET_SUBMSG(msg)) {
712 // Handle mouse click
715 // Button 1: Select volume
716 if (parm1 == kButton1) {
717 TGListTreeItem *item;
718 if ((item = fLt->GetSelected()))
720 gCurrentVolume=((AliG3Volume *) item->GetUserData());
725 // Button 2: Draw volume specifications
727 if (parm1 == kButton2) {
728 TGListTreeItem *item;
729 if ((item = fLt->GetSelected()))
732 ((AliG3Volume *) item->GetUserData())->DrawSpec();
734 gCurrentVolume=((AliG3Volume *) item->GetUserData());
739 // Button 3: Draw Volume
740 if (parm1 == kButton3) {
741 TGListTreeItem *item;
742 if ((item = fLt->GetSelected()))
744 ((AliG3Volume *) item->GetUserData())->Draw();
745 gCurrentVolume=((AliG3Volume *) item->GetUserData());
752 case kCT_ITEMDBLCLICK:
753 if (parm1 == kButton1) {
754 if (fLt->GetSelected() != 0) {
755 gClient->NeedRedraw(fLt);
764 switch (GET_SUBMSG(msg)) {
774 // Combo box bindings
779 gCurrentMaterial=(AliG3Material*)
780 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
781 gCurrentMedium=(AliG3Medium*)
782 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
789 gCurrentMedium=(AliG3Medium*)
790 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
791 gCurrentMaterial=(AliG3Material*)
792 (fComboMaterialEntries->UncheckedAt(Int_t(parm2-1)));
799 gCurrentParticle=Int_t(parm2);
804 gCurrentProcess=Int_t(parm2);
815 printf("kFileOpen not yet implemented \n");
820 fDialog = new AliGuiGeomDialog
821 (gClient->GetRoot(), this, 400, 200);
825 printf("kFileSave not yet implemented \n");
829 // printf("kFileExit not yet implemented \n");
830 CloseWindow(); // this also terminates theApp
844 void AliGuiGeomMain::AddMaterial(AliG3Material *Material, Int_t i)
846 // Add material to material combo
848 tmp=Material->GetName();
851 strncpy(mName, tmp, 20);
854 // Material->SetItemId(i);
855 fMaterialCombo->AddEntry(mName, i);
856 fMaterialCombo->Select(i);
857 fMaterialCombo->Resize(200, 20);
860 void AliGuiGeomMain::AddMedium(AliG3Medium *Medium, Int_t i)
862 // Add medium to medium combo
864 tmp=Medium->GetName();
866 strncpy(mName, tmp, 20);
868 Medium->SetItemId(i);
869 fMediaCombo->AddEntry(mName, i);
870 fMediaCombo->Select(i);
871 fMediaCombo->Resize(200, 20);
874 void AliGuiGeomMain::SetMaterialComboEntries(TClonesArray *entries)
876 // Set the material combo entries
878 fComboMaterialEntries = entries;
879 Int_t nent = fComboMaterialEntries->GetEntriesFast();
880 for (Int_t i=0; i < nent; i++)
882 AddMaterial((AliG3Material*)fComboMaterialEntries->At(i), i);
883 gCurrentMaterial = (AliG3Material*)fComboMaterialEntries->At(i);
888 void AliGuiGeomMain::SetMediaComboEntries(TClonesArray *entries)
890 // Set the media combo entries
892 fComboMediaEntries = entries;
893 Int_t nent = fComboMediaEntries->GetEntriesFast();
894 for (Int_t i=0; i < nent; i++)
896 AddMedium((AliG3Medium*)fComboMediaEntries->At(i), i);
897 gCurrentMedium = (AliG3Medium*)fComboMediaEntries->At(i);
901 void AliGuiGeomMain::AddFoldersRecursively(TFolder* folder, TGListTreeItem* parent)
903 // Display geometry represented by TFolders in List Tree
905 const TGPicture* kFolder = gClient->GetPicture("folder_t.xpm");
906 const TGPicture* kOpenFolder = gClient->GetPicture("ofolder_t.xpm");
907 const TGPicture* kDocument = gClient->GetPicture("doc_t.xpm");
909 AliG3Volume* volume = ((AliG3Volume *) folder->FindObject(folder->GetName()));
910 volume->SetItem(folder);
912 TList* folders = (TList*) folder->GetListOfFolders();
915 TGListTreeItem* nParent = 0;
916 if (folders->GetSize() > 1) {
917 nParent = fLt->AddItem(parent, folder->GetName(), volume, kOpenFolder, kFolder);
919 nParent = fLt->AddItem(parent, folder->GetName(), volume, kDocument, kDocument);
922 while ((obj = next()))
924 if ((AliG3Volume*) obj == volume) continue;
925 TFolder* item = (TFolder*) obj;
926 AddFoldersRecursively(item, nParent);