1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface Class to the Geant3.21 MonteCarlo //
7 <img src="picts/TGeant3Class.gif">
12 ///////////////////////////////////////////////////////////////////////////////
18 #include <TDatabasePDG.h>
19 #include "AliCallf77.h"
22 # define gzebra gzebra_
23 # define grfile grfile_
24 # define gpcxyz gpcxyz_
25 # define ggclos ggclos_
28 # define gcinit gcinit_
31 # define gtrigc gtrigc_
32 # define gtrigi gtrigi_
34 # define gzinit gzinit_
35 # define gfmate gfmate_
36 # define gfpart gfpart_
37 # define gftmed gftmed_
41 # define gsmate gsmate_
42 # define gsmixt gsmixt_
43 # define gspart gspart_
44 # define gstmed gstmed_
45 # define gsckov gsckov_
46 # define gstpar gstpar_
47 # define gfkine gfkine_
48 # define gfvert gfvert_
49 # define gskine gskine_
50 # define gsvert gsvert_
51 # define gphysi gphysi_
52 # define gdebug gdebug_
53 # define gekbin gekbin_
54 # define gfinds gfinds_
55 # define gsking gsking_
56 # define gskpho gskpho_
57 # define gsstak gsstak_
59 # define gtrack gtrack_
60 # define gtreve gtreve_
61 # define gtreve_root gtreve_root_
63 # define grndmq grndmq_
65 # define glmoth glmoth_
66 # define gmedia gmedia_
69 # define gsdvn2 gsdvn2_
71 # define gsdvs2 gsdvs2_
73 # define gsdvt2 gsdvt2_
76 # define gsposp gsposp_
77 # define gsrotm gsrotm_
78 # define gprotm gprotm_
79 # define gsvolu gsvolu_
80 # define gprint gprint_
81 # define gdinit gdinit_
84 # define gdrayt gdrayt_
85 # define gdrawc gdrawc_
86 # define gdrawx gdrawx_
87 # define gdhead gdhead_
88 # define gdwmn1 gdwmn1_
89 # define gdwmn2 gdwmn2_
90 # define gdwmn3 gdwmn3_
92 # define gdcxyz gdcxyz_
94 # define gdspec gdspec_
95 # define gdtree gdtree_
96 # define gdelet gdelet_
97 # define gdclos gdclos_
98 # define gdshow gdshow_
99 # define gdopen gdopen_
100 # define dzshow dzshow_
101 # define gsatt gsatt_
102 # define gfpara gfpara_
103 # define gckpar gckpar_
104 # define gckmat gckmat_
105 # define geditv geditv_
106 # define mzdrop mzdrop_
108 # define ertrak ertrak_
109 # define ertrgo ertrgo_
111 # define setbomb setbomb_
112 # define setclip setclip_
113 # define gcomad gcomad_
116 # define gzebra GZEBRA
117 # define grfile GRFILE
118 # define gpcxyz GPCXYZ
119 # define ggclos GGCLOS
122 # define gcinit GCINIT
125 # define gtrigc GTRIGC
126 # define gtrigi GTRIGI
128 # define gzinit GZINIT
129 # define gfmate GFMATE
130 # define gfpart GFPART
131 # define gftmed GFTMED
135 # define gsmate GSMATE
136 # define gsmixt GSMIXT
137 # define gspart GSPART
138 # define gstmed GSTMED
139 # define gsckov GSCKOV
140 # define gstpar GSTPAR
141 # define gfkine GFKINE
142 # define gfvert GFVERT
143 # define gskine GSKINE
144 # define gsvert GSVERT
145 # define gphysi GPHYSI
146 # define gdebug GDEBUG
147 # define gekbin GEKBIN
148 # define gfinds GFINDS
149 # define gsking GSKING
150 # define gskpho GSKPHO
151 # define gsstak GSSTAK
153 # define gtrack GTRACK
154 # define gtreve GTREVE
155 # define gtreve_root GTREVE_ROOT
157 # define grndmq GRNDMQ
159 # define glmoth GLMOTH
160 # define gmedia GMEDIA
163 # define gsdvn2 GSDVN2
165 # define gsdvs2 GSDVS2
167 # define gsdvt2 GSDVT2
170 # define gsposp GSPOSP
171 # define gsrotm GSROTM
172 # define gprotm GPROTM
173 # define gsvolu GSVOLU
174 # define gprint GPRINT
175 # define gdinit GDINIT
178 # define gdrayt GDRAYT
179 # define gdrawc GDRAWC
180 # define gdrawx GDRAWX
181 # define gdhead GDHEAD
182 # define gdwmn1 GDWMN1
183 # define gdwmn2 GDWMN2
184 # define gdwmn3 GDWMN3
186 # define gdcxyz GDCXYZ
188 # define gdfspc GDFSPC
189 # define gdspec GDSPEC
190 # define gdtree GDTREE
191 # define gdelet GDELET
192 # define gdclos GDCLOS
193 # define gdshow GDSHOW
194 # define gdopen GDOPEN
195 # define dzshow DZSHOW
197 # define gfpara GFPARA
198 # define gckpar GCKPAR
199 # define gckmat GCKMAT
200 # define geditv GEDITV
201 # define mzdrop MZDROP
203 # define ertrak ERTRAK
204 # define ertrgo ERTRGO
206 # define setbomb SETBOMB
207 # define setclip SETCLIP
208 # define gcomad GCOMAD
212 //____________________________________________________________________________
216 // Prototypes for GEANT functions
218 void type_of_call gzebra(const int&);
220 void type_of_call gpcxyz();
222 void type_of_call ggclos();
224 void type_of_call glast();
226 void type_of_call ginit();
228 void type_of_call gcinit();
230 void type_of_call grun();
232 void type_of_call gtrig();
234 void type_of_call gtrigc();
236 void type_of_call gtrigi();
238 void type_of_call gwork(const int&);
240 void type_of_call gzinit();
242 void type_of_call gmate();
244 void type_of_call gpart();
246 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
248 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
249 Int_t &, Float_t *, Int_t &);
251 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
252 Float_t &, Float_t *, Int_t &);
254 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
257 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
260 void type_of_call gphysi();
262 void type_of_call gdebug();
264 void type_of_call gekbin();
266 void type_of_call gfinds();
268 void type_of_call gsking(Int_t &);
270 void type_of_call gskpho(Int_t &);
272 void type_of_call gsstak(Int_t &);
274 void type_of_call gsxyz();
276 void type_of_call gtrack();
278 void type_of_call gtreve();
280 void type_of_call gtreve_root();
282 void type_of_call grndm(Float_t *, const Int_t &);
284 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
287 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
289 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
290 Int_t *, Int_t * DEFCHARL);
292 void type_of_call gmedia(Float_t *, Int_t &);
294 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
296 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
297 const Float_t &, const Float_t &, const Float_t &,
300 void type_of_call gprotm(const Int_t &);
302 void type_of_call grfile(const Int_t&, DEFCHARD,
303 DEFCHARD DEFCHARL DEFCHARL);
305 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
306 Float_t &, Float_t &, Float_t &, Float_t *,
309 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
310 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
312 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
313 Float_t &, Float_t &, Float_t &, Float_t &,
314 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
316 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
317 Float_t &, Float_t &, Float_t &, Float_t *,
320 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
321 Float_t &, Int_t &, Float_t * DEFCHARL);
323 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
324 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
327 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
328 Float_t &, Float_t &, Float_t &, Float_t &,
329 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
331 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
332 Float_t *absco, Float_t *effic, Float_t *rindex);
333 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
335 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
338 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
339 Int_t & DEFCHARL DEFCHARL);
341 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
344 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
345 Int_t & DEFCHARL DEFCHARL);
347 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
348 Int_t & DEFCHARL DEFCHARL);
350 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
351 Int_t &, Int_t & DEFCHARL DEFCHARL);
353 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
355 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
356 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
359 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
360 Float_t &, Int_t &, DEFCHARD,
361 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
363 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
364 Int_t & DEFCHARL DEFCHARL);
366 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
368 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
371 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
373 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
375 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
377 void type_of_call gdinit();
379 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
381 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
382 Float_t &, Float_t &, Float_t & DEFCHARL);
383 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
384 Float_t &, Float_t &, Float_t & DEFCHARL);
385 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
386 Float_t &, Float_t & DEFCHARL);
387 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
388 Float_t &, Float_t &, Float_t &, Float_t &,
390 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
391 void type_of_call gdxyz(Int_t &);
392 void type_of_call gdcxyz();
393 void type_of_call gdman(Float_t &, Float_t &);
394 void type_of_call gdwmn1(Float_t &, Float_t &);
395 void type_of_call gdwmn2(Float_t &, Float_t &);
396 void type_of_call gdwmn3(Float_t &, Float_t &);
397 void type_of_call gdspec(DEFCHARD DEFCHARL);
398 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
399 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
401 void type_of_call gdopen(Int_t &);
402 void type_of_call gdclos();
403 void type_of_call gdelet(Int_t &);
404 void type_of_call gdshow(Int_t &);
405 void type_of_call geditv(Int_t &) {;}
408 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
409 const int&, const int&, const int& DEFCHARL
412 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
414 void type_of_call setbomb(Float_t &);
415 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
416 Float_t &, Float_t & DEFCHARL);
417 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
419 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
420 const Float_t *x2, const Float_t *p2,
421 const Int_t &ipa, DEFCHARD DEFCHARL);
423 void type_of_call ertrgo();
427 // Geant3 global pointer
429 static Int_t defSize = 600;
433 //____________________________________________________________________________
437 // Default constructor
441 //____________________________________________________________________________
442 TGeant3::TGeant3(const char *title, Int_t nwgeant)
443 :AliMC("TGeant3",title)
446 // Standard constructor for TGeant3 with ZEBRA initialisation
457 // Load Address of Geant3 commons
460 // Zero number of particles
464 //____________________________________________________________________________
465 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
466 Float_t &radl, Float_t &absl) const
469 // Return the parameters of the current material during transport
473 dens = fGcmate->dens;
474 radl = fGcmate->radl;
475 absl = fGcmate->absl;
476 return 1; //this could be the number of elements in mixture
479 //____________________________________________________________________________
480 void TGeant3::DefaultRange()
483 // Set range of current drawing pad to 20x20 cm
489 higz->Range(0,0,20,20);
492 //____________________________________________________________________________
493 void TGeant3::InitHIGZ()
504 //____________________________________________________________________________
505 void TGeant3::LoadAddress()
508 // Assigns the address of the GEANT common blocks to the structures
509 // that allow their access from C++
512 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
513 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
514 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
515 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
516 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
517 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
518 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
519 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
520 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
521 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
522 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
523 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
524 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
525 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
526 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
527 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
528 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
529 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
530 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
531 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
534 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
535 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
536 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
537 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
539 // Variables for ZEBRA store
540 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
542 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
547 //_____________________________________________________________________________
548 void TGeant3::GeomIter()
551 // Geometry iterator for moving upward in the geometry tree
552 // Initialise the iterator
554 fNextVol=fGcvolu->nlevel;
557 //____________________________________________________________________________
558 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
561 // Geometry iterator for moving upward in the geometry tree
562 // Return next volume up
567 gname=fGcvolu->names[fNextVol];
568 strncpy(name,(char *) &gname, 4);
570 copy=fGcvolu->number[fNextVol];
571 i=fGcvolu->lvolum[fNextVol];
572 if(gname == fZiq[fGclink->jvolum+i]) return i;
573 else printf("GeomTree: Volume %s not found in bank\n",name);
578 //_____________________________________________________________________________
579 Int_t TGeant3::CurrentVolID(Int_t ©) const
582 // Returns the current volume ID and copy number
585 if( (i=fGcvolu->nlevel-1) < 0 ) {
586 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
588 gname=fGcvolu->names[i];
589 copy=fGcvolu->number[i];
590 i=fGcvolu->lvolum[i];
591 if(gname == fZiq[fGclink->jvolum+i]) return i;
592 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
597 //_____________________________________________________________________________
598 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
601 // Return the current volume "off" upward in the geometrical tree
602 // ID and copy number
605 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
606 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
607 off,fGcvolu->nlevel);
609 gname=fGcvolu->names[i];
610 copy=fGcvolu->number[i];
611 i=fGcvolu->lvolum[i];
612 if(gname == fZiq[fGclink->jvolum+i]) return i;
613 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
618 //_____________________________________________________________________________
619 const char* TGeant3::CurrentVolName() const
622 // Returns the current volume name
626 if( (i=fGcvolu->nlevel-1) < 0 ) {
627 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
629 gname=fGcvolu->names[i];
631 strncpy(name,(char *) &gname, 4);
633 i=fGcvolu->lvolum[i];
634 if(gname == fZiq[fGclink->jvolum+i]) return name;
635 else Warning("CurrentVolName","Volume %4s not found\n",name);
640 //_____________________________________________________________________________
641 const char* TGeant3::CurrentVolOffName(Int_t off) const
644 // Return the current volume "off" upward in the geometrical tree
645 // ID, name and copy number
646 // if name=0 no name is returned
650 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
651 Warning("CurrentVolOffName",
652 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
654 gname=fGcvolu->names[i];
656 strncpy(name,(char *) &gname, 4);
658 i=fGcvolu->lvolum[i];
659 if(gname == fZiq[fGclink->jvolum+i]) return name;
660 else Warning("CurrentVolOffName","Volume %4s not found\n",name);
665 //_____________________________________________________________________________
666 Int_t TGeant3::IdFromPDG(Int_t pdg) const
669 // Return Geant3 code from PDG and pseudo ENDF code
671 for(Int_t i=0;i<fNPDGCodes;++i)
672 if(pdg==fPDGCode[i]) return i;
676 //_____________________________________________________________________________
677 Int_t TGeant3::PDGFromId(Int_t id) const
679 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
683 //_____________________________________________________________________________
684 void TGeant3::DefineParticles()
687 // Define standard Geant 3 particles
690 // Load standard numbers for GEANT particles and PDG conversion
691 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
692 fPDGCode[fNPDGCodes++]=22; // 1 = photon
693 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
694 fPDGCode[fNPDGCodes++]=11; // 3 = electron
695 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
696 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
697 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
698 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
699 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
700 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
701 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
702 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
703 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
704 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
705 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
706 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
707 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
708 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
709 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
710 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
711 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
712 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
713 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
714 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
715 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
716 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
717 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
718 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
719 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
720 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
721 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
722 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
723 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
730 /* --- Define additional particles */
731 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
732 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
734 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
735 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
737 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
738 fPDGCode[fNPDGCodes++]=411; // 35 = D+
740 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
741 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
743 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
744 fPDGCode[fNPDGCodes++]=421; // 37 = D0
746 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
747 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
749 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
751 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
753 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
755 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
756 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
758 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
759 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
761 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
762 fPDGCode[fNPDGCodes++]=113; // 37 = D0
765 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
767 // and numbers above 5 000 000 for special applications
770 const Int_t kion=10000000;
772 const Int_t kspe=50000000;
774 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
776 const Double_t autogev=0.9314943228;
777 const Double_t hslash = 1.0545726663e-27;
778 const Double_t erggev = 1/1.6021773349e-3;
779 const Double_t hshgev = hslash*erggev;
780 const Double_t yearstosec = 3600*24*365.25;
783 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
784 0,1,"Ion",kion+10020);
785 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
787 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
788 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
789 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
791 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
792 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
793 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
795 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
797 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
798 0,2,"Ion",kion+20030);
799 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
801 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
802 0,0,"Special",kspe+50);
803 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
805 /* --- Define additional decay modes --- */
806 /* --- omega(783) --- */
807 for (kz = 0; kz < 6; ++kz) {
818 Gsdk(ipa, bratio, mode);
819 /* --- phi(1020) --- */
820 for (kz = 0; kz < 6; ++kz) {
835 Gsdk(ipa, bratio, mode);
837 for (kz = 0; kz < 6; ++kz) {
850 Gsdk(ipa, bratio, mode);
852 for (kz = 0; kz < 6; ++kz) {
865 Gsdk(ipa, bratio, mode);
867 for (kz = 0; kz < 6; ++kz) {
878 Gsdk(ipa, bratio, mode);
879 /* --- Anti D0 --- */
880 for (kz = 0; kz < 6; ++kz) {
891 Gsdk(ipa, bratio, mode);
893 for (kz = 0; kz < 6; ++kz) {
900 Gsdk(ipa, bratio, mode);
902 for (kz = 0; kz < 6; ++kz) {
909 Gsdk(ipa, bratio, mode);
911 for (kz = 0; kz < 6; ++kz) {
918 Gsdk(ipa, bratio, mode);
921 for (kz = 0; kz < 6; ++kz) {
930 Gsdk(ipa, bratio, mode);
933 Gsdk(ipa, bratio, mode);
936 Gsdk(ipa, bratio, mode);
941 //_____________________________________________________________________________
942 Int_t TGeant3::VolId(Text_t *name) const
945 // Return the unique numeric identifier for volume name
948 strncpy((char *) &gname, name, 4);
949 for(i=1; i<=fGcnum->nvolum; i++)
950 if(gname == fZiq[fGclink->jvolum+i]) return i;
951 printf("VolId: Volume %s not found\n",name);
955 //_____________________________________________________________________________
956 Int_t TGeant3::NofVolumes() const
959 // Return total number of volumes in the geometry
961 return fGcnum->nvolum;
964 //_____________________________________________________________________________
965 const char* TGeant3::VolName(Int_t id) const
968 // Return the volume name given the volume identifier
971 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
974 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
979 //_____________________________________________________________________________
980 void TGeant3::TrackPosition(TLorentzVector &xyz) const
983 // Return the current position in the master reference frame of the
984 // track being transported
986 xyz[0]=fGctrak->vect[0];
987 xyz[1]=fGctrak->vect[1];
988 xyz[2]=fGctrak->vect[2];
989 xyz[3]=fGctrak->tofg;
992 //_____________________________________________________________________________
993 Float_t TGeant3::TrackTime() const
996 // Return the current time of flight of the track being transported
998 return fGctrak->tofg;
1001 //_____________________________________________________________________________
1002 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1005 // Return the direction and the momentum (GeV/c) of the track
1006 // currently being transported
1008 Double_t ptot=fGctrak->vect[6];
1009 xyz[0]=fGctrak->vect[3]*ptot;
1010 xyz[1]=fGctrak->vect[4]*ptot;
1011 xyz[2]=fGctrak->vect[5]*ptot;
1012 xyz[3]=fGctrak->getot;
1015 //_____________________________________________________________________________
1016 Float_t TGeant3::TrackCharge() const
1019 // Return charge of the track currently transported
1021 return fGckine->charge;
1024 //_____________________________________________________________________________
1025 Float_t TGeant3::TrackMass() const
1028 // Return the mass of the track currently transported
1030 return fGckine->amass;
1033 //_____________________________________________________________________________
1034 Int_t TGeant3::TrackPid() const
1037 // Return the id of the particle transported
1039 return PDGFromId(fGckine->ipart);
1042 //_____________________________________________________________________________
1043 Float_t TGeant3::TrackStep() const
1046 // Return the length in centimeters of the current step
1048 return fGctrak->step;
1051 //_____________________________________________________________________________
1052 Float_t TGeant3::TrackLength() const
1055 // Return the length of the current track from its origin
1057 return fGctrak->sleng;
1060 //_____________________________________________________________________________
1061 Bool_t TGeant3::IsTrackInside() const
1064 // True if the track is not at the boundary of the current volume
1066 return (fGctrak->inwvol==0);
1069 //_____________________________________________________________________________
1070 Bool_t TGeant3::IsTrackEntering() const
1073 // True if this is the first step of the track in the current volume
1075 return (fGctrak->inwvol==1);
1078 //_____________________________________________________________________________
1079 Bool_t TGeant3::IsTrackExiting() const
1082 // True if this is the last step of the track in the current volume
1084 return (fGctrak->inwvol==2);
1087 //_____________________________________________________________________________
1088 Bool_t TGeant3::IsTrackOut() const
1091 // True if the track is out of the setup
1093 return (fGctrak->inwvol==3);
1096 //_____________________________________________________________________________
1097 Bool_t TGeant3::IsTrackStop() const
1100 // True if the track energy has fallen below the threshold
1102 return (fGctrak->istop==2);
1105 //_____________________________________________________________________________
1106 Int_t TGeant3::NSecondaries() const
1109 // Number of secondary particles generated in the current step
1111 return fGcking->ngkine;
1114 //_____________________________________________________________________________
1115 Int_t TGeant3::CurrentEvent() const
1118 // Number of the current event
1120 return fGcflag->idevt;
1123 //_____________________________________________________________________________
1124 void TGeant3::ProdProcess(char* proc) const
1127 // Name of the process that has produced the secondary particles
1128 // in the current step
1130 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1133 if(fGcking->ngkine>0) {
1134 for (km = 0; km < fGctrak->nmec; ++km) {
1135 for (im = 0; im < 13; ++im) {
1136 if (fGctrak->lmec[km] == ipmec[im]) {
1137 mec = fGctrak->lmec[km];
1138 if (0 < mec && mec < 31) {
1139 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1140 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1141 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1148 strcpy(proc,"UNKN");
1149 } else strcpy(proc,"NONE");
1152 //_____________________________________________________________________________
1153 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p)
1156 // Get the parameters of the secondary track number isec produced
1157 // in the current step
1160 if(-1<isec && isec<fGcking->ngkine) {
1161 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1163 x[i]=fGckin3->gpos[isec][i];
1164 p[i]=fGcking->gkin[isec][i];
1166 x[3]=fGcking->tofd[isec];
1167 p[3]=fGcking->gkin[isec][3];
1169 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1170 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1175 //_____________________________________________________________________________
1176 void TGeant3::InitLego()
1179 SetDEBU(0,0,0); //do not print a message
1182 //_____________________________________________________________________________
1183 Bool_t TGeant3::IsTrackDisappeared() const
1186 // True if the current particle has disappered
1187 // either because it decayed or because it underwent
1188 // an inelastic collision
1190 return (fGctrak->istop==1);
1193 //_____________________________________________________________________________
1194 Bool_t TGeant3::IsTrackAlive() const
1197 // True if the current particle is alive and will continue to be
1200 return (fGctrak->istop==0);
1203 //_____________________________________________________________________________
1204 void TGeant3::StopTrack()
1207 // Stop the transport of the current particle and skip to the next
1212 //_____________________________________________________________________________
1213 void TGeant3::StopEvent()
1216 // Stop simulation of the current event and skip to the next
1221 //_____________________________________________________________________________
1222 Float_t TGeant3::MaxStep() const
1225 // Return the maximum step length in the current medium
1227 return fGctmed->stemax;
1230 //_____________________________________________________________________________
1231 void TGeant3::SetColors()
1234 // Set the colors for all the volumes
1235 // this is done sequentially for all volumes
1236 // based on the number of their medium
1239 Int_t jvolum=fGclink->jvolum;
1240 //Int_t jtmed=fGclink->jtmed;
1241 //Int_t jmate=fGclink->jmate;
1242 Int_t nvolum=fGcnum->nvolum;
1245 // Now for all the volumes
1246 for(kv=1;kv<=nvolum;kv++) {
1247 // Get the tracking medium
1248 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1250 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1252 //Float_t z=fZq[fZlq[jmate-ima]+7];
1253 // Find color number
1254 //icol = Int_t(z)%6+2;
1255 //icol = 17+Int_t(z*150./92.);
1258 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1260 Gsatt(name,"COLO",icol);
1264 //_____________________________________________________________________________
1265 void TGeant3::SetMaxStep(Float_t maxstep)
1268 // Set the maximum step allowed till the particle is in the current medium
1270 fGctmed->stemax=maxstep;
1273 //_____________________________________________________________________________
1274 void TGeant3::SetMaxNStep(Int_t maxnstp)
1277 // Set the maximum number of steps till the particle is in the current medium
1279 fGctrak->maxnst=maxnstp;
1282 //_____________________________________________________________________________
1283 Int_t TGeant3::GetMaxNStep() const
1286 // Maximum number of steps allowed in current medium
1288 return fGctrak->maxnst;
1291 //_____________________________________________________________________________
1292 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1293 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1297 // Defines a Material
1299 // kmat number assigned to the material
1300 // name material name
1301 // a atomic mass in au
1303 // dens density in g/cm3
1304 // absl absorbtion length in cm
1305 // if >=0 it is ignored and the program
1306 // calculates it, if <0. -absl is taken
1307 // radl radiation length in cm
1308 // if >=0 it is ignored and the program
1309 // calculates it, if <0. -radl is taken
1310 // buf pointer to an array of user words
1311 // nbuf number of user words
1313 Int_t jmate=fGclink->jmate;
1319 for(i=1; i<=ns; i++) {
1320 if(fZlq[jmate-i]==0) {
1326 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1327 nwbuf PASSCHARL(name));
1330 //_____________________________________________________________________________
1331 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1332 Float_t dens, Int_t nlmat, Float_t* wmat)
1335 // Defines mixture OR COMPOUND IMAT as composed by
1336 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1338 // If NLMAT > 0 then wmat contains the proportion by
1339 // weights of each basic material in the mixture.
1341 // If nlmat < 0 then WMAT contains the number of atoms
1342 // of a given kind into the molecule of the COMPOUND
1343 // In this case, WMAT in output is changed to relative
1346 Int_t jmate=fGclink->jmate;
1352 for(i=1; i<=ns; i++) {
1353 if(fZlq[jmate-i]==0) {
1359 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1362 //_____________________________________________________________________________
1363 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1364 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1365 Float_t stemax, Float_t deemax, Float_t epsil,
1366 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1369 // kmed tracking medium number assigned
1370 // name tracking medium name
1371 // nmat material number
1372 // isvol sensitive volume flag
1373 // ifield magnetic field
1374 // fieldm max. field value (kilogauss)
1375 // tmaxfd max. angle due to field (deg/step)
1376 // stemax max. step allowed
1377 // deemax max. fraction of energy lost in a step
1378 // epsil tracking precision (cm)
1379 // stmin min. step due to continuos processes (cm)
1381 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1382 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1383 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1385 Int_t jtmed=fGclink->jtmed;
1391 for(i=1; i<=ns; i++) {
1392 if(fZlq[jtmed-i]==0) {
1398 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1399 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1402 //_____________________________________________________________________________
1403 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1404 Float_t phiy, Float_t thez, Float_t phiz)
1407 // krot rotation matrix number assigned
1408 // theta1 polar angle for axis i
1409 // phi1 azimuthal angle for axis i
1410 // theta2 polar angle for axis ii
1411 // phi2 azimuthal angle for axis ii
1412 // theta3 polar angle for axis iii
1413 // phi3 azimuthal angle for axis iii
1415 // it defines the rotation matrix number irot.
1417 Int_t jrotm=fGclink->jrotm;
1423 for(i=1; i<=ns; i++) {
1424 if(fZlq[jrotm-i]==0) {
1430 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1433 //_____________________________________________________________________________
1434 Int_t TGeant3::GetMedium() const
1437 // Return the number of the current medium
1439 return fGctmed->numed;
1442 //_____________________________________________________________________________
1443 Float_t TGeant3::Edep() const
1446 // Return the energy lost in the current step
1448 return fGctrak->destep;
1451 //_____________________________________________________________________________
1452 Float_t TGeant3::Etot() const
1455 // Return the total energy of the current track
1457 return fGctrak->getot;
1460 //_____________________________________________________________________________
1461 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1464 // Return an array of n random numbers uniformly distributed
1465 // between 0 and 1 not included
1470 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1472 // Functions from GBASE
1474 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1476 //____________________________________________________________________________
1477 void TGeant3::Gfile(const char *filename, const char *option)
1480 // Routine to open a GEANT/RZ data base.
1482 // LUN logical unit number associated to the file
1484 // CHFILE RZ file name
1486 // CHOPT is a character string which may be
1487 // N To create a new file
1488 // U to open an existing file for update
1489 // " " to open an existing file for read only
1490 // Q The initial allocation (default 1000 records)
1491 // is given in IQUEST(10)
1492 // X Open the file in exchange format
1493 // I Read all data structures from file to memory
1494 // O Write all data structures from memory to file
1497 // If options "I" or "O" all data structures are read or
1498 // written from/to file and the file is closed.
1499 // See routine GRMDIR to create subdirectories
1500 // See routines GROUT,GRIN to write,read objects
1502 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1506 //____________________________________________________________________________
1507 void TGeant3::Gpcxyz()
1510 // Print track and volume parameters at current point
1515 //_____________________________________________________________________________
1516 void TGeant3::Ggclos()
1519 // Closes off the geometry setting.
1520 // Initializes the search list for the contents of each
1521 // volume following the order they have been positioned, and
1522 // inserting the content '0' when a call to GSNEXT (-1) has
1523 // been required by the user.
1524 // Performs the development of the JVOLUM structure for all
1525 // volumes with variable parameters, by calling GGDVLP.
1526 // Interprets the user calls to GSORD, through GGORD.
1527 // Computes and stores in a bank (next to JVOLUM mother bank)
1528 // the number of levels in the geometrical tree and the
1529 // maximum number of contents per level, by calling GGNLEV.
1530 // Sets status bit for CONCAVE volumes, through GGCAVE.
1531 // Completes the JSET structure with the list of volume names
1532 // which identify uniquely a given physical detector, the
1533 // list of bit numbers to pack the corresponding volume copy
1534 // numbers, and the generic path(s) in the JVOLUM tree,
1535 // through the routine GHCLOS.
1540 //_____________________________________________________________________________
1541 void TGeant3::Glast()
1544 // Finish a Geant run
1549 //_____________________________________________________________________________
1550 void TGeant3::Gprint(const char *name)
1553 // Routine to print data structures
1554 // CHNAME name of a data structure
1558 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1561 //_____________________________________________________________________________
1562 void TGeant3::Grun()
1565 // Steering function to process one run
1570 //_____________________________________________________________________________
1571 void TGeant3::Gtrig()
1574 // Steering function to process one event
1579 //_____________________________________________________________________________
1580 void TGeant3::Gtrigc()
1583 // Clear event partition
1588 //_____________________________________________________________________________
1589 void TGeant3::Gtrigi()
1592 // Initialises event partition
1597 //_____________________________________________________________________________
1598 void TGeant3::Gwork(Int_t nwork)
1601 // Allocates workspace in ZEBRA memory
1606 //_____________________________________________________________________________
1607 void TGeant3::Gzinit()
1610 // To initialise GEANT/ZEBRA data structures
1615 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1617 // Functions from GCONS
1619 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1621 //_____________________________________________________________________________
1622 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1623 Float_t &dens, Float_t &radl, Float_t &absl,
1624 Float_t* ubuf, Int_t& nbuf)
1627 // Return parameters for material IMAT
1629 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1633 //_____________________________________________________________________________
1634 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1635 Float_t &amass, Float_t &charge, Float_t &tlife)
1638 // Return parameters for particle of type IPART
1642 Int_t igpart = IdFromPDG(ipart);
1643 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1647 //_____________________________________________________________________________
1648 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1649 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1650 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1651 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1654 // Return parameters for tracking medium NUMED
1656 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1657 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1660 //_____________________________________________________________________________
1661 void TGeant3::Gmate()
1664 // Define standard GEANT materials
1669 //_____________________________________________________________________________
1670 void TGeant3::Gpart()
1673 // Define standard GEANT particles plus selected decay modes
1674 // and branching ratios.
1679 //_____________________________________________________________________________
1680 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1682 // Defines branching ratios and decay modes for standard
1684 gsdk(ipart,bratio,mode);
1687 //_____________________________________________________________________________
1688 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1689 Float_t dens, Float_t radl, Float_t absl)
1692 // Defines a Material
1694 // kmat number assigned to the material
1695 // name material name
1696 // a atomic mass in au
1698 // dens density in g/cm3
1699 // absl absorbtion length in cm
1700 // if >=0 it is ignored and the program
1701 // calculates it, if <0. -absl is taken
1702 // radl radiation length in cm
1703 // if >=0 it is ignored and the program
1704 // calculates it, if <0. -radl is taken
1705 // buf pointer to an array of user words
1706 // nbuf number of user words
1710 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1714 //_____________________________________________________________________________
1715 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1716 Float_t dens, Int_t nlmat, Float_t *wmat)
1719 // Defines mixture OR COMPOUND IMAT as composed by
1720 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1722 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1723 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1725 // If NLMAT.LT.0 then WMAT contains the number of atoms
1726 // of a given kind into the molecule of the COMPOUND
1727 // In this case, WMAT in output is changed to relative
1730 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1733 //_____________________________________________________________________________
1734 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1735 Float_t amass, Float_t charge, Float_t tlife)
1738 // Store particle parameters
1740 // ipart particle code
1741 // name particle name
1742 // itrtyp transport method (see GEANT manual)
1743 // amass mass in GeV/c2
1744 // charge charge in electron units
1745 // tlife lifetime in seconds
1749 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1753 //_____________________________________________________________________________
1754 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1755 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1756 Float_t stemax, Float_t deemax, Float_t epsil,
1760 // NTMED Tracking medium number
1761 // NAME Tracking medium name
1762 // NMAT Material number
1763 // ISVOL Sensitive volume flag
1764 // IFIELD Magnetic field
1765 // FIELDM Max. field value (Kilogauss)
1766 // TMAXFD Max. angle due to field (deg/step)
1767 // STEMAX Max. step allowed
1768 // DEEMAX Max. fraction of energy lost in a step
1769 // EPSIL Tracking precision (cm)
1770 // STMIN Min. step due to continuos processes (cm)
1772 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1773 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1774 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1778 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1779 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1782 //_____________________________________________________________________________
1783 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1784 Float_t *absco, Float_t *effic, Float_t *rindex)
1787 // Stores the tables for UV photon tracking in medium ITMED
1788 // Please note that it is the user's responsability to
1789 // provide all the coefficients:
1792 // ITMED Tracking medium number
1793 // NPCKOV Number of bins of each table
1794 // PPCKOV Value of photon momentum (in GeV)
1795 // ABSCO Absorbtion coefficients
1796 // dielectric: absorbtion length in cm
1797 // metals : absorbtion fraction (0<=x<=1)
1798 // EFFIC Detection efficiency for UV photons
1799 // RINDEX Refraction index (if=0 metal)
1801 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1804 //_____________________________________________________________________________
1805 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1808 // To change the value of cut or mechanism "CHPAR"
1809 // to a new value PARVAL for tracking medium ITMED
1810 // The data structure JTMED contains the standard tracking
1811 // parameters (CUTS and flags to control the physics processes) which
1812 // are used by default for all tracking media. It is possible to
1813 // redefine individually with GSTPAR any of these parameters for a
1814 // given tracking medium.
1815 // ITMED tracking medium number
1816 // CHPAR is a character string (variable name)
1817 // PARVAL must be given as a floating point.
1819 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1822 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1824 // Functions from GCONS
1826 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1828 //_____________________________________________________________________________
1829 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1832 // Storing/Retrieving Vertex and Track parameters
1833 // ----------------------------------------------
1835 // Stores vertex parameters.
1836 // VERT array of (x,y,z) position of the vertex
1837 // NTBEAM beam track number origin of the vertex
1838 // =0 if none exists
1839 // NTTARG target track number origin of the vertex
1840 // UBUF user array of NUBUF floating point numbers
1842 // NVTX new vertex number (=0 in case of error).
1843 // Prints vertex parameters.
1844 // IVTX for vertex IVTX.
1845 // (For all vertices if IVTX=0)
1846 // Stores long life track parameters.
1847 // PLAB components of momentum
1848 // IPART type of particle (see GSPART)
1849 // NV vertex number origin of track
1850 // UBUF array of NUBUF floating point user parameters
1852 // NT track number (if=0 error).
1853 // Retrieves long life track parameters.
1854 // ITRA track number for which parameters are requested
1855 // VERT vector origin of the track
1856 // PVERT 4 momentum components at the track origin
1857 // IPART particle type (=0 if track ITRA does not exist)
1858 // NVERT vertex number origin of the track
1859 // UBUF user words stored in GSKINE.
1860 // Prints initial track parameters.
1861 // ITRA for track ITRA
1862 // (For all tracks if ITRA=0)
1866 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1869 //_____________________________________________________________________________
1870 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1874 // Retrieves the parameter of a vertex bank
1875 // Vertex is generated from tracks NTBEAM NTTARG
1876 // NVTX is the new vertex number
1880 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1883 //_____________________________________________________________________________
1884 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1888 // Store kinematics of track NT into data structure
1889 // Track is coming from vertex NV
1892 gskine(plab, ipart, nv, buf, nwbuf, nt);
1896 //_____________________________________________________________________________
1897 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1901 // Creates a new vertex bank
1902 // Vertex is generated from tracks NTBEAM NTTARG
1903 // NVTX is the new vertex number
1906 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1910 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1912 // Functions from GPHYS
1914 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1916 //_____________________________________________________________________________
1917 void TGeant3::Gphysi()
1920 // Initialise material constants for all the physics
1921 // mechanisms used by GEANT
1926 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1928 // Functions from GTRAK
1930 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1932 //_____________________________________________________________________________
1933 void TGeant3::Gdebug()
1936 // Debug the current step
1941 //_____________________________________________________________________________
1942 void TGeant3::Gekbin()
1945 // To find bin number in kinetic energy table
1946 // stored in ELOW(NEKBIN)
1951 //_____________________________________________________________________________
1952 void TGeant3::Gfinds()
1955 // Returns the set/volume parameters corresponding to
1956 // the current space point in /GCTRAK/
1957 // and fill common /GCSETS/
1959 // IHSET user set identifier
1960 // IHDET user detector identifier
1961 // ISET set number in JSET
1962 // IDET detector number in JS=LQ(JSET-ISET)
1963 // IDTYPE detector type (1,2)
1964 // NUMBV detector volume numbers (array of length NVNAME)
1965 // NVNAME number of volume levels
1970 //_____________________________________________________________________________
1971 void TGeant3::Gsking(Int_t igk)
1974 // Stores in stack JSTAK either the IGKth track of /GCKING/,
1975 // or the NGKINE tracks when IGK is 0.
1980 //_____________________________________________________________________________
1981 void TGeant3::Gskpho(Int_t igk)
1984 // Stores in stack JSTAK either the IGKth Cherenkov photon of
1985 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
1990 //_____________________________________________________________________________
1991 void TGeant3::Gsstak(Int_t iflag)
1994 // Stores in auxiliary stack JSTAK the particle currently
1995 // described in common /GCKINE/.
1997 // On request, creates also an entry in structure JKINE :
1999 // 0 : No entry in JKINE structure required (user)
2000 // 1 : New entry in JVERTX / JKINE structures required (user)
2001 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2002 // 2 : Entry in JKINE structure exists already (from GTREVE)
2007 //_____________________________________________________________________________
2008 void TGeant3::Gsxyz()
2011 // Store space point VECT in banks JXYZ
2016 //_____________________________________________________________________________
2017 void TGeant3::Gtrack()
2020 // Controls tracking of current particle
2025 //_____________________________________________________________________________
2026 void TGeant3::Gtreve()
2029 // Controls tracking of all particles belonging to the current event
2034 //_____________________________________________________________________________
2035 void TGeant3::Gtreve_root()
2038 // Controls tracking of all particles belonging to the current event
2043 //_____________________________________________________________________________
2044 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2047 // To generate a vector RVECV of LEN random numbers
2048 // Copy of the CERN Library routine RANECU
2052 //_____________________________________________________________________________
2053 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2054 const Text_t *chopt)
2057 // To set/retrieve the seed of the random number generator
2059 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2062 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2064 // Functions from GDRAW
2066 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2068 //_____________________________________________________________________________
2069 void TGeant3::Gdxyz(Int_t it)
2072 // Draw the points stored with Gsxyz relative to track it
2077 //_____________________________________________________________________________
2078 void TGeant3::Gdcxyz()
2081 // Draw the position of the current track
2086 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2088 // Functions from GGEOM
2090 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2092 //_____________________________________________________________________________
2093 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2096 // Computes coordinates XM (Master Reference System
2097 // knowing the coordinates XD (Detector Ref System)
2098 // The local reference system can be initialized by
2099 // - the tracking routines and GDTOM used in GUSTEP
2100 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2101 // (inverse routine is GMTOD)
2103 // If IFLAG=1 convert coordinates
2104 // IFLAG=2 convert direction cosinus
2106 gdtom(xd, xm, iflag);
2109 //_____________________________________________________________________________
2110 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2114 // Loads the top part of the Volume tree in LVOLS (IVO's),
2115 // LINDX (IN indices) for a given volume defined through
2116 // its name IUDET and number IUNUM.
2118 // The routine stores only upto the last level where JVOLUM
2119 // data structure is developed. If there is no development
2120 // above the current level, it returns NLEV zero.
2122 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2125 //_____________________________________________________________________________
2126 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2129 // Finds in which volume/medium the point X is, and updates the
2130 // common /GCVOLU/ and the structure JGPAR accordingly.
2132 // NUMED returns the tracking medium number, or 0 if point is
2133 // outside the experimental setup.
2138 //_____________________________________________________________________________
2139 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2142 // Computes coordinates XD (in DRS)
2143 // from known coordinates XM in MRS
2144 // The local reference system can be initialized by
2145 // - the tracking routines and GMTOD used in GUSTEP
2146 // - a call to GMEDIA(XM,NUMED)
2147 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2148 // (inverse routine is GDTOM)
2150 // If IFLAG=1 convert coordinates
2151 // IFLAG=2 convert direction cosinus
2153 gmtod(xm, xd, iflag);
2156 //_____________________________________________________________________________
2157 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2161 // Create a new volume by dividing an existing one
2164 // MOTHER Mother volume name
2165 // NDIV Number of divisions
2168 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2169 // It divides a previously defined volume.
2174 Vname(mother,vmother);
2175 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2176 PASSCHARL(vmother));
2179 //_____________________________________________________________________________
2180 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2181 Int_t iaxis, Float_t c0i, Int_t numed)
2184 // Create a new volume by dividing an existing one
2186 // Divides mother into ndiv divisions called name
2187 // along axis iaxis starting at coordinate value c0.
2188 // the new volume created will be medium number numed.
2193 Vname(mother,vmother);
2194 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2195 PASSCHARL(vname) PASSCHARL(vmother));
2198 //_____________________________________________________________________________
2199 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2200 Int_t iaxis, Int_t numed)
2203 // Create a new volume by dividing an existing one
2208 Vname(mother,vmother);
2209 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2210 PASSCHARL(vname) PASSCHARL(vmother));
2213 //_____________________________________________________________________________
2214 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2215 Int_t iaxis, Float_t c0, Int_t numed)
2218 // Create a new volume by dividing an existing one
2223 Vname(mother,vmother);
2224 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2225 PASSCHARL(vname) PASSCHARL(vmother));
2228 //_____________________________________________________________________________
2229 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2230 Int_t iaxis, Int_t numed, Int_t ndvmx)
2233 // Create a new volume by dividing an existing one
2235 // Divides MOTHER into divisions called NAME along
2236 // axis IAXIS in steps of STEP. If not exactly divisible
2237 // will make as many as possible and will centre them
2238 // with respect to the mother. Divisions will have medium
2239 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2240 // NDVMX is the expected maximum number of divisions
2241 // (If 0, no protection tests are performed)
2246 Vname(mother,vmother);
2247 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2248 PASSCHARL(vname) PASSCHARL(vmother));
2251 //_____________________________________________________________________________
2252 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2253 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2256 // Create a new volume by dividing an existing one
2258 // Divides MOTHER into divisions called NAME along
2259 // axis IAXIS starting at coordinate value C0 with step
2261 // The new volume created will have medium number NUMED.
2262 // If NUMED is 0, NUMED of mother is taken.
2263 // NDVMX is the expected maximum number of divisions
2264 // (If 0, no protection tests are performed)
2269 Vname(mother,vmother);
2270 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2271 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2274 //_____________________________________________________________________________
2275 void TGeant3::Gsord(const char *name, Int_t iax)
2278 // Flags volume CHNAME whose contents will have to be ordered
2279 // along axis IAX, by setting the search flag to -IAX
2283 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2284 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2285 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2286 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2287 // IAX = 6 PHI (PHI=0 => X axis)
2288 // IAX = 7 THETA (THETA=0 => Z axis)
2292 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2295 //_____________________________________________________________________________
2296 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2297 Float_t y, Float_t z, Int_t irot, const char *konly)
2300 // Position a volume into an existing one
2303 // NUMBER Copy number of the volume
2304 // MOTHER Mother volume name
2305 // X X coord. of the volume in mother ref. sys.
2306 // Y Y coord. of the volume in mother ref. sys.
2307 // Z Z coord. of the volume in mother ref. sys.
2308 // IROT Rotation matrix number w.r.t. mother ref. sys.
2309 // ONLY ONLY/MANY flag
2311 // It positions a previously defined volume in the mother.
2316 Vname(mother,vmother);
2317 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2318 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2322 //_____________________________________________________________________________
2323 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2324 Float_t x, Float_t y, Float_t z, Int_t irot,
2325 const char *konly, Float_t *upar, Int_t np )
2328 // Place a copy of generic volume NAME with user number
2329 // NR inside MOTHER, with its parameters UPAR(1..NP)
2334 Vname(mother,vmother);
2335 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2336 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2340 //_____________________________________________________________________________
2341 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2342 Float_t phi2, Float_t theta3, Float_t phi3)
2345 // nmat Rotation matrix number
2346 // THETA1 Polar angle for axis I
2347 // PHI1 Azimuthal angle for axis I
2348 // THETA2 Polar angle for axis II
2349 // PHI2 Azimuthal angle for axis II
2350 // THETA3 Polar angle for axis III
2351 // PHI3 Azimuthal angle for axis III
2353 // It defines the rotation matrix number IROT.
2355 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2358 //_____________________________________________________________________________
2359 void TGeant3::Gprotm(Int_t nmat)
2362 // To print rotation matrices structure JROTM
2363 // nmat Rotation matrix number
2368 //_____________________________________________________________________________
2369 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2370 Float_t *upar, Int_t npar)
2374 // SHAPE Volume type
2375 // NUMED Tracking medium number
2376 // NPAR Number of shape parameters
2377 // UPAR Vector containing shape parameters
2379 // It creates a new volume in the JVOLUM data structure.
2385 Vname(shape,vshape);
2386 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2387 PASSCHARL(vname) PASSCHARL(vshape));
2391 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2393 // T H E D R A W I N G P A C K A G E
2394 // ======================================
2395 // Drawing functions. These functions allow the visualization in several ways
2396 // of the volumes defined in the geometrical data structure. It is possible
2397 // to draw the logical tree of volumes belonging to the detector (DTREE),
2398 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2399 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2400 // these commands when the hidden line removal option is activated; in
2401 // this case, the volumes can be also either translated in the space
2402 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2403 // possible to fill the surfaces of the volumes
2404 // with solid colours when the shading option (SHAD) is activated.
2405 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2406 // of the detectors or to scan physical events as well.
2407 // Finally, the command MOVE will allow the rotation, translation and zooming
2408 // on real time parts of the detectors or tracks and hits of a simulated event.
2409 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2410 // the drawing is performed by the Geant ray-tracing;
2411 // automatically, the color is assigned according to the tracking medium of each
2412 // volume and the volumes with a density lower/equal than the air are considered
2413 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2414 // the user can set color and visibility for the desired volumes via the command
2415 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2416 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2417 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2418 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2419 // first case, we assume that the first mother volume of the tree is a box with
2420 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2421 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2422 // second case, the distance between the observer and the origin of the world
2423 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2424 // or telescopic effects can be achieved changing the scale factors in the command
2425 // (DRAW). When the final picture does not occupy the full window,
2426 // mapping the space before tracing can speed up the drawing, but can also
2427 // produce less precise results; values from 1 to 4 are allowed in the command
2428 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2429 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2430 // The command (VALCUT) allows the cutting of the detector by three planes
2431 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2432 // SATT for any desired volume and can assume values from 0 to 7; it determines
2433 // the different light processing to be performed for different materials:
2434 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2435 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2436 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2437 // is 0.9) and the observer is assumed to have a light source (therefore he will
2438 // produce parallel light in the case of parallel view and point-like-source
2439 // light in the case of perspective view).
2441 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2443 //_____________________________________________________________________________
2444 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2448 // IOPT Name of the attribute to be set
2449 // IVAL Value to which the attribute is to be set
2451 // name= "*" stands for all the volumes.
2452 // iopt can be chosen among the following :
2454 // WORK 0=volume name is inactive for the tracking
2455 // 1=volume name is active for the tracking (default)
2457 // SEEN 0=volume name is invisible
2458 // 1=volume name is visible (default)
2459 // -1=volume invisible with all its descendants in the tree
2460 // -2=volume visible but not its descendants in the tree
2462 // LSTY line style 1,2,3,... (default=1)
2463 // LSTY=7 will produce a very precise approximation for
2464 // revolution bodies.
2466 // LWID line width -7,...,1,2,3,..7 (default=1)
2467 // LWID<0 will act as abs(LWID) was set for the volume
2468 // and for all the levels below it. When SHAD is 'ON', LWID
2469 // represent the linewidth of the scan lines filling the surfaces
2470 // (whereas the FILL value represent their number). Therefore
2471 // tuning this parameter will help to obtain the desired
2472 // quality/performance ratio.
2474 // COLO colour code -166,...,1,2,..166 (default=1)
2476 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2477 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2478 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2479 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2480 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2481 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2482 // colour=n*10+m, m=1,2,...9, will produce the same colour
2483 // as 'n', but with increasing luminosity according to 'm';
2484 // COLO<0 will act as if abs(COLO) was set for the volume
2485 // and for all the levels below it.
2486 // When for a volume the attribute FILL is > 1 (and the
2487 // option SHAD is on), the ABS of its colour code must be < 8
2488 // because an automatic shading of its faces will be
2491 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2492 // when option SHAD is "on" the FILL attribute of any
2493 // volume can be set different from 0 (normal drawing);
2494 // if it is set to 1, the faces of such volume will be filled
2495 // with solid colours; if ABS(FILL) is > 1, then a light
2496 // source is placed along the observer line, and the faces of
2497 // such volumes will be painted by colours whose luminosity
2498 // will depend on the amount of light reflected;
2499 // if ABS(FILL) = 1, then it is possible to use all the 166
2500 // colours of the colour table, becouse the automatic shading
2501 // is not performed;
2502 // for increasing values of FILL the drawing will be performed
2503 // with higher and higher resolution improving the quality (the
2504 // number of scan lines used to fill the faces increases with FILL);
2505 // it is possible to set different values of FILL
2506 // for different volumes, in order to optimize at the same time
2507 // the performance and the quality of the picture;
2508 // FILL<0 will act as if abs(FILL) was set for the volume
2509 // and for all the levels below it.
2510 // This kind of drawing can be saved in 'picture files'
2511 // or in view banks.
2512 // 0=drawing without fill area
2513 // 1=faces filled with solid colours and resolution = 6
2514 // 2=lowest resolution (very fast)
2515 // 3=default resolution
2516 // 4=.................
2517 // 5=.................
2518 // 6=.................
2520 // Finally, if a coloured background is desired, the FILL
2521 // attribute for the first volume of the tree must be set
2522 // equal to -abs(colo), colo being >0 and <166.
2524 // SET set number associated to volume name
2525 // DET detector number associated to volume name
2526 // DTYP detector type (1,2)
2533 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2537 //_____________________________________________________________________________
2538 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2539 Int_t& natt, Float_t* par, Float_t* att)
2542 // Find the parameters of a volume
2544 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2548 //_____________________________________________________________________________
2549 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2552 // Check the parameters of a shape
2554 gckpar(ish,npar,par);
2557 //_____________________________________________________________________________
2558 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2561 // Check the parameters of a tracking medium
2563 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2566 //_____________________________________________________________________________
2567 void TGeant3::Gdelete(Int_t iview)
2570 // IVIEW View number
2572 // It deletes a view bank from memory.
2577 //_____________________________________________________________________________
2578 void TGeant3::Gdopen(Int_t iview)
2581 // IVIEW View number
2583 // When a drawing is very complex and requires a long time to be
2584 // executed, it can be useful to store it in a view bank: after a
2585 // call to DOPEN and the execution of the drawing (nothing will
2586 // appear on the screen), and after a necessary call to DCLOSE,
2587 // the contents of the bank can be displayed in a very fast way
2588 // through a call to DSHOW; therefore, the detector can be easily
2589 // zoomed many times in different ways. Please note that the pictures
2590 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2597 //_____________________________________________________________________________
2598 void TGeant3::Gdclose()
2601 // It closes the currently open view bank; it must be called after the
2602 // end of the drawing to be stored.
2607 //_____________________________________________________________________________
2608 void TGeant3::Gdshow(Int_t iview)
2611 // IVIEW View number
2613 // It shows on the screen the contents of a view bank. It
2614 // can be called after a view bank has been closed.
2619 //_____________________________________________________________________________
2620 void TGeant3::Gdopt(const char *name,const char *value)
2624 // VALUE Option value
2626 // To set/modify the drawing options.
2629 // THRZ ON Draw tracks in R vs Z
2630 // OFF (D) Draw tracks in X,Y,Z
2633 // PROJ PARA (D) Parallel projection
2635 // TRAK LINE (D) Trajectory drawn with lines
2636 // POIN " " with markers
2637 // HIDE ON Hidden line removal using the CG package
2638 // OFF (D) No hidden line removal
2639 // SHAD ON Fill area and shading of surfaces.
2640 // OFF (D) Normal hidden line removal.
2641 // RAYT ON Ray-tracing on.
2642 // OFF (D) Ray-tracing off.
2643 // EDGE OFF Does not draw contours when shad is on.
2644 // ON (D) Normal shading.
2645 // MAPP 1,2,3,4 Mapping before ray-tracing.
2646 // 0 (D) No mapping.
2647 // USER ON User graphics options in the raytracing.
2648 // OFF (D) Automatic graphics options.
2654 Vname(value,vvalue);
2655 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2659 //_____________________________________________________________________________
2660 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2661 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2666 // THETA Viewing angle theta (for 3D projection)
2667 // PHI Viewing angle phi (for 3D projection)
2668 // PSI Viewing angle psi (for 2D rotation)
2669 // U0 U-coord. (horizontal) of volume origin
2670 // V0 V-coord. (vertical) of volume origin
2671 // SU Scale factor for U-coord.
2672 // SV Scale factor for V-coord.
2674 // This function will draw the volumes,
2675 // selected with their graphical attributes, set by the Gsatt
2676 // facility. The drawing may be performed with hidden line removal
2677 // and with shading effects according to the value of the options HIDE
2678 // and SHAD; if the option SHAD is ON, the contour's edges can be
2679 // drawn or not. If the option HIDE is ON, the detector can be
2680 // exploded (BOMB), clipped with different shapes (CVOL), and some
2681 // of its parts can be shifted from their original
2682 // position (SHIFT). When HIDE is ON, if
2683 // the drawing requires more than the available memory, the program
2684 // will evaluate and display the number of missing words
2685 // (so that the user can increase the
2686 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2687 // the program will print messages about the memory used and
2688 // statistics on the volumes' visibility.
2689 // The following commands will produce the drawing of a green
2690 // volume, specified by NAME, without using the hidden line removal
2691 // technique, using the hidden line removal technique,
2692 // with different linewidth and colour (red), with
2693 // solid colour, with shading of surfaces, and without edges.
2694 // Finally, some examples are given for the ray-tracing. (A possible
2695 // string for the NAME of the volume can be found using the command DTREE).
2701 if (fGcvdma->raytra != 1) {
2702 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2704 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2708 //_____________________________________________________________________________
2709 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2710 Float_t v0,Float_t ul,Float_t vl)
2715 // CUTVAL Cut plane distance from the origin along the axis
2717 // U0 U-coord. (horizontal) of volume origin
2718 // V0 V-coord. (vertical) of volume origin
2719 // SU Scale factor for U-coord.
2720 // SV Scale factor for V-coord.
2722 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2723 // and placed at the distance cutval from the origin.
2724 // The resulting picture is seen from the the same axis.
2725 // When HIDE Mode is ON, it is possible to get the same effect with
2726 // the CVOL/BOX function.
2732 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2735 //_____________________________________________________________________________
2736 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2737 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2738 Float_t v0,Float_t ul,Float_t vl)
2742 // CUTTHE Theta angle of the line normal to cut plane
2743 // CUTPHI Phi angle of the line normal to cut plane
2744 // CUTVAL Cut plane distance from the origin along the axis
2746 // THETA Viewing angle theta (for 3D projection)
2747 // PHI Viewing angle phi (for 3D projection)
2748 // U0 U-coord. (horizontal) of volume origin
2749 // V0 V-coord. (vertical) of volume origin
2750 // SU Scale factor for U-coord.
2751 // SV Scale factor for V-coord.
2753 // The cut plane is normal to the line given by the cut angles
2754 // cutthe and cutphi and placed at the distance cutval from the origin.
2755 // The resulting picture is seen from the viewing angles theta,phi.
2761 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2765 //_____________________________________________________________________________
2766 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2771 // ISEL Option flag D=111110
2773 // CHRSIZ Character size (cm) of title NAME D=0.6
2776 // 0 to have only the header lines
2777 // xxxxx1 to add the text name centered on top of header
2778 // xxxx1x to add global detector name (first volume) on left
2779 // xxx1xx to add date on right
2780 // xx1xxx to select thick characters for text on top of header
2781 // x1xxxx to add the text 'EVENT NR x' on top of header
2782 // 1xxxxx to add the text 'RUN NR x' on top of header
2783 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2784 // i.e. they generate overwritten text.
2786 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2789 //_____________________________________________________________________________
2790 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2793 // Draw a 2D-man at position (U0,V0)
2795 // U U-coord. (horizontal) of the centre of man' R
2796 // V V-coord. (vertical) of the centre of man' R
2797 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2799 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2800 // It superimposes the picure of a man or of a woman, chosen among
2801 // three different ones, with the same scale factors as the detector
2802 // in the current drawing.
2805 if (opt.Contains("WM1")) {
2807 } else if (opt.Contains("WM3")) {
2809 } else if (opt.Contains("WM2")) {
2816 //_____________________________________________________________________________
2817 void TGeant3::Gdspec(const char *name)
2822 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2823 // its geometrical specifications. The 3D drawing will
2824 // be performed according the current values of the options HIDE and
2825 // SHAD and according the current SetClipBox clipping parameters for that
2832 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2835 //_____________________________________________________________________________
2836 void TGeant3::DrawOneSpec(const char *name)
2839 // Function called when one double-clicks on a volume name
2840 // in a TPavelabel drawn by Gdtree.
2842 THIGZ *higzSave = higz;
2843 higzSave->SetName("higzSave");
2844 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2845 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2846 if (higzSpec) higz = higzSpec;
2847 else higzSpec = new THIGZ(defSize);
2848 higzSpec->SetName("higzSpec");
2853 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2856 higzSave->SetName("higz");
2860 //_____________________________________________________________________________
2861 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2865 // LEVMAX Depth level
2868 // This function draws the logical tree,
2869 // Each volume in the tree is represented by a TPaveTree object.
2870 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2871 // Use TPaveTree pop-up menu to select:
2874 // - drawing tree of parent
2880 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2884 //_____________________________________________________________________________
2885 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2889 // LEVMAX Depth level
2892 // This function draws the logical tree of the parent of name.
2896 // Scan list of volumes in JVOLUM
2898 Int_t gname, i, jvo, in, nin, jin, num;
2899 strncpy((char *) &gname, name, 4);
2900 for(i=1; i<=fGcnum->nvolum; i++) {
2901 jvo = fZlq[fGclink->jvolum-i];
2902 nin = Int_t(fZq[jvo+3]);
2903 if (nin == -1) nin = 1;
2904 for (in=1;in<=nin;in++) {
2906 num = Int_t(fZq[jin+2]);
2907 if(gname == fZiq[fGclink->jvolum+num]) {
2908 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2910 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2918 //_____________________________________________________________________________
2919 void TGeant3::SetABAN(Int_t par)
2922 // par = 1 particles will be stopped according to their residual
2923 // range if they are not in a sensitive material and are
2924 // far enough from the boundary
2925 // 0 particles are transported normally
2927 fGcphys->dphys1 = par;
2931 //_____________________________________________________________________________
2932 void TGeant3::SetANNI(Int_t par)
2935 // To control positron annihilation.
2936 // par =0 no annihilation
2937 // =1 annihilation. Decays processed.
2938 // =2 annihilation. No decay products stored.
2940 fGcphys->ianni = par;
2944 //_____________________________________________________________________________
2945 void TGeant3::SetAUTO(Int_t par)
2948 // To control automatic calculation of tracking medium parameters:
2949 // par =0 no automatic calculation;
2950 // =1 automati calculation.
2952 fGctrak->igauto = par;
2956 //_____________________________________________________________________________
2957 void TGeant3::SetBOMB(Float_t boom)
2960 // BOOM : Exploding factor for volumes position
2962 // To 'explode' the detector. If BOOM is positive (values smaller
2963 // than 1. are suggested, but any value is possible)
2964 // all the volumes are shifted by a distance
2965 // proportional to BOOM along the direction between their centre
2966 // and the origin of the MARS; the volumes which are symmetric
2967 // with respect to this origin are simply not shown.
2968 // BOOM equal to 0 resets the normal mode.
2969 // A negative (greater than -1.) value of
2970 // BOOM will cause an 'implosion'; for even lower values of BOOM
2971 // the volumes' positions will be reflected respect to the origin.
2972 // This command can be useful to improve the 3D effect for very
2973 // complex detectors. The following commands will make explode the
2980 //_____________________________________________________________________________
2981 void TGeant3::SetBREM(Int_t par)
2984 // To control bremstrahlung.
2985 // par =0 no bremstrahlung
2986 // =1 bremstrahlung. Photon processed.
2987 // =2 bremstrahlung. No photon stored.
2989 fGcphys->ibrem = par;
2993 //_____________________________________________________________________________
2994 void TGeant3::SetCKOV(Int_t par)
2997 // To control Cerenkov production
2998 // par =0 no Cerenkov;
3000 // =2 Cerenkov with primary stopped at each step.
3002 fGctlit->itckov = par;
3006 //_____________________________________________________________________________
3007 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3008 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3011 // The hidden line removal technique is necessary to visualize properly
3012 // very complex detectors. At the same time, it can be useful to visualize
3013 // the inner elements of a detector in detail. This function allows
3014 // subtractions (via boolean operation) of BOX shape from any part of
3015 // the detector, therefore showing its inner contents.
3016 // If "*" is given as the name of the
3017 // volume to be clipped, all volumes are clipped by the given box.
3018 // A volume can be clipped at most twice.
3019 // if a volume is explicitely clipped twice,
3020 // the "*" will not act on it anymore. Giving "." as the name
3021 // of the volume to be clipped will reset the clipping.
3023 // NAME Name of volume to be clipped
3025 // XMIN Lower limit of the Shape X coordinate
3026 // XMAX Upper limit of the Shape X coordinate
3027 // YMIN Lower limit of the Shape Y coordinate
3028 // YMAX Upper limit of the Shape Y coordinate
3029 // ZMIN Lower limit of the Shape Z coordinate
3030 // ZMAX Upper limit of the Shape Z coordinate
3032 // This function performs a boolean subtraction between the volume
3033 // NAME and a box placed in the MARS according the values of the given
3039 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3042 //_____________________________________________________________________________
3043 void TGeant3::SetCOMP(Int_t par)
3046 // To control Compton scattering
3047 // par =0 no Compton
3048 // =1 Compton. Electron processed.
3049 // =2 Compton. No electron stored.
3052 fGcphys->icomp = par;
3055 //_____________________________________________________________________________
3056 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3057 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3058 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3059 Float_t ppcutm, Float_t tofmax)
3062 // CUTGAM Cut for gammas D=0.001
3063 // CUTELE Cut for electrons D=0.001
3064 // CUTHAD Cut for charged hadrons D=0.01
3065 // CUTNEU Cut for neutral hadrons D=0.01
3066 // CUTMUO Cut for muons D=0.01
3067 // BCUTE Cut for electron brems. D=-1.
3068 // BCUTM Cut for muon brems. D=-1.
3069 // DCUTE Cut for electron delta-rays D=-1.
3070 // DCUTM Cut for muon delta-rays D=-1.
3071 // PPCUTM Cut for e+e- pairs by muons D=0.01
3072 // TOFMAX Time of flight cut D=1.E+10
3074 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3075 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3077 // If one of the parameters from CUTGAM to PPCUTM included
3078 // is modified, cross-sections and energy loss tables must be
3079 // recomputed via the function Gphysi.
3081 fGccuts->cutgam = cutgam;
3082 fGccuts->cutele = cutele;
3083 fGccuts->cutneu = cutneu;
3084 fGccuts->cuthad = cuthad;
3085 fGccuts->cutmuo = cutmuo;
3086 fGccuts->bcute = bcute;
3087 fGccuts->bcutm = bcutm;
3088 fGccuts->dcute = dcute;
3089 fGccuts->dcutm = dcutm;
3090 fGccuts->ppcutm = ppcutm;
3091 fGccuts->tofmax = tofmax;
3094 //_____________________________________________________________________________
3095 void TGeant3::SetDCAY(Int_t par)
3098 // To control Decay mechanism.
3099 // par =0 no decays.
3100 // =1 Decays. secondaries processed.
3101 // =2 Decays. No secondaries stored.
3103 fGcphys->idcay = par;
3107 //_____________________________________________________________________________
3108 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3111 // Set the debug flag and frequency
3112 // Selected debug output will be printed from
3113 // event emin to even emax each emod event
3115 fGcflag->idemin = emin;
3116 fGcflag->idemax = emax;
3117 fGcflag->itest = emod;
3121 //_____________________________________________________________________________
3122 void TGeant3::SetDRAY(Int_t par)
3125 // To control delta rays mechanism.
3126 // par =0 no delta rays.
3127 // =1 Delta rays. secondaries processed.
3128 // =2 Delta rays. No secondaries stored.
3130 fGcphys->idray = par;
3133 //_____________________________________________________________________________
3134 void TGeant3::SetHADR(Int_t par)
3137 // To control hadronic interactions.
3138 // par =0 no hadronic interactions.
3139 // =1 Hadronic interactions. secondaries processed.
3140 // =2 Hadronic interactions. No secondaries stored.
3142 fGcphys->ihadr = par;
3145 //_____________________________________________________________________________
3146 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3147 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3148 Float_t xk8, Float_t xk9, Float_t xk10)
3151 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3152 // Their meaning is user defined
3154 fGckine->ikine = kine;
3155 fGckine->pkine[0] = xk1;
3156 fGckine->pkine[1] = xk2;
3157 fGckine->pkine[2] = xk3;
3158 fGckine->pkine[3] = xk4;
3159 fGckine->pkine[4] = xk5;
3160 fGckine->pkine[5] = xk6;
3161 fGckine->pkine[6] = xk7;
3162 fGckine->pkine[7] = xk8;
3163 fGckine->pkine[8] = xk9;
3164 fGckine->pkine[9] = xk10;
3167 //_____________________________________________________________________________
3168 void TGeant3::SetLOSS(Int_t par)
3171 // To control energy loss.
3172 // par =0 no energy loss;
3173 // =1 restricted energy loss fluctuations;
3174 // =2 complete energy loss fluctuations;
3176 // =4 no energy loss fluctuations.
3177 // If the value ILOSS is changed, then cross-sections and energy loss
3178 // tables must be recomputed via the command 'PHYSI'.
3180 fGcphys->iloss = par;
3184 //_____________________________________________________________________________
3185 void TGeant3::SetMULS(Int_t par)
3188 // To control multiple scattering.
3189 // par =0 no multiple scattering.
3190 // =1 Moliere or Coulomb scattering.
3191 // =2 Moliere or Coulomb scattering.
3192 // =3 Gaussian scattering.
3194 fGcphys->imuls = par;
3198 //_____________________________________________________________________________
3199 void TGeant3::SetMUNU(Int_t par)
3202 // To control muon nuclear interactions.
3203 // par =0 no muon-nuclear interactions.
3204 // =1 Nuclear interactions. Secondaries processed.
3205 // =2 Nuclear interactions. Secondaries not processed.
3207 fGcphys->imunu = par;
3210 //_____________________________________________________________________________
3211 void TGeant3::SetOPTI(Int_t par)
3214 // This flag controls the tracking optimisation performed via the
3216 // 1 no optimisation at all; GSORD calls disabled;
3217 // 0 no optimisation; only user calls to GSORD kept;
3218 // 1 all non-GSORDered volumes are ordered along the best axis;
3219 // 2 all volumes are ordered along the best axis.
3221 fGcopti->ioptim = par;
3224 //_____________________________________________________________________________
3225 void TGeant3::SetPAIR(Int_t par)
3228 // To control pair production mechanism.
3229 // par =0 no pair production.
3230 // =1 Pair production. secondaries processed.
3231 // =2 Pair production. No secondaries stored.
3233 fGcphys->ipair = par;
3237 //_____________________________________________________________________________
3238 void TGeant3::SetPFIS(Int_t par)
3241 // To control photo fission mechanism.
3242 // par =0 no photo fission.
3243 // =1 Photo fission. secondaries processed.
3244 // =2 Photo fission. No secondaries stored.
3246 fGcphys->ipfis = par;
3249 //_____________________________________________________________________________
3250 void TGeant3::SetPHOT(Int_t par)
3253 // To control Photo effect.
3254 // par =0 no photo electric effect.
3255 // =1 Photo effect. Electron processed.
3256 // =2 Photo effect. No electron stored.
3258 fGcphys->iphot = par;
3261 //_____________________________________________________________________________
3262 void TGeant3::SetRAYL(Int_t par)
3265 // To control Rayleigh scattering.
3266 // par =0 no Rayleigh scattering.
3269 fGcphys->irayl = par;
3272 //_____________________________________________________________________________
3273 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3277 // val New switch value
3279 // Change one element of array ISWIT(10) in /GCFLAG/
3281 if (sw <= 0 || sw > 10) return;
3282 fGcflag->iswit[sw-1] = val;
3286 //_____________________________________________________________________________
3287 void TGeant3::SetTRIG(Int_t nevents)
3290 // Set number of events to be run
3292 fGcflag->nevent = nevents;
3295 //_____________________________________________________________________________
3296 void TGeant3::SetUserDecay(Int_t pdg)
3299 // Force the decays of particles to be done with Pythia
3300 // and not with the Geant routines.
3301 // just kill pointers doing mzdrop
3303 Int_t ipart = IdFromPDG(pdg);
3305 printf("Particle %d not in geant\n",pdg);
3308 Int_t jpart=fGclink->jpart;
3309 Int_t jpa=fZlq[jpart-ipart];
3312 Int_t jpa1=fZlq[jpa-1];
3314 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3315 Int_t jpa2=fZlq[jpa-2];
3317 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3321 //______________________________________________________________________________
3322 void TGeant3::Vname(const char *name, char *vname)
3325 // convert name to upper case. Make vname at least 4 chars
3327 Int_t l = strlen(name);
3330 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3331 for (i=l;i<4;i++) vname[i] = ' ';
3335 //______________________________________________________________________________
3336 void TGeant3::Ertrgo()
3341 //______________________________________________________________________________
3342 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3343 const Float_t *x2, const Float_t *p2,
3344 Int_t ipa, Option_t *chopt)
3346 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3349 //_____________________________________________________________________________
3350 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3351 Int_t number, Int_t nlevel)
3355 // ******************************************************************
3357 // * Write out the geometry of the detector in EUCLID file format *
3359 // * filnam : will be with the extension .euc *
3360 // * topvol : volume name of the starting node *
3361 // * number : copy number of topvol (relevant for gsposp) *
3362 // * nlevel : number of levels in the tree structure *
3363 // * to be written out, starting from topvol *
3365 // * Author : M. Maire *
3367 // ******************************************************************
3369 // File filnam.tme is written out with the definitions of tracking
3370 // medias and materials.
3371 // As to restore original numbers for materials and medias, program
3372 // searches in the file euc_medi.dat and comparing main parameters of
3373 // the mat. defined inside geant and the one in file recognizes them
3374 // and is able to take number from file. If for any material or medium,
3375 // this procedure fails, ordering starts from 1.
3376 // Arrays IOTMED and IOMATE are used for this procedure
3378 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3379 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3381 Int_t i, end, itm, irm, jrm, k, nmed;
3385 char *filext, *filetme;
3386 char natmed[21], namate[21];
3387 char natmedc[21], namatec[21];
3388 char key[5], name[5], mother[5], konly[5];
3390 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3391 Int_t mlevel, numbr, natt, numed, nin, ndata;
3392 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3393 Int_t jdiv, ivin, in, jin, jvin, irot;
3394 Int_t jtm, imat, jma, flag=0, imatc;
3395 Float_t az, dens, radl, absl, a, step, x, y, z;
3396 Int_t npar, ndvmx, left;
3397 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3399 Int_t iomate[100], iotmed[100];
3400 Float_t par[50], att[20], ubuf[50];
3403 Int_t level, ndiv, iaxe;
3404 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3405 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3406 Float_t tmaxf, stemax, deemax, epsil, stmin;
3407 const char *f10000="!\n%s\n!\n";
3408 //Open the input file
3410 for(i=0;i<end;i++) if(filnam[i]=='.') {
3414 filext=new char[end+4];
3415 filetme=new char[end+4];
3416 strncpy(filext,filnam,end);
3417 strncpy(filetme,filnam,end);
3419 // *** The output filnam name will be with extension '.euc'
3420 strcpy(&filext[end],".euc");
3421 strcpy(&filetme[end],".tme");
3422 lun=fopen(filext,"w");
3424 // *** Initialisation of the working space
3425 iadvol=fGcnum->nvolum;
3426 iadtmd=iadvol+fGcnum->nvolum;
3427 iadrot=iadtmd+fGcnum->ntmed;
3428 if(fGclink->jrotm) {
3429 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3433 nwtot=iadrot+fGcnum->nrotm;
3434 qws = new float[nwtot+1];
3435 for (i=0;i<nwtot+1;i++) qws[i]=0;
3438 if(nlevel==0) mlevel=20;
3440 // *** find the top volume and put it in the stak
3441 numbr = number>0 ? number : 1;
3442 Gfpara(topvol,numbr,1,npar,natt,par,att);
3444 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3449 // *** authorized shape ?
3450 strncpy((char *)&iname, topvol, 4);
3452 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3456 jvo = fZlq[fGclink->jvolum-ivo];
3457 ish = Int_t (fZq[jvo+2]);
3459 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3466 iws[iadvol+ivo] = level;
3469 //*** flag all volumes and fill the stak
3473 // pick the next volume in stak
3475 ivo = TMath::Abs(iws[ivstak]);
3476 jvo = fZlq[fGclink->jvolum - ivo];
3478 // flag the tracking medium
3479 numed = Int_t (fZq[jvo + 4]);
3480 iws[iadtmd + numed] = 1;
3482 // get the daughters ...
3483 level = iws[iadvol+ivo];
3484 if (level < mlevel) {
3486 nin = Int_t (fZq[jvo + 3]);
3488 // from division ...
3490 jdiv = fZlq[jvo - 1];
3491 ivin = Int_t (fZq[jdiv + 2]);
3493 iws[nvstak] = -ivin;
3494 iws[iadvol+ivin] = level;
3496 // from position ...
3497 } else if (nin > 0) {
3498 for(in=1; in<=nin; in++) {
3499 jin = fZlq[jvo - in];
3500 ivin = Int_t (fZq[jin + 2 ]);
3501 jvin = fZlq[fGclink->jvolum - ivin];
3502 ish = Int_t (fZq[jvin + 2]);
3503 // authorized shape ?
3505 // not yet flagged ?
3506 if (iws[iadvol+ivin]==0) {
3509 iws[iadvol+ivin] = level;
3511 // flag the rotation matrix
3512 irot = Int_t ( fZq[jin + 4 ]);
3513 if (irot > 0) iws[iadrot+irot] = 1;
3519 // next volume in stak ?
3520 if (ivstak < nvstak) goto L10;
3522 // *** restore original material and media numbers
3523 // file euc_medi.dat is needed to compare materials and medias
3525 FILE* luncor=fopen("euc_medi.dat","r");
3528 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3529 if (iws[iadtmd+itm] > 0) {
3530 jtm = fZlq[fGclink->jtmed-itm];
3531 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3532 imat = Int_t (fZq[jtm+6]);
3533 jma = fZlq[fGclink->jmate-imat];
3535 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3538 strncpy(namate,(char *)&fZiq[jma+1],20);
3541 //** find the material original number
3544 iret=fscanf(luncor,"%4s,%130s",key,card);
3545 if(iret<=0) goto L26;
3547 if(!strcmp(key,"MATE")) {
3548 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3549 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3550 if(!strcmp(namatec,namate)) {
3551 if(az==a && zc==z && densc==dens && radlc==radl
3552 && abslc==absl && nparc==nparc) {
3555 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3557 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3561 if(strcmp(key,"END") && !flag) goto L23;
3563 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3567 //*** restore original tracking medium number
3570 iret=fscanf(luncor,"%4s,%130s",key,card);
3571 if(iret<=0) goto L26;
3573 if (!strcmp(key,"TMED")) {
3574 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3575 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3576 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3577 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3578 epsil,stmin,ubuf,&nwbuf);
3579 if(!strcmp(natmedc,natmed)) {
3580 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3583 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3586 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3590 if(strcmp(key,"END") && !flag) goto L24;
3592 printf("cannot restore original number for medium : %s\n",natmed);
3600 L26: printf("*** GWEUCL *** cannot read the data file\n");
3602 L29: if(luncor) fclose (luncor);
3605 // *** write down the tracking medium definition
3607 strcpy(card,"! Tracking medium");
3608 fprintf(lun,f10000,card);
3610 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3611 if (iws[iadtmd+itm]>0) {
3612 jtm = fZlq[fGclink->jtmed-itm];
3613 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3615 imat = Int_t (fZq[jtm+6]);
3616 jma = fZlq[fGclink->jmate-imat];
3617 //* order media from one, if comparing with database failed
3619 iotmed[itm]=++imxtmed;
3620 iomate[imat]=++imxmate;
3625 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3628 strncpy(namate,(char *)&fZiq[jma+1],20);
3631 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3635 //* *** write down the rotation matrix
3637 strcpy(card,"! Reperes");
3638 fprintf(lun,f10000,card);
3640 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3641 if (iws[iadrot+irm]>0) {
3642 jrm = fZlq[fGclink->jrotm-irm];
3643 fprintf(lun,"ROTM %3d",irm);
3644 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3649 //* *** write down the volume definition
3651 strcpy(card,"! Volumes");
3652 fprintf(lun,f10000,card);
3654 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3657 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3659 jvo = fZlq[fGclink->jvolum-ivo];
3660 ish = Int_t (fZq[jvo+2]);
3661 nmed = Int_t (fZq[jvo+4]);
3662 npar = Int_t (fZq[jvo+5]);
3664 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3665 Gckpar (ish,npar,par);
3666 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3667 for(i=0;i<(npar-1)/6+1;i++) {
3670 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3674 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3679 //* *** write down the division of volumes
3681 fprintf(lun,f10000,"! Divisions");
3682 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3683 ivo = TMath::Abs(iws[ivstak]);
3684 jvo = fZlq[fGclink->jvolum-ivo];
3685 ish = Int_t (fZq[jvo+2]);
3686 nin = Int_t (fZq[jvo+3]);
3687 //* this volume is divided ...
3690 iaxe = Int_t ( fZq[jdiv+1]);
3691 ivin = Int_t ( fZq[jdiv+2]);
3692 ndiv = Int_t ( fZq[jdiv+3]);
3695 jvin = fZlq[fGclink->jvolum-ivin];
3696 nmed = Int_t ( fZq[jvin+4]);
3697 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3699 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3701 if ((step<=0.)||(ish>=11)) {
3702 //* volume with negative parameter or gsposp or pgon ...
3703 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3704 } else if ((ndiv<=0)||(ish==10)) {
3705 //* volume with negative parameter or gsposp or para ...
3706 ndvmx = TMath::Abs(ndiv);
3707 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3708 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3710 //* normal volume : all kind of division are equivalent
3711 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3712 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3717 //* *** write down the the positionnement of volumes
3719 fprintf(lun,f10000,"! Positionnements\n");
3721 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3722 ivo = TMath::Abs(iws[ivstak]);
3723 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3725 jvo = fZlq[fGclink->jvolum-ivo];
3726 nin = Int_t( fZq[jvo+3]);
3727 //* this volume has daughters ...
3729 for (in=1;in<=nin;in++) {
3731 ivin = Int_t (fZq[jin +2]);
3732 numb = Int_t (fZq[jin +3]);
3733 irot = Int_t (fZq[jin +4]);
3737 strcpy(konly,"ONLY");
3738 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
3739 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
3741 jvin = fZlq[fGclink->jvolum-ivin];
3742 ish = Int_t (fZq[jvin+2]);
3743 //* gspos or gsposp ?
3744 ndata = fZiq[jin-1];
3746 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
3747 name,numb,mother,x,y,z,irot,konly);
3749 npar = Int_t (fZq[jin+9]);
3750 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
3751 Gckpar (ish,npar,par);
3752 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
3753 name,numb,mother,x,y,z,irot,konly,npar);
3755 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3762 fprintf(lun,"END\n");
3765 //****** write down the materials and medias *****
3767 lun=fopen(filetme,"w");
3769 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3770 if (iws[iadtmd+itm]>0) {
3771 jtm = fZlq[fGclink->jtmed-itm];
3772 strncpy(natmed,(char*)&fZiq[jtm+1],4);
3773 imat = Int_t (fZq[jtm+6]);
3774 jma = Int_t (fZlq[fGclink->jmate-imat]);
3776 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
3777 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
3778 iomate[imat],namate,a,z,dens,radl,absl,npar);
3782 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3786 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
3787 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
3788 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
3789 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
3793 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3799 fprintf(lun,"END\n");
3800 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
3801 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
3810 //_____________________________________________________________________________
3811 void TGeant3::Streamer(TBuffer &R__b)
3814 // Stream an object of class TGeant3.
3816 if (R__b.IsReading()) {
3817 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
3818 AliMC::Streamer(R__b);
3821 R__b.ReadStaticArray(fPDGCode);
3823 R__b.WriteVersion(TGeant3::IsA());
3824 AliMC::Streamer(R__b);
3827 R__b.WriteArray(fPDGCode, fNPDGCodes);