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 setbomb setbomb_
109 # define setclip setclip_
110 # define gcomad gcomad_
113 # define gzebra GZEBRA
114 # define grfile GRFILE
115 # define gpcxyz GPCXYZ
116 # define ggclos GGCLOS
119 # define gcinit GCINIT
122 # define gtrigc GTRIGC
123 # define gtrigi GTRIGI
125 # define gzinit GZINIT
126 # define gfmate GFMATE
127 # define gfpart GFPART
128 # define gftmed GFTMED
132 # define gsmate GSMATE
133 # define gsmixt GSMIXT
134 # define gspart GSPART
135 # define gstmed GSTMED
136 # define gsckov GSCKOV
137 # define gstpar GSTPAR
138 # define gfkine GFKINE
139 # define gfvert GFVERT
140 # define gskine GSKINE
141 # define gsvert GSVERT
142 # define gphysi GPHYSI
143 # define gdebug GDEBUG
144 # define gekbin GEKBIN
145 # define gfinds GFINDS
146 # define gsking GSKING
147 # define gskpho GSKPHO
148 # define gsstak GSSTAK
150 # define gtrack GTRACK
151 # define gtreve GTREVE
152 # define gtreve_root GTREVE_ROOT
154 # define grndmq GRNDMQ
156 # define glmoth GLMOTH
157 # define gmedia GMEDIA
160 # define gsdvn2 GSDVN2
162 # define gsdvs2 GSDVS2
164 # define gsdvt2 GSDVT2
167 # define gsposp GSPOSP
168 # define gsrotm GSROTM
169 # define gprotm GPROTM
170 # define gsvolu GSVOLU
171 # define gprint GPRINT
172 # define gdinit GDINIT
175 # define gdrayt GDRAYT
176 # define gdrawc GDRAWC
177 # define gdrawx GDRAWX
178 # define gdhead GDHEAD
179 # define gdwmn1 GDWMN1
180 # define gdwmn2 GDWMN2
181 # define gdwmn3 GDWMN3
183 # define gdcxyz GDCXYZ
185 # define gdfspc GDFSPC
186 # define gdspec GDSPEC
187 # define gdtree GDTREE
188 # define gdelet GDELET
189 # define gdclos GDCLOS
190 # define gdshow GDSHOW
191 # define gdopen GDOPEN
192 # define dzshow DZSHOW
194 # define gfpara GFPARA
195 # define gckpar GCKPAR
196 # define gckmat GCKMAT
197 # define geditv GEDITV
198 # define mzdrop MZDROP
200 # define setbomb SETBOMB
201 # define setclip SETCLIP
202 # define gcomad GCOMAD
206 //____________________________________________________________________________
210 // Prototypes for GEANT functions
212 void type_of_call gzebra(const int&);
214 void type_of_call gpcxyz();
216 void type_of_call ggclos();
218 void type_of_call glast();
220 void type_of_call ginit();
222 void type_of_call gcinit();
224 void type_of_call grun();
226 void type_of_call gtrig();
228 void type_of_call gtrigc();
230 void type_of_call gtrigi();
232 void type_of_call gwork(const int&);
234 void type_of_call gzinit();
236 void type_of_call gmate();
238 void type_of_call gpart();
240 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
242 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
243 Int_t &, Float_t *, Int_t &);
245 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
246 Float_t &, Float_t *, Int_t &);
248 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
251 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
254 void type_of_call gphysi();
256 void type_of_call gdebug();
258 void type_of_call gekbin();
260 void type_of_call gfinds();
262 void type_of_call gsking(Int_t &);
264 void type_of_call gskpho(Int_t &);
266 void type_of_call gsstak(Int_t &);
268 void type_of_call gsxyz();
270 void type_of_call gtrack();
272 void type_of_call gtreve();
274 void type_of_call gtreve_root();
276 void type_of_call grndm(Float_t *, const Int_t &);
278 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
281 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
283 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
284 Int_t *, Int_t * DEFCHARL);
286 void type_of_call gmedia(Float_t *, Int_t &);
288 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
290 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
291 const Float_t &, const Float_t &, const Float_t &,
294 void type_of_call gprotm(const Int_t &);
296 void type_of_call grfile(const Int_t&, DEFCHARD,
297 DEFCHARD DEFCHARL DEFCHARL);
299 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
300 Float_t &, Float_t &, Float_t &, Float_t *,
303 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
304 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
306 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
307 Float_t &, Float_t &, Float_t &, Float_t &,
308 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
310 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
311 Float_t &, Float_t &, Float_t &, Float_t *,
314 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
315 Float_t &, Int_t &, Float_t * DEFCHARL);
317 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
318 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
321 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
322 Float_t &, Float_t &, Float_t &, Float_t &,
323 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
325 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
326 Float_t *absco, Float_t *effic, Float_t *rindex);
327 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
329 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
332 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
333 Int_t & DEFCHARL DEFCHARL);
335 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
338 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
339 Int_t & DEFCHARL DEFCHARL);
341 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
342 Int_t & DEFCHARL DEFCHARL);
344 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
345 Int_t &, Int_t & DEFCHARL DEFCHARL);
347 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
349 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
350 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
353 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
354 Float_t &, Int_t &, DEFCHARD,
355 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
357 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
358 Int_t & DEFCHARL DEFCHARL);
360 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
362 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
365 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
367 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
369 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
371 void type_of_call gdinit();
373 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
375 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
376 Float_t &, Float_t &, Float_t & DEFCHARL);
377 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
378 Float_t &, Float_t &, Float_t & DEFCHARL);
379 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
380 Float_t &, Float_t & DEFCHARL);
381 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
382 Float_t &, Float_t &, Float_t &, Float_t &,
384 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
385 void type_of_call gdxyz(Int_t &);
386 void type_of_call gdcxyz();
387 void type_of_call gdman(Float_t &, Float_t &);
388 void type_of_call gdwmn1(Float_t &, Float_t &);
389 void type_of_call gdwmn2(Float_t &, Float_t &);
390 void type_of_call gdwmn3(Float_t &, Float_t &);
391 void type_of_call gdspec(DEFCHARD DEFCHARL);
392 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
393 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
395 void type_of_call gdopen(Int_t &);
396 void type_of_call gdclos();
397 void type_of_call gdelet(Int_t &);
398 void type_of_call gdshow(Int_t &);
399 void type_of_call geditv(Int_t &) {;}
402 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
403 const int&, const int&, const int& DEFCHARL
406 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
408 void type_of_call setbomb(Float_t &);
409 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
410 Float_t &, Float_t & DEFCHARL);
411 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
415 // Geant3 global pointer
417 static Int_t defSize = 600;
421 //____________________________________________________________________________
425 // Default constructor
429 //____________________________________________________________________________
430 TGeant3::TGeant3(const char *title, Int_t nwgeant)
431 :AliMC("TGeant3",title)
434 // Standard constructor for TGeant3 with ZEBRA initialisation
445 // Load Address of Geant3 commons
448 // Zero number of particles
452 //____________________________________________________________________________
453 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
454 Float_t &radl, Float_t &absl) const
457 // Return the parameters of the current material during transport
461 dens = fGcmate->dens;
462 radl = fGcmate->radl;
463 absl = fGcmate->absl;
464 return 1; //this could be the number of elements in mixture
467 //____________________________________________________________________________
468 void TGeant3::DefaultRange()
471 // Set range of current drawing pad to 20x20 cm
477 higz->Range(0,0,20,20);
480 //____________________________________________________________________________
481 void TGeant3::InitHIGZ()
492 //____________________________________________________________________________
493 void TGeant3::LoadAddress()
496 // Assigns the address of the GEANT common blocks to the structures
497 // that allow their access from C++
500 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
501 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
502 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
503 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
504 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
505 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
506 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
507 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
508 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
509 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
510 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
511 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
512 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
513 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
514 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
515 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
516 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
517 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
518 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
519 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
521 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
523 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
528 //_____________________________________________________________________________
529 void TGeant3::GeomIter()
532 // Geometry iterator for moving upward in the geometry tree
533 // Initialise the iterator
535 fNextVol=fGcvolu->nlevel;
538 //____________________________________________________________________________
539 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
542 // Geometry iterator for moving upward in the geometry tree
543 // Return next volume up
548 gname=fGcvolu->names[fNextVol];
549 strncpy(name,(char *) &gname, 4);
551 copy=fGcvolu->number[fNextVol];
552 i=fGcvolu->lvolum[fNextVol];
553 if(gname == fZiq[fGclink->jvolum+i]) return i;
554 else printf("GeomTree: Volume %s not found in bank\n",name);
559 //_____________________________________________________________________________
560 Int_t TGeant3::CurrentVolID(Int_t ©) const
563 // Returns the current volume ID and copy number
566 if( (i=fGcvolu->nlevel-1) < 0 ) {
567 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
569 gname=fGcvolu->names[i];
570 copy=fGcvolu->number[i];
571 i=fGcvolu->lvolum[i];
572 if(gname == fZiq[fGclink->jvolum+i]) return i;
573 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
578 //_____________________________________________________________________________
579 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
582 // Return the current volume "off" upward in the geometrical tree
583 // ID and copy number
586 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
587 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
588 off,fGcvolu->nlevel);
590 gname=fGcvolu->names[i];
591 copy=fGcvolu->number[i];
592 i=fGcvolu->lvolum[i];
593 if(gname == fZiq[fGclink->jvolum+i]) return i;
594 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
599 //_____________________________________________________________________________
600 const char* TGeant3::CurrentVolName() const
603 // Returns the current volume name
607 if( (i=fGcvolu->nlevel-1) < 0 ) {
608 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
610 gname=fGcvolu->names[i];
612 strncpy(name,(char *) &gname, 4);
614 i=fGcvolu->lvolum[i];
615 if(gname == fZiq[fGclink->jvolum+i]) return name;
616 else Warning("CurrentVolName","Volume %4s not found\n",name);
621 //_____________________________________________________________________________
622 const char* TGeant3::CurrentVolOffName(Int_t off) const
625 // Return the current volume "off" upward in the geometrical tree
626 // ID, name and copy number
627 // if name=0 no name is returned
631 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
632 Warning("CurrentVolOffName",
633 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
635 gname=fGcvolu->names[i];
637 strncpy(name,(char *) &gname, 4);
639 i=fGcvolu->lvolum[i];
640 if(gname == fZiq[fGclink->jvolum+i]) return name;
641 else Warning("CurrentVolOffName","Volume %4s not found\n",name);
646 //_____________________________________________________________________________
647 Int_t TGeant3::IdFromPDG(Int_t pdg) const
650 // Return Geant3 code from PDG and pseudo ENDF code
652 for(Int_t i=0;i<fNPDGCodes;++i)
653 if(pdg==fPDGCode[i]) return i;
657 //_____________________________________________________________________________
658 Int_t TGeant3::PDGFromId(Int_t id) const
660 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
664 //_____________________________________________________________________________
665 void TGeant3::DefineParticles()
668 // Define standard Geant 3 particles
671 // Load standard numbers for GEANT particles and PDG conversion
672 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
673 fPDGCode[fNPDGCodes++]=22; // 1 = photon
674 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
675 fPDGCode[fNPDGCodes++]=11; // 3 = electron
676 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
677 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
678 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
679 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
680 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
681 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
682 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
683 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
684 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
685 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
686 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
687 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
688 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
689 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
690 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
691 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
692 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
693 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
694 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
695 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
696 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
697 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
698 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
699 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
700 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
701 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
702 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
703 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
704 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
711 /* --- Define additional particles */
712 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
713 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
715 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
716 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
718 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
719 fPDGCode[fNPDGCodes++]=411; // 35 = D+
721 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
722 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
724 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
725 fPDGCode[fNPDGCodes++]=421; // 37 = D0
727 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
728 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
730 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
732 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
734 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
736 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
737 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
739 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
740 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
742 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
743 fPDGCode[fNPDGCodes++]=113; // 37 = D0
746 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
748 // and numbers above 5 000 000 for special applications
751 const Int_t kion=10000000;
753 const Int_t kspe=50000000;
755 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
757 const Double_t autogev=0.9314943228;
758 const Double_t hslash = 1.0545726663e-27;
759 const Double_t erggev = 1/1.6021773349e-3;
760 const Double_t hshgev = hslash*erggev;
761 const Double_t yearstosec = 3600*24*365.25;
764 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
765 0,1,"Ion",kion+10020);
766 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
768 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
769 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
770 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
772 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
773 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
774 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
776 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
778 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
779 0,2,"Ion",kion+20030);
780 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
782 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
783 0,0,"Special",kspe+50);
784 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
786 /* --- Define additional decay modes --- */
787 /* --- omega(783) --- */
788 for (kz = 0; kz < 6; ++kz) {
799 Gsdk(ipa, bratio, mode);
800 /* --- phi(1020) --- */
801 for (kz = 0; kz < 6; ++kz) {
816 Gsdk(ipa, bratio, mode);
818 for (kz = 0; kz < 6; ++kz) {
831 Gsdk(ipa, bratio, mode);
833 for (kz = 0; kz < 6; ++kz) {
846 Gsdk(ipa, bratio, mode);
848 for (kz = 0; kz < 6; ++kz) {
859 Gsdk(ipa, bratio, mode);
860 /* --- Anti D0 --- */
861 for (kz = 0; kz < 6; ++kz) {
872 Gsdk(ipa, bratio, mode);
874 for (kz = 0; kz < 6; ++kz) {
881 Gsdk(ipa, bratio, mode);
883 for (kz = 0; kz < 6; ++kz) {
890 Gsdk(ipa, bratio, mode);
892 for (kz = 0; kz < 6; ++kz) {
899 Gsdk(ipa, bratio, mode);
902 for (kz = 0; kz < 6; ++kz) {
911 Gsdk(ipa, bratio, mode);
914 Gsdk(ipa, bratio, mode);
917 Gsdk(ipa, bratio, mode);
922 //_____________________________________________________________________________
923 Int_t TGeant3::VolId(Text_t *name) const
926 // Return the unique numeric identifier for volume name
929 strncpy((char *) &gname, name, 4);
930 for(i=1; i<=fGcnum->nvolum; i++)
931 if(gname == fZiq[fGclink->jvolum+i]) return i;
932 printf("VolId: Volume %s not found\n",name);
936 //_____________________________________________________________________________
937 Int_t TGeant3::NofVolumes() const
940 // Return total number of volumes in the geometry
942 return fGcnum->nvolum;
945 //_____________________________________________________________________________
946 const char* TGeant3::VolName(Int_t id) const
949 // Return the volume name given the volume identifier
952 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
955 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
960 //_____________________________________________________________________________
961 void TGeant3::TrackPosition(TLorentzVector &xyz) const
964 // Return the current position in the master reference frame of the
965 // track being transported
967 xyz[0]=fGctrak->vect[0];
968 xyz[1]=fGctrak->vect[1];
969 xyz[2]=fGctrak->vect[2];
970 xyz[3]=fGctrak->tofg;
973 //_____________________________________________________________________________
974 Float_t TGeant3::TrackTime() const
977 // Return the current time of flight of the track being transported
979 return fGctrak->tofg;
982 //_____________________________________________________________________________
983 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
986 // Return the direction and the momentum (GeV/c) of the track
987 // currently being transported
989 Double_t ptot=fGctrak->vect[6];
990 xyz[0]=fGctrak->vect[3]*ptot;
991 xyz[1]=fGctrak->vect[4]*ptot;
992 xyz[2]=fGctrak->vect[5]*ptot;
993 xyz[3]=fGctrak->getot;
996 //_____________________________________________________________________________
997 Float_t TGeant3::TrackCharge() const
1000 // Return charge of the track currently transported
1002 return fGckine->charge;
1005 //_____________________________________________________________________________
1006 Float_t TGeant3::TrackMass() const
1009 // Return the mass of the track currently transported
1011 return fGckine->amass;
1014 //_____________________________________________________________________________
1015 Int_t TGeant3::TrackPid() const
1018 // Return the id of the particle transported
1020 return fGckine->ipart;
1023 //_____________________________________________________________________________
1024 Float_t TGeant3::TrackStep() const
1027 // Return the length in centimeters of the current step
1029 return fGctrak->step;
1032 //_____________________________________________________________________________
1033 Float_t TGeant3::TrackLength() const
1036 // Return the length of the current track from its origin
1038 return fGctrak->sleng;
1041 //_____________________________________________________________________________
1042 Bool_t TGeant3::IsTrackInside() const
1045 // True if the track is not at the boundary of the current volume
1047 return (fGctrak->inwvol==0);
1050 //_____________________________________________________________________________
1051 Bool_t TGeant3::IsTrackEntering() const
1054 // True if this is the first step of the track in the current volume
1056 return (fGctrak->inwvol==1);
1059 //_____________________________________________________________________________
1060 Bool_t TGeant3::IsTrackExiting() const
1063 // True if this is the last step of the track in the current volume
1065 return (fGctrak->inwvol==2);
1068 //_____________________________________________________________________________
1069 Bool_t TGeant3::IsTrackOut() const
1072 // True if the track is out of the setup
1074 return (fGctrak->inwvol==3);
1077 //_____________________________________________________________________________
1078 Bool_t TGeant3::IsTrackStop() const
1081 // True if the track energy has fallen below the threshold
1083 return (fGctrak->istop==2);
1086 //_____________________________________________________________________________
1087 Int_t TGeant3::NSecondaries() const
1090 // Number of secondary particles generated in the current step
1092 return fGcking->ngkine;
1095 //_____________________________________________________________________________
1096 Int_t TGeant3::CurrentEvent() const
1099 // Number of the current event
1101 return fGcflag->idevt;
1104 //_____________________________________________________________________________
1105 void TGeant3::ProdProcess(char* proc) const
1108 // Name of the process that has produced the secondary particles
1109 // in the current step
1111 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1114 if(fGcking->ngkine>0) {
1115 for (km = 0; km < fGctrak->nmec; ++km) {
1116 for (im = 0; im < 13; ++im) {
1117 if (fGctrak->lmec[km] == ipmec[im]) {
1118 mec = fGctrak->lmec[km];
1119 if (0 < mec && mec < 31) {
1120 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1121 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1122 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1129 strcpy(proc,"UNKN");
1130 } else strcpy(proc,"NONE");
1133 //_____________________________________________________________________________
1134 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p)
1137 // Get the parameters of the secondary track number isec produced
1138 // in the current step
1141 if(-1<isec && isec<fGcking->ngkine) {
1142 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1144 x[i]=fGckin3->gpos[isec][i];
1145 p[i]=fGcking->gkin[isec][i];
1147 x[3]=fGcking->tofd[isec];
1148 p[3]=fGcking->gkin[isec][3];
1150 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1151 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1156 //_____________________________________________________________________________
1157 void TGeant3::InitLego()
1160 SetDEBU(0,0,0); //do not print a message
1163 //_____________________________________________________________________________
1164 Bool_t TGeant3::IsTrackDisappeared() const
1167 // True if the current particle has disappered
1168 // either because it decayed or because it underwent
1169 // an inelastic collision
1171 return (fGctrak->istop==1);
1174 //_____________________________________________________________________________
1175 Bool_t TGeant3::IsTrackAlive() const
1178 // True if the current particle is alive and will continue to be
1181 return (fGctrak->istop==0);
1184 //_____________________________________________________________________________
1185 void TGeant3::StopTrack()
1188 // Stop the transport of the current particle and skip to the next
1193 //_____________________________________________________________________________
1194 void TGeant3::StopEvent()
1197 // Stop simulation of the current event and skip to the next
1202 //_____________________________________________________________________________
1203 Float_t TGeant3::MaxStep() const
1206 // Return the maximum step length in the current medium
1208 return fGctmed->stemax;
1211 //_____________________________________________________________________________
1212 void TGeant3::SetColors()
1215 // Set the colors for all the volumes
1216 // this is done sequentially for all volumes
1217 // based on the number of their medium
1220 Int_t jvolum=fGclink->jvolum;
1221 //Int_t jtmed=fGclink->jtmed;
1222 //Int_t jmate=fGclink->jmate;
1223 Int_t nvolum=fGcnum->nvolum;
1226 // Now for all the volumes
1227 for(kv=1;kv<=nvolum;kv++) {
1228 // Get the tracking medium
1229 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1231 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1233 //Float_t z=fZq[fZlq[jmate-ima]+7];
1234 // Find color number
1235 //icol = Int_t(z)%6+2;
1236 //icol = 17+Int_t(z*150./92.);
1239 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1241 Gsatt(name,"COLO",icol);
1245 //_____________________________________________________________________________
1246 void TGeant3::SetMaxStep(Float_t maxstep)
1249 // Set the maximum step allowed till the particle is in the current medium
1251 fGctmed->stemax=maxstep;
1254 //_____________________________________________________________________________
1255 void TGeant3::SetMaxNStep(Int_t maxnstp)
1258 // Set the maximum number of steps till the particle is in the current medium
1260 fGctrak->maxnst=maxnstp;
1263 //_____________________________________________________________________________
1264 Int_t TGeant3::GetMaxNStep() const
1267 // Maximum number of steps allowed in current medium
1269 return fGctrak->maxnst;
1272 //_____________________________________________________________________________
1273 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1274 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1278 // Defines a Material
1280 // kmat number assigned to the material
1281 // name material name
1282 // a atomic mass in au
1284 // dens density in g/cm3
1285 // absl absorbtion length in cm
1286 // if >=0 it is ignored and the program
1287 // calculates it, if <0. -absl is taken
1288 // radl radiation length in cm
1289 // if >=0 it is ignored and the program
1290 // calculates it, if <0. -radl is taken
1291 // buf pointer to an array of user words
1292 // nbuf number of user words
1294 Int_t jmate=fGclink->jmate;
1300 for(i=1; i<=ns; i++) {
1301 if(fZlq[jmate-i]==0) {
1307 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1308 nwbuf PASSCHARL(name));
1311 //_____________________________________________________________________________
1312 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1313 Float_t dens, Int_t nlmat, Float_t* wmat)
1316 // Defines mixture OR COMPOUND IMAT as composed by
1317 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1319 // If NLMAT > 0 then wmat contains the proportion by
1320 // weights of each basic material in the mixture.
1322 // If nlmat < 0 then WMAT contains the number of atoms
1323 // of a given kind into the molecule of the COMPOUND
1324 // In this case, WMAT in output is changed to relative
1327 Int_t jmate=fGclink->jmate;
1333 for(i=1; i<=ns; i++) {
1334 if(fZlq[jmate-i]==0) {
1340 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1343 //_____________________________________________________________________________
1344 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1345 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1346 Float_t stemax, Float_t deemax, Float_t epsil,
1347 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1350 // kmed tracking medium number assigned
1351 // name tracking medium name
1352 // nmat material number
1353 // isvol sensitive volume flag
1354 // ifield magnetic field
1355 // fieldm max. field value (kilogauss)
1356 // tmaxfd max. angle due to field (deg/step)
1357 // stemax max. step allowed
1358 // deemax max. fraction of energy lost in a step
1359 // epsil tracking precision (cm)
1360 // stmin min. step due to continuos processes (cm)
1362 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1363 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1364 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1366 Int_t jtmed=fGclink->jtmed;
1372 for(i=1; i<=ns; i++) {
1373 if(fZlq[jtmed-i]==0) {
1379 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1380 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1383 //_____________________________________________________________________________
1384 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1385 Float_t phiy, Float_t thez, Float_t phiz)
1388 // krot rotation matrix number assigned
1389 // theta1 polar angle for axis i
1390 // phi1 azimuthal angle for axis i
1391 // theta2 polar angle for axis ii
1392 // phi2 azimuthal angle for axis ii
1393 // theta3 polar angle for axis iii
1394 // phi3 azimuthal angle for axis iii
1396 // it defines the rotation matrix number irot.
1398 Int_t jrotm=fGclink->jrotm;
1404 for(i=1; i<=ns; i++) {
1405 if(fZlq[jrotm-i]==0) {
1411 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1414 //_____________________________________________________________________________
1415 void TGeant3::GetParticle(const Int_t pdg, char *name, Float_t &mass) const
1417 Int_t ipart = IdFromPDG(pdg);
1419 printf("Particle %d not in geant\n",pdg);
1421 strcpy(name,"Unknown");
1426 // Return name and mass of particle code ipart
1427 // Geant321 conventions
1430 Int_t jpart=fGclink->jpart;
1431 Int_t jpa=fZlq[jpart-ipart];
1433 for(Int_t i=1; i<6; i++) hname[i-1]=fZiq[jpa+i];
1435 strncpy(name,(char *)hname, 21);
1439 //_____________________________________________________________________________
1440 Int_t TGeant3::GetMedium() const
1443 // Return the number of the current medium
1445 return fGctmed->numed;
1448 //_____________________________________________________________________________
1449 Float_t TGeant3::Edep() const
1452 // Return the energy lost in the current step
1454 return fGctrak->destep;
1457 //_____________________________________________________________________________
1458 Float_t TGeant3::Etot() const
1461 // Return the total energy of the current track
1463 return fGctrak->getot;
1466 //_____________________________________________________________________________
1467 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1470 // Return an array of n random numbers uniformly distributed
1471 // between 0 and 1 not included
1476 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1478 // Functions from GBASE
1480 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1482 //____________________________________________________________________________
1483 void TGeant3::Gfile(const char *filename, const char *option)
1486 // Routine to open a GEANT/RZ data base.
1488 // LUN logical unit number associated to the file
1490 // CHFILE RZ file name
1492 // CHOPT is a character string which may be
1493 // N To create a new file
1494 // U to open an existing file for update
1495 // " " to open an existing file for read only
1496 // Q The initial allocation (default 1000 records)
1497 // is given in IQUEST(10)
1498 // X Open the file in exchange format
1499 // I Read all data structures from file to memory
1500 // O Write all data structures from memory to file
1503 // If options "I" or "O" all data structures are read or
1504 // written from/to file and the file is closed.
1505 // See routine GRMDIR to create subdirectories
1506 // See routines GROUT,GRIN to write,read objects
1508 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1512 //____________________________________________________________________________
1513 void TGeant3::Gpcxyz()
1516 // Print track and volume parameters at current point
1521 //_____________________________________________________________________________
1522 void TGeant3::Ggclos()
1525 // Closes off the geometry setting.
1526 // Initializes the search list for the contents of each
1527 // volume following the order they have been positioned, and
1528 // inserting the content '0' when a call to GSNEXT (-1) has
1529 // been required by the user.
1530 // Performs the development of the JVOLUM structure for all
1531 // volumes with variable parameters, by calling GGDVLP.
1532 // Interprets the user calls to GSORD, through GGORD.
1533 // Computes and stores in a bank (next to JVOLUM mother bank)
1534 // the number of levels in the geometrical tree and the
1535 // maximum number of contents per level, by calling GGNLEV.
1536 // Sets status bit for CONCAVE volumes, through GGCAVE.
1537 // Completes the JSET structure with the list of volume names
1538 // which identify uniquely a given physical detector, the
1539 // list of bit numbers to pack the corresponding volume copy
1540 // numbers, and the generic path(s) in the JVOLUM tree,
1541 // through the routine GHCLOS.
1546 //_____________________________________________________________________________
1547 void TGeant3::Glast()
1550 // Finish a Geant run
1555 //_____________________________________________________________________________
1556 void TGeant3::Gprint(const char *name)
1559 // Routine to print data structures
1560 // CHNAME name of a data structure
1564 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1567 //_____________________________________________________________________________
1568 void TGeant3::Grun()
1571 // Steering function to process one run
1576 //_____________________________________________________________________________
1577 void TGeant3::Gtrig()
1580 // Steering function to process one event
1585 //_____________________________________________________________________________
1586 void TGeant3::Gtrigc()
1589 // Clear event partition
1594 //_____________________________________________________________________________
1595 void TGeant3::Gtrigi()
1598 // Initialises event partition
1603 //_____________________________________________________________________________
1604 void TGeant3::Gwork(Int_t nwork)
1607 // Allocates workspace in ZEBRA memory
1612 //_____________________________________________________________________________
1613 void TGeant3::Gzinit()
1616 // To initialise GEANT/ZEBRA data structures
1621 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1623 // Functions from GCONS
1625 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1627 //_____________________________________________________________________________
1628 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1629 Float_t &dens, Float_t &radl, Float_t &absl,
1630 Float_t* ubuf, Int_t& nbuf)
1633 // Return parameters for material IMAT
1635 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1639 //_____________________________________________________________________________
1640 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1641 Float_t &amass, Float_t &charge, Float_t &tlife)
1644 // Return parameters for particle of type IPART
1648 gfpart(ipart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1652 //_____________________________________________________________________________
1653 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1654 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1655 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1656 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1659 // Return parameters for tracking medium NUMED
1661 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1662 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1665 //_____________________________________________________________________________
1666 void TGeant3::Gmate()
1669 // Define standard GEANT materials
1674 //_____________________________________________________________________________
1675 void TGeant3::Gpart()
1678 // Define standard GEANT particles plus selected decay modes
1679 // and branching ratios.
1684 //_____________________________________________________________________________
1685 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1687 // Defines branching ratios and decay modes for standard
1689 gsdk(ipart,bratio,mode);
1692 //_____________________________________________________________________________
1693 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1694 Float_t dens, Float_t radl, Float_t absl)
1697 // Defines a Material
1699 // kmat number assigned to the material
1700 // name material name
1701 // a atomic mass in au
1703 // dens density in g/cm3
1704 // absl absorbtion length in cm
1705 // if >=0 it is ignored and the program
1706 // calculates it, if <0. -absl is taken
1707 // radl radiation length in cm
1708 // if >=0 it is ignored and the program
1709 // calculates it, if <0. -radl is taken
1710 // buf pointer to an array of user words
1711 // nbuf number of user words
1715 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1719 //_____________________________________________________________________________
1720 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1721 Float_t dens, Int_t nlmat, Float_t *wmat)
1724 // Defines mixture OR COMPOUND IMAT as composed by
1725 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1727 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1728 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1730 // If NLMAT.LT.0 then WMAT contains the number of atoms
1731 // of a given kind into the molecule of the COMPOUND
1732 // In this case, WMAT in output is changed to relative
1735 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1738 //_____________________________________________________________________________
1739 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1740 Float_t amass, Float_t charge, Float_t tlife)
1743 // Store particle parameters
1745 // ipart particle code
1746 // name particle name
1747 // itrtyp transport method (see GEANT manual)
1748 // amass mass in GeV/c2
1749 // charge charge in electron units
1750 // tlife lifetime in seconds
1754 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1758 //_____________________________________________________________________________
1759 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1760 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1761 Float_t stemax, Float_t deemax, Float_t epsil,
1765 // NTMED Tracking medium number
1766 // NAME Tracking medium name
1767 // NMAT Material number
1768 // ISVOL Sensitive volume flag
1769 // IFIELD Magnetic field
1770 // FIELDM Max. field value (Kilogauss)
1771 // TMAXFD Max. angle due to field (deg/step)
1772 // STEMAX Max. step allowed
1773 // DEEMAX Max. fraction of energy lost in a step
1774 // EPSIL Tracking precision (cm)
1775 // STMIN Min. step due to continuos processes (cm)
1777 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1778 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1779 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1783 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1784 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1787 //_____________________________________________________________________________
1788 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1789 Float_t *absco, Float_t *effic, Float_t *rindex)
1792 // Stores the tables for UV photon tracking in medium ITMED
1793 // Please note that it is the user's responsability to
1794 // provide all the coefficients:
1797 // ITMED Tracking medium number
1798 // NPCKOV Number of bins of each table
1799 // PPCKOV Value of photon momentum (in GeV)
1800 // ABSCO Absorbtion coefficients
1801 // dielectric: absorbtion length in cm
1802 // metals : absorbtion fraction (0<=x<=1)
1803 // EFFIC Detection efficiency for UV photons
1804 // RINDEX Refraction index (if=0 metal)
1806 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1809 //_____________________________________________________________________________
1810 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1813 // To change the value of cut or mechanism "CHPAR"
1814 // to a new value PARVAL for tracking medium ITMED
1815 // The data structure JTMED contains the standard tracking
1816 // parameters (CUTS and flags to control the physics processes) which
1817 // are used by default for all tracking media. It is possible to
1818 // redefine individually with GSTPAR any of these parameters for a
1819 // given tracking medium.
1820 // ITMED tracking medium number
1821 // CHPAR is a character string (variable name)
1822 // PARVAL must be given as a floating point.
1824 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1827 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1829 // Functions from GCONS
1831 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1833 //_____________________________________________________________________________
1834 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1837 // Storing/Retrieving Vertex and Track parameters
1838 // ----------------------------------------------
1840 // Stores vertex parameters.
1841 // VERT array of (x,y,z) position of the vertex
1842 // NTBEAM beam track number origin of the vertex
1843 // =0 if none exists
1844 // NTTARG target track number origin of the vertex
1845 // UBUF user array of NUBUF floating point numbers
1847 // NVTX new vertex number (=0 in case of error).
1848 // Prints vertex parameters.
1849 // IVTX for vertex IVTX.
1850 // (For all vertices if IVTX=0)
1851 // Stores long life track parameters.
1852 // PLAB components of momentum
1853 // IPART type of particle (see GSPART)
1854 // NV vertex number origin of track
1855 // UBUF array of NUBUF floating point user parameters
1857 // NT track number (if=0 error).
1858 // Retrieves long life track parameters.
1859 // ITRA track number for which parameters are requested
1860 // VERT vector origin of the track
1861 // PVERT 4 momentum components at the track origin
1862 // IPART particle type (=0 if track ITRA does not exist)
1863 // NVERT vertex number origin of the track
1864 // UBUF user words stored in GSKINE.
1865 // Prints initial track parameters.
1866 // ITRA for track ITRA
1867 // (For all tracks if ITRA=0)
1871 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1874 //_____________________________________________________________________________
1875 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1879 // Retrieves the parameter of a vertex bank
1880 // Vertex is generated from tracks NTBEAM NTTARG
1881 // NVTX is the new vertex number
1885 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1888 //_____________________________________________________________________________
1889 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1893 // Store kinematics of track NT into data structure
1894 // Track is coming from vertex NV
1897 gskine(plab, ipart, nv, buf, nwbuf, nt);
1901 //_____________________________________________________________________________
1902 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1906 // Creates a new vertex bank
1907 // Vertex is generated from tracks NTBEAM NTTARG
1908 // NVTX is the new vertex number
1911 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1915 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1917 // Functions from GPHYS
1919 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1921 //_____________________________________________________________________________
1922 void TGeant3::Gphysi()
1925 // Initialise material constants for all the physics
1926 // mechanisms used by GEANT
1931 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1933 // Functions from GTRAK
1935 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1937 //_____________________________________________________________________________
1938 void TGeant3::Gdebug()
1941 // Debug the current step
1946 //_____________________________________________________________________________
1947 void TGeant3::Gekbin()
1950 // To find bin number in kinetic energy table
1951 // stored in ELOW(NEKBIN)
1956 //_____________________________________________________________________________
1957 void TGeant3::Gfinds()
1960 // Returns the set/volume parameters corresponding to
1961 // the current space point in /GCTRAK/
1962 // and fill common /GCSETS/
1964 // IHSET user set identifier
1965 // IHDET user detector identifier
1966 // ISET set number in JSET
1967 // IDET detector number in JS=LQ(JSET-ISET)
1968 // IDTYPE detector type (1,2)
1969 // NUMBV detector volume numbers (array of length NVNAME)
1970 // NVNAME number of volume levels
1975 //_____________________________________________________________________________
1976 void TGeant3::Gsking(Int_t igk)
1979 // Stores in stack JSTAK either the IGKth track of /GCKING/,
1980 // or the NGKINE tracks when IGK is 0.
1985 //_____________________________________________________________________________
1986 void TGeant3::Gskpho(Int_t igk)
1989 // Stores in stack JSTAK either the IGKth Cherenkov photon of
1990 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
1995 //_____________________________________________________________________________
1996 void TGeant3::Gsstak(Int_t iflag)
1999 // Stores in auxiliary stack JSTAK the particle currently
2000 // described in common /GCKINE/.
2002 // On request, creates also an entry in structure JKINE :
2004 // 0 : No entry in JKINE structure required (user)
2005 // 1 : New entry in JVERTX / JKINE structures required (user)
2006 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2007 // 2 : Entry in JKINE structure exists already (from GTREVE)
2012 //_____________________________________________________________________________
2013 void TGeant3::Gsxyz()
2016 // Store space point VECT in banks JXYZ
2021 //_____________________________________________________________________________
2022 void TGeant3::Gtrack()
2025 // Controls tracking of current particle
2030 //_____________________________________________________________________________
2031 void TGeant3::Gtreve()
2034 // Controls tracking of all particles belonging to the current event
2039 //_____________________________________________________________________________
2040 void TGeant3::Gtreve_root()
2043 // Controls tracking of all particles belonging to the current event
2048 //_____________________________________________________________________________
2049 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2052 // To generate a vector RVECV of LEN random numbers
2053 // Copy of the CERN Library routine RANECU
2057 //_____________________________________________________________________________
2058 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2059 const Text_t *chopt)
2062 // To set/retrieve the seed of the random number generator
2064 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2067 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2069 // Functions from GDRAW
2071 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2073 //_____________________________________________________________________________
2074 void TGeant3::Gdxyz(Int_t it)
2077 // Draw the points stored with Gsxyz relative to track it
2082 //_____________________________________________________________________________
2083 void TGeant3::Gdcxyz()
2086 // Draw the position of the current track
2091 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2093 // Functions from GGEOM
2095 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2097 //_____________________________________________________________________________
2098 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2101 // Computes coordinates XM (Master Reference System
2102 // knowing the coordinates XD (Detector Ref System)
2103 // The local reference system can be initialized by
2104 // - the tracking routines and GDTOM used in GUSTEP
2105 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2106 // (inverse routine is GMTOD)
2108 // If IFLAG=1 convert coordinates
2109 // IFLAG=2 convert direction cosinus
2111 gdtom(xd, xm, iflag);
2114 //_____________________________________________________________________________
2115 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2119 // Loads the top part of the Volume tree in LVOLS (IVO's),
2120 // LINDX (IN indices) for a given volume defined through
2121 // its name IUDET and number IUNUM.
2123 // The routine stores only upto the last level where JVOLUM
2124 // data structure is developed. If there is no development
2125 // above the current level, it returns NLEV zero.
2127 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2130 //_____________________________________________________________________________
2131 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2134 // Finds in which volume/medium the point X is, and updates the
2135 // common /GCVOLU/ and the structure JGPAR accordingly.
2137 // NUMED returns the tracking medium number, or 0 if point is
2138 // outside the experimental setup.
2143 //_____________________________________________________________________________
2144 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2147 // Computes coordinates XD (in DRS)
2148 // from known coordinates XM in MRS
2149 // The local reference system can be initialized by
2150 // - the tracking routines and GMTOD used in GUSTEP
2151 // - a call to GMEDIA(XM,NUMED)
2152 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2153 // (inverse routine is GDTOM)
2155 // If IFLAG=1 convert coordinates
2156 // IFLAG=2 convert direction cosinus
2158 gmtod(xm, xd, iflag);
2161 //_____________________________________________________________________________
2162 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2166 // Create a new volume by dividing an existing one
2169 // MOTHER Mother volume name
2170 // NDIV Number of divisions
2173 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2174 // It divides a previously defined volume.
2179 Vname(mother,vmother);
2180 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2181 PASSCHARL(vmother));
2184 //_____________________________________________________________________________
2185 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2186 Int_t iaxis, Float_t c0i, Int_t numed)
2189 // Create a new volume by dividing an existing one
2191 // Divides mother into ndiv divisions called name
2192 // along axis iaxis starting at coordinate value c0.
2193 // the new volume created will be medium number numed.
2198 Vname(mother,vmother);
2199 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2200 PASSCHARL(vname) PASSCHARL(vmother));
2203 //_____________________________________________________________________________
2204 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2205 Int_t iaxis, Int_t numed)
2208 // Create a new volume by dividing an existing one
2213 Vname(mother,vmother);
2214 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2215 PASSCHARL(vname) PASSCHARL(vmother));
2218 //_____________________________________________________________________________
2219 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2220 Int_t iaxis, Float_t c0, Int_t numed)
2223 // Create a new volume by dividing an existing one
2228 Vname(mother,vmother);
2229 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2230 PASSCHARL(vname) PASSCHARL(vmother));
2233 //_____________________________________________________________________________
2234 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2235 Int_t iaxis, Int_t numed, Int_t ndvmx)
2238 // Create a new volume by dividing an existing one
2240 // Divides MOTHER into divisions called NAME along
2241 // axis IAXIS in steps of STEP. If not exactly divisible
2242 // will make as many as possible and will centre them
2243 // with respect to the mother. Divisions will have medium
2244 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2245 // NDVMX is the expected maximum number of divisions
2246 // (If 0, no protection tests are performed)
2251 Vname(mother,vmother);
2252 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2253 PASSCHARL(vname) PASSCHARL(vmother));
2256 //_____________________________________________________________________________
2257 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2258 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2261 // Create a new volume by dividing an existing one
2263 // Divides MOTHER into divisions called NAME along
2264 // axis IAXIS starting at coordinate value C0 with step
2266 // The new volume created will have medium number NUMED.
2267 // If NUMED is 0, NUMED of mother is taken.
2268 // NDVMX is the expected maximum number of divisions
2269 // (If 0, no protection tests are performed)
2274 Vname(mother,vmother);
2275 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2276 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2279 //_____________________________________________________________________________
2280 void TGeant3::Gsord(const char *name, Int_t iax)
2283 // Flags volume CHNAME whose contents will have to be ordered
2284 // along axis IAX, by setting the search flag to -IAX
2288 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2289 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2290 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2291 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2292 // IAX = 6 PHI (PHI=0 => X axis)
2293 // IAX = 7 THETA (THETA=0 => Z axis)
2297 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2300 //_____________________________________________________________________________
2301 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2302 Float_t y, Float_t z, Int_t irot, const char *konly)
2305 // Position a volume into an existing one
2308 // NUMBER Copy number of the volume
2309 // MOTHER Mother volume name
2310 // X X coord. of the volume in mother ref. sys.
2311 // Y Y coord. of the volume in mother ref. sys.
2312 // Z Z coord. of the volume in mother ref. sys.
2313 // IROT Rotation matrix number w.r.t. mother ref. sys.
2314 // ONLY ONLY/MANY flag
2316 // It positions a previously defined volume in the mother.
2321 Vname(mother,vmother);
2322 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2323 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2327 //_____________________________________________________________________________
2328 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2329 Float_t x, Float_t y, Float_t z, Int_t irot,
2330 const char *konly, Float_t *upar, Int_t np )
2333 // Place a copy of generic volume NAME with user number
2334 // NR inside MOTHER, with its parameters UPAR(1..NP)
2339 Vname(mother,vmother);
2340 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2341 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2345 //_____________________________________________________________________________
2346 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2347 Float_t phi2, Float_t theta3, Float_t phi3)
2350 // nmat Rotation matrix number
2351 // THETA1 Polar angle for axis I
2352 // PHI1 Azimuthal angle for axis I
2353 // THETA2 Polar angle for axis II
2354 // PHI2 Azimuthal angle for axis II
2355 // THETA3 Polar angle for axis III
2356 // PHI3 Azimuthal angle for axis III
2358 // It defines the rotation matrix number IROT.
2360 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2363 //_____________________________________________________________________________
2364 void TGeant3::Gprotm(Int_t nmat)
2367 // To print rotation matrices structure JROTM
2368 // nmat Rotation matrix number
2373 //_____________________________________________________________________________
2374 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2375 Float_t *upar, Int_t npar)
2379 // SHAPE Volume type
2380 // NUMED Tracking medium number
2381 // NPAR Number of shape parameters
2382 // UPAR Vector containing shape parameters
2384 // It creates a new volume in the JVOLUM data structure.
2390 Vname(shape,vshape);
2391 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2392 PASSCHARL(vname) PASSCHARL(vshape));
2396 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2398 // T H E D R A W I N G P A C K A G E
2399 // ======================================
2400 // Drawing functions. These functions allow the visualization in several ways
2401 // of the volumes defined in the geometrical data structure. It is possible
2402 // to draw the logical tree of volumes belonging to the detector (DTREE),
2403 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2404 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2405 // these commands when the hidden line removal option is activated; in
2406 // this case, the volumes can be also either translated in the space
2407 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2408 // possible to fill the surfaces of the volumes
2409 // with solid colours when the shading option (SHAD) is activated.
2410 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2411 // of the detectors or to scan physical events as well.
2412 // Finally, the command MOVE will allow the rotation, translation and zooming
2413 // on real time parts of the detectors or tracks and hits of a simulated event.
2414 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2415 // the drawing is performed by the Geant ray-tracing;
2416 // automatically, the color is assigned according to the tracking medium of each
2417 // volume and the volumes with a density lower/equal than the air are considered
2418 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2419 // the user can set color and visibility for the desired volumes via the command
2420 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2421 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2422 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2423 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2424 // first case, we assume that the first mother volume of the tree is a box with
2425 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2426 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2427 // second case, the distance between the observer and the origin of the world
2428 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2429 // or telescopic effects can be achieved changing the scale factors in the command
2430 // (DRAW). When the final picture does not occupy the full window,
2431 // mapping the space before tracing can speed up the drawing, but can also
2432 // produce less precise results; values from 1 to 4 are allowed in the command
2433 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2434 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2435 // The command (VALCUT) allows the cutting of the detector by three planes
2436 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2437 // SATT for any desired volume and can assume values from 0 to 7; it determines
2438 // the different light processing to be performed for different materials:
2439 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2440 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2441 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2442 // is 0.9) and the observer is assumed to have a light source (therefore he will
2443 // produce parallel light in the case of parallel view and point-like-source
2444 // light in the case of perspective view).
2446 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2448 //_____________________________________________________________________________
2449 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2453 // IOPT Name of the attribute to be set
2454 // IVAL Value to which the attribute is to be set
2456 // name= "*" stands for all the volumes.
2457 // iopt can be chosen among the following :
2459 // WORK 0=volume name is inactive for the tracking
2460 // 1=volume name is active for the tracking (default)
2462 // SEEN 0=volume name is invisible
2463 // 1=volume name is visible (default)
2464 // -1=volume invisible with all its descendants in the tree
2465 // -2=volume visible but not its descendants in the tree
2467 // LSTY line style 1,2,3,... (default=1)
2468 // LSTY=7 will produce a very precise approximation for
2469 // revolution bodies.
2471 // LWID line width -7,...,1,2,3,..7 (default=1)
2472 // LWID<0 will act as abs(LWID) was set for the volume
2473 // and for all the levels below it. When SHAD is 'ON', LWID
2474 // represent the linewidth of the scan lines filling the surfaces
2475 // (whereas the FILL value represent their number). Therefore
2476 // tuning this parameter will help to obtain the desired
2477 // quality/performance ratio.
2479 // COLO colour code -166,...,1,2,..166 (default=1)
2481 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2482 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2483 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2484 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2485 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2486 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2487 // colour=n*10+m, m=1,2,...9, will produce the same colour
2488 // as 'n', but with increasing luminosity according to 'm';
2489 // COLO<0 will act as if abs(COLO) was set for the volume
2490 // and for all the levels below it.
2491 // When for a volume the attribute FILL is > 1 (and the
2492 // option SHAD is on), the ABS of its colour code must be < 8
2493 // because an automatic shading of its faces will be
2496 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2497 // when option SHAD is "on" the FILL attribute of any
2498 // volume can be set different from 0 (normal drawing);
2499 // if it is set to 1, the faces of such volume will be filled
2500 // with solid colours; if ABS(FILL) is > 1, then a light
2501 // source is placed along the observer line, and the faces of
2502 // such volumes will be painted by colours whose luminosity
2503 // will depend on the amount of light reflected;
2504 // if ABS(FILL) = 1, then it is possible to use all the 166
2505 // colours of the colour table, becouse the automatic shading
2506 // is not performed;
2507 // for increasing values of FILL the drawing will be performed
2508 // with higher and higher resolution improving the quality (the
2509 // number of scan lines used to fill the faces increases with FILL);
2510 // it is possible to set different values of FILL
2511 // for different volumes, in order to optimize at the same time
2512 // the performance and the quality of the picture;
2513 // FILL<0 will act as if abs(FILL) was set for the volume
2514 // and for all the levels below it.
2515 // This kind of drawing can be saved in 'picture files'
2516 // or in view banks.
2517 // 0=drawing without fill area
2518 // 1=faces filled with solid colours and resolution = 6
2519 // 2=lowest resolution (very fast)
2520 // 3=default resolution
2521 // 4=.................
2522 // 5=.................
2523 // 6=.................
2525 // Finally, if a coloured background is desired, the FILL
2526 // attribute for the first volume of the tree must be set
2527 // equal to -abs(colo), colo being >0 and <166.
2529 // SET set number associated to volume name
2530 // DET detector number associated to volume name
2531 // DTYP detector type (1,2)
2538 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2542 //_____________________________________________________________________________
2543 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2544 Int_t& natt, Float_t* par, Float_t* att)
2547 // Find the parameters of a volume
2549 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2553 //_____________________________________________________________________________
2554 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2557 // Check the parameters of a shape
2559 gckpar(ish,npar,par);
2562 //_____________________________________________________________________________
2563 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2566 // Check the parameters of a tracking medium
2568 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2571 //_____________________________________________________________________________
2572 void TGeant3::Gdelete(Int_t iview)
2575 // IVIEW View number
2577 // It deletes a view bank from memory.
2582 //_____________________________________________________________________________
2583 void TGeant3::Gdopen(Int_t iview)
2586 // IVIEW View number
2588 // When a drawing is very complex and requires a long time to be
2589 // executed, it can be useful to store it in a view bank: after a
2590 // call to DOPEN and the execution of the drawing (nothing will
2591 // appear on the screen), and after a necessary call to DCLOSE,
2592 // the contents of the bank can be displayed in a very fast way
2593 // through a call to DSHOW; therefore, the detector can be easily
2594 // zoomed many times in different ways. Please note that the pictures
2595 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2602 //_____________________________________________________________________________
2603 void TGeant3::Gdclose()
2606 // It closes the currently open view bank; it must be called after the
2607 // end of the drawing to be stored.
2612 //_____________________________________________________________________________
2613 void TGeant3::Gdshow(Int_t iview)
2616 // IVIEW View number
2618 // It shows on the screen the contents of a view bank. It
2619 // can be called after a view bank has been closed.
2624 //_____________________________________________________________________________
2625 void TGeant3::Gdopt(const char *name,const char *value)
2629 // VALUE Option value
2631 // To set/modify the drawing options.
2634 // THRZ ON Draw tracks in R vs Z
2635 // OFF (D) Draw tracks in X,Y,Z
2638 // PROJ PARA (D) Parallel projection
2640 // TRAK LINE (D) Trajectory drawn with lines
2641 // POIN " " with markers
2642 // HIDE ON Hidden line removal using the CG package
2643 // OFF (D) No hidden line removal
2644 // SHAD ON Fill area and shading of surfaces.
2645 // OFF (D) Normal hidden line removal.
2646 // RAYT ON Ray-tracing on.
2647 // OFF (D) Ray-tracing off.
2648 // EDGE OFF Does not draw contours when shad is on.
2649 // ON (D) Normal shading.
2650 // MAPP 1,2,3,4 Mapping before ray-tracing.
2651 // 0 (D) No mapping.
2652 // USER ON User graphics options in the raytracing.
2653 // OFF (D) Automatic graphics options.
2659 Vname(value,vvalue);
2660 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2664 //_____________________________________________________________________________
2665 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2666 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2671 // THETA Viewing angle theta (for 3D projection)
2672 // PHI Viewing angle phi (for 3D projection)
2673 // PSI Viewing angle psi (for 2D rotation)
2674 // U0 U-coord. (horizontal) of volume origin
2675 // V0 V-coord. (vertical) of volume origin
2676 // SU Scale factor for U-coord.
2677 // SV Scale factor for V-coord.
2679 // This function will draw the volumes,
2680 // selected with their graphical attributes, set by the Gsatt
2681 // facility. The drawing may be performed with hidden line removal
2682 // and with shading effects according to the value of the options HIDE
2683 // and SHAD; if the option SHAD is ON, the contour's edges can be
2684 // drawn or not. If the option HIDE is ON, the detector can be
2685 // exploded (BOMB), clipped with different shapes (CVOL), and some
2686 // of its parts can be shifted from their original
2687 // position (SHIFT). When HIDE is ON, if
2688 // the drawing requires more than the available memory, the program
2689 // will evaluate and display the number of missing words
2690 // (so that the user can increase the
2691 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2692 // the program will print messages about the memory used and
2693 // statistics on the volumes' visibility.
2694 // The following commands will produce the drawing of a green
2695 // volume, specified by NAME, without using the hidden line removal
2696 // technique, using the hidden line removal technique,
2697 // with different linewidth and colour (red), with
2698 // solid colour, with shading of surfaces, and without edges.
2699 // Finally, some examples are given for the ray-tracing. (A possible
2700 // string for the NAME of the volume can be found using the command DTREE).
2706 if (fGcvdma->raytra != 1) {
2707 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2709 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2713 //_____________________________________________________________________________
2714 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2715 Float_t v0,Float_t ul,Float_t vl)
2720 // CUTVAL Cut plane distance from the origin along the axis
2722 // U0 U-coord. (horizontal) of volume origin
2723 // V0 V-coord. (vertical) of volume origin
2724 // SU Scale factor for U-coord.
2725 // SV Scale factor for V-coord.
2727 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2728 // and placed at the distance cutval from the origin.
2729 // The resulting picture is seen from the the same axis.
2730 // When HIDE Mode is ON, it is possible to get the same effect with
2731 // the CVOL/BOX function.
2737 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2740 //_____________________________________________________________________________
2741 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2742 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2743 Float_t v0,Float_t ul,Float_t vl)
2747 // CUTTHE Theta angle of the line normal to cut plane
2748 // CUTPHI Phi angle of the line normal to cut plane
2749 // CUTVAL Cut plane distance from the origin along the axis
2751 // THETA Viewing angle theta (for 3D projection)
2752 // PHI Viewing angle phi (for 3D projection)
2753 // U0 U-coord. (horizontal) of volume origin
2754 // V0 V-coord. (vertical) of volume origin
2755 // SU Scale factor for U-coord.
2756 // SV Scale factor for V-coord.
2758 // The cut plane is normal to the line given by the cut angles
2759 // cutthe and cutphi and placed at the distance cutval from the origin.
2760 // The resulting picture is seen from the viewing angles theta,phi.
2766 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2770 //_____________________________________________________________________________
2771 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2776 // ISEL Option flag D=111110
2778 // CHRSIZ Character size (cm) of title NAME D=0.6
2781 // 0 to have only the header lines
2782 // xxxxx1 to add the text name centered on top of header
2783 // xxxx1x to add global detector name (first volume) on left
2784 // xxx1xx to add date on right
2785 // xx1xxx to select thick characters for text on top of header
2786 // x1xxxx to add the text 'EVENT NR x' on top of header
2787 // 1xxxxx to add the text 'RUN NR x' on top of header
2788 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2789 // i.e. they generate overwritten text.
2791 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2794 //_____________________________________________________________________________
2795 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2798 // Draw a 2D-man at position (U0,V0)
2800 // U U-coord. (horizontal) of the centre of man' R
2801 // V V-coord. (vertical) of the centre of man' R
2802 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2804 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2805 // It superimposes the picure of a man or of a woman, chosen among
2806 // three different ones, with the same scale factors as the detector
2807 // in the current drawing.
2810 if (opt.Contains("WM1")) {
2812 } else if (opt.Contains("WM3")) {
2814 } else if (opt.Contains("WM2")) {
2821 //_____________________________________________________________________________
2822 void TGeant3::Gdspec(const char *name)
2827 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2828 // its geometrical specifications. The 3D drawing will
2829 // be performed according the current values of the options HIDE and
2830 // SHAD and according the current SetClipBox clipping parameters for that
2837 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2840 //_____________________________________________________________________________
2841 void TGeant3::DrawOneSpec(const char *name)
2844 // Function called when one double-clicks on a volume name
2845 // in a TPavelabel drawn by Gdtree.
2847 THIGZ *higzSave = higz;
2848 higzSave->SetName("higzSave");
2849 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2850 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2851 if (higzSpec) higz = higzSpec;
2852 else higzSpec = new THIGZ(defSize);
2853 higzSpec->SetName("higzSpec");
2858 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2861 higzSave->SetName("higz");
2865 //_____________________________________________________________________________
2866 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2870 // LEVMAX Depth level
2873 // This function draws the logical tree,
2874 // Each volume in the tree is represented by a TPaveTree object.
2875 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2876 // Use TPaveTree pop-up menu to select:
2879 // - drawing tree of parent
2885 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2889 //_____________________________________________________________________________
2890 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2894 // LEVMAX Depth level
2897 // This function draws the logical tree of the parent of name.
2901 // Scan list of volumes in JVOLUM
2903 Int_t gname, i, jvo, in, nin, jin, num;
2904 strncpy((char *) &gname, name, 4);
2905 for(i=1; i<=fGcnum->nvolum; i++) {
2906 jvo = fZlq[fGclink->jvolum-i];
2907 nin = Int_t(fZq[jvo+3]);
2908 if (nin == -1) nin = 1;
2909 for (in=1;in<=nin;in++) {
2911 num = Int_t(fZq[jin+2]);
2912 if(gname == fZiq[fGclink->jvolum+num]) {
2913 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2915 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2923 //_____________________________________________________________________________
2924 void TGeant3::SetABAN(Int_t par)
2927 // par = 1 particles will be stopped according to their residual
2928 // range if they are not in a sensitive material and are
2929 // far enough from the boundary
2930 // 0 particles are transported normally
2932 fGcphys->dphys1 = par;
2936 //_____________________________________________________________________________
2937 void TGeant3::SetANNI(Int_t par)
2940 // To control positron annihilation.
2941 // par =0 no annihilation
2942 // =1 annihilation. Decays processed.
2943 // =2 annihilation. No decay products stored.
2945 fGcphys->ianni = par;
2949 //_____________________________________________________________________________
2950 void TGeant3::SetAUTO(Int_t par)
2953 // To control automatic calculation of tracking medium parameters:
2954 // par =0 no automatic calculation;
2955 // =1 automati calculation.
2957 fGctrak->igauto = par;
2961 //_____________________________________________________________________________
2962 void TGeant3::SetBOMB(Float_t boom)
2965 // BOOM : Exploding factor for volumes position
2967 // To 'explode' the detector. If BOOM is positive (values smaller
2968 // than 1. are suggested, but any value is possible)
2969 // all the volumes are shifted by a distance
2970 // proportional to BOOM along the direction between their centre
2971 // and the origin of the MARS; the volumes which are symmetric
2972 // with respect to this origin are simply not shown.
2973 // BOOM equal to 0 resets the normal mode.
2974 // A negative (greater than -1.) value of
2975 // BOOM will cause an 'implosion'; for even lower values of BOOM
2976 // the volumes' positions will be reflected respect to the origin.
2977 // This command can be useful to improve the 3D effect for very
2978 // complex detectors. The following commands will make explode the
2985 //_____________________________________________________________________________
2986 void TGeant3::SetBREM(Int_t par)
2989 // To control bremstrahlung.
2990 // par =0 no bremstrahlung
2991 // =1 bremstrahlung. Photon processed.
2992 // =2 bremstrahlung. No photon stored.
2994 fGcphys->ibrem = par;
2998 //_____________________________________________________________________________
2999 void TGeant3::SetCKOV(Int_t par)
3002 // To control Cerenkov production
3003 // par =0 no Cerenkov;
3005 // =2 Cerenkov with primary stopped at each step.
3007 fGctlit->itckov = par;
3011 //_____________________________________________________________________________
3012 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3013 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3016 // The hidden line removal technique is necessary to visualize properly
3017 // very complex detectors. At the same time, it can be useful to visualize
3018 // the inner elements of a detector in detail. This function allows
3019 // subtractions (via boolean operation) of BOX shape from any part of
3020 // the detector, therefore showing its inner contents.
3021 // If "*" is given as the name of the
3022 // volume to be clipped, all volumes are clipped by the given box.
3023 // A volume can be clipped at most twice.
3024 // if a volume is explicitely clipped twice,
3025 // the "*" will not act on it anymore. Giving "." as the name
3026 // of the volume to be clipped will reset the clipping.
3028 // NAME Name of volume to be clipped
3030 // XMIN Lower limit of the Shape X coordinate
3031 // XMAX Upper limit of the Shape X coordinate
3032 // YMIN Lower limit of the Shape Y coordinate
3033 // YMAX Upper limit of the Shape Y coordinate
3034 // ZMIN Lower limit of the Shape Z coordinate
3035 // ZMAX Upper limit of the Shape Z coordinate
3037 // This function performs a boolean subtraction between the volume
3038 // NAME and a box placed in the MARS according the values of the given
3044 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3047 //_____________________________________________________________________________
3048 void TGeant3::SetCOMP(Int_t par)
3051 // To control Compton scattering
3052 // par =0 no Compton
3053 // =1 Compton. Electron processed.
3054 // =2 Compton. No electron stored.
3057 fGcphys->icomp = par;
3060 //_____________________________________________________________________________
3061 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3062 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3063 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3064 Float_t ppcutm, Float_t tofmax)
3067 // CUTGAM Cut for gammas D=0.001
3068 // CUTELE Cut for electrons D=0.001
3069 // CUTHAD Cut for charged hadrons D=0.01
3070 // CUTNEU Cut for neutral hadrons D=0.01
3071 // CUTMUO Cut for muons D=0.01
3072 // BCUTE Cut for electron brems. D=-1.
3073 // BCUTM Cut for muon brems. D=-1.
3074 // DCUTE Cut for electron delta-rays D=-1.
3075 // DCUTM Cut for muon delta-rays D=-1.
3076 // PPCUTM Cut for e+e- pairs by muons D=0.01
3077 // TOFMAX Time of flight cut D=1.E+10
3079 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3080 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3082 // If one of the parameters from CUTGAM to PPCUTM included
3083 // is modified, cross-sections and energy loss tables must be
3084 // recomputed via the function Gphysi.
3086 fGccuts->cutgam = cutgam;
3087 fGccuts->cutele = cutele;
3088 fGccuts->cutneu = cutneu;
3089 fGccuts->cuthad = cuthad;
3090 fGccuts->cutmuo = cutmuo;
3091 fGccuts->bcute = bcute;
3092 fGccuts->bcutm = bcutm;
3093 fGccuts->dcute = dcute;
3094 fGccuts->dcutm = dcutm;
3095 fGccuts->ppcutm = ppcutm;
3096 fGccuts->tofmax = tofmax;
3099 //_____________________________________________________________________________
3100 void TGeant3::SetDCAY(Int_t par)
3103 // To control Decay mechanism.
3104 // par =0 no decays.
3105 // =1 Decays. secondaries processed.
3106 // =2 Decays. No secondaries stored.
3108 fGcphys->idcay = par;
3112 //_____________________________________________________________________________
3113 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3116 // Set the debug flag and frequency
3117 // Selected debug output will be printed from
3118 // event emin to even emax each emod event
3120 fGcflag->idemin = emin;
3121 fGcflag->idemax = emax;
3122 fGcflag->itest = emod;
3126 //_____________________________________________________________________________
3127 void TGeant3::SetDRAY(Int_t par)
3130 // To control delta rays mechanism.
3131 // par =0 no delta rays.
3132 // =1 Delta rays. secondaries processed.
3133 // =2 Delta rays. No secondaries stored.
3135 fGcphys->idray = par;
3138 //_____________________________________________________________________________
3139 void TGeant3::SetHADR(Int_t par)
3142 // To control hadronic interactions.
3143 // par =0 no hadronic interactions.
3144 // =1 Hadronic interactions. secondaries processed.
3145 // =2 Hadronic interactions. No secondaries stored.
3147 fGcphys->ihadr = par;
3150 //_____________________________________________________________________________
3151 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3152 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3153 Float_t xk8, Float_t xk9, Float_t xk10)
3156 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3157 // Their meaning is user defined
3159 fGckine->ikine = kine;
3160 fGckine->pkine[0] = xk1;
3161 fGckine->pkine[1] = xk2;
3162 fGckine->pkine[2] = xk3;
3163 fGckine->pkine[3] = xk4;
3164 fGckine->pkine[4] = xk5;
3165 fGckine->pkine[5] = xk6;
3166 fGckine->pkine[6] = xk7;
3167 fGckine->pkine[7] = xk8;
3168 fGckine->pkine[8] = xk9;
3169 fGckine->pkine[9] = xk10;
3172 //_____________________________________________________________________________
3173 void TGeant3::SetLOSS(Int_t par)
3176 // To control energy loss.
3177 // par =0 no energy loss;
3178 // =1 restricted energy loss fluctuations;
3179 // =2 complete energy loss fluctuations;
3181 // =4 no energy loss fluctuations.
3182 // If the value ILOSS is changed, then cross-sections and energy loss
3183 // tables must be recomputed via the command 'PHYSI'.
3185 fGcphys->iloss = par;
3189 //_____________________________________________________________________________
3190 void TGeant3::SetMULS(Int_t par)
3193 // To control multiple scattering.
3194 // par =0 no multiple scattering.
3195 // =1 Moliere or Coulomb scattering.
3196 // =2 Moliere or Coulomb scattering.
3197 // =3 Gaussian scattering.
3199 fGcphys->imuls = par;
3203 //_____________________________________________________________________________
3204 void TGeant3::SetMUNU(Int_t par)
3207 // To control muon nuclear interactions.
3208 // par =0 no muon-nuclear interactions.
3209 // =1 Nuclear interactions. Secondaries processed.
3210 // =2 Nuclear interactions. Secondaries not processed.
3212 fGcphys->imunu = par;
3215 //_____________________________________________________________________________
3216 void TGeant3::SetOPTI(Int_t par)
3219 // This flag controls the tracking optimisation performed via the
3221 // 1 no optimisation at all; GSORD calls disabled;
3222 // 0 no optimisation; only user calls to GSORD kept;
3223 // 1 all non-GSORDered volumes are ordered along the best axis;
3224 // 2 all volumes are ordered along the best axis.
3226 fGcopti->ioptim = par;
3229 //_____________________________________________________________________________
3230 void TGeant3::SetPAIR(Int_t par)
3233 // To control pair production mechanism.
3234 // par =0 no pair production.
3235 // =1 Pair production. secondaries processed.
3236 // =2 Pair production. No secondaries stored.
3238 fGcphys->ipair = par;
3242 //_____________________________________________________________________________
3243 void TGeant3::SetPFIS(Int_t par)
3246 // To control photo fission mechanism.
3247 // par =0 no photo fission.
3248 // =1 Photo fission. secondaries processed.
3249 // =2 Photo fission. No secondaries stored.
3251 fGcphys->ipfis = par;
3254 //_____________________________________________________________________________
3255 void TGeant3::SetPHOT(Int_t par)
3258 // To control Photo effect.
3259 // par =0 no photo electric effect.
3260 // =1 Photo effect. Electron processed.
3261 // =2 Photo effect. No electron stored.
3263 fGcphys->iphot = par;
3266 //_____________________________________________________________________________
3267 void TGeant3::SetRAYL(Int_t par)
3270 // To control Rayleigh scattering.
3271 // par =0 no Rayleigh scattering.
3274 fGcphys->irayl = par;
3277 //_____________________________________________________________________________
3278 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3282 // val New switch value
3284 // Change one element of array ISWIT(10) in /GCFLAG/
3286 if (sw <= 0 || sw > 10) return;
3287 fGcflag->iswit[sw-1] = val;
3291 //_____________________________________________________________________________
3292 void TGeant3::SetTRIG(Int_t nevents)
3295 // Set number of events to be run
3297 fGcflag->nevent = nevents;
3300 //_____________________________________________________________________________
3301 void TGeant3::SetUserDecay(Int_t pdg)
3304 // Force the decays of particles to be done with Pythia
3305 // and not with the Geant routines.
3306 // just kill pointers doing mzdrop
3308 Int_t ipart = IdFromPDG(pdg);
3310 printf("Particle %d not in geant\n",pdg);
3313 Int_t jpart=fGclink->jpart;
3314 Int_t jpa=fZlq[jpart-ipart];
3317 Int_t jpa1=fZlq[jpa-1];
3319 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3320 Int_t jpa2=fZlq[jpa-2];
3322 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3326 //______________________________________________________________________________
3327 void TGeant3::Vname(const char *name, char *vname)
3330 // convert name to upper case. Make vname at least 4 chars
3332 Int_t l = strlen(name);
3335 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3336 for (i=l;i<4;i++) vname[i] = ' ';
3340 //_____________________________________________________________________________
3341 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3342 Int_t number, Int_t nlevel)
3346 // ******************************************************************
3348 // * Write out the geometry of the detector in EUCLID file format *
3350 // * filnam : will be with the extension .euc *
3351 // * topvol : volume name of the starting node *
3352 // * number : copy number of topvol (relevant for gsposp) *
3353 // * nlevel : number of levels in the tree structure *
3354 // * to be written out, starting from topvol *
3356 // * Author : M. Maire *
3358 // ******************************************************************
3360 // File filnam.tme is written out with the definitions of tracking
3361 // medias and materials.
3362 // As to restore original numbers for materials and medias, program
3363 // searches in the file euc_medi.dat and comparing main parameters of
3364 // the mat. defined inside geant and the one in file recognizes them
3365 // and is able to take number from file. If for any material or medium,
3366 // this procedure fails, ordering starts from 1.
3367 // Arrays IOTMED and IOMATE are used for this procedure
3369 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3370 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3372 Int_t i, end, itm, irm, jrm, k, nmed;
3376 char *filext, *filetme;
3377 char natmed[21], namate[21];
3378 char natmedc[21], namatec[21];
3379 char key[5], name[5], mother[5], konly[5];
3381 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3382 Int_t mlevel, numbr, natt, numed, nin, ndata;
3383 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3384 Int_t jdiv, ivin, in, jin, jvin, irot;
3385 Int_t jtm, imat, jma, flag=0, imatc;
3386 Float_t az, dens, radl, absl, a, step, x, y, z;
3387 Int_t npar, ndvmx, left;
3388 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3390 Int_t iomate[100], iotmed[100];
3391 Float_t par[50], att[20], ubuf[50];
3394 Int_t level, ndiv, iaxe;
3395 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3396 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3397 Float_t tmaxf, stemax, deemax, epsil, stmin;
3398 const char *f10000="!\n%s\n!\n";
3399 //Open the input file
3401 for(i=0;i<end;i++) if(filnam[i]=='.') {
3405 filext=new char[end+4];
3406 filetme=new char[end+4];
3407 strncpy(filext,filnam,end);
3408 strncpy(filetme,filnam,end);
3410 // *** The output filnam name will be with extension '.euc'
3411 strcpy(&filext[end],".euc");
3412 strcpy(&filetme[end],".tme");
3413 lun=fopen(filext,"w");
3415 // *** Initialisation of the working space
3416 iadvol=fGcnum->nvolum;
3417 iadtmd=iadvol+fGcnum->nvolum;
3418 iadrot=iadtmd+fGcnum->ntmed;
3419 if(fGclink->jrotm) {
3420 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3424 nwtot=iadrot+fGcnum->nrotm;
3425 qws = new float[nwtot+1];
3426 for (i=0;i<nwtot+1;i++) qws[i]=0;
3429 if(nlevel==0) mlevel=20;
3431 // *** find the top volume and put it in the stak
3432 numbr = number>0 ? number : 1;
3433 Gfpara(topvol,numbr,1,npar,natt,par,att);
3435 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3440 // *** authorized shape ?
3441 strncpy((char *)&iname, topvol, 4);
3443 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3447 jvo = fZlq[fGclink->jvolum-ivo];
3448 ish = Int_t (fZq[jvo+2]);
3450 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3457 iws[iadvol+ivo] = level;
3460 //*** flag all volumes and fill the stak
3464 // pick the next volume in stak
3466 ivo = TMath::Abs(iws[ivstak]);
3467 jvo = fZlq[fGclink->jvolum - ivo];
3469 // flag the tracking medium
3470 numed = Int_t (fZq[jvo + 4]);
3471 iws[iadtmd + numed] = 1;
3473 // get the daughters ...
3474 level = iws[iadvol+ivo];
3475 if (level < mlevel) {
3477 nin = Int_t (fZq[jvo + 3]);
3479 // from division ...
3481 jdiv = fZlq[jvo - 1];
3482 ivin = Int_t (fZq[jdiv + 2]);
3484 iws[nvstak] = -ivin;
3485 iws[iadvol+ivin] = level;
3487 // from position ...
3488 } else if (nin > 0) {
3489 for(in=1; in<=nin; in++) {
3490 jin = fZlq[jvo - in];
3491 ivin = Int_t (fZq[jin + 2 ]);
3492 jvin = fZlq[fGclink->jvolum - ivin];
3493 ish = Int_t (fZq[jvin + 2]);
3494 // authorized shape ?
3496 // not yet flagged ?
3497 if (iws[iadvol+ivin]==0) {
3500 iws[iadvol+ivin] = level;
3502 // flag the rotation matrix
3503 irot = Int_t ( fZq[jin + 4 ]);
3504 if (irot > 0) iws[iadrot+irot] = 1;
3510 // next volume in stak ?
3511 if (ivstak < nvstak) goto L10;
3513 // *** restore original material and media numbers
3514 // file euc_medi.dat is needed to compare materials and medias
3516 FILE* luncor=fopen("euc_medi.dat","r");
3519 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3520 if (iws[iadtmd+itm] > 0) {
3521 jtm = fZlq[fGclink->jtmed-itm];
3522 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3523 imat = Int_t (fZq[jtm+6]);
3524 jma = fZlq[fGclink->jmate-imat];
3526 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3529 strncpy(namate,(char *)&fZiq[jma+1],20);
3532 //** find the material original number
3535 iret=fscanf(luncor,"%4s,%130s",key,card);
3536 if(iret<=0) goto L26;
3538 if(!strcmp(key,"MATE")) {
3539 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3540 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3541 if(!strcmp(namatec,namate)) {
3542 if(az==a && zc==z && densc==dens && radlc==radl
3543 && abslc==absl && nparc==nparc) {
3546 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3548 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3552 if(strcmp(key,"END") && !flag) goto L23;
3554 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3558 //*** restore original tracking medium number
3561 iret=fscanf(luncor,"%4s,%130s",key,card);
3562 if(iret<=0) goto L26;
3564 if (!strcmp(key,"TMED")) {
3565 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3566 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3567 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3568 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3569 epsil,stmin,ubuf,&nwbuf);
3570 if(!strcmp(natmedc,natmed)) {
3571 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3574 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3577 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3581 if(strcmp(key,"END") && !flag) goto L24;
3583 printf("cannot restore original number for medium : %s\n",natmed);
3591 L26: printf("*** GWEUCL *** cannot read the data file\n");
3593 L29: if(luncor) fclose (luncor);
3596 // *** write down the tracking medium definition
3598 strcpy(card,"! Tracking medium");
3599 fprintf(lun,f10000,card);
3601 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3602 if (iws[iadtmd+itm]>0) {
3603 jtm = fZlq[fGclink->jtmed-itm];
3604 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3606 imat = Int_t (fZq[jtm+6]);
3607 jma = fZlq[fGclink->jmate-imat];
3608 //* order media from one, if comparing with database failed
3610 iotmed[itm]=++imxtmed;
3611 iomate[imat]=++imxmate;
3616 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3619 strncpy(namate,(char *)&fZiq[jma+1],20);
3622 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3626 //* *** write down the rotation matrix
3628 strcpy(card,"! Reperes");
3629 fprintf(lun,f10000,card);
3631 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3632 if (iws[iadrot+irm]>0) {
3633 jrm = fZlq[fGclink->jrotm-irm];
3634 fprintf(lun,"ROTM %3d",irm);
3635 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3640 //* *** write down the volume definition
3642 strcpy(card,"! Volumes");
3643 fprintf(lun,f10000,card);
3645 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3648 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3650 jvo = fZlq[fGclink->jvolum-ivo];
3651 ish = Int_t (fZq[jvo+2]);
3652 nmed = Int_t (fZq[jvo+4]);
3653 npar = Int_t (fZq[jvo+5]);
3655 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3656 Gckpar (ish,npar,par);
3657 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3658 for(i=0;i<(npar-1)/6+1;i++) {
3661 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3665 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3670 //* *** write down the division of volumes
3672 fprintf(lun,f10000,"! Divisions");
3673 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3674 ivo = TMath::Abs(iws[ivstak]);
3675 jvo = fZlq[fGclink->jvolum-ivo];
3676 ish = Int_t (fZq[jvo+2]);
3677 nin = Int_t (fZq[jvo+3]);
3678 //* this volume is divided ...
3681 iaxe = Int_t ( fZq[jdiv+1]);
3682 ivin = Int_t ( fZq[jdiv+2]);
3683 ndiv = Int_t ( fZq[jdiv+3]);
3686 jvin = fZlq[fGclink->jvolum-ivin];
3687 nmed = Int_t ( fZq[jvin+4]);
3688 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3690 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3692 if ((step<=0.)||(ish>=11)) {
3693 //* volume with negative parameter or gsposp or pgon ...
3694 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3695 } else if ((ndiv<=0)||(ish==10)) {
3696 //* volume with negative parameter or gsposp or para ...
3697 ndvmx = TMath::Abs(ndiv);
3698 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3699 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3701 //* normal volume : all kind of division are equivalent
3702 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3703 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3708 //* *** write down the the positionnement of volumes
3710 fprintf(lun,f10000,"! Positionnements\n");
3712 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3713 ivo = TMath::Abs(iws[ivstak]);
3714 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3716 jvo = fZlq[fGclink->jvolum-ivo];
3717 nin = Int_t( fZq[jvo+3]);
3718 //* this volume has daughters ...
3720 for (in=1;in<=nin;in++) {
3722 ivin = Int_t (fZq[jin +2]);
3723 numb = Int_t (fZq[jin +3]);
3724 irot = Int_t (fZq[jin +4]);
3728 strcpy(konly,"ONLY");
3729 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
3730 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
3732 jvin = fZlq[fGclink->jvolum-ivin];
3733 ish = Int_t (fZq[jvin+2]);
3734 //* gspos or gsposp ?
3735 ndata = fZiq[jin-1];
3737 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
3738 name,numb,mother,x,y,z,irot,konly);
3740 npar = Int_t (fZq[jin+9]);
3741 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
3742 Gckpar (ish,npar,par);
3743 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
3744 name,numb,mother,x,y,z,irot,konly,npar);
3746 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3753 fprintf(lun,"END\n");
3756 //****** write down the materials and medias *****
3758 lun=fopen(filetme,"w");
3760 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3761 if (iws[iadtmd+itm]>0) {
3762 jtm = fZlq[fGclink->jtmed-itm];
3763 strncpy(natmed,(char*)&fZiq[jtm+1],4);
3764 imat = Int_t (fZq[jtm+6]);
3765 jma = Int_t (fZlq[fGclink->jmate-imat]);
3767 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
3768 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
3769 iomate[imat],namate,a,z,dens,radl,absl,npar);
3773 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3777 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
3778 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
3779 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
3780 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
3784 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3790 fprintf(lun,"END\n");
3791 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
3792 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
3801 //_____________________________________________________________________________
3802 void TGeant3::Streamer(TBuffer &R__b)
3805 // Stream an object of class TGeant3.
3807 if (R__b.IsReading()) {
3808 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
3809 AliMC::Streamer(R__b);
3812 R__b.ReadStaticArray(fPDGCode);
3814 R__b.WriteVersion(TGeant3::IsA());
3815 AliMC::Streamer(R__b);
3818 R__b.WriteArray(fPDGCode, fNPDGCodes);