1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface Class to the Geant3.21 MonteCarlo //
7 <img src="picts/TGeant3Class.gif">
12 ///////////////////////////////////////////////////////////////////////////////
18 #include <TDatabasePDG.h>
19 #include "AliCallf77.h"
22 # define gzebra gzebra_
23 # define grfile grfile_
24 # define gpcxyz gpcxyz_
25 # define ggclos ggclos_
28 # define gcinit gcinit_
31 # define gtrigc gtrigc_
32 # define gtrigi gtrigi_
34 # define gzinit gzinit_
35 # define gfmate gfmate_
36 # define gfpart gfpart_
37 # define gftmed gftmed_
41 # define gsmate gsmate_
42 # define gsmixt gsmixt_
43 # define gspart gspart_
44 # define gstmed gstmed_
45 # define gsckov gsckov_
46 # define gstpar gstpar_
47 # define gfkine gfkine_
48 # define gfvert gfvert_
49 # define gskine gskine_
50 # define gsvert gsvert_
51 # define gphysi gphysi_
52 # define gdebug gdebug_
53 # define gekbin gekbin_
54 # define gfinds gfinds_
55 # define gsking gsking_
56 # define gskpho gskpho_
57 # define gsstak gsstak_
59 # define gtrack gtrack_
60 # define gtreve gtreve_
61 # define gtreve_root gtreve_root_
63 # define grndmq grndmq_
65 # define glmoth glmoth_
66 # define gmedia gmedia_
69 # define gsdvn2 gsdvn2_
71 # define gsdvs2 gsdvs2_
73 # define gsdvt2 gsdvt2_
76 # define gsposp gsposp_
77 # define gsrotm gsrotm_
78 # define gprotm gprotm_
79 # define gsvolu gsvolu_
80 # define gprint gprint_
81 # define gdinit gdinit_
84 # define gdrayt gdrayt_
85 # define gdrawc gdrawc_
86 # define gdrawx gdrawx_
87 # define gdhead gdhead_
88 # define gdwmn1 gdwmn1_
89 # define gdwmn2 gdwmn2_
90 # define gdwmn3 gdwmn3_
92 # define gdcxyz gdcxyz_
94 # define gdspec gdspec_
95 # define gdtree gdtree_
96 # define gdelet gdelet_
97 # define gdclos gdclos_
98 # define gdshow gdshow_
99 # define gdopen gdopen_
100 # define dzshow dzshow_
101 # define gsatt gsatt_
102 # define gfpara gfpara_
103 # define gckpar gckpar_
104 # define gckmat gckmat_
105 # define geditv geditv_
106 # define mzdrop mzdrop_
108 # define ertrak ertrak_
109 # define ertrgo ertrgo_
111 # define setbomb setbomb_
112 # define setclip setclip_
113 # define gcomad gcomad_
116 # define gzebra GZEBRA
117 # define grfile GRFILE
118 # define gpcxyz GPCXYZ
119 # define ggclos GGCLOS
122 # define gcinit GCINIT
125 # define gtrigc GTRIGC
126 # define gtrigi GTRIGI
128 # define gzinit GZINIT
129 # define gfmate GFMATE
130 # define gfpart GFPART
131 # define gftmed GFTMED
135 # define gsmate GSMATE
136 # define gsmixt GSMIXT
137 # define gspart GSPART
138 # define gstmed GSTMED
139 # define gsckov GSCKOV
140 # define gstpar GSTPAR
141 # define gfkine GFKINE
142 # define gfvert GFVERT
143 # define gskine GSKINE
144 # define gsvert GSVERT
145 # define gphysi GPHYSI
146 # define gdebug GDEBUG
147 # define gekbin GEKBIN
148 # define gfinds GFINDS
149 # define gsking GSKING
150 # define gskpho GSKPHO
151 # define gsstak GSSTAK
153 # define gtrack GTRACK
154 # define gtreve GTREVE
155 # define gtreve_root GTREVE_ROOT
157 # define grndmq GRNDMQ
159 # define glmoth GLMOTH
160 # define gmedia GMEDIA
163 # define gsdvn2 GSDVN2
165 # define gsdvs2 GSDVS2
167 # define gsdvt2 GSDVT2
170 # define gsposp GSPOSP
171 # define gsrotm GSROTM
172 # define gprotm GPROTM
173 # define gsvolu GSVOLU
174 # define gprint GPRINT
175 # define gdinit GDINIT
178 # define gdrayt GDRAYT
179 # define gdrawc GDRAWC
180 # define gdrawx GDRAWX
181 # define gdhead GDHEAD
182 # define gdwmn1 GDWMN1
183 # define gdwmn2 GDWMN2
184 # define gdwmn3 GDWMN3
186 # define gdcxyz GDCXYZ
188 # define gdfspc GDFSPC
189 # define gdspec GDSPEC
190 # define gdtree GDTREE
191 # define gdelet GDELET
192 # define gdclos GDCLOS
193 # define gdshow GDSHOW
194 # define gdopen GDOPEN
195 # define dzshow DZSHOW
197 # define gfpara GFPARA
198 # define gckpar GCKPAR
199 # define gckmat GCKMAT
200 # define geditv GEDITV
201 # define mzdrop MZDROP
203 # define ertrak ERTRAK
204 # define ertrgo ERTRGO
206 # define setbomb SETBOMB
207 # define setclip SETCLIP
208 # define gcomad GCOMAD
212 //____________________________________________________________________________
216 // Prototypes for GEANT functions
218 void type_of_call gzebra(const int&);
220 void type_of_call gpcxyz();
222 void type_of_call ggclos();
224 void type_of_call glast();
226 void type_of_call ginit();
228 void type_of_call gcinit();
230 void type_of_call grun();
232 void type_of_call gtrig();
234 void type_of_call gtrigc();
236 void type_of_call gtrigi();
238 void type_of_call gwork(const int&);
240 void type_of_call gzinit();
242 void type_of_call gmate();
244 void type_of_call gpart();
246 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
248 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
249 Int_t &, Float_t *, Int_t &);
251 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
252 Float_t &, Float_t *, Int_t &);
254 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
257 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
260 void type_of_call gphysi();
262 void type_of_call gdebug();
264 void type_of_call gekbin();
266 void type_of_call gfinds();
268 void type_of_call gsking(Int_t &);
270 void type_of_call gskpho(Int_t &);
272 void type_of_call gsstak(Int_t &);
274 void type_of_call gsxyz();
276 void type_of_call gtrack();
278 void type_of_call gtreve();
280 void type_of_call gtreve_root();
282 void type_of_call grndm(Float_t *, const Int_t &);
284 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
287 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
289 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
290 Int_t *, Int_t * DEFCHARL);
292 void type_of_call gmedia(Float_t *, Int_t &);
294 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
296 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
297 const Float_t &, const Float_t &, const Float_t &,
300 void type_of_call gprotm(const Int_t &);
302 void type_of_call grfile(const Int_t&, DEFCHARD,
303 DEFCHARD DEFCHARL DEFCHARL);
305 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
306 Float_t &, Float_t &, Float_t &, Float_t *,
309 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
310 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
312 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
313 Float_t &, Float_t &, Float_t &, Float_t &,
314 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
316 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
317 Float_t &, Float_t &, Float_t &, Float_t *,
320 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
321 Float_t &, Int_t &, Float_t * DEFCHARL);
323 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
324 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
327 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
328 Float_t &, Float_t &, Float_t &, Float_t &,
329 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
331 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
332 Float_t *absco, Float_t *effic, Float_t *rindex);
333 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
335 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
338 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
339 Int_t & DEFCHARL DEFCHARL);
341 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
344 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
345 Int_t & DEFCHARL DEFCHARL);
347 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
348 Int_t & DEFCHARL DEFCHARL);
350 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
351 Int_t &, Int_t & DEFCHARL DEFCHARL);
353 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
355 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
356 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
359 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
360 Float_t &, Int_t &, DEFCHARD,
361 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
363 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
364 Int_t & DEFCHARL DEFCHARL);
366 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
368 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
371 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
373 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
375 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
377 void type_of_call gdinit();
379 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
381 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
382 Float_t &, Float_t &, Float_t & DEFCHARL);
383 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
384 Float_t &, Float_t &, Float_t & DEFCHARL);
385 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
386 Float_t &, Float_t & DEFCHARL);
387 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
388 Float_t &, Float_t &, Float_t &, Float_t &,
390 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
391 void type_of_call gdxyz(Int_t &);
392 void type_of_call gdcxyz();
393 void type_of_call gdman(Float_t &, Float_t &);
394 void type_of_call gdwmn1(Float_t &, Float_t &);
395 void type_of_call gdwmn2(Float_t &, Float_t &);
396 void type_of_call gdwmn3(Float_t &, Float_t &);
397 void type_of_call gdspec(DEFCHARD DEFCHARL);
398 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
399 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
401 void type_of_call gdopen(Int_t &);
402 void type_of_call gdclos();
403 void type_of_call gdelet(Int_t &);
404 void type_of_call gdshow(Int_t &);
405 void type_of_call geditv(Int_t &) {;}
408 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
409 const int&, const int&, const int& DEFCHARL
412 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
414 void type_of_call setbomb(Float_t &);
415 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
416 Float_t &, Float_t & DEFCHARL);
417 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
419 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
420 const Float_t *x2, const Float_t *p2,
421 const Int_t &ipa, DEFCHARD DEFCHARL);
423 void type_of_call ertrgo();
427 // Geant3 global pointer
429 static Int_t defSize = 600;
433 //____________________________________________________________________________
437 // Default constructor
441 //____________________________________________________________________________
442 TGeant3::TGeant3(const char *title, Int_t nwgeant)
443 :AliMC("TGeant3",title)
446 // Standard constructor for TGeant3 with ZEBRA initialisation
457 // Load Address of Geant3 commons
460 // Zero number of particles
464 //____________________________________________________________________________
465 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
466 Float_t &radl, Float_t &absl) const
469 // Return the parameters of the current material during transport
473 dens = fGcmate->dens;
474 radl = fGcmate->radl;
475 absl = fGcmate->absl;
476 return 1; //this could be the number of elements in mixture
479 //____________________________________________________________________________
480 void TGeant3::DefaultRange()
483 // Set range of current drawing pad to 20x20 cm
489 higz->Range(0,0,20,20);
492 //____________________________________________________________________________
493 void TGeant3::InitHIGZ()
504 //____________________________________________________________________________
505 void TGeant3::LoadAddress()
508 // Assigns the address of the GEANT common blocks to the structures
509 // that allow their access from C++
512 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
513 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
514 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
515 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
516 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
517 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
518 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
519 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
520 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
521 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
522 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
523 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
524 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
525 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
526 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
527 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
528 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
529 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
530 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
531 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
534 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
535 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
536 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
537 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
539 // Variables for ZEBRA store
540 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
542 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
547 //_____________________________________________________________________________
548 void TGeant3::GeomIter()
551 // Geometry iterator for moving upward in the geometry tree
552 // Initialise the iterator
554 fNextVol=fGcvolu->nlevel;
557 //____________________________________________________________________________
558 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
561 // Geometry iterator for moving upward in the geometry tree
562 // Return next volume up
567 gname=fGcvolu->names[fNextVol];
568 strncpy(name,(char *) &gname, 4);
570 copy=fGcvolu->number[fNextVol];
571 i=fGcvolu->lvolum[fNextVol];
572 if(gname == fZiq[fGclink->jvolum+i]) return i;
573 else printf("GeomTree: Volume %s not found in bank\n",name);
578 //_____________________________________________________________________________
579 Int_t TGeant3::CurrentVolID(Int_t ©) const
582 // Returns the current volume ID and copy number
585 if( (i=fGcvolu->nlevel-1) < 0 ) {
586 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
588 gname=fGcvolu->names[i];
589 copy=fGcvolu->number[i];
590 i=fGcvolu->lvolum[i];
591 if(gname == fZiq[fGclink->jvolum+i]) return i;
592 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
597 //_____________________________________________________________________________
598 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
601 // Return the current volume "off" upward in the geometrical tree
602 // ID and copy number
605 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
606 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
607 off,fGcvolu->nlevel);
609 gname=fGcvolu->names[i];
610 copy=fGcvolu->number[i];
611 i=fGcvolu->lvolum[i];
612 if(gname == fZiq[fGclink->jvolum+i]) return i;
613 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
618 //_____________________________________________________________________________
619 const char* TGeant3::CurrentVolName() const
622 // Returns the current volume name
626 if( (i=fGcvolu->nlevel-1) < 0 ) {
627 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
629 gname=fGcvolu->names[i];
631 strncpy(name,(char *) &gname, 4);
633 i=fGcvolu->lvolum[i];
634 if(gname == fZiq[fGclink->jvolum+i]) return name;
635 else Warning("CurrentVolName","Volume %4s not found\n",name);
640 //_____________________________________________________________________________
641 const char* TGeant3::CurrentVolOffName(Int_t off) const
644 // Return the current volume "off" upward in the geometrical tree
645 // ID, name and copy number
646 // if name=0 no name is returned
650 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
651 Warning("CurrentVolOffName",
652 "Offset requested %d but stack depth %d\n",off,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("CurrentVolOffName","Volume %4s not found\n",name);
665 //_____________________________________________________________________________
666 Int_t TGeant3::IdFromPDG(Int_t pdg) const
669 // Return Geant3 code from PDG and pseudo ENDF code
671 for(Int_t i=0;i<fNPDGCodes;++i)
672 if(pdg==fPDGCode[i]) return i;
676 //_____________________________________________________________________________
677 Int_t TGeant3::PDGFromId(Int_t id) const
679 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
683 //_____________________________________________________________________________
684 void TGeant3::DefineParticles()
687 // Define standard Geant 3 particles
690 // Load standard numbers for GEANT particles and PDG conversion
691 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
692 fPDGCode[fNPDGCodes++]=22; // 1 = photon
693 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
694 fPDGCode[fNPDGCodes++]=11; // 3 = electron
695 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
696 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
697 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
698 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
699 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
700 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
701 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
702 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
703 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
704 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
705 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
706 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
707 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
708 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
709 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
710 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
711 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
712 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
713 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
714 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
715 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
716 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
717 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
718 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
719 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
720 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
721 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
722 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
723 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
730 /* --- Define additional particles */
731 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
732 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
734 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
735 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
737 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
738 fPDGCode[fNPDGCodes++]=411; // 35 = D+
740 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
741 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
743 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
744 fPDGCode[fNPDGCodes++]=421; // 37 = D0
746 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
747 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
749 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
751 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
753 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
755 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
756 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
758 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
759 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
761 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
762 fPDGCode[fNPDGCodes++]=113; // 37 = D0
765 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
767 // and numbers above 5 000 000 for special applications
770 const Int_t kion=10000000;
772 const Int_t kspe=50000000;
774 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
776 const Double_t autogev=0.9314943228;
777 const Double_t hslash = 1.0545726663e-27;
778 const Double_t erggev = 1/1.6021773349e-3;
779 const Double_t hshgev = hslash*erggev;
780 const Double_t yearstosec = 3600*24*365.25;
783 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
784 0,1,"Ion",kion+10020);
785 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
787 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
788 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
789 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
791 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
792 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
793 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
795 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
797 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
798 0,2,"Ion",kion+20030);
799 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
801 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
802 0,0,"Special",kspe+50);
803 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
805 /* --- Define additional decay modes --- */
806 /* --- omega(783) --- */
807 for (kz = 0; kz < 6; ++kz) {
818 Gsdk(ipa, bratio, mode);
819 /* --- phi(1020) --- */
820 for (kz = 0; kz < 6; ++kz) {
835 Gsdk(ipa, bratio, mode);
837 for (kz = 0; kz < 6; ++kz) {
850 Gsdk(ipa, bratio, mode);
852 for (kz = 0; kz < 6; ++kz) {
865 Gsdk(ipa, bratio, mode);
867 for (kz = 0; kz < 6; ++kz) {
878 Gsdk(ipa, bratio, mode);
879 /* --- Anti D0 --- */
880 for (kz = 0; kz < 6; ++kz) {
891 Gsdk(ipa, bratio, mode);
893 for (kz = 0; kz < 6; ++kz) {
900 Gsdk(ipa, bratio, mode);
902 for (kz = 0; kz < 6; ++kz) {
909 Gsdk(ipa, bratio, mode);
911 for (kz = 0; kz < 6; ++kz) {
918 Gsdk(ipa, bratio, mode);
921 for (kz = 0; kz < 6; ++kz) {
930 Gsdk(ipa, bratio, mode);
933 Gsdk(ipa, bratio, mode);
936 Gsdk(ipa, bratio, mode);
941 //_____________________________________________________________________________
942 Int_t TGeant3::VolId(Text_t *name) const
945 // Return the unique numeric identifier for volume name
948 strncpy((char *) &gname, name, 4);
949 for(i=1; i<=fGcnum->nvolum; i++)
950 if(gname == fZiq[fGclink->jvolum+i]) return i;
951 printf("VolId: Volume %s not found\n",name);
955 //_____________________________________________________________________________
956 Int_t TGeant3::NofVolumes() const
959 // Return total number of volumes in the geometry
961 return fGcnum->nvolum;
964 //_____________________________________________________________________________
965 const char* TGeant3::VolName(Int_t id) const
968 // Return the volume name given the volume identifier
971 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
974 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
979 //_____________________________________________________________________________
980 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
982 Int_t gpart = IdFromPDG(part);
983 if(!strcmp(reac,"PHOT"))
986 Error("Xsec","Can calculate photoelectric only for photons\n");
992 //_____________________________________________________________________________
993 void TGeant3::TrackPosition(TLorentzVector &xyz) const
996 // Return the current position in the master reference frame of the
997 // track being transported
999 xyz[0]=fGctrak->vect[0];
1000 xyz[1]=fGctrak->vect[1];
1001 xyz[2]=fGctrak->vect[2];
1002 xyz[3]=fGctrak->tofg;
1005 //_____________________________________________________________________________
1006 Float_t TGeant3::TrackTime() const
1009 // Return the current time of flight of the track being transported
1011 return fGctrak->tofg;
1014 //_____________________________________________________________________________
1015 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1018 // Return the direction and the momentum (GeV/c) of the track
1019 // currently being transported
1021 Double_t ptot=fGctrak->vect[6];
1022 xyz[0]=fGctrak->vect[3]*ptot;
1023 xyz[1]=fGctrak->vect[4]*ptot;
1024 xyz[2]=fGctrak->vect[5]*ptot;
1025 xyz[3]=fGctrak->getot;
1028 //_____________________________________________________________________________
1029 Float_t TGeant3::TrackCharge() const
1032 // Return charge of the track currently transported
1034 return fGckine->charge;
1037 //_____________________________________________________________________________
1038 Float_t TGeant3::TrackMass() const
1041 // Return the mass of the track currently transported
1043 return fGckine->amass;
1046 //_____________________________________________________________________________
1047 Int_t TGeant3::TrackPid() const
1050 // Return the id of the particle transported
1052 return PDGFromId(fGckine->ipart);
1055 //_____________________________________________________________________________
1056 Float_t TGeant3::TrackStep() const
1059 // Return the length in centimeters of the current step
1061 return fGctrak->step;
1064 //_____________________________________________________________________________
1065 Float_t TGeant3::TrackLength() const
1068 // Return the length of the current track from its origin
1070 return fGctrak->sleng;
1073 //_____________________________________________________________________________
1074 Bool_t TGeant3::IsTrackInside() const
1077 // True if the track is not at the boundary of the current volume
1079 return (fGctrak->inwvol==0);
1082 //_____________________________________________________________________________
1083 Bool_t TGeant3::IsTrackEntering() const
1086 // True if this is the first step of the track in the current volume
1088 return (fGctrak->inwvol==1);
1091 //_____________________________________________________________________________
1092 Bool_t TGeant3::IsTrackExiting() const
1095 // True if this is the last step of the track in the current volume
1097 return (fGctrak->inwvol==2);
1100 //_____________________________________________________________________________
1101 Bool_t TGeant3::IsTrackOut() const
1104 // True if the track is out of the setup
1106 return (fGctrak->inwvol==3);
1109 //_____________________________________________________________________________
1110 Bool_t TGeant3::IsTrackStop() const
1113 // True if the track energy has fallen below the threshold
1115 return (fGctrak->istop==2);
1118 //_____________________________________________________________________________
1119 Int_t TGeant3::NSecondaries() const
1122 // Number of secondary particles generated in the current step
1124 return fGcking->ngkine;
1127 //_____________________________________________________________________________
1128 Int_t TGeant3::CurrentEvent() const
1131 // Number of the current event
1133 return fGcflag->idevt;
1136 //_____________________________________________________________________________
1137 void TGeant3::ProdProcess(char* proc) const
1140 // Name of the process that has produced the secondary particles
1141 // in the current step
1143 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1146 if(fGcking->ngkine>0) {
1147 for (km = 0; km < fGctrak->nmec; ++km) {
1148 for (im = 0; im < 13; ++im) {
1149 if (fGctrak->lmec[km] == ipmec[im]) {
1150 mec = fGctrak->lmec[km];
1151 if (0 < mec && mec < 31) {
1152 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1153 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1154 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1161 strcpy(proc,"UNKN");
1162 } else strcpy(proc,"NONE");
1165 //_____________________________________________________________________________
1166 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p)
1169 // Get the parameters of the secondary track number isec produced
1170 // in the current step
1173 if(-1<isec && isec<fGcking->ngkine) {
1174 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1176 x[i]=fGckin3->gpos[isec][i];
1177 p[i]=fGcking->gkin[isec][i];
1179 x[3]=fGcking->tofd[isec];
1180 p[3]=fGcking->gkin[isec][3];
1182 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1183 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1188 //_____________________________________________________________________________
1189 void TGeant3::InitLego()
1192 SetDEBU(0,0,0); //do not print a message
1195 //_____________________________________________________________________________
1196 Bool_t TGeant3::IsTrackDisappeared() const
1199 // True if the current particle has disappered
1200 // either because it decayed or because it underwent
1201 // an inelastic collision
1203 return (fGctrak->istop==1);
1206 //_____________________________________________________________________________
1207 Bool_t TGeant3::IsTrackAlive() const
1210 // True if the current particle is alive and will continue to be
1213 return (fGctrak->istop==0);
1216 //_____________________________________________________________________________
1217 void TGeant3::StopTrack()
1220 // Stop the transport of the current particle and skip to the next
1225 //_____________________________________________________________________________
1226 void TGeant3::StopEvent()
1229 // Stop simulation of the current event and skip to the next
1234 //_____________________________________________________________________________
1235 Float_t TGeant3::MaxStep() const
1238 // Return the maximum step length in the current medium
1240 return fGctmed->stemax;
1243 //_____________________________________________________________________________
1244 void TGeant3::SetColors()
1247 // Set the colors for all the volumes
1248 // this is done sequentially for all volumes
1249 // based on the number of their medium
1252 Int_t jvolum=fGclink->jvolum;
1253 //Int_t jtmed=fGclink->jtmed;
1254 //Int_t jmate=fGclink->jmate;
1255 Int_t nvolum=fGcnum->nvolum;
1258 // Now for all the volumes
1259 for(kv=1;kv<=nvolum;kv++) {
1260 // Get the tracking medium
1261 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1263 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1265 //Float_t z=fZq[fZlq[jmate-ima]+7];
1266 // Find color number
1267 //icol = Int_t(z)%6+2;
1268 //icol = 17+Int_t(z*150./92.);
1271 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1273 Gsatt(name,"COLO",icol);
1277 //_____________________________________________________________________________
1278 void TGeant3::SetMaxStep(Float_t maxstep)
1281 // Set the maximum step allowed till the particle is in the current medium
1283 fGctmed->stemax=maxstep;
1286 //_____________________________________________________________________________
1287 void TGeant3::SetMaxNStep(Int_t maxnstp)
1290 // Set the maximum number of steps till the particle is in the current medium
1292 fGctrak->maxnst=maxnstp;
1295 //_____________________________________________________________________________
1296 Int_t TGeant3::GetMaxNStep() const
1299 // Maximum number of steps allowed in current medium
1301 return fGctrak->maxnst;
1304 //_____________________________________________________________________________
1305 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1306 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1310 // Defines a Material
1312 // kmat number assigned to the material
1313 // name material name
1314 // a atomic mass in au
1316 // dens density in g/cm3
1317 // absl absorbtion length in cm
1318 // if >=0 it is ignored and the program
1319 // calculates it, if <0. -absl is taken
1320 // radl radiation length in cm
1321 // if >=0 it is ignored and the program
1322 // calculates it, if <0. -radl is taken
1323 // buf pointer to an array of user words
1324 // nbuf number of user words
1326 Int_t jmate=fGclink->jmate;
1332 for(i=1; i<=ns; i++) {
1333 if(fZlq[jmate-i]==0) {
1339 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1340 nwbuf PASSCHARL(name));
1343 //_____________________________________________________________________________
1344 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1345 Float_t dens, Int_t nlmat, Float_t* wmat)
1348 // Defines mixture OR COMPOUND IMAT as composed by
1349 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1351 // If NLMAT > 0 then wmat contains the proportion by
1352 // weights of each basic material in the mixture.
1354 // If nlmat < 0 then WMAT contains the number of atoms
1355 // of a given kind into the molecule of the COMPOUND
1356 // In this case, WMAT in output is changed to relative
1359 Int_t jmate=fGclink->jmate;
1365 for(i=1; i<=ns; i++) {
1366 if(fZlq[jmate-i]==0) {
1372 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1375 //_____________________________________________________________________________
1376 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1377 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1378 Float_t stemax, Float_t deemax, Float_t epsil,
1379 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1382 // kmed tracking medium number assigned
1383 // name tracking medium name
1384 // nmat material number
1385 // isvol sensitive volume flag
1386 // ifield magnetic field
1387 // fieldm max. field value (kilogauss)
1388 // tmaxfd max. angle due to field (deg/step)
1389 // stemax max. step allowed
1390 // deemax max. fraction of energy lost in a step
1391 // epsil tracking precision (cm)
1392 // stmin min. step due to continuos processes (cm)
1394 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1395 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1396 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1398 Int_t jtmed=fGclink->jtmed;
1404 for(i=1; i<=ns; i++) {
1405 if(fZlq[jtmed-i]==0) {
1411 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1412 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1415 //_____________________________________________________________________________
1416 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1417 Float_t phiy, Float_t thez, Float_t phiz)
1420 // krot rotation matrix number assigned
1421 // theta1 polar angle for axis i
1422 // phi1 azimuthal angle for axis i
1423 // theta2 polar angle for axis ii
1424 // phi2 azimuthal angle for axis ii
1425 // theta3 polar angle for axis iii
1426 // phi3 azimuthal angle for axis iii
1428 // it defines the rotation matrix number irot.
1430 Int_t jrotm=fGclink->jrotm;
1436 for(i=1; i<=ns; i++) {
1437 if(fZlq[jrotm-i]==0) {
1443 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1446 //_____________________________________________________________________________
1447 Int_t TGeant3::GetMedium() const
1450 // Return the number of the current medium
1452 return fGctmed->numed;
1455 //_____________________________________________________________________________
1456 Float_t TGeant3::Edep() const
1459 // Return the energy lost in the current step
1461 return fGctrak->destep;
1464 //_____________________________________________________________________________
1465 Float_t TGeant3::Etot() const
1468 // Return the total energy of the current track
1470 return fGctrak->getot;
1473 //_____________________________________________________________________________
1474 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1477 // Return an array of n random numbers uniformly distributed
1478 // between 0 and 1 not included
1483 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1485 // Functions from GBASE
1487 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1489 //____________________________________________________________________________
1490 void TGeant3::Gfile(const char *filename, const char *option)
1493 // Routine to open a GEANT/RZ data base.
1495 // LUN logical unit number associated to the file
1497 // CHFILE RZ file name
1499 // CHOPT is a character string which may be
1500 // N To create a new file
1501 // U to open an existing file for update
1502 // " " to open an existing file for read only
1503 // Q The initial allocation (default 1000 records)
1504 // is given in IQUEST(10)
1505 // X Open the file in exchange format
1506 // I Read all data structures from file to memory
1507 // O Write all data structures from memory to file
1510 // If options "I" or "O" all data structures are read or
1511 // written from/to file and the file is closed.
1512 // See routine GRMDIR to create subdirectories
1513 // See routines GROUT,GRIN to write,read objects
1515 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1519 //____________________________________________________________________________
1520 void TGeant3::Gpcxyz()
1523 // Print track and volume parameters at current point
1528 //_____________________________________________________________________________
1529 void TGeant3::Ggclos()
1532 // Closes off the geometry setting.
1533 // Initializes the search list for the contents of each
1534 // volume following the order they have been positioned, and
1535 // inserting the content '0' when a call to GSNEXT (-1) has
1536 // been required by the user.
1537 // Performs the development of the JVOLUM structure for all
1538 // volumes with variable parameters, by calling GGDVLP.
1539 // Interprets the user calls to GSORD, through GGORD.
1540 // Computes and stores in a bank (next to JVOLUM mother bank)
1541 // the number of levels in the geometrical tree and the
1542 // maximum number of contents per level, by calling GGNLEV.
1543 // Sets status bit for CONCAVE volumes, through GGCAVE.
1544 // Completes the JSET structure with the list of volume names
1545 // which identify uniquely a given physical detector, the
1546 // list of bit numbers to pack the corresponding volume copy
1547 // numbers, and the generic path(s) in the JVOLUM tree,
1548 // through the routine GHCLOS.
1553 //_____________________________________________________________________________
1554 void TGeant3::Glast()
1557 // Finish a Geant run
1562 //_____________________________________________________________________________
1563 void TGeant3::Gprint(const char *name)
1566 // Routine to print data structures
1567 // CHNAME name of a data structure
1571 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1574 //_____________________________________________________________________________
1575 void TGeant3::Grun()
1578 // Steering function to process one run
1583 //_____________________________________________________________________________
1584 void TGeant3::Gtrig()
1587 // Steering function to process one event
1592 //_____________________________________________________________________________
1593 void TGeant3::Gtrigc()
1596 // Clear event partition
1601 //_____________________________________________________________________________
1602 void TGeant3::Gtrigi()
1605 // Initialises event partition
1610 //_____________________________________________________________________________
1611 void TGeant3::Gwork(Int_t nwork)
1614 // Allocates workspace in ZEBRA memory
1619 //_____________________________________________________________________________
1620 void TGeant3::Gzinit()
1623 // To initialise GEANT/ZEBRA data structures
1628 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1630 // Functions from GCONS
1632 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1634 //_____________________________________________________________________________
1635 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1636 Float_t &dens, Float_t &radl, Float_t &absl,
1637 Float_t* ubuf, Int_t& nbuf)
1640 // Return parameters for material IMAT
1642 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1646 //_____________________________________________________________________________
1647 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1648 Float_t &amass, Float_t &charge, Float_t &tlife)
1651 // Return parameters for particle of type IPART
1655 Int_t igpart = IdFromPDG(ipart);
1656 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1660 //_____________________________________________________________________________
1661 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1662 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1663 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1664 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1667 // Return parameters for tracking medium NUMED
1669 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1670 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1673 //_____________________________________________________________________________
1674 void TGeant3::Gmate()
1677 // Define standard GEANT materials
1682 //_____________________________________________________________________________
1683 void TGeant3::Gpart()
1686 // Define standard GEANT particles plus selected decay modes
1687 // and branching ratios.
1692 //_____________________________________________________________________________
1693 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1695 // Defines branching ratios and decay modes for standard
1697 gsdk(ipart,bratio,mode);
1700 //_____________________________________________________________________________
1701 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1702 Float_t dens, Float_t radl, Float_t absl)
1705 // Defines a Material
1707 // kmat number assigned to the material
1708 // name material name
1709 // a atomic mass in au
1711 // dens density in g/cm3
1712 // absl absorbtion length in cm
1713 // if >=0 it is ignored and the program
1714 // calculates it, if <0. -absl is taken
1715 // radl radiation length in cm
1716 // if >=0 it is ignored and the program
1717 // calculates it, if <0. -radl is taken
1718 // buf pointer to an array of user words
1719 // nbuf number of user words
1723 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1727 //_____________________________________________________________________________
1728 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1729 Float_t dens, Int_t nlmat, Float_t *wmat)
1732 // Defines mixture OR COMPOUND IMAT as composed by
1733 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1735 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1736 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1738 // If NLMAT.LT.0 then WMAT contains the number of atoms
1739 // of a given kind into the molecule of the COMPOUND
1740 // In this case, WMAT in output is changed to relative
1743 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1746 //_____________________________________________________________________________
1747 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1748 Float_t amass, Float_t charge, Float_t tlife)
1751 // Store particle parameters
1753 // ipart particle code
1754 // name particle name
1755 // itrtyp transport method (see GEANT manual)
1756 // amass mass in GeV/c2
1757 // charge charge in electron units
1758 // tlife lifetime in seconds
1762 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1766 //_____________________________________________________________________________
1767 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1768 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1769 Float_t stemax, Float_t deemax, Float_t epsil,
1773 // NTMED Tracking medium number
1774 // NAME Tracking medium name
1775 // NMAT Material number
1776 // ISVOL Sensitive volume flag
1777 // IFIELD Magnetic field
1778 // FIELDM Max. field value (Kilogauss)
1779 // TMAXFD Max. angle due to field (deg/step)
1780 // STEMAX Max. step allowed
1781 // DEEMAX Max. fraction of energy lost in a step
1782 // EPSIL Tracking precision (cm)
1783 // STMIN Min. step due to continuos processes (cm)
1785 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1786 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1787 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1791 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1792 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1795 //_____________________________________________________________________________
1796 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1797 Float_t *absco, Float_t *effic, Float_t *rindex)
1800 // Stores the tables for UV photon tracking in medium ITMED
1801 // Please note that it is the user's responsability to
1802 // provide all the coefficients:
1805 // ITMED Tracking medium number
1806 // NPCKOV Number of bins of each table
1807 // PPCKOV Value of photon momentum (in GeV)
1808 // ABSCO Absorbtion coefficients
1809 // dielectric: absorbtion length in cm
1810 // metals : absorbtion fraction (0<=x<=1)
1811 // EFFIC Detection efficiency for UV photons
1812 // RINDEX Refraction index (if=0 metal)
1814 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1817 //_____________________________________________________________________________
1818 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1821 // To change the value of cut or mechanism "CHPAR"
1822 // to a new value PARVAL for tracking medium ITMED
1823 // The data structure JTMED contains the standard tracking
1824 // parameters (CUTS and flags to control the physics processes) which
1825 // are used by default for all tracking media. It is possible to
1826 // redefine individually with GSTPAR any of these parameters for a
1827 // given tracking medium.
1828 // ITMED tracking medium number
1829 // CHPAR is a character string (variable name)
1830 // PARVAL must be given as a floating point.
1832 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1835 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1837 // Functions from GCONS
1839 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1841 //_____________________________________________________________________________
1842 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1845 // Storing/Retrieving Vertex and Track parameters
1846 // ----------------------------------------------
1848 // Stores vertex parameters.
1849 // VERT array of (x,y,z) position of the vertex
1850 // NTBEAM beam track number origin of the vertex
1851 // =0 if none exists
1852 // NTTARG target track number origin of the vertex
1853 // UBUF user array of NUBUF floating point numbers
1855 // NVTX new vertex number (=0 in case of error).
1856 // Prints vertex parameters.
1857 // IVTX for vertex IVTX.
1858 // (For all vertices if IVTX=0)
1859 // Stores long life track parameters.
1860 // PLAB components of momentum
1861 // IPART type of particle (see GSPART)
1862 // NV vertex number origin of track
1863 // UBUF array of NUBUF floating point user parameters
1865 // NT track number (if=0 error).
1866 // Retrieves long life track parameters.
1867 // ITRA track number for which parameters are requested
1868 // VERT vector origin of the track
1869 // PVERT 4 momentum components at the track origin
1870 // IPART particle type (=0 if track ITRA does not exist)
1871 // NVERT vertex number origin of the track
1872 // UBUF user words stored in GSKINE.
1873 // Prints initial track parameters.
1874 // ITRA for track ITRA
1875 // (For all tracks if ITRA=0)
1879 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1882 //_____________________________________________________________________________
1883 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1887 // Retrieves the parameter of a vertex bank
1888 // Vertex is generated from tracks NTBEAM NTTARG
1889 // NVTX is the new vertex number
1893 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1896 //_____________________________________________________________________________
1897 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1901 // Store kinematics of track NT into data structure
1902 // Track is coming from vertex NV
1905 gskine(plab, ipart, nv, buf, nwbuf, nt);
1909 //_____________________________________________________________________________
1910 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1914 // Creates a new vertex bank
1915 // Vertex is generated from tracks NTBEAM NTTARG
1916 // NVTX is the new vertex number
1919 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1923 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1925 // Functions from GPHYS
1927 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1929 //_____________________________________________________________________________
1930 void TGeant3::Gphysi()
1933 // Initialise material constants for all the physics
1934 // mechanisms used by GEANT
1939 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1941 // Functions from GTRAK
1943 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1945 //_____________________________________________________________________________
1946 void TGeant3::Gdebug()
1949 // Debug the current step
1954 //_____________________________________________________________________________
1955 void TGeant3::Gekbin()
1958 // To find bin number in kinetic energy table
1959 // stored in ELOW(NEKBIN)
1964 //_____________________________________________________________________________
1965 void TGeant3::Gfinds()
1968 // Returns the set/volume parameters corresponding to
1969 // the current space point in /GCTRAK/
1970 // and fill common /GCSETS/
1972 // IHSET user set identifier
1973 // IHDET user detector identifier
1974 // ISET set number in JSET
1975 // IDET detector number in JS=LQ(JSET-ISET)
1976 // IDTYPE detector type (1,2)
1977 // NUMBV detector volume numbers (array of length NVNAME)
1978 // NVNAME number of volume levels
1983 //_____________________________________________________________________________
1984 void TGeant3::Gsking(Int_t igk)
1987 // Stores in stack JSTAK either the IGKth track of /GCKING/,
1988 // or the NGKINE tracks when IGK is 0.
1993 //_____________________________________________________________________________
1994 void TGeant3::Gskpho(Int_t igk)
1997 // Stores in stack JSTAK either the IGKth Cherenkov photon of
1998 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2003 //_____________________________________________________________________________
2004 void TGeant3::Gsstak(Int_t iflag)
2007 // Stores in auxiliary stack JSTAK the particle currently
2008 // described in common /GCKINE/.
2010 // On request, creates also an entry in structure JKINE :
2012 // 0 : No entry in JKINE structure required (user)
2013 // 1 : New entry in JVERTX / JKINE structures required (user)
2014 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2015 // 2 : Entry in JKINE structure exists already (from GTREVE)
2020 //_____________________________________________________________________________
2021 void TGeant3::Gsxyz()
2024 // Store space point VECT in banks JXYZ
2029 //_____________________________________________________________________________
2030 void TGeant3::Gtrack()
2033 // Controls tracking of current particle
2038 //_____________________________________________________________________________
2039 void TGeant3::Gtreve()
2042 // Controls tracking of all particles belonging to the current event
2047 //_____________________________________________________________________________
2048 void TGeant3::Gtreve_root()
2051 // Controls tracking of all particles belonging to the current event
2056 //_____________________________________________________________________________
2057 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2060 // To generate a vector RVECV of LEN random numbers
2061 // Copy of the CERN Library routine RANECU
2065 //_____________________________________________________________________________
2066 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2067 const Text_t *chopt)
2070 // To set/retrieve the seed of the random number generator
2072 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2075 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2077 // Functions from GDRAW
2079 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2081 //_____________________________________________________________________________
2082 void TGeant3::Gdxyz(Int_t it)
2085 // Draw the points stored with Gsxyz relative to track it
2090 //_____________________________________________________________________________
2091 void TGeant3::Gdcxyz()
2094 // Draw the position of the current track
2099 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2101 // Functions from GGEOM
2103 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2105 //_____________________________________________________________________________
2106 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2109 // Computes coordinates XM (Master Reference System
2110 // knowing the coordinates XD (Detector Ref System)
2111 // The local reference system can be initialized by
2112 // - the tracking routines and GDTOM used in GUSTEP
2113 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2114 // (inverse routine is GMTOD)
2116 // If IFLAG=1 convert coordinates
2117 // IFLAG=2 convert direction cosinus
2119 gdtom(xd, xm, iflag);
2122 //_____________________________________________________________________________
2123 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2127 // Loads the top part of the Volume tree in LVOLS (IVO's),
2128 // LINDX (IN indices) for a given volume defined through
2129 // its name IUDET and number IUNUM.
2131 // The routine stores only upto the last level where JVOLUM
2132 // data structure is developed. If there is no development
2133 // above the current level, it returns NLEV zero.
2135 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2138 //_____________________________________________________________________________
2139 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2142 // Finds in which volume/medium the point X is, and updates the
2143 // common /GCVOLU/ and the structure JGPAR accordingly.
2145 // NUMED returns the tracking medium number, or 0 if point is
2146 // outside the experimental setup.
2151 //_____________________________________________________________________________
2152 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2155 // Computes coordinates XD (in DRS)
2156 // from known coordinates XM in MRS
2157 // The local reference system can be initialized by
2158 // - the tracking routines and GMTOD used in GUSTEP
2159 // - a call to GMEDIA(XM,NUMED)
2160 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2161 // (inverse routine is GDTOM)
2163 // If IFLAG=1 convert coordinates
2164 // IFLAG=2 convert direction cosinus
2166 gmtod(xm, xd, iflag);
2169 //_____________________________________________________________________________
2170 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2174 // Create a new volume by dividing an existing one
2177 // MOTHER Mother volume name
2178 // NDIV Number of divisions
2181 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2182 // It divides a previously defined volume.
2187 Vname(mother,vmother);
2188 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2189 PASSCHARL(vmother));
2192 //_____________________________________________________________________________
2193 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2194 Int_t iaxis, Float_t c0i, Int_t numed)
2197 // Create a new volume by dividing an existing one
2199 // Divides mother into ndiv divisions called name
2200 // along axis iaxis starting at coordinate value c0.
2201 // the new volume created will be medium number numed.
2206 Vname(mother,vmother);
2207 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2208 PASSCHARL(vname) PASSCHARL(vmother));
2211 //_____________________________________________________________________________
2212 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2213 Int_t iaxis, Int_t numed)
2216 // Create a new volume by dividing an existing one
2221 Vname(mother,vmother);
2222 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2223 PASSCHARL(vname) PASSCHARL(vmother));
2226 //_____________________________________________________________________________
2227 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2228 Int_t iaxis, Float_t c0, Int_t numed)
2231 // Create a new volume by dividing an existing one
2236 Vname(mother,vmother);
2237 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2238 PASSCHARL(vname) PASSCHARL(vmother));
2241 //_____________________________________________________________________________
2242 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2243 Int_t iaxis, Int_t numed, Int_t ndvmx)
2246 // Create a new volume by dividing an existing one
2248 // Divides MOTHER into divisions called NAME along
2249 // axis IAXIS in steps of STEP. If not exactly divisible
2250 // will make as many as possible and will centre them
2251 // with respect to the mother. Divisions will have medium
2252 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2253 // NDVMX is the expected maximum number of divisions
2254 // (If 0, no protection tests are performed)
2259 Vname(mother,vmother);
2260 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2261 PASSCHARL(vname) PASSCHARL(vmother));
2264 //_____________________________________________________________________________
2265 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2266 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2269 // Create a new volume by dividing an existing one
2271 // Divides MOTHER into divisions called NAME along
2272 // axis IAXIS starting at coordinate value C0 with step
2274 // The new volume created will have medium number NUMED.
2275 // If NUMED is 0, NUMED of mother is taken.
2276 // NDVMX is the expected maximum number of divisions
2277 // (If 0, no protection tests are performed)
2282 Vname(mother,vmother);
2283 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2284 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2287 //_____________________________________________________________________________
2288 void TGeant3::Gsord(const char *name, Int_t iax)
2291 // Flags volume CHNAME whose contents will have to be ordered
2292 // along axis IAX, by setting the search flag to -IAX
2296 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2297 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2298 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2299 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2300 // IAX = 6 PHI (PHI=0 => X axis)
2301 // IAX = 7 THETA (THETA=0 => Z axis)
2305 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2308 //_____________________________________________________________________________
2309 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2310 Float_t y, Float_t z, Int_t irot, const char *konly)
2313 // Position a volume into an existing one
2316 // NUMBER Copy number of the volume
2317 // MOTHER Mother volume name
2318 // X X coord. of the volume in mother ref. sys.
2319 // Y Y coord. of the volume in mother ref. sys.
2320 // Z Z coord. of the volume in mother ref. sys.
2321 // IROT Rotation matrix number w.r.t. mother ref. sys.
2322 // ONLY ONLY/MANY flag
2324 // It positions a previously defined volume in the mother.
2329 Vname(mother,vmother);
2330 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2331 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2335 //_____________________________________________________________________________
2336 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2337 Float_t x, Float_t y, Float_t z, Int_t irot,
2338 const char *konly, Float_t *upar, Int_t np )
2341 // Place a copy of generic volume NAME with user number
2342 // NR inside MOTHER, with its parameters UPAR(1..NP)
2347 Vname(mother,vmother);
2348 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2349 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2353 //_____________________________________________________________________________
2354 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2355 Float_t phi2, Float_t theta3, Float_t phi3)
2358 // nmat Rotation matrix number
2359 // THETA1 Polar angle for axis I
2360 // PHI1 Azimuthal angle for axis I
2361 // THETA2 Polar angle for axis II
2362 // PHI2 Azimuthal angle for axis II
2363 // THETA3 Polar angle for axis III
2364 // PHI3 Azimuthal angle for axis III
2366 // It defines the rotation matrix number IROT.
2368 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2371 //_____________________________________________________________________________
2372 void TGeant3::Gprotm(Int_t nmat)
2375 // To print rotation matrices structure JROTM
2376 // nmat Rotation matrix number
2381 //_____________________________________________________________________________
2382 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2383 Float_t *upar, Int_t npar)
2387 // SHAPE Volume type
2388 // NUMED Tracking medium number
2389 // NPAR Number of shape parameters
2390 // UPAR Vector containing shape parameters
2392 // It creates a new volume in the JVOLUM data structure.
2398 Vname(shape,vshape);
2399 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2400 PASSCHARL(vname) PASSCHARL(vshape));
2404 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2406 // T H E D R A W I N G P A C K A G E
2407 // ======================================
2408 // Drawing functions. These functions allow the visualization in several ways
2409 // of the volumes defined in the geometrical data structure. It is possible
2410 // to draw the logical tree of volumes belonging to the detector (DTREE),
2411 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2412 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2413 // these commands when the hidden line removal option is activated; in
2414 // this case, the volumes can be also either translated in the space
2415 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2416 // possible to fill the surfaces of the volumes
2417 // with solid colours when the shading option (SHAD) is activated.
2418 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2419 // of the detectors or to scan physical events as well.
2420 // Finally, the command MOVE will allow the rotation, translation and zooming
2421 // on real time parts of the detectors or tracks and hits of a simulated event.
2422 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2423 // the drawing is performed by the Geant ray-tracing;
2424 // automatically, the color is assigned according to the tracking medium of each
2425 // volume and the volumes with a density lower/equal than the air are considered
2426 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2427 // the user can set color and visibility for the desired volumes via the command
2428 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2429 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2430 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2431 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2432 // first case, we assume that the first mother volume of the tree is a box with
2433 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2434 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2435 // second case, the distance between the observer and the origin of the world
2436 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2437 // or telescopic effects can be achieved changing the scale factors in the command
2438 // (DRAW). When the final picture does not occupy the full window,
2439 // mapping the space before tracing can speed up the drawing, but can also
2440 // produce less precise results; values from 1 to 4 are allowed in the command
2441 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2442 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2443 // The command (VALCUT) allows the cutting of the detector by three planes
2444 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2445 // SATT for any desired volume and can assume values from 0 to 7; it determines
2446 // the different light processing to be performed for different materials:
2447 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2448 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2449 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2450 // is 0.9) and the observer is assumed to have a light source (therefore he will
2451 // produce parallel light in the case of parallel view and point-like-source
2452 // light in the case of perspective view).
2454 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2456 //_____________________________________________________________________________
2457 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2461 // IOPT Name of the attribute to be set
2462 // IVAL Value to which the attribute is to be set
2464 // name= "*" stands for all the volumes.
2465 // iopt can be chosen among the following :
2467 // WORK 0=volume name is inactive for the tracking
2468 // 1=volume name is active for the tracking (default)
2470 // SEEN 0=volume name is invisible
2471 // 1=volume name is visible (default)
2472 // -1=volume invisible with all its descendants in the tree
2473 // -2=volume visible but not its descendants in the tree
2475 // LSTY line style 1,2,3,... (default=1)
2476 // LSTY=7 will produce a very precise approximation for
2477 // revolution bodies.
2479 // LWID line width -7,...,1,2,3,..7 (default=1)
2480 // LWID<0 will act as abs(LWID) was set for the volume
2481 // and for all the levels below it. When SHAD is 'ON', LWID
2482 // represent the linewidth of the scan lines filling the surfaces
2483 // (whereas the FILL value represent their number). Therefore
2484 // tuning this parameter will help to obtain the desired
2485 // quality/performance ratio.
2487 // COLO colour code -166,...,1,2,..166 (default=1)
2489 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2490 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2491 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2492 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2493 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2494 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2495 // colour=n*10+m, m=1,2,...9, will produce the same colour
2496 // as 'n', but with increasing luminosity according to 'm';
2497 // COLO<0 will act as if abs(COLO) was set for the volume
2498 // and for all the levels below it.
2499 // When for a volume the attribute FILL is > 1 (and the
2500 // option SHAD is on), the ABS of its colour code must be < 8
2501 // because an automatic shading of its faces will be
2504 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2505 // when option SHAD is "on" the FILL attribute of any
2506 // volume can be set different from 0 (normal drawing);
2507 // if it is set to 1, the faces of such volume will be filled
2508 // with solid colours; if ABS(FILL) is > 1, then a light
2509 // source is placed along the observer line, and the faces of
2510 // such volumes will be painted by colours whose luminosity
2511 // will depend on the amount of light reflected;
2512 // if ABS(FILL) = 1, then it is possible to use all the 166
2513 // colours of the colour table, becouse the automatic shading
2514 // is not performed;
2515 // for increasing values of FILL the drawing will be performed
2516 // with higher and higher resolution improving the quality (the
2517 // number of scan lines used to fill the faces increases with FILL);
2518 // it is possible to set different values of FILL
2519 // for different volumes, in order to optimize at the same time
2520 // the performance and the quality of the picture;
2521 // FILL<0 will act as if abs(FILL) was set for the volume
2522 // and for all the levels below it.
2523 // This kind of drawing can be saved in 'picture files'
2524 // or in view banks.
2525 // 0=drawing without fill area
2526 // 1=faces filled with solid colours and resolution = 6
2527 // 2=lowest resolution (very fast)
2528 // 3=default resolution
2529 // 4=.................
2530 // 5=.................
2531 // 6=.................
2533 // Finally, if a coloured background is desired, the FILL
2534 // attribute for the first volume of the tree must be set
2535 // equal to -abs(colo), colo being >0 and <166.
2537 // SET set number associated to volume name
2538 // DET detector number associated to volume name
2539 // DTYP detector type (1,2)
2546 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2550 //_____________________________________________________________________________
2551 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2552 Int_t& natt, Float_t* par, Float_t* att)
2555 // Find the parameters of a volume
2557 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2561 //_____________________________________________________________________________
2562 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2565 // Check the parameters of a shape
2567 gckpar(ish,npar,par);
2570 //_____________________________________________________________________________
2571 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2574 // Check the parameters of a tracking medium
2576 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2579 //_____________________________________________________________________________
2580 void TGeant3::Gdelete(Int_t iview)
2583 // IVIEW View number
2585 // It deletes a view bank from memory.
2590 //_____________________________________________________________________________
2591 void TGeant3::Gdopen(Int_t iview)
2594 // IVIEW View number
2596 // When a drawing is very complex and requires a long time to be
2597 // executed, it can be useful to store it in a view bank: after a
2598 // call to DOPEN and the execution of the drawing (nothing will
2599 // appear on the screen), and after a necessary call to DCLOSE,
2600 // the contents of the bank can be displayed in a very fast way
2601 // through a call to DSHOW; therefore, the detector can be easily
2602 // zoomed many times in different ways. Please note that the pictures
2603 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2610 //_____________________________________________________________________________
2611 void TGeant3::Gdclose()
2614 // It closes the currently open view bank; it must be called after the
2615 // end of the drawing to be stored.
2620 //_____________________________________________________________________________
2621 void TGeant3::Gdshow(Int_t iview)
2624 // IVIEW View number
2626 // It shows on the screen the contents of a view bank. It
2627 // can be called after a view bank has been closed.
2632 //_____________________________________________________________________________
2633 void TGeant3::Gdopt(const char *name,const char *value)
2637 // VALUE Option value
2639 // To set/modify the drawing options.
2642 // THRZ ON Draw tracks in R vs Z
2643 // OFF (D) Draw tracks in X,Y,Z
2646 // PROJ PARA (D) Parallel projection
2648 // TRAK LINE (D) Trajectory drawn with lines
2649 // POIN " " with markers
2650 // HIDE ON Hidden line removal using the CG package
2651 // OFF (D) No hidden line removal
2652 // SHAD ON Fill area and shading of surfaces.
2653 // OFF (D) Normal hidden line removal.
2654 // RAYT ON Ray-tracing on.
2655 // OFF (D) Ray-tracing off.
2656 // EDGE OFF Does not draw contours when shad is on.
2657 // ON (D) Normal shading.
2658 // MAPP 1,2,3,4 Mapping before ray-tracing.
2659 // 0 (D) No mapping.
2660 // USER ON User graphics options in the raytracing.
2661 // OFF (D) Automatic graphics options.
2667 Vname(value,vvalue);
2668 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2672 //_____________________________________________________________________________
2673 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2674 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2679 // THETA Viewing angle theta (for 3D projection)
2680 // PHI Viewing angle phi (for 3D projection)
2681 // PSI Viewing angle psi (for 2D rotation)
2682 // U0 U-coord. (horizontal) of volume origin
2683 // V0 V-coord. (vertical) of volume origin
2684 // SU Scale factor for U-coord.
2685 // SV Scale factor for V-coord.
2687 // This function will draw the volumes,
2688 // selected with their graphical attributes, set by the Gsatt
2689 // facility. The drawing may be performed with hidden line removal
2690 // and with shading effects according to the value of the options HIDE
2691 // and SHAD; if the option SHAD is ON, the contour's edges can be
2692 // drawn or not. If the option HIDE is ON, the detector can be
2693 // exploded (BOMB), clipped with different shapes (CVOL), and some
2694 // of its parts can be shifted from their original
2695 // position (SHIFT). When HIDE is ON, if
2696 // the drawing requires more than the available memory, the program
2697 // will evaluate and display the number of missing words
2698 // (so that the user can increase the
2699 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2700 // the program will print messages about the memory used and
2701 // statistics on the volumes' visibility.
2702 // The following commands will produce the drawing of a green
2703 // volume, specified by NAME, without using the hidden line removal
2704 // technique, using the hidden line removal technique,
2705 // with different linewidth and colour (red), with
2706 // solid colour, with shading of surfaces, and without edges.
2707 // Finally, some examples are given for the ray-tracing. (A possible
2708 // string for the NAME of the volume can be found using the command DTREE).
2714 if (fGcvdma->raytra != 1) {
2715 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2717 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2721 //_____________________________________________________________________________
2722 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2723 Float_t v0,Float_t ul,Float_t vl)
2728 // CUTVAL Cut plane distance from the origin along the axis
2730 // U0 U-coord. (horizontal) of volume origin
2731 // V0 V-coord. (vertical) of volume origin
2732 // SU Scale factor for U-coord.
2733 // SV Scale factor for V-coord.
2735 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2736 // and placed at the distance cutval from the origin.
2737 // The resulting picture is seen from the the same axis.
2738 // When HIDE Mode is ON, it is possible to get the same effect with
2739 // the CVOL/BOX function.
2745 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2748 //_____________________________________________________________________________
2749 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2750 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2751 Float_t v0,Float_t ul,Float_t vl)
2755 // CUTTHE Theta angle of the line normal to cut plane
2756 // CUTPHI Phi angle of the line normal to cut plane
2757 // CUTVAL Cut plane distance from the origin along the axis
2759 // THETA Viewing angle theta (for 3D projection)
2760 // PHI Viewing angle phi (for 3D projection)
2761 // U0 U-coord. (horizontal) of volume origin
2762 // V0 V-coord. (vertical) of volume origin
2763 // SU Scale factor for U-coord.
2764 // SV Scale factor for V-coord.
2766 // The cut plane is normal to the line given by the cut angles
2767 // cutthe and cutphi and placed at the distance cutval from the origin.
2768 // The resulting picture is seen from the viewing angles theta,phi.
2774 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2778 //_____________________________________________________________________________
2779 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2784 // ISEL Option flag D=111110
2786 // CHRSIZ Character size (cm) of title NAME D=0.6
2789 // 0 to have only the header lines
2790 // xxxxx1 to add the text name centered on top of header
2791 // xxxx1x to add global detector name (first volume) on left
2792 // xxx1xx to add date on right
2793 // xx1xxx to select thick characters for text on top of header
2794 // x1xxxx to add the text 'EVENT NR x' on top of header
2795 // 1xxxxx to add the text 'RUN NR x' on top of header
2796 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2797 // i.e. they generate overwritten text.
2799 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2802 //_____________________________________________________________________________
2803 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2806 // Draw a 2D-man at position (U0,V0)
2808 // U U-coord. (horizontal) of the centre of man' R
2809 // V V-coord. (vertical) of the centre of man' R
2810 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2812 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2813 // It superimposes the picure of a man or of a woman, chosen among
2814 // three different ones, with the same scale factors as the detector
2815 // in the current drawing.
2818 if (opt.Contains("WM1")) {
2820 } else if (opt.Contains("WM3")) {
2822 } else if (opt.Contains("WM2")) {
2829 //_____________________________________________________________________________
2830 void TGeant3::Gdspec(const char *name)
2835 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2836 // its geometrical specifications. The 3D drawing will
2837 // be performed according the current values of the options HIDE and
2838 // SHAD and according the current SetClipBox clipping parameters for that
2845 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2848 //_____________________________________________________________________________
2849 void TGeant3::DrawOneSpec(const char *name)
2852 // Function called when one double-clicks on a volume name
2853 // in a TPavelabel drawn by Gdtree.
2855 THIGZ *higzSave = higz;
2856 higzSave->SetName("higzSave");
2857 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2858 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2859 if (higzSpec) higz = higzSpec;
2860 else higzSpec = new THIGZ(defSize);
2861 higzSpec->SetName("higzSpec");
2866 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2869 higzSave->SetName("higz");
2873 //_____________________________________________________________________________
2874 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2878 // LEVMAX Depth level
2881 // This function draws the logical tree,
2882 // Each volume in the tree is represented by a TPaveTree object.
2883 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2884 // Use TPaveTree pop-up menu to select:
2887 // - drawing tree of parent
2893 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2897 //_____________________________________________________________________________
2898 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2902 // LEVMAX Depth level
2905 // This function draws the logical tree of the parent of name.
2909 // Scan list of volumes in JVOLUM
2911 Int_t gname, i, jvo, in, nin, jin, num;
2912 strncpy((char *) &gname, name, 4);
2913 for(i=1; i<=fGcnum->nvolum; i++) {
2914 jvo = fZlq[fGclink->jvolum-i];
2915 nin = Int_t(fZq[jvo+3]);
2916 if (nin == -1) nin = 1;
2917 for (in=1;in<=nin;in++) {
2919 num = Int_t(fZq[jin+2]);
2920 if(gname == fZiq[fGclink->jvolum+num]) {
2921 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2923 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2931 //_____________________________________________________________________________
2932 void TGeant3::SetABAN(Int_t par)
2935 // par = 1 particles will be stopped according to their residual
2936 // range if they are not in a sensitive material and are
2937 // far enough from the boundary
2938 // 0 particles are transported normally
2940 fGcphys->dphys1 = par;
2944 //_____________________________________________________________________________
2945 void TGeant3::SetANNI(Int_t par)
2948 // To control positron annihilation.
2949 // par =0 no annihilation
2950 // =1 annihilation. Decays processed.
2951 // =2 annihilation. No decay products stored.
2953 fGcphys->ianni = par;
2957 //_____________________________________________________________________________
2958 void TGeant3::SetAUTO(Int_t par)
2961 // To control automatic calculation of tracking medium parameters:
2962 // par =0 no automatic calculation;
2963 // =1 automati calculation.
2965 fGctrak->igauto = par;
2969 //_____________________________________________________________________________
2970 void TGeant3::SetBOMB(Float_t boom)
2973 // BOOM : Exploding factor for volumes position
2975 // To 'explode' the detector. If BOOM is positive (values smaller
2976 // than 1. are suggested, but any value is possible)
2977 // all the volumes are shifted by a distance
2978 // proportional to BOOM along the direction between their centre
2979 // and the origin of the MARS; the volumes which are symmetric
2980 // with respect to this origin are simply not shown.
2981 // BOOM equal to 0 resets the normal mode.
2982 // A negative (greater than -1.) value of
2983 // BOOM will cause an 'implosion'; for even lower values of BOOM
2984 // the volumes' positions will be reflected respect to the origin.
2985 // This command can be useful to improve the 3D effect for very
2986 // complex detectors. The following commands will make explode the
2993 //_____________________________________________________________________________
2994 void TGeant3::SetBREM(Int_t par)
2997 // To control bremstrahlung.
2998 // par =0 no bremstrahlung
2999 // =1 bremstrahlung. Photon processed.
3000 // =2 bremstrahlung. No photon stored.
3002 fGcphys->ibrem = par;
3006 //_____________________________________________________________________________
3007 void TGeant3::SetCKOV(Int_t par)
3010 // To control Cerenkov production
3011 // par =0 no Cerenkov;
3013 // =2 Cerenkov with primary stopped at each step.
3015 fGctlit->itckov = par;
3019 //_____________________________________________________________________________
3020 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3021 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3024 // The hidden line removal technique is necessary to visualize properly
3025 // very complex detectors. At the same time, it can be useful to visualize
3026 // the inner elements of a detector in detail. This function allows
3027 // subtractions (via boolean operation) of BOX shape from any part of
3028 // the detector, therefore showing its inner contents.
3029 // If "*" is given as the name of the
3030 // volume to be clipped, all volumes are clipped by the given box.
3031 // A volume can be clipped at most twice.
3032 // if a volume is explicitely clipped twice,
3033 // the "*" will not act on it anymore. Giving "." as the name
3034 // of the volume to be clipped will reset the clipping.
3036 // NAME Name of volume to be clipped
3038 // XMIN Lower limit of the Shape X coordinate
3039 // XMAX Upper limit of the Shape X coordinate
3040 // YMIN Lower limit of the Shape Y coordinate
3041 // YMAX Upper limit of the Shape Y coordinate
3042 // ZMIN Lower limit of the Shape Z coordinate
3043 // ZMAX Upper limit of the Shape Z coordinate
3045 // This function performs a boolean subtraction between the volume
3046 // NAME and a box placed in the MARS according the values of the given
3052 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3055 //_____________________________________________________________________________
3056 void TGeant3::SetCOMP(Int_t par)
3059 // To control Compton scattering
3060 // par =0 no Compton
3061 // =1 Compton. Electron processed.
3062 // =2 Compton. No electron stored.
3065 fGcphys->icomp = par;
3068 //_____________________________________________________________________________
3069 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3070 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3071 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3072 Float_t ppcutm, Float_t tofmax)
3075 // CUTGAM Cut for gammas D=0.001
3076 // CUTELE Cut for electrons D=0.001
3077 // CUTHAD Cut for charged hadrons D=0.01
3078 // CUTNEU Cut for neutral hadrons D=0.01
3079 // CUTMUO Cut for muons D=0.01
3080 // BCUTE Cut for electron brems. D=-1.
3081 // BCUTM Cut for muon brems. D=-1.
3082 // DCUTE Cut for electron delta-rays D=-1.
3083 // DCUTM Cut for muon delta-rays D=-1.
3084 // PPCUTM Cut for e+e- pairs by muons D=0.01
3085 // TOFMAX Time of flight cut D=1.E+10
3087 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3088 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3090 // If one of the parameters from CUTGAM to PPCUTM included
3091 // is modified, cross-sections and energy loss tables must be
3092 // recomputed via the function Gphysi.
3094 fGccuts->cutgam = cutgam;
3095 fGccuts->cutele = cutele;
3096 fGccuts->cutneu = cutneu;
3097 fGccuts->cuthad = cuthad;
3098 fGccuts->cutmuo = cutmuo;
3099 fGccuts->bcute = bcute;
3100 fGccuts->bcutm = bcutm;
3101 fGccuts->dcute = dcute;
3102 fGccuts->dcutm = dcutm;
3103 fGccuts->ppcutm = ppcutm;
3104 fGccuts->tofmax = tofmax;
3107 //_____________________________________________________________________________
3108 void TGeant3::SetDCAY(Int_t par)
3111 // To control Decay mechanism.
3112 // par =0 no decays.
3113 // =1 Decays. secondaries processed.
3114 // =2 Decays. No secondaries stored.
3116 fGcphys->idcay = par;
3120 //_____________________________________________________________________________
3121 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3124 // Set the debug flag and frequency
3125 // Selected debug output will be printed from
3126 // event emin to even emax each emod event
3128 fGcflag->idemin = emin;
3129 fGcflag->idemax = emax;
3130 fGcflag->itest = emod;
3134 //_____________________________________________________________________________
3135 void TGeant3::SetDRAY(Int_t par)
3138 // To control delta rays mechanism.
3139 // par =0 no delta rays.
3140 // =1 Delta rays. secondaries processed.
3141 // =2 Delta rays. No secondaries stored.
3143 fGcphys->idray = par;
3146 //_____________________________________________________________________________
3147 void TGeant3::SetHADR(Int_t par)
3150 // To control hadronic interactions.
3151 // par =0 no hadronic interactions.
3152 // =1 Hadronic interactions. secondaries processed.
3153 // =2 Hadronic interactions. No secondaries stored.
3155 fGcphys->ihadr = par;
3158 //_____________________________________________________________________________
3159 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3160 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3161 Float_t xk8, Float_t xk9, Float_t xk10)
3164 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3165 // Their meaning is user defined
3167 fGckine->ikine = kine;
3168 fGckine->pkine[0] = xk1;
3169 fGckine->pkine[1] = xk2;
3170 fGckine->pkine[2] = xk3;
3171 fGckine->pkine[3] = xk4;
3172 fGckine->pkine[4] = xk5;
3173 fGckine->pkine[5] = xk6;
3174 fGckine->pkine[6] = xk7;
3175 fGckine->pkine[7] = xk8;
3176 fGckine->pkine[8] = xk9;
3177 fGckine->pkine[9] = xk10;
3180 //_____________________________________________________________________________
3181 void TGeant3::SetLOSS(Int_t par)
3184 // To control energy loss.
3185 // par =0 no energy loss;
3186 // =1 restricted energy loss fluctuations;
3187 // =2 complete energy loss fluctuations;
3189 // =4 no energy loss fluctuations.
3190 // If the value ILOSS is changed, then cross-sections and energy loss
3191 // tables must be recomputed via the command 'PHYSI'.
3193 fGcphys->iloss = par;
3197 //_____________________________________________________________________________
3198 void TGeant3::SetMULS(Int_t par)
3201 // To control multiple scattering.
3202 // par =0 no multiple scattering.
3203 // =1 Moliere or Coulomb scattering.
3204 // =2 Moliere or Coulomb scattering.
3205 // =3 Gaussian scattering.
3207 fGcphys->imuls = par;
3211 //_____________________________________________________________________________
3212 void TGeant3::SetMUNU(Int_t par)
3215 // To control muon nuclear interactions.
3216 // par =0 no muon-nuclear interactions.
3217 // =1 Nuclear interactions. Secondaries processed.
3218 // =2 Nuclear interactions. Secondaries not processed.
3220 fGcphys->imunu = par;
3223 //_____________________________________________________________________________
3224 void TGeant3::SetOPTI(Int_t par)
3227 // This flag controls the tracking optimisation performed via the
3229 // 1 no optimisation at all; GSORD calls disabled;
3230 // 0 no optimisation; only user calls to GSORD kept;
3231 // 1 all non-GSORDered volumes are ordered along the best axis;
3232 // 2 all volumes are ordered along the best axis.
3234 fGcopti->ioptim = par;
3237 //_____________________________________________________________________________
3238 void TGeant3::SetPAIR(Int_t par)
3241 // To control pair production mechanism.
3242 // par =0 no pair production.
3243 // =1 Pair production. secondaries processed.
3244 // =2 Pair production. No secondaries stored.
3246 fGcphys->ipair = par;
3250 //_____________________________________________________________________________
3251 void TGeant3::SetPFIS(Int_t par)
3254 // To control photo fission mechanism.
3255 // par =0 no photo fission.
3256 // =1 Photo fission. secondaries processed.
3257 // =2 Photo fission. No secondaries stored.
3259 fGcphys->ipfis = par;
3262 //_____________________________________________________________________________
3263 void TGeant3::SetPHOT(Int_t par)
3266 // To control Photo effect.
3267 // par =0 no photo electric effect.
3268 // =1 Photo effect. Electron processed.
3269 // =2 Photo effect. No electron stored.
3271 fGcphys->iphot = par;
3274 //_____________________________________________________________________________
3275 void TGeant3::SetRAYL(Int_t par)
3278 // To control Rayleigh scattering.
3279 // par =0 no Rayleigh scattering.
3282 fGcphys->irayl = par;
3285 //_____________________________________________________________________________
3286 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3290 // val New switch value
3292 // Change one element of array ISWIT(10) in /GCFLAG/
3294 if (sw <= 0 || sw > 10) return;
3295 fGcflag->iswit[sw-1] = val;
3299 //_____________________________________________________________________________
3300 void TGeant3::SetTRIG(Int_t nevents)
3303 // Set number of events to be run
3305 fGcflag->nevent = nevents;
3308 //_____________________________________________________________________________
3309 void TGeant3::SetUserDecay(Int_t pdg)
3312 // Force the decays of particles to be done with Pythia
3313 // and not with the Geant routines.
3314 // just kill pointers doing mzdrop
3316 Int_t ipart = IdFromPDG(pdg);
3318 printf("Particle %d not in geant\n",pdg);
3321 Int_t jpart=fGclink->jpart;
3322 Int_t jpa=fZlq[jpart-ipart];
3325 Int_t jpa1=fZlq[jpa-1];
3327 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3328 Int_t jpa2=fZlq[jpa-2];
3330 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3334 //______________________________________________________________________________
3335 void TGeant3::Vname(const char *name, char *vname)
3338 // convert name to upper case. Make vname at least 4 chars
3340 Int_t l = strlen(name);
3343 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3344 for (i=l;i<4;i++) vname[i] = ' ';
3348 //______________________________________________________________________________
3349 void TGeant3::Ertrgo()
3354 //______________________________________________________________________________
3355 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3356 const Float_t *x2, const Float_t *p2,
3357 Int_t ipa, Option_t *chopt)
3359 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3362 //_____________________________________________________________________________
3363 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3364 Int_t number, Int_t nlevel)
3368 // ******************************************************************
3370 // * Write out the geometry of the detector in EUCLID file format *
3372 // * filnam : will be with the extension .euc *
3373 // * topvol : volume name of the starting node *
3374 // * number : copy number of topvol (relevant for gsposp) *
3375 // * nlevel : number of levels in the tree structure *
3376 // * to be written out, starting from topvol *
3378 // * Author : M. Maire *
3380 // ******************************************************************
3382 // File filnam.tme is written out with the definitions of tracking
3383 // medias and materials.
3384 // As to restore original numbers for materials and medias, program
3385 // searches in the file euc_medi.dat and comparing main parameters of
3386 // the mat. defined inside geant and the one in file recognizes them
3387 // and is able to take number from file. If for any material or medium,
3388 // this procedure fails, ordering starts from 1.
3389 // Arrays IOTMED and IOMATE are used for this procedure
3391 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3392 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3394 Int_t i, end, itm, irm, jrm, k, nmed;
3398 char *filext, *filetme;
3399 char natmed[21], namate[21];
3400 char natmedc[21], namatec[21];
3401 char key[5], name[5], mother[5], konly[5];
3403 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3404 Int_t mlevel, numbr, natt, numed, nin, ndata;
3405 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3406 Int_t jdiv, ivin, in, jin, jvin, irot;
3407 Int_t jtm, imat, jma, flag=0, imatc;
3408 Float_t az, dens, radl, absl, a, step, x, y, z;
3409 Int_t npar, ndvmx, left;
3410 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3412 Int_t iomate[100], iotmed[100];
3413 Float_t par[50], att[20], ubuf[50];
3416 Int_t level, ndiv, iaxe;
3417 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3418 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3419 Float_t tmaxf, stemax, deemax, epsil, stmin;
3420 const char *f10000="!\n%s\n!\n";
3421 //Open the input file
3423 for(i=0;i<end;i++) if(filnam[i]=='.') {
3427 filext=new char[end+4];
3428 filetme=new char[end+4];
3429 strncpy(filext,filnam,end);
3430 strncpy(filetme,filnam,end);
3432 // *** The output filnam name will be with extension '.euc'
3433 strcpy(&filext[end],".euc");
3434 strcpy(&filetme[end],".tme");
3435 lun=fopen(filext,"w");
3437 // *** Initialisation of the working space
3438 iadvol=fGcnum->nvolum;
3439 iadtmd=iadvol+fGcnum->nvolum;
3440 iadrot=iadtmd+fGcnum->ntmed;
3441 if(fGclink->jrotm) {
3442 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3446 nwtot=iadrot+fGcnum->nrotm;
3447 qws = new float[nwtot+1];
3448 for (i=0;i<nwtot+1;i++) qws[i]=0;
3451 if(nlevel==0) mlevel=20;
3453 // *** find the top volume and put it in the stak
3454 numbr = number>0 ? number : 1;
3455 Gfpara(topvol,numbr,1,npar,natt,par,att);
3457 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3462 // *** authorized shape ?
3463 strncpy((char *)&iname, topvol, 4);
3465 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3469 jvo = fZlq[fGclink->jvolum-ivo];
3470 ish = Int_t (fZq[jvo+2]);
3472 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3479 iws[iadvol+ivo] = level;
3482 //*** flag all volumes and fill the stak
3486 // pick the next volume in stak
3488 ivo = TMath::Abs(iws[ivstak]);
3489 jvo = fZlq[fGclink->jvolum - ivo];
3491 // flag the tracking medium
3492 numed = Int_t (fZq[jvo + 4]);
3493 iws[iadtmd + numed] = 1;
3495 // get the daughters ...
3496 level = iws[iadvol+ivo];
3497 if (level < mlevel) {
3499 nin = Int_t (fZq[jvo + 3]);
3501 // from division ...
3503 jdiv = fZlq[jvo - 1];
3504 ivin = Int_t (fZq[jdiv + 2]);
3506 iws[nvstak] = -ivin;
3507 iws[iadvol+ivin] = level;
3509 // from position ...
3510 } else if (nin > 0) {
3511 for(in=1; in<=nin; in++) {
3512 jin = fZlq[jvo - in];
3513 ivin = Int_t (fZq[jin + 2 ]);
3514 jvin = fZlq[fGclink->jvolum - ivin];
3515 ish = Int_t (fZq[jvin + 2]);
3516 // authorized shape ?
3518 // not yet flagged ?
3519 if (iws[iadvol+ivin]==0) {
3522 iws[iadvol+ivin] = level;
3524 // flag the rotation matrix
3525 irot = Int_t ( fZq[jin + 4 ]);
3526 if (irot > 0) iws[iadrot+irot] = 1;
3532 // next volume in stak ?
3533 if (ivstak < nvstak) goto L10;
3535 // *** restore original material and media numbers
3536 // file euc_medi.dat is needed to compare materials and medias
3538 FILE* luncor=fopen("euc_medi.dat","r");
3541 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3542 if (iws[iadtmd+itm] > 0) {
3543 jtm = fZlq[fGclink->jtmed-itm];
3544 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3545 imat = Int_t (fZq[jtm+6]);
3546 jma = fZlq[fGclink->jmate-imat];
3548 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3551 strncpy(namate,(char *)&fZiq[jma+1],20);
3554 //** find the material original number
3557 iret=fscanf(luncor,"%4s,%130s",key,card);
3558 if(iret<=0) goto L26;
3560 if(!strcmp(key,"MATE")) {
3561 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3562 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3563 if(!strcmp(namatec,namate)) {
3564 if(az==a && zc==z && densc==dens && radlc==radl
3565 && abslc==absl && nparc==nparc) {
3568 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3570 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3574 if(strcmp(key,"END") && !flag) goto L23;
3576 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3580 //*** restore original tracking medium number
3583 iret=fscanf(luncor,"%4s,%130s",key,card);
3584 if(iret<=0) goto L26;
3586 if (!strcmp(key,"TMED")) {
3587 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3588 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3589 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3590 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3591 epsil,stmin,ubuf,&nwbuf);
3592 if(!strcmp(natmedc,natmed)) {
3593 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3596 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3599 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3603 if(strcmp(key,"END") && !flag) goto L24;
3605 printf("cannot restore original number for medium : %s\n",natmed);
3613 L26: printf("*** GWEUCL *** cannot read the data file\n");
3615 L29: if(luncor) fclose (luncor);
3618 // *** write down the tracking medium definition
3620 strcpy(card,"! Tracking medium");
3621 fprintf(lun,f10000,card);
3623 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3624 if (iws[iadtmd+itm]>0) {
3625 jtm = fZlq[fGclink->jtmed-itm];
3626 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3628 imat = Int_t (fZq[jtm+6]);
3629 jma = fZlq[fGclink->jmate-imat];
3630 //* order media from one, if comparing with database failed
3632 iotmed[itm]=++imxtmed;
3633 iomate[imat]=++imxmate;
3638 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3641 strncpy(namate,(char *)&fZiq[jma+1],20);
3644 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3648 //* *** write down the rotation matrix
3650 strcpy(card,"! Reperes");
3651 fprintf(lun,f10000,card);
3653 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3654 if (iws[iadrot+irm]>0) {
3655 jrm = fZlq[fGclink->jrotm-irm];
3656 fprintf(lun,"ROTM %3d",irm);
3657 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3662 //* *** write down the volume definition
3664 strcpy(card,"! Volumes");
3665 fprintf(lun,f10000,card);
3667 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3670 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3672 jvo = fZlq[fGclink->jvolum-ivo];
3673 ish = Int_t (fZq[jvo+2]);
3674 nmed = Int_t (fZq[jvo+4]);
3675 npar = Int_t (fZq[jvo+5]);
3677 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3678 Gckpar (ish,npar,par);
3679 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3680 for(i=0;i<(npar-1)/6+1;i++) {
3683 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3687 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3692 //* *** write down the division of volumes
3694 fprintf(lun,f10000,"! Divisions");
3695 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3696 ivo = TMath::Abs(iws[ivstak]);
3697 jvo = fZlq[fGclink->jvolum-ivo];
3698 ish = Int_t (fZq[jvo+2]);
3699 nin = Int_t (fZq[jvo+3]);
3700 //* this volume is divided ...
3703 iaxe = Int_t ( fZq[jdiv+1]);
3704 ivin = Int_t ( fZq[jdiv+2]);
3705 ndiv = Int_t ( fZq[jdiv+3]);
3708 jvin = fZlq[fGclink->jvolum-ivin];
3709 nmed = Int_t ( fZq[jvin+4]);
3710 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3712 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3714 if ((step<=0.)||(ish>=11)) {
3715 //* volume with negative parameter or gsposp or pgon ...
3716 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3717 } else if ((ndiv<=0)||(ish==10)) {
3718 //* volume with negative parameter or gsposp or para ...
3719 ndvmx = TMath::Abs(ndiv);
3720 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3721 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3723 //* normal volume : all kind of division are equivalent
3724 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3725 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3730 //* *** write down the the positionnement of volumes
3732 fprintf(lun,f10000,"! Positionnements\n");
3734 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3735 ivo = TMath::Abs(iws[ivstak]);
3736 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3738 jvo = fZlq[fGclink->jvolum-ivo];
3739 nin = Int_t( fZq[jvo+3]);
3740 //* this volume has daughters ...
3742 for (in=1;in<=nin;in++) {
3744 ivin = Int_t (fZq[jin +2]);
3745 numb = Int_t (fZq[jin +3]);
3746 irot = Int_t (fZq[jin +4]);
3750 strcpy(konly,"ONLY");
3751 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
3752 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
3754 jvin = fZlq[fGclink->jvolum-ivin];
3755 ish = Int_t (fZq[jvin+2]);
3756 //* gspos or gsposp ?
3757 ndata = fZiq[jin-1];
3759 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
3760 name,numb,mother,x,y,z,irot,konly);
3762 npar = Int_t (fZq[jin+9]);
3763 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
3764 Gckpar (ish,npar,par);
3765 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
3766 name,numb,mother,x,y,z,irot,konly,npar);
3768 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3775 fprintf(lun,"END\n");
3778 //****** write down the materials and medias *****
3780 lun=fopen(filetme,"w");
3782 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3783 if (iws[iadtmd+itm]>0) {
3784 jtm = fZlq[fGclink->jtmed-itm];
3785 strncpy(natmed,(char*)&fZiq[jtm+1],4);
3786 imat = Int_t (fZq[jtm+6]);
3787 jma = Int_t (fZlq[fGclink->jmate-imat]);
3789 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
3790 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
3791 iomate[imat],namate,a,z,dens,radl,absl,npar);
3795 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3799 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
3800 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
3801 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
3802 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
3806 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3812 fprintf(lun,"END\n");
3813 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
3814 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
3823 //_____________________________________________________________________________
3824 void TGeant3::Streamer(TBuffer &R__b)
3827 // Stream an object of class TGeant3.
3829 if (R__b.IsReading()) {
3830 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
3831 AliMC::Streamer(R__b);
3834 R__b.ReadStaticArray(fPDGCode);
3836 R__b.WriteVersion(TGeant3::IsA());
3837 AliMC::Streamer(R__b);
3840 R__b.WriteArray(fPDGCode, fNPDGCodes);