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.5 2000/03/20 15:11:03 fca
19 Mods to make the code compile on HP
21 Revision 1.4 2000/01/18 16:12:08 morsch
22 Bug in calculation of number of volume divisions and number of positionings corrected
23 Browser for Material and Media properties added
25 Revision 1.3 1999/11/14 14:31:14 fca
26 Correct small error and remove compilation warnings on HP
28 Revision 1.2 1999/11/10 16:53:35 fca
29 The new geometry viewer from A.Morsch
35 * Written by Andreas Morsch
39 * For questions critics and suggestions to this part of the code
40 * contact andreas.morsch@cern.ch
42 **************************************************************************/
49 #include <TApplication.h>
50 #include <TVirtualX.h>
51 #include <TGListBox.h>
52 #include <TGListTree.h>
58 #include <TGTextEntry.h>
62 #include <TGComboBox.h>
65 #include <TGDoubleSlider.h>
66 #include <TGFileDialog.h>
67 #include <TRootEmbeddedCanvas.h>
74 #include <TGPicture.h>
77 #include "TGeant3GUI.h"
79 static AliDrawVolume *gCurrentVolume = new AliDrawVolume("NULL");
80 static AliGUIMaterial *gCurrentMaterial = new AliGUIMaterial();
81 static AliGUIMedium *gCurrentMedium = new AliGUIMedium();
82 static Int_t gCurrentParticle = 1;
83 static Int_t gCurrentProcess = 1;
85 ClassImp(AliGeant3GeometryGUI)
87 AliGeant3GeometryGUI::AliGeant3GeometryGUI()
89 fPanel = new AliGuiGeomMain(gClient->GetRoot(), 500, 500);
91 fVolumes = new TClonesArray("AliDrawVolume",1000);
92 fMaterials = new TClonesArray("AliGUIMaterial",1000);
93 fMedia = new TClonesArray("AliGUIMedium",1000);
94 // Store local copy of zebra bank entries
95 TGeant3 *geant3 = (TGeant3*) gMC;
100 fGclink=geant3->Gclink();
101 fGcnum=geant3->Gcnum();
107 void AliGeant3GeometryGUI::Streamer(TBuffer &)
113 void AliGeant3GeometryGUI::ReadGeometryTree()
116 // Copy zebra volume tree into ROOT LisTree
119 char /* *namec, */ *tmp;
122 // Closed folder (=volume containing children)
123 const TGPicture* Folder = gClient->GetPicture("folder_t.xpm");
124 // Open folder (=volume containing children)
125 const TGPicture* OpenFolder = gClient->GetPicture("ofolder_t.xpm");
127 const TGPicture* Document = gClient->GetPicture("doc_t.xpm");
129 AliDrawVolume *volume;
133 Int_t newlevel=nlevel;
135 volume = new AliDrawVolume("ALIC");
136 volume->SetIdVolume(((TGeant3*)gMC)->VolId("ALIC"));
137 volume->SetIdCopy(0);
138 volume->SetItem(NULL);
139 (*fVolumes)[0]=volume;
141 // Loop over volumes for which information has been collected
143 for (Int_t i=nst; i<nlevel; i++)
145 TGListTreeItem *itemi, *item2;
146 // GEANT3 volume number
147 Int_t ivol=TMath::Abs(Volume(i)->GetIdVolume());
149 // icopy=1 normal positioning
150 // icopy>1 positioning with parposp
152 Int_t icopy = Volume(i)->GetIdCopy();
153 // Medium and material number, handle special case of divisions
158 imat=Material(-ivol);
164 // Number of children
165 Int_t nch = NChildren(ivol);
166 strcpy(namec,((TGeant3*)gMC)->VolName(ivol));
168 printf("\n %s has %d children \n ", namec, nch);
170 printf("\n %s has divisions \n ", namec);
173 // Name to be used in ListTree
175 strncpy(vname,namec, 4);
179 sprintf(namec,"%s*%3dPos",namec,icopy);
180 } else if (icopy <0) {
181 sprintf(namec,"%s*%3dDiv",namec,-icopy);
184 itemi=Volume(i)->GetItem();
190 // Add volume to list tree
193 item2 = fPanel->AddItem(new AliDrawVolume(vname),
194 itemi, namec, OpenFolder, Folder);
196 item2 = fPanel->AddItem(new AliDrawVolume(vname),
197 itemi, namec, Document, Document);
200 // Add medium information to list tree item
201 ((AliDrawVolume *) item2->GetUserData())->SetIdVolume(ivol);
202 ((AliDrawVolume *) item2->GetUserData())->SetIdMaterial(imat);
203 ((AliDrawVolume *) item2->GetUserData())->SetIdMedium(imed);
205 // Set current volume to first list tree entry
206 if (!i) gCurrentVolume= ((AliDrawVolume *) item2->GetUserData());
209 // Collect children information
211 // nch < 0: Children by division
214 // Geant volume number
215 Int_t icvol=Child(ivol,1);
217 strcpy(namec,((TGeant3*)gMC)->VolName(-icvol));
219 strncpy(tmp,(char *) &namec, 4);
220 volume = new AliDrawVolume(namec);
221 volume->SetIdVolume(-icvol);
222 // Number of divisions
223 Int_t jvo = fZlq[fGclink->jvolum-ivol];
224 Int_t jdiv = fZlq[jvo-1];
225 Int_t ndiv = Int_t (fZq[jdiv+3]);
226 volume->SetIdCopy(-ndiv);
228 volume->SetItem(item2);
229 (*fVolumes)[newlevel]=volume;
230 printf("\n volume %s %d %d %d", namec, icvol, nch, ndiv);
233 // Children by positioning
236 // Loop over children
237 for (Int_t j=0; j<nch; j++)
240 // Find out if this volume was already positioned and count copies
241 Int_t icvol=Child(ivol,j+1);
242 icvol = TMath::Abs(icvol);
243 Bool_t inList=kFALSE;
244 for (Int_t k=0; k<nnew; k++) {
246 Volume(newlevel-k-1)->GetIdVolume())
248 Volume(newlevel-k-1)->AddCopy();
257 strcpy(namec,((TGeant3*)gMC)->VolName(icvol));
259 strncpy(tmp,(char *) &namec, 4);
260 volume = new AliDrawVolume(namec);
261 volume->SetIdVolume(icvol);
262 volume->SetIdCopy(1);
264 volume->SetItem(item2);
265 (*fVolumes)[newlevel]=volume;
266 printf("\n volume %s %d %d", namec, icvol, nch);
273 // Move one level deaper
279 void AliGeant3GeometryGUI::ReadMaterials()
282 // Puts media and material names into ComboBox and
283 // collects material information
285 Float_t a, z, dens, radl, absl;
286 a=z=dens=radl=absl=-1;
288 Int_t imat, isvol, ifield;
289 Float_t fieldm, tmaxfd, stemax, deemax, epsil, stmin;
294 char natmed[21], namate[21];
299 for(Int_t itm=1;itm<=fGcnum->ntmed;itm++) {
300 Int_t jtm = fZlq[fGclink->jtmed-itm];
304 // Get medium parameters
305 ((TGeant3*)(gMC))->Gftmed(itm, natmed, imat, isvol, ifield, fieldm,
306 tmaxfd, stemax, deemax, epsil, stmin, ubuf, &nwbuf);
307 strncpy(natmed,(char*)&fZiq[jtm+1],20);
310 // Create new medium object
311 AliGUIMedium * medium =
312 new AliGUIMedium(itm, imat, natmed, isvol, ifield, fieldm,
313 tmaxfd, stemax, deemax, epsil, stmin);
314 (*fMedia)[NEntries-1]=medium;
315 { //Begin local scope for j
316 for (Int_t j=1; j<=22; j++) {
317 medium->SetPar(j,Cut(itm,j));
319 } //End local scope for j
320 { //Begin local scope for j
321 for (Int_t j=23; j<=26; j++) {
322 medium->SetPar(j,Cut(itm,j+3));
324 } //End local scope for j
325 { //Begin local scope for j
326 for (Int_t j=27; j<=29; j++) {
327 medium->SetPar(j,Cut(itm,j+4));
329 } //End local scope for j
332 fPanel->AddMedium(medium, NEntries);
334 // Associated material
335 imat = Int_t (fZq[jtm+6]);
336 Int_t jma = Int_t (fZlq[fGclink->jmate-imat]);
338 // Get material parameters
339 ((TGeant3*)(gMC))->Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
340 strncpy(namate,(char *)&fZiq[jma+1],20);
343 // Create new material object
344 AliGUIMaterial * material =
345 new AliGUIMaterial(imat,namate,a,z,dens,radl,absl);
346 (*fMaterials)[NEntries-1]=material;
350 fPanel->AddMaterial(material, NEntries);
351 gCurrentMaterial=material;
354 fPanel->SetComboEntries(fMaterials);
355 fPanel->SetMediaComboEntries(fMedia);
359 Int_t AliGeant3GeometryGUI::NChildren(Int_t idvol)
362 // Return number of children for volume idvol
363 Int_t jvo = fZlq[fGclink->jvolum-idvol];
364 Int_t nin = Int_t(fZq[jvo+3]);
368 Int_t AliGeant3GeometryGUI::Child(Int_t idvol, Int_t idc)
371 // Return GEANT id of child number idc of volume idvol
372 Int_t jvo = fZlq[fGclink->jvolum-idvol];
374 Int_t jin = fZlq[jvo-nin];
375 Int_t numb = Int_t (fZq[jin +3]);
377 return -Int_t(fZq[jin+2]);
379 return Int_t(fZq[jin+2]);
383 Int_t AliGeant3GeometryGUI::Medium(Int_t idvol)
386 // Return medium number for volume idvol.
387 // If idvol is negative the volume results from a division.
390 Int_t jvo = fZlq[fGclink->jvolum-idvol];
391 imed = Int_t(fZq[jvo+4]);
394 Int_t jdiv = fZlq[fGclink->jvolum-idvol];
395 Int_t ivin = Int_t ( fZq[jdiv+2]);
396 Int_t jvin = fZlq[fGclink->jvolum-ivin];
397 imed = Int_t (fZq[jvin+4]);
402 Int_t AliGeant3GeometryGUI::Material(Int_t idvol)
404 // Return material number for volume idvol.
405 // If idvol is negative the volume results from a division.
407 Int_t imed=Medium(idvol);
408 Int_t jtm = fZlq[fGclink->jtmed-imed];
409 return Int_t (fZq[jtm+6]);
413 Float_t AliGeant3GeometryGUI::Cut(Int_t imed, Int_t icut)
415 // Return cuts icut for medium idmed
417 Int_t jtm = fZlq[fGclink->jtmed-imed];
419 // Have the defaults been modified ??
420 Int_t jtmn = fZlq[jtm];
428 return Float_t (fZq[jtm+icut]);
431 ClassImp(AliDrawVolume)
433 // Drawing parameter tags
434 enum AliDrawParamId {
456 AliDrawVolume::AliDrawVolume(char* name)
479 char* AliDrawVolume::Name()
482 // Return volume name
487 void AliDrawVolume::Streamer(TBuffer &)
494 void AliDrawVolume::Draw(Option_t *)
496 gMC->Gsatt(fName,"seen", fSeen);
499 gMC->Gdopt("hide", "on");
501 gMC->Gdopt("hide", "off");
505 gMC->Gdopt("shad", "on");
506 gMC->Gsatt("*", "fill", fFill);
508 gMC->Gdopt("shad", "off");
511 gMC->SetClipBox(".");
513 gMC->SetClipBox("*", fClipXmin, fClipXmax,
514 fClipYmin, fClipYmax, fClipZmin, fClipZmax);
516 gMC->SetClipBox(".");
520 gMC->Gdraw(fName, fTheta, fPhi, fPsi, fU, fV, fUscale, fVscale);
521 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
522 if (higz) higz->Update();
525 void AliDrawVolume::DrawSpec()
527 gMC->Gsatt(fName,"seen", fSeen);
530 gMC->Gdopt("hide", "on");
532 gMC->Gdopt("hide", "off");
536 gMC->Gdopt("shad", "on");
537 gMC->Gsatt("*", "fill", fFill);
539 gMC->Gdopt("shad", "off");
542 gMC->SetClipBox(".");
544 gMC->SetClipBox("*", fClipXmin, fClipXmax, fClipYmin, fClipYmax, fClipZmin, fClipZmax);
546 gMC->SetClipBox(".");
550 ((TGeant3*) gMC)->DrawOneSpec(fName);
551 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
552 if (higz) higz->Update();
555 void AliDrawVolume::SetParam(Int_t ip, Float_t param)
583 fShadow=Int_t(param);
615 Float_t AliDrawVolume::GetParam(Int_t ip)
633 return Float_t(fHide);
635 return Float_t(fShadow);
637 return Float_t(fFill);
639 return Float_t(fSeen);
641 return Float_t(fClip);
661 ClassImp(AliGuiGeomMain)
663 const Text_t* LabelTextP[19] =
664 {"PAIR ", "COMP ", "PHOT ", "PFIS ", "DRAY ", "ANNI ", "BREM ",
665 "HADR ", "MUNU ", "DCAY ", "LOSS ", "MULS ", "GHCOR1", "BIRK1 ",
666 "BIRK2 ", "BIRK3 ", "LABS ", "SYNC ", "STRA "};
669 const Text_t* LabelTextC[10] =
670 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
671 "DCUTE ", "DCUTM ", "PPCUTM"};
673 const Text_t* LabelTextPart[24] =
674 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-",
675 "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton",
676 "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
677 "Xi0", "Xi-", "Omega-"};
679 const Text_t* LabelTextMechanism[24] =
680 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
681 "HADG", "INEG", "ELAG", "FISG", "CAPG",
682 "LOSS", "PHOT", "ANNI", "COMP", "BREM",
683 "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
684 "MUNU", "RANG", "STEP", "MUON"};
689 enum ETestCommandIdentifiers {
714 Int_t mb_button_id[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
715 kMBRetry, kMBIgnore, kMBCancel,
716 kMBClose, kMBDismiss };
718 EMsgBoxIcon mb_icon[4] = { kMBIconStop, kMBIconQuestion,
719 kMBIconExclamation, kMBIconAsterisk };
721 const char *filetypes[] = { "All files", "*",
722 "ROOT files", "*.root",
723 "ROOT macros", "*.C",
729 TGListTreeItem* AliGuiGeomMain::
730 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
732 return fLt->AddItem(parent, name, obj, open, closed);
735 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
736 : TGMainFrame(p, w, h)
739 // Create test main frame. A TGMainFrame is a top level window.
740 // Create menubar and popup menus. The hint objects are used to place
741 // and group the different menu widgets with respect to eachother.
742 fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
744 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
745 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
747 fMenuFile = new TGPopupMenu(gClient->GetRoot());
748 fMenuFile->AddEntry("&Open...", M_FILE_OPEN);
749 fMenuFile->AddEntry("&Save", M_FILE_SAVE);
750 fMenuFile->AddEntry("S&ave as...", M_FILE_SAVEAS);
751 fMenuFile->AddEntry("&Close", -1);
752 fMenuFile->AddSeparator();
753 fMenuFile->AddEntry("E&xit", M_FILE_EXIT);
755 fMenuFile->DisableEntry(M_FILE_SAVEAS);
756 fMenuFile->DisableEntry(M_FILE_OPEN);
757 fMenuFile->DisableEntry(M_FILE_SAVE);
761 fMenuTest = new TGPopupMenu(this);
762 fMenuTest->AddLabel("Draw");
763 fMenuTest->AddSeparator();
764 fMenuTest->AddEntry("&Volume Draw Control", M_TEST_DLG);
765 fMenuTest->AddSeparator();
766 fMenuTest->Associate(this);
769 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
770 fMenuHelp->AddEntry("&Contents", M_HELP_CONTENTS);
771 fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
772 fMenuHelp->AddSeparator();
773 fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
775 fMenuFile->DisableEntry(M_HELP_CONTENTS);
776 fMenuFile->DisableEntry(M_HELP_SEARCH);
777 fMenuFile->DisableEntry(M_HELP_ABOUT);
778 // Menu button messages are handled by the main frame (i.e. "this")
779 // ProcessMessage() method.
780 fMenuFile->Associate(this);
781 fMenuTest->Associate(this);
782 fMenuHelp->Associate(this);
784 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
785 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
786 fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
787 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
789 AddFrame(fMenuBar, fMenuBarLayout);
794 fTab = new TGTab(this, 400, 400);
795 TGCompositeFrame *tf = fTab->AddTab("Volumes");
796 TGLayoutHints *fLTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
797 kLHintsExpandY, 2, 2, 5, 1);
798 AddFrame(fTab, fLTab);
800 // Create TGCanvas and a canvas container which uses a tile layout manager
801 fCanvasWindow = new TGCanvas(tf, 400, 240);
803 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
805 fLt->Associate(this);
806 fCanvasWindow->SetContainer(fLt);
809 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
810 tf->AddFrame(fCanvasWindow, lo);
814 tf = fTab->AddTab("Materials");
815 fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
816 fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
817 // ComboBox for materials
818 fMaterialCombo = new TGComboBox(fF2, 1);
819 fF2->AddFrame(fMaterialCombo, fL2);
821 // text labels with material properties
823 Text_t* LabelText[6] =
829 "Absorption Length"};
832 new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
833 TGLayoutHints* Bfly1 =
834 new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
835 fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
836 fF2->AddFrame(fF21,fL2);
837 for (Int_t i=0; i<6; i++) {
839 fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
840 fF21->AddFrame(fHframe[i], Bly);
841 fTbh[i] = new TGTextBuffer(10);
842 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
843 fTeh[i]->Associate(this);
844 fLabel[i] = new TGLabel(fHframe[i], LabelText[i]);
845 fHframe[i]->AddFrame(fLabel[i], Bfly1);
846 fHframe[i]->AddFrame(fTeh[i], Bfly1);
848 tf->AddFrame(fF2, fL2);
849 fMaterialCombo->Resize(200, 20);
850 fMaterialCombo->Associate(this);
855 tf = fTab->AddTab("Media");
856 fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
857 // ComboBox for tracking media
858 fMediaCombo = new TGComboBox(fF3, 2);
859 fF3->AddFrame(fMediaCombo, fL2);
861 // text labels with material properties
863 Text_t* LabelTextM[8] =
864 {"Sensitivity Flag ",
865 "Magnetic Field Flag ",
867 "Max. Ang. Deviation ",
869 "Max. Frac. Energy Loss",
870 "Crossing Precission ",
871 "Minimum Step Size "};
873 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
874 fF3->AddFrame(fF31,fL2);
875 { //Begin local scope for i
876 for (Int_t i=0; i<8; i++) {
878 fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
879 fF31->AddFrame(fHframeM[i], Bly);
880 fTbhM[i] = new TGTextBuffer(10);
881 fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
882 fTehM[i]->Associate(this);
883 fLabelM[i] = new TGLabel(fHframeM[i], LabelTextM[i]);
884 fHframeM[i]->AddFrame(fLabelM[i], Bfly1);
885 fHframeM[i]->AddFrame(fTehM[i], Bfly1);
887 } //End local scope for i
888 tf->AddFrame(fF3, fL2);
889 fMediaCombo->Resize(200, 20);
890 fMediaCombo->Associate(this);
893 tf = fTab->AddTab("Processes");
894 fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
895 fProcessLB = new TGListBox(fF4, 1);
896 fF4->AddFrame(fProcessLB, fL2);
897 tf->AddFrame(fF4, fL2);
898 fProcessLB->Resize(150, 350);
899 fProcessLB->Associate(this);
903 tf = fTab->AddTab("Cuts");
904 fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
905 fCutsLB = new TGListBox(fF5, 1);
906 fF5->AddFrame(fCutsLB, fL2);
907 tf->AddFrame(fF5, fL2);
908 fCutsLB->Resize(150, 350);
911 // de/dx and cross-sections
912 tf = fTab->AddTab("DE/DX and X-Sections");
913 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
915 // ComboBox for particles
916 fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
917 fF6->AddFrame(fF61, fL2);
918 fParticleCombo = new TGComboBox(fF61, 3);
919 fF61->AddFrame(fParticleCombo, fL2);
920 { //Begin local scope for i
921 for (Int_t i = 0; i < 24; i++) {
923 sprintf(tmp, "%s", LabelTextPart[i]);
924 fParticleCombo->AddEntry(tmp, i+1);
926 } //End local scope for i
927 fParticleCombo->Select(1);
928 fParticleCombo->Resize(100, 20);
929 fParticleCombo->Associate(this);
931 // ComboBox for mechanisms
932 fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
933 fF6->AddFrame(fF63, fL2);
934 fMechanismCombo = new TGComboBox(fF63, 4);
935 fF63->AddFrame(fMechanismCombo, fL2);
936 { //Begin local scope for i
937 for (Int_t i = 0; i < 24; i++) {
939 sprintf(tmp, "%s", LabelTextMechanism[i]);
940 fMechanismCombo->AddEntry(tmp, i+1);
942 } //End local scope for i
943 fMechanismCombo->Select(1);
944 fMechanismCombo->Resize(100, 20);
945 fMechanismCombo->Associate(this);
950 fTbh61 = new TGTextBuffer(10);
951 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
952 fTbh61->AddText(0, " 100");
953 fTeh61->Associate(this);
955 fTbh62 = new TGTextBuffer(10);
956 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
957 fTbh62->AddText(0, "0.001");
958 fTeh62->Associate(this);
960 fTbh63 = new TGTextBuffer(10);
961 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
962 fTbh63->AddText(0, "10.");
963 fTeh63->Associate(this);
969 fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
970 Bfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
971 fF61->AddFrame(fSLabel61, Bfly1);
972 fF61->AddFrame(fTeh61, Bfly1);
973 fF61->AddFrame(fTeh62, Bfly1);
974 fF61->AddFrame(fTeh63, Bfly1);
977 fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
978 fF6->AddFrame(fF62, fL2);
979 fPlotButton = new TGTextButton(fF62, "Plot", 1);
980 fPlotButton -> Associate(this);
981 fF62->AddFrame(fPlotButton);
983 tf->AddFrame(fF6, fL2);
984 // Window name and final mapping
986 SetWindowName("AliRoot Geometry Browser");
988 // We need to use GetDefault...() to initialize the layout algorithm...
989 Resize(GetDefaultSize());
993 AliGuiGeomMain::~AliGuiGeomMain()
995 // Delete all created widgets.
998 delete fCanvasWindow;
1000 delete fMenuBarLayout;
1001 delete fMenuBarItemLayout;
1002 delete fMenuBarHelpLayout;
1009 void AliGuiGeomMain::Streamer(TBuffer &)
1014 void AliGuiGeomMain::Plot()
1016 const Float_t avo=0.60221367;
1017 Float_t *tkin = new Float_t[fNbins];
1018 Float_t *value = new Float_t[fNbins];
1019 Float_t *pcut = new Float_t[fNbins];
1021 Int_t imate=gCurrentMaterial->Id();
1022 Float_t z=gCurrentMaterial->Z();
1023 Float_t a=gCurrentMaterial->A();
1024 Float_t density=gCurrentMaterial->Density();
1026 Int_t ipart=gCurrentParticle;
1027 const char *chmeca= LabelTextMechanism[gCurrentProcess-1];
1030 strncpy(tmp, chmeca, 4);
1033 Float_t de=(fEmax-fEmin)/fNbins;
1034 for (Int_t i=0; i<kdim; i++) {
1035 tkin[i]=fEmin+Float_t(i)*de;
1038 if (chmeca!="MUON") {
1039 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
1041 for (Int_t i=0; i<kdim; i++) {
1042 Float_t ekin=tkin[i];
1043 value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
1044 value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
1045 value[i]*=1000.*avo*density/a;
1050 printf("\n %d %d %s %d \n",imate, ipart, chmeca, kdim);
1052 TGraph *graph = new TGraph(kdim,tkin,value);
1053 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
1057 graph->SetFillColor(42);
1058 graph->SetMarkerColor(4);
1059 graph->SetMarkerStyle(21);
1061 graph->GetHistogram()->SetXTitle("Energy (GeV)");
1062 if (chmeca == "RANG" || chmeca == "STEP") {
1063 graph->GetHistogram()->SetYTitle
1065 } else if (chmeca == "LOSS" || chmeca == "MUON") {
1066 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
1068 graph->GetHistogram()->SetYTitle
1069 ("Macroscopic X-Section (1/cm)");
1080 void AliGuiGeomMain::Update()
1086 Int_t imat=gCurrentVolume->Material();
1087 Int_t nmat=fComboEntries->GetEntriesFast();
1089 for (i=0; i<nmat; i++) {
1090 gCurrentMaterial = (AliGUIMaterial*)
1091 (fComboEntries->UncheckedAt(i));
1092 if (gCurrentMaterial->Id()==imat) break;
1094 Int_t imed = gCurrentVolume->Medium();
1095 Int_t nmed=fComboMediaEntries->GetEntriesFast();
1096 for (i=0; i<nmed; i++) {
1097 gCurrentMedium = (AliGUIMedium*)
1098 (fComboMediaEntries->UncheckedAt(i));
1099 if (gCurrentMedium->Id()==imed) break;
1107 void AliGuiGeomMain::UpdateCombo()
1110 Int_t imat = gCurrentMaterial->Id();
1111 Float_t a = gCurrentMaterial->A();
1112 Float_t z = gCurrentMaterial->Z();
1113 Float_t dens = gCurrentMaterial->Density();
1114 Float_t radl = gCurrentMaterial->RadiationLength();
1115 Float_t absl = gCurrentMaterial->AbsorptionLength();
1116 Int_t entry=gCurrentMaterial->ItemId();
1119 fMaterialCombo->Select(entry);
1120 fMediaCombo->Select(entry);
1123 sprintf(buf, "%10i", imat);
1125 fTbh[0]->AddText(0, buf);
1126 gClient->NeedRedraw(fTeh[0]);
1127 sprintf(buf, "%10.2e", a);
1129 fTbh[1]->AddText(0, buf);
1130 gClient->NeedRedraw(fTeh[1]);
1132 sprintf(buf, "%10.2e", z);
1134 fTbh[2]->AddText(0, buf);
1135 gClient->NeedRedraw(fTeh[2]);
1137 sprintf(buf, "%10.2e", dens);
1139 fTbh[3]->AddText(0, buf);
1140 gClient->NeedRedraw(fTeh[3]);
1142 sprintf(buf, "%10.2e", radl);
1144 fTbh[4]->AddText(0, buf);
1145 gClient->NeedRedraw(fTeh[4]);
1147 sprintf(buf, "%10.2e", absl);
1149 fTbh[5]->AddText(0, buf);
1150 gClient->NeedRedraw(fTeh[5]);
1153 sprintf(buf, "%10i", gCurrentMedium->Isvol());
1155 fTbhM[0]->AddText(0, buf);
1156 gClient->NeedRedraw(fTehM[0]);
1159 sprintf(buf, "%10i", gCurrentMedium->Ifield());
1161 fTbhM[1]->AddText(0, buf);
1162 gClient->NeedRedraw(fTehM[1]);
1164 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
1166 fTbhM[2]->AddText(0, buf);
1167 gClient->NeedRedraw(fTehM[2]);
1169 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
1171 fTbhM[3]->AddText(0, buf);
1172 gClient->NeedRedraw(fTehM[3]);
1174 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
1176 fTbhM[4]->AddText(0, buf);
1177 gClient->NeedRedraw(fTehM[4]);
1179 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
1181 fTbhM[5]->AddText(0, buf);
1182 gClient->NeedRedraw(fTehM[5]);
1184 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
1186 fTbhM[6]->AddText(0, buf);
1187 gClient->NeedRedraw(fTehM[6]);
1189 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
1191 fTbhM[7]->AddText(0, buf);
1192 gClient->NeedRedraw(fTehM[7]);
1195 void AliGuiGeomMain::UpdateListBox()
1198 fProcessLB->RemoveEntries(1,19);
1199 for (i=11; i < 30; i++) {
1200 Float_t p=gCurrentMedium->GetPar(i);
1202 sprintf(tmp, "%6s%5d", LabelTextP[i-11], Int_t(p));
1203 fProcessLB->AddEntry(tmp, i-10);
1205 fProcessLB->MapSubwindows();
1206 fProcessLB->Layout();
1208 fCutsLB->RemoveEntries(1,10);
1209 for (i=1; i < 11; i++) {
1210 Float_t p=gCurrentMedium->GetPar(i);
1212 sprintf(tmp, "%6s%10.3e", LabelTextC[i-1], p);
1213 fCutsLB->AddEntry(tmp,i);
1215 fCutsLB->MapSubwindows();
1220 void AliGuiGeomMain::CloseWindow()
1222 // Got close message for this MainFrame. Calls parent CloseWindow()
1223 // (which destroys the window) and terminate the application.
1224 // The close message is generated by the window manager when its close
1225 // window menu item is selected.
1227 TGMainFrame::CloseWindow();
1228 gApplication->Terminate(0);
1231 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1233 switch (GET_MSG(msg)) {
1235 // Text entries for binning of cross-section plots
1237 switch (GET_SUBMSG(msg)) {
1238 case kTE_TEXTCHANGED:
1241 fNbins=(Int_t) atof(fTbh61->GetString());
1244 fEmin= atof(fTbh62->GetString());
1247 fEmax= atof(fTbh63->GetString());
1250 printf("\n %d %f %f binning", fNbins, fEmin, fEmax);
1254 // ListTree for volumes
1256 switch (GET_SUBMSG(msg)) {
1258 // Handle mouse click
1260 TGListTreeItem *item;
1262 // Button 1: Select volume
1263 if (parm1 == kButton1) {
1264 if ((item = fLt->GetSelected()))
1266 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1271 // Button 2: Draw volume specifications
1273 if (parm1 == kButton2) {
1274 TGListTreeItem *item;
1275 if ((item = fLt->GetSelected()))
1278 ((AliDrawVolume *) item->GetUserData())->DrawSpec();
1280 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1285 // Button 3: Draw Volume
1286 if (parm1 == kButton3) {
1287 TGListTreeItem *item;
1288 if ((item = fLt->GetSelected()))
1290 ((AliDrawVolume *) item->GetUserData())->Draw();
1291 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1298 case kCT_ITEMDBLCLICK:
1299 if (parm1 == kButton1) {
1300 if (fLt->GetSelected() != 0) {
1301 gClient->NeedRedraw(fLt);
1310 switch (GET_SUBMSG(msg)) {
1320 // Combo box bindings
1325 gCurrentMaterial=(AliGUIMaterial*)
1326 (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1327 gCurrentMedium=(AliGUIMedium*)
1328 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1335 gCurrentMedium=(AliGUIMedium*)
1336 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1337 gCurrentMaterial=(AliGUIMaterial*)
1338 (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1345 gCurrentParticle=Int_t(parm2);
1350 gCurrentProcess=Int_t(parm2);
1351 printf("\n Process %d", gCurrentProcess);
1355 case kCM_MENUSELECT:
1364 fi.fFileTypes = (char **)filetypes;
1365 new TGFileDialog(gClient->GetRoot(), this, kFDOpen,&fi);
1370 fDialog = new AliGuiGeomDialog
1371 (gClient->GetRoot(), this, 400, 200);
1375 printf("M_FILE_SAVE\n");
1379 CloseWindow(); // this also terminates theApp
1393 void AliGuiGeomMain::AddMaterial(AliGUIMaterial *Material, Int_t i)
1396 tmp=Material->Name();
1397 Material->SetItemId(i);
1398 fMaterialCombo->AddEntry(tmp, i);
1399 fMaterialCombo->Select(i);
1400 fMaterialCombo->Resize(200, 20);
1403 void AliGuiGeomMain::AddMedium(AliGUIMedium *Medium, Int_t i)
1407 Medium->SetItemId(i);
1409 fMediaCombo->AddEntry(tmp, i);
1410 fMediaCombo->Select(i);
1411 fMediaCombo->Resize(200, 20);
1415 AliGuiGeomDialog::AliGuiGeomDialog(const TGWindow *p, const TGWindow *main, UInt_t w,
1416 UInt_t h, UInt_t options)
1417 : TGTransientFrame(p, main, w, h, options)
1419 // Create a dialog window. A dialog window pops up with respect to its
1422 fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
1424 fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
1425 fOkButton->Associate(this);
1426 fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
1427 fCancelButton->Associate(this);
1429 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1431 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
1433 fFrame1->AddFrame(fOkButton, fL1);
1434 fFrame1->AddFrame(fCancelButton, fL1);
1436 fFrame1->Resize(150, fOkButton->GetDefaultHeight());
1437 AddFrame(fFrame1, fL2);
1439 //--------- create Tab widget and some composite frames for Tab testing
1441 fTab = new TGTab(this, 300, 300);
1442 fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
1446 TGCompositeFrame *tf = fTab->AddTab("Draw");
1447 fF1 = new AliGUISliders(tf, this, 60, 20);
1448 tf->AddFrame(fF1,fL3);
1451 // Tab2: Drawing Options
1453 tf = fTab->AddTab("Options");
1454 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1456 fF2 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1458 fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "Shadow", 86), fL3);
1459 fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "Hide ", 87), fL3);
1460 fF2->AddFrame(fChk3 = new TGCheckButton(fF2, "Clip ", 88), fL3);
1462 fF2->AddFrame(fLabel1 = new TGLabel(fF2, "Fill"),fL3);
1464 fCombo = new TGComboBox(fF2, 89);
1465 fF2->AddFrame(fCombo, fL3);
1467 tf->AddFrame(fF2, fL3);
1470 for (i = 0; i < 8; i++) {
1473 sprintf(tmp, "%i", i+1);
1474 fCombo->AddEntry(tmp, i+1);
1477 fCombo->Resize(50, 20);
1478 fCombo->Associate(this);
1480 fChk1->Associate(this);
1481 fChk2->Associate(this);
1482 fChk3->Associate(this);
1484 // Tab3: Seen Option
1486 tf = fTab->AddTab("Seen");
1487 fF3 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1488 fF3->AddFrame(fLabel2 = new TGLabel(fF3, "Seen"),fL3);
1489 fCombo2 = new TGComboBox(fF3, 90);
1490 fF3->AddFrame(fCombo2, fL3);
1491 tf->AddFrame(fF3, fL3);
1493 for (i = 0; i < 4; i++) {
1496 sprintf(tmp, "%i", i-2);
1497 fCombo2->AddEntry(tmp, i+1);
1500 fCombo2->Resize(50, 20);
1501 fCombo2->Associate(this);
1505 tf = fTab->AddTab("ClipBox");
1506 //--- layout for buttons: top align, equally expand horizontally
1507 fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1509 //--- layout for the frame: place at bottom, right aligned
1510 fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1515 fF4 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1517 fHSframe1 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1519 fTbh11 = new TGTextBuffer(10);
1520 fTeh11 = new TGTextEntry(fHSframe1, fTbh11,1);
1521 fTbh11->AddText(0, " 0");
1522 fTeh11->Associate(this);
1524 fTbh12 = new TGTextBuffer(10);
1525 fTeh12 = new TGTextEntry(fHSframe1, fTbh12,1);
1526 fTbh12->AddText(0, "2000");
1527 fTeh12->Associate(this);
1529 fDslider1 = new TGDoubleHSlider(fHSframe1, 400, kSlider1 | kScaleBoth, 1);
1530 fDslider1->Associate(this);
1531 fDslider1->SetRange(-2000, 2000);
1532 fDslider1->SetPosition(0, 2000);
1534 fSLabel1 = new TGLabel(fHSframe1, "xmin-xmax");
1536 fHSframe1->AddFrame(fSLabel1, fBfly1);
1537 fHSframe1->AddFrame(fTeh11, fBfly1);
1538 fHSframe1->AddFrame(fTeh12, fBfly1);
1539 fHSframe1->AddFrame(fDslider1, fBfly1);
1541 fF4->AddFrame(fHSframe1, fBly);
1544 fHSframe2 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1546 fTbh21 = new TGTextBuffer(10);
1547 fTeh21 = new TGTextEntry(fHSframe2, fTbh21,1);
1548 fTbh21->AddText(0, " 0");
1549 fTeh21->Associate(this);
1551 fTbh22 = new TGTextBuffer(10);
1552 fTeh22 = new TGTextEntry(fHSframe2, fTbh22,1);
1553 fTbh22->AddText(0, "2000");
1554 fTeh22->Associate(this);
1556 fDslider2 = new TGDoubleHSlider(fHSframe2, 400, kSlider1 | kScaleBoth, 2);
1557 fDslider2->Associate(this);
1558 fDslider2->SetRange(-2000, 2000);
1559 fDslider2->SetPosition(0, 2000);
1561 fSLabel2 = new TGLabel(fHSframe2, "ymin-ymax");
1563 fHSframe2->AddFrame(fSLabel2, fBfly1);
1564 fHSframe2->AddFrame(fTeh21, fBfly1);
1565 fHSframe2->AddFrame(fTeh22, fBfly1);
1566 fHSframe2->AddFrame(fDslider2, fBfly1);
1568 fF4->AddFrame(fHSframe2, fBly);
1571 fHSframe3 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1573 fTbh31 = new TGTextBuffer(10);
1574 fTeh31 = new TGTextEntry(fHSframe3, fTbh31,1);
1575 fTbh31->AddText(0, " 0");
1576 fTeh31->Associate(this);
1578 fTbh32 = new TGTextBuffer(10);
1579 fTeh32 = new TGTextEntry(fHSframe3, fTbh32,1);
1580 fTbh32->AddText(0, "2000");
1581 fTeh32->Associate(this);
1583 fDslider3 = new TGDoubleHSlider(fHSframe3, 400, kSlider1 | kScaleBoth, 3);
1584 fDslider3->Associate(this);
1585 fDslider3->SetRange(-2000, 2000);
1586 fDslider3->SetPosition(0, 2000);
1588 fSLabel3 = new TGLabel(fHSframe3, "zmin-zmax");
1590 fHSframe3->AddFrame(fSLabel3, fBfly1);
1591 fHSframe3->AddFrame(fTeh31, fBfly1);
1592 fHSframe3->AddFrame(fTeh32, fBfly1);
1593 fHSframe3->AddFrame(fDslider3, fBfly1);
1595 fF4->AddFrame(fHSframe3, fBly);
1596 tf->AddFrame(fF4, fL3);
1599 TGLayoutHints *fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
1600 kLHintsExpandY, 2, 2, 5, 1);
1601 AddFrame(fTab, fL5);
1604 Resize(GetDefaultSize());
1606 // position relative to the parent's window
1609 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
1610 (((TGFrame *) main)->GetWidth() - fWidth) >> 1,
1611 (((TGFrame *) main)->GetHeight() - fHeight) >> 1,
1615 SetWindowName("Dialog");
1618 //gClient->WaitFor(this); // otherwise canvas contextmenu does not work
1621 AliGuiGeomDialog::~AliGuiGeomDialog()
1623 // Delete test dialog widgets.
1626 delete fCancelButton;
1628 delete fChk1; delete fChk2;
1629 delete fF1; delete fF2; delete fF3; delete fF4;
1632 delete fL3; delete fL4;
1633 delete fL1; delete fL2;
1634 delete fBly; delete fBfly1;
1635 delete fTbh11; delete fTbh12; delete fTbh21; delete fTbh22;
1636 delete fTbh31; delete fTbh32; delete fTeh11; delete fTeh12;
1637 delete fTeh21; delete fTeh22; delete fTeh31; delete fTeh32;
1638 delete fDslider1; delete fDslider2; delete fDslider3;
1639 delete fSLabel1; delete fSLabel2; delete fSLabel3;
1642 void AliGuiGeomDialog::Update()
1652 param=gCurrentVolume->GetParam(P_Seen);
1653 fCombo2->Select(Int_t(param)+3);
1655 // Hide, Shadow, Clip
1657 if (Int_t(gCurrentVolume->GetParam(P_Shadow))) {
1658 fChk1->SetState(kButtonDown);
1660 fChk1->SetState(kButtonUp);
1665 if (Int_t(gCurrentVolume->GetParam(P_Hide))) {
1666 fChk2->SetState(kButtonDown);
1668 fChk2->SetState(kButtonUp);
1673 if (Int_t(gCurrentVolume->GetParam(P_Clip))) {
1674 fChk3->SetState(kButtonDown);
1676 fChk3->SetState(kButtonUp);
1682 void AliGuiGeomDialog::CloseWindow()
1684 // Called when window is closed via the window manager.
1688 Bool_t AliGuiGeomDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1690 // Process messages coming from widgets associated with the dialog.
1693 switch (GET_MSG(msg)) {
1695 switch (GET_SUBMSG(msg)) {
1697 switch (Int_t(parm1)) {
1699 min=fDslider1->GetMinPosition();
1700 max=fDslider1->GetMaxPosition();
1701 sprintf(buf, "%6.2f", min);
1703 fTbh11->AddText(0, buf);
1704 sprintf(buf, "%6.2f", max);
1706 fTbh12->AddText(0, buf);
1707 gClient->NeedRedraw(fTeh11);
1708 gClient->NeedRedraw(fTeh12);
1709 gCurrentVolume->SetParam(P_ClipXmin,min);
1710 gCurrentVolume->SetParam(P_ClipXmax,max);
1713 min=fDslider2->GetMinPosition();
1714 max=fDslider2->GetMaxPosition();
1715 sprintf(buf, "%6.2f", min);
1717 fTbh21->AddText(0, buf);
1718 sprintf(buf, "%6.2f", max);
1720 fTbh22->AddText(0, buf);
1721 gClient->NeedRedraw(fTeh21);
1722 gClient->NeedRedraw(fTeh22);
1723 gCurrentVolume->SetParam(P_ClipYmin,min);
1724 gCurrentVolume->SetParam(P_ClipYmax,max);
1727 min=fDslider3->GetMinPosition();
1728 max=fDslider3->GetMaxPosition();
1729 sprintf(buf, "%6.2f", min);
1731 fTbh31->AddText(0, buf);
1732 sprintf(buf, "%6.2f", max);
1734 fTbh32->AddText(0, buf);
1735 gClient->NeedRedraw(fTeh31);
1736 gClient->NeedRedraw(fTeh32);
1737 gCurrentVolume->SetParam(P_ClipZmin,min);
1738 gCurrentVolume->SetParam(P_ClipZmax,max);
1746 switch (GET_SUBMSG(msg)) {
1751 printf("\nTerminating dialog: %s pressed\n",
1752 (parm1 == 1) ? "OK" : "Cancel");
1760 gCurrentVolume->SetParam(P_Fill, Float_t(parm2));
1761 gCurrentVolume->Draw();
1764 gCurrentVolume->SetParam(P_Seen, Float_t(parm2-3));
1765 gCurrentVolume->Draw();
1769 case kCM_CHECKBUTTON:
1772 if (Int_t(gCurrentVolume->GetParam(P_Shadow))) {
1773 gCurrentVolume->SetParam(P_Shadow, 0.);
1775 gCurrentVolume->SetParam(P_Shadow, 1.);
1777 gCurrentVolume->Draw();
1780 if (Int_t(gCurrentVolume->GetParam(P_Hide))) {
1781 gCurrentVolume->SetParam(P_Hide, 0.);
1783 gCurrentVolume->SetParam(P_Hide, 1.);
1785 gCurrentVolume->Draw();
1788 if (Int_t(gCurrentVolume->GetParam(P_Clip))) {
1789 gCurrentVolume->SetParam(P_Clip, 0.);
1791 gCurrentVolume->SetParam(P_Clip, 1.);
1793 gCurrentVolume->Draw();
1812 static Text_t* LabelText[7] =
1813 {"Theta ", "Phi ", "Psi ", "U ", "V ", "UScale", "VScale"};
1814 static Int_t IRangeMin[7] = { 0, 0, 0, 0, 0, 0, 0};
1815 static Int_t IRangeMax[7] = {36000, 36000, 36000, 2000, 2000, 10, 10};
1816 static Int_t DefaultPos[7] = { 3000, 4000, 0, 1000, 1000, 1, 1};
1818 AliGUISliders::AliGUISliders(const TGWindow *p, const TGWindow *,
1819 UInt_t w, UInt_t h) :
1820 TGCompositeFrame(p, w, h,kVerticalFrame)
1822 ChangeOptions((GetOptions() & ~kHorizontalFrame) | kVerticalFrame);
1823 //--- layout for buttons: top align, equally expand horizontally
1824 fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1826 //--- layout for the frame: place at bottom, right aligned
1827 fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1831 for (Int_t i=0; i<7; i++) {
1834 fHframe[i] = new TGHorizontalFrame(this, 400, 100, kFixedWidth);
1835 fTbh[i] = new TGTextBuffer(10);
1836 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
1838 sprintf(buf, "%6.2f", Float_t(DefaultPos[i])/100);
1839 fTbh[i]->AddText(0, buf);
1840 fTeh[i]->Associate(this);
1842 fHslider[i] = new TGHSlider(fHframe[i], 400, kSlider1 | kScaleBoth, idS);
1843 fHslider[i]->Associate(this);
1844 fHslider[i]->SetRange(IRangeMin[i], IRangeMax[i]);
1845 fHslider[i]->SetPosition(DefaultPos[i]);
1847 fLabel[i] = new TGLabel(fHframe[i], LabelText[i]);
1850 fHframe[i]->AddFrame(fLabel[i], fBfly1);
1851 fHframe[i]->AddFrame(fTeh[i], fBfly1);
1852 fHframe[i]->AddFrame(fHslider[i], fBfly1);
1853 AddFrame(fHframe[i], fBly);
1857 AliGUISliders::~AliGUISliders()
1859 delete fBfly1; delete fBly;
1861 for (Int_t i=1; i<7; i++) {
1869 void AliGUISliders::Update()
1873 for (Int_t i=0; i<7; i++) {
1874 Float_t param = gCurrentVolume->GetParam(i);
1876 fHslider[i]->SetPosition(Int_t(param*100.));
1877 gClient->NeedRedraw(fHslider[i]);
1879 sprintf(buf, "%6.2f", param);
1881 fTbh[i]->AddText(0, buf);
1882 gClient->NeedRedraw(fTeh[i]);
1889 void AliGUISliders::CloseWindow()
1891 // Called when window is closed via the window manager.
1896 Bool_t AliGUISliders::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1898 // Process slider messages.
1902 switch (GET_MSG(msg)) {
1904 switch (GET_SUBMSG(msg)) {
1905 case kTE_TEXTCHANGED:
1906 Int_t idT=Int_t(parm1)-1;
1907 fHslider[idT]->SetPosition((Int_t)atof(fTbh[idT]->GetString())*100);
1908 gClient->NeedRedraw(fHslider[idT]);
1909 gCurrentVolume->SetParam(idT,atof(fTbh[idT]->GetString()));
1910 gCurrentVolume->Draw();
1914 switch (GET_SUBMSG(msg)) {
1916 sprintf(buf, "%6.2f", Float_t(parm2)/100);
1917 Int_t idS=Int_t(parm1)-8;
1919 fTbh[idS]->AddText(0, buf);
1920 gClient->NeedRedraw(fTeh[idS]);
1921 gCurrentVolume->SetParam(idS, Float_t(parm2)/100.);
1922 gCurrentVolume->Draw();
1929 ClassImp(AliGUIMaterial)
1931 AliGUIMaterial::AliGUIMaterial()
1942 AliGUIMaterial::AliGUIMaterial(Int_t imat, char* name, Float_t a, Float_t z,
1943 Float_t dens, Float_t radl, Float_t absl)
1953 void AliGUIMaterial::Dump()
1955 printf("\n *****************************************");
1956 printf("\n Material Number: %10d", fId);
1957 printf("\n %s", fName);
1958 printf("\n Mass Number: %10.2f", fA);
1959 printf("\n Charge Number: %10.2f", fZ);
1960 printf("\n Density: %10.2f", fDensity);
1961 printf("\n Radiation Length: %10.2f", fRadl);
1962 printf("\n Absorption Length: %10.2f", fAbsl);
1965 Int_t AliGUIMaterial::Id()
1970 char* AliGUIMaterial::Name()
1975 Float_t AliGUIMaterial::A()
1980 Float_t AliGUIMaterial::Z()
1985 Float_t AliGUIMaterial::Density()
1990 Float_t AliGUIMaterial::RadiationLength()
1995 Float_t AliGUIMaterial::AbsorptionLength()
2001 void AliGUIMaterial::Plot()
2006 void AliGUIMaterial::Streamer(TBuffer &)
2011 ClassImp(AliGUIMedium)
2013 AliGUIMedium::AliGUIMedium()
2019 AliGUIMedium::AliGUIMedium(Int_t imed, Int_t imat, char* name, Int_t isvol,
2021 Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax,
2022 Float_t epsil, Float_t stmin)
2037 void AliGUIMedium::Dump()
2042 Int_t AliGUIMedium::Id()
2047 char* AliGUIMedium::Name()
2052 Float_t AliGUIMedium::GetPar(Int_t ipar)
2057 } else if(ipar >=23 && ipar <27) {
2066 void AliGUIMedium::Streamer(TBuffer &)