]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant3/TGeant3GUI.cxx
Dummy definition of Gftmat, Gbrelm and Gprelm added.
[u/mrichter/AliRoot.git] / TGeant3 / TGeant3GUI.cxx
1 /* *************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly 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  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.3  1999/11/14 14:31:14  fca
19 Correct small error and remove compilation warnings on HP
20
21 Revision 1.2  1999/11/10 16:53:35  fca
22 The new geometry viewer from A.Morsch
23
24 */
25
26 /* 
27  *  Version: 0
28  *  Written by Andreas Morsch
29  *  
30  * 
31  *
32  * For questions critics and suggestions to this part of the code
33  * contact andreas.morsch@cern.ch
34  * 
35  **************************************************************************/
36 #include <stdlib.h>
37 #include <TROOT.h>
38 #include <AliRun.h>
39 #include <AliMC.h>
40 #include <TGeant3.h>
41 #include <THIGZ.h>
42 #include <TApplication.h>
43 #include <TVirtualX.h>
44 #include <TGListBox.h>
45 #include <TGListTree.h>
46 #include <TGClient.h>
47 #include <TGFrame.h>
48 #include <TGIcon.h>
49 #include <TGLabel.h>
50 #include <TGButton.h>
51 #include <TGTextEntry.h>
52 #include <TGMsgBox.h>
53 #include <TGMenu.h>
54 #include <TGCanvas.h>
55 #include <TGComboBox.h>
56 #include <TGTab.h>
57 #include <TGSlider.h>
58 #include <TGDoubleSlider.h>
59 #include <TGFileDialog.h>
60 #include <TRootEmbeddedCanvas.h>
61 #include <TCanvas.h>
62 #include <TH1.h>
63 #include <TH2.h>
64 #include <TRandom.h>
65 #include <TSystem.h>
66 #include <TEnv.h>
67 #include <TGPicture.h>
68 #include <TGraph.h>
69
70 #include "TGeant3GUI.h"
71
72 static AliDrawVolume  *gCurrentVolume   = new AliDrawVolume("NULL");
73 static AliGUIMaterial *gCurrentMaterial = new AliGUIMaterial();
74 static AliGUIMedium   *gCurrentMedium   = new AliGUIMedium();
75 static Int_t           gCurrentParticle = 1;
76 static Int_t           gCurrentProcess  = 1;
77
78 ClassImp(AliGeant3GeometryGUI)
79
80     AliGeant3GeometryGUI::AliGeant3GeometryGUI()
81 {
82     fPanel  =   new AliGuiGeomMain(gClient->GetRoot(), 500, 500);
83     fNstack = 0;
84     fVolumes =   new TClonesArray("AliDrawVolume",1000);
85     fMaterials = new TClonesArray("AliGUIMaterial",1000);
86     fMedia =     new TClonesArray("AliGUIMedium",1000);
87 //  Store local copy of zebra bank entries
88     TGeant3 *geant3 = (TGeant3*) gMC;
89     if (geant3) {
90         fZlq=geant3->Lq();
91         fZq=geant3->Q();
92         fZiq=geant3->Iq();
93         fGclink=geant3->Gclink();
94         fGcnum=geant3->Gcnum();
95 //
96         ReadGeometryTree();
97         ReadMaterials();
98     }
99 }
100 void AliGeant3GeometryGUI::Streamer(TBuffer &)
101 {
102 ;
103 }
104
105
106 void AliGeant3GeometryGUI::ReadGeometryTree()
107 {
108 //
109 // Copy zebra volume tree into ROOT LisTree
110 //
111     char *vname;
112     char /* *namec, */ *tmp;
113     char namec[30];
114 //  Icons for 
115 //  Closed folder (=volume containing children)
116     const TGPicture* Folder     = gClient->GetPicture("folder_t.xpm");
117 //  Open folder   (=volume containing children)
118     const TGPicture* OpenFolder = gClient->GetPicture("ofolder_t.xpm");
119 //  Empty object
120     const TGPicture* Document   = gClient->GetPicture("doc_t.xpm");
121
122     AliDrawVolume  *volume;
123
124     Int_t nst=0;
125     Int_t nlevel=1;
126     Int_t newlevel=nlevel;
127
128     volume = new AliDrawVolume("ALIC");
129     volume->SetIdVolume(((TGeant3*)gMC)->VolId("ALIC"));
130     volume->SetIdCopy(0);
131     volume->SetItem(NULL);
132     (*fVolumes)[0]=volume;
133 //
134 //  Loop over volumes for which information has been collected
135     while(nlevel>nst) {
136         for (Int_t i=nst; i<nlevel; i++) 
137         {
138             TGListTreeItem *itemi, *item2;
139 // GEANT3 volume number
140             Int_t ivol=TMath::Abs(Volume(i)->GetIdVolume());
141 // Copy number
142 // icopy=1 normal positioning
143 // icopy>1 positioning with parposp
144 // icopy<0 division
145             Int_t icopy = Volume(i)->GetIdCopy();
146 // Medium and material number, handle special case of divisions
147             Int_t imat, imed;
148             
149             if (icopy <0) {
150                 imed=Medium(-ivol);
151                 imat=Material(-ivol);
152             } else {
153                 imed=Medium(ivol);
154                 imat=Material(ivol);
155             }
156 //
157 // Number of children
158             Int_t nch = NChildren(ivol);
159             strcpy(namec,((TGeant3*)gMC)->VolName(ivol));
160             if (nch >= 0) {
161                 printf("\n %s has %d children  \n ", namec,  nch);
162             } else {
163                 printf("\n %s has  divisions \n ", namec);
164             }
165 //
166 // Name to be used in ListTree
167             vname = new char[5];
168             strncpy(vname,namec, 4);
169             vname[4]='\0';
170
171             if (icopy >1) {
172                 sprintf(namec,"%s*%3dPos",namec,icopy);
173             } else if (icopy <0) {
174                 sprintf(namec,"%s*%3dDiv",namec,-icopy);
175             }
176             if (i>0) {
177                 itemi=Volume(i)->GetItem();
178             } else {
179                 itemi=NULL;
180             }
181             
182 //
183 // Add volume to list tree
184             
185             if (nch!=0) {
186                 item2 = fPanel->AddItem(new AliDrawVolume(vname), 
187                                     itemi, namec, OpenFolder, Folder);
188             } else {
189                 item2 = fPanel->AddItem(new AliDrawVolume(vname), 
190                                     itemi, namec, Document, Document);
191             }
192 //
193 // Add medium information to list tree item
194             ((AliDrawVolume *) item2->GetUserData())->SetIdVolume(ivol);
195             ((AliDrawVolume *) item2->GetUserData())->SetIdMaterial(imat);
196             ((AliDrawVolume *) item2->GetUserData())->SetIdMedium(imed);
197 //
198 // Set current volume to first list tree entry
199             if (!i) gCurrentVolume= ((AliDrawVolume *) item2->GetUserData());
200             
201 //
202 // Collect children information
203 //
204 // nch < 0: Children by division            
205             if (nch < 0) {
206 //
207 // Geant volume number
208                 Int_t icvol=Child(ivol,1);
209 // Name
210                 strcpy(namec,((TGeant3*)gMC)->VolName(-icvol));
211                 tmp = new char[4];
212                 strncpy(tmp,(char *) &namec, 4);
213                 volume = new AliDrawVolume(namec);
214                 volume->SetIdVolume(-icvol);
215 // Number of divisions
216                 Int_t jvo  = fZlq[fGclink->jvolum-ivol];
217                 Int_t jdiv = fZlq[jvo-1];
218                 Int_t ndiv = Int_t (fZq[jdiv+3]);
219                 volume->SetIdCopy(-ndiv);
220 // Link to mother
221                 volume->SetItem(item2);
222                 (*fVolumes)[newlevel]=volume;
223                 printf("\n volume %s %d %d %d", namec, icvol, nch, ndiv);
224                 newlevel++;
225 //
226 // Children by positioning
227             } else {
228                 Int_t nnew=0;
229 // Loop over children 
230                 for (Int_t j=0; j<nch; j++) 
231                 {
232 //
233 // Find out if this volume was already positioned and count copies 
234                     Int_t icvol=Child(ivol,j+1);
235                     icvol = TMath::Abs(icvol);
236                     Bool_t inList=kFALSE;
237                     for (Int_t k=0; k<nnew; k++) {
238                         if (icvol==
239                             Volume(newlevel-k-1)->GetIdVolume()) 
240                         {
241                             Volume(newlevel-k-1)->AddCopy();
242                             inList=kTRUE;
243                         }
244                     }
245 //
246 // New child
247                     if (!inList) {
248 //
249 // Name
250                         strcpy(namec,((TGeant3*)gMC)->VolName(icvol));
251                         tmp = new char[4];
252                         strncpy(tmp,(char *) &namec, 4);
253                         volume = new AliDrawVolume(namec);
254                         volume->SetIdVolume(icvol);
255                         volume->SetIdCopy(1);
256 // Link to mother
257                         volume->SetItem(item2);
258                         (*fVolumes)[newlevel]=volume;
259                         printf("\n volume %s %d %d", namec, icvol, nch);
260                         newlevel++;
261                         nnew++;
262                     }
263                 }
264             }
265         }
266 // Move one level deaper
267         nst=nlevel;
268         nlevel=newlevel;
269     }
270 }
271
272 void AliGeant3GeometryGUI::ReadMaterials()
273 {
274 //
275 // Puts media and material names into ComboBox and 
276 // collects material information
277 // 
278     Float_t a, z, dens, radl, absl;
279     a=z=dens=radl=absl=-1;
280     Int_t npar=0;
281     Int_t imat, isvol, ifield;
282     Float_t fieldm, tmaxfd, stemax, deemax, epsil, stmin;
283     Float_t par[50];
284     Float_t ubuf[50];
285     Int_t nwbuf;
286     
287     char natmed[21], namate[21];
288 //
289 // Loop over media
290     Int_t NEntries=0;
291     
292     for(Int_t itm=1;itm<=fGcnum->ntmed;itm++) {
293         Int_t jtm  = fZlq[fGclink->jtmed-itm];
294         if (jtm > 0) {
295             NEntries++;
296 // 
297 // Get medium parameters
298             ((TGeant3*)(gMC))->Gftmed(itm, natmed, imat, isvol, ifield, fieldm, 
299                                       tmaxfd, stemax, deemax, epsil, stmin, ubuf, &nwbuf);
300             strncpy(natmed,(char*)&fZiq[jtm+1],20);
301             natmed[20]='\0';
302 //
303 // Create new medium object 
304             AliGUIMedium * medium = 
305                 new AliGUIMedium(itm, imat, natmed, isvol, ifield, fieldm, 
306                                       tmaxfd, stemax, deemax, epsil, stmin);
307             (*fMedia)[NEntries-1]=medium;
308             for (Int_t j=1; j<=22; j++) {
309                 medium->SetPar(j,Cut(itm,j));
310             }
311             for (Int_t j=23; j<=26; j++) {
312                 medium->SetPar(j,Cut(itm,j+3));
313             }
314             for (Int_t j=27; j<=29; j++) {
315                 medium->SetPar(j,Cut(itm,j+4));
316             }
317 //
318 // Add to ComboBox
319             fPanel->AddMedium(medium, NEntries);
320 //
321 // Associated material
322             imat =  Int_t (fZq[jtm+6]);
323             Int_t jma  =  Int_t (fZlq[fGclink->jmate-imat]);
324 //
325 // Get material parameters
326             ((TGeant3*)(gMC))->Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
327             strncpy(namate,(char *)&fZiq[jma+1],20);
328             namate[20]='\0';
329 //
330 // Create new material object
331             AliGUIMaterial * material = 
332                 new AliGUIMaterial(imat,namate,a,z,dens,radl,absl);
333             (*fMaterials)[NEntries-1]=material;
334             material->Dump();
335 //
336 // Add to combo box
337             fPanel->AddMaterial(material, NEntries);
338             gCurrentMaterial=material;
339         }
340     }
341     fPanel->SetComboEntries(fMaterials);
342     fPanel->SetMediaComboEntries(fMedia);
343     fPanel->Update();
344 }
345
346 Int_t AliGeant3GeometryGUI::NChildren(Int_t idvol)
347 {
348 //
349 // Return number of children for volume idvol
350     Int_t jvo = fZlq[fGclink->jvolum-idvol];
351     Int_t nin = Int_t(fZq[jvo+3]);
352     return nin;
353 }
354
355 Int_t AliGeant3GeometryGUI::Child(Int_t idvol, Int_t idc)
356 {
357 //
358 // Return GEANT id of child number idc of volume idvol
359     Int_t jvo = fZlq[fGclink->jvolum-idvol];
360     Int_t nin=idc;
361     Int_t jin = fZlq[jvo-nin];
362     Int_t numb =  Int_t (fZq[jin +3]);
363     if (numb > 1) {
364         return -Int_t(fZq[jin+2]);
365     } else {
366         return Int_t(fZq[jin+2]);
367     }
368 }
369
370 Int_t AliGeant3GeometryGUI::Medium(Int_t idvol)
371 {
372 //
373 // Return medium number for volume idvol.
374 // If idvol is negative the volume results from a division.
375     Int_t imed;
376     if (idvol > 0) {
377         Int_t jvo = fZlq[fGclink->jvolum-idvol];
378         imed = Int_t(fZq[jvo+4]);
379     } else {
380         idvol=-idvol;
381         Int_t jdiv = fZlq[fGclink->jvolum-idvol];
382         Int_t ivin = Int_t ( fZq[jdiv+2]);
383         Int_t jvin = fZlq[fGclink->jvolum-ivin];
384         imed = Int_t (fZq[jvin+4]);
385     }
386     return imed;
387 }
388
389 Int_t AliGeant3GeometryGUI::Material(Int_t idvol)
390 {
391 // Return material number for volume idvol.
392 // If idvol is negative the volume results from a division.
393
394     Int_t imed=Medium(idvol);
395     Int_t jtm  = fZlq[fGclink->jtmed-imed];
396     return Int_t (fZq[jtm+6]);
397 }
398
399
400 Float_t AliGeant3GeometryGUI::Cut(Int_t imed, Int_t icut)
401 {
402 // Return cuts icut for medium idmed 
403 // 
404     Int_t jtm  = fZlq[fGclink->jtmed-imed];
405 //
406 //  Have the defaults been modified ??
407     Int_t jtmn = fZlq[jtm];
408     if (jtmn >0) {
409         jtm=jtmn;
410         
411     } else {
412         jtm=fGclink->jtmed;
413     }
414     
415     return Float_t (fZq[jtm+icut]);
416 }
417
418 ClassImp(AliDrawVolume)
419 //
420 // Drawing parameter tags
421 enum AliDrawParamId {
422    P_Theta,
423    P_Phi,
424    P_Psi,
425    P_U,
426    P_V,
427    P_Uscale,
428    P_Vscale,
429    P_Shadow,
430    P_Hide,
431    P_Fill,
432    P_Seen,
433    P_Clip,
434    P_ClipXmin,
435    P_ClipXmax,
436    P_ClipYmin,
437    P_ClipYmax,
438    P_ClipZmin,
439    P_ClipZmax
440 };
441
442
443 AliDrawVolume::AliDrawVolume(char* name)
444 {
445     fName   = name;
446     fTheta  = 30;
447     fPhi    = 30;
448     fPsi    = 0;
449     fU      = 10;
450     fV      = 10;
451     fUscale = 0.01;
452     fVscale = 0.01;
453     fHide=0;
454     fShadow=0;
455     fFill=1;
456     fSeen=1;
457     fClip=0;
458     fClipXmin=0.;
459     fClipXmax=2000.;
460     fClipYmin=0.;
461     fClipYmax=2000.;
462     fClipZmin=0.;
463     fClipZmax=2000.;
464 }
465
466 char* AliDrawVolume::Name()
467 {
468 //
469 // Return volume name
470     return fName;
471 }
472
473     
474 void AliDrawVolume::Streamer(TBuffer &)
475 {
476 ;
477 }
478
479
480
481 void AliDrawVolume::Draw(Option_t *)
482 {
483     gMC->Gsatt(fName,"seen", fSeen);
484     
485     if (fHide) {
486         gMC->Gdopt("hide", "on");
487     } else {
488         gMC->Gdopt("hide", "off");
489     }
490
491     if (fShadow) {
492         gMC->Gdopt("shad", "on");
493         gMC->Gsatt("*", "fill", fFill);
494     } else {
495         gMC->Gdopt("shad", "off");
496     }
497
498         gMC->SetClipBox(".");
499     if (fClip) {
500         gMC->SetClipBox("*", fClipXmin, fClipXmax, 
501                         fClipYmin, fClipYmax, fClipZmin, fClipZmax);
502     } else {
503         gMC->SetClipBox(".");
504     }
505     
506
507     gMC->Gdraw(fName, fTheta, fPhi, fPsi, fU, fV, fUscale, fVscale);
508     THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
509     if (higz) higz->Update();
510 }
511
512 void AliDrawVolume::DrawSpec()
513 {
514     gMC->Gsatt(fName,"seen", fSeen);
515     
516     if (fHide) {
517         gMC->Gdopt("hide", "on");
518     } else {
519         gMC->Gdopt("hide", "off");
520     }
521
522     if (fShadow) {
523         gMC->Gdopt("shad", "on");
524         gMC->Gsatt("*", "fill", fFill);
525     } else {
526         gMC->Gdopt("shad", "off");
527     }
528
529     gMC->SetClipBox(".");
530     if (fClip) {
531         gMC->SetClipBox("*", fClipXmin, fClipXmax, fClipYmin, fClipYmax, fClipZmin, fClipZmax);
532     } else {
533         gMC->SetClipBox(".");
534     }
535     
536
537     ((TGeant3*) gMC)->DrawOneSpec(fName);
538     THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
539     if (higz) higz->Update();
540 }
541
542 void AliDrawVolume::SetParam(Int_t ip, Float_t param)
543 {
544     switch (ip) {
545     case P_Theta:
546         fTheta=param;
547         break;
548     case P_Phi:
549         fPhi=param;
550         break;
551     case P_Psi:
552         fPsi=param;
553         break;
554     case P_U:
555         fU=param;
556         break;
557     case P_V:
558         fV=param;
559         break;
560     case P_Uscale:
561         fUscale=param;
562         break;
563     case P_Vscale:
564         fVscale=param;
565         break;
566     case P_Hide:
567         fHide=Int_t(param);
568         break;
569     case P_Shadow:
570         fShadow=Int_t(param);
571         break;
572     case P_Fill:
573         fFill=Int_t(param);
574         break;
575     case P_Seen:
576         fSeen=Int_t(param);
577         break;
578     case P_Clip:
579         fClip=Int_t(param);
580         break;
581     case P_ClipXmin:
582         fClipXmin=param;
583         break;
584     case P_ClipXmax:
585         fClipXmax=param;
586         break;
587     case P_ClipYmin:
588         fClipYmin=param;
589         break;
590     case P_ClipYmax:
591         fClipYmax=param;
592         break;
593     case P_ClipZmin:
594         fClipZmin=param;
595         break;
596     case P_ClipZmax:
597         fClipZmax=param;
598         break;
599     }
600 }
601
602 Float_t  AliDrawVolume::GetParam(Int_t ip)
603 {
604     switch (ip) {
605     case P_Theta:
606         return fTheta;
607     case P_Phi:
608         return fPhi;
609     case P_Psi:
610         return fPsi;
611     case P_U:
612         return fU;
613     case P_V:
614         return fV;
615     case P_Uscale:
616         return fUscale;
617     case P_Vscale:
618         return fVscale;
619     case P_Hide:
620         return Float_t(fHide);
621     case P_Shadow:
622         return Float_t(fShadow);
623     case P_Fill:
624         return Float_t(fFill);
625     case P_Seen:
626         return Float_t(fSeen);
627     case P_Clip:
628         return Float_t(fClip);
629     case P_ClipXmin:
630         return fClipXmin;
631     case P_ClipXmax:
632         return fClipXmax;
633     case P_ClipYmin:
634         return fClipYmin;
635     case P_ClipYmax:
636         return fClipYmax;
637     case P_ClipZmin:
638         return fClipZmin;
639     case P_ClipZmax:
640         return fClipZmax;
641     default:
642         return 0.;
643     }
644     return 0.;
645 }
646
647
648 ClassImp(AliGuiGeomMain)
649
650  const Text_t* LabelTextP[19]  = 
651 {"PAIR  ", "COMP  ", "PHOT  ", "PFIS  ", "DRAY  ", "ANNI  ", "BREM  ", 
652  "HADR  ", "MUNU  ", "DCAY  ", "LOSS  ", "MULS  ", "GHCOR1", "BIRK1 ", 
653  "BIRK2 ", "BIRK3 ", "LABS  ", "SYNC  ", "STRA  "};
654
655
656  const Text_t* LabelTextC[10]  = 
657  {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
658   "DCUTE ", "DCUTM ", "PPCUTM"};
659
660 const Text_t* LabelTextPart[24]  = 
661 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-", 
662  "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton", 
663  "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
664  "Xi0", "Xi-", "Omega-"};
665
666 const Text_t* LabelTextMechanism[24]  = 
667 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
668  "HADG", "INEG", "ELAG", "FISG", "CAPG",
669  "LOSS", "PHOT", "ANNI", "COMP", "BREM",
670  "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
671  "MUNU", "RANG", "STEP", "MUON"};
672
673
674
675
676 enum ETestCommandIdentifiers {
677    M_FILE_OPEN,
678    M_FILE_SAVE,
679    M_FILE_SAVEAS,
680    M_FILE_EXIT,
681
682    M_TEST_DLG,
683
684    M_HELP_CONTENTS,
685    M_HELP_SEARCH,
686    M_HELP_ABOUT,
687
688
689    VId1,
690    HId1,
691    VId2,
692    HId2,
693
694    VSId1,
695    HSId1,
696    VSId2,
697    HSId2
698 };
699
700
701 Int_t mb_button_id[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
702                           kMBRetry, kMBIgnore, kMBCancel,
703                           kMBClose, kMBDismiss };
704
705 EMsgBoxIcon mb_icon[4] = { kMBIconStop, kMBIconQuestion,
706                            kMBIconExclamation, kMBIconAsterisk };
707
708 const char *filetypes[] = { "All files",     "*",
709                             "ROOT files",    "*.root",
710                             "ROOT macros",   "*.C",
711                             0,               0 };
712
713
714
715
716 TGListTreeItem*  AliGuiGeomMain::
717 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
718 {
719     return fLt->AddItem(parent, name, obj, open, closed);
720 }
721
722 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
723       : TGMainFrame(p, w, h)
724 {
725     fDialog=0;
726    // Create test main frame. A TGMainFrame is a top level window.
727    // Create menubar and popup menus. The hint objects are used to place
728    // and group the different menu widgets with respect to eachother.
729    fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
730                                       0, 0, 1, 1);
731    fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
732    fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
733
734    fMenuFile = new TGPopupMenu(gClient->GetRoot());
735    fMenuFile->AddEntry("&Open...", M_FILE_OPEN);
736    fMenuFile->AddEntry("&Save", M_FILE_SAVE);
737    fMenuFile->AddEntry("S&ave as...", M_FILE_SAVEAS);
738    fMenuFile->AddEntry("&Close", -1);
739    fMenuFile->AddSeparator();
740    fMenuFile->AddEntry("E&xit", M_FILE_EXIT);
741
742    fMenuFile->DisableEntry(M_FILE_SAVEAS);
743    fMenuFile->DisableEntry(M_FILE_OPEN);
744    fMenuFile->DisableEntry(M_FILE_SAVE);
745
746
747
748    fMenuTest = new TGPopupMenu(this);
749    fMenuTest->AddLabel("Draw");
750    fMenuTest->AddSeparator();
751    fMenuTest->AddEntry("&Volume Draw Control", M_TEST_DLG);
752    fMenuTest->AddSeparator();
753    fMenuTest->Associate(this);
754    
755    
756    fMenuHelp = new TGPopupMenu(gClient->GetRoot());
757    fMenuHelp->AddEntry("&Contents", M_HELP_CONTENTS);
758    fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
759    fMenuHelp->AddSeparator();
760    fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
761
762    fMenuFile->DisableEntry(M_HELP_CONTENTS);
763    fMenuFile->DisableEntry(M_HELP_SEARCH);
764    fMenuFile->DisableEntry(M_HELP_ABOUT);
765    // Menu button messages are handled by the main frame (i.e. "this")
766    // ProcessMessage() method.
767    fMenuFile->Associate(this);
768    fMenuTest->Associate(this);
769    fMenuHelp->Associate(this);
770
771    fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
772    fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
773    fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
774    fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
775
776    AddFrame(fMenuBar, fMenuBarLayout);
777
778 // 
779 // Volumes
780 //
781    fTab = new TGTab(this, 400, 400);
782    TGCompositeFrame *tf = fTab->AddTab("Volumes");
783    TGLayoutHints *fLTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
784                                           kLHintsExpandY, 2, 2, 5, 1);
785    AddFrame(fTab, fLTab);
786
787 // Create TGCanvas and a canvas container which uses a tile layout manager
788    fCanvasWindow = new TGCanvas(tf, 400, 240);
789 // Create TreeList
790    fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
791                         fgWhitePixel);
792    fLt->Associate(this);
793    fCanvasWindow->SetContainer(fLt);
794
795     
796    TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
797    tf->AddFrame(fCanvasWindow, lo);
798 //
799 // Materials
800 //
801    tf = fTab->AddTab("Materials");
802    fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
803    fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
804 // ComboBox for materials
805    fMaterialCombo = new TGComboBox(fF2, 1);
806    fF2->AddFrame(fMaterialCombo, fL2);
807 // 
808 // text labels with material properties 
809 //
810    Text_t* LabelText[6]  = 
811    {"Material Number  ", 
812     "Atomic Weight    ",
813     "Atomic Number    ", 
814     "Density          ",
815     "Radiation Length ", 
816     "Absorption Length"};
817
818    TGLayoutHints* Bly   = 
819        new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
820    TGLayoutHints* Bfly1 = 
821        new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
822    fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
823    fF2->AddFrame(fF21,fL2);
824    for (Int_t i=0; i<6; i++) {
825        Int_t idT=i+1;       
826        fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
827        fF21->AddFrame(fHframe[i], Bly);
828        fTbh[i] = new TGTextBuffer(10);
829        fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
830        fTeh[i]->Associate(this);
831        fLabel[i] = new TGLabel(fHframe[i], LabelText[i]);
832        fHframe[i]->AddFrame(fLabel[i], Bfly1);
833        fHframe[i]->AddFrame(fTeh[i], Bfly1);
834    }
835   tf->AddFrame(fF2, fL2);
836   fMaterialCombo->Resize(200, 20);
837   fMaterialCombo->Associate(this);
838
839
840 // Media Combo
841 //   
842    tf = fTab->AddTab("Media");
843    fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
844 // ComboBox for tracking media
845    fMediaCombo = new TGComboBox(fF3, 2);
846    fF3->AddFrame(fMediaCombo, fL2);
847 // 
848 // text labels with material properties 
849 //
850    Text_t* LabelTextM[8]  = 
851    {"Sensitivity Flag      ", 
852     "Magnetic Field Flag   ",
853     "Maximum Field         ", 
854     "Max. Ang. Deviation   ",
855     "Maximum Step          ", 
856     "Max. Frac. Energy Loss",
857     "Crossing Precission   ",
858     "Minimum Step Size     "};
859
860    fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
861    fF3->AddFrame(fF31,fL2);
862    for (Int_t i=0; i<8; i++) {
863        Int_t idT=i+1;       
864        fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
865        fF31->AddFrame(fHframeM[i], Bly);
866        fTbhM[i] = new TGTextBuffer(10);
867        fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
868        fTehM[i]->Associate(this);
869        fLabelM[i] = new TGLabel(fHframeM[i], LabelTextM[i]);
870        fHframeM[i]->AddFrame(fLabelM[i], Bfly1);
871        fHframeM[i]->AddFrame(fTehM[i], Bfly1);
872    }
873   tf->AddFrame(fF3, fL2);
874   fMediaCombo->Resize(200, 20);
875   fMediaCombo->Associate(this);
876 //
877 // Processes
878    tf = fTab->AddTab("Processes");
879    fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
880    fProcessLB = new TGListBox(fF4, 1);
881    fF4->AddFrame(fProcessLB, fL2);
882    tf->AddFrame(fF4, fL2);
883    fProcessLB->Resize(150, 350);
884    fProcessLB->Associate(this);
885    
886 //
887 // Cuts
888    tf = fTab->AddTab("Cuts");
889    fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
890    fCutsLB = new TGListBox(fF5, 1);
891    fF5->AddFrame(fCutsLB, fL2);
892    tf->AddFrame(fF5, fL2);
893    fCutsLB->Resize(150, 350);
894
895 //
896 // de/dx and cross-sections
897    tf = fTab->AddTab("DE/DX and X-Sections");
898    fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
899
900 // ComboBox for particles
901    fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
902    fF6->AddFrame(fF61, fL2);
903    fParticleCombo = new TGComboBox(fF61, 3);
904    fF61->AddFrame(fParticleCombo, fL2);
905    int i;
906    for (i = 0; i < 24; i++) {
907       char tmp[20];
908       sprintf(tmp, "%s", LabelTextPart[i]);
909       fParticleCombo->AddEntry(tmp, i+1);
910    }
911    fParticleCombo->Select(1);
912    fParticleCombo->Resize(100, 20);
913    fParticleCombo->Associate(this);
914
915 // ComboBox for mechanisms
916    fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
917    fF6->AddFrame(fF63, fL2);
918    fMechanismCombo = new TGComboBox(fF63, 4);
919    fF63->AddFrame(fMechanismCombo, fL2);
920    for (i = 0; i < 24; i++) {
921       char tmp[20];
922       sprintf(tmp, "%s", LabelTextMechanism[i]);
923       fMechanismCombo->AddEntry(tmp, i+1);
924    }
925    fMechanismCombo->Select(1);
926    fMechanismCombo->Resize(100, 20);
927    fMechanismCombo->Associate(this);
928
929 //
930 // Energy Range
931 //
932    fTbh61 = new TGTextBuffer(10);
933    fTeh61 = new TGTextEntry(fF61, fTbh61,10);
934    fTbh61->AddText(0, "  100");
935    fTeh61->Associate(this);
936
937    fTbh62 = new TGTextBuffer(10);
938    fTeh62 = new TGTextEntry(fF61, fTbh62,11);
939    fTbh62->AddText(0, "0.001");
940    fTeh62->Associate(this);
941     
942    fTbh63 = new TGTextBuffer(10);
943    fTeh63 = new TGTextEntry(fF61, fTbh63,12);
944    fTbh63->AddText(0, "10.");
945    fTeh63->Associate(this);
946
947    fEmin=0.001;
948    fEmax=10.;
949    fNbins=100;
950    
951    fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
952    Bfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
953    fF61->AddFrame(fSLabel61, Bfly1);
954    fF61->AddFrame(fTeh61, Bfly1);
955    fF61->AddFrame(fTeh62, Bfly1);
956    fF61->AddFrame(fTeh63, Bfly1);
957 //
958 // Plot Button
959    fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
960    fF6->AddFrame(fF62, fL2);
961    fPlotButton = new TGTextButton(fF62, "Plot", 1);
962    fPlotButton -> Associate(this);
963    fF62->AddFrame(fPlotButton);
964
965    tf->AddFrame(fF6, fL2);
966 // Window name and final mapping
967 //
968    SetWindowName("AliRoot Geometry Browser");
969    MapSubwindows();
970    // We need to use GetDefault...() to initialize the layout algorithm...
971    Resize(GetDefaultSize());
972    MapWindow();
973 }
974
975 AliGuiGeomMain::~AliGuiGeomMain()
976 {
977    // Delete all created widgets.
978
979    delete fContainer;
980    delete fCanvasWindow;
981
982    delete fMenuBarLayout;
983    delete fMenuBarItemLayout;
984    delete fMenuBarHelpLayout;
985
986    delete fMenuFile;
987    delete fMenuTest;
988    delete fMenuHelp;
989 }
990
991 void AliGuiGeomMain::Streamer(TBuffer &)
992 {
993 ;
994 }
995
996 void AliGuiGeomMain::Plot()
997 {
998     const Float_t avo=0.60221367;
999     Float_t *tkin  = new Float_t[fNbins];
1000     Float_t *value = new Float_t[fNbins];
1001     Float_t *pcut  = new Float_t[fNbins];
1002     Int_t ixst;
1003     Int_t imate=gCurrentMaterial->Id();
1004     Float_t z=gCurrentMaterial->Z();
1005     Float_t a=gCurrentMaterial->A();
1006     Float_t density=gCurrentMaterial->Density();
1007     
1008     Int_t ipart=gCurrentParticle;
1009     const char *chmeca= LabelTextMechanism[gCurrentProcess-1];
1010     char* tmp;
1011     tmp = new char[5];
1012     strncpy(tmp, chmeca, 4);
1013     tmp[4]='\0';
1014     Int_t kdim=fNbins;
1015     Float_t de=(fEmax-fEmin)/fNbins;
1016     for (Int_t i=0; i<kdim; i++) {
1017         tkin[i]=fEmin+Float_t(i)*de;
1018         value[i]=0.;
1019     }
1020     if (chmeca!="MUON") {
1021         ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
1022     } else {
1023         for (Int_t i=0; i<kdim; i++) {
1024             Float_t ekin=tkin[i];
1025             value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
1026             value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
1027             value[i]*=1000.*avo*density/a;
1028         }
1029     }
1030     
1031     
1032     printf("\n %d %d %s %d \n",imate, ipart, chmeca, kdim);
1033     if (ixst) {
1034         TGraph *graph = new TGraph(kdim,tkin,value);
1035         TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
1036         c1->Divide(1,1);
1037         c1->cd(1);
1038         
1039         graph->SetFillColor(42);
1040         graph->SetMarkerColor(4);
1041         graph->SetMarkerStyle(21);
1042         graph->Draw("AC");
1043         graph->GetHistogram()->SetXTitle("Energy (GeV)");
1044         if (chmeca == "RANG" || chmeca == "STEP") {
1045             graph->GetHistogram()->SetYTitle
1046                 ("Distance (cm)");   
1047         } else if (chmeca == "LOSS" || chmeca == "MUON") {
1048             graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");   
1049         } else {
1050             graph->GetHistogram()->SetYTitle
1051                 ("Macroscopic X-Section (1/cm)"); 
1052         }
1053     }
1054     
1055     delete tkin;
1056     delete value;
1057     delete pcut;
1058     
1059     
1060 }
1061
1062 void AliGuiGeomMain::Update()
1063 {
1064     if (fDialog) {
1065         fDialog->Update();
1066     }
1067
1068     Int_t imat=gCurrentVolume->Material();
1069     Int_t nmat=fComboEntries->GetEntriesFast();
1070     Int_t i=0;
1071     for (i=0; i<nmat; i++) {
1072         gCurrentMaterial = (AliGUIMaterial*) 
1073             (fComboEntries->UncheckedAt(i));
1074         if (gCurrentMaterial->Id()==imat) break;
1075     }
1076     gCurrentMedium   = (AliGUIMedium*) 
1077         (fComboMediaEntries->UncheckedAt(i));
1078     UpdateCombo();
1079     UpdateListBox();
1080     
1081 }
1082
1083 void AliGuiGeomMain::UpdateCombo()
1084 {
1085
1086     Int_t   imat = gCurrentMaterial->Id();
1087     Float_t    a = gCurrentMaterial->A();
1088     Float_t    z = gCurrentMaterial->Z();    
1089     Float_t dens = gCurrentMaterial->Density();
1090     Float_t radl = gCurrentMaterial->RadiationLength();
1091     Float_t absl = gCurrentMaterial->AbsorptionLength();
1092     Int_t entry=gCurrentMaterial->ItemId();
1093 //    
1094 //
1095     fMaterialCombo->Select(entry);
1096     fMediaCombo->Select(entry);    
1097     char buf[10];
1098      
1099     sprintf(buf, "%10i", imat);
1100     fTbh[0]->Clear();
1101     fTbh[0]->AddText(0, buf);
1102     gClient->NeedRedraw(fTeh[0]);
1103     sprintf(buf, "%10.2e", a);
1104     fTbh[1]->Clear();
1105     fTbh[1]->AddText(0, buf);
1106     gClient->NeedRedraw(fTeh[1]);
1107
1108     sprintf(buf, "%10.2e", z);
1109     fTbh[2]->Clear();
1110     fTbh[2]->AddText(0, buf);
1111     gClient->NeedRedraw(fTeh[2]);
1112
1113     sprintf(buf, "%10.2e", dens);
1114     fTbh[3]->Clear();
1115     fTbh[3]->AddText(0, buf);
1116     gClient->NeedRedraw(fTeh[3]);
1117
1118     sprintf(buf, "%10.2e", radl);
1119     fTbh[4]->Clear();
1120     fTbh[4]->AddText(0, buf);
1121     gClient->NeedRedraw(fTeh[4]);
1122
1123     sprintf(buf, "%10.2e", absl);
1124     fTbh[5]->Clear();
1125     fTbh[5]->AddText(0, buf);
1126     gClient->NeedRedraw(fTeh[5]);
1127
1128 //  Media Combo
1129     sprintf(buf, "%10i", gCurrentMedium->Isvol());
1130     fTbhM[0]->Clear();
1131     fTbhM[0]->AddText(0, buf);
1132     gClient->NeedRedraw(fTehM[0]);
1133
1134
1135     sprintf(buf, "%10i", gCurrentMedium->Ifield());
1136     fTbhM[1]->Clear();
1137     fTbhM[1]->AddText(0, buf);
1138     gClient->NeedRedraw(fTehM[1]);
1139
1140     sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
1141     fTbhM[2]->Clear();
1142     fTbhM[2]->AddText(0, buf);
1143     gClient->NeedRedraw(fTehM[2]);
1144
1145     sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
1146     fTbhM[3]->Clear();
1147     fTbhM[3]->AddText(0, buf);
1148     gClient->NeedRedraw(fTehM[3]);
1149
1150     sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
1151     fTbhM[4]->Clear();
1152     fTbhM[4]->AddText(0, buf);
1153     gClient->NeedRedraw(fTehM[4]);
1154
1155     sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
1156     fTbhM[5]->Clear();
1157     fTbhM[5]->AddText(0, buf);
1158     gClient->NeedRedraw(fTehM[5]);
1159
1160     sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
1161     fTbhM[6]->Clear();
1162     fTbhM[6]->AddText(0, buf);
1163     gClient->NeedRedraw(fTehM[6]);
1164
1165     sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
1166     fTbhM[7]->Clear();
1167     fTbhM[7]->AddText(0, buf);
1168     gClient->NeedRedraw(fTehM[7]);
1169 }
1170
1171 void AliGuiGeomMain::UpdateListBox()
1172 {
1173     Int_t i;
1174     fProcessLB->RemoveEntries(1,19);
1175     for (i=11; i < 30; i++) {
1176         Float_t p=gCurrentMedium->GetPar(i);
1177         char tmp[20];
1178         sprintf(tmp, "%6s%5d", LabelTextP[i-11], Int_t(p));
1179         fProcessLB->AddEntry(tmp, i-10);
1180     }
1181     fProcessLB->MapSubwindows();
1182     fProcessLB->Layout();
1183
1184     fCutsLB->RemoveEntries(1,10);
1185     for (i=1; i < 11; i++) {
1186         Float_t p=gCurrentMedium->GetPar(i);
1187         char tmp[20];
1188         sprintf(tmp, "%6s%10.3e", LabelTextC[i-1], p);
1189         fCutsLB->AddEntry(tmp,i);
1190     }
1191     fCutsLB->MapSubwindows();
1192     fCutsLB->Layout();
1193 }
1194
1195
1196 void AliGuiGeomMain::CloseWindow()
1197 {
1198    // Got close message for this MainFrame. Calls parent CloseWindow()
1199    // (which destroys the window) and terminate the application.
1200    // The close message is generated by the window manager when its close
1201    // window menu item is selected.
1202
1203    TGMainFrame::CloseWindow();
1204    gApplication->Terminate(0);
1205 }
1206
1207 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1208 {
1209     switch (GET_MSG(msg)) {
1210 //
1211 //  Text entries for binning of cross-section plots
1212     case kC_TEXTENTRY:
1213         switch (GET_SUBMSG(msg)) {
1214         case kTE_TEXTCHANGED:
1215             switch (parm1) {
1216             case 10:
1217                 fNbins=(Int_t) atof(fTbh61->GetString());
1218                 break;
1219             case 11:
1220                 fEmin= atof(fTbh62->GetString());
1221                 break;
1222             case 12:
1223                 fEmax= atof(fTbh63->GetString());
1224                 break;
1225             }
1226             printf("\n %d %f %f binning", fNbins, fEmin, fEmax);
1227         }
1228         break;
1229 //
1230 // ListTree for volumes
1231     case kC_LISTTREE:
1232         switch (GET_SUBMSG(msg)) {
1233 //
1234 // Handle mouse click 
1235         case kCT_ITEMCLICK:
1236             TGListTreeItem *item;
1237 //
1238 // Button 1: Select volume
1239             if (parm1 == kButton1) {
1240                 if ((item = fLt->GetSelected())) 
1241                 {
1242                     gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1243                     Update();
1244                 }
1245             }
1246 //
1247 // Button 2: Draw volume specifications
1248
1249             if (parm1 == kButton2) {
1250                 TGListTreeItem *item;
1251                 if ((item = fLt->GetSelected())) 
1252                 {
1253
1254                     ((AliDrawVolume *) item->GetUserData())->DrawSpec();
1255
1256                     gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1257                     Update();
1258                 }
1259             }
1260 //
1261 // Button 3: Draw Volume
1262             if (parm1 == kButton3) {
1263                 TGListTreeItem *item;
1264                 if ((item = fLt->GetSelected())) 
1265                 {
1266                     ((AliDrawVolume *) item->GetUserData())->Draw();
1267                     gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1268                     Update();
1269                 }
1270             }
1271             
1272             
1273             break;
1274         case kCT_ITEMDBLCLICK:
1275             if (parm1 == kButton1) {
1276                 if (fLt->GetSelected() != 0) {
1277                     gClient->NeedRedraw(fLt);
1278                 }
1279             }
1280             break;
1281         default:
1282             break;
1283         }
1284         break;
1285     case kC_COMMAND:
1286         switch (GET_SUBMSG(msg)) {
1287         case kCM_BUTTON:
1288             switch(parm1) {
1289             case 1:
1290                 Plot();
1291                 break;
1292             }
1293             break;
1294         case kCM_COMBOBOX:
1295 //
1296 // Combo box bindings
1297             switch(parm1) {
1298 //
1299 // Material Combo
1300             case 1:
1301                 gCurrentMaterial=(AliGUIMaterial*) 
1302                     (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1303                 gCurrentMedium=(AliGUIMedium*) 
1304                     (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1305                 UpdateCombo();
1306                 UpdateListBox();
1307                 break;
1308 //
1309 // Media Combo
1310             case 2:
1311                 gCurrentMedium=(AliGUIMedium*) 
1312                     (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1313                 gCurrentMaterial=(AliGUIMaterial*) 
1314                     (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1315                 UpdateCombo();
1316                 UpdateListBox();
1317                 break;
1318 //
1319 // Particle Combo
1320             case 3:
1321                 gCurrentParticle=Int_t(parm2);
1322                 break;
1323 //
1324 // Mechanism Combo
1325             case 4:
1326                 gCurrentProcess=Int_t(parm2);
1327                 printf("\n Process %d", gCurrentProcess);
1328                 break;
1329             }
1330             break;
1331         case kCM_MENUSELECT:
1332             break;
1333             
1334         case kCM_MENU:
1335             switch (parm1) {
1336                 
1337             case M_FILE_OPEN:
1338             {
1339                 TGFileInfo fi;
1340                 fi.fFileTypes = (char **)filetypes;
1341                 new TGFileDialog(gClient->GetRoot(), this, kFDOpen,&fi);
1342             }
1343             break;
1344             
1345             case M_TEST_DLG:
1346                 fDialog = new AliGuiGeomDialog
1347                     (gClient->GetRoot(), this, 400, 200);
1348                 break;
1349                 
1350             case M_FILE_SAVE:
1351                 printf("M_FILE_SAVE\n");
1352                 break;
1353                 
1354             case M_FILE_EXIT:
1355                 CloseWindow();   // this also terminates theApp
1356                 break;
1357             default:
1358                 break;
1359             }
1360         default:
1361             break;
1362         }
1363     default:
1364         break;
1365     }
1366     return kTRUE;
1367 }
1368
1369 void AliGuiGeomMain::AddMaterial(AliGUIMaterial *Material, Int_t i)
1370 {
1371     char* tmp;
1372     tmp=Material->Name();
1373     Material->SetItemId(i);
1374     fMaterialCombo->AddEntry(tmp, i);
1375     fMaterialCombo->Select(i);
1376     fMaterialCombo->Resize(200, 20);
1377 }
1378
1379 void AliGuiGeomMain::AddMedium(AliGUIMedium *Medium, Int_t i)
1380 {
1381     char* tmp;
1382     tmp=Medium->Name();
1383     Medium->SetItemId(i);
1384     
1385     fMediaCombo->AddEntry(tmp, i);
1386     fMediaCombo->Select(i);
1387     fMediaCombo->Resize(200, 20);
1388 }
1389
1390
1391 AliGuiGeomDialog::AliGuiGeomDialog(const TGWindow *p, const TGWindow *main, UInt_t w,
1392                        UInt_t h, UInt_t options)
1393     : TGTransientFrame(p, main, w, h, options)
1394 {
1395    // Create a dialog window. A dialog window pops up with respect to its
1396    // "main" window.
1397
1398    fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
1399
1400    fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
1401    fOkButton->Associate(this);
1402    fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
1403    fCancelButton->Associate(this);
1404
1405    fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1406                            2, 2, 2, 2);
1407    fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
1408
1409    fFrame1->AddFrame(fOkButton, fL1);
1410    fFrame1->AddFrame(fCancelButton, fL1); 
1411
1412    fFrame1->Resize(150, fOkButton->GetDefaultHeight());
1413    AddFrame(fFrame1, fL2);
1414
1415    //--------- create Tab widget and some composite frames for Tab testing
1416
1417    fTab = new TGTab(this, 300, 300);
1418    fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
1419 //
1420 // Tab1: Sliders
1421 //
1422    TGCompositeFrame *tf = fTab->AddTab("Draw");
1423    fF1 = new AliGUISliders(tf, this, 60, 20);
1424    tf->AddFrame(fF1,fL3);
1425    
1426 // 
1427 // Tab2: Drawing Options
1428 //
1429    tf = fTab->AddTab("Options");
1430    fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1431                            200, 2, 2, 2);
1432    fF2 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1433
1434    fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "Shadow", 86), fL3);
1435    fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "Hide  ", 87), fL3);
1436    fF2->AddFrame(fChk3 = new TGCheckButton(fF2, "Clip  ", 88), fL3);
1437
1438    fF2->AddFrame(fLabel1 = new TGLabel(fF2, "Fill"),fL3);
1439    
1440    fCombo = new TGComboBox(fF2, 89);
1441    fF2->AddFrame(fCombo, fL3);
1442
1443    tf->AddFrame(fF2, fL3);
1444
1445    int i;
1446    for (i = 0; i < 8; i++) {
1447       char tmp[20];
1448
1449       sprintf(tmp, "%i", i+1);
1450       fCombo->AddEntry(tmp, i+1);
1451    }
1452    fCombo->Select(1);
1453    fCombo->Resize(50, 20);
1454    fCombo->Associate(this);
1455
1456    fChk1->Associate(this);
1457    fChk2->Associate(this);
1458    fChk3->Associate(this);
1459 // 
1460 // Tab3: Seen Option
1461 //
1462    tf = fTab->AddTab("Seen");
1463    fF3 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1464    fF3->AddFrame(fLabel2 = new TGLabel(fF3, "Seen"),fL3);
1465    fCombo2 = new TGComboBox(fF3, 90);
1466    fF3->AddFrame(fCombo2, fL3);
1467    tf->AddFrame(fF3, fL3);
1468
1469    for (i = 0; i < 4; i++) {
1470       char tmp[20];
1471
1472       sprintf(tmp, "%i", i-2);
1473       fCombo2->AddEntry(tmp, i+1);
1474    }
1475    fCombo2->Select(4);
1476    fCombo2->Resize(50, 20);
1477    fCombo2->Associate(this);
1478 // 
1479 // Tab4: Clip Box
1480 //
1481    tf = fTab->AddTab("ClipBox");
1482    //--- layout for buttons: top align, equally expand horizontally
1483    fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1484
1485    //--- layout for the frame: place at bottom, right aligned
1486    fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1487 //
1488 //  Frames
1489 //
1490 //  Slider1
1491    fF4 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1492        
1493    fHSframe1 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1494
1495    fTbh11 = new TGTextBuffer(10);
1496    fTeh11 = new TGTextEntry(fHSframe1, fTbh11,1);
1497    fTbh11->AddText(0, "   0");
1498    fTeh11->Associate(this);
1499
1500    fTbh12 = new TGTextBuffer(10);
1501    fTeh12 = new TGTextEntry(fHSframe1, fTbh12,1);
1502    fTbh12->AddText(0, "2000");
1503    fTeh12->Associate(this);
1504     
1505    fDslider1 = new TGDoubleHSlider(fHSframe1, 400, kSlider1 | kScaleBoth, 1);
1506    fDslider1->Associate(this);
1507    fDslider1->SetRange(-2000, 2000);
1508    fDslider1->SetPosition(0, 2000);
1509    
1510    fSLabel1 = new TGLabel(fHSframe1, "xmin-xmax");
1511
1512    fHSframe1->AddFrame(fSLabel1, fBfly1);
1513    fHSframe1->AddFrame(fTeh11, fBfly1);
1514    fHSframe1->AddFrame(fTeh12, fBfly1);
1515    fHSframe1->AddFrame(fDslider1, fBfly1);
1516    
1517    fF4->AddFrame(fHSframe1, fBly);
1518
1519 //
1520    fHSframe2 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1521
1522    fTbh21 = new TGTextBuffer(10);
1523    fTeh21 = new TGTextEntry(fHSframe2, fTbh21,1);
1524    fTbh21->AddText(0, "   0");
1525    fTeh21->Associate(this);
1526
1527    fTbh22 = new TGTextBuffer(10);
1528    fTeh22 = new TGTextEntry(fHSframe2, fTbh22,1);
1529    fTbh22->AddText(0, "2000");
1530    fTeh22->Associate(this);
1531
1532    fDslider2 = new TGDoubleHSlider(fHSframe2, 400, kSlider1 | kScaleBoth, 2);
1533    fDslider2->Associate(this);
1534    fDslider2->SetRange(-2000, 2000);
1535    fDslider2->SetPosition(0, 2000);
1536    
1537    fSLabel2 = new TGLabel(fHSframe2, "ymin-ymax");
1538
1539    fHSframe2->AddFrame(fSLabel2, fBfly1);
1540    fHSframe2->AddFrame(fTeh21, fBfly1);
1541    fHSframe2->AddFrame(fTeh22, fBfly1);
1542    fHSframe2->AddFrame(fDslider2, fBfly1);
1543    
1544    fF4->AddFrame(fHSframe2, fBly);
1545
1546 //
1547    fHSframe3 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1548
1549    fTbh31 = new TGTextBuffer(10);
1550    fTeh31 = new TGTextEntry(fHSframe3, fTbh31,1);
1551    fTbh31->AddText(0, "   0");
1552    fTeh31->Associate(this);
1553
1554    fTbh32 = new TGTextBuffer(10);
1555    fTeh32 = new TGTextEntry(fHSframe3, fTbh32,1);
1556    fTbh32->AddText(0, "2000");
1557    fTeh32->Associate(this);
1558
1559    fDslider3 = new TGDoubleHSlider(fHSframe3, 400, kSlider1 | kScaleBoth, 3);
1560    fDslider3->Associate(this);
1561    fDslider3->SetRange(-2000, 2000);
1562    fDslider3->SetPosition(0, 2000);
1563    
1564    fSLabel3 = new TGLabel(fHSframe3, "zmin-zmax");
1565
1566    fHSframe3->AddFrame(fSLabel3, fBfly1);
1567    fHSframe3->AddFrame(fTeh31, fBfly1);
1568    fHSframe3->AddFrame(fTeh32, fBfly1);
1569    fHSframe3->AddFrame(fDslider3, fBfly1);
1570    
1571    fF4->AddFrame(fHSframe3, fBly);
1572    tf->AddFrame(fF4, fL3);
1573 //
1574 //
1575    TGLayoutHints *fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
1576                                           kLHintsExpandY, 2, 2, 5, 1);
1577    AddFrame(fTab, fL5);
1578
1579    MapSubwindows();
1580    Resize(GetDefaultSize());
1581
1582    // position relative to the parent's window
1583    Window_t wdum;
1584    int ax, ay;
1585    gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
1586                           (((TGFrame *) main)->GetWidth() - fWidth) >> 1,
1587                           (((TGFrame *) main)->GetHeight() - fHeight) >> 1,
1588                           ax, ay, wdum);
1589    Move(ax, ay);
1590
1591    SetWindowName("Dialog");
1592
1593    MapWindow();
1594    //gClient->WaitFor(this);    // otherwise canvas contextmenu does not work
1595 }
1596
1597 AliGuiGeomDialog::~AliGuiGeomDialog()
1598 {
1599    // Delete test dialog widgets.
1600
1601    delete fOkButton;
1602    delete fCancelButton;
1603    delete fFrame1;
1604    delete fChk1; delete fChk2;
1605    delete fF1; delete fF2; delete fF3; delete fF4;
1606    delete fCombo;
1607    delete fTab;
1608    delete fL3; delete fL4;
1609    delete fL1; delete fL2;
1610    delete fBly; delete fBfly1;
1611    delete fTbh11; delete fTbh12; delete fTbh21; delete fTbh22; 
1612    delete fTbh31; delete fTbh32; delete fTeh11; delete fTeh12; 
1613    delete fTeh21; delete fTeh22; delete fTeh31; delete fTeh32;
1614    delete fDslider1; delete fDslider2; delete fDslider3;
1615    delete fSLabel1;  delete fSLabel2;  delete fSLabel3;
1616 }
1617
1618 void AliGuiGeomDialog::Update()
1619 {
1620     
1621     Float_t param;
1622 //  Update Sliders
1623     if (fF1) {
1624         fF1->Update();
1625     }
1626 //  Seen
1627     if (fCombo2) {
1628         param=gCurrentVolume->GetParam(P_Seen);
1629         fCombo2->Select(Int_t(param)+3);
1630     }
1631 //  Hide, Shadow, Clip
1632     if (fChk1) {
1633         if (Int_t(gCurrentVolume->GetParam(P_Shadow))) {
1634             fChk1->SetState(kButtonDown);
1635         } else {
1636             fChk1->SetState(kButtonUp);
1637         }
1638     }
1639
1640     if (fChk2) {
1641         if (Int_t(gCurrentVolume->GetParam(P_Hide))) {
1642             fChk2->SetState(kButtonDown);
1643         } else {
1644             fChk2->SetState(kButtonUp);
1645         }
1646     }
1647
1648     if (fChk3) {
1649         if (Int_t(gCurrentVolume->GetParam(P_Clip))) {
1650             fChk3->SetState(kButtonDown);
1651         } else {
1652             fChk3->SetState(kButtonUp);
1653         }
1654     }
1655     
1656 }
1657
1658 void AliGuiGeomDialog::CloseWindow()
1659 {
1660    // Called when window is closed via the window manager.
1661    delete this;
1662 }
1663
1664 Bool_t AliGuiGeomDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1665 {
1666    // Process messages coming from widgets associated with the dialog.
1667     char buf[10];
1668     Float_t min,max;
1669     switch (GET_MSG(msg)) {
1670     case kC_HSLIDER:
1671         switch (GET_SUBMSG(msg)) {
1672         case kSL_POS:
1673             switch (Int_t(parm1)) {
1674             case 1:
1675                 min=fDslider1->GetMinPosition();
1676                 max=fDslider1->GetMaxPosition();
1677                 sprintf(buf, "%6.2f", min);
1678                 fTbh11->Clear();
1679                 fTbh11->AddText(0, buf);
1680                 sprintf(buf, "%6.2f", max);
1681                 fTbh12->Clear();
1682                 fTbh12->AddText(0, buf);
1683                 gClient->NeedRedraw(fTeh11);
1684                 gClient->NeedRedraw(fTeh12);
1685                 gCurrentVolume->SetParam(P_ClipXmin,min);
1686                 gCurrentVolume->SetParam(P_ClipXmax,max);
1687                 break;
1688             case 2:
1689                 min=fDslider2->GetMinPosition();
1690                 max=fDslider2->GetMaxPosition();
1691                 sprintf(buf, "%6.2f", min);
1692                 fTbh21->Clear();
1693                 fTbh21->AddText(0, buf);
1694                 sprintf(buf, "%6.2f", max);
1695                 fTbh22->Clear();
1696                 fTbh22->AddText(0, buf);
1697                 gClient->NeedRedraw(fTeh21);
1698                 gClient->NeedRedraw(fTeh22);
1699                 gCurrentVolume->SetParam(P_ClipYmin,min);
1700                 gCurrentVolume->SetParam(P_ClipYmax,max);
1701                 break;
1702             case 3:
1703                 min=fDslider3->GetMinPosition();
1704                 max=fDslider3->GetMaxPosition();
1705                 sprintf(buf, "%6.2f", min);
1706                 fTbh31->Clear();
1707                 fTbh31->AddText(0, buf);
1708                 sprintf(buf, "%6.2f", max);
1709                 fTbh32->Clear();
1710                 fTbh32->AddText(0, buf);
1711                 gClient->NeedRedraw(fTeh31);
1712                 gClient->NeedRedraw(fTeh32);
1713                 gCurrentVolume->SetParam(P_ClipZmin,min);
1714                 gCurrentVolume->SetParam(P_ClipZmax,max);
1715                 break;
1716             default:
1717                 break;
1718             }
1719         }
1720         break;
1721     case kC_COMMAND:
1722         switch (GET_SUBMSG(msg)) {
1723         case kCM_BUTTON:
1724             switch(parm1) {
1725             case 1:
1726             case 2:
1727                 printf("\nTerminating dialog: %s pressed\n",
1728                        (parm1 == 1) ? "OK" : "Cancel");
1729                 CloseWindow();
1730                 break;
1731             }
1732             break;
1733         case kCM_COMBOBOX:
1734             switch(parm1) {
1735             case 89:
1736                 gCurrentVolume->SetParam(P_Fill, Float_t(parm2));
1737                 gCurrentVolume->Draw();
1738                 break;
1739             case 90:
1740                 gCurrentVolume->SetParam(P_Seen, Float_t(parm2-3));
1741                 gCurrentVolume->Draw();
1742                 break;
1743             }
1744             break;
1745         case kCM_CHECKBUTTON:
1746             switch (parm1) {
1747             case 86:
1748                 if (Int_t(gCurrentVolume->GetParam(P_Shadow))) {
1749                     gCurrentVolume->SetParam(P_Shadow, 0.);
1750                 } else {
1751                     gCurrentVolume->SetParam(P_Shadow, 1.);
1752                 }
1753                 gCurrentVolume->Draw();
1754                 break;
1755             case 87:
1756                 if (Int_t(gCurrentVolume->GetParam(P_Hide))) {
1757                     gCurrentVolume->SetParam(P_Hide, 0.);
1758                 } else {
1759                     gCurrentVolume->SetParam(P_Hide, 1.);
1760                 }
1761                 gCurrentVolume->Draw();
1762                 break;
1763             case 88:
1764                 if (Int_t(gCurrentVolume->GetParam(P_Clip))) {
1765                     gCurrentVolume->SetParam(P_Clip, 0.);
1766                 } else {
1767                     gCurrentVolume->SetParam(P_Clip, 1.);
1768                 }
1769                 gCurrentVolume->Draw();
1770                 break;
1771
1772             default:
1773                 break;
1774             }
1775             break;
1776         case kCM_TAB:
1777             break;
1778         default:
1779             break;
1780         }
1781         break;
1782     default:
1783         break;
1784     }
1785     return kTRUE;
1786 }
1787
1788 static Text_t* LabelText[7]  = 
1789 {"Theta  ", "Phi    ", "Psi    ", "U      ", "V      ", "UScale", "VScale"};
1790 static Int_t   IRangeMin[7]  = {    0,     0,     0,    0,    0,   0,   0};
1791 static Int_t   IRangeMax[7]  = {36000, 36000, 36000, 2000, 2000, 10, 10};
1792 static Int_t   DefaultPos[7] = { 3000,  4000,     0, 1000, 1000,   1,   1};
1793
1794 AliGUISliders::AliGUISliders(const TGWindow *p, const TGWindow *,
1795                          UInt_t w, UInt_t h) :
1796     TGCompositeFrame(p, w, h,kVerticalFrame)
1797 {
1798     ChangeOptions((GetOptions() & ~kHorizontalFrame) | kVerticalFrame);
1799    //--- layout for buttons: top align, equally expand horizontally
1800     fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1801
1802    //--- layout for the frame: place at bottom, right aligned
1803     fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1804 //
1805 // Frames
1806
1807    for (Int_t i=0; i<7; i++) {
1808        Int_t idT=i+1;
1809        Int_t idS=i+8;       
1810        fHframe[i] = new TGHorizontalFrame(this, 400, 100, kFixedWidth);
1811        fTbh[i] = new TGTextBuffer(10);
1812        fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
1813        char buf[10];
1814        sprintf(buf, "%6.2f", Float_t(DefaultPos[i])/100);
1815        fTbh[i]->AddText(0, buf);
1816        fTeh[i]->Associate(this);
1817        
1818        fHslider[i] = new TGHSlider(fHframe[i], 400, kSlider1 | kScaleBoth, idS);
1819        fHslider[i]->Associate(this);
1820        fHslider[i]->SetRange(IRangeMin[i], IRangeMax[i]);
1821        fHslider[i]->SetPosition(DefaultPos[i]);
1822
1823        fLabel[i] = new TGLabel(fHframe[i], LabelText[i]);
1824        
1825        
1826        fHframe[i]->AddFrame(fLabel[i], fBfly1);
1827        fHframe[i]->AddFrame(fTeh[i], fBfly1);
1828        fHframe[i]->AddFrame(fHslider[i], fBfly1);
1829        AddFrame(fHframe[i], fBly);
1830    }
1831 }
1832
1833 AliGUISliders::~AliGUISliders()
1834 {
1835     delete fBfly1; delete fBly;
1836    // Delete dialog.
1837     for (Int_t i=1; i<7; i++) {
1838         delete fHframe[i];
1839         delete fHslider[i];
1840         delete fTeh[i];
1841         delete fTbh[i]; 
1842     }
1843 }
1844
1845 void AliGUISliders::Update()
1846 {
1847     char buf[10];
1848     
1849     for (Int_t i=0; i<7; i++) {
1850         Float_t param = gCurrentVolume->GetParam(i);
1851 //
1852         fHslider[i]->SetPosition(Int_t(param*100.));
1853         gClient->NeedRedraw(fHslider[i]);
1854 //
1855         sprintf(buf, "%6.2f", param);
1856         fTbh[i]->Clear();
1857         fTbh[i]->AddText(0, buf);
1858         gClient->NeedRedraw(fTeh[i]);
1859 //
1860     }
1861
1862     
1863 }
1864
1865 void AliGUISliders::CloseWindow()
1866 {
1867    // Called when window is closed via the window manager.
1868
1869    delete this;
1870 }
1871
1872 Bool_t AliGUISliders::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1873 {
1874    // Process slider messages.
1875
1876    char buf[10];
1877
1878    switch (GET_MSG(msg)) {
1879    case kC_TEXTENTRY:
1880        switch (GET_SUBMSG(msg)) {
1881        case kTE_TEXTCHANGED:
1882            Int_t idT=Int_t(parm1)-1;
1883            fHslider[idT]->SetPosition((Int_t)atof(fTbh[idT]->GetString())*100);
1884            gClient->NeedRedraw(fHslider[idT]);
1885            gCurrentVolume->SetParam(idT,atof(fTbh[idT]->GetString()));
1886            gCurrentVolume->Draw();
1887        }
1888        break;
1889    case kC_HSLIDER:
1890        switch (GET_SUBMSG(msg)) {
1891        case kSL_POS:
1892            sprintf(buf, "%6.2f", Float_t(parm2)/100);
1893            Int_t idS=Int_t(parm1)-8;
1894            fTbh[idS]->Clear();
1895            fTbh[idS]->AddText(0, buf);
1896            gClient->NeedRedraw(fTeh[idS]);
1897            gCurrentVolume->SetParam(idS, Float_t(parm2)/100.);
1898            gCurrentVolume->Draw();
1899        }
1900        break;
1901    }
1902    return kTRUE;
1903 }
1904
1905 ClassImp(AliGUIMaterial)
1906
1907 AliGUIMaterial::AliGUIMaterial()
1908
1909     fId=-1;
1910     fName = 0; 
1911     fA=-1; 
1912     fZ=-1; 
1913     fDensity=-1;
1914     fRadl=-1;   
1915     fAbsl=-1;    
1916 }
1917
1918 AliGUIMaterial::AliGUIMaterial(Int_t imat, char* name, Float_t a, Float_t z,
1919                    Float_t dens, Float_t radl, Float_t absl)
1920
1921     fId=imat;
1922     fName=name;
1923     fA=a; 
1924     fZ=z; 
1925     fDensity=dens;
1926     fRadl=radl;   
1927     fAbsl=absl;    
1928 }
1929 void AliGUIMaterial::Dump()
1930 {
1931     printf("\n *****************************************");
1932     printf("\n Material Number:   %10d", fId);
1933     printf("\n %s", fName);
1934     printf("\n Mass   Number:     %10.2f", fA);    
1935     printf("\n Charge Number:     %10.2f", fZ);
1936     printf("\n Density:           %10.2f", fDensity);
1937     printf("\n Radiation  Length: %10.2f", fRadl);
1938     printf("\n Absorption Length: %10.2f", fAbsl);              
1939 }
1940
1941 Int_t AliGUIMaterial::Id()
1942 {
1943     return fId;
1944 }
1945
1946 char*  AliGUIMaterial::Name()
1947 {
1948     return fName;
1949 }
1950
1951 Float_t  AliGUIMaterial::A()
1952 {
1953     return fA;
1954 }
1955
1956 Float_t  AliGUIMaterial::Z()
1957 {
1958     return fZ;
1959 }
1960
1961 Float_t  AliGUIMaterial::Density()
1962 {
1963     return fDensity;
1964 }
1965
1966 Float_t  AliGUIMaterial::RadiationLength()
1967 {
1968     return fRadl;
1969 }
1970
1971 Float_t  AliGUIMaterial::AbsorptionLength()
1972 {
1973     return fAbsl;
1974 }
1975
1976
1977 void AliGUIMaterial::Plot()
1978 {
1979     ;
1980 }
1981
1982 void AliGUIMaterial::Streamer(TBuffer &)
1983 {
1984 ;
1985 }
1986
1987 ClassImp(AliGUIMedium)
1988
1989 AliGUIMedium::AliGUIMedium()
1990
1991     fId=-1;
1992     fName = 0; 
1993 }
1994
1995 AliGUIMedium::AliGUIMedium(Int_t imed, Int_t imat, char* name, Int_t isvol, 
1996                            Int_t ifield,
1997                            Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax,
1998                            Float_t epsil, Float_t stmin)
1999 {
2000     fId=imed;
2001     fIdMat=imat;
2002     fName=name;
2003     fIsvol=isvol;
2004     fIfield=ifield;
2005     fFieldm=fieldm;
2006     fTmaxfd=tmaxfd;
2007     fStemax=stemax;
2008     fDeemax=deemax;
2009     fEpsil=epsil;
2010     fStmin=stmin;
2011 }
2012
2013 void AliGUIMedium::Dump()
2014 {
2015     ;
2016 }
2017
2018 Int_t AliGUIMedium::Id()
2019 {
2020     return fId;
2021 }
2022
2023 char*  AliGUIMedium::Name()
2024 {
2025     return fName;
2026 }
2027
2028 Float_t AliGUIMedium::GetPar(Int_t ipar)
2029
2030     Float_t p;
2031     if (ipar < 23) {
2032         p= fPars[ipar-1];   
2033     } else if(ipar >=23 && ipar <27) {
2034         p= fPars[ipar-1+3];   
2035     } else {
2036         p= fPars[ipar-1+4];   
2037     }
2038     
2039     return p;
2040 }
2041  
2042 void AliGUIMedium::Streamer(TBuffer &)
2043 {
2044 ;
2045 }
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060