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.15 1999/10/26 06:04:50 fca
19 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
21 Revision 1.14 1999/09/29 09:24:30 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////////
28 // Interface Class to the Geant3.21 MonteCarlo //
32 <img src="picts/TGeant3Class.gif">
37 ///////////////////////////////////////////////////////////////////////////////
43 #include <TDatabasePDG.h>
44 #include "AliCallf77.h"
47 # define gzebra gzebra_
48 # define grfile grfile_
49 # define gpcxyz gpcxyz_
50 # define ggclos ggclos_
53 # define gcinit gcinit_
56 # define gtrigc gtrigc_
57 # define gtrigi gtrigi_
59 # define gzinit gzinit_
60 # define gfmate gfmate_
61 # define gfpart gfpart_
62 # define gftmed gftmed_
66 # define gsmate gsmate_
67 # define gsmixt gsmixt_
68 # define gspart gspart_
69 # define gstmed gstmed_
70 # define gsckov gsckov_
71 # define gstpar gstpar_
72 # define gfkine gfkine_
73 # define gfvert gfvert_
74 # define gskine gskine_
75 # define gsvert gsvert_
76 # define gphysi gphysi_
77 # define gdebug gdebug_
78 # define gekbin gekbin_
79 # define gfinds gfinds_
80 # define gsking gsking_
81 # define gskpho gskpho_
82 # define gsstak gsstak_
84 # define gtrack gtrack_
85 # define gtreve gtreve_
86 # define gtreve_root gtreve_root_
88 # define grndmq grndmq_
90 # define glmoth glmoth_
91 # define gmedia gmedia_
94 # define gsdvn2 gsdvn2_
96 # define gsdvs2 gsdvs2_
98 # define gsdvt2 gsdvt2_
100 # define gspos gspos_
101 # define gsposp gsposp_
102 # define gsrotm gsrotm_
103 # define gprotm gprotm_
104 # define gsvolu gsvolu_
105 # define gprint gprint_
106 # define gdinit gdinit_
107 # define gdopt gdopt_
108 # define gdraw gdraw_
109 # define gdrayt gdrayt_
110 # define gdrawc gdrawc_
111 # define gdrawx gdrawx_
112 # define gdhead gdhead_
113 # define gdwmn1 gdwmn1_
114 # define gdwmn2 gdwmn2_
115 # define gdwmn3 gdwmn3_
116 # define gdxyz gdxyz_
117 # define gdcxyz gdcxyz_
118 # define gdman gdman_
119 # define gdspec gdspec_
120 # define gdtree gdtree_
121 # define gdelet gdelet_
122 # define gdclos gdclos_
123 # define gdshow gdshow_
124 # define gdopen gdopen_
125 # define dzshow dzshow_
126 # define gsatt gsatt_
127 # define gfpara gfpara_
128 # define gckpar gckpar_
129 # define gckmat gckmat_
130 # define geditv geditv_
131 # define mzdrop mzdrop_
133 # define ertrak ertrak_
134 # define ertrgo ertrgo_
136 # define setbomb setbomb_
137 # define setclip setclip_
138 # define gcomad gcomad_
141 # define gzebra GZEBRA
142 # define grfile GRFILE
143 # define gpcxyz GPCXYZ
144 # define ggclos GGCLOS
147 # define gcinit GCINIT
150 # define gtrigc GTRIGC
151 # define gtrigi GTRIGI
153 # define gzinit GZINIT
154 # define gfmate GFMATE
155 # define gfpart GFPART
156 # define gftmed GFTMED
160 # define gsmate GSMATE
161 # define gsmixt GSMIXT
162 # define gspart GSPART
163 # define gstmed GSTMED
164 # define gsckov GSCKOV
165 # define gstpar GSTPAR
166 # define gfkine GFKINE
167 # define gfvert GFVERT
168 # define gskine GSKINE
169 # define gsvert GSVERT
170 # define gphysi GPHYSI
171 # define gdebug GDEBUG
172 # define gekbin GEKBIN
173 # define gfinds GFINDS
174 # define gsking GSKING
175 # define gskpho GSKPHO
176 # define gsstak GSSTAK
178 # define gtrack GTRACK
179 # define gtreve GTREVE
180 # define gtreve_root GTREVE_ROOT
182 # define grndmq GRNDMQ
184 # define glmoth GLMOTH
185 # define gmedia GMEDIA
188 # define gsdvn2 GSDVN2
190 # define gsdvs2 GSDVS2
192 # define gsdvt2 GSDVT2
195 # define gsposp GSPOSP
196 # define gsrotm GSROTM
197 # define gprotm GPROTM
198 # define gsvolu GSVOLU
199 # define gprint GPRINT
200 # define gdinit GDINIT
203 # define gdrayt GDRAYT
204 # define gdrawc GDRAWC
205 # define gdrawx GDRAWX
206 # define gdhead GDHEAD
207 # define gdwmn1 GDWMN1
208 # define gdwmn2 GDWMN2
209 # define gdwmn3 GDWMN3
211 # define gdcxyz GDCXYZ
213 # define gdfspc GDFSPC
214 # define gdspec GDSPEC
215 # define gdtree GDTREE
216 # define gdelet GDELET
217 # define gdclos GDCLOS
218 # define gdshow GDSHOW
219 # define gdopen GDOPEN
220 # define dzshow DZSHOW
222 # define gfpara GFPARA
223 # define gckpar GCKPAR
224 # define gckmat GCKMAT
225 # define geditv GEDITV
226 # define mzdrop MZDROP
228 # define ertrak ERTRAK
229 # define ertrgo ERTRGO
231 # define setbomb SETBOMB
232 # define setclip SETCLIP
233 # define gcomad GCOMAD
237 //____________________________________________________________________________
241 // Prototypes for GEANT functions
243 void type_of_call gzebra(const int&);
245 void type_of_call gpcxyz();
247 void type_of_call ggclos();
249 void type_of_call glast();
251 void type_of_call ginit();
253 void type_of_call gcinit();
255 void type_of_call grun();
257 void type_of_call gtrig();
259 void type_of_call gtrigc();
261 void type_of_call gtrigi();
263 void type_of_call gwork(const int&);
265 void type_of_call gzinit();
267 void type_of_call gmate();
269 void type_of_call gpart();
271 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
273 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
274 Int_t &, Float_t *, Int_t &);
276 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
277 Float_t &, Float_t *, Int_t &);
279 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
282 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
285 void type_of_call gphysi();
287 void type_of_call gdebug();
289 void type_of_call gekbin();
291 void type_of_call gfinds();
293 void type_of_call gsking(Int_t &);
295 void type_of_call gskpho(Int_t &);
297 void type_of_call gsstak(Int_t &);
299 void type_of_call gsxyz();
301 void type_of_call gtrack();
303 void type_of_call gtreve();
305 void type_of_call gtreve_root();
307 void type_of_call grndm(Float_t *, const Int_t &);
309 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
312 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
314 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
315 Int_t *, Int_t * DEFCHARL);
317 void type_of_call gmedia(Float_t *, Int_t &);
319 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
321 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
322 const Float_t &, const Float_t &, const Float_t &,
325 void type_of_call gprotm(const Int_t &);
327 void type_of_call grfile(const Int_t&, DEFCHARD,
328 DEFCHARD DEFCHARL DEFCHARL);
330 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
331 Float_t &, Float_t &, Float_t &, Float_t *,
334 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
335 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
337 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
338 Float_t &, Float_t &, Float_t &, Float_t &,
339 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
341 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
342 Float_t &, Float_t &, Float_t &, Float_t *,
345 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
346 Float_t &, Int_t &, Float_t * DEFCHARL);
348 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
349 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
352 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
353 Float_t &, Float_t &, Float_t &, Float_t &,
354 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
356 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
357 Float_t *absco, Float_t *effic, Float_t *rindex);
358 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
360 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
363 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
364 Int_t & DEFCHARL DEFCHARL);
366 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
369 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
370 Int_t & DEFCHARL DEFCHARL);
372 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
373 Int_t & DEFCHARL DEFCHARL);
375 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
376 Int_t &, Int_t & DEFCHARL DEFCHARL);
378 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
380 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
381 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
384 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
385 Float_t &, Int_t &, DEFCHARD,
386 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
388 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
389 Int_t & DEFCHARL DEFCHARL);
391 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
393 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
396 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
398 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
400 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
402 void type_of_call gdinit();
404 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
406 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
407 Float_t &, Float_t &, Float_t & DEFCHARL);
408 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
409 Float_t &, Float_t &, Float_t & DEFCHARL);
410 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
411 Float_t &, Float_t & DEFCHARL);
412 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
413 Float_t &, Float_t &, Float_t &, Float_t &,
415 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
416 void type_of_call gdxyz(Int_t &);
417 void type_of_call gdcxyz();
418 void type_of_call gdman(Float_t &, Float_t &);
419 void type_of_call gdwmn1(Float_t &, Float_t &);
420 void type_of_call gdwmn2(Float_t &, Float_t &);
421 void type_of_call gdwmn3(Float_t &, Float_t &);
422 void type_of_call gdspec(DEFCHARD DEFCHARL);
423 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
424 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
426 void type_of_call gdopen(Int_t &);
427 void type_of_call gdclos();
428 void type_of_call gdelet(Int_t &);
429 void type_of_call gdshow(Int_t &);
430 void type_of_call geditv(Int_t &) {;}
433 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
434 const int&, const int&, const int& DEFCHARL
437 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
439 void type_of_call setbomb(Float_t &);
440 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
441 Float_t &, Float_t & DEFCHARL);
442 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
444 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
445 const Float_t *x2, const Float_t *p2,
446 const Int_t &ipa, DEFCHARD DEFCHARL);
448 void type_of_call ertrgo();
452 // Geant3 global pointer
454 static Int_t defSize = 600;
458 //____________________________________________________________________________
462 // Default constructor
466 //____________________________________________________________________________
467 TGeant3::TGeant3(const char *title, Int_t nwgeant)
468 :AliMC("TGeant3",title)
471 // Standard constructor for TGeant3 with ZEBRA initialisation
482 // Load Address of Geant3 commons
485 // Zero number of particles
489 //____________________________________________________________________________
490 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
491 Float_t &radl, Float_t &absl) const
494 // Return the parameters of the current material during transport
498 dens = fGcmate->dens;
499 radl = fGcmate->radl;
500 absl = fGcmate->absl;
501 return 1; //this could be the number of elements in mixture
504 //____________________________________________________________________________
505 void TGeant3::DefaultRange()
508 // Set range of current drawing pad to 20x20 cm
514 higz->Range(0,0,20,20);
517 //____________________________________________________________________________
518 void TGeant3::InitHIGZ()
529 //____________________________________________________________________________
530 void TGeant3::LoadAddress()
533 // Assigns the address of the GEANT common blocks to the structures
534 // that allow their access from C++
537 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
538 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
539 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
540 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
541 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
542 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
543 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
544 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
545 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
546 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
547 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
548 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
549 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
550 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
551 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
552 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
553 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
554 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
555 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
556 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
559 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
560 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
561 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
562 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
564 // Variables for ZEBRA store
565 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
567 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
572 //_____________________________________________________________________________
573 void TGeant3::GeomIter()
576 // Geometry iterator for moving upward in the geometry tree
577 // Initialise the iterator
579 fNextVol=fGcvolu->nlevel;
582 //____________________________________________________________________________
583 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
586 // Geometry iterator for moving upward in the geometry tree
587 // Return next volume up
592 gname=fGcvolu->names[fNextVol];
593 strncpy(name,(char *) &gname, 4);
595 copy=fGcvolu->number[fNextVol];
596 i=fGcvolu->lvolum[fNextVol];
597 if(gname == fZiq[fGclink->jvolum+i]) return i;
598 else printf("GeomTree: Volume %s not found in bank\n",name);
603 //_____________________________________________________________________________
604 Int_t TGeant3::CurrentVolID(Int_t ©) const
607 // Returns the current volume ID and copy number
610 if( (i=fGcvolu->nlevel-1) < 0 ) {
611 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
613 gname=fGcvolu->names[i];
614 copy=fGcvolu->number[i];
615 i=fGcvolu->lvolum[i];
616 if(gname == fZiq[fGclink->jvolum+i]) return i;
617 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
622 //_____________________________________________________________________________
623 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
626 // Return the current volume "off" upward in the geometrical tree
627 // ID and copy number
630 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
631 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
632 off,fGcvolu->nlevel);
634 gname=fGcvolu->names[i];
635 copy=fGcvolu->number[i];
636 i=fGcvolu->lvolum[i];
637 if(gname == fZiq[fGclink->jvolum+i]) return i;
638 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
643 //_____________________________________________________________________________
644 const char* TGeant3::CurrentVolName() const
647 // Returns the current volume name
651 if( (i=fGcvolu->nlevel-1) < 0 ) {
652 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
654 gname=fGcvolu->names[i];
656 strncpy(name,(char *) &gname, 4);
658 i=fGcvolu->lvolum[i];
659 if(gname == fZiq[fGclink->jvolum+i]) return name;
660 else Warning("CurrentVolName","Volume %4s not found\n",name);
665 //_____________________________________________________________________________
666 const char* TGeant3::CurrentVolOffName(Int_t off) const
669 // Return the current volume "off" upward in the geometrical tree
670 // ID, name and copy number
671 // if name=0 no name is returned
675 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
676 Warning("CurrentVolOffName",
677 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
679 gname=fGcvolu->names[i];
681 strncpy(name,(char *) &gname, 4);
683 i=fGcvolu->lvolum[i];
684 if(gname == fZiq[fGclink->jvolum+i]) return name;
685 else Warning("CurrentVolOffName","Volume %4s not found\n",name);
690 //_____________________________________________________________________________
691 Int_t TGeant3::IdFromPDG(Int_t pdg) const
694 // Return Geant3 code from PDG and pseudo ENDF code
696 for(Int_t i=0;i<fNPDGCodes;++i)
697 if(pdg==fPDGCode[i]) return i;
701 //_____________________________________________________________________________
702 Int_t TGeant3::PDGFromId(Int_t id) const
704 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
708 //_____________________________________________________________________________
709 void TGeant3::DefineParticles()
712 // Define standard Geant 3 particles
715 // Load standard numbers for GEANT particles and PDG conversion
716 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
717 fPDGCode[fNPDGCodes++]=22; // 1 = photon
718 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
719 fPDGCode[fNPDGCodes++]=11; // 3 = electron
720 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
721 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
722 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
723 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
724 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
725 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
726 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
727 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
728 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
729 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
730 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
731 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
732 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
733 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
734 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
735 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
736 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
737 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
738 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
739 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
740 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
741 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
742 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
743 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
744 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
745 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
746 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
747 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
748 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
755 /* --- Define additional particles */
756 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
757 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
759 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
760 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
762 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
763 fPDGCode[fNPDGCodes++]=411; // 35 = D+
765 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
766 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
768 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
769 fPDGCode[fNPDGCodes++]=421; // 37 = D0
771 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
772 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
774 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
776 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
778 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
780 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
781 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
783 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
784 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
786 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
787 fPDGCode[fNPDGCodes++]=113; // 37 = D0
790 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
792 // and numbers above 5 000 000 for special applications
795 const Int_t kion=10000000;
797 const Int_t kspe=50000000;
799 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
801 const Double_t autogev=0.9314943228;
802 const Double_t hslash = 1.0545726663e-27;
803 const Double_t erggev = 1/1.6021773349e-3;
804 const Double_t hshgev = hslash*erggev;
805 const Double_t yearstosec = 3600*24*365.25;
808 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
809 0,1,"Ion",kion+10020);
810 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
812 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
813 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
814 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
816 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
817 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
818 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
820 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
822 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
823 0,2,"Ion",kion+20030);
824 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
826 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
827 0,0,"Special",kspe+50);
828 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
830 /* --- Define additional decay modes --- */
831 /* --- omega(783) --- */
832 for (kz = 0; kz < 6; ++kz) {
843 Gsdk(ipa, bratio, mode);
844 /* --- phi(1020) --- */
845 for (kz = 0; kz < 6; ++kz) {
860 Gsdk(ipa, bratio, mode);
862 for (kz = 0; kz < 6; ++kz) {
875 Gsdk(ipa, bratio, mode);
877 for (kz = 0; kz < 6; ++kz) {
890 Gsdk(ipa, bratio, mode);
892 for (kz = 0; kz < 6; ++kz) {
903 Gsdk(ipa, bratio, mode);
904 /* --- Anti D0 --- */
905 for (kz = 0; kz < 6; ++kz) {
916 Gsdk(ipa, bratio, mode);
918 for (kz = 0; kz < 6; ++kz) {
925 Gsdk(ipa, bratio, mode);
927 for (kz = 0; kz < 6; ++kz) {
934 Gsdk(ipa, bratio, mode);
936 for (kz = 0; kz < 6; ++kz) {
943 Gsdk(ipa, bratio, mode);
946 for (kz = 0; kz < 6; ++kz) {
955 Gsdk(ipa, bratio, mode);
958 Gsdk(ipa, bratio, mode);
961 Gsdk(ipa, bratio, mode);
966 //_____________________________________________________________________________
967 Int_t TGeant3::VolId(Text_t *name) const
970 // Return the unique numeric identifier for volume name
973 strncpy((char *) &gname, name, 4);
974 for(i=1; i<=fGcnum->nvolum; i++)
975 if(gname == fZiq[fGclink->jvolum+i]) return i;
976 printf("VolId: Volume %s not found\n",name);
980 //_____________________________________________________________________________
981 Int_t TGeant3::NofVolumes() const
984 // Return total number of volumes in the geometry
986 return fGcnum->nvolum;
989 //_____________________________________________________________________________
990 const char* TGeant3::VolName(Int_t id) const
993 // Return the volume name given the volume identifier
996 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
999 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
1004 //_____________________________________________________________________________
1005 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
1007 Int_t gpart = IdFromPDG(part);
1008 if(!strcmp(reac,"PHOT"))
1011 Error("Xsec","Can calculate photoelectric only for photons\n");
1017 //_____________________________________________________________________________
1018 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1021 // Return the current position in the master reference frame of the
1022 // track being transported
1024 xyz[0]=fGctrak->vect[0];
1025 xyz[1]=fGctrak->vect[1];
1026 xyz[2]=fGctrak->vect[2];
1027 xyz[3]=fGctrak->tofg;
1030 //_____________________________________________________________________________
1031 Float_t TGeant3::TrackTime() const
1034 // Return the current time of flight of the track being transported
1036 return fGctrak->tofg;
1039 //_____________________________________________________________________________
1040 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1043 // Return the direction and the momentum (GeV/c) of the track
1044 // currently being transported
1046 Double_t ptot=fGctrak->vect[6];
1047 xyz[0]=fGctrak->vect[3]*ptot;
1048 xyz[1]=fGctrak->vect[4]*ptot;
1049 xyz[2]=fGctrak->vect[5]*ptot;
1050 xyz[3]=fGctrak->getot;
1053 //_____________________________________________________________________________
1054 Float_t TGeant3::TrackCharge() const
1057 // Return charge of the track currently transported
1059 return fGckine->charge;
1062 //_____________________________________________________________________________
1063 Float_t TGeant3::TrackMass() const
1066 // Return the mass of the track currently transported
1068 return fGckine->amass;
1071 //_____________________________________________________________________________
1072 Int_t TGeant3::TrackPid() const
1075 // Return the id of the particle transported
1077 return PDGFromId(fGckine->ipart);
1080 //_____________________________________________________________________________
1081 Float_t TGeant3::TrackStep() const
1084 // Return the length in centimeters of the current step
1086 return fGctrak->step;
1089 //_____________________________________________________________________________
1090 Float_t TGeant3::TrackLength() const
1093 // Return the length of the current track from its origin
1095 return fGctrak->sleng;
1098 //_____________________________________________________________________________
1099 Bool_t TGeant3::IsTrackInside() const
1102 // True if the track is not at the boundary of the current volume
1104 return (fGctrak->inwvol==0);
1107 //_____________________________________________________________________________
1108 Bool_t TGeant3::IsTrackEntering() const
1111 // True if this is the first step of the track in the current volume
1113 return (fGctrak->inwvol==1);
1116 //_____________________________________________________________________________
1117 Bool_t TGeant3::IsTrackExiting() const
1120 // True if this is the last step of the track in the current volume
1122 return (fGctrak->inwvol==2);
1125 //_____________________________________________________________________________
1126 Bool_t TGeant3::IsTrackOut() const
1129 // True if the track is out of the setup
1131 return (fGctrak->inwvol==3);
1134 //_____________________________________________________________________________
1135 Bool_t TGeant3::IsTrackStop() const
1138 // True if the track energy has fallen below the threshold
1140 return (fGctrak->istop==2);
1143 //_____________________________________________________________________________
1144 Int_t TGeant3::NSecondaries() const
1147 // Number of secondary particles generated in the current step
1149 return fGcking->ngkine;
1152 //_____________________________________________________________________________
1153 Int_t TGeant3::CurrentEvent() const
1156 // Number of the current event
1158 return fGcflag->idevt;
1161 //_____________________________________________________________________________
1162 const char* TGeant3::ProdProcess() const
1165 // Name of the process that has produced the secondary particles
1166 // in the current step
1168 static char proc[5];
1169 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1172 if(fGcking->ngkine>0) {
1173 for (km = 0; km < fGctrak->nmec; ++km) {
1174 for (im = 0; im < 13; ++im) {
1175 if (fGctrak->lmec[km] == ipmec[im]) {
1176 mec = fGctrak->lmec[km];
1177 if (0 < mec && mec < 31) {
1178 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1179 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1180 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1187 strcpy(proc,"UNKN");
1188 } else strcpy(proc,"NONE");
1192 //_____________________________________________________________________________
1193 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1194 TLorentzVector &x, TLorentzVector &p)
1197 // Get the parameters of the secondary track number isec produced
1198 // in the current step
1201 if(-1<isec && isec<fGcking->ngkine) {
1202 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1204 x[i]=fGckin3->gpos[isec][i];
1205 p[i]=fGcking->gkin[isec][i];
1207 x[3]=fGcking->tofd[isec];
1208 p[3]=fGcking->gkin[isec][3];
1210 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1211 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1216 //_____________________________________________________________________________
1217 void TGeant3::InitLego()
1220 SetDEBU(0,0,0); //do not print a message
1223 //_____________________________________________________________________________
1224 Bool_t TGeant3::IsTrackDisappeared() const
1227 // True if the current particle has disappered
1228 // either because it decayed or because it underwent
1229 // an inelastic collision
1231 return (fGctrak->istop==1);
1234 //_____________________________________________________________________________
1235 Bool_t TGeant3::IsTrackAlive() const
1238 // True if the current particle is alive and will continue to be
1241 return (fGctrak->istop==0);
1244 //_____________________________________________________________________________
1245 void TGeant3::StopTrack()
1248 // Stop the transport of the current particle and skip to the next
1253 //_____________________________________________________________________________
1254 void TGeant3::StopEvent()
1257 // Stop simulation of the current event and skip to the next
1262 //_____________________________________________________________________________
1263 Float_t TGeant3::MaxStep() const
1266 // Return the maximum step length in the current medium
1268 return fGctmed->stemax;
1271 //_____________________________________________________________________________
1272 void TGeant3::SetColors()
1275 // Set the colors for all the volumes
1276 // this is done sequentially for all volumes
1277 // based on the number of their medium
1280 Int_t jvolum=fGclink->jvolum;
1281 //Int_t jtmed=fGclink->jtmed;
1282 //Int_t jmate=fGclink->jmate;
1283 Int_t nvolum=fGcnum->nvolum;
1286 // Now for all the volumes
1287 for(kv=1;kv<=nvolum;kv++) {
1288 // Get the tracking medium
1289 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1291 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1293 //Float_t z=fZq[fZlq[jmate-ima]+7];
1294 // Find color number
1295 //icol = Int_t(z)%6+2;
1296 //icol = 17+Int_t(z*150./92.);
1299 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1301 Gsatt(name,"COLO",icol);
1305 //_____________________________________________________________________________
1306 void TGeant3::SetMaxStep(Float_t maxstep)
1309 // Set the maximum step allowed till the particle is in the current medium
1311 fGctmed->stemax=maxstep;
1314 //_____________________________________________________________________________
1315 void TGeant3::SetMaxNStep(Int_t maxnstp)
1318 // Set the maximum number of steps till the particle is in the current medium
1320 fGctrak->maxnst=maxnstp;
1323 //_____________________________________________________________________________
1324 Int_t TGeant3::GetMaxNStep() const
1327 // Maximum number of steps allowed in current medium
1329 return fGctrak->maxnst;
1332 //_____________________________________________________________________________
1333 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1334 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1338 // Defines a Material
1340 // kmat number assigned to the material
1341 // name material name
1342 // a atomic mass in au
1344 // dens density in g/cm3
1345 // absl absorbtion length in cm
1346 // if >=0 it is ignored and the program
1347 // calculates it, if <0. -absl is taken
1348 // radl radiation length in cm
1349 // if >=0 it is ignored and the program
1350 // calculates it, if <0. -radl is taken
1351 // buf pointer to an array of user words
1352 // nbuf number of user words
1354 Int_t jmate=fGclink->jmate;
1360 for(i=1; i<=ns; i++) {
1361 if(fZlq[jmate-i]==0) {
1367 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1368 nwbuf PASSCHARL(name));
1371 //_____________________________________________________________________________
1372 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1373 Float_t dens, Int_t nlmat, Float_t* wmat)
1376 // Defines mixture OR COMPOUND IMAT as composed by
1377 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1379 // If NLMAT > 0 then wmat contains the proportion by
1380 // weights of each basic material in the mixture.
1382 // If nlmat < 0 then WMAT contains the number of atoms
1383 // of a given kind into the molecule of the COMPOUND
1384 // In this case, WMAT in output is changed to relative
1387 Int_t jmate=fGclink->jmate;
1393 for(i=1; i<=ns; i++) {
1394 if(fZlq[jmate-i]==0) {
1400 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1403 //_____________________________________________________________________________
1404 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1405 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1406 Float_t stemax, Float_t deemax, Float_t epsil,
1407 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1410 // kmed tracking medium number assigned
1411 // name tracking medium name
1412 // nmat material number
1413 // isvol sensitive volume flag
1414 // ifield magnetic field
1415 // fieldm max. field value (kilogauss)
1416 // tmaxfd max. angle due to field (deg/step)
1417 // stemax max. step allowed
1418 // deemax max. fraction of energy lost in a step
1419 // epsil tracking precision (cm)
1420 // stmin min. step due to continuos processes (cm)
1422 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1423 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1424 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1426 Int_t jtmed=fGclink->jtmed;
1432 for(i=1; i<=ns; i++) {
1433 if(fZlq[jtmed-i]==0) {
1439 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1440 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1443 //_____________________________________________________________________________
1444 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1445 Float_t phiy, Float_t thez, Float_t phiz)
1448 // krot rotation matrix number assigned
1449 // theta1 polar angle for axis i
1450 // phi1 azimuthal angle for axis i
1451 // theta2 polar angle for axis ii
1452 // phi2 azimuthal angle for axis ii
1453 // theta3 polar angle for axis iii
1454 // phi3 azimuthal angle for axis iii
1456 // it defines the rotation matrix number irot.
1458 Int_t jrotm=fGclink->jrotm;
1464 for(i=1; i<=ns; i++) {
1465 if(fZlq[jrotm-i]==0) {
1471 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1474 //_____________________________________________________________________________
1475 Int_t TGeant3::GetMedium() const
1478 // Return the number of the current medium
1480 return fGctmed->numed;
1483 //_____________________________________________________________________________
1484 Float_t TGeant3::Edep() const
1487 // Return the energy lost in the current step
1489 return fGctrak->destep;
1492 //_____________________________________________________________________________
1493 Float_t TGeant3::Etot() const
1496 // Return the total energy of the current track
1498 return fGctrak->getot;
1501 //_____________________________________________________________________________
1502 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1505 // Return an array of n random numbers uniformly distributed
1506 // between 0 and 1 not included
1511 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1513 // Functions from GBASE
1515 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1517 //____________________________________________________________________________
1518 void TGeant3::Gfile(const char *filename, const char *option)
1521 // Routine to open a GEANT/RZ data base.
1523 // LUN logical unit number associated to the file
1525 // CHFILE RZ file name
1527 // CHOPT is a character string which may be
1528 // N To create a new file
1529 // U to open an existing file for update
1530 // " " to open an existing file for read only
1531 // Q The initial allocation (default 1000 records)
1532 // is given in IQUEST(10)
1533 // X Open the file in exchange format
1534 // I Read all data structures from file to memory
1535 // O Write all data structures from memory to file
1538 // If options "I" or "O" all data structures are read or
1539 // written from/to file and the file is closed.
1540 // See routine GRMDIR to create subdirectories
1541 // See routines GROUT,GRIN to write,read objects
1543 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1547 //____________________________________________________________________________
1548 void TGeant3::Gpcxyz()
1551 // Print track and volume parameters at current point
1556 //_____________________________________________________________________________
1557 void TGeant3::Ggclos()
1560 // Closes off the geometry setting.
1561 // Initializes the search list for the contents of each
1562 // volume following the order they have been positioned, and
1563 // inserting the content '0' when a call to GSNEXT (-1) has
1564 // been required by the user.
1565 // Performs the development of the JVOLUM structure for all
1566 // volumes with variable parameters, by calling GGDVLP.
1567 // Interprets the user calls to GSORD, through GGORD.
1568 // Computes and stores in a bank (next to JVOLUM mother bank)
1569 // the number of levels in the geometrical tree and the
1570 // maximum number of contents per level, by calling GGNLEV.
1571 // Sets status bit for CONCAVE volumes, through GGCAVE.
1572 // Completes the JSET structure with the list of volume names
1573 // which identify uniquely a given physical detector, the
1574 // list of bit numbers to pack the corresponding volume copy
1575 // numbers, and the generic path(s) in the JVOLUM tree,
1576 // through the routine GHCLOS.
1581 //_____________________________________________________________________________
1582 void TGeant3::Glast()
1585 // Finish a Geant run
1590 //_____________________________________________________________________________
1591 void TGeant3::Gprint(const char *name)
1594 // Routine to print data structures
1595 // CHNAME name of a data structure
1599 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1602 //_____________________________________________________________________________
1603 void TGeant3::Grun()
1606 // Steering function to process one run
1611 //_____________________________________________________________________________
1612 void TGeant3::Gtrig()
1615 // Steering function to process one event
1620 //_____________________________________________________________________________
1621 void TGeant3::Gtrigc()
1624 // Clear event partition
1629 //_____________________________________________________________________________
1630 void TGeant3::Gtrigi()
1633 // Initialises event partition
1638 //_____________________________________________________________________________
1639 void TGeant3::Gwork(Int_t nwork)
1642 // Allocates workspace in ZEBRA memory
1647 //_____________________________________________________________________________
1648 void TGeant3::Gzinit()
1651 // To initialise GEANT/ZEBRA data structures
1656 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1658 // Functions from GCONS
1660 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1662 //_____________________________________________________________________________
1663 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1664 Float_t &dens, Float_t &radl, Float_t &absl,
1665 Float_t* ubuf, Int_t& nbuf)
1668 // Return parameters for material IMAT
1670 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1674 //_____________________________________________________________________________
1675 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1676 Float_t &amass, Float_t &charge, Float_t &tlife)
1679 // Return parameters for particle of type IPART
1683 Int_t igpart = IdFromPDG(ipart);
1684 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1688 //_____________________________________________________________________________
1689 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1690 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1691 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1692 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1695 // Return parameters for tracking medium NUMED
1697 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1698 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1701 //_____________________________________________________________________________
1702 void TGeant3::Gmate()
1705 // Define standard GEANT materials
1710 //_____________________________________________________________________________
1711 void TGeant3::Gpart()
1714 // Define standard GEANT particles plus selected decay modes
1715 // and branching ratios.
1720 //_____________________________________________________________________________
1721 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1723 // Defines branching ratios and decay modes for standard
1725 gsdk(ipart,bratio,mode);
1728 //_____________________________________________________________________________
1729 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1730 Float_t dens, Float_t radl, Float_t absl)
1733 // Defines a Material
1735 // kmat number assigned to the material
1736 // name material name
1737 // a atomic mass in au
1739 // dens density in g/cm3
1740 // absl absorbtion length in cm
1741 // if >=0 it is ignored and the program
1742 // calculates it, if <0. -absl is taken
1743 // radl radiation length in cm
1744 // if >=0 it is ignored and the program
1745 // calculates it, if <0. -radl is taken
1746 // buf pointer to an array of user words
1747 // nbuf number of user words
1751 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1755 //_____________________________________________________________________________
1756 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1757 Float_t dens, Int_t nlmat, Float_t *wmat)
1760 // Defines mixture OR COMPOUND IMAT as composed by
1761 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1763 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1764 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1766 // If NLMAT.LT.0 then WMAT contains the number of atoms
1767 // of a given kind into the molecule of the COMPOUND
1768 // In this case, WMAT in output is changed to relative
1771 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1774 //_____________________________________________________________________________
1775 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1776 Float_t amass, Float_t charge, Float_t tlife)
1779 // Store particle parameters
1781 // ipart particle code
1782 // name particle name
1783 // itrtyp transport method (see GEANT manual)
1784 // amass mass in GeV/c2
1785 // charge charge in electron units
1786 // tlife lifetime in seconds
1790 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1794 //_____________________________________________________________________________
1795 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1796 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1797 Float_t stemax, Float_t deemax, Float_t epsil,
1801 // NTMED Tracking medium number
1802 // NAME Tracking medium name
1803 // NMAT Material number
1804 // ISVOL Sensitive volume flag
1805 // IFIELD Magnetic field
1806 // FIELDM Max. field value (Kilogauss)
1807 // TMAXFD Max. angle due to field (deg/step)
1808 // STEMAX Max. step allowed
1809 // DEEMAX Max. fraction of energy lost in a step
1810 // EPSIL Tracking precision (cm)
1811 // STMIN Min. step due to continuos processes (cm)
1813 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1814 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1815 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1819 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1820 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1823 //_____________________________________________________________________________
1824 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1825 Float_t *absco, Float_t *effic, Float_t *rindex)
1828 // Stores the tables for UV photon tracking in medium ITMED
1829 // Please note that it is the user's responsability to
1830 // provide all the coefficients:
1833 // ITMED Tracking medium number
1834 // NPCKOV Number of bins of each table
1835 // PPCKOV Value of photon momentum (in GeV)
1836 // ABSCO Absorbtion coefficients
1837 // dielectric: absorbtion length in cm
1838 // metals : absorbtion fraction (0<=x<=1)
1839 // EFFIC Detection efficiency for UV photons
1840 // RINDEX Refraction index (if=0 metal)
1842 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1845 //_____________________________________________________________________________
1846 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1849 // To change the value of cut or mechanism "CHPAR"
1850 // to a new value PARVAL for tracking medium ITMED
1851 // The data structure JTMED contains the standard tracking
1852 // parameters (CUTS and flags to control the physics processes) which
1853 // are used by default for all tracking media. It is possible to
1854 // redefine individually with GSTPAR any of these parameters for a
1855 // given tracking medium.
1856 // ITMED tracking medium number
1857 // CHPAR is a character string (variable name)
1858 // PARVAL must be given as a floating point.
1860 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1863 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1865 // Functions from GCONS
1867 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1869 //_____________________________________________________________________________
1870 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1873 // Storing/Retrieving Vertex and Track parameters
1874 // ----------------------------------------------
1876 // Stores vertex parameters.
1877 // VERT array of (x,y,z) position of the vertex
1878 // NTBEAM beam track number origin of the vertex
1879 // =0 if none exists
1880 // NTTARG target track number origin of the vertex
1881 // UBUF user array of NUBUF floating point numbers
1883 // NVTX new vertex number (=0 in case of error).
1884 // Prints vertex parameters.
1885 // IVTX for vertex IVTX.
1886 // (For all vertices if IVTX=0)
1887 // Stores long life track parameters.
1888 // PLAB components of momentum
1889 // IPART type of particle (see GSPART)
1890 // NV vertex number origin of track
1891 // UBUF array of NUBUF floating point user parameters
1893 // NT track number (if=0 error).
1894 // Retrieves long life track parameters.
1895 // ITRA track number for which parameters are requested
1896 // VERT vector origin of the track
1897 // PVERT 4 momentum components at the track origin
1898 // IPART particle type (=0 if track ITRA does not exist)
1899 // NVERT vertex number origin of the track
1900 // UBUF user words stored in GSKINE.
1901 // Prints initial track parameters.
1902 // ITRA for track ITRA
1903 // (For all tracks if ITRA=0)
1907 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1910 //_____________________________________________________________________________
1911 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1915 // Retrieves the parameter of a vertex bank
1916 // Vertex is generated from tracks NTBEAM NTTARG
1917 // NVTX is the new vertex number
1921 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1924 //_____________________________________________________________________________
1925 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1929 // Store kinematics of track NT into data structure
1930 // Track is coming from vertex NV
1933 gskine(plab, ipart, nv, buf, nwbuf, nt);
1937 //_____________________________________________________________________________
1938 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1942 // Creates a new vertex bank
1943 // Vertex is generated from tracks NTBEAM NTTARG
1944 // NVTX is the new vertex number
1947 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1951 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1953 // Functions from GPHYS
1955 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1957 //_____________________________________________________________________________
1958 void TGeant3::Gphysi()
1961 // Initialise material constants for all the physics
1962 // mechanisms used by GEANT
1967 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1969 // Functions from GTRAK
1971 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1973 //_____________________________________________________________________________
1974 void TGeant3::Gdebug()
1977 // Debug the current step
1982 //_____________________________________________________________________________
1983 void TGeant3::Gekbin()
1986 // To find bin number in kinetic energy table
1987 // stored in ELOW(NEKBIN)
1992 //_____________________________________________________________________________
1993 void TGeant3::Gfinds()
1996 // Returns the set/volume parameters corresponding to
1997 // the current space point in /GCTRAK/
1998 // and fill common /GCSETS/
2000 // IHSET user set identifier
2001 // IHDET user detector identifier
2002 // ISET set number in JSET
2003 // IDET detector number in JS=LQ(JSET-ISET)
2004 // IDTYPE detector type (1,2)
2005 // NUMBV detector volume numbers (array of length NVNAME)
2006 // NVNAME number of volume levels
2011 //_____________________________________________________________________________
2012 void TGeant3::Gsking(Int_t igk)
2015 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2016 // or the NGKINE tracks when IGK is 0.
2021 //_____________________________________________________________________________
2022 void TGeant3::Gskpho(Int_t igk)
2025 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2026 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2031 //_____________________________________________________________________________
2032 void TGeant3::Gsstak(Int_t iflag)
2035 // Stores in auxiliary stack JSTAK the particle currently
2036 // described in common /GCKINE/.
2038 // On request, creates also an entry in structure JKINE :
2040 // 0 : No entry in JKINE structure required (user)
2041 // 1 : New entry in JVERTX / JKINE structures required (user)
2042 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2043 // 2 : Entry in JKINE structure exists already (from GTREVE)
2048 //_____________________________________________________________________________
2049 void TGeant3::Gsxyz()
2052 // Store space point VECT in banks JXYZ
2057 //_____________________________________________________________________________
2058 void TGeant3::Gtrack()
2061 // Controls tracking of current particle
2066 //_____________________________________________________________________________
2067 void TGeant3::Gtreve()
2070 // Controls tracking of all particles belonging to the current event
2075 //_____________________________________________________________________________
2076 void TGeant3::Gtreve_root()
2079 // Controls tracking of all particles belonging to the current event
2084 //_____________________________________________________________________________
2085 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2088 // To generate a vector RVECV of LEN random numbers
2089 // Copy of the CERN Library routine RANECU
2093 //_____________________________________________________________________________
2094 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2095 const Text_t *chopt)
2098 // To set/retrieve the seed of the random number generator
2100 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2103 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2105 // Functions from GDRAW
2107 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2109 //_____________________________________________________________________________
2110 void TGeant3::Gdxyz(Int_t it)
2113 // Draw the points stored with Gsxyz relative to track it
2118 //_____________________________________________________________________________
2119 void TGeant3::Gdcxyz()
2122 // Draw the position of the current track
2127 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2129 // Functions from GGEOM
2131 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2133 //_____________________________________________________________________________
2134 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2137 // Computes coordinates XM (Master Reference System
2138 // knowing the coordinates XD (Detector Ref System)
2139 // The local reference system can be initialized by
2140 // - the tracking routines and GDTOM used in GUSTEP
2141 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2142 // (inverse routine is GMTOD)
2144 // If IFLAG=1 convert coordinates
2145 // IFLAG=2 convert direction cosinus
2147 gdtom(xd, xm, iflag);
2150 //_____________________________________________________________________________
2151 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2155 // Loads the top part of the Volume tree in LVOLS (IVO's),
2156 // LINDX (IN indices) for a given volume defined through
2157 // its name IUDET and number IUNUM.
2159 // The routine stores only upto the last level where JVOLUM
2160 // data structure is developed. If there is no development
2161 // above the current level, it returns NLEV zero.
2163 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2166 //_____________________________________________________________________________
2167 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2170 // Finds in which volume/medium the point X is, and updates the
2171 // common /GCVOLU/ and the structure JGPAR accordingly.
2173 // NUMED returns the tracking medium number, or 0 if point is
2174 // outside the experimental setup.
2179 //_____________________________________________________________________________
2180 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2183 // Computes coordinates XD (in DRS)
2184 // from known coordinates XM in MRS
2185 // The local reference system can be initialized by
2186 // - the tracking routines and GMTOD used in GUSTEP
2187 // - a call to GMEDIA(XM,NUMED)
2188 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2189 // (inverse routine is GDTOM)
2191 // If IFLAG=1 convert coordinates
2192 // IFLAG=2 convert direction cosinus
2194 gmtod(xm, xd, iflag);
2197 //_____________________________________________________________________________
2198 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2202 // Create a new volume by dividing an existing one
2205 // MOTHER Mother volume name
2206 // NDIV Number of divisions
2209 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2210 // It divides a previously defined volume.
2215 Vname(mother,vmother);
2216 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2217 PASSCHARL(vmother));
2220 //_____________________________________________________________________________
2221 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2222 Int_t iaxis, Float_t c0i, Int_t numed)
2225 // Create a new volume by dividing an existing one
2227 // Divides mother into ndiv divisions called name
2228 // along axis iaxis starting at coordinate value c0.
2229 // the new volume created will be medium number numed.
2234 Vname(mother,vmother);
2235 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2236 PASSCHARL(vname) PASSCHARL(vmother));
2239 //_____________________________________________________________________________
2240 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2241 Int_t iaxis, Int_t numed)
2244 // Create a new volume by dividing an existing one
2249 Vname(mother,vmother);
2250 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2251 PASSCHARL(vname) PASSCHARL(vmother));
2254 //_____________________________________________________________________________
2255 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2256 Int_t iaxis, Float_t c0, Int_t numed)
2259 // Create a new volume by dividing an existing one
2264 Vname(mother,vmother);
2265 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2266 PASSCHARL(vname) PASSCHARL(vmother));
2269 //_____________________________________________________________________________
2270 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2271 Int_t iaxis, Int_t numed, Int_t ndvmx)
2274 // Create a new volume by dividing an existing one
2276 // Divides MOTHER into divisions called NAME along
2277 // axis IAXIS in steps of STEP. If not exactly divisible
2278 // will make as many as possible and will centre them
2279 // with respect to the mother. Divisions will have medium
2280 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2281 // NDVMX is the expected maximum number of divisions
2282 // (If 0, no protection tests are performed)
2287 Vname(mother,vmother);
2288 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2289 PASSCHARL(vname) PASSCHARL(vmother));
2292 //_____________________________________________________________________________
2293 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2294 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2297 // Create a new volume by dividing an existing one
2299 // Divides MOTHER into divisions called NAME along
2300 // axis IAXIS starting at coordinate value C0 with step
2302 // The new volume created will have medium number NUMED.
2303 // If NUMED is 0, NUMED of mother is taken.
2304 // NDVMX is the expected maximum number of divisions
2305 // (If 0, no protection tests are performed)
2310 Vname(mother,vmother);
2311 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2312 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2315 //_____________________________________________________________________________
2316 void TGeant3::Gsord(const char *name, Int_t iax)
2319 // Flags volume CHNAME whose contents will have to be ordered
2320 // along axis IAX, by setting the search flag to -IAX
2324 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2325 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2326 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2327 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2328 // IAX = 6 PHI (PHI=0 => X axis)
2329 // IAX = 7 THETA (THETA=0 => Z axis)
2333 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2336 //_____________________________________________________________________________
2337 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2338 Float_t y, Float_t z, Int_t irot, const char *konly)
2341 // Position a volume into an existing one
2344 // NUMBER Copy number of the volume
2345 // MOTHER Mother volume name
2346 // X X coord. of the volume in mother ref. sys.
2347 // Y Y coord. of the volume in mother ref. sys.
2348 // Z Z coord. of the volume in mother ref. sys.
2349 // IROT Rotation matrix number w.r.t. mother ref. sys.
2350 // ONLY ONLY/MANY flag
2352 // It positions a previously defined volume in the mother.
2357 Vname(mother,vmother);
2358 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2359 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2363 //_____________________________________________________________________________
2364 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2365 Float_t x, Float_t y, Float_t z, Int_t irot,
2366 const char *konly, Float_t *upar, Int_t np )
2369 // Place a copy of generic volume NAME with user number
2370 // NR inside MOTHER, with its parameters UPAR(1..NP)
2375 Vname(mother,vmother);
2376 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2377 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2381 //_____________________________________________________________________________
2382 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2383 Float_t phi2, Float_t theta3, Float_t phi3)
2386 // nmat Rotation matrix number
2387 // THETA1 Polar angle for axis I
2388 // PHI1 Azimuthal angle for axis I
2389 // THETA2 Polar angle for axis II
2390 // PHI2 Azimuthal angle for axis II
2391 // THETA3 Polar angle for axis III
2392 // PHI3 Azimuthal angle for axis III
2394 // It defines the rotation matrix number IROT.
2396 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2399 //_____________________________________________________________________________
2400 void TGeant3::Gprotm(Int_t nmat)
2403 // To print rotation matrices structure JROTM
2404 // nmat Rotation matrix number
2409 //_____________________________________________________________________________
2410 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2411 Float_t *upar, Int_t npar)
2415 // SHAPE Volume type
2416 // NUMED Tracking medium number
2417 // NPAR Number of shape parameters
2418 // UPAR Vector containing shape parameters
2420 // It creates a new volume in the JVOLUM data structure.
2426 Vname(shape,vshape);
2427 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2428 PASSCHARL(vname) PASSCHARL(vshape));
2432 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2434 // T H E D R A W I N G P A C K A G E
2435 // ======================================
2436 // Drawing functions. These functions allow the visualization in several ways
2437 // of the volumes defined in the geometrical data structure. It is possible
2438 // to draw the logical tree of volumes belonging to the detector (DTREE),
2439 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2440 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2441 // these commands when the hidden line removal option is activated; in
2442 // this case, the volumes can be also either translated in the space
2443 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2444 // possible to fill the surfaces of the volumes
2445 // with solid colours when the shading option (SHAD) is activated.
2446 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2447 // of the detectors or to scan physical events as well.
2448 // Finally, the command MOVE will allow the rotation, translation and zooming
2449 // on real time parts of the detectors or tracks and hits of a simulated event.
2450 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2451 // the drawing is performed by the Geant ray-tracing;
2452 // automatically, the color is assigned according to the tracking medium of each
2453 // volume and the volumes with a density lower/equal than the air are considered
2454 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2455 // the user can set color and visibility for the desired volumes via the command
2456 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2457 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2458 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2459 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2460 // first case, we assume that the first mother volume of the tree is a box with
2461 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2462 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2463 // second case, the distance between the observer and the origin of the world
2464 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2465 // or telescopic effects can be achieved changing the scale factors in the command
2466 // (DRAW). When the final picture does not occupy the full window,
2467 // mapping the space before tracing can speed up the drawing, but can also
2468 // produce less precise results; values from 1 to 4 are allowed in the command
2469 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2470 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2471 // The command (VALCUT) allows the cutting of the detector by three planes
2472 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2473 // SATT for any desired volume and can assume values from 0 to 7; it determines
2474 // the different light processing to be performed for different materials:
2475 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2476 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2477 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2478 // is 0.9) and the observer is assumed to have a light source (therefore he will
2479 // produce parallel light in the case of parallel view and point-like-source
2480 // light in the case of perspective view).
2482 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2484 //_____________________________________________________________________________
2485 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2489 // IOPT Name of the attribute to be set
2490 // IVAL Value to which the attribute is to be set
2492 // name= "*" stands for all the volumes.
2493 // iopt can be chosen among the following :
2495 // WORK 0=volume name is inactive for the tracking
2496 // 1=volume name is active for the tracking (default)
2498 // SEEN 0=volume name is invisible
2499 // 1=volume name is visible (default)
2500 // -1=volume invisible with all its descendants in the tree
2501 // -2=volume visible but not its descendants in the tree
2503 // LSTY line style 1,2,3,... (default=1)
2504 // LSTY=7 will produce a very precise approximation for
2505 // revolution bodies.
2507 // LWID line width -7,...,1,2,3,..7 (default=1)
2508 // LWID<0 will act as abs(LWID) was set for the volume
2509 // and for all the levels below it. When SHAD is 'ON', LWID
2510 // represent the linewidth of the scan lines filling the surfaces
2511 // (whereas the FILL value represent their number). Therefore
2512 // tuning this parameter will help to obtain the desired
2513 // quality/performance ratio.
2515 // COLO colour code -166,...,1,2,..166 (default=1)
2517 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2518 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2519 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2520 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2521 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2522 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2523 // colour=n*10+m, m=1,2,...9, will produce the same colour
2524 // as 'n', but with increasing luminosity according to 'm';
2525 // COLO<0 will act as if abs(COLO) was set for the volume
2526 // and for all the levels below it.
2527 // When for a volume the attribute FILL is > 1 (and the
2528 // option SHAD is on), the ABS of its colour code must be < 8
2529 // because an automatic shading of its faces will be
2532 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2533 // when option SHAD is "on" the FILL attribute of any
2534 // volume can be set different from 0 (normal drawing);
2535 // if it is set to 1, the faces of such volume will be filled
2536 // with solid colours; if ABS(FILL) is > 1, then a light
2537 // source is placed along the observer line, and the faces of
2538 // such volumes will be painted by colours whose luminosity
2539 // will depend on the amount of light reflected;
2540 // if ABS(FILL) = 1, then it is possible to use all the 166
2541 // colours of the colour table, becouse the automatic shading
2542 // is not performed;
2543 // for increasing values of FILL the drawing will be performed
2544 // with higher and higher resolution improving the quality (the
2545 // number of scan lines used to fill the faces increases with FILL);
2546 // it is possible to set different values of FILL
2547 // for different volumes, in order to optimize at the same time
2548 // the performance and the quality of the picture;
2549 // FILL<0 will act as if abs(FILL) was set for the volume
2550 // and for all the levels below it.
2551 // This kind of drawing can be saved in 'picture files'
2552 // or in view banks.
2553 // 0=drawing without fill area
2554 // 1=faces filled with solid colours and resolution = 6
2555 // 2=lowest resolution (very fast)
2556 // 3=default resolution
2557 // 4=.................
2558 // 5=.................
2559 // 6=.................
2561 // Finally, if a coloured background is desired, the FILL
2562 // attribute for the first volume of the tree must be set
2563 // equal to -abs(colo), colo being >0 and <166.
2565 // SET set number associated to volume name
2566 // DET detector number associated to volume name
2567 // DTYP detector type (1,2)
2574 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2578 //_____________________________________________________________________________
2579 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2580 Int_t& natt, Float_t* par, Float_t* att)
2583 // Find the parameters of a volume
2585 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2589 //_____________________________________________________________________________
2590 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2593 // Check the parameters of a shape
2595 gckpar(ish,npar,par);
2598 //_____________________________________________________________________________
2599 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2602 // Check the parameters of a tracking medium
2604 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2607 //_____________________________________________________________________________
2608 void TGeant3::Gdelete(Int_t iview)
2611 // IVIEW View number
2613 // It deletes a view bank from memory.
2618 //_____________________________________________________________________________
2619 void TGeant3::Gdopen(Int_t iview)
2622 // IVIEW View number
2624 // When a drawing is very complex and requires a long time to be
2625 // executed, it can be useful to store it in a view bank: after a
2626 // call to DOPEN and the execution of the drawing (nothing will
2627 // appear on the screen), and after a necessary call to DCLOSE,
2628 // the contents of the bank can be displayed in a very fast way
2629 // through a call to DSHOW; therefore, the detector can be easily
2630 // zoomed many times in different ways. Please note that the pictures
2631 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2638 //_____________________________________________________________________________
2639 void TGeant3::Gdclose()
2642 // It closes the currently open view bank; it must be called after the
2643 // end of the drawing to be stored.
2648 //_____________________________________________________________________________
2649 void TGeant3::Gdshow(Int_t iview)
2652 // IVIEW View number
2654 // It shows on the screen the contents of a view bank. It
2655 // can be called after a view bank has been closed.
2660 //_____________________________________________________________________________
2661 void TGeant3::Gdopt(const char *name,const char *value)
2665 // VALUE Option value
2667 // To set/modify the drawing options.
2670 // THRZ ON Draw tracks in R vs Z
2671 // OFF (D) Draw tracks in X,Y,Z
2674 // PROJ PARA (D) Parallel projection
2676 // TRAK LINE (D) Trajectory drawn with lines
2677 // POIN " " with markers
2678 // HIDE ON Hidden line removal using the CG package
2679 // OFF (D) No hidden line removal
2680 // SHAD ON Fill area and shading of surfaces.
2681 // OFF (D) Normal hidden line removal.
2682 // RAYT ON Ray-tracing on.
2683 // OFF (D) Ray-tracing off.
2684 // EDGE OFF Does not draw contours when shad is on.
2685 // ON (D) Normal shading.
2686 // MAPP 1,2,3,4 Mapping before ray-tracing.
2687 // 0 (D) No mapping.
2688 // USER ON User graphics options in the raytracing.
2689 // OFF (D) Automatic graphics options.
2695 Vname(value,vvalue);
2696 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2700 //_____________________________________________________________________________
2701 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2702 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2707 // THETA Viewing angle theta (for 3D projection)
2708 // PHI Viewing angle phi (for 3D projection)
2709 // PSI Viewing angle psi (for 2D rotation)
2710 // U0 U-coord. (horizontal) of volume origin
2711 // V0 V-coord. (vertical) of volume origin
2712 // SU Scale factor for U-coord.
2713 // SV Scale factor for V-coord.
2715 // This function will draw the volumes,
2716 // selected with their graphical attributes, set by the Gsatt
2717 // facility. The drawing may be performed with hidden line removal
2718 // and with shading effects according to the value of the options HIDE
2719 // and SHAD; if the option SHAD is ON, the contour's edges can be
2720 // drawn or not. If the option HIDE is ON, the detector can be
2721 // exploded (BOMB), clipped with different shapes (CVOL), and some
2722 // of its parts can be shifted from their original
2723 // position (SHIFT). When HIDE is ON, if
2724 // the drawing requires more than the available memory, the program
2725 // will evaluate and display the number of missing words
2726 // (so that the user can increase the
2727 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2728 // the program will print messages about the memory used and
2729 // statistics on the volumes' visibility.
2730 // The following commands will produce the drawing of a green
2731 // volume, specified by NAME, without using the hidden line removal
2732 // technique, using the hidden line removal technique,
2733 // with different linewidth and colour (red), with
2734 // solid colour, with shading of surfaces, and without edges.
2735 // Finally, some examples are given for the ray-tracing. (A possible
2736 // string for the NAME of the volume can be found using the command DTREE).
2742 if (fGcvdma->raytra != 1) {
2743 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2745 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2749 //_____________________________________________________________________________
2750 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2751 Float_t v0,Float_t ul,Float_t vl)
2756 // CUTVAL Cut plane distance from the origin along the axis
2758 // U0 U-coord. (horizontal) of volume origin
2759 // V0 V-coord. (vertical) of volume origin
2760 // SU Scale factor for U-coord.
2761 // SV Scale factor for V-coord.
2763 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2764 // and placed at the distance cutval from the origin.
2765 // The resulting picture is seen from the the same axis.
2766 // When HIDE Mode is ON, it is possible to get the same effect with
2767 // the CVOL/BOX function.
2773 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2776 //_____________________________________________________________________________
2777 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2778 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2779 Float_t v0,Float_t ul,Float_t vl)
2783 // CUTTHE Theta angle of the line normal to cut plane
2784 // CUTPHI Phi angle of the line normal to cut plane
2785 // CUTVAL Cut plane distance from the origin along the axis
2787 // THETA Viewing angle theta (for 3D projection)
2788 // PHI Viewing angle phi (for 3D projection)
2789 // U0 U-coord. (horizontal) of volume origin
2790 // V0 V-coord. (vertical) of volume origin
2791 // SU Scale factor for U-coord.
2792 // SV Scale factor for V-coord.
2794 // The cut plane is normal to the line given by the cut angles
2795 // cutthe and cutphi and placed at the distance cutval from the origin.
2796 // The resulting picture is seen from the viewing angles theta,phi.
2802 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2806 //_____________________________________________________________________________
2807 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2812 // ISEL Option flag D=111110
2814 // CHRSIZ Character size (cm) of title NAME D=0.6
2817 // 0 to have only the header lines
2818 // xxxxx1 to add the text name centered on top of header
2819 // xxxx1x to add global detector name (first volume) on left
2820 // xxx1xx to add date on right
2821 // xx1xxx to select thick characters for text on top of header
2822 // x1xxxx to add the text 'EVENT NR x' on top of header
2823 // 1xxxxx to add the text 'RUN NR x' on top of header
2824 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2825 // i.e. they generate overwritten text.
2827 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2830 //_____________________________________________________________________________
2831 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2834 // Draw a 2D-man at position (U0,V0)
2836 // U U-coord. (horizontal) of the centre of man' R
2837 // V V-coord. (vertical) of the centre of man' R
2838 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2840 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2841 // It superimposes the picure of a man or of a woman, chosen among
2842 // three different ones, with the same scale factors as the detector
2843 // in the current drawing.
2846 if (opt.Contains("WM1")) {
2848 } else if (opt.Contains("WM3")) {
2850 } else if (opt.Contains("WM2")) {
2857 //_____________________________________________________________________________
2858 void TGeant3::Gdspec(const char *name)
2863 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2864 // its geometrical specifications. The 3D drawing will
2865 // be performed according the current values of the options HIDE and
2866 // SHAD and according the current SetClipBox clipping parameters for that
2873 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2876 //_____________________________________________________________________________
2877 void TGeant3::DrawOneSpec(const char *name)
2880 // Function called when one double-clicks on a volume name
2881 // in a TPavelabel drawn by Gdtree.
2883 THIGZ *higzSave = higz;
2884 higzSave->SetName("higzSave");
2885 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2886 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2887 if (higzSpec) higz = higzSpec;
2888 else higzSpec = new THIGZ(defSize);
2889 higzSpec->SetName("higzSpec");
2894 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2897 higzSave->SetName("higz");
2901 //_____________________________________________________________________________
2902 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2906 // LEVMAX Depth level
2909 // This function draws the logical tree,
2910 // Each volume in the tree is represented by a TPaveTree object.
2911 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2912 // Use TPaveTree pop-up menu to select:
2915 // - drawing tree of parent
2921 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2925 //_____________________________________________________________________________
2926 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2930 // LEVMAX Depth level
2933 // This function draws the logical tree of the parent of name.
2937 // Scan list of volumes in JVOLUM
2939 Int_t gname, i, jvo, in, nin, jin, num;
2940 strncpy((char *) &gname, name, 4);
2941 for(i=1; i<=fGcnum->nvolum; i++) {
2942 jvo = fZlq[fGclink->jvolum-i];
2943 nin = Int_t(fZq[jvo+3]);
2944 if (nin == -1) nin = 1;
2945 for (in=1;in<=nin;in++) {
2947 num = Int_t(fZq[jin+2]);
2948 if(gname == fZiq[fGclink->jvolum+num]) {
2949 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2951 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2959 //_____________________________________________________________________________
2960 void TGeant3::SetABAN(Int_t par)
2963 // par = 1 particles will be stopped according to their residual
2964 // range if they are not in a sensitive material and are
2965 // far enough from the boundary
2966 // 0 particles are transported normally
2968 fGcphys->dphys1 = par;
2972 //_____________________________________________________________________________
2973 void TGeant3::SetANNI(Int_t par)
2976 // To control positron annihilation.
2977 // par =0 no annihilation
2978 // =1 annihilation. Decays processed.
2979 // =2 annihilation. No decay products stored.
2981 fGcphys->ianni = par;
2985 //_____________________________________________________________________________
2986 void TGeant3::SetAUTO(Int_t par)
2989 // To control automatic calculation of tracking medium parameters:
2990 // par =0 no automatic calculation;
2991 // =1 automati calculation.
2993 fGctrak->igauto = par;
2997 //_____________________________________________________________________________
2998 void TGeant3::SetBOMB(Float_t boom)
3001 // BOOM : Exploding factor for volumes position
3003 // To 'explode' the detector. If BOOM is positive (values smaller
3004 // than 1. are suggested, but any value is possible)
3005 // all the volumes are shifted by a distance
3006 // proportional to BOOM along the direction between their centre
3007 // and the origin of the MARS; the volumes which are symmetric
3008 // with respect to this origin are simply not shown.
3009 // BOOM equal to 0 resets the normal mode.
3010 // A negative (greater than -1.) value of
3011 // BOOM will cause an 'implosion'; for even lower values of BOOM
3012 // the volumes' positions will be reflected respect to the origin.
3013 // This command can be useful to improve the 3D effect for very
3014 // complex detectors. The following commands will make explode the
3021 //_____________________________________________________________________________
3022 void TGeant3::SetBREM(Int_t par)
3025 // To control bremstrahlung.
3026 // par =0 no bremstrahlung
3027 // =1 bremstrahlung. Photon processed.
3028 // =2 bremstrahlung. No photon stored.
3030 fGcphys->ibrem = par;
3034 //_____________________________________________________________________________
3035 void TGeant3::SetCKOV(Int_t par)
3038 // To control Cerenkov production
3039 // par =0 no Cerenkov;
3041 // =2 Cerenkov with primary stopped at each step.
3043 fGctlit->itckov = par;
3047 //_____________________________________________________________________________
3048 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3049 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3052 // The hidden line removal technique is necessary to visualize properly
3053 // very complex detectors. At the same time, it can be useful to visualize
3054 // the inner elements of a detector in detail. This function allows
3055 // subtractions (via boolean operation) of BOX shape from any part of
3056 // the detector, therefore showing its inner contents.
3057 // If "*" is given as the name of the
3058 // volume to be clipped, all volumes are clipped by the given box.
3059 // A volume can be clipped at most twice.
3060 // if a volume is explicitely clipped twice,
3061 // the "*" will not act on it anymore. Giving "." as the name
3062 // of the volume to be clipped will reset the clipping.
3064 // NAME Name of volume to be clipped
3066 // XMIN Lower limit of the Shape X coordinate
3067 // XMAX Upper limit of the Shape X coordinate
3068 // YMIN Lower limit of the Shape Y coordinate
3069 // YMAX Upper limit of the Shape Y coordinate
3070 // ZMIN Lower limit of the Shape Z coordinate
3071 // ZMAX Upper limit of the Shape Z coordinate
3073 // This function performs a boolean subtraction between the volume
3074 // NAME and a box placed in the MARS according the values of the given
3080 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3083 //_____________________________________________________________________________
3084 void TGeant3::SetCOMP(Int_t par)
3087 // To control Compton scattering
3088 // par =0 no Compton
3089 // =1 Compton. Electron processed.
3090 // =2 Compton. No electron stored.
3093 fGcphys->icomp = par;
3096 //_____________________________________________________________________________
3097 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3098 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3099 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3100 Float_t ppcutm, Float_t tofmax)
3103 // CUTGAM Cut for gammas D=0.001
3104 // CUTELE Cut for electrons D=0.001
3105 // CUTHAD Cut for charged hadrons D=0.01
3106 // CUTNEU Cut for neutral hadrons D=0.01
3107 // CUTMUO Cut for muons D=0.01
3108 // BCUTE Cut for electron brems. D=-1.
3109 // BCUTM Cut for muon brems. D=-1.
3110 // DCUTE Cut for electron delta-rays D=-1.
3111 // DCUTM Cut for muon delta-rays D=-1.
3112 // PPCUTM Cut for e+e- pairs by muons D=0.01
3113 // TOFMAX Time of flight cut D=1.E+10
3115 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3116 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3118 // If one of the parameters from CUTGAM to PPCUTM included
3119 // is modified, cross-sections and energy loss tables must be
3120 // recomputed via the function Gphysi.
3122 fGccuts->cutgam = cutgam;
3123 fGccuts->cutele = cutele;
3124 fGccuts->cutneu = cutneu;
3125 fGccuts->cuthad = cuthad;
3126 fGccuts->cutmuo = cutmuo;
3127 fGccuts->bcute = bcute;
3128 fGccuts->bcutm = bcutm;
3129 fGccuts->dcute = dcute;
3130 fGccuts->dcutm = dcutm;
3131 fGccuts->ppcutm = ppcutm;
3132 fGccuts->tofmax = tofmax;
3135 //_____________________________________________________________________________
3136 void TGeant3::SetDCAY(Int_t par)
3139 // To control Decay mechanism.
3140 // par =0 no decays.
3141 // =1 Decays. secondaries processed.
3142 // =2 Decays. No secondaries stored.
3144 fGcphys->idcay = par;
3148 //_____________________________________________________________________________
3149 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3152 // Set the debug flag and frequency
3153 // Selected debug output will be printed from
3154 // event emin to even emax each emod event
3156 fGcflag->idemin = emin;
3157 fGcflag->idemax = emax;
3158 fGcflag->itest = emod;
3162 //_____________________________________________________________________________
3163 void TGeant3::SetDRAY(Int_t par)
3166 // To control delta rays mechanism.
3167 // par =0 no delta rays.
3168 // =1 Delta rays. secondaries processed.
3169 // =2 Delta rays. No secondaries stored.
3171 fGcphys->idray = par;
3174 //_____________________________________________________________________________
3175 void TGeant3::SetHADR(Int_t par)
3178 // To control hadronic interactions.
3179 // par =0 no hadronic interactions.
3180 // =1 Hadronic interactions. secondaries processed.
3181 // =2 Hadronic interactions. No secondaries stored.
3183 fGcphys->ihadr = par;
3186 //_____________________________________________________________________________
3187 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3188 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3189 Float_t xk8, Float_t xk9, Float_t xk10)
3192 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3193 // Their meaning is user defined
3195 fGckine->ikine = kine;
3196 fGckine->pkine[0] = xk1;
3197 fGckine->pkine[1] = xk2;
3198 fGckine->pkine[2] = xk3;
3199 fGckine->pkine[3] = xk4;
3200 fGckine->pkine[4] = xk5;
3201 fGckine->pkine[5] = xk6;
3202 fGckine->pkine[6] = xk7;
3203 fGckine->pkine[7] = xk8;
3204 fGckine->pkine[8] = xk9;
3205 fGckine->pkine[9] = xk10;
3208 //_____________________________________________________________________________
3209 void TGeant3::SetLOSS(Int_t par)
3212 // To control energy loss.
3213 // par =0 no energy loss;
3214 // =1 restricted energy loss fluctuations;
3215 // =2 complete energy loss fluctuations;
3217 // =4 no energy loss fluctuations.
3218 // If the value ILOSS is changed, then cross-sections and energy loss
3219 // tables must be recomputed via the command 'PHYSI'.
3221 fGcphys->iloss = par;
3225 //_____________________________________________________________________________
3226 void TGeant3::SetMULS(Int_t par)
3229 // To control multiple scattering.
3230 // par =0 no multiple scattering.
3231 // =1 Moliere or Coulomb scattering.
3232 // =2 Moliere or Coulomb scattering.
3233 // =3 Gaussian scattering.
3235 fGcphys->imuls = par;
3239 //_____________________________________________________________________________
3240 void TGeant3::SetMUNU(Int_t par)
3243 // To control muon nuclear interactions.
3244 // par =0 no muon-nuclear interactions.
3245 // =1 Nuclear interactions. Secondaries processed.
3246 // =2 Nuclear interactions. Secondaries not processed.
3248 fGcphys->imunu = par;
3251 //_____________________________________________________________________________
3252 void TGeant3::SetOPTI(Int_t par)
3255 // This flag controls the tracking optimisation performed via the
3257 // 1 no optimisation at all; GSORD calls disabled;
3258 // 0 no optimisation; only user calls to GSORD kept;
3259 // 1 all non-GSORDered volumes are ordered along the best axis;
3260 // 2 all volumes are ordered along the best axis.
3262 fGcopti->ioptim = par;
3265 //_____________________________________________________________________________
3266 void TGeant3::SetPAIR(Int_t par)
3269 // To control pair production mechanism.
3270 // par =0 no pair production.
3271 // =1 Pair production. secondaries processed.
3272 // =2 Pair production. No secondaries stored.
3274 fGcphys->ipair = par;
3278 //_____________________________________________________________________________
3279 void TGeant3::SetPFIS(Int_t par)
3282 // To control photo fission mechanism.
3283 // par =0 no photo fission.
3284 // =1 Photo fission. secondaries processed.
3285 // =2 Photo fission. No secondaries stored.
3287 fGcphys->ipfis = par;
3290 //_____________________________________________________________________________
3291 void TGeant3::SetPHOT(Int_t par)
3294 // To control Photo effect.
3295 // par =0 no photo electric effect.
3296 // =1 Photo effect. Electron processed.
3297 // =2 Photo effect. No electron stored.
3299 fGcphys->iphot = par;
3302 //_____________________________________________________________________________
3303 void TGeant3::SetRAYL(Int_t par)
3306 // To control Rayleigh scattering.
3307 // par =0 no Rayleigh scattering.
3310 fGcphys->irayl = par;
3313 //_____________________________________________________________________________
3314 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3318 // val New switch value
3320 // Change one element of array ISWIT(10) in /GCFLAG/
3322 if (sw <= 0 || sw > 10) return;
3323 fGcflag->iswit[sw-1] = val;
3327 //_____________________________________________________________________________
3328 void TGeant3::SetTRIG(Int_t nevents)
3331 // Set number of events to be run
3333 fGcflag->nevent = nevents;
3336 //_____________________________________________________________________________
3337 void TGeant3::SetUserDecay(Int_t pdg)
3340 // Force the decays of particles to be done with Pythia
3341 // and not with the Geant routines.
3342 // just kill pointers doing mzdrop
3344 Int_t ipart = IdFromPDG(pdg);
3346 printf("Particle %d not in geant\n",pdg);
3349 Int_t jpart=fGclink->jpart;
3350 Int_t jpa=fZlq[jpart-ipart];
3353 Int_t jpa1=fZlq[jpa-1];
3355 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3356 Int_t jpa2=fZlq[jpa-2];
3358 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3362 //______________________________________________________________________________
3363 void TGeant3::Vname(const char *name, char *vname)
3366 // convert name to upper case. Make vname at least 4 chars
3368 Int_t l = strlen(name);
3371 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3372 for (i=l;i<4;i++) vname[i] = ' ';
3376 //______________________________________________________________________________
3377 void TGeant3::Ertrgo()
3382 //______________________________________________________________________________
3383 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3384 const Float_t *x2, const Float_t *p2,
3385 Int_t ipa, Option_t *chopt)
3387 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3390 //_____________________________________________________________________________
3391 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3392 Int_t number, Int_t nlevel)
3396 // ******************************************************************
3398 // * Write out the geometry of the detector in EUCLID file format *
3400 // * filnam : will be with the extension .euc *
3401 // * topvol : volume name of the starting node *
3402 // * number : copy number of topvol (relevant for gsposp) *
3403 // * nlevel : number of levels in the tree structure *
3404 // * to be written out, starting from topvol *
3406 // * Author : M. Maire *
3408 // ******************************************************************
3410 // File filnam.tme is written out with the definitions of tracking
3411 // medias and materials.
3412 // As to restore original numbers for materials and medias, program
3413 // searches in the file euc_medi.dat and comparing main parameters of
3414 // the mat. defined inside geant and the one in file recognizes them
3415 // and is able to take number from file. If for any material or medium,
3416 // this procedure fails, ordering starts from 1.
3417 // Arrays IOTMED and IOMATE are used for this procedure
3419 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3420 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3422 Int_t i, end, itm, irm, jrm, k, nmed;
3426 char *filext, *filetme;
3427 char natmed[21], namate[21];
3428 char natmedc[21], namatec[21];
3429 char key[5], name[5], mother[5], konly[5];
3431 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3432 Int_t mlevel, numbr, natt, numed, nin, ndata;
3433 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3434 Int_t jdiv, ivin, in, jin, jvin, irot;
3435 Int_t jtm, imat, jma, flag=0, imatc;
3436 Float_t az, dens, radl, absl, a, step, x, y, z;
3437 Int_t npar, ndvmx, left;
3438 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3440 Int_t iomate[100], iotmed[100];
3441 Float_t par[50], att[20], ubuf[50];
3444 Int_t level, ndiv, iaxe;
3445 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3446 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3447 Float_t tmaxf, stemax, deemax, epsil, stmin;
3448 const char *f10000="!\n%s\n!\n";
3449 //Open the input file
3451 for(i=0;i<end;i++) if(filnam[i]=='.') {
3455 filext=new char[end+4];
3456 filetme=new char[end+4];
3457 strncpy(filext,filnam,end);
3458 strncpy(filetme,filnam,end);
3460 // *** The output filnam name will be with extension '.euc'
3461 strcpy(&filext[end],".euc");
3462 strcpy(&filetme[end],".tme");
3463 lun=fopen(filext,"w");
3465 // *** Initialisation of the working space
3466 iadvol=fGcnum->nvolum;
3467 iadtmd=iadvol+fGcnum->nvolum;
3468 iadrot=iadtmd+fGcnum->ntmed;
3469 if(fGclink->jrotm) {
3470 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3474 nwtot=iadrot+fGcnum->nrotm;
3475 qws = new float[nwtot+1];
3476 for (i=0;i<nwtot+1;i++) qws[i]=0;
3479 if(nlevel==0) mlevel=20;
3481 // *** find the top volume and put it in the stak
3482 numbr = number>0 ? number : 1;
3483 Gfpara(topvol,numbr,1,npar,natt,par,att);
3485 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3490 // *** authorized shape ?
3491 strncpy((char *)&iname, topvol, 4);
3493 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3497 jvo = fZlq[fGclink->jvolum-ivo];
3498 ish = Int_t (fZq[jvo+2]);
3500 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3507 iws[iadvol+ivo] = level;
3510 //*** flag all volumes and fill the stak
3514 // pick the next volume in stak
3516 ivo = TMath::Abs(iws[ivstak]);
3517 jvo = fZlq[fGclink->jvolum - ivo];
3519 // flag the tracking medium
3520 numed = Int_t (fZq[jvo + 4]);
3521 iws[iadtmd + numed] = 1;
3523 // get the daughters ...
3524 level = iws[iadvol+ivo];
3525 if (level < mlevel) {
3527 nin = Int_t (fZq[jvo + 3]);
3529 // from division ...
3531 jdiv = fZlq[jvo - 1];
3532 ivin = Int_t (fZq[jdiv + 2]);
3534 iws[nvstak] = -ivin;
3535 iws[iadvol+ivin] = level;
3537 // from position ...
3538 } else if (nin > 0) {
3539 for(in=1; in<=nin; in++) {
3540 jin = fZlq[jvo - in];
3541 ivin = Int_t (fZq[jin + 2 ]);
3542 jvin = fZlq[fGclink->jvolum - ivin];
3543 ish = Int_t (fZq[jvin + 2]);
3544 // authorized shape ?
3546 // not yet flagged ?
3547 if (iws[iadvol+ivin]==0) {
3550 iws[iadvol+ivin] = level;
3552 // flag the rotation matrix
3553 irot = Int_t ( fZq[jin + 4 ]);
3554 if (irot > 0) iws[iadrot+irot] = 1;
3560 // next volume in stak ?
3561 if (ivstak < nvstak) goto L10;
3563 // *** restore original material and media numbers
3564 // file euc_medi.dat is needed to compare materials and medias
3566 FILE* luncor=fopen("euc_medi.dat","r");
3569 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3570 if (iws[iadtmd+itm] > 0) {
3571 jtm = fZlq[fGclink->jtmed-itm];
3572 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3573 imat = Int_t (fZq[jtm+6]);
3574 jma = fZlq[fGclink->jmate-imat];
3576 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3579 strncpy(namate,(char *)&fZiq[jma+1],20);
3582 //** find the material original number
3585 iret=fscanf(luncor,"%4s,%130s",key,card);
3586 if(iret<=0) goto L26;
3588 if(!strcmp(key,"MATE")) {
3589 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3590 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3591 if(!strcmp(namatec,namate)) {
3592 if(az==a && zc==z && densc==dens && radlc==radl
3593 && abslc==absl && nparc==nparc) {
3596 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3598 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3602 if(strcmp(key,"END") && !flag) goto L23;
3604 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3608 //*** restore original tracking medium number
3611 iret=fscanf(luncor,"%4s,%130s",key,card);
3612 if(iret<=0) goto L26;
3614 if (!strcmp(key,"TMED")) {
3615 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3616 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3617 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);