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.7 2000/06/28 21:27:45 morsch
19 Most coding rule violations corrected.
20 Still to do: Split the file (on file per class) ? Avoid the global variables.
21 Copy constructors and assignment operators (dummy ?)
23 Revision 1.6 2000/04/14 11:07:46 morsch
24 Correct volume to medium assignment in case several media are asigned to the
27 Revision 1.5 2000/03/20 15:11:03 fca
28 Mods to make the code compile on HP
30 Revision 1.4 2000/01/18 16:12:08 morsch
31 Bug in calculation of number of volume divisions and number of positionings corrected
32 Browser for Material and Media properties added
34 Revision 1.3 1999/11/14 14:31:14 fca
35 Correct small error and remove compilation warnings on HP
37 Revision 1.2 1999/11/10 16:53:35 fca
38 The new geometry viewer from A.Morsch
44 * Written by Andreas Morsch
48 * For questions critics and suggestions to this part of the code
49 * contact andreas.morsch@cern.ch
51 **************************************************************************/
58 #include <TApplication.h>
59 #include <TVirtualX.h>
60 #include <TGListBox.h>
61 #include <TGListTree.h>
67 #include <TGTextEntry.h>
71 #include <TGComboBox.h>
74 #include <TGDoubleSlider.h>
75 #include <TGFileDialog.h>
76 #include <TRootEmbeddedCanvas.h>
83 #include <TGPicture.h>
86 #include "TGeant3GUI.h"
88 static AliDrawVolume *gCurrentVolume = new AliDrawVolume("NULL");
89 static AliGUIMaterial *gCurrentMaterial = new AliGUIMaterial();
90 static AliGUIMedium *gCurrentMedium = new AliGUIMedium();
91 static Int_t gCurrentParticle = 1;
92 static Int_t gCurrentProcess = 1;
94 ClassImp(AliGeant3GeometryGUI)
96 AliGeant3GeometryGUI::AliGeant3GeometryGUI()
99 fPanel = new AliGuiGeomMain(gClient->GetRoot(), 500, 500);
101 fVolumes = new TClonesArray("AliDrawVolume",1000);
102 fMaterials = new TClonesArray("AliGUIMaterial",1000);
103 fMedia = new TClonesArray("AliGUIMedium",1000);
104 // Store local copy of zebra bank entries
105 TGeant3 *geant3 = (TGeant3*) gMC;
110 fGclink=geant3->Gclink();
111 fGcnum=geant3->Gcnum();
117 void AliGeant3GeometryGUI::Streamer(TBuffer &)
124 void AliGeant3GeometryGUI::ReadGeometryTree()
127 // Copy zebra volume tree into ROOT LisTree
130 char /* *namec, */ *tmp;
133 // Closed folder (=volume containing children)
134 const TGPicture* kFolder = gClient->GetPicture("folder_t.xpm");
135 // Open folder (=volume containing children)
136 const TGPicture* kOpenFolder = gClient->GetPicture("ofolder_t.xpm");
138 const TGPicture* kDocument = gClient->GetPicture("doc_t.xpm");
140 AliDrawVolume *volume;
144 Int_t newlevel=nlevel;
146 volume = new AliDrawVolume("ALIC");
147 volume->SetIdVolume(((TGeant3*)gMC)->VolId("ALIC"));
148 volume->SetIdCopy(0);
149 volume->SetItem(NULL);
150 (*fVolumes)[0]=volume;
152 // Loop over volumes for which information has been collected
154 for (Int_t i=nst; i<nlevel; i++)
156 TGListTreeItem *itemi, *item2;
157 // GEANT3 volume number
158 Int_t ivol=TMath::Abs(Volume(i)->GetIdVolume());
160 // icopy=1 normal positioning
161 // icopy>1 positioning with parposp
163 Int_t icopy = Volume(i)->GetIdCopy();
164 // Medium and material number, handle special case of divisions
169 imat=Material(-ivol);
175 // Number of children
176 Int_t nch = NChildren(ivol);
177 strcpy(namec,((TGeant3*)gMC)->VolName(ivol));
179 printf("\n %s has %d children \n ", namec, nch);
181 printf("\n %s has divisions \n ", namec);
184 // Name to be used in ListTree
186 strncpy(vname,namec, 4);
190 sprintf(namec,"%s*%3dPos",namec,icopy);
191 } else if (icopy <0) {
192 sprintf(namec,"%s*%3dDiv",namec,-icopy);
195 itemi=Volume(i)->GetItem();
201 // Add volume to list tree
204 item2 = fPanel->AddItem(new AliDrawVolume(vname),
205 itemi, namec, kOpenFolder, kFolder);
207 item2 = fPanel->AddItem(new AliDrawVolume(vname),
208 itemi, namec, kDocument, kDocument);
211 // Add medium information to list tree item
212 ((AliDrawVolume *) item2->GetUserData())->SetIdVolume(ivol);
213 ((AliDrawVolume *) item2->GetUserData())->SetIdMaterial(imat);
214 ((AliDrawVolume *) item2->GetUserData())->SetIdMedium(imed);
216 // Set current volume to first list tree entry
217 if (!i) gCurrentVolume= ((AliDrawVolume *) item2->GetUserData());
220 // Collect children information
222 // nch < 0: Children by division
225 // Geant volume number
226 Int_t icvol=Child(ivol,1);
228 strcpy(namec,((TGeant3*)gMC)->VolName(-icvol));
230 strncpy(tmp,(char *) &namec, 4);
231 volume = new AliDrawVolume(namec);
232 volume->SetIdVolume(-icvol);
233 // Number of divisions
234 Int_t jvo = fZlq[fGclink->jvolum-ivol];
235 Int_t jdiv = fZlq[jvo-1];
236 Int_t ndiv = Int_t (fZq[jdiv+3]);
237 volume->SetIdCopy(-ndiv);
239 volume->SetItem(item2);
240 (*fVolumes)[newlevel]=volume;
241 printf("\n volume %s %d %d %d", namec, icvol, nch, ndiv);
244 // Children by positioning
247 // Loop over children
248 for (Int_t j=0; j<nch; j++)
251 // Find out if this volume was already positioned and count copies
252 Int_t icvol=Child(ivol,j+1);
253 icvol = TMath::Abs(icvol);
254 Bool_t inList=kFALSE;
255 for (Int_t k=0; k<nnew; k++) {
257 Volume(newlevel-k-1)->GetIdVolume())
259 Volume(newlevel-k-1)->AddCopy();
268 strcpy(namec,((TGeant3*)gMC)->VolName(icvol));
270 strncpy(tmp,(char *) &namec, 4);
271 volume = new AliDrawVolume(namec);
272 volume->SetIdVolume(icvol);
273 volume->SetIdCopy(1);
275 volume->SetItem(item2);
276 (*fVolumes)[newlevel]=volume;
277 printf("\n volume %s %d %d", namec, icvol, nch);
284 // Move one level deaper
290 void AliGeant3GeometryGUI::ReadMaterials()
293 // Puts media and material names into ComboBox and
294 // collects material information
296 Float_t a, z, dens, radl, absl;
297 a=z=dens=radl=absl=-1;
299 Int_t imat, isvol, ifield;
300 Float_t fieldm, tmaxfd, stemax, deemax, epsil, stmin;
305 char natmed[21], namate[21];
310 for(Int_t itm=1;itm<=fGcnum->ntmed;itm++) {
311 Int_t jtm = fZlq[fGclink->jtmed-itm];
315 // Get medium parameters
316 ((TGeant3*)(gMC))->Gftmed(itm, natmed, imat, isvol, ifield, fieldm,
317 tmaxfd, stemax, deemax, epsil, stmin, ubuf, &nwbuf);
318 strncpy(natmed,(char*)&fZiq[jtm+1],20);
321 // Create new medium object
322 AliGUIMedium * medium =
323 new AliGUIMedium(itm, imat, natmed, isvol, ifield, fieldm,
324 tmaxfd, stemax, deemax, epsil, stmin);
325 (*fMedia)[nEntries-1]=medium;
326 { //Begin local scope for j
327 for (Int_t j=1; j<=22; j++) {
328 medium->SetPar(j,Cut(itm,j));
330 } //End local scope for j
331 { //Begin local scope for j
332 for (Int_t j=23; j<=26; j++) {
333 medium->SetPar(j,Cut(itm,j+3));
335 } //End local scope for j
336 { //Begin local scope for j
337 for (Int_t j=27; j<=29; j++) {
338 medium->SetPar(j,Cut(itm,j+4));
340 } //End local scope for j
343 fPanel->AddMedium(medium, nEntries);
345 // Associated material
346 imat = Int_t (fZq[jtm+6]);
347 Int_t jma = Int_t (fZlq[fGclink->jmate-imat]);
349 // Get material parameters
350 ((TGeant3*)(gMC))->Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
351 strncpy(namate,(char *)&fZiq[jma+1],20);
354 // Create new material object
355 AliGUIMaterial * material =
356 new AliGUIMaterial(imat,namate,a,z,dens,radl,absl);
357 (*fMaterials)[nEntries-1]=material;
361 fPanel->AddMaterial(material, nEntries);
362 gCurrentMaterial=material;
365 fPanel->SetComboEntries(fMaterials);
366 fPanel->SetMediaComboEntries(fMedia);
370 Int_t AliGeant3GeometryGUI::NChildren(Int_t idvol)
373 // Return number of children for volume idvol
374 Int_t jvo = fZlq[fGclink->jvolum-idvol];
375 Int_t nin = Int_t(fZq[jvo+3]);
379 Int_t AliGeant3GeometryGUI::Child(Int_t idvol, Int_t idc)
382 // Return GEANT id of child number idc of volume idvol
383 Int_t jvo = fZlq[fGclink->jvolum-idvol];
385 Int_t jin = fZlq[jvo-nin];
386 Int_t numb = Int_t (fZq[jin +3]);
388 return -Int_t(fZq[jin+2]);
390 return Int_t(fZq[jin+2]);
394 Int_t AliGeant3GeometryGUI::Medium(Int_t idvol)
397 // Return medium number for volume idvol.
398 // If idvol is negative the volume results from a division.
401 Int_t jvo = fZlq[fGclink->jvolum-idvol];
402 imed = Int_t(fZq[jvo+4]);
405 Int_t jdiv = fZlq[fGclink->jvolum-idvol];
406 Int_t ivin = Int_t ( fZq[jdiv+2]);
407 Int_t jvin = fZlq[fGclink->jvolum-ivin];
408 imed = Int_t (fZq[jvin+4]);
413 Int_t AliGeant3GeometryGUI::Material(Int_t idvol)
415 // Return material number for volume idvol.
416 // If idvol is negative the volume results from a division.
418 Int_t imed=Medium(idvol);
419 Int_t jtm = fZlq[fGclink->jtmed-imed];
420 return Int_t (fZq[jtm+6]);
424 Float_t AliGeant3GeometryGUI::Cut(Int_t imed, Int_t icut)
426 // Return cuts icut for medium idmed
428 Int_t jtm = fZlq[fGclink->jtmed-imed];
430 // Have the defaults been modified ??
431 Int_t jtmn = fZlq[jtm];
439 return Float_t (fZq[jtm+icut]);
442 ClassImp(AliDrawVolume)
444 // Drawing parameter tags
445 enum AliDrawParamId {
467 AliDrawVolume::AliDrawVolume(char* name)
491 char* AliDrawVolume::Name()
494 // Return volume name
499 void AliDrawVolume::Streamer(TBuffer &)
507 void AliDrawVolume::Draw(Option_t *)
509 // Wraps the geant Gdraw
510 gMC->Gsatt(fName,"seen", fSeen);
513 gMC->Gdopt("hide", "on");
515 gMC->Gdopt("hide", "off");
519 gMC->Gdopt("shad", "on");
520 gMC->Gsatt("*", "fill", fFill);
522 gMC->Gdopt("shad", "off");
525 gMC->SetClipBox(".");
527 gMC->SetClipBox("*", fClipXmin, fClipXmax,
528 fClipYmin, fClipYmax, fClipZmin, fClipZmax);
530 gMC->SetClipBox(".");
534 gMC->Gdraw(fName, fTheta, fPhi, fPsi, fU, fV, fUscale, fVscale);
535 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
536 if (higz) higz->Update();
539 void AliDrawVolume::DrawSpec()
541 // Wraps the Geant DrawSpec
542 gMC->Gsatt(fName,"seen", fSeen);
545 gMC->Gdopt("hide", "on");
547 gMC->Gdopt("hide", "off");
551 gMC->Gdopt("shad", "on");
552 gMC->Gsatt("*", "fill", fFill);
554 gMC->Gdopt("shad", "off");
557 gMC->SetClipBox(".");
559 gMC->SetClipBox("*", fClipXmin, fClipXmax, fClipYmin, fClipYmax, fClipZmin, fClipZmax);
561 gMC->SetClipBox(".");
565 ((TGeant3*) gMC)->DrawOneSpec(fName);
566 THIGZ *higz = (THIGZ*)gROOT->GetListOfCanvases()->FindObject("higz");
567 if (higz) higz->Update();
570 void AliDrawVolume::SetParam(Int_t ip, Float_t param)
572 // Set drawing parameters
599 fShadow=Int_t(param);
631 Float_t AliDrawVolume::GetParam(Int_t ip)
633 // Get drawing parameters
650 return Float_t(fHide);
652 return Float_t(fShadow);
654 return Float_t(fFill);
656 return Float_t(fSeen);
658 return Float_t(fClip);
678 ClassImp(AliGuiGeomMain)
680 const Text_t* kLabelTextP[19] =
681 {"PAIR ", "COMP ", "PHOT ", "PFIS ", "DRAY ", "ANNI ", "BREM ",
682 "HADR ", "MUNU ", "DCAY ", "LOSS ", "MULS ", "GHCOR1", "BIRK1 ",
683 "BIRK2 ", "BIRK3 ", "LABS ", "SYNC ", "STRA "};
686 const Text_t* kLabelTextC[10] =
687 {"CUTGAM", "CUTELE", "CUTNEU", "CUTHAD", "CUTMUO", "BCUTE", "BCUTM",
688 "DCUTE ", "DCUTM ", "PPCUTM"};
690 const Text_t* kLabelTextPart[24] =
691 {"Photon", "Positron", "Electron", "Neutrino", "Muon+", "Muon-",
692 "Pi0", "Pi+", "Pi-", "Kaon_L", "Kaon+", "Kaon-", "Neutron", "Proton",
693 "Anti Proton", "Kaon_S", "Eta", "Lambda", "Sigma+", "Sigma0", "Sigma-",
694 "Xi0", "Xi-", "Omega-"};
696 const Text_t* kLabelTextMechanism[24] =
697 {"HADF", "INEF", "ELAF", "FISF", "CAPF",
698 "HADG", "INEG", "ELAG", "FISG", "CAPG",
699 "LOSS", "PHOT", "ANNI", "COMP", "BREM",
700 "PAIR", "DRAY", "PFIS", "RAYL", "HADG",
701 "MUNU", "RANG", "STEP", "MUON"};
706 enum ETestCommandIdentifiers {
731 Int_t mbButtonId[9] = { kMBYes, kMBNo, kMBOk, kMBApply,
732 kMBRetry, kMBIgnore, kMBCancel,
733 kMBClose, kMBDismiss };
735 EMsgBoxIcon mbIcon[4] = { kMBIconStop, kMBIconQuestion,
736 kMBIconExclamation, kMBIconAsterisk };
738 const char *kFileTypes[] = { "All files", "*",
739 "ROOT files", "*.root",
740 "ROOT macros", "*.C",
746 TGListTreeItem* AliGuiGeomMain::
747 AddItem(TObject * obj, TGListTreeItem *parent, const char* name, const TGPicture *open, const TGPicture *closed)
749 // Add item to the list tree
750 return fLt->AddItem(parent, name, obj, open, closed);
753 AliGuiGeomMain::AliGuiGeomMain(const TGWindow *p, UInt_t w, UInt_t h)
754 : TGMainFrame(p, w, h)
756 // Create test main frame. A TGMainFrame is a top level window.
757 // Create menubar and popup menus. The hint objects are used to place
758 // and group the different menu widgets with respect to eachother.
761 fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
763 fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
764 fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
766 fMenuFile = new TGPopupMenu(gClient->GetRoot());
767 fMenuFile->AddEntry("&Open...", kFileOpen);
768 fMenuFile->AddEntry("&Save", kFileSave);
769 fMenuFile->AddEntry("S&ave as...", kFileSaveAs);
770 fMenuFile->AddEntry("&Close", -1);
771 fMenuFile->AddSeparator();
772 fMenuFile->AddEntry("E&xit", kFileExit);
774 fMenuFile->DisableEntry(kFileSaveAs);
775 fMenuFile->DisableEntry(kFileOpen);
776 fMenuFile->DisableEntry(kFileSave);
780 fMenuTest = new TGPopupMenu(this);
781 fMenuTest->AddLabel("Draw");
782 fMenuTest->AddSeparator();
783 fMenuTest->AddEntry("&Volume Draw Control", kTestDlg);
784 fMenuTest->AddSeparator();
785 fMenuTest->Associate(this);
788 fMenuHelp = new TGPopupMenu(gClient->GetRoot());
789 fMenuHelp->AddEntry("&Contents", kHelpContents);
790 fMenuHelp->AddEntry("&Search...", kHelpSearch);
791 fMenuHelp->AddSeparator();
792 fMenuHelp->AddEntry("&About", kHelpAbout);
794 fMenuFile->DisableEntry(kHelpContents);
795 fMenuFile->DisableEntry(kHelpSearch);
796 fMenuFile->DisableEntry(kHelpAbout);
797 // Menu button messages are handled by the main frame (i.e. "this")
798 // ProcessMessage() method.
799 fMenuFile->Associate(this);
800 fMenuTest->Associate(this);
801 fMenuHelp->Associate(this);
803 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
804 fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
805 fMenuBar->AddPopup("&Draw Control", fMenuTest, fMenuBarItemLayout);
806 fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
808 AddFrame(fMenuBar, fMenuBarLayout);
813 fTab = new TGTab(this, 400, 400);
814 TGCompositeFrame *tf = fTab->AddTab("Volumes");
815 TGLayoutHints *lTab = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
816 kLHintsExpandY, 2, 2, 5, 1);
817 AddFrame(fTab, lTab);
819 // Create TGCanvas and a canvas container which uses a tile layout manager
820 fCanvasWindow = new TGCanvas(tf, 400, 240);
822 fLt = new TGListTree(fCanvasWindow->GetViewPort(), 10, 10, kHorizontalFrame,
824 fLt->Associate(this);
825 fCanvasWindow->SetContainer(fLt);
828 TGLayoutHints *lo = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
829 tf->AddFrame(fCanvasWindow, lo);
833 tf = fTab->AddTab("Materials");
834 fF2 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
835 fL2 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
836 // ComboBox for materials
837 fMaterialCombo = new TGComboBox(fF2, 1);
838 fF2->AddFrame(fMaterialCombo, fL2);
840 // text labels with material properties
842 Text_t* labelText[6] =
848 "Absorption Length"};
851 new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
852 TGLayoutHints* bFly1 =
853 new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
854 fF21 = new TGCompositeFrame(fF2, 60, 20, kVerticalFrame);
855 fF2->AddFrame(fF21,fL2);
856 { //Begin local scope for i
857 for (Int_t i=0; i<6; i++) {
859 fHframe[i] = new TGHorizontalFrame(fF21, 400, 100, kFixedWidth);
860 fF21->AddFrame(fHframe[i], bly);
861 fTbh[i] = new TGTextBuffer(10);
862 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
863 fTeh[i]->Associate(this);
864 fLabel[i] = new TGLabel(fHframe[i], labelText[i]);
865 fHframe[i]->AddFrame(fLabel[i], bFly1);
866 fHframe[i]->AddFrame(fTeh[i], bFly1);
868 } //End local scope for i
869 tf->AddFrame(fF2, fL2);
870 fMaterialCombo->Resize(200, 20);
871 fMaterialCombo->Associate(this);
876 tf = fTab->AddTab("Media");
877 fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
878 // ComboBox for tracking media
879 fMediaCombo = new TGComboBox(fF3, 2);
880 fF3->AddFrame(fMediaCombo, fL2);
882 // text labels with material properties
884 Text_t* labelTextM[8] =
885 {"Sensitivity Flag ",
886 "Magnetic Field Flag ",
888 "Max. Ang. Deviation ",
890 "Max. Frac. Energy Loss",
891 "Crossing Precission ",
892 "Minimum Step Size "};
894 fF31 = new TGCompositeFrame(fF3, 60, 20, kVerticalFrame);
895 fF3->AddFrame(fF31,fL2);
896 { //Begin local scope for i
897 for (Int_t i=0; i<8; i++) {
899 fHframeM[i] = new TGHorizontalFrame(fF31, 400, 100, kFixedWidth);
900 fF31->AddFrame(fHframeM[i], bly);
901 fTbhM[i] = new TGTextBuffer(10);
902 fTehM[i] = new TGTextEntry(fHframeM[i], fTbhM[i],idT);
903 fTehM[i]->Associate(this);
904 fLabelM[i] = new TGLabel(fHframeM[i], labelTextM[i]);
905 fHframeM[i]->AddFrame(fLabelM[i], bFly1);
906 fHframeM[i]->AddFrame(fTehM[i], bFly1);
908 } //End local scope for i
909 tf->AddFrame(fF3, fL2);
910 fMediaCombo->Resize(200, 20);
911 fMediaCombo->Associate(this);
914 tf = fTab->AddTab("Processes");
915 fF4 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
916 fProcessLB = new TGListBox(fF4, 1);
917 fF4->AddFrame(fProcessLB, fL2);
918 tf->AddFrame(fF4, fL2);
919 fProcessLB->Resize(150, 350);
920 fProcessLB->Associate(this);
924 tf = fTab->AddTab("Cuts");
925 fF5 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
926 fCutsLB = new TGListBox(fF5, 1);
927 fF5->AddFrame(fCutsLB, fL2);
928 tf->AddFrame(fF5, fL2);
929 fCutsLB->Resize(150, 350);
932 // de/dx and cross-sections
933 tf = fTab->AddTab("DE/DX and X-Sections");
934 fF6 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
936 // ComboBox for particles
937 fF61 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
938 fF6->AddFrame(fF61, fL2);
939 fParticleCombo = new TGComboBox(fF61, 3);
940 fF61->AddFrame(fParticleCombo, fL2);
941 { //Begin local scope for i
942 for (Int_t i = 0; i < 24; i++) {
944 sprintf(tmp, "%s", kLabelTextPart[i]);
945 fParticleCombo->AddEntry(tmp, i+1);
947 } //End local scope for i
948 fParticleCombo->Select(1);
949 fParticleCombo->Resize(100, 20);
950 fParticleCombo->Associate(this);
952 // ComboBox for mechanisms
953 fF63 = new TGCompositeFrame(fF6, 60, 20, kVerticalFrame);
954 fF6->AddFrame(fF63, fL2);
955 fMechanismCombo = new TGComboBox(fF63, 4);
956 fF63->AddFrame(fMechanismCombo, fL2);
957 { //Begin local scope for i
958 for (Int_t i = 0; i < 24; i++) {
960 sprintf(tmp, "%s", kLabelTextMechanism[i]);
961 fMechanismCombo->AddEntry(tmp, i+1);
963 } //End local scope for i
964 fMechanismCombo->Select(1);
965 fMechanismCombo->Resize(100, 20);
966 fMechanismCombo->Associate(this);
971 fTbh61 = new TGTextBuffer(10);
972 fTeh61 = new TGTextEntry(fF61, fTbh61,10);
973 fTbh61->AddText(0, " 100");
974 fTeh61->Associate(this);
976 fTbh62 = new TGTextBuffer(10);
977 fTeh62 = new TGTextEntry(fF61, fTbh62,11);
978 fTbh62->AddText(0, "0.001");
979 fTeh62->Associate(this);
981 fTbh63 = new TGTextBuffer(10);
982 fTeh63 = new TGTextEntry(fF61, fTbh63,12);
983 fTbh63->AddText(0, "10.");
984 fTeh63->Associate(this);
990 fSLabel61 = new TGLabel(fF61, "Nbins-Emin-Emax");
991 bFly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
992 fF61->AddFrame(fSLabel61, bFly1);
993 fF61->AddFrame(fTeh61, bFly1);
994 fF61->AddFrame(fTeh62, bFly1);
995 fF61->AddFrame(fTeh63, bFly1);
998 fF62 = new TGCompositeFrame(fF6, 60, 20, kHorizontalFrame);
999 fF6->AddFrame(fF62, fL2);
1000 fPlotButton = new TGTextButton(fF62, "Plot", 1);
1001 fPlotButton -> Associate(this);
1002 fF62->AddFrame(fPlotButton);
1004 tf->AddFrame(fF6, fL2);
1005 // Window name and final mapping
1007 SetWindowName("AliRoot Geometry Browser");
1009 // We need to use GetDefault...() to initialize the layout algorithm...
1010 Resize(GetDefaultSize());
1014 AliGuiGeomMain::~AliGuiGeomMain()
1016 // Delete all created widgets.
1018 delete fCanvasWindow;
1020 delete fMenuBarLayout;
1021 delete fMenuBarItemLayout;
1022 delete fMenuBarHelpLayout;
1029 void AliGuiGeomMain::Streamer(TBuffer &)
1035 void AliGuiGeomMain::Plot()
1037 // plot de/dx or cross-sections
1038 const Float_t kAvo=0.60221367;
1039 Float_t *tkin = new Float_t[fNbins];
1040 Float_t *value = new Float_t[fNbins];
1041 Float_t *pcut = new Float_t[fNbins];
1043 Int_t imate=gCurrentMaterial->Id();
1044 Float_t z=gCurrentMaterial->Z();
1045 Float_t a=gCurrentMaterial->A();
1046 Float_t density=gCurrentMaterial->Density();
1048 Int_t ipart=gCurrentParticle;
1049 const char *kChMeca= kLabelTextMechanism[gCurrentProcess-1];
1052 strncpy(tmp, kChMeca, 4);
1055 Float_t de=(fEmax-fEmin)/fNbins;
1056 { //Begin local scope for i
1057 for (Int_t i=0; i<kdim; i++) {
1058 tkin[i]=fEmin+Float_t(i)*de;
1061 } //End local scope for i
1062 if (kChMeca!="MUON") {
1063 ((TGeant3*) gMC)->Gftmat(imate, ipart, tmp, kdim, tkin, value, pcut, ixst);
1065 for (Int_t i=0; i<kdim; i++) {
1066 Float_t ekin=tkin[i];
1067 value[i]+=((TGeant3*) gMC)->Gbrelm(z,ekin,1.e10);
1068 value[i]+=((TGeant3*) gMC)->Gprelm(z,ekin,1.e10);
1069 value[i]*=1000.*kAvo*density/a;
1074 printf("\n %d %d %s %d \n",imate, ipart, kChMeca, kdim);
1076 TGraph *graph = new TGraph(kdim,tkin,value);
1077 TCanvas *c1 = new TCanvas("c1"," ",400,10,600,700);
1081 graph->SetFillColor(42);
1082 graph->SetMarkerColor(4);
1083 graph->SetMarkerStyle(21);
1085 graph->GetHistogram()->SetXTitle("Energy (GeV)");
1086 if (kChMeca == "RANG" || kChMeca == "STEP") {
1087 graph->GetHistogram()->SetYTitle
1089 } else if (kChMeca == "LOSS" || kChMeca == "MUON") {
1090 graph->GetHistogram()->SetYTitle("dE/dx (MeV/cm)");
1092 graph->GetHistogram()->SetYTitle
1093 ("Macroscopic X-Section (1/cm)");
1104 void AliGuiGeomMain::Update()
1111 Int_t imat=gCurrentVolume->Material();
1112 Int_t nmat=fComboEntries->GetEntriesFast();
1114 for (i=0; i<nmat; i++) {
1115 gCurrentMaterial = (AliGUIMaterial*)
1116 (fComboEntries->UncheckedAt(i));
1117 if (gCurrentMaterial->Id()==imat) break;
1119 Int_t imed = gCurrentVolume->Medium();
1120 Int_t nmed=fComboMediaEntries->GetEntriesFast();
1121 for (i=0; i<nmed; i++) {
1122 gCurrentMedium = (AliGUIMedium*)
1123 (fComboMediaEntries->UncheckedAt(i));
1124 if (gCurrentMedium->Id()==imed) break;
1132 void AliGuiGeomMain::UpdateCombo()
1136 Int_t imat = gCurrentMaterial->Id();
1137 Float_t a = gCurrentMaterial->A();
1138 Float_t z = gCurrentMaterial->Z();
1139 Float_t dens = gCurrentMaterial->Density();
1140 Float_t radl = gCurrentMaterial->RadiationLength();
1141 Float_t absl = gCurrentMaterial->AbsorptionLength();
1142 Int_t entry=gCurrentMaterial->ItemId();
1145 fMaterialCombo->Select(entry);
1146 fMediaCombo->Select(entry);
1149 sprintf(buf, "%10i", imat);
1151 fTbh[0]->AddText(0, buf);
1152 gClient->NeedRedraw(fTeh[0]);
1153 sprintf(buf, "%10.2e", a);
1155 fTbh[1]->AddText(0, buf);
1156 gClient->NeedRedraw(fTeh[1]);
1158 sprintf(buf, "%10.2e", z);
1160 fTbh[2]->AddText(0, buf);
1161 gClient->NeedRedraw(fTeh[2]);
1163 sprintf(buf, "%10.2e", dens);
1165 fTbh[3]->AddText(0, buf);
1166 gClient->NeedRedraw(fTeh[3]);
1168 sprintf(buf, "%10.2e", radl);
1170 fTbh[4]->AddText(0, buf);
1171 gClient->NeedRedraw(fTeh[4]);
1173 sprintf(buf, "%10.2e", absl);
1175 fTbh[5]->AddText(0, buf);
1176 gClient->NeedRedraw(fTeh[5]);
1179 sprintf(buf, "%10i", gCurrentMedium->Isvol());
1181 fTbhM[0]->AddText(0, buf);
1182 gClient->NeedRedraw(fTehM[0]);
1185 sprintf(buf, "%10i", gCurrentMedium->Ifield());
1187 fTbhM[1]->AddText(0, buf);
1188 gClient->NeedRedraw(fTehM[1]);
1190 sprintf(buf, "%10.2e", gCurrentMedium->Fieldm());
1192 fTbhM[2]->AddText(0, buf);
1193 gClient->NeedRedraw(fTehM[2]);
1195 sprintf(buf, "%10.2e", gCurrentMedium->Tmaxfd());
1197 fTbhM[3]->AddText(0, buf);
1198 gClient->NeedRedraw(fTehM[3]);
1200 sprintf(buf, "%10.2e", gCurrentMedium->Stemax());
1202 fTbhM[4]->AddText(0, buf);
1203 gClient->NeedRedraw(fTehM[4]);
1205 sprintf(buf, "%10.2e", gCurrentMedium->Deemax());
1207 fTbhM[5]->AddText(0, buf);
1208 gClient->NeedRedraw(fTehM[5]);
1210 sprintf(buf, "%10.2e", gCurrentMedium->Epsil());
1212 fTbhM[6]->AddText(0, buf);
1213 gClient->NeedRedraw(fTehM[6]);
1215 sprintf(buf, "%10.2e", gCurrentMedium->Stmin());
1217 fTbhM[7]->AddText(0, buf);
1218 gClient->NeedRedraw(fTehM[7]);
1221 void AliGuiGeomMain::UpdateListBox()
1223 // Update the list box
1225 fProcessLB->RemoveEntries(1,19);
1226 for (i=11; i < 30; i++) {
1227 Float_t p=gCurrentMedium->GetPar(i);
1229 sprintf(tmp, "%6s%5d", kLabelTextP[i-11], Int_t(p));
1230 fProcessLB->AddEntry(tmp, i-10);
1232 fProcessLB->MapSubwindows();
1233 fProcessLB->Layout();
1235 fCutsLB->RemoveEntries(1,10);
1236 for (i=1; i < 11; i++) {
1237 Float_t p=gCurrentMedium->GetPar(i);
1239 sprintf(tmp, "%6s%10.3e", kLabelTextC[i-1], p);
1240 fCutsLB->AddEntry(tmp,i);
1242 fCutsLB->MapSubwindows();
1247 void AliGuiGeomMain::CloseWindow()
1249 // Got close message for this MainFrame. Calls parent CloseWindow()
1250 // (which destroys the window) and terminate the application.
1251 // The close message is generated by the window manager when its close
1252 // window menu item is selected.
1254 TGMainFrame::CloseWindow();
1255 gApplication->Terminate(0);
1258 Bool_t AliGuiGeomMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1260 // Process messages to widgets
1261 switch (GET_MSG(msg)) {
1263 // Text entries for binning of cross-section plots
1265 switch (GET_SUBMSG(msg)) {
1266 case kTE_TEXTCHANGED:
1269 fNbins=(Int_t) atof(fTbh61->GetString());
1272 fEmin= atof(fTbh62->GetString());
1275 fEmax= atof(fTbh63->GetString());
1278 printf("\n %d %f %f binning", fNbins, fEmin, fEmax);
1282 // ListTree for volumes
1284 switch (GET_SUBMSG(msg)) {
1286 // Handle mouse click
1289 // Button 1: Select volume
1290 if (parm1 == kButton1) {
1291 TGListTreeItem *item;
1292 if ((item = fLt->GetSelected()))
1294 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1299 // Button 2: Draw volume specifications
1301 if (parm1 == kButton2) {
1302 TGListTreeItem *item;
1303 if ((item = fLt->GetSelected()))
1306 ((AliDrawVolume *) item->GetUserData())->DrawSpec();
1308 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1313 // Button 3: Draw Volume
1314 if (parm1 == kButton3) {
1315 TGListTreeItem *item;
1316 if ((item = fLt->GetSelected()))
1318 ((AliDrawVolume *) item->GetUserData())->Draw();
1319 gCurrentVolume=((AliDrawVolume *) item->GetUserData());
1326 case kCT_ITEMDBLCLICK:
1327 if (parm1 == kButton1) {
1328 if (fLt->GetSelected() != 0) {
1329 gClient->NeedRedraw(fLt);
1338 switch (GET_SUBMSG(msg)) {
1348 // Combo box bindings
1353 gCurrentMaterial=(AliGUIMaterial*)
1354 (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1355 gCurrentMedium=(AliGUIMedium*)
1356 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1363 gCurrentMedium=(AliGUIMedium*)
1364 (fComboMediaEntries->UncheckedAt(Int_t(parm2-1)));
1365 gCurrentMaterial=(AliGUIMaterial*)
1366 (fComboEntries->UncheckedAt(Int_t(parm2-1)));
1373 gCurrentParticle=Int_t(parm2);
1378 gCurrentProcess=Int_t(parm2);
1379 printf("\n Process %d", gCurrentProcess);
1383 case kCM_MENUSELECT:
1392 fi.fFileTypes = (char **)kFileTypes;
1393 new TGFileDialog(gClient->GetRoot(), this, kFDOpen,&fi);
1398 fDialog = new AliGuiGeomDialog
1399 (gClient->GetRoot(), this, 400, 200);
1403 printf("kFileSave\n");
1407 CloseWindow(); // this also terminates theApp
1421 void AliGuiGeomMain::AddMaterial(AliGUIMaterial *Material, Int_t i)
1423 // Add material to material combo
1425 tmp=Material->Name();
1426 Material->SetItemId(i);
1427 fMaterialCombo->AddEntry(tmp, i);
1428 fMaterialCombo->Select(i);
1429 fMaterialCombo->Resize(200, 20);
1432 void AliGuiGeomMain::AddMedium(AliGUIMedium *Medium, Int_t i)
1434 // Add medium to medium combo
1437 Medium->SetItemId(i);
1439 fMediaCombo->AddEntry(tmp, i);
1440 fMediaCombo->Select(i);
1441 fMediaCombo->Resize(200, 20);
1445 AliGuiGeomDialog::AliGuiGeomDialog(const TGWindow *p, const TGWindow *main, UInt_t w,
1446 UInt_t h, UInt_t options)
1447 : TGTransientFrame(p, main, w, h, options)
1449 // Create a dialog window. A dialog window pops up with respect to its
1452 fFrame1 = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
1454 fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
1455 fOkButton->Associate(this);
1456 fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
1457 fCancelButton->Associate(this);
1459 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1461 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
1463 fFrame1->AddFrame(fOkButton, fL1);
1464 fFrame1->AddFrame(fCancelButton, fL1);
1466 fFrame1->Resize(150, fOkButton->GetDefaultHeight());
1467 AddFrame(fFrame1, fL2);
1469 //--------- create Tab widget and some composite frames for Tab testing
1471 fTab = new TGTab(this, 300, 300);
1472 fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
1476 TGCompositeFrame *tf = fTab->AddTab("Draw");
1477 fF1 = new AliGUISliders(tf, this, 60, 20);
1478 tf->AddFrame(fF1,fL3);
1481 // Tab2: Drawing Options
1483 tf = fTab->AddTab("Options");
1484 fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
1486 fF2 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1488 fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "Shadow", 86), fL3);
1489 fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "Hide ", 87), fL3);
1490 fF2->AddFrame(fChk3 = new TGCheckButton(fF2, "Clip ", 88), fL3);
1492 fF2->AddFrame(fLabel1 = new TGLabel(fF2, "Fill"),fL3);
1494 fCombo = new TGComboBox(fF2, 89);
1495 fF2->AddFrame(fCombo, fL3);
1497 tf->AddFrame(fF2, fL3);
1500 for (i = 0; i < 8; i++) {
1503 sprintf(tmp, "%i", i+1);
1504 fCombo->AddEntry(tmp, i+1);
1507 fCombo->Resize(50, 20);
1508 fCombo->Associate(this);
1510 fChk1->Associate(this);
1511 fChk2->Associate(this);
1512 fChk3->Associate(this);
1514 // Tab3: Seen Option
1516 tf = fTab->AddTab("Seen");
1517 fF3 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1518 fF3->AddFrame(fLabel2 = new TGLabel(fF3, "Seen"),fL3);
1519 fCombo2 = new TGComboBox(fF3, 90);
1520 fF3->AddFrame(fCombo2, fL3);
1521 tf->AddFrame(fF3, fL3);
1523 for (i = 0; i < 4; i++) {
1526 sprintf(tmp, "%i", i-2);
1527 fCombo2->AddEntry(tmp, i+1);
1530 fCombo2->Resize(50, 20);
1531 fCombo2->Associate(this);
1535 tf = fTab->AddTab("ClipBox");
1536 //--- layout for buttons: top align, equally expand horizontally
1537 fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1539 //--- layout for the frame: place at bottom, right aligned
1540 fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1545 fF4 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
1547 fHSframe1 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1549 fTbh11 = new TGTextBuffer(10);
1550 fTeh11 = new TGTextEntry(fHSframe1, fTbh11,1);
1551 fTbh11->AddText(0, " 0");
1552 fTeh11->Associate(this);
1554 fTbh12 = new TGTextBuffer(10);
1555 fTeh12 = new TGTextEntry(fHSframe1, fTbh12,1);
1556 fTbh12->AddText(0, "2000");
1557 fTeh12->Associate(this);
1559 fDslider1 = new TGDoubleHSlider(fHSframe1, 400, kSlider1 | kScaleBoth, 1);
1560 fDslider1->Associate(this);
1561 fDslider1->SetRange(-2000, 2000);
1562 fDslider1->SetPosition(0, 2000);
1564 fSLabel1 = new TGLabel(fHSframe1, "xmin-xmax");
1566 fHSframe1->AddFrame(fSLabel1, fBfly1);
1567 fHSframe1->AddFrame(fTeh11, fBfly1);
1568 fHSframe1->AddFrame(fTeh12, fBfly1);
1569 fHSframe1->AddFrame(fDslider1, fBfly1);
1571 fF4->AddFrame(fHSframe1, fBly);
1574 fHSframe2 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1576 fTbh21 = new TGTextBuffer(10);
1577 fTeh21 = new TGTextEntry(fHSframe2, fTbh21,1);
1578 fTbh21->AddText(0, " 0");
1579 fTeh21->Associate(this);
1581 fTbh22 = new TGTextBuffer(10);
1582 fTeh22 = new TGTextEntry(fHSframe2, fTbh22,1);
1583 fTbh22->AddText(0, "2000");
1584 fTeh22->Associate(this);
1586 fDslider2 = new TGDoubleHSlider(fHSframe2, 400, kSlider1 | kScaleBoth, 2);
1587 fDslider2->Associate(this);
1588 fDslider2->SetRange(-2000, 2000);
1589 fDslider2->SetPosition(0, 2000);
1591 fSLabel2 = new TGLabel(fHSframe2, "ymin-ymax");
1593 fHSframe2->AddFrame(fSLabel2, fBfly1);
1594 fHSframe2->AddFrame(fTeh21, fBfly1);
1595 fHSframe2->AddFrame(fTeh22, fBfly1);
1596 fHSframe2->AddFrame(fDslider2, fBfly1);
1598 fF4->AddFrame(fHSframe2, fBly);
1601 fHSframe3 = new TGHorizontalFrame(fF4, 400, 100, kFixedWidth);
1603 fTbh31 = new TGTextBuffer(10);
1604 fTeh31 = new TGTextEntry(fHSframe3, fTbh31,1);
1605 fTbh31->AddText(0, " 0");
1606 fTeh31->Associate(this);
1608 fTbh32 = new TGTextBuffer(10);
1609 fTeh32 = new TGTextEntry(fHSframe3, fTbh32,1);
1610 fTbh32->AddText(0, "2000");
1611 fTeh32->Associate(this);
1613 fDslider3 = new TGDoubleHSlider(fHSframe3, 400, kSlider1 | kScaleBoth, 3);
1614 fDslider3->Associate(this);
1615 fDslider3->SetRange(-2000, 2000);
1616 fDslider3->SetPosition(0, 2000);
1618 fSLabel3 = new TGLabel(fHSframe3, "zmin-zmax");
1620 fHSframe3->AddFrame(fSLabel3, fBfly1);
1621 fHSframe3->AddFrame(fTeh31, fBfly1);
1622 fHSframe3->AddFrame(fTeh32, fBfly1);
1623 fHSframe3->AddFrame(fDslider3, fBfly1);
1625 fF4->AddFrame(fHSframe3, fBly);
1626 tf->AddFrame(fF4, fL3);
1629 TGLayoutHints *fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
1630 kLHintsExpandY, 2, 2, 5, 1);
1631 AddFrame(fTab, fL5);
1634 Resize(GetDefaultSize());
1636 // position relative to the parent's window
1639 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
1640 (((TGFrame *) main)->GetWidth() - fWidth) >> 1,
1641 (((TGFrame *) main)->GetHeight() - fHeight) >> 1,
1645 SetWindowName("Dialog");
1648 //gClient->WaitFor(this); // otherwise canvas contextmenu does not work
1651 AliGuiGeomDialog::~AliGuiGeomDialog()
1653 // Delete test dialog widgets.
1656 delete fCancelButton;
1658 delete fChk1; delete fChk2;
1659 delete fF1; delete fF2; delete fF3; delete fF4;
1662 delete fL3; delete fL4;
1663 delete fL1; delete fL2;
1664 delete fBly; delete fBfly1;
1665 delete fTbh11; delete fTbh12; delete fTbh21; delete fTbh22;
1666 delete fTbh31; delete fTbh32; delete fTeh11; delete fTeh12;
1667 delete fTeh21; delete fTeh22; delete fTeh31; delete fTeh32;
1668 delete fDslider1; delete fDslider2; delete fDslider3;
1669 delete fSLabel1; delete fSLabel2; delete fSLabel3;
1672 void AliGuiGeomDialog::Update()
1683 param=gCurrentVolume->GetParam(kSeen);
1684 fCombo2->Select(Int_t(param)+3);
1686 // Hide, Shadow, Clip
1688 if (Int_t(gCurrentVolume->GetParam(kShadow))) {
1689 fChk1->SetState(kButtonDown);
1691 fChk1->SetState(kButtonUp);
1696 if (Int_t(gCurrentVolume->GetParam(kHide))) {
1697 fChk2->SetState(kButtonDown);
1699 fChk2->SetState(kButtonUp);
1704 if (Int_t(gCurrentVolume->GetParam(kClip))) {
1705 fChk3->SetState(kButtonDown);
1707 fChk3->SetState(kButtonUp);
1713 void AliGuiGeomDialog::CloseWindow()
1715 // Called when window is closed via the window manager.
1719 Bool_t AliGuiGeomDialog::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1721 // Process messages coming from widgets associated with the dialog.
1724 switch (GET_MSG(msg)) {
1726 switch (GET_SUBMSG(msg)) {
1728 switch (Int_t(parm1)) {
1730 min=fDslider1->GetMinPosition();
1731 max=fDslider1->GetMaxPosition();
1732 sprintf(buf, "%6.2f", min);
1734 fTbh11->AddText(0, buf);
1735 sprintf(buf, "%6.2f", max);
1737 fTbh12->AddText(0, buf);
1738 gClient->NeedRedraw(fTeh11);
1739 gClient->NeedRedraw(fTeh12);
1740 gCurrentVolume->SetParam(kClipXmin,min);
1741 gCurrentVolume->SetParam(kClipXmax,max);
1744 min=fDslider2->GetMinPosition();
1745 max=fDslider2->GetMaxPosition();
1746 sprintf(buf, "%6.2f", min);
1748 fTbh21->AddText(0, buf);
1749 sprintf(buf, "%6.2f", max);
1751 fTbh22->AddText(0, buf);
1752 gClient->NeedRedraw(fTeh21);
1753 gClient->NeedRedraw(fTeh22);
1754 gCurrentVolume->SetParam(kClipYmin,min);
1755 gCurrentVolume->SetParam(kClipYmax,max);
1758 min=fDslider3->GetMinPosition();
1759 max=fDslider3->GetMaxPosition();
1760 sprintf(buf, "%6.2f", min);
1762 fTbh31->AddText(0, buf);
1763 sprintf(buf, "%6.2f", max);
1765 fTbh32->AddText(0, buf);
1766 gClient->NeedRedraw(fTeh31);
1767 gClient->NeedRedraw(fTeh32);
1768 gCurrentVolume->SetParam(kClipZmin,min);
1769 gCurrentVolume->SetParam(kClipZmax,max);
1777 switch (GET_SUBMSG(msg)) {
1782 printf("\nTerminating dialog: %s pressed\n",
1783 (parm1 == 1) ? "OK" : "Cancel");
1791 gCurrentVolume->SetParam(kFill, Float_t(parm2));
1792 gCurrentVolume->Draw();
1795 gCurrentVolume->SetParam(kSeen, Float_t(parm2-3));
1796 gCurrentVolume->Draw();
1800 case kCM_CHECKBUTTON:
1803 if (Int_t(gCurrentVolume->GetParam(kShadow))) {
1804 gCurrentVolume->SetParam(kShadow, 0.);
1806 gCurrentVolume->SetParam(kShadow, 1.);
1808 gCurrentVolume->Draw();
1811 if (Int_t(gCurrentVolume->GetParam(kHide))) {
1812 gCurrentVolume->SetParam(kHide, 0.);
1814 gCurrentVolume->SetParam(kHide, 1.);
1816 gCurrentVolume->Draw();
1819 if (Int_t(gCurrentVolume->GetParam(kClip))) {
1820 gCurrentVolume->SetParam(kClip, 0.);
1822 gCurrentVolume->SetParam(kClip, 1.);
1824 gCurrentVolume->Draw();
1843 static Text_t* kLabelText[7] =
1844 {"Theta ", "Phi ", "Psi ", "U ", "V ", "UScale", "VScale"};
1845 static Int_t IRangeMin[7] = { 0, 0, 0, 0, 0, 0, 0};
1846 static Int_t IRangeMax[7] = {36000, 36000, 36000, 2000, 2000, 10, 10};
1847 static Int_t DefaultPos[7] = { 3000, 4000, 0, 1000, 1000, 1, 1};
1849 AliGUISliders::AliGUISliders(const TGWindow *p, const TGWindow *,
1850 UInt_t w, UInt_t h) :
1851 TGCompositeFrame(p, w, h,kVerticalFrame)
1854 ChangeOptions((GetOptions() & ~kHorizontalFrame) | kVerticalFrame);
1855 //--- layout for buttons: top align, equally expand horizontally
1856 fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandY, 5, 5, 5, 5);
1858 //--- layout for the frame: place at bottom, right aligned
1859 fBfly1 = new TGLayoutHints(kLHintsLeft | kLHintsExpandX );
1863 for (Int_t i=0; i<7; i++) {
1866 fHframe[i] = new TGHorizontalFrame(this, 400, 100, kFixedWidth);
1867 fTbh[i] = new TGTextBuffer(10);
1868 fTeh[i] = new TGTextEntry(fHframe[i], fTbh[i],idT);
1870 sprintf(buf, "%6.2f", Float_t(DefaultPos[i])/100);
1871 fTbh[i]->AddText(0, buf);
1872 fTeh[i]->Associate(this);
1874 fHslider[i] = new TGHSlider(fHframe[i], 400, kSlider1 | kScaleBoth, idS);
1875 fHslider[i]->Associate(this);
1876 fHslider[i]->SetRange(IRangeMin[i], IRangeMax[i]);
1877 fHslider[i]->SetPosition(DefaultPos[i]);
1879 fLabel[i] = new TGLabel(fHframe[i], kLabelText[i]);
1882 fHframe[i]->AddFrame(fLabel[i], fBfly1);
1883 fHframe[i]->AddFrame(fTeh[i], fBfly1);
1884 fHframe[i]->AddFrame(fHslider[i], fBfly1);
1885 AddFrame(fHframe[i], fBly);
1889 AliGUISliders::~AliGUISliders()
1892 delete fBfly1; delete fBly;
1894 for (Int_t i=1; i<7; i++) {
1902 void AliGUISliders::Update()
1907 for (Int_t i=0; i<7; i++) {
1908 Float_t param = gCurrentVolume->GetParam(i);
1910 fHslider[i]->SetPosition(Int_t(param*100.));
1911 gClient->NeedRedraw(fHslider[i]);
1913 sprintf(buf, "%6.2f", param);
1915 fTbh[i]->AddText(0, buf);
1916 gClient->NeedRedraw(fTeh[i]);
1923 void AliGUISliders::CloseWindow()
1925 // Called when window is closed via the window manager.
1930 Bool_t AliGUISliders::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
1932 // Process slider messages.
1936 switch (GET_MSG(msg)) {
1938 switch (GET_SUBMSG(msg)) {
1939 case kTE_TEXTCHANGED:
1940 Int_t idT=Int_t(parm1)-1;
1941 fHslider[idT]->SetPosition((Int_t)atof(fTbh[idT]->GetString())*100);
1942 gClient->NeedRedraw(fHslider[idT]);
1943 gCurrentVolume->SetParam(idT,atof(fTbh[idT]->GetString()));
1944 gCurrentVolume->Draw();
1948 switch (GET_SUBMSG(msg)) {
1950 sprintf(buf, "%6.2f", Float_t(parm2)/100);
1951 Int_t idS=Int_t(parm1)-8;
1953 fTbh[idS]->AddText(0, buf);
1954 gClient->NeedRedraw(fTeh[idS]);
1955 gCurrentVolume->SetParam(idS, Float_t(parm2)/100.);
1956 gCurrentVolume->Draw();
1963 ClassImp(AliGUIMaterial)
1965 AliGUIMaterial::AliGUIMaterial()
1977 AliGUIMaterial::AliGUIMaterial(Int_t imat, char* name, Float_t a, Float_t z,
1978 Float_t dens, Float_t radl, Float_t absl)
1989 void AliGUIMaterial::Dump()
1991 // Dump material information
1992 printf("\n *****************************************");
1993 printf("\n Material Number: %10d", fId);
1994 printf("\n %s", fName);
1995 printf("\n Mass Number: %10.2f", fA);
1996 printf("\n Charge Number: %10.2f", fZ);
1997 printf("\n Density: %10.2f", fDensity);
1998 printf("\n Radiation Length: %10.2f", fRadl);
1999 printf("\n Absorption Length: %10.2f", fAbsl);
2002 Int_t AliGUIMaterial::Id()
2004 // return material id
2008 char* AliGUIMaterial::Name()
2010 // return material name
2014 Float_t AliGUIMaterial::A()
2016 // return atomic number
2020 Float_t AliGUIMaterial::Z()
2022 // return charge number
2026 Float_t AliGUIMaterial::Density()
2032 Float_t AliGUIMaterial::RadiationLength()
2034 // return radiation length
2038 Float_t AliGUIMaterial::AbsorptionLength()
2040 // return absorption length
2045 void AliGUIMaterial::Plot()
2047 // dummy plot routine
2051 void AliGUIMaterial::Streamer(TBuffer &)
2057 ClassImp(AliGUIMedium)
2059 AliGUIMedium::AliGUIMedium()
2066 AliGUIMedium::AliGUIMedium(Int_t imed, Int_t imat, char* name, Int_t isvol,
2068 Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax,
2069 Float_t epsil, Float_t stmin)
2085 void AliGUIMedium::Dump()
2091 Int_t AliGUIMedium::Id()
2097 char* AliGUIMedium::Name()
2099 // return medium name
2103 Float_t AliGUIMedium::GetPar(Int_t ipar)
2105 // Get parameter number ipar
2109 } else if(ipar >=23 && ipar <27) {
2118 void AliGUIMedium::Streamer(TBuffer &)