1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface Class to the Geant3.21 MonteCarlo //
7 <img src="picts/TGeant3Class.gif">
12 ///////////////////////////////////////////////////////////////////////////////
18 #include <TDatabasePDG.h>
19 #include "AliCallf77.h"
22 # define gzebra gzebra_
23 # define grfile grfile_
24 # define gpcxyz gpcxyz_
25 # define ggclos ggclos_
28 # define gcinit gcinit_
31 # define gtrigc gtrigc_
32 # define gtrigi gtrigi_
34 # define gzinit gzinit_
35 # define gfmate gfmate_
36 # define gfpart gfpart_
37 # define gftmed gftmed_
41 # define gsmate gsmate_
42 # define gsmixt gsmixt_
43 # define gspart gspart_
44 # define gstmed gstmed_
45 # define gsckov gsckov_
46 # define gstpar gstpar_
47 # define gfkine gfkine_
48 # define gfvert gfvert_
49 # define gskine gskine_
50 # define gsvert gsvert_
51 # define gphysi gphysi_
52 # define gdebug gdebug_
53 # define gekbin gekbin_
54 # define gfinds gfinds_
55 # define gsking gsking_
56 # define gskpho gskpho_
57 # define gsstak gsstak_
59 # define gtrack gtrack_
60 # define gtreve gtreve_
61 # define gtreve_root gtreve_root_
63 # define grndmq grndmq_
65 # define glmoth glmoth_
66 # define gmedia gmedia_
69 # define gsdvn2 gsdvn2_
71 # define gsdvs2 gsdvs2_
73 # define gsdvt2 gsdvt2_
76 # define gsposp gsposp_
77 # define gsrotm gsrotm_
78 # define gprotm gprotm_
79 # define gsvolu gsvolu_
80 # define gprint gprint_
81 # define gdinit gdinit_
84 # define gdrayt gdrayt_
85 # define gdrawc gdrawc_
86 # define gdrawx gdrawx_
87 # define gdhead gdhead_
88 # define gdwmn1 gdwmn1_
89 # define gdwmn2 gdwmn2_
90 # define gdwmn3 gdwmn3_
92 # define gdcxyz gdcxyz_
94 # define gdspec gdspec_
95 # define gdtree gdtree_
96 # define gdelet gdelet_
97 # define gdclos gdclos_
98 # define gdshow gdshow_
99 # define gdopen gdopen_
100 # define dzshow dzshow_
101 # define gsatt gsatt_
102 # define gfpara gfpara_
103 # define gckpar gckpar_
104 # define gckmat gckmat_
105 # define geditv geditv_
106 # define mzdrop mzdrop_
108 # define ertrak ertrak_
109 # define ertrgo ertrgo_
111 # define setbomb setbomb_
112 # define setclip setclip_
113 # define gcomad gcomad_
116 # define gzebra GZEBRA
117 # define grfile GRFILE
118 # define gpcxyz GPCXYZ
119 # define ggclos GGCLOS
122 # define gcinit GCINIT
125 # define gtrigc GTRIGC
126 # define gtrigi GTRIGI
128 # define gzinit GZINIT
129 # define gfmate GFMATE
130 # define gfpart GFPART
131 # define gftmed GFTMED
135 # define gsmate GSMATE
136 # define gsmixt GSMIXT
137 # define gspart GSPART
138 # define gstmed GSTMED
139 # define gsckov GSCKOV
140 # define gstpar GSTPAR
141 # define gfkine GFKINE
142 # define gfvert GFVERT
143 # define gskine GSKINE
144 # define gsvert GSVERT
145 # define gphysi GPHYSI
146 # define gdebug GDEBUG
147 # define gekbin GEKBIN
148 # define gfinds GFINDS
149 # define gsking GSKING
150 # define gskpho GSKPHO
151 # define gsstak GSSTAK
153 # define gtrack GTRACK
154 # define gtreve GTREVE
155 # define gtreve_root GTREVE_ROOT
157 # define grndmq GRNDMQ
159 # define glmoth GLMOTH
160 # define gmedia GMEDIA
163 # define gsdvn2 GSDVN2
165 # define gsdvs2 GSDVS2
167 # define gsdvt2 GSDVT2
170 # define gsposp GSPOSP
171 # define gsrotm GSROTM
172 # define gprotm GPROTM
173 # define gsvolu GSVOLU
174 # define gprint GPRINT
175 # define gdinit GDINIT
178 # define gdrayt GDRAYT
179 # define gdrawc GDRAWC
180 # define gdrawx GDRAWX
181 # define gdhead GDHEAD
182 # define gdwmn1 GDWMN1
183 # define gdwmn2 GDWMN2
184 # define gdwmn3 GDWMN3
186 # define gdcxyz GDCXYZ
188 # define gdfspc GDFSPC
189 # define gdspec GDSPEC
190 # define gdtree GDTREE
191 # define gdelet GDELET
192 # define gdclos GDCLOS
193 # define gdshow GDSHOW
194 # define gdopen GDOPEN
195 # define dzshow DZSHOW
197 # define gfpara GFPARA
198 # define gckpar GCKPAR
199 # define gckmat GCKMAT
200 # define geditv GEDITV
201 # define mzdrop MZDROP
203 # define ertrak ERTRAK
204 # define ertrgo ERTRGO
206 # define setbomb SETBOMB
207 # define setclip SETCLIP
208 # define gcomad GCOMAD
212 //____________________________________________________________________________
216 // Prototypes for GEANT functions
218 void type_of_call gzebra(const int&);
220 void type_of_call gpcxyz();
222 void type_of_call ggclos();
224 void type_of_call glast();
226 void type_of_call ginit();
228 void type_of_call gcinit();
230 void type_of_call grun();
232 void type_of_call gtrig();
234 void type_of_call gtrigc();
236 void type_of_call gtrigi();
238 void type_of_call gwork(const int&);
240 void type_of_call gzinit();
242 void type_of_call gmate();
244 void type_of_call gpart();
246 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
248 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
249 Int_t &, Float_t *, Int_t &);
251 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
252 Float_t &, Float_t *, Int_t &);
254 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
257 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
260 void type_of_call gphysi();
262 void type_of_call gdebug();
264 void type_of_call gekbin();
266 void type_of_call gfinds();
268 void type_of_call gsking(Int_t &);
270 void type_of_call gskpho(Int_t &);
272 void type_of_call gsstak(Int_t &);
274 void type_of_call gsxyz();
276 void type_of_call gtrack();
278 void type_of_call gtreve();
280 void type_of_call gtreve_root();
282 void type_of_call grndm(Float_t *, const Int_t &);
284 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
287 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
289 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
290 Int_t *, Int_t * DEFCHARL);
292 void type_of_call gmedia(Float_t *, Int_t &);
294 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
296 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
297 const Float_t &, const Float_t &, const Float_t &,
300 void type_of_call gprotm(const Int_t &);
302 void type_of_call grfile(const Int_t&, DEFCHARD,
303 DEFCHARD DEFCHARL DEFCHARL);
305 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
306 Float_t &, Float_t &, Float_t &, Float_t *,
309 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
310 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
312 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
313 Float_t &, Float_t &, Float_t &, Float_t &,
314 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
316 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
317 Float_t &, Float_t &, Float_t &, Float_t *,
320 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
321 Float_t &, Int_t &, Float_t * DEFCHARL);
323 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
324 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
327 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
328 Float_t &, Float_t &, Float_t &, Float_t &,
329 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
331 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
332 Float_t *absco, Float_t *effic, Float_t *rindex);
333 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
335 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
338 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
339 Int_t & DEFCHARL DEFCHARL);
341 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
344 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
345 Int_t & DEFCHARL DEFCHARL);
347 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
348 Int_t & DEFCHARL DEFCHARL);
350 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
351 Int_t &, Int_t & DEFCHARL DEFCHARL);
353 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
355 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
356 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
359 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
360 Float_t &, Int_t &, DEFCHARD,
361 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
363 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
364 Int_t & DEFCHARL DEFCHARL);
366 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
368 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
371 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
373 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
375 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
377 void type_of_call gdinit();
379 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
381 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
382 Float_t &, Float_t &, Float_t & DEFCHARL);
383 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
384 Float_t &, Float_t &, Float_t & DEFCHARL);
385 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
386 Float_t &, Float_t & DEFCHARL);
387 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
388 Float_t &, Float_t &, Float_t &, Float_t &,
390 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
391 void type_of_call gdxyz(Int_t &);
392 void type_of_call gdcxyz();
393 void type_of_call gdman(Float_t &, Float_t &);
394 void type_of_call gdwmn1(Float_t &, Float_t &);
395 void type_of_call gdwmn2(Float_t &, Float_t &);
396 void type_of_call gdwmn3(Float_t &, Float_t &);
397 void type_of_call gdspec(DEFCHARD DEFCHARL);
398 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
399 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
401 void type_of_call gdopen(Int_t &);
402 void type_of_call gdclos();
403 void type_of_call gdelet(Int_t &);
404 void type_of_call gdshow(Int_t &);
405 void type_of_call geditv(Int_t &) {;}
408 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
409 const int&, const int&, const int& DEFCHARL
412 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
414 void type_of_call setbomb(Float_t &);
415 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
416 Float_t &, Float_t & DEFCHARL);
417 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
419 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
420 const Float_t *x2, const Float_t *p2,
421 const Int_t &ipa, DEFCHARD DEFCHARL);
423 void type_of_call ertrgo();
427 // Geant3 global pointer
429 static Int_t defSize = 600;
433 //____________________________________________________________________________
437 // Default constructor
441 //____________________________________________________________________________
442 TGeant3::TGeant3(const char *title, Int_t nwgeant)
443 :AliMC("TGeant3",title)
446 // Standard constructor for TGeant3 with ZEBRA initialisation
457 // Load Address of Geant3 commons
460 // Zero number of particles
464 //____________________________________________________________________________
465 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
466 Float_t &radl, Float_t &absl) const
469 // Return the parameters of the current material during transport
473 dens = fGcmate->dens;
474 radl = fGcmate->radl;
475 absl = fGcmate->absl;
476 return 1; //this could be the number of elements in mixture
479 //____________________________________________________________________________
480 void TGeant3::DefaultRange()
483 // Set range of current drawing pad to 20x20 cm
489 higz->Range(0,0,20,20);
492 //____________________________________________________________________________
493 void TGeant3::InitHIGZ()
504 //____________________________________________________________________________
505 void TGeant3::LoadAddress()
508 // Assigns the address of the GEANT common blocks to the structures
509 // that allow their access from C++
512 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
513 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
514 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
515 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
516 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
517 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
518 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
519 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
520 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
521 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
522 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
523 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
524 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
525 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
526 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
527 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
528 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
529 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
530 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
531 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
533 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
535 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
540 //_____________________________________________________________________________
541 void TGeant3::GeomIter()
544 // Geometry iterator for moving upward in the geometry tree
545 // Initialise the iterator
547 fNextVol=fGcvolu->nlevel;
550 //____________________________________________________________________________
551 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
554 // Geometry iterator for moving upward in the geometry tree
555 // Return next volume up
560 gname=fGcvolu->names[fNextVol];
561 strncpy(name,(char *) &gname, 4);
563 copy=fGcvolu->number[fNextVol];
564 i=fGcvolu->lvolum[fNextVol];
565 if(gname == fZiq[fGclink->jvolum+i]) return i;
566 else printf("GeomTree: Volume %s not found in bank\n",name);
571 //_____________________________________________________________________________
572 Int_t TGeant3::CurrentVolID(Int_t ©) const
575 // Returns the current volume ID and copy number
578 if( (i=fGcvolu->nlevel-1) < 0 ) {
579 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
581 gname=fGcvolu->names[i];
582 copy=fGcvolu->number[i];
583 i=fGcvolu->lvolum[i];
584 if(gname == fZiq[fGclink->jvolum+i]) return i;
585 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
590 //_____________________________________________________________________________
591 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
594 // Return the current volume "off" upward in the geometrical tree
595 // ID and copy number
598 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
599 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
600 off,fGcvolu->nlevel);
602 gname=fGcvolu->names[i];
603 copy=fGcvolu->number[i];
604 i=fGcvolu->lvolum[i];
605 if(gname == fZiq[fGclink->jvolum+i]) return i;
606 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
611 //_____________________________________________________________________________
612 const char* TGeant3::CurrentVolName() const
615 // Returns the current volume name
619 if( (i=fGcvolu->nlevel-1) < 0 ) {
620 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
622 gname=fGcvolu->names[i];
624 strncpy(name,(char *) &gname, 4);
626 i=fGcvolu->lvolum[i];
627 if(gname == fZiq[fGclink->jvolum+i]) return name;
628 else Warning("CurrentVolName","Volume %4s not found\n",name);
633 //_____________________________________________________________________________
634 const char* TGeant3::CurrentVolOffName(Int_t off) const
637 // Return the current volume "off" upward in the geometrical tree
638 // ID, name and copy number
639 // if name=0 no name is returned
643 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
644 Warning("CurrentVolOffName",
645 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
647 gname=fGcvolu->names[i];
649 strncpy(name,(char *) &gname, 4);
651 i=fGcvolu->lvolum[i];
652 if(gname == fZiq[fGclink->jvolum+i]) return name;
653 else Warning("CurrentVolOffName","Volume %4s not found\n",name);
658 //_____________________________________________________________________________
659 Int_t TGeant3::IdFromPDG(Int_t pdg) const
662 // Return Geant3 code from PDG and pseudo ENDF code
664 for(Int_t i=0;i<fNPDGCodes;++i)
665 if(pdg==fPDGCode[i]) return i;
669 //_____________________________________________________________________________
670 Int_t TGeant3::PDGFromId(Int_t id) const
672 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
676 //_____________________________________________________________________________
677 void TGeant3::DefineParticles()
680 // Define standard Geant 3 particles
683 // Load standard numbers for GEANT particles and PDG conversion
684 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
685 fPDGCode[fNPDGCodes++]=22; // 1 = photon
686 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
687 fPDGCode[fNPDGCodes++]=11; // 3 = electron
688 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
689 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
690 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
691 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
692 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
693 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
694 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
695 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
696 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
697 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
698 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
699 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
700 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
701 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
702 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
703 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
704 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
705 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
706 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
707 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
708 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
709 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
710 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
711 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
712 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
713 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
714 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
715 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
716 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
723 /* --- Define additional particles */
724 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
725 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
727 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
728 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
730 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
731 fPDGCode[fNPDGCodes++]=411; // 35 = D+
733 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
734 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
736 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
737 fPDGCode[fNPDGCodes++]=421; // 37 = D0
739 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
740 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
742 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
744 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
746 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
748 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
749 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
751 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
752 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
754 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
755 fPDGCode[fNPDGCodes++]=113; // 37 = D0
758 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
760 // and numbers above 5 000 000 for special applications
763 const Int_t kion=10000000;
765 const Int_t kspe=50000000;
767 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
769 const Double_t autogev=0.9314943228;
770 const Double_t hslash = 1.0545726663e-27;
771 const Double_t erggev = 1/1.6021773349e-3;
772 const Double_t hshgev = hslash*erggev;
773 const Double_t yearstosec = 3600*24*365.25;
776 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
777 0,1,"Ion",kion+10020);
778 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
780 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
781 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
782 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
784 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
785 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
786 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
788 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
790 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
791 0,2,"Ion",kion+20030);
792 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
794 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
795 0,0,"Special",kspe+50);
796 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
798 /* --- Define additional decay modes --- */
799 /* --- omega(783) --- */
800 for (kz = 0; kz < 6; ++kz) {
811 Gsdk(ipa, bratio, mode);
812 /* --- phi(1020) --- */
813 for (kz = 0; kz < 6; ++kz) {
828 Gsdk(ipa, bratio, mode);
830 for (kz = 0; kz < 6; ++kz) {
843 Gsdk(ipa, bratio, mode);
845 for (kz = 0; kz < 6; ++kz) {
858 Gsdk(ipa, bratio, mode);
860 for (kz = 0; kz < 6; ++kz) {
871 Gsdk(ipa, bratio, mode);
872 /* --- Anti D0 --- */
873 for (kz = 0; kz < 6; ++kz) {
884 Gsdk(ipa, bratio, mode);
886 for (kz = 0; kz < 6; ++kz) {
893 Gsdk(ipa, bratio, mode);
895 for (kz = 0; kz < 6; ++kz) {
902 Gsdk(ipa, bratio, mode);
904 for (kz = 0; kz < 6; ++kz) {
911 Gsdk(ipa, bratio, mode);
914 for (kz = 0; kz < 6; ++kz) {
923 Gsdk(ipa, bratio, mode);
926 Gsdk(ipa, bratio, mode);
929 Gsdk(ipa, bratio, mode);
934 //_____________________________________________________________________________
935 Int_t TGeant3::VolId(Text_t *name) const
938 // Return the unique numeric identifier for volume name
941 strncpy((char *) &gname, name, 4);
942 for(i=1; i<=fGcnum->nvolum; i++)
943 if(gname == fZiq[fGclink->jvolum+i]) return i;
944 printf("VolId: Volume %s not found\n",name);
948 //_____________________________________________________________________________
949 Int_t TGeant3::NofVolumes() const
952 // Return total number of volumes in the geometry
954 return fGcnum->nvolum;
957 //_____________________________________________________________________________
958 const char* TGeant3::VolName(Int_t id) const
961 // Return the volume name given the volume identifier
964 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
967 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
972 //_____________________________________________________________________________
973 void TGeant3::TrackPosition(TLorentzVector &xyz) const
976 // Return the current position in the master reference frame of the
977 // track being transported
979 xyz[0]=fGctrak->vect[0];
980 xyz[1]=fGctrak->vect[1];
981 xyz[2]=fGctrak->vect[2];
982 xyz[3]=fGctrak->tofg;
985 //_____________________________________________________________________________
986 Float_t TGeant3::TrackTime() const
989 // Return the current time of flight of the track being transported
991 return fGctrak->tofg;
994 //_____________________________________________________________________________
995 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
998 // Return the direction and the momentum (GeV/c) of the track
999 // currently being transported
1001 Double_t ptot=fGctrak->vect[6];
1002 xyz[0]=fGctrak->vect[3]*ptot;
1003 xyz[1]=fGctrak->vect[4]*ptot;
1004 xyz[2]=fGctrak->vect[5]*ptot;
1005 xyz[3]=fGctrak->getot;
1008 //_____________________________________________________________________________
1009 Float_t TGeant3::TrackCharge() const
1012 // Return charge of the track currently transported
1014 return fGckine->charge;
1017 //_____________________________________________________________________________
1018 Float_t TGeant3::TrackMass() const
1021 // Return the mass of the track currently transported
1023 return fGckine->amass;
1026 //_____________________________________________________________________________
1027 Int_t TGeant3::TrackPid() const
1030 // Return the id of the particle transported
1032 return PDGFromId(fGckine->ipart);
1035 //_____________________________________________________________________________
1036 Float_t TGeant3::TrackStep() const
1039 // Return the length in centimeters of the current step
1041 return fGctrak->step;
1044 //_____________________________________________________________________________
1045 Float_t TGeant3::TrackLength() const
1048 // Return the length of the current track from its origin
1050 return fGctrak->sleng;
1053 //_____________________________________________________________________________
1054 Bool_t TGeant3::IsTrackInside() const
1057 // True if the track is not at the boundary of the current volume
1059 return (fGctrak->inwvol==0);
1062 //_____________________________________________________________________________
1063 Bool_t TGeant3::IsTrackEntering() const
1066 // True if this is the first step of the track in the current volume
1068 return (fGctrak->inwvol==1);
1071 //_____________________________________________________________________________
1072 Bool_t TGeant3::IsTrackExiting() const
1075 // True if this is the last step of the track in the current volume
1077 return (fGctrak->inwvol==2);
1080 //_____________________________________________________________________________
1081 Bool_t TGeant3::IsTrackOut() const
1084 // True if the track is out of the setup
1086 return (fGctrak->inwvol==3);
1089 //_____________________________________________________________________________
1090 Bool_t TGeant3::IsTrackStop() const
1093 // True if the track energy has fallen below the threshold
1095 return (fGctrak->istop==2);
1098 //_____________________________________________________________________________
1099 Int_t TGeant3::NSecondaries() const
1102 // Number of secondary particles generated in the current step
1104 return fGcking->ngkine;
1107 //_____________________________________________________________________________
1108 Int_t TGeant3::CurrentEvent() const
1111 // Number of the current event
1113 return fGcflag->idevt;
1116 //_____________________________________________________________________________
1117 void TGeant3::ProdProcess(char* proc) const
1120 // Name of the process that has produced the secondary particles
1121 // in the current step
1123 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1126 if(fGcking->ngkine>0) {
1127 for (km = 0; km < fGctrak->nmec; ++km) {
1128 for (im = 0; im < 13; ++im) {
1129 if (fGctrak->lmec[km] == ipmec[im]) {
1130 mec = fGctrak->lmec[km];
1131 if (0 < mec && mec < 31) {
1132 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1133 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1134 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1141 strcpy(proc,"UNKN");
1142 } else strcpy(proc,"NONE");
1145 //_____________________________________________________________________________
1146 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p)
1149 // Get the parameters of the secondary track number isec produced
1150 // in the current step
1153 if(-1<isec && isec<fGcking->ngkine) {
1154 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1156 x[i]=fGckin3->gpos[isec][i];
1157 p[i]=fGcking->gkin[isec][i];
1159 x[3]=fGcking->tofd[isec];
1160 p[3]=fGcking->gkin[isec][3];
1162 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1163 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1168 //_____________________________________________________________________________
1169 void TGeant3::InitLego()
1172 SetDEBU(0,0,0); //do not print a message
1175 //_____________________________________________________________________________
1176 Bool_t TGeant3::IsTrackDisappeared() const
1179 // True if the current particle has disappered
1180 // either because it decayed or because it underwent
1181 // an inelastic collision
1183 return (fGctrak->istop==1);
1186 //_____________________________________________________________________________
1187 Bool_t TGeant3::IsTrackAlive() const
1190 // True if the current particle is alive and will continue to be
1193 return (fGctrak->istop==0);
1196 //_____________________________________________________________________________
1197 void TGeant3::StopTrack()
1200 // Stop the transport of the current particle and skip to the next
1205 //_____________________________________________________________________________
1206 void TGeant3::StopEvent()
1209 // Stop simulation of the current event and skip to the next
1214 //_____________________________________________________________________________
1215 Float_t TGeant3::MaxStep() const
1218 // Return the maximum step length in the current medium
1220 return fGctmed->stemax;
1223 //_____________________________________________________________________________
1224 void TGeant3::SetColors()
1227 // Set the colors for all the volumes
1228 // this is done sequentially for all volumes
1229 // based on the number of their medium
1232 Int_t jvolum=fGclink->jvolum;
1233 //Int_t jtmed=fGclink->jtmed;
1234 //Int_t jmate=fGclink->jmate;
1235 Int_t nvolum=fGcnum->nvolum;
1238 // Now for all the volumes
1239 for(kv=1;kv<=nvolum;kv++) {
1240 // Get the tracking medium
1241 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1243 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1245 //Float_t z=fZq[fZlq[jmate-ima]+7];
1246 // Find color number
1247 //icol = Int_t(z)%6+2;
1248 //icol = 17+Int_t(z*150./92.);
1251 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1253 Gsatt(name,"COLO",icol);
1257 //_____________________________________________________________________________
1258 void TGeant3::SetMaxStep(Float_t maxstep)
1261 // Set the maximum step allowed till the particle is in the current medium
1263 fGctmed->stemax=maxstep;
1266 //_____________________________________________________________________________
1267 void TGeant3::SetMaxNStep(Int_t maxnstp)
1270 // Set the maximum number of steps till the particle is in the current medium
1272 fGctrak->maxnst=maxnstp;
1275 //_____________________________________________________________________________
1276 Int_t TGeant3::GetMaxNStep() const
1279 // Maximum number of steps allowed in current medium
1281 return fGctrak->maxnst;
1284 //_____________________________________________________________________________
1285 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1286 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1290 // Defines a Material
1292 // kmat number assigned to the material
1293 // name material name
1294 // a atomic mass in au
1296 // dens density in g/cm3
1297 // absl absorbtion length in cm
1298 // if >=0 it is ignored and the program
1299 // calculates it, if <0. -absl is taken
1300 // radl radiation length in cm
1301 // if >=0 it is ignored and the program
1302 // calculates it, if <0. -radl is taken
1303 // buf pointer to an array of user words
1304 // nbuf number of user words
1306 Int_t jmate=fGclink->jmate;
1312 for(i=1; i<=ns; i++) {
1313 if(fZlq[jmate-i]==0) {
1319 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1320 nwbuf PASSCHARL(name));
1323 //_____________________________________________________________________________
1324 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1325 Float_t dens, Int_t nlmat, Float_t* wmat)
1328 // Defines mixture OR COMPOUND IMAT as composed by
1329 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1331 // If NLMAT > 0 then wmat contains the proportion by
1332 // weights of each basic material in the mixture.
1334 // If nlmat < 0 then WMAT contains the number of atoms
1335 // of a given kind into the molecule of the COMPOUND
1336 // In this case, WMAT in output is changed to relative
1339 Int_t jmate=fGclink->jmate;
1345 for(i=1; i<=ns; i++) {
1346 if(fZlq[jmate-i]==0) {
1352 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1355 //_____________________________________________________________________________
1356 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1357 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1358 Float_t stemax, Float_t deemax, Float_t epsil,
1359 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1362 // kmed tracking medium number assigned
1363 // name tracking medium name
1364 // nmat material number
1365 // isvol sensitive volume flag
1366 // ifield magnetic field
1367 // fieldm max. field value (kilogauss)
1368 // tmaxfd max. angle due to field (deg/step)
1369 // stemax max. step allowed
1370 // deemax max. fraction of energy lost in a step
1371 // epsil tracking precision (cm)
1372 // stmin min. step due to continuos processes (cm)
1374 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1375 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1376 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1378 Int_t jtmed=fGclink->jtmed;
1384 for(i=1; i<=ns; i++) {
1385 if(fZlq[jtmed-i]==0) {
1391 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1392 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1395 //_____________________________________________________________________________
1396 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1397 Float_t phiy, Float_t thez, Float_t phiz)
1400 // krot rotation matrix number assigned
1401 // theta1 polar angle for axis i
1402 // phi1 azimuthal angle for axis i
1403 // theta2 polar angle for axis ii
1404 // phi2 azimuthal angle for axis ii
1405 // theta3 polar angle for axis iii
1406 // phi3 azimuthal angle for axis iii
1408 // it defines the rotation matrix number irot.
1410 Int_t jrotm=fGclink->jrotm;
1416 for(i=1; i<=ns; i++) {
1417 if(fZlq[jrotm-i]==0) {
1423 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1426 //_____________________________________________________________________________
1427 Int_t TGeant3::GetMedium() const
1430 // Return the number of the current medium
1432 return fGctmed->numed;
1435 //_____________________________________________________________________________
1436 Float_t TGeant3::Edep() const
1439 // Return the energy lost in the current step
1441 return fGctrak->destep;
1444 //_____________________________________________________________________________
1445 Float_t TGeant3::Etot() const
1448 // Return the total energy of the current track
1450 return fGctrak->getot;
1453 //_____________________________________________________________________________
1454 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1457 // Return an array of n random numbers uniformly distributed
1458 // between 0 and 1 not included
1463 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1465 // Functions from GBASE
1467 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1469 //____________________________________________________________________________
1470 void TGeant3::Gfile(const char *filename, const char *option)
1473 // Routine to open a GEANT/RZ data base.
1475 // LUN logical unit number associated to the file
1477 // CHFILE RZ file name
1479 // CHOPT is a character string which may be
1480 // N To create a new file
1481 // U to open an existing file for update
1482 // " " to open an existing file for read only
1483 // Q The initial allocation (default 1000 records)
1484 // is given in IQUEST(10)
1485 // X Open the file in exchange format
1486 // I Read all data structures from file to memory
1487 // O Write all data structures from memory to file
1490 // If options "I" or "O" all data structures are read or
1491 // written from/to file and the file is closed.
1492 // See routine GRMDIR to create subdirectories
1493 // See routines GROUT,GRIN to write,read objects
1495 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1499 //____________________________________________________________________________
1500 void TGeant3::Gpcxyz()
1503 // Print track and volume parameters at current point
1508 //_____________________________________________________________________________
1509 void TGeant3::Ggclos()
1512 // Closes off the geometry setting.
1513 // Initializes the search list for the contents of each
1514 // volume following the order they have been positioned, and
1515 // inserting the content '0' when a call to GSNEXT (-1) has
1516 // been required by the user.
1517 // Performs the development of the JVOLUM structure for all
1518 // volumes with variable parameters, by calling GGDVLP.
1519 // Interprets the user calls to GSORD, through GGORD.
1520 // Computes and stores in a bank (next to JVOLUM mother bank)
1521 // the number of levels in the geometrical tree and the
1522 // maximum number of contents per level, by calling GGNLEV.
1523 // Sets status bit for CONCAVE volumes, through GGCAVE.
1524 // Completes the JSET structure with the list of volume names
1525 // which identify uniquely a given physical detector, the
1526 // list of bit numbers to pack the corresponding volume copy
1527 // numbers, and the generic path(s) in the JVOLUM tree,
1528 // through the routine GHCLOS.
1533 //_____________________________________________________________________________
1534 void TGeant3::Glast()
1537 // Finish a Geant run
1542 //_____________________________________________________________________________
1543 void TGeant3::Gprint(const char *name)
1546 // Routine to print data structures
1547 // CHNAME name of a data structure
1551 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1554 //_____________________________________________________________________________
1555 void TGeant3::Grun()
1558 // Steering function to process one run
1563 //_____________________________________________________________________________
1564 void TGeant3::Gtrig()
1567 // Steering function to process one event
1572 //_____________________________________________________________________________
1573 void TGeant3::Gtrigc()
1576 // Clear event partition
1581 //_____________________________________________________________________________
1582 void TGeant3::Gtrigi()
1585 // Initialises event partition
1590 //_____________________________________________________________________________
1591 void TGeant3::Gwork(Int_t nwork)
1594 // Allocates workspace in ZEBRA memory
1599 //_____________________________________________________________________________
1600 void TGeant3::Gzinit()
1603 // To initialise GEANT/ZEBRA data structures
1608 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1610 // Functions from GCONS
1612 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1614 //_____________________________________________________________________________
1615 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1616 Float_t &dens, Float_t &radl, Float_t &absl,
1617 Float_t* ubuf, Int_t& nbuf)
1620 // Return parameters for material IMAT
1622 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1626 //_____________________________________________________________________________
1627 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1628 Float_t &amass, Float_t &charge, Float_t &tlife)
1631 // Return parameters for particle of type IPART
1635 Int_t igpart = IdFromPDG(ipart);
1636 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1640 //_____________________________________________________________________________
1641 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1642 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1643 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1644 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1647 // Return parameters for tracking medium NUMED
1649 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1650 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1653 //_____________________________________________________________________________
1654 void TGeant3::Gmate()
1657 // Define standard GEANT materials
1662 //_____________________________________________________________________________
1663 void TGeant3::Gpart()
1666 // Define standard GEANT particles plus selected decay modes
1667 // and branching ratios.
1672 //_____________________________________________________________________________
1673 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1675 // Defines branching ratios and decay modes for standard
1677 gsdk(ipart,bratio,mode);
1680 //_____________________________________________________________________________
1681 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1682 Float_t dens, Float_t radl, Float_t absl)
1685 // Defines a Material
1687 // kmat number assigned to the material
1688 // name material name
1689 // a atomic mass in au
1691 // dens density in g/cm3
1692 // absl absorbtion length in cm
1693 // if >=0 it is ignored and the program
1694 // calculates it, if <0. -absl is taken
1695 // radl radiation length in cm
1696 // if >=0 it is ignored and the program
1697 // calculates it, if <0. -radl is taken
1698 // buf pointer to an array of user words
1699 // nbuf number of user words
1703 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1707 //_____________________________________________________________________________
1708 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1709 Float_t dens, Int_t nlmat, Float_t *wmat)
1712 // Defines mixture OR COMPOUND IMAT as composed by
1713 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1715 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1716 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1718 // If NLMAT.LT.0 then WMAT contains the number of atoms
1719 // of a given kind into the molecule of the COMPOUND
1720 // In this case, WMAT in output is changed to relative
1723 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1726 //_____________________________________________________________________________
1727 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1728 Float_t amass, Float_t charge, Float_t tlife)
1731 // Store particle parameters
1733 // ipart particle code
1734 // name particle name
1735 // itrtyp transport method (see GEANT manual)
1736 // amass mass in GeV/c2
1737 // charge charge in electron units
1738 // tlife lifetime in seconds
1742 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1746 //_____________________________________________________________________________
1747 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1748 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1749 Float_t stemax, Float_t deemax, Float_t epsil,
1753 // NTMED Tracking medium number
1754 // NAME Tracking medium name
1755 // NMAT Material number
1756 // ISVOL Sensitive volume flag
1757 // IFIELD Magnetic field
1758 // FIELDM Max. field value (Kilogauss)
1759 // TMAXFD Max. angle due to field (deg/step)
1760 // STEMAX Max. step allowed
1761 // DEEMAX Max. fraction of energy lost in a step
1762 // EPSIL Tracking precision (cm)
1763 // STMIN Min. step due to continuos processes (cm)
1765 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1766 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1767 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1771 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1772 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1775 //_____________________________________________________________________________
1776 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1777 Float_t *absco, Float_t *effic, Float_t *rindex)
1780 // Stores the tables for UV photon tracking in medium ITMED
1781 // Please note that it is the user's responsability to
1782 // provide all the coefficients:
1785 // ITMED Tracking medium number
1786 // NPCKOV Number of bins of each table
1787 // PPCKOV Value of photon momentum (in GeV)
1788 // ABSCO Absorbtion coefficients
1789 // dielectric: absorbtion length in cm
1790 // metals : absorbtion fraction (0<=x<=1)
1791 // EFFIC Detection efficiency for UV photons
1792 // RINDEX Refraction index (if=0 metal)
1794 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1797 //_____________________________________________________________________________
1798 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1801 // To change the value of cut or mechanism "CHPAR"
1802 // to a new value PARVAL for tracking medium ITMED
1803 // The data structure JTMED contains the standard tracking
1804 // parameters (CUTS and flags to control the physics processes) which
1805 // are used by default for all tracking media. It is possible to
1806 // redefine individually with GSTPAR any of these parameters for a
1807 // given tracking medium.
1808 // ITMED tracking medium number
1809 // CHPAR is a character string (variable name)
1810 // PARVAL must be given as a floating point.
1812 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1815 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1817 // Functions from GCONS
1819 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1821 //_____________________________________________________________________________
1822 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1825 // Storing/Retrieving Vertex and Track parameters
1826 // ----------------------------------------------
1828 // Stores vertex parameters.
1829 // VERT array of (x,y,z) position of the vertex
1830 // NTBEAM beam track number origin of the vertex
1831 // =0 if none exists
1832 // NTTARG target track number origin of the vertex
1833 // UBUF user array of NUBUF floating point numbers
1835 // NVTX new vertex number (=0 in case of error).
1836 // Prints vertex parameters.
1837 // IVTX for vertex IVTX.
1838 // (For all vertices if IVTX=0)
1839 // Stores long life track parameters.
1840 // PLAB components of momentum
1841 // IPART type of particle (see GSPART)
1842 // NV vertex number origin of track
1843 // UBUF array of NUBUF floating point user parameters
1845 // NT track number (if=0 error).
1846 // Retrieves long life track parameters.
1847 // ITRA track number for which parameters are requested
1848 // VERT vector origin of the track
1849 // PVERT 4 momentum components at the track origin
1850 // IPART particle type (=0 if track ITRA does not exist)
1851 // NVERT vertex number origin of the track
1852 // UBUF user words stored in GSKINE.
1853 // Prints initial track parameters.
1854 // ITRA for track ITRA
1855 // (For all tracks if ITRA=0)
1859 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1862 //_____________________________________________________________________________
1863 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1867 // Retrieves the parameter of a vertex bank
1868 // Vertex is generated from tracks NTBEAM NTTARG
1869 // NVTX is the new vertex number
1873 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1876 //_____________________________________________________________________________
1877 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1881 // Store kinematics of track NT into data structure
1882 // Track is coming from vertex NV
1885 gskine(plab, ipart, nv, buf, nwbuf, nt);
1889 //_____________________________________________________________________________
1890 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1894 // Creates a new vertex bank
1895 // Vertex is generated from tracks NTBEAM NTTARG
1896 // NVTX is the new vertex number
1899 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1903 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1905 // Functions from GPHYS
1907 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1909 //_____________________________________________________________________________
1910 void TGeant3::Gphysi()
1913 // Initialise material constants for all the physics
1914 // mechanisms used by GEANT
1919 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1921 // Functions from GTRAK
1923 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1925 //_____________________________________________________________________________
1926 void TGeant3::Gdebug()
1929 // Debug the current step
1934 //_____________________________________________________________________________
1935 void TGeant3::Gekbin()
1938 // To find bin number in kinetic energy table
1939 // stored in ELOW(NEKBIN)
1944 //_____________________________________________________________________________
1945 void TGeant3::Gfinds()
1948 // Returns the set/volume parameters corresponding to
1949 // the current space point in /GCTRAK/
1950 // and fill common /GCSETS/
1952 // IHSET user set identifier
1953 // IHDET user detector identifier
1954 // ISET set number in JSET
1955 // IDET detector number in JS=LQ(JSET-ISET)
1956 // IDTYPE detector type (1,2)
1957 // NUMBV detector volume numbers (array of length NVNAME)
1958 // NVNAME number of volume levels
1963 //_____________________________________________________________________________
1964 void TGeant3::Gsking(Int_t igk)
1967 // Stores in stack JSTAK either the IGKth track of /GCKING/,
1968 // or the NGKINE tracks when IGK is 0.
1973 //_____________________________________________________________________________
1974 void TGeant3::Gskpho(Int_t igk)
1977 // Stores in stack JSTAK either the IGKth Cherenkov photon of
1978 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
1983 //_____________________________________________________________________________
1984 void TGeant3::Gsstak(Int_t iflag)
1987 // Stores in auxiliary stack JSTAK the particle currently
1988 // described in common /GCKINE/.
1990 // On request, creates also an entry in structure JKINE :
1992 // 0 : No entry in JKINE structure required (user)
1993 // 1 : New entry in JVERTX / JKINE structures required (user)
1994 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
1995 // 2 : Entry in JKINE structure exists already (from GTREVE)
2000 //_____________________________________________________________________________
2001 void TGeant3::Gsxyz()
2004 // Store space point VECT in banks JXYZ
2009 //_____________________________________________________________________________
2010 void TGeant3::Gtrack()
2013 // Controls tracking of current particle
2018 //_____________________________________________________________________________
2019 void TGeant3::Gtreve()
2022 // Controls tracking of all particles belonging to the current event
2027 //_____________________________________________________________________________
2028 void TGeant3::Gtreve_root()
2031 // Controls tracking of all particles belonging to the current event
2036 //_____________________________________________________________________________
2037 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2040 // To generate a vector RVECV of LEN random numbers
2041 // Copy of the CERN Library routine RANECU
2045 //_____________________________________________________________________________
2046 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2047 const Text_t *chopt)
2050 // To set/retrieve the seed of the random number generator
2052 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2055 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2057 // Functions from GDRAW
2059 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2061 //_____________________________________________________________________________
2062 void TGeant3::Gdxyz(Int_t it)
2065 // Draw the points stored with Gsxyz relative to track it
2070 //_____________________________________________________________________________
2071 void TGeant3::Gdcxyz()
2074 // Draw the position of the current track
2079 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2081 // Functions from GGEOM
2083 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2085 //_____________________________________________________________________________
2086 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2089 // Computes coordinates XM (Master Reference System
2090 // knowing the coordinates XD (Detector Ref System)
2091 // The local reference system can be initialized by
2092 // - the tracking routines and GDTOM used in GUSTEP
2093 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2094 // (inverse routine is GMTOD)
2096 // If IFLAG=1 convert coordinates
2097 // IFLAG=2 convert direction cosinus
2099 gdtom(xd, xm, iflag);
2102 //_____________________________________________________________________________
2103 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2107 // Loads the top part of the Volume tree in LVOLS (IVO's),
2108 // LINDX (IN indices) for a given volume defined through
2109 // its name IUDET and number IUNUM.
2111 // The routine stores only upto the last level where JVOLUM
2112 // data structure is developed. If there is no development
2113 // above the current level, it returns NLEV zero.
2115 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2118 //_____________________________________________________________________________
2119 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2122 // Finds in which volume/medium the point X is, and updates the
2123 // common /GCVOLU/ and the structure JGPAR accordingly.
2125 // NUMED returns the tracking medium number, or 0 if point is
2126 // outside the experimental setup.
2131 //_____________________________________________________________________________
2132 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2135 // Computes coordinates XD (in DRS)
2136 // from known coordinates XM in MRS
2137 // The local reference system can be initialized by
2138 // - the tracking routines and GMTOD used in GUSTEP
2139 // - a call to GMEDIA(XM,NUMED)
2140 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2141 // (inverse routine is GDTOM)
2143 // If IFLAG=1 convert coordinates
2144 // IFLAG=2 convert direction cosinus
2146 gmtod(xm, xd, iflag);
2149 //_____________________________________________________________________________
2150 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2154 // Create a new volume by dividing an existing one
2157 // MOTHER Mother volume name
2158 // NDIV Number of divisions
2161 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2162 // It divides a previously defined volume.
2167 Vname(mother,vmother);
2168 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2169 PASSCHARL(vmother));
2172 //_____________________________________________________________________________
2173 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2174 Int_t iaxis, Float_t c0i, Int_t numed)
2177 // Create a new volume by dividing an existing one
2179 // Divides mother into ndiv divisions called name
2180 // along axis iaxis starting at coordinate value c0.
2181 // the new volume created will be medium number numed.
2186 Vname(mother,vmother);
2187 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2188 PASSCHARL(vname) PASSCHARL(vmother));
2191 //_____________________________________________________________________________
2192 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2193 Int_t iaxis, Int_t numed)
2196 // Create a new volume by dividing an existing one
2201 Vname(mother,vmother);
2202 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2203 PASSCHARL(vname) PASSCHARL(vmother));
2206 //_____________________________________________________________________________
2207 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2208 Int_t iaxis, Float_t c0, Int_t numed)
2211 // Create a new volume by dividing an existing one
2216 Vname(mother,vmother);
2217 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2218 PASSCHARL(vname) PASSCHARL(vmother));
2221 //_____________________________________________________________________________
2222 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2223 Int_t iaxis, Int_t numed, Int_t ndvmx)
2226 // Create a new volume by dividing an existing one
2228 // Divides MOTHER into divisions called NAME along
2229 // axis IAXIS in steps of STEP. If not exactly divisible
2230 // will make as many as possible and will centre them
2231 // with respect to the mother. Divisions will have medium
2232 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2233 // NDVMX is the expected maximum number of divisions
2234 // (If 0, no protection tests are performed)
2239 Vname(mother,vmother);
2240 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2241 PASSCHARL(vname) PASSCHARL(vmother));
2244 //_____________________________________________________________________________
2245 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2246 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2249 // Create a new volume by dividing an existing one
2251 // Divides MOTHER into divisions called NAME along
2252 // axis IAXIS starting at coordinate value C0 with step
2254 // The new volume created will have medium number NUMED.
2255 // If NUMED is 0, NUMED of mother is taken.
2256 // NDVMX is the expected maximum number of divisions
2257 // (If 0, no protection tests are performed)
2262 Vname(mother,vmother);
2263 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2264 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2267 //_____________________________________________________________________________
2268 void TGeant3::Gsord(const char *name, Int_t iax)
2271 // Flags volume CHNAME whose contents will have to be ordered
2272 // along axis IAX, by setting the search flag to -IAX
2276 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2277 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2278 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2279 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2280 // IAX = 6 PHI (PHI=0 => X axis)
2281 // IAX = 7 THETA (THETA=0 => Z axis)
2285 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2288 //_____________________________________________________________________________
2289 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2290 Float_t y, Float_t z, Int_t irot, const char *konly)
2293 // Position a volume into an existing one
2296 // NUMBER Copy number of the volume
2297 // MOTHER Mother volume name
2298 // X X coord. of the volume in mother ref. sys.
2299 // Y Y coord. of the volume in mother ref. sys.
2300 // Z Z coord. of the volume in mother ref. sys.
2301 // IROT Rotation matrix number w.r.t. mother ref. sys.
2302 // ONLY ONLY/MANY flag
2304 // It positions a previously defined volume in the mother.
2309 Vname(mother,vmother);
2310 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2311 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2315 //_____________________________________________________________________________
2316 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2317 Float_t x, Float_t y, Float_t z, Int_t irot,
2318 const char *konly, Float_t *upar, Int_t np )
2321 // Place a copy of generic volume NAME with user number
2322 // NR inside MOTHER, with its parameters UPAR(1..NP)
2327 Vname(mother,vmother);
2328 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2329 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2333 //_____________________________________________________________________________
2334 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2335 Float_t phi2, Float_t theta3, Float_t phi3)
2338 // nmat Rotation matrix number
2339 // THETA1 Polar angle for axis I
2340 // PHI1 Azimuthal angle for axis I
2341 // THETA2 Polar angle for axis II
2342 // PHI2 Azimuthal angle for axis II
2343 // THETA3 Polar angle for axis III
2344 // PHI3 Azimuthal angle for axis III
2346 // It defines the rotation matrix number IROT.
2348 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2351 //_____________________________________________________________________________
2352 void TGeant3::Gprotm(Int_t nmat)
2355 // To print rotation matrices structure JROTM
2356 // nmat Rotation matrix number
2361 //_____________________________________________________________________________
2362 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2363 Float_t *upar, Int_t npar)
2367 // SHAPE Volume type
2368 // NUMED Tracking medium number
2369 // NPAR Number of shape parameters
2370 // UPAR Vector containing shape parameters
2372 // It creates a new volume in the JVOLUM data structure.
2378 Vname(shape,vshape);
2379 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2380 PASSCHARL(vname) PASSCHARL(vshape));
2384 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2386 // T H E D R A W I N G P A C K A G E
2387 // ======================================
2388 // Drawing functions. These functions allow the visualization in several ways
2389 // of the volumes defined in the geometrical data structure. It is possible
2390 // to draw the logical tree of volumes belonging to the detector (DTREE),
2391 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2392 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2393 // these commands when the hidden line removal option is activated; in
2394 // this case, the volumes can be also either translated in the space
2395 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2396 // possible to fill the surfaces of the volumes
2397 // with solid colours when the shading option (SHAD) is activated.
2398 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2399 // of the detectors or to scan physical events as well.
2400 // Finally, the command MOVE will allow the rotation, translation and zooming
2401 // on real time parts of the detectors or tracks and hits of a simulated event.
2402 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2403 // the drawing is performed by the Geant ray-tracing;
2404 // automatically, the color is assigned according to the tracking medium of each
2405 // volume and the volumes with a density lower/equal than the air are considered
2406 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2407 // the user can set color and visibility for the desired volumes via the command
2408 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2409 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2410 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2411 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2412 // first case, we assume that the first mother volume of the tree is a box with
2413 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2414 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2415 // second case, the distance between the observer and the origin of the world
2416 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2417 // or telescopic effects can be achieved changing the scale factors in the command
2418 // (DRAW). When the final picture does not occupy the full window,
2419 // mapping the space before tracing can speed up the drawing, but can also
2420 // produce less precise results; values from 1 to 4 are allowed in the command
2421 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2422 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2423 // The command (VALCUT) allows the cutting of the detector by three planes
2424 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2425 // SATT for any desired volume and can assume values from 0 to 7; it determines
2426 // the different light processing to be performed for different materials:
2427 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2428 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2429 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2430 // is 0.9) and the observer is assumed to have a light source (therefore he will
2431 // produce parallel light in the case of parallel view and point-like-source
2432 // light in the case of perspective view).
2434 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2436 //_____________________________________________________________________________
2437 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2441 // IOPT Name of the attribute to be set
2442 // IVAL Value to which the attribute is to be set
2444 // name= "*" stands for all the volumes.
2445 // iopt can be chosen among the following :
2447 // WORK 0=volume name is inactive for the tracking
2448 // 1=volume name is active for the tracking (default)
2450 // SEEN 0=volume name is invisible
2451 // 1=volume name is visible (default)
2452 // -1=volume invisible with all its descendants in the tree
2453 // -2=volume visible but not its descendants in the tree
2455 // LSTY line style 1,2,3,... (default=1)
2456 // LSTY=7 will produce a very precise approximation for
2457 // revolution bodies.
2459 // LWID line width -7,...,1,2,3,..7 (default=1)
2460 // LWID<0 will act as abs(LWID) was set for the volume
2461 // and for all the levels below it. When SHAD is 'ON', LWID
2462 // represent the linewidth of the scan lines filling the surfaces
2463 // (whereas the FILL value represent their number). Therefore
2464 // tuning this parameter will help to obtain the desired
2465 // quality/performance ratio.
2467 // COLO colour code -166,...,1,2,..166 (default=1)
2469 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2470 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2471 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2472 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2473 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2474 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2475 // colour=n*10+m, m=1,2,...9, will produce the same colour
2476 // as 'n', but with increasing luminosity according to 'm';
2477 // COLO<0 will act as if abs(COLO) was set for the volume
2478 // and for all the levels below it.
2479 // When for a volume the attribute FILL is > 1 (and the
2480 // option SHAD is on), the ABS of its colour code must be < 8
2481 // because an automatic shading of its faces will be
2484 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2485 // when option SHAD is "on" the FILL attribute of any
2486 // volume can be set different from 0 (normal drawing);
2487 // if it is set to 1, the faces of such volume will be filled
2488 // with solid colours; if ABS(FILL) is > 1, then a light
2489 // source is placed along the observer line, and the faces of
2490 // such volumes will be painted by colours whose luminosity
2491 // will depend on the amount of light reflected;
2492 // if ABS(FILL) = 1, then it is possible to use all the 166
2493 // colours of the colour table, becouse the automatic shading
2494 // is not performed;
2495 // for increasing values of FILL the drawing will be performed
2496 // with higher and higher resolution improving the quality (the
2497 // number of scan lines used to fill the faces increases with FILL);
2498 // it is possible to set different values of FILL
2499 // for different volumes, in order to optimize at the same time
2500 // the performance and the quality of the picture;
2501 // FILL<0 will act as if abs(FILL) was set for the volume
2502 // and for all the levels below it.
2503 // This kind of drawing can be saved in 'picture files'
2504 // or in view banks.
2505 // 0=drawing without fill area
2506 // 1=faces filled with solid colours and resolution = 6
2507 // 2=lowest resolution (very fast)
2508 // 3=default resolution
2509 // 4=.................
2510 // 5=.................
2511 // 6=.................
2513 // Finally, if a coloured background is desired, the FILL
2514 // attribute for the first volume of the tree must be set
2515 // equal to -abs(colo), colo being >0 and <166.
2517 // SET set number associated to volume name
2518 // DET detector number associated to volume name
2519 // DTYP detector type (1,2)
2526 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2530 //_____________________________________________________________________________
2531 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2532 Int_t& natt, Float_t* par, Float_t* att)
2535 // Find the parameters of a volume
2537 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2541 //_____________________________________________________________________________
2542 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2545 // Check the parameters of a shape
2547 gckpar(ish,npar,par);
2550 //_____________________________________________________________________________
2551 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2554 // Check the parameters of a tracking medium
2556 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2559 //_____________________________________________________________________________
2560 void TGeant3::Gdelete(Int_t iview)
2563 // IVIEW View number
2565 // It deletes a view bank from memory.
2570 //_____________________________________________________________________________
2571 void TGeant3::Gdopen(Int_t iview)
2574 // IVIEW View number
2576 // When a drawing is very complex and requires a long time to be
2577 // executed, it can be useful to store it in a view bank: after a
2578 // call to DOPEN and the execution of the drawing (nothing will
2579 // appear on the screen), and after a necessary call to DCLOSE,
2580 // the contents of the bank can be displayed in a very fast way
2581 // through a call to DSHOW; therefore, the detector can be easily
2582 // zoomed many times in different ways. Please note that the pictures
2583 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2590 //_____________________________________________________________________________
2591 void TGeant3::Gdclose()
2594 // It closes the currently open view bank; it must be called after the
2595 // end of the drawing to be stored.
2600 //_____________________________________________________________________________
2601 void TGeant3::Gdshow(Int_t iview)
2604 // IVIEW View number
2606 // It shows on the screen the contents of a view bank. It
2607 // can be called after a view bank has been closed.
2612 //_____________________________________________________________________________
2613 void TGeant3::Gdopt(const char *name,const char *value)
2617 // VALUE Option value
2619 // To set/modify the drawing options.
2622 // THRZ ON Draw tracks in R vs Z
2623 // OFF (D) Draw tracks in X,Y,Z
2626 // PROJ PARA (D) Parallel projection
2628 // TRAK LINE (D) Trajectory drawn with lines
2629 // POIN " " with markers
2630 // HIDE ON Hidden line removal using the CG package
2631 // OFF (D) No hidden line removal
2632 // SHAD ON Fill area and shading of surfaces.
2633 // OFF (D) Normal hidden line removal.
2634 // RAYT ON Ray-tracing on.
2635 // OFF (D) Ray-tracing off.
2636 // EDGE OFF Does not draw contours when shad is on.
2637 // ON (D) Normal shading.
2638 // MAPP 1,2,3,4 Mapping before ray-tracing.
2639 // 0 (D) No mapping.
2640 // USER ON User graphics options in the raytracing.
2641 // OFF (D) Automatic graphics options.
2647 Vname(value,vvalue);
2648 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2652 //_____________________________________________________________________________
2653 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2654 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2659 // THETA Viewing angle theta (for 3D projection)
2660 // PHI Viewing angle phi (for 3D projection)
2661 // PSI Viewing angle psi (for 2D rotation)
2662 // U0 U-coord. (horizontal) of volume origin
2663 // V0 V-coord. (vertical) of volume origin
2664 // SU Scale factor for U-coord.
2665 // SV Scale factor for V-coord.
2667 // This function will draw the volumes,
2668 // selected with their graphical attributes, set by the Gsatt
2669 // facility. The drawing may be performed with hidden line removal
2670 // and with shading effects according to the value of the options HIDE
2671 // and SHAD; if the option SHAD is ON, the contour's edges can be
2672 // drawn or not. If the option HIDE is ON, the detector can be
2673 // exploded (BOMB), clipped with different shapes (CVOL), and some
2674 // of its parts can be shifted from their original
2675 // position (SHIFT). When HIDE is ON, if
2676 // the drawing requires more than the available memory, the program
2677 // will evaluate and display the number of missing words
2678 // (so that the user can increase the
2679 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2680 // the program will print messages about the memory used and
2681 // statistics on the volumes' visibility.
2682 // The following commands will produce the drawing of a green
2683 // volume, specified by NAME, without using the hidden line removal
2684 // technique, using the hidden line removal technique,
2685 // with different linewidth and colour (red), with
2686 // solid colour, with shading of surfaces, and without edges.
2687 // Finally, some examples are given for the ray-tracing. (A possible
2688 // string for the NAME of the volume can be found using the command DTREE).
2694 if (fGcvdma->raytra != 1) {
2695 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2697 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2701 //_____________________________________________________________________________
2702 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2703 Float_t v0,Float_t ul,Float_t vl)
2708 // CUTVAL Cut plane distance from the origin along the axis
2710 // U0 U-coord. (horizontal) of volume origin
2711 // V0 V-coord. (vertical) of volume origin
2712 // SU Scale factor for U-coord.
2713 // SV Scale factor for V-coord.
2715 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2716 // and placed at the distance cutval from the origin.
2717 // The resulting picture is seen from the the same axis.
2718 // When HIDE Mode is ON, it is possible to get the same effect with
2719 // the CVOL/BOX function.
2725 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2728 //_____________________________________________________________________________
2729 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2730 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2731 Float_t v0,Float_t ul,Float_t vl)
2735 // CUTTHE Theta angle of the line normal to cut plane
2736 // CUTPHI Phi angle of the line normal to cut plane
2737 // CUTVAL Cut plane distance from the origin along the axis
2739 // THETA Viewing angle theta (for 3D projection)
2740 // PHI Viewing angle phi (for 3D projection)
2741 // U0 U-coord. (horizontal) of volume origin
2742 // V0 V-coord. (vertical) of volume origin
2743 // SU Scale factor for U-coord.
2744 // SV Scale factor for V-coord.
2746 // The cut plane is normal to the line given by the cut angles
2747 // cutthe and cutphi and placed at the distance cutval from the origin.
2748 // The resulting picture is seen from the viewing angles theta,phi.
2754 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2758 //_____________________________________________________________________________
2759 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2764 // ISEL Option flag D=111110
2766 // CHRSIZ Character size (cm) of title NAME D=0.6
2769 // 0 to have only the header lines
2770 // xxxxx1 to add the text name centered on top of header
2771 // xxxx1x to add global detector name (first volume) on left
2772 // xxx1xx to add date on right
2773 // xx1xxx to select thick characters for text on top of header
2774 // x1xxxx to add the text 'EVENT NR x' on top of header
2775 // 1xxxxx to add the text 'RUN NR x' on top of header
2776 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2777 // i.e. they generate overwritten text.
2779 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2782 //_____________________________________________________________________________
2783 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2786 // Draw a 2D-man at position (U0,V0)
2788 // U U-coord. (horizontal) of the centre of man' R
2789 // V V-coord. (vertical) of the centre of man' R
2790 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2792 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2793 // It superimposes the picure of a man or of a woman, chosen among
2794 // three different ones, with the same scale factors as the detector
2795 // in the current drawing.
2798 if (opt.Contains("WM1")) {
2800 } else if (opt.Contains("WM3")) {
2802 } else if (opt.Contains("WM2")) {
2809 //_____________________________________________________________________________
2810 void TGeant3::Gdspec(const char *name)
2815 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2816 // its geometrical specifications. The 3D drawing will
2817 // be performed according the current values of the options HIDE and
2818 // SHAD and according the current SetClipBox clipping parameters for that
2825 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2828 //_____________________________________________________________________________
2829 void TGeant3::DrawOneSpec(const char *name)
2832 // Function called when one double-clicks on a volume name
2833 // in a TPavelabel drawn by Gdtree.
2835 THIGZ *higzSave = higz;
2836 higzSave->SetName("higzSave");
2837 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2838 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2839 if (higzSpec) higz = higzSpec;
2840 else higzSpec = new THIGZ(defSize);
2841 higzSpec->SetName("higzSpec");
2846 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2849 higzSave->SetName("higz");
2853 //_____________________________________________________________________________
2854 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2858 // LEVMAX Depth level
2861 // This function draws the logical tree,
2862 // Each volume in the tree is represented by a TPaveTree object.
2863 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2864 // Use TPaveTree pop-up menu to select:
2867 // - drawing tree of parent
2873 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2877 //_____________________________________________________________________________
2878 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2882 // LEVMAX Depth level
2885 // This function draws the logical tree of the parent of name.
2889 // Scan list of volumes in JVOLUM
2891 Int_t gname, i, jvo, in, nin, jin, num;
2892 strncpy((char *) &gname, name, 4);
2893 for(i=1; i<=fGcnum->nvolum; i++) {
2894 jvo = fZlq[fGclink->jvolum-i];
2895 nin = Int_t(fZq[jvo+3]);
2896 if (nin == -1) nin = 1;
2897 for (in=1;in<=nin;in++) {
2899 num = Int_t(fZq[jin+2]);
2900 if(gname == fZiq[fGclink->jvolum+num]) {
2901 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2903 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2911 //_____________________________________________________________________________
2912 void TGeant3::SetABAN(Int_t par)
2915 // par = 1 particles will be stopped according to their residual
2916 // range if they are not in a sensitive material and are
2917 // far enough from the boundary
2918 // 0 particles are transported normally
2920 fGcphys->dphys1 = par;
2924 //_____________________________________________________________________________
2925 void TGeant3::SetANNI(Int_t par)
2928 // To control positron annihilation.
2929 // par =0 no annihilation
2930 // =1 annihilation. Decays processed.
2931 // =2 annihilation. No decay products stored.
2933 fGcphys->ianni = par;
2937 //_____________________________________________________________________________
2938 void TGeant3::SetAUTO(Int_t par)
2941 // To control automatic calculation of tracking medium parameters:
2942 // par =0 no automatic calculation;
2943 // =1 automati calculation.
2945 fGctrak->igauto = par;
2949 //_____________________________________________________________________________
2950 void TGeant3::SetBOMB(Float_t boom)
2953 // BOOM : Exploding factor for volumes position
2955 // To 'explode' the detector. If BOOM is positive (values smaller
2956 // than 1. are suggested, but any value is possible)
2957 // all the volumes are shifted by a distance
2958 // proportional to BOOM along the direction between their centre
2959 // and the origin of the MARS; the volumes which are symmetric
2960 // with respect to this origin are simply not shown.
2961 // BOOM equal to 0 resets the normal mode.
2962 // A negative (greater than -1.) value of
2963 // BOOM will cause an 'implosion'; for even lower values of BOOM
2964 // the volumes' positions will be reflected respect to the origin.
2965 // This command can be useful to improve the 3D effect for very
2966 // complex detectors. The following commands will make explode the
2973 //_____________________________________________________________________________
2974 void TGeant3::SetBREM(Int_t par)
2977 // To control bremstrahlung.
2978 // par =0 no bremstrahlung
2979 // =1 bremstrahlung. Photon processed.
2980 // =2 bremstrahlung. No photon stored.
2982 fGcphys->ibrem = par;
2986 //_____________________________________________________________________________
2987 void TGeant3::SetCKOV(Int_t par)
2990 // To control Cerenkov production
2991 // par =0 no Cerenkov;
2993 // =2 Cerenkov with primary stopped at each step.
2995 fGctlit->itckov = par;
2999 //_____________________________________________________________________________
3000 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3001 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3004 // The hidden line removal technique is necessary to visualize properly
3005 // very complex detectors. At the same time, it can be useful to visualize
3006 // the inner elements of a detector in detail. This function allows
3007 // subtractions (via boolean operation) of BOX shape from any part of
3008 // the detector, therefore showing its inner contents.
3009 // If "*" is given as the name of the
3010 // volume to be clipped, all volumes are clipped by the given box.
3011 // A volume can be clipped at most twice.
3012 // if a volume is explicitely clipped twice,
3013 // the "*" will not act on it anymore. Giving "." as the name
3014 // of the volume to be clipped will reset the clipping.
3016 // NAME Name of volume to be clipped
3018 // XMIN Lower limit of the Shape X coordinate
3019 // XMAX Upper limit of the Shape X coordinate
3020 // YMIN Lower limit of the Shape Y coordinate
3021 // YMAX Upper limit of the Shape Y coordinate
3022 // ZMIN Lower limit of the Shape Z coordinate
3023 // ZMAX Upper limit of the Shape Z coordinate
3025 // This function performs a boolean subtraction between the volume
3026 // NAME and a box placed in the MARS according the values of the given
3032 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3035 //_____________________________________________________________________________
3036 void TGeant3::SetCOMP(Int_t par)
3039 // To control Compton scattering
3040 // par =0 no Compton
3041 // =1 Compton. Electron processed.
3042 // =2 Compton. No electron stored.
3045 fGcphys->icomp = par;
3048 //_____________________________________________________________________________
3049 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3050 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3051 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3052 Float_t ppcutm, Float_t tofmax)
3055 // CUTGAM Cut for gammas D=0.001
3056 // CUTELE Cut for electrons D=0.001
3057 // CUTHAD Cut for charged hadrons D=0.01
3058 // CUTNEU Cut for neutral hadrons D=0.01
3059 // CUTMUO Cut for muons D=0.01
3060 // BCUTE Cut for electron brems. D=-1.
3061 // BCUTM Cut for muon brems. D=-1.
3062 // DCUTE Cut for electron delta-rays D=-1.
3063 // DCUTM Cut for muon delta-rays D=-1.
3064 // PPCUTM Cut for e+e- pairs by muons D=0.01
3065 // TOFMAX Time of flight cut D=1.E+10
3067 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3068 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3070 // If one of the parameters from CUTGAM to PPCUTM included
3071 // is modified, cross-sections and energy loss tables must be
3072 // recomputed via the function Gphysi.
3074 fGccuts->cutgam = cutgam;
3075 fGccuts->cutele = cutele;
3076 fGccuts->cutneu = cutneu;
3077 fGccuts->cuthad = cuthad;
3078 fGccuts->cutmuo = cutmuo;
3079 fGccuts->bcute = bcute;
3080 fGccuts->bcutm = bcutm;
3081 fGccuts->dcute = dcute;
3082 fGccuts->dcutm = dcutm;
3083 fGccuts->ppcutm = ppcutm;
3084 fGccuts->tofmax = tofmax;
3087 //_____________________________________________________________________________
3088 void TGeant3::SetDCAY(Int_t par)
3091 // To control Decay mechanism.
3092 // par =0 no decays.
3093 // =1 Decays. secondaries processed.
3094 // =2 Decays. No secondaries stored.
3096 fGcphys->idcay = par;
3100 //_____________________________________________________________________________
3101 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3104 // Set the debug flag and frequency
3105 // Selected debug output will be printed from
3106 // event emin to even emax each emod event
3108 fGcflag->idemin = emin;
3109 fGcflag->idemax = emax;
3110 fGcflag->itest = emod;
3114 //_____________________________________________________________________________
3115 void TGeant3::SetDRAY(Int_t par)
3118 // To control delta rays mechanism.
3119 // par =0 no delta rays.
3120 // =1 Delta rays. secondaries processed.
3121 // =2 Delta rays. No secondaries stored.
3123 fGcphys->idray = par;
3126 //_____________________________________________________________________________
3127 void TGeant3::SetHADR(Int_t par)
3130 // To control hadronic interactions.
3131 // par =0 no hadronic interactions.
3132 // =1 Hadronic interactions. secondaries processed.
3133 // =2 Hadronic interactions. No secondaries stored.
3135 fGcphys->ihadr = par;
3138 //_____________________________________________________________________________
3139 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3140 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3141 Float_t xk8, Float_t xk9, Float_t xk10)
3144 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3145 // Their meaning is user defined
3147 fGckine->ikine = kine;
3148 fGckine->pkine[0] = xk1;
3149 fGckine->pkine[1] = xk2;
3150 fGckine->pkine[2] = xk3;
3151 fGckine->pkine[3] = xk4;
3152 fGckine->pkine[4] = xk5;
3153 fGckine->pkine[5] = xk6;
3154 fGckine->pkine[6] = xk7;
3155 fGckine->pkine[7] = xk8;
3156 fGckine->pkine[8] = xk9;
3157 fGckine->pkine[9] = xk10;
3160 //_____________________________________________________________________________
3161 void TGeant3::SetLOSS(Int_t par)
3164 // To control energy loss.
3165 // par =0 no energy loss;
3166 // =1 restricted energy loss fluctuations;
3167 // =2 complete energy loss fluctuations;
3169 // =4 no energy loss fluctuations.
3170 // If the value ILOSS is changed, then cross-sections and energy loss
3171 // tables must be recomputed via the command 'PHYSI'.
3173 fGcphys->iloss = par;
3177 //_____________________________________________________________________________
3178 void TGeant3::SetMULS(Int_t par)
3181 // To control multiple scattering.
3182 // par =0 no multiple scattering.
3183 // =1 Moliere or Coulomb scattering.
3184 // =2 Moliere or Coulomb scattering.
3185 // =3 Gaussian scattering.
3187 fGcphys->imuls = par;
3191 //_____________________________________________________________________________
3192 void TGeant3::SetMUNU(Int_t par)
3195 // To control muon nuclear interactions.
3196 // par =0 no muon-nuclear interactions.
3197 // =1 Nuclear interactions. Secondaries processed.
3198 // =2 Nuclear interactions. Secondaries not processed.
3200 fGcphys->imunu = par;
3203 //_____________________________________________________________________________
3204 void TGeant3::SetOPTI(Int_t par)
3207 // This flag controls the tracking optimisation performed via the
3209 // 1 no optimisation at all; GSORD calls disabled;
3210 // 0 no optimisation; only user calls to GSORD kept;
3211 // 1 all non-GSORDered volumes are ordered along the best axis;
3212 // 2 all volumes are ordered along the best axis.
3214 fGcopti->ioptim = par;
3217 //_____________________________________________________________________________
3218 void TGeant3::SetPAIR(Int_t par)
3221 // To control pair production mechanism.
3222 // par =0 no pair production.
3223 // =1 Pair production. secondaries processed.
3224 // =2 Pair production. No secondaries stored.
3226 fGcphys->ipair = par;
3230 //_____________________________________________________________________________
3231 void TGeant3::SetPFIS(Int_t par)
3234 // To control photo fission mechanism.
3235 // par =0 no photo fission.
3236 // =1 Photo fission. secondaries processed.
3237 // =2 Photo fission. No secondaries stored.
3239 fGcphys->ipfis = par;
3242 //_____________________________________________________________________________
3243 void TGeant3::SetPHOT(Int_t par)
3246 // To control Photo effect.
3247 // par =0 no photo electric effect.
3248 // =1 Photo effect. Electron processed.
3249 // =2 Photo effect. No electron stored.
3251 fGcphys->iphot = par;
3254 //_____________________________________________________________________________
3255 void TGeant3::SetRAYL(Int_t par)
3258 // To control Rayleigh scattering.
3259 // par =0 no Rayleigh scattering.
3262 fGcphys->irayl = par;
3265 //_____________________________________________________________________________
3266 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3270 // val New switch value
3272 // Change one element of array ISWIT(10) in /GCFLAG/
3274 if (sw <= 0 || sw > 10) return;
3275 fGcflag->iswit[sw-1] = val;
3279 //_____________________________________________________________________________
3280 void TGeant3::SetTRIG(Int_t nevents)
3283 // Set number of events to be run
3285 fGcflag->nevent = nevents;
3288 //_____________________________________________________________________________
3289 void TGeant3::SetUserDecay(Int_t pdg)
3292 // Force the decays of particles to be done with Pythia
3293 // and not with the Geant routines.
3294 // just kill pointers doing mzdrop
3296 Int_t ipart = IdFromPDG(pdg);
3298 printf("Particle %d not in geant\n",pdg);
3301 Int_t jpart=fGclink->jpart;
3302 Int_t jpa=fZlq[jpart-ipart];
3305 Int_t jpa1=fZlq[jpa-1];
3307 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3308 Int_t jpa2=fZlq[jpa-2];
3310 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3314 //______________________________________________________________________________
3315 void TGeant3::Vname(const char *name, char *vname)
3318 // convert name to upper case. Make vname at least 4 chars
3320 Int_t l = strlen(name);
3323 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3324 for (i=l;i<4;i++) vname[i] = ' ';
3328 //______________________________________________________________________________
3329 void TGeant3::Ertrgo()
3334 //______________________________________________________________________________
3335 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3336 const Float_t *x2, const Float_t *p2,
3337 Int_t ipa, Option_t *chopt)
3339 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3342 //_____________________________________________________________________________
3343 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3344 Int_t number, Int_t nlevel)
3348 // ******************************************************************
3350 // * Write out the geometry of the detector in EUCLID file format *
3352 // * filnam : will be with the extension .euc *
3353 // * topvol : volume name of the starting node *
3354 // * number : copy number of topvol (relevant for gsposp) *
3355 // * nlevel : number of levels in the tree structure *
3356 // * to be written out, starting from topvol *
3358 // * Author : M. Maire *
3360 // ******************************************************************
3362 // File filnam.tme is written out with the definitions of tracking
3363 // medias and materials.
3364 // As to restore original numbers for materials and medias, program
3365 // searches in the file euc_medi.dat and comparing main parameters of
3366 // the mat. defined inside geant and the one in file recognizes them
3367 // and is able to take number from file. If for any material or medium,
3368 // this procedure fails, ordering starts from 1.
3369 // Arrays IOTMED and IOMATE are used for this procedure
3371 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3372 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3374 Int_t i, end, itm, irm, jrm, k, nmed;
3378 char *filext, *filetme;
3379 char natmed[21], namate[21];
3380 char natmedc[21], namatec[21];
3381 char key[5], name[5], mother[5], konly[5];
3383 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3384 Int_t mlevel, numbr, natt, numed, nin, ndata;
3385 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3386 Int_t jdiv, ivin, in, jin, jvin, irot;
3387 Int_t jtm, imat, jma, flag=0, imatc;
3388 Float_t az, dens, radl, absl, a, step, x, y, z;
3389 Int_t npar, ndvmx, left;
3390 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3392 Int_t iomate[100], iotmed[100];
3393 Float_t par[50], att[20], ubuf[50];
3396 Int_t level, ndiv, iaxe;
3397 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3398 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3399 Float_t tmaxf, stemax, deemax, epsil, stmin;
3400 const char *f10000="!\n%s\n!\n";
3401 //Open the input file
3403 for(i=0;i<end;i++) if(filnam[i]=='.') {
3407 filext=new char[end+4];
3408 filetme=new char[end+4];
3409 strncpy(filext,filnam,end);
3410 strncpy(filetme,filnam,end);
3412 // *** The output filnam name will be with extension '.euc'
3413 strcpy(&filext[end],".euc");
3414 strcpy(&filetme[end],".tme");
3415 lun=fopen(filext,"w");
3417 // *** Initialisation of the working space
3418 iadvol=fGcnum->nvolum;
3419 iadtmd=iadvol+fGcnum->nvolum;
3420 iadrot=iadtmd+fGcnum->ntmed;
3421 if(fGclink->jrotm) {
3422 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3426 nwtot=iadrot+fGcnum->nrotm;
3427 qws = new float[nwtot+1];
3428 for (i=0;i<nwtot+1;i++) qws[i]=0;
3431 if(nlevel==0) mlevel=20;
3433 // *** find the top volume and put it in the stak
3434 numbr = number>0 ? number : 1;
3435 Gfpara(topvol,numbr,1,npar,natt,par,att);
3437 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3442 // *** authorized shape ?
3443 strncpy((char *)&iname, topvol, 4);
3445 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3449 jvo = fZlq[fGclink->jvolum-ivo];
3450 ish = Int_t (fZq[jvo+2]);
3452 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3459 iws[iadvol+ivo] = level;
3462 //*** flag all volumes and fill the stak
3466 // pick the next volume in stak
3468 ivo = TMath::Abs(iws[ivstak]);
3469 jvo = fZlq[fGclink->jvolum - ivo];
3471 // flag the tracking medium
3472 numed = Int_t (fZq[jvo + 4]);
3473 iws[iadtmd + numed] = 1;
3475 // get the daughters ...
3476 level = iws[iadvol+ivo];
3477 if (level < mlevel) {
3479 nin = Int_t (fZq[jvo + 3]);
3481 // from division ...
3483 jdiv = fZlq[jvo - 1];
3484 ivin = Int_t (fZq[jdiv + 2]);
3486 iws[nvstak] = -ivin;
3487 iws[iadvol+ivin] = level;
3489 // from position ...
3490 } else if (nin > 0) {
3491 for(in=1; in<=nin; in++) {
3492 jin = fZlq[jvo - in];
3493 ivin = Int_t (fZq[jin + 2 ]);
3494 jvin = fZlq[fGclink->jvolum - ivin];
3495 ish = Int_t (fZq[jvin + 2]);
3496 // authorized shape ?
3498 // not yet flagged ?
3499 if (iws[iadvol+ivin]==0) {
3502 iws[iadvol+ivin] = level;
3504 // flag the rotation matrix
3505 irot = Int_t ( fZq[jin + 4 ]);
3506 if (irot > 0) iws[iadrot+irot] = 1;
3512 // next volume in stak ?
3513 if (ivstak < nvstak) goto L10;
3515 // *** restore original material and media numbers
3516 // file euc_medi.dat is needed to compare materials and medias
3518 FILE* luncor=fopen("euc_medi.dat","r");
3521 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3522 if (iws[iadtmd+itm] > 0) {
3523 jtm = fZlq[fGclink->jtmed-itm];
3524 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3525 imat = Int_t (fZq[jtm+6]);
3526 jma = fZlq[fGclink->jmate-imat];
3528 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3531 strncpy(namate,(char *)&fZiq[jma+1],20);
3534 //** find the material original number
3537 iret=fscanf(luncor,"%4s,%130s",key,card);
3538 if(iret<=0) goto L26;
3540 if(!strcmp(key,"MATE")) {
3541 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3542 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3543 if(!strcmp(namatec,namate)) {
3544 if(az==a && zc==z && densc==dens && radlc==radl
3545 && abslc==absl && nparc==nparc) {
3548 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3550 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3554 if(strcmp(key,"END") && !flag) goto L23;
3556 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3560 //*** restore original tracking medium number
3563 iret=fscanf(luncor,"%4s,%130s",key,card);
3564 if(iret<=0) goto L26;
3566 if (!strcmp(key,"TMED")) {
3567 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3568 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3569 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3570 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3571 epsil,stmin,ubuf,&nwbuf);
3572 if(!strcmp(natmedc,natmed)) {
3573 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3576 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3579 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3583 if(strcmp(key,"END") && !flag) goto L24;
3585 printf("cannot restore original number for medium : %s\n",natmed);
3593 L26: printf("*** GWEUCL *** cannot read the data file\n");
3595 L29: if(luncor) fclose (luncor);
3598 // *** write down the tracking medium definition
3600 strcpy(card,"! Tracking medium");
3601 fprintf(lun,f10000,card);
3603 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3604 if (iws[iadtmd+itm]>0) {
3605 jtm = fZlq[fGclink->jtmed-itm];
3606 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3608 imat = Int_t (fZq[jtm+6]);
3609 jma = fZlq[fGclink->jmate-imat];
3610 //* order media from one, if comparing with database failed
3612 iotmed[itm]=++imxtmed;
3613 iomate[imat]=++imxmate;
3618 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",