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 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 **************************************************************************/
18 Revision 1.3 1999/11/14 14:31:14 fca
19 Correct small error and remove compilation warnings on HP
21 Revision 1.2 1999/11/10 16:53:35 fca
22 The new geometry viewer from A.Morsch
28 * Written by Andreas Morsch
32 * For questions critics and suggestions to this part of the code
33 * contact andreas.morsch@cern.ch
35 **************************************************************************/
42 #include <TApplication.h>
43 #include <TVirtualX.h>
44 #include <TGListBox.h>
45 #include <TGListTree.h>
51 #include <TGTextEntry.h>
55 #include <TGComboBox.h>
58 #include <TGDoubleSlider.h>
59 #include <TGFileDialog.h>
60 #include <TRootEmbeddedCanvas.h>
67 #include <TGPicture.h>
70 #include "TGeant3GUI.h"
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;
78 ClassImp(AliGeant3GeometryGUI)
80 AliGeant3GeometryGUI::AliGeant3GeometryGUI()
82 fPanel = new AliGuiGeomMain(gClient->GetRoot(), 500, 500);
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;
93 fGclink=geant3->Gclink();
94 fGcnum=geant3->Gcnum();
100 void AliGeant3GeometryGUI::Streamer(TBuffer &)
106 void AliGeant3GeometryGUI::ReadGeometryTree()
109 // Copy zebra volume tree into ROOT LisTree
112 char /* *namec, */ *tmp;
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");
120 const TGPicture* Document = gClient->GetPicture("doc_t.xpm");
122 AliDrawVolume *volume;
126 Int_t newlevel=nlevel;
128 volume = new AliDrawVolume("ALIC");
129 volume->SetIdVolume(((TGeant3*)gMC)->VolId("ALIC"));
130 volume->SetIdCopy(0);
131 volume->SetItem(NULL);
132 (*fVolumes)[0]=volume;
134 // Loop over volumes for which information has been collected
136 for (Int_t i=nst; i<nlevel; i++)
138 TGListTreeItem *itemi, *item2;
139 // GEANT3 volume number
140 Int_t ivol=TMath::Abs(Volume(i)->GetIdVolume());
142 // icopy=1 normal positioning
143 // icopy>1 positioning with parposp
145 Int_t icopy = Volume(i)->GetIdCopy();
146 // Medium and material number, handle special case of divisions
151 imat=Material(-ivol);
157 // Number of children
158 Int_t nch = NChildren(ivol);
159 strcpy(namec,((TGeant3*)gMC)->VolName(ivol));
161 printf("\n %s has %d children \n ", namec, nch);
163 printf("\n %s has divisions \n ", namec);
166 // Name to be used in ListTree
168 strncpy(vname,namec, 4);
172 sprintf(namec,"%s*%3dPos",namec,icopy);
173 } else if (icopy <0) {
174 sprintf(namec,"%s*%3dDiv",namec,-icopy);
177 itemi=Volume(i)->GetItem();
183 // Add volume to list tree
186 item2 = fPanel->AddItem(new AliDrawVolume(vname),
187 itemi, namec, OpenFolder, Folder);
189 item2 = fPanel->AddItem(new AliDrawVolume(vname),
190 itemi, namec, Document, Document);
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);
198 // Set current volume to first list tree entry
199 if (!i) gCurrentVolume= ((AliDrawVolume *) item2->GetUserData());
202 // Collect children information
204 // nch < 0: Children by division
207 // Geant volume number
208 Int_t icvol=Child(ivol,1);
210 strcpy(namec,((TGeant3*)gMC)->VolName(-icvol));
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);
221 volume->SetItem(item2);
222 (*fVolumes)[newlevel]=volume;
223 printf("\n volume %s %d %d %d", namec, icvol, nch, ndiv);
226 // Children by positioning
229 // Loop over children
230 for (Int_t j=0; j<nch; j++)
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++) {
239 Volume(newlevel-k-1)->GetIdVolume())
241 Volume(newlevel-k-1)->AddCopy();
250 strcpy(namec,((TGeant3*)gMC)->VolName(icvol));
252 strncpy(tmp,(char *) &namec, 4);
253 volume = new AliDrawVolume(namec);
254 volume->SetIdVolume(icvol);
255 volume->SetIdCopy(1);
257 volume->SetItem(item2);
258 (*fVolumes)[newlevel]=volume;
259 printf("\n volume %s %d %d", namec, icvol, nch);
266 // Move one level deaper
272 void AliGeant3GeometryGUI::ReadMaterials()
275 // Puts media and material names into ComboBox and
276 // collects material information
278 Float_t a, z, dens, radl, absl;
279 a=z=dens=radl=absl=-1;
281 Int_t imat, isvol, ifield;
282 Float_t fieldm, tmaxfd, stemax, deemax, epsil, stmin;
287 char natmed[21], namate[21];
292 for(Int_t itm=1;itm<=fGcnum->ntmed;itm++) {
293 Int_t jtm = fZlq[fGclink->jtmed-itm];
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);
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));
311 for (Int_t j=23; j<=26; j++) {
312 medium->SetPar(j,Cut(itm,j+3));
314 for (Int_t j=27; j<=29; j++) {
315 medium->SetPar(j,Cut(itm,j+4));
319 fPanel->AddMedium(medium, NEntries);
321 // Associated material
322 imat = Int_t (fZq[jtm+6]);
323 Int_t jma = Int_t (fZlq[fGclink->jmate-imat]);
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);
330 // Create new material object
331 AliGUIMaterial * material =
332 new AliGUIMaterial(imat,namate,a,z,dens,radl,absl);
333 (*fMaterials)[NEntries-1]=material;
337 fPanel->AddMaterial(material, NEntries);
338 gCurrentMaterial=material;
341 fPanel->SetComboEntries(fMaterials);
342 fPanel->SetMediaComboEntries(fMedia);
346 Int_t AliGeant3GeometryGUI::NChildren(Int_t idvol)
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]);
355 Int_t AliGeant3GeometryGUI::Child(Int_t idvol, Int_t idc)
358 // Return GEANT id of child number idc of volume idvol
359 Int_t jvo = fZlq[fGclink->jvolum-idvol];
361 Int_t jin = fZlq[jvo-nin];
362 Int_t numb = Int_t (fZq[jin +3]);
364 return -Int_t(fZq[jin+2]);
366 return Int_t(fZq[jin+2]);
370 Int_t AliGeant3GeometryGUI::Medium(Int_t idvol)
373 // Return medium number for volume idvol.
374 // If idvol is negative the volume results from a division.
377 Int_t jvo = fZlq[fGclink->jvolum-idvol];
378 imed = Int_t(fZq[jvo+4]);
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]);
389 Int_t AliGeant3GeometryGUI::Material(Int_t idvol)
391 // Return material number for volume idvol.
392 // If idvol is negative the volume results from a division.
394 Int_t imed=Medium(idvol);
395 Int_t jtm = fZlq[fGclink->jtmed-imed];
396 return Int_t (fZq[jtm+6]);
400 Float_t AliGeant3GeometryGUI::Cut(Int_t imed, Int_t icut)
402 // Return cuts icut for medium idmed
404 Int_t jtm = fZlq[fGclink->jtmed-imed];
406 // Have the defaults been modified ??
407 Int_t jtmn = fZlq[jtm];
415 return Float_t (fZq[jtm+icut]);
418 ClassImp(AliDrawVolume)
420 // Drawing parameter tags
421 enum AliDrawParamId {
443 AliDrawVolume::AliDrawVolume(char* name)
466 char* AliDrawVolume::Name()
469 // Return volume name
474 void AliDrawVolume::Streamer(TBuffer &)
481 void AliDrawVolume::Draw(Option_t *)
483 gMC->Gsatt(fName,"seen", fSeen);
486 gMC->Gdopt("hide", "on");
488 gMC->Gdopt("hide", "off");
492 gMC->Gdopt("shad", "on");
493 gMC->Gsatt("*", "fill", fFill);
495 gMC->Gdopt("shad", "off");
498 gMC->SetClipBox(".");
500 gMC->SetClipBox("*", fClipXmin, fClipXmax,
501 fClipYmin, fClipYmax, fClipZmin, fClipZmax);
503 gMC->SetClipBox(".");
507 gMC->Gdraw(fName, fTheta, fPhi, fPsi, fU, fV, fUscale, fVscale);
508 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
509 if (higz) higz->Update();
512 void AliDrawVolume::DrawSpec()
514 gMC->Gsatt(fName,"seen", fSeen);
517 gMC->Gdopt("hide", "on");
519 gMC->Gdopt("hide", "off");
523 gMC->Gdopt("shad", "on");
524 gMC->Gsatt("*", "fill", fFill);
526 gMC->Gdopt("shad", "off");
529 gMC->SetClipBox(".");
531 gMC->SetClipBox("*", fClipXmin, fClipXmax, fClipYmin, fClipYmax, fClipZmin, fClipZmax);
533 gMC->SetClipBox(".");
537 ((TGeant3*) gMC)->DrawOneSpec(fName);
538 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
539 if (higz) higz->Update();
542 void AliDrawVolume::SetParam(Int_t ip, Float_t param)
570 fShadow=Int_t(param);
602 Float_t AliDrawVolume::GetParam(Int_t ip)
620 return Float_t(fHide);
622 return Float_t(fShadow);
624 return Float_t(fFill);
626 return Float_t(fSeen);
628 return Float_t(fClip);
648 ClassImp(AliGuiGeomMain)
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 "};
656 const Text_t* LabelTextC[10] =
657 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
658 "DCUTE ", "DCUTM ", "PPCUTM"};
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-"};
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"};
676 enum ETestCommandIdentifiers {
701 Int_t mb_button_id[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
702 kMBRetry, kMBIgnore, kMBCancel,
703 kMBClose, kMBDismiss };
705 EMsgBoxIcon mb_icon[4] = { kMBIconStop, kMBIconQuestion,
706 kMBIconExclamation, kMBIconAsterisk };
708 const char *filetypes[] = { "All files", "*",
709 "ROOT files", "*.root",
710 "ROOT macros", "*.C",
716 TGListTreeItem* AliGuiGeomMain::
717 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
719 return fLt->AddItem(parent, name, obj, open, closed);
722 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
723 : TGMainFrame(p, w, h)
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,
731 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
732 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
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);
742 fMenuFile->DisableEntry(M_FILE_SAVEAS);
743 fMenuFile->DisableEntry(M_FILE_OPEN);
744 fMenuFile->DisableEntry(M_FILE_SAVE);
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);
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);
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);
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);
776 AddFrame(fMenuBar, fMenuBarLayout);
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);
787 // Create TGCanvas and a canvas container which uses a tile layout manager
788 fCanvasWindow = new TGCanvas(tf, 400, 240);
790 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
792 fLt->Associate(this);
793 fCanvasWindow->SetContainer(fLt);
796 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
797 tf->AddFrame(fCanvasWindow, lo);
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);
808 // text labels with material properties
810 Text_t* LabelText[6] =
816 "Absorption Length"};
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++) {
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);
835 tf->AddFrame(fF2, fL2);
836 fMaterialCombo->Resize(200, 20);
837 fMaterialCombo->Associate(this);
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);
848 // text labels with material properties
850 Text_t* LabelTextM[8] =
851 {"Sensitivity Flag ",
852 "Magnetic Field Flag ",
854 "Max. Ang. Deviation ",
856 "Max. Frac. Energy Loss",
857 "Crossing Precission ",
858 "Minimum Step Size "};
860 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
861 fF3->AddFrame(fF31,fL2);
862 for (Int_t i=0; i<8; i++) {
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);
873 tf->AddFrame(fF3, fL2);
874 fMediaCombo->Resize(200, 20);
875 fMediaCombo->Associate(this);
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);
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);
896 // de/dx and cross-sections
897 tf = fTab->AddTab("DE/DX and X-Sections");
898 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
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);
906 for (i = 0; i < 24; i++) {
908 sprintf(tmp, "%s", LabelTextPart[i]);
909 fParticleCombo->AddEntry(tmp, i+1);
911 fParticleCombo->Select(1);
912 fParticleCombo->Resize(100, 20);
913 fParticleCombo->Associate(this);
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++) {
922 sprintf(tmp, "%s", LabelTextMechanism[i]);
923 fMechanismCombo->AddEntry(tmp, i+1);
925 fMechanismCombo->Select(1);
926 fMechanismCombo->Resize(100, 20);
927 fMechanismCombo->Associate(this);
932 fTbh61 = new TGTextBuffer(10);
933 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
934 fTbh61->AddText(0, " 100");
935 fTeh61->Associate(this);
937 fTbh62 = new TGTextBuffer(10);
938 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
939 fTbh62->AddText(0, "0.001");
940 fTeh62->Associate(this);
942 fTbh63 = new TGTextBuffer(10);
943 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
944 fTbh63->AddText(0, "10.");
945 fTeh63->Associate(this);
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);
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);
965 tf->AddFrame(fF6, fL2);
966 // Window name and final mapping
968 SetWindowName("AliRoot Geometry Browser");
970 // We need to use GetDefault...() to initialize the layout algorithm...
971 Resize(GetDefaultSize());
975 AliGuiGeomMain::~AliGuiGeomMain()
977 // Delete all created widgets.
980 delete fCanvasWindow;
982 delete fMenuBarLayout;
983 delete fMenuBarItemLayout;
984 delete fMenuBarHelpLayout;
991 void AliGuiGeomMain::Streamer(TBuffer &)
996 void AliGuiGeomMain::Plot()
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];
1003 Int_t imate=gCurrentMaterial->Id();
1004 Float_t z=gCurrentMaterial->Z();
1005 Float_t a=gCurrentMaterial->A();
1006 Float_t density=gCurrentMaterial->Density();
1008 Int_t ipart=gCurrentParticle;
1009 const char *chmeca= LabelTextMechanism[gCurrentProcess-1];
1012 strncpy(tmp, chmeca, 4);
1015 Float_t de=(fEmax-fEmin)/fNbins;
1016 for (Int_t i=0; i<kdim; i++) {
1017 tkin[i]=fEmin+Float_t(i)*de;
1020 if (chmeca!="MUON") {
1021 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
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;
1032 printf("\n %d %d %s %d \n",imate, ipart, chmeca, kdim);
1034 TGraph *graph = new TGraph(kdim,tkin,value);
1035 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
1039 graph->SetFillColor(42);
1040 graph->SetMarkerColor(4);
1041 graph->SetMarkerStyle(21);
1043 graph->GetHistogram()->SetXTitle("Energy (GeV)");
1044 if (chmeca == "RANG" || chmeca == "STEP") {
1045 graph->GetHistogram()->SetYTitle
1047 } else if (chmeca == "LOSS" || chmeca == "MUON") {
1048 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
1050 graph->GetHistogram()->SetYTitle
1051 ("Macroscopic X-Section (1/cm)");
1062 void AliGuiGeomMain::Update()
1068 Int_t imat=gCurrentVolume->Material();
1069 Int_t nmat=fComboEntries->GetEntriesFast();
1071 for (i=0; i<nmat; i++) {
1072 gCurrentMaterial = (AliGUIMaterial*)
1073 (fComboEntries->UncheckedAt(i));
1074 if (gCurrentMaterial->Id()==imat) break;
1076 gCurrentMedium = (AliGUIMedium*)
1077 (fComboMediaEntries->UncheckedAt(i));
1083 void AliGuiGeomMain::UpdateCombo()
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();
1095 fMaterialCombo->Select(entry);
1096 fMediaCombo->Select(entry);
1099 sprintf(buf, "%10i", imat);
1101 fTbh[0]->AddText(0, buf);
1102 gClient->NeedRedraw(fTeh[0]);
1103 sprintf(buf, "%10.2e", a);
1105 fTbh[1]->AddText(0, buf);
1106 gClient->NeedRedraw(fTeh[1]);
1108 sprintf(buf, "%10.2e", z);
1110 fTbh[2]->AddText(0, buf);
1111 gClient->NeedRedraw(fTeh[2]);
1113 sprintf(buf, "%10.2e", dens);
1115 fTbh[3]->AddText(0, buf);
1116 gClient->NeedRedraw(fTeh[3]);
1118 sprintf(buf, "%10.2e", radl);
1120 fTbh[4]->AddText(0, buf);
1121 gClient->NeedRedraw(fTeh[4]);
1123 sprintf(buf, "%10.2e", absl);
1125 fTbh[5]->AddText(0, buf);
1126 gClient->NeedRedraw(fTeh[5]);
1129 sprintf(buf, "%10i", gCurrentMedium->Isvol());
1131 fTbhM[0]->AddText(0, buf);
1132 gClient->NeedRedraw(fTehM[0]);
1135 sprintf(buf, "%10i", gCurrentMedium->Ifield());
1137 fTbhM[1]->AddText(0, buf);
1138 gClient->NeedRedraw(fTehM[1]);
1140 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
1142 fTbhM[2]->AddText(0, buf);
1143 gClient->NeedRedraw(fTehM[2]);
1145 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
1147 fTbhM[3]->AddText(0, buf);
1148 gClient->NeedRedraw(fTehM[3]);
1150 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
1152 fTbhM[4]->AddText(0, buf);
1153 gClient->NeedRedraw(fTehM[4]);
1155 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
1157 fTbhM[5]->AddText(0, buf);
1158 gClient->NeedRedraw(fTehM[5]);
1160 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
1162 fTbhM[6]->AddText(0, buf);
1163 gClient->NeedRedraw(fTehM[6]);
1165 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
1167 fTbhM[7]->AddText(0, buf);
1168 gClient->NeedRedraw(fTehM[7]);
1171 void AliGuiGeomMain::UpdateListBox()
1174 fProcessLB->RemoveEntries(1,19);
1175 for (i=11; i < 30; i++) {
1176 Float_t p=gCurrentMedium->GetPar(i);
1178 sprintf(tmp, "%6s%5d", LabelTextP[i-11], Int_t(p));
1179 fProcessLB->AddEntry(tmp, i-10);
1181 fProcessLB->MapSubwindows();
1182 fProcessLB->Layout();
1184 fCutsLB->RemoveEntries(1,10);
1185 for (i=1; i < 11; i++) {
1186 Float_t p=gCurrentMedium->GetPar(i);
1188 sprintf(tmp, "%6s%10.3e", LabelTextC[i-1], p);
1189 fCutsLB->AddEntry(tmp,i);
1191 fCutsLB->MapSubwindows();
1196 void AliGuiGeomMain::CloseWindow()
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.
1203 TGMainFrame::CloseWindow();
1204 gApplication->Terminate(0);
1207 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1209 switch (GET_MSG(msg)) {
1211 // Text entries for binning of cross-section plots
1213 switch (GET_SUBMSG(msg)) {
1214 case kTE_TEXTCHANGED:
1217 fNbins=(Int_t) atof(fTbh61->GetString());
1220 fEmin= atof(fTbh62->GetString());
1223 fEmax= atof(fTbh63->GetString());
1226 printf("\n %d %f %f binning", fNbins, fEmin, fEmax);
1230 // ListTree for volumes
1232 switch (GET_SUBMSG(msg)) {
1234 // Handle mouse click
1236 TGListTreeItem *item;
1238 // Button 1: Select volume
1239 if (parm1 == kButton1) {
1240 if ((item = fLt->GetSelected()))
1242 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1247 // Button 2: Draw volume specifications
1249 if (parm1 == kButton2) {
1250 TGListTreeItem *item;
1251 if ((item = fLt->GetSelected()))
1254 ((AliDrawVolume *) item->GetUserData())->DrawSpec();
1256 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1261 // Button 3: Draw Volume
1262 if (parm1 == kButton3) {
1263 TGListTreeItem *item;
1264 if ((item = fLt->GetSelected()))
1266 ((AliDrawVolume *) item->GetUserData())->Draw();
1267 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1274 case kCT_ITEMDBLCLICK:
1275 if (parm1 == kButton1) {
1276 if (fLt->GetSelected() != 0) {
1277 gClient->NeedRedraw(fLt);
1286 switch (GET_SUBMSG(msg)) {
1296 // Combo box bindings
1301 gCurrentMaterial=(AliGUIMaterial*)
1302 (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1303 gCurrentMedium=(AliGUIMedium*)
1304 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1311 gCurrentMedium=(AliGUIMedium*)
1312 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1313 gCurrentMaterial=(AliGUIMaterial*)
1314 (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1321 gCurrentParticle=Int_t(parm2);
1326 gCurrentProcess=Int_t(parm2);
1327 printf("\n Process %d", gCurrentProcess);
1331 case kCM_MENUSELECT:
1340 fi.fFileTypes = (char **)filetypes;
1341 new TGFileDialog(gClient->GetRoot(), this, kFDOpen,&fi);
1346 fDialog = new AliGuiGeomDialog
1347 (gClient->GetRoot(), this, 400, 200);
1351 printf("M_FILE_SAVE\n");
1355 CloseWindow(); // this also terminates theApp
1369 void AliGuiGeomMain::AddMaterial(AliGUIMaterial *Material, Int_t i)
1372 tmp=Material->Name();
1373 Material->SetItemId(i);
1374 fMaterialCombo->AddEntry(tmp, i);
1375 fMaterialCombo->Select(i);
1376 fMaterialCombo->Resize(200, 20);
1379 void AliGuiGeomMain::AddMedium(AliGUIMedium *Medium, Int_t i)
1383 Medium->SetItemId(i);
1385 fMediaCombo->AddEntry(tmp, i);
1386 fMediaCombo->Select(i);
1387 fMediaCombo->Resize(200, 20);
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)
1395 // Create a dialog window. A dialog window pops up with respect to its
1398 fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
1400 fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
1401 fOkButton->Associate(this);
1402 fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
1403 fCancelButton->Associate(this);
1405 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1407 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
1409 fFrame1->AddFrame(fOkButton, fL1);
1410 fFrame1->AddFrame(fCancelButton, fL1);
1412 fFrame1->Resize(150, fOkButton->GetDefaultHeight());
1413 AddFrame(fFrame1, fL2);
1415 //--------- create Tab widget and some composite frames for Tab testing
1417 fTab = new TGTab(this, 300, 300);
1418 fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
1422 TGCompositeFrame *tf = fTab->AddTab("Draw");
1423 fF1 = new AliGUISliders(tf, this, 60, 20);
1424 tf->AddFrame(fF1,fL3);
1427 // Tab2: Drawing Options
1429 tf = fTab->AddTab("Options");
1430 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1432 fF2 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
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);
1438 fF2->AddFrame(fLabel1 = new TGLabel(fF2, "Fill"),fL3);
1440 fCombo = new TGComboBox(fF2, 89);
1441 fF2->AddFrame(fCombo, fL3);
1443 tf->AddFrame(fF2, fL3);
1446 for (i = 0; i < 8; i++) {
1449 sprintf(tmp, "%i", i+1);
1450 fCombo->AddEntry(tmp, i+1);
1453 fCombo->Resize(50, 20);
1454 fCombo->Associate(this);
1456 fChk1->Associate(this);
1457 fChk2->Associate(this);
1458 fChk3->Associate(this);
1460 // Tab3: Seen Option
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);
1469 for (i = 0; i < 4; i++) {
1472 sprintf(tmp, "%i", i-2);
1473 fCombo2->AddEntry(tmp, i+1);
1476 fCombo2->Resize(50, 20);
1477 fCombo2->Associate(this);
1481 tf = fTab->AddTab("ClipBox");
1482 //--- layout for buttons: top align, equally expand horizontally
1483 fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1485 //--- layout for the frame: place at bottom, right aligned
1486 fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1491 fF4 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1493 fHSframe1 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1495 fTbh11 = new TGTextBuffer(10);
1496 fTeh11 = new TGTextEntry(fHSframe1, fTbh11,1);
1497 fTbh11->AddText(0, " 0");
1498 fTeh11->Associate(this);
1500 fTbh12 = new TGTextBuffer(10);
1501 fTeh12 = new TGTextEntry(fHSframe1, fTbh12,1);
1502 fTbh12->AddText(0, "2000");
1503 fTeh12->Associate(this);
1505 fDslider1 = new TGDoubleHSlider(fHSframe1, 400, kSlider1 | kScaleBoth, 1);
1506 fDslider1->Associate(this);
1507 fDslider1->SetRange(-2000, 2000);
1508 fDslider1->SetPosition(0, 2000);
1510 fSLabel1 = new TGLabel(fHSframe1, "xmin-xmax");
1512 fHSframe1->AddFrame(fSLabel1, fBfly1);
1513 fHSframe1->AddFrame(fTeh11, fBfly1);
1514 fHSframe1->AddFrame(fTeh12, fBfly1);
1515 fHSframe1->AddFrame(fDslider1, fBfly1);
1517 fF4->AddFrame(fHSframe1, fBly);
1520 fHSframe2 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1522 fTbh21 = new TGTextBuffer(10);
1523 fTeh21 = new TGTextEntry(fHSframe2, fTbh21,1);
1524 fTbh21->AddText(0, " 0");
1525 fTeh21->Associate(this);
1527 fTbh22 = new TGTextBuffer(10);
1528 fTeh22 = new TGTextEntry(fHSframe2, fTbh22,1);
1529 fTbh22->AddText(0, "2000");
1530 fTeh22->Associate(this);
1532 fDslider2 = new TGDoubleHSlider(fHSframe2, 400, kSlider1 | kScaleBoth, 2);
1533 fDslider2->Associate(this);
1534 fDslider2->SetRange(-2000, 2000);
1535 fDslider2->SetPosition(0, 2000);
1537 fSLabel2 = new TGLabel(fHSframe2, "ymin-ymax");
1539 fHSframe2->AddFrame(fSLabel2, fBfly1);
1540 fHSframe2->AddFrame(fTeh21, fBfly1);
1541 fHSframe2->AddFrame(fTeh22, fBfly1);
1542 fHSframe2->AddFrame(fDslider2, fBfly1);
1544 fF4->AddFrame(fHSframe2, fBly);
1547 fHSframe3 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1549 fTbh31 = new TGTextBuffer(10);
1550 fTeh31 = new TGTextEntry(fHSframe3, fTbh31,1);
1551 fTbh31->AddText(0, " 0");
1552 fTeh31->Associate(this);
1554 fTbh32 = new TGTextBuffer(10);
1555 fTeh32 = new TGTextEntry(fHSframe3, fTbh32,1);
1556 fTbh32->AddText(0, "2000");
1557 fTeh32->Associate(this);
1559 fDslider3 = new TGDoubleHSlider(fHSframe3, 400, kSlider1 | kScaleBoth, 3);
1560 fDslider3->Associate(this);
1561 fDslider3->SetRange(-2000, 2000);
1562 fDslider3->SetPosition(0, 2000);
1564 fSLabel3 = new TGLabel(fHSframe3, "zmin-zmax");
1566 fHSframe3->AddFrame(fSLabel3, fBfly1);
1567 fHSframe3->AddFrame(fTeh31, fBfly1);
1568 fHSframe3->AddFrame(fTeh32, fBfly1);
1569 fHSframe3->AddFrame(fDslider3, fBfly1);
1571 fF4->AddFrame(fHSframe3, fBly);
1572 tf->AddFrame(fF4, fL3);
1575 TGLayoutHints *fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
1576 kLHintsExpandY, 2, 2, 5, 1);
1577 AddFrame(fTab, fL5);
1580 Resize(GetDefaultSize());
1582 // position relative to the parent's window
1585 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
1586 (((TGFrame *) main)->GetWidth() - fWidth) >> 1,
1587 (((TGFrame *) main)->GetHeight() - fHeight) >> 1,
1591 SetWindowName("Dialog");
1594 //gClient->WaitFor(this); // otherwise canvas contextmenu does not work
1597 AliGuiGeomDialog::~AliGuiGeomDialog()
1599 // Delete test dialog widgets.
1602 delete fCancelButton;
1604 delete fChk1; delete fChk2;
1605 delete fF1; delete fF2; delete fF3; delete fF4;
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;
1618 void AliGuiGeomDialog::Update()
1628 param=gCurrentVolume->GetParam(P_Seen);
1629 fCombo2->Select(Int_t(param)+3);
1631 // Hide, Shadow, Clip
1633 if (Int_t(gCurrentVolume->GetParam(P_Shadow))) {
1634 fChk1->SetState(kButtonDown);
1636 fChk1->SetState(kButtonUp);
1641 if (Int_t(gCurrentVolume->GetParam(P_Hide))) {
1642 fChk2->SetState(kButtonDown);
1644 fChk2->SetState(kButtonUp);
1649 if (Int_t(gCurrentVolume->GetParam(P_Clip))) {
1650 fChk3->SetState(kButtonDown);
1652 fChk3->SetState(kButtonUp);
1658 void AliGuiGeomDialog::CloseWindow()
1660 // Called when window is closed via the window manager.
1664 Bool_t AliGuiGeomDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1666 // Process messages coming from widgets associated with the dialog.
1669 switch (GET_MSG(msg)) {
1671 switch (GET_SUBMSG(msg)) {
1673 switch (Int_t(parm1)) {
1675 min=fDslider1->GetMinPosition();
1676 max=fDslider1->GetMaxPosition();
1677 sprintf(buf, "%6.2f", min);
1679 fTbh11->AddText(0, buf);
1680 sprintf(buf, "%6.2f", max);
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);
1689 min=fDslider2->GetMinPosition();
1690 max=fDslider2->GetMaxPosition();
1691 sprintf(buf, "%6.2f", min);
1693 fTbh21->AddText(0, buf);
1694 sprintf(buf, "%6.2f", max);
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);
1703 min=fDslider3->GetMinPosition();
1704 max=fDslider3->GetMaxPosition();
1705 sprintf(buf, "%6.2f", min);
1707 fTbh31->AddText(0, buf);
1708 sprintf(buf, "%6.2f", max);
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);
1722 switch (GET_SUBMSG(msg)) {
1727 printf("\nTerminating dialog: %s pressed\n",
1728 (parm1 == 1) ? "OK" : "Cancel");
1736 gCurrentVolume->SetParam(P_Fill, Float_t(parm2));
1737 gCurrentVolume->Draw();
1740 gCurrentVolume->SetParam(P_Seen, Float_t(parm2-3));
1741 gCurrentVolume->Draw();
1745 case kCM_CHECKBUTTON:
1748 if (Int_t(gCurrentVolume->GetParam(P_Shadow))) {
1749 gCurrentVolume->SetParam(P_Shadow, 0.);
1751 gCurrentVolume->SetParam(P_Shadow, 1.);
1753 gCurrentVolume->Draw();
1756 if (Int_t(gCurrentVolume->GetParam(P_Hide))) {
1757 gCurrentVolume->SetParam(P_Hide, 0.);
1759 gCurrentVolume->SetParam(P_Hide, 1.);
1761 gCurrentVolume->Draw();
1764 if (Int_t(gCurrentVolume->GetParam(P_Clip))) {
1765 gCurrentVolume->SetParam(P_Clip, 0.);
1767 gCurrentVolume->SetParam(P_Clip, 1.);
1769 gCurrentVolume->Draw();
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};
1794 AliGUISliders::AliGUISliders(const TGWindow *p, const TGWindow *,
1795 UInt_t w, UInt_t h) :
1796 TGCompositeFrame(p, w, h,kVerticalFrame)
1798 ChangeOptions((GetOptions() & ~kHorizontalFrame) | kVerticalFrame);
1799 //--- layout for buttons: top align, equally expand horizontally
1800 fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1802 //--- layout for the frame: place at bottom, right aligned
1803 fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1807 for (Int_t i=0; i<7; i++) {
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);
1814 sprintf(buf, "%6.2f", Float_t(DefaultPos[i])/100);
1815 fTbh[i]->AddText(0, buf);
1816 fTeh[i]->Associate(this);
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]);
1823 fLabel[i] = new TGLabel(fHframe[i], LabelText[i]);
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);
1833 AliGUISliders::~AliGUISliders()
1835 delete fBfly1; delete fBly;
1837 for (Int_t i=1; i<7; i++) {
1845 void AliGUISliders::Update()
1849 for (Int_t i=0; i<7; i++) {
1850 Float_t param = gCurrentVolume->GetParam(i);
1852 fHslider[i]->SetPosition(Int_t(param*100.));
1853 gClient->NeedRedraw(fHslider[i]);
1855 sprintf(buf, "%6.2f", param);
1857 fTbh[i]->AddText(0, buf);
1858 gClient->NeedRedraw(fTeh[i]);
1865 void AliGUISliders::CloseWindow()
1867 // Called when window is closed via the window manager.
1872 Bool_t AliGUISliders::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1874 // Process slider messages.
1878 switch (GET_MSG(msg)) {
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();
1890 switch (GET_SUBMSG(msg)) {
1892 sprintf(buf, "%6.2f", Float_t(parm2)/100);
1893 Int_t idS=Int_t(parm1)-8;
1895 fTbh[idS]->AddText(0, buf);
1896 gClient->NeedRedraw(fTeh[idS]);
1897 gCurrentVolume->SetParam(idS, Float_t(parm2)/100.);
1898 gCurrentVolume->Draw();
1905 ClassImp(AliGUIMaterial)
1907 AliGUIMaterial::AliGUIMaterial()
1918 AliGUIMaterial::AliGUIMaterial(Int_t imat, char* name, Float_t a, Float_t z,
1919 Float_t dens, Float_t radl, Float_t absl)
1929 void AliGUIMaterial::Dump()
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);
1941 Int_t AliGUIMaterial::Id()
1946 char* AliGUIMaterial::Name()
1951 Float_t AliGUIMaterial::A()
1956 Float_t AliGUIMaterial::Z()
1961 Float_t AliGUIMaterial::Density()
1966 Float_t AliGUIMaterial::RadiationLength()
1971 Float_t AliGUIMaterial::AbsorptionLength()
1977 void AliGUIMaterial::Plot()
1982 void AliGUIMaterial::Streamer(TBuffer &)
1987 ClassImp(AliGUIMedium)
1989 AliGUIMedium::AliGUIMedium()
1995 AliGUIMedium::AliGUIMedium(Int_t imed, Int_t imat, char* name, Int_t isvol,
1997 Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax,
1998 Float_t epsil, Float_t stmin)
2013 void AliGUIMedium::Dump()
2018 Int_t AliGUIMedium::Id()
2023 char* AliGUIMedium::Name()
2028 Float_t AliGUIMedium::GetPar(Int_t ipar)
2033 } else if(ipar >=23 && ipar <27) {
2042 void AliGUIMedium::Streamer(TBuffer &)