1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface Class to the Geant3.21 MonteCarlo //
7 <img src="picts/TGeant3Class.gif">
12 ///////////////////////////////////////////////////////////////////////////////
18 #include <TDatabasePDG.h>
19 #include "AliCallf77.h"
22 # define gzebra gzebra_
23 # define grfile grfile_
24 # define gpcxyz gpcxyz_
25 # define ggclos ggclos_
28 # define gcinit gcinit_
31 # define gtrigc gtrigc_
32 # define gtrigi gtrigi_
34 # define gzinit gzinit_
35 # define gfmate gfmate_
36 # define gfpart gfpart_
37 # define gftmed gftmed_
41 # define gsmate gsmate_
42 # define gsmixt gsmixt_
43 # define gspart gspart_
44 # define gstmed gstmed_
45 # define gsckov gsckov_
46 # define gstpar gstpar_
47 # define gfkine gfkine_
48 # define gfvert gfvert_
49 # define gskine gskine_
50 # define gsvert gsvert_
51 # define gphysi gphysi_
52 # define gdebug gdebug_
53 # define gekbin gekbin_
54 # define gfinds gfinds_
55 # define gsking gsking_
56 # define gskpho gskpho_
57 # define gsstak gsstak_
59 # define gtrack gtrack_
60 # define gtreve gtreve_
61 # define gtreve_root gtreve_root_
63 # define grndmq grndmq_
65 # define glmoth glmoth_
66 # define gmedia gmedia_
69 # define gsdvn2 gsdvn2_
71 # define gsdvs2 gsdvs2_
73 # define gsdvt2 gsdvt2_
76 # define gsposp gsposp_
77 # define gsrotm gsrotm_
78 # define gprotm gprotm_
79 # define gsvolu gsvolu_
80 # define gprint gprint_
81 # define gdinit gdinit_
84 # define gdrayt gdrayt_
85 # define gdrawc gdrawc_
86 # define gdrawx gdrawx_
87 # define gdhead gdhead_
88 # define gdwmn1 gdwmn1_
89 # define gdwmn2 gdwmn2_
90 # define gdwmn3 gdwmn3_
92 # define gdcxyz gdcxyz_
94 # define gdspec gdspec_
95 # define gdtree gdtree_
96 # define gdelet gdelet_
97 # define gdclos gdclos_
98 # define gdshow gdshow_
99 # define gdopen gdopen_
100 # define dzshow dzshow_
101 # define gsatt gsatt_
102 # define gfpara gfpara_
103 # define gckpar gckpar_
104 # define gckmat gckmat_
105 # define geditv geditv_
106 # define mzdrop mzdrop_
108 # define setbomb setbomb_
109 # define setclip setclip_
110 # define gcomad gcomad_
113 # define gzebra GZEBRA
114 # define grfile GRFILE
115 # define gpcxyz GPCXYZ
116 # define ggclos GGCLOS
119 # define gcinit GCINIT
122 # define gtrigc GTRIGC
123 # define gtrigi GTRIGI
125 # define gzinit GZINIT
126 # define gfmate GFMATE
127 # define gfpart GFPART
128 # define gftmed GFTMED
132 # define gsmate GSMATE
133 # define gsmixt GSMIXT
134 # define gspart GSPART
135 # define gstmed GSTMED
136 # define gsckov GSCKOV
137 # define gstpar GSTPAR
138 # define gfkine GFKINE
139 # define gfvert GFVERT
140 # define gskine GSKINE
141 # define gsvert GSVERT
142 # define gphysi GPHYSI
143 # define gdebug GDEBUG
144 # define gekbin GEKBIN
145 # define gfinds GFINDS
146 # define gsking GSKING
147 # define gskpho GSKPHO
148 # define gsstak GSSTAK
150 # define gtrack GTRACK
151 # define gtreve GTREVE
152 # define gtreve_root GTREVE_ROOT
154 # define grndmq GRNDMQ
156 # define glmoth GLMOTH
157 # define gmedia GMEDIA
160 # define gsdvn2 GSDVN2
162 # define gsdvs2 GSDVS2
164 # define gsdvt2 GSDVT2
167 # define gsposp GSPOSP
168 # define gsrotm GSROTM
169 # define gprotm GPROTM
170 # define gsvolu GSVOLU
171 # define gprint GPRINT
172 # define gdinit GDINIT
175 # define gdrayt GDRAYT
176 # define gdrawc GDRAWC
177 # define gdrawx GDRAWX
178 # define gdhead GDHEAD
179 # define gdwmn1 GDWMN1
180 # define gdwmn2 GDWMN2
181 # define gdwmn3 GDWMN3
183 # define gdcxyz GDCXYZ
185 # define gdfspc GDFSPC
186 # define gdspec GDSPEC
187 # define gdtree GDTREE
188 # define gdelet GDELET
189 # define gdclos GDCLOS
190 # define gdshow GDSHOW
191 # define gdopen GDOPEN
192 # define dzshow DZSHOW
194 # define gfpara GFPARA
195 # define gckpar GCKPAR
196 # define gckmat GCKMAT
197 # define geditv GEDITV
198 # define mzdrop MZDROP
200 # define setbomb SETBOMB
201 # define setclip SETCLIP
202 # define gcomad GCOMAD
206 //____________________________________________________________________________
210 // Prototypes for GEANT functions
212 void type_of_call gzebra(const int&);
214 void type_of_call gpcxyz();
216 void type_of_call ggclos();
218 void type_of_call glast();
220 void type_of_call ginit();
222 void type_of_call gcinit();
224 void type_of_call grun();
226 void type_of_call gtrig();
228 void type_of_call gtrigc();
230 void type_of_call gtrigi();
232 void type_of_call gwork(const int&);
234 void type_of_call gzinit();
236 void type_of_call gmate();
238 void type_of_call gpart();
240 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
242 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
243 Int_t &, Float_t *, Int_t &);
245 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
246 Float_t &, Float_t *, Int_t &);
248 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
251 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
254 void type_of_call gphysi();
256 void type_of_call gdebug();
258 void type_of_call gekbin();
260 void type_of_call gfinds();
262 void type_of_call gsking(Int_t &);
264 void type_of_call gskpho(Int_t &);
266 void type_of_call gsstak(Int_t &);
268 void type_of_call gsxyz();
270 void type_of_call gtrack();
272 void type_of_call gtreve();
274 void type_of_call gtreve_root();
276 void type_of_call grndm(Float_t *, const Int_t &);
278 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
281 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
283 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
284 Int_t *, Int_t * DEFCHARL);
286 void type_of_call gmedia(Float_t *, Int_t &);
288 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
290 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
291 const Float_t &, const Float_t &, const Float_t &,
294 void type_of_call gprotm(const Int_t &);
296 void type_of_call grfile(const Int_t&, DEFCHARD,
297 DEFCHARD DEFCHARL DEFCHARL);
299 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
300 Float_t &, Float_t &, Float_t &, Float_t *,
303 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
304 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
306 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
307 Float_t &, Float_t &, Float_t &, Float_t &,
308 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
310 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
311 Float_t &, Float_t &, Float_t &, Float_t *,
314 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
315 Float_t &, Int_t &, Float_t * DEFCHARL);
317 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
318 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
321 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
322 Float_t &, Float_t &, Float_t &, Float_t &,
323 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
325 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
326 Float_t *absco, Float_t *effic, Float_t *rindex);
327 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
329 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
332 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
333 Int_t & DEFCHARL DEFCHARL);
335 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
338 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
339 Int_t & DEFCHARL DEFCHARL);
341 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
342 Int_t & DEFCHARL DEFCHARL);
344 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
345 Int_t &, Int_t & DEFCHARL DEFCHARL);
347 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
349 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
350 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
353 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
354 Float_t &, Int_t &, DEFCHARD,
355 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
357 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
358 Int_t & DEFCHARL DEFCHARL);
360 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
362 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
365 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
367 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
369 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
371 void type_of_call gdinit();
373 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
375 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
376 Float_t &, Float_t &, Float_t & DEFCHARL);
377 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
378 Float_t &, Float_t &, Float_t & DEFCHARL);
379 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
380 Float_t &, Float_t & DEFCHARL);
381 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
382 Float_t &, Float_t &, Float_t &, Float_t &,
384 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
385 void type_of_call gdxyz(Int_t &);
386 void type_of_call gdcxyz();
387 void type_of_call gdman(Float_t &, Float_t &);
388 void type_of_call gdwmn1(Float_t &, Float_t &);
389 void type_of_call gdwmn2(Float_t &, Float_t &);
390 void type_of_call gdwmn3(Float_t &, Float_t &);
391 void type_of_call gdspec(DEFCHARD DEFCHARL);
392 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
393 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
395 void type_of_call gdopen(Int_t &);
396 void type_of_call gdclos();
397 void type_of_call gdelet(Int_t &);
398 void type_of_call gdshow(Int_t &);
399 void type_of_call geditv(Int_t &) {;}
402 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
403 const int&, const int&, const int& DEFCHARL
406 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
408 void type_of_call setbomb(Float_t &);
409 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
410 Float_t &, Float_t & DEFCHARL);
411 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
415 // Geant3 global pointer
417 static Int_t defSize = 600;
421 //____________________________________________________________________________
425 // Default constructor
429 //____________________________________________________________________________
430 TGeant3::TGeant3(const char *title, Int_t nwgeant)
431 :AliMC("TGeant3",title)
434 // Standard constructor for TGeant3 with ZEBRA initialisation
445 // Load Address of Geant3 commons
448 // Zero number of particles
452 //____________________________________________________________________________
453 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
454 Float_t &radl, Float_t &absl) const
457 // Return the parameters of the current material during transport
461 dens = fGcmate->dens;
462 radl = fGcmate->radl;
463 absl = fGcmate->absl;
464 return 1; //this could be the number of elements in mixture
467 //____________________________________________________________________________
468 void TGeant3::DefaultRange()
471 // Set range of current drawing pad to 20x20 cm
477 higz->Range(0,0,20,20);
480 //____________________________________________________________________________
481 void TGeant3::InitHIGZ()
492 //____________________________________________________________________________
493 void TGeant3::LoadAddress()
496 // Assigns the address of the GEANT common blocks to the structures
497 // that allow their access from C++
500 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
501 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
502 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
503 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
504 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
505 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
506 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
507 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
508 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
509 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
510 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
511 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
512 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
513 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
514 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
515 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
516 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
517 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
518 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
519 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
521 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
523 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
528 //_____________________________________________________________________________
529 void TGeant3::GeomIter()
532 // Geometry iterator for moving upward in the geometry tree
533 // Initialise the iterator
535 fNextVol=fGcvolu->nlevel;
538 //____________________________________________________________________________
539 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
542 // Geometry iterator for moving upward in the geometry tree
543 // Return next volume up
548 gname=fGcvolu->names[fNextVol];
549 strncpy(name,(char *) &gname, 4);
551 copy=fGcvolu->number[fNextVol];
552 i=fGcvolu->lvolum[fNextVol];
553 if(gname == fZiq[fGclink->jvolum+i]) return i;
554 else printf("GeomTree: Volume %s not found in bank\n",name);
559 //_____________________________________________________________________________
560 Int_t TGeant3::CurrentVolID(Int_t ©) const
563 // Returns the current volume ID and copy number
566 if( (i=fGcvolu->nlevel-1) < 0 ) {
567 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
569 gname=fGcvolu->names[i];
570 copy=fGcvolu->number[i];
571 i=fGcvolu->lvolum[i];
572 if(gname == fZiq[fGclink->jvolum+i]) return i;
573 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
578 //_____________________________________________________________________________
579 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
582 // Return the current volume "off" upward in the geometrical tree
583 // ID and copy number
586 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
587 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
588 off,fGcvolu->nlevel);
590 gname=fGcvolu->names[i];
591 copy=fGcvolu->number[i];
592 i=fGcvolu->lvolum[i];
593 if(gname == fZiq[fGclink->jvolum+i]) return i;
594 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
599 //_____________________________________________________________________________
600 const char* TGeant3::CurrentVolName() const
603 // Returns the current volume name
607 if( (i=fGcvolu->nlevel-1) < 0 ) {
608 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
610 gname=fGcvolu->names[i];
612 strncpy(name,(char *) &gname, 4);
614 i=fGcvolu->lvolum[i];
615 if(gname == fZiq[fGclink->jvolum+i]) return name;
616 else Warning("CurrentVolName","Volume %4s not found\n",name);
621 //_____________________________________________________________________________
622 const char* TGeant3::CurrentVolOffName(Int_t off) const
625 // Return the current volume "off" upward in the geometrical tree
626 // ID, name and copy number
627 // if name=0 no name is returned
631 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
632 Warning("CurrentVolOffName",
633 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
635 gname=fGcvolu->names[i];
637 strncpy(name,(char *) &gname, 4);
639 i=fGcvolu->lvolum[i];
640 if(gname == fZiq[fGclink->jvolum+i]) return name;
641 else Warning("CurrentVolOffName","Volume %4s not found\n",name);
646 //_____________________________________________________________________________
647 Int_t TGeant3::IdFromPDG(Int_t pdg) const
650 // Return Geant3 code from PDG and pseudo ENDF code
652 for(Int_t i=0;i<fNPDGCodes;++i)
653 if(pdg==fPDGCode[i]) return i;
657 //_____________________________________________________________________________
658 Int_t TGeant3::PDGFromId(Int_t id) const
660 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
664 //_____________________________________________________________________________
665 void TGeant3::DefineParticles()
668 // Define standard Geant 3 particles
671 // Load standard numbers for GEANT particles and PDG conversion
672 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
673 fPDGCode[fNPDGCodes++]=22; // 1 = photon
674 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
675 fPDGCode[fNPDGCodes++]=11; // 3 = electron
676 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
677 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
678 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
679 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
680 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
681 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
682 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
683 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
684 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
685 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
686 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
687 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
688 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
689 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
690 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
691 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
692 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
693 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
694 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
695 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
696 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
697 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
698 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
699 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
700 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
701 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
702 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
703 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
704 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
711 /* --- Define additional particles */
712 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
713 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
715 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
716 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
718 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
719 fPDGCode[fNPDGCodes++]=411; // 35 = D+
721 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
722 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
724 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
725 fPDGCode[fNPDGCodes++]=421; // 37 = D0
727 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
728 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
730 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
732 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
734 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
736 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
737 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
739 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
740 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
742 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
743 fPDGCode[fNPDGCodes++]=113; // 37 = D0
746 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
748 // and numbers above 5 000 000 for special applications
751 const Int_t kion=10000000;
753 const Int_t kspe=50000000;
755 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
757 const Double_t autogev=0.9314943228;
758 const Double_t hslash = 1.0545726663e-27;
759 const Double_t erggev = 1/1.6021773349e-3;
760 const Double_t hshgev = hslash*erggev;
761 const Double_t yearstosec = 3600*24*365.25;
764 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
765 0,1,"Ion",kion+10020);
766 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
768 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
769 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
770 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
772 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
773 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
774 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
776 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
778 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
779 0,2,"Ion",kion+20030);
780 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
782 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
783 0,0,"Special",kspe+50);
784 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
786 /* --- Define additional decay modes --- */
787 /* --- omega(783) --- */
788 for (kz = 0; kz < 6; ++kz) {
799 Gsdk(ipa, bratio, mode);
800 /* --- phi(1020) --- */
801 for (kz = 0; kz < 6; ++kz) {
816 Gsdk(ipa, bratio, mode);
818 for (kz = 0; kz < 6; ++kz) {
831 Gsdk(ipa, bratio, mode);
833 for (kz = 0; kz < 6; ++kz) {
846 Gsdk(ipa, bratio, mode);
848 for (kz = 0; kz < 6; ++kz) {
859 Gsdk(ipa, bratio, mode);
860 /* --- Anti D0 --- */
861 for (kz = 0; kz < 6; ++kz) {
872 Gsdk(ipa, bratio, mode);
874 for (kz = 0; kz < 6; ++kz) {
881 Gsdk(ipa, bratio, mode);
883 for (kz = 0; kz < 6; ++kz) {
890 Gsdk(ipa, bratio, mode);
892 for (kz = 0; kz < 6; ++kz) {
899 Gsdk(ipa, bratio, mode);
902 for (kz = 0; kz < 6; ++kz) {
911 Gsdk(ipa, bratio, mode);
914 Gsdk(ipa, bratio, mode);
917 Gsdk(ipa, bratio, mode);
922 //_____________________________________________________________________________
923 Int_t TGeant3::VolId(Text_t *name) const
926 // Return the unique numeric identifier for volume name
929 strncpy((char *) &gname, name, 4);
930 for(i=1; i<=fGcnum->nvolum; i++)
931 if(gname == fZiq[fGclink->jvolum+i]) return i;
932 printf("VolId: Volume %s not found\n",name);
936 //_____________________________________________________________________________
937 Int_t TGeant3::NofVolumes() const
940 // Return total number of volumes in the geometry
942 return fGcnum->nvolum;
945 //_____________________________________________________________________________
946 const char* TGeant3::VolName(Int_t id) const
949 // Return the volume name given the volume identifier
952 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
955 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
960 //_____________________________________________________________________________
961 void TGeant3::TrackPosition(TLorentzVector &xyz) const
964 // Return the current position in the master reference frame of the
965 // track being transported
967 xyz[0]=fGctrak->vect[0];
968 xyz[1]=fGctrak->vect[1];
969 xyz[2]=fGctrak->vect[2];
970 xyz[3]=fGctrak->tofg;
973 //_____________________________________________________________________________
974 Float_t TGeant3::TrackTime() const
977 // Return the current time of flight of the track being transported
979 return fGctrak->tofg;
982 //_____________________________________________________________________________
983 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
986 // Return the direction and the momentum (GeV/c) of the track
987 // currently being transported
989 Double_t ptot=fGctrak->vect[6];
990 xyz[0]=fGctrak->vect[3]*ptot;
991 xyz[1]=fGctrak->vect[4]*ptot;
992 xyz[2]=fGctrak->vect[5]*ptot;
993 xyz[3]=fGctrak->getot;
996 //_____________________________________________________________________________
997 Float_t TGeant3::TrackCharge() const
1000 // Return charge of the track currently transported
1002 return fGckine->charge;
1005 //_____________________________________________________________________________
1006 Float_t TGeant3::TrackMass() const
1009 // Return the mass of the track currently transported
1011 return fGckine->amass;
1014 //_____________________________________________________________________________
1015 Int_t TGeant3::TrackPid() const
1018 // Return the id of the particle transported
1020 return PDGFromId(fGckine->ipart);
1023 //_____________________________________________________________________________
1024 Float_t TGeant3::TrackStep() const
1027 // Return the length in centimeters of the current step
1029 return fGctrak->step;
1032 //_____________________________________________________________________________
1033 Float_t TGeant3::TrackLength() const
1036 // Return the length of the current track from its origin
1038 return fGctrak->sleng;
1041 //_____________________________________________________________________________
1042 Bool_t TGeant3::IsTrackInside() const
1045 // True if the track is not at the boundary of the current volume
1047 return (fGctrak->inwvol==0);
1050 //_____________________________________________________________________________
1051 Bool_t TGeant3::IsTrackEntering() const
1054 // True if this is the first step of the track in the current volume
1056 return (fGctrak->inwvol==1);
1059 //_____________________________________________________________________________
1060 Bool_t TGeant3::IsTrackExiting() const
1063 // True if this is the last step of the track in the current volume
1065 return (fGctrak->inwvol==2);
1068 //_____________________________________________________________________________
1069 Bool_t TGeant3::IsTrackOut() const
1072 // True if the track is out of the setup
1074 return (fGctrak->inwvol==3);
1077 //_____________________________________________________________________________
1078 Bool_t TGeant3::IsTrackStop() const
1081 // True if the track energy has fallen below the threshold
1083 return (fGctrak->istop==2);
1086 //_____________________________________________________________________________
1087 Int_t TGeant3::NSecondaries() const
1090 // Number of secondary particles generated in the current step
1092 return fGcking->ngkine;
1095 //_____________________________________________________________________________
1096 Int_t TGeant3::CurrentEvent() const
1099 // Number of the current event
1101 return fGcflag->idevt;
1104 //_____________________________________________________________________________
1105 void TGeant3::ProdProcess(char* proc) const
1108 // Name of the process that has produced the secondary particles
1109 // in the current step
1111 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1114 if(fGcking->ngkine>0) {
1115 for (km = 0; km < fGctrak->nmec; ++km) {
1116 for (im = 0; im < 13; ++im) {
1117 if (fGctrak->lmec[km] == ipmec[im]) {
1118 mec = fGctrak->lmec[km];
1119 if (0 < mec && mec < 31) {
1120 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1121 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1122 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1129 strcpy(proc,"UNKN");
1130 } else strcpy(proc,"NONE");
1133 //_____________________________________________________________________________
1134 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p)
1137 // Get the parameters of the secondary track number isec produced
1138 // in the current step
1141 if(-1<isec && isec<fGcking->ngkine) {
1142 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1144 x[i]=fGckin3->gpos[isec][i];
1145 p[i]=fGcking->gkin[isec][i];
1147 x[3]=fGcking->tofd[isec];
1148 p[3]=fGcking->gkin[isec][3];
1150 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1151 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1156 //_____________________________________________________________________________
1157 void TGeant3::InitLego()
1160 SetDEBU(0,0,0); //do not print a message
1163 //_____________________________________________________________________________
1164 Bool_t TGeant3::IsTrackDisappeared() const
1167 // True if the current particle has disappered
1168 // either because it decayed or because it underwent
1169 // an inelastic collision
1171 return (fGctrak->istop==1);
1174 //_____________________________________________________________________________
1175 Bool_t TGeant3::IsTrackAlive() const
1178 // True if the current particle is alive and will continue to be
1181 return (fGctrak->istop==0);
1184 //_____________________________________________________________________________
1185 void TGeant3::StopTrack()
1188 // Stop the transport of the current particle and skip to the next
1193 //_____________________________________________________________________________
1194 void TGeant3::StopEvent()
1197 // Stop simulation of the current event and skip to the next
1202 //_____________________________________________________________________________
1203 Float_t TGeant3::MaxStep() const
1206 // Return the maximum step length in the current medium
1208 return fGctmed->stemax;
1211 //_____________________________________________________________________________
1212 void TGeant3::SetColors()
1215 // Set the colors for all the volumes
1216 // this is done sequentially for all volumes
1217 // based on the number of their medium
1220 Int_t jvolum=fGclink->jvolum;
1221 //Int_t jtmed=fGclink->jtmed;
1222 //Int_t jmate=fGclink->jmate;
1223 Int_t nvolum=fGcnum->nvolum;
1226 // Now for all the volumes
1227 for(kv=1;kv<=nvolum;kv++) {
1228 // Get the tracking medium
1229 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1231 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1233 //Float_t z=fZq[fZlq[jmate-ima]+7];
1234 // Find color number
1235 //icol = Int_t(z)%6+2;
1236 //icol = 17+Int_t(z*150./92.);
1239 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1241 Gsatt(name,"COLO",icol);
1245 //_____________________________________________________________________________
1246 void TGeant3::SetMaxStep(Float_t maxstep)
1249 // Set the maximum step allowed till the particle is in the current medium
1251 fGctmed->stemax=maxstep;
1254 //_____________________________________________________________________________
1255 void TGeant3::SetMaxNStep(Int_t maxnstp)
1258 // Set the maximum number of steps till the particle is in the current medium
1260 fGctrak->maxnst=maxnstp;
1263 //_____________________________________________________________________________
1264 Int_t TGeant3::GetMaxNStep() const
1267 // Maximum number of steps allowed in current medium
1269 return fGctrak->maxnst;
1272 //_____________________________________________________________________________
1273 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1274 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1278 // Defines a Material
1280 // kmat number assigned to the material
1281 // name material name
1282 // a atomic mass in au
1284 // dens density in g/cm3
1285 // absl absorbtion length in cm
1286 // if >=0 it is ignored and the program
1287 // calculates it, if <0. -absl is taken
1288 // radl radiation length in cm
1289 // if >=0 it is ignored and the program
1290 // calculates it, if <0. -radl is taken
1291 // buf pointer to an array of user words
1292 // nbuf number of user words
1294 Int_t jmate=fGclink->jmate;
1300 for(i=1; i<=ns; i++) {
1301 if(fZlq[jmate-i]==0) {
1307 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1308 nwbuf PASSCHARL(name));
1311 //_____________________________________________________________________________
1312 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1313 Float_t dens, Int_t nlmat, Float_t* wmat)
1316 // Defines mixture OR COMPOUND IMAT as composed by
1317 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1319 // If NLMAT > 0 then wmat contains the proportion by
1320 // weights of each basic material in the mixture.
1322 // If nlmat < 0 then WMAT contains the number of atoms
1323 // of a given kind into the molecule of the COMPOUND
1324 // In this case, WMAT in output is changed to relative
1327 Int_t jmate=fGclink->jmate;
1333 for(i=1; i<=ns; i++) {
1334 if(fZlq[jmate-i]==0) {
1340 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1343 //_____________________________________________________________________________
1344 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1345 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1346 Float_t stemax, Float_t deemax, Float_t epsil,
1347 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1350 // kmed tracking medium number assigned
1351 // name tracking medium name
1352 // nmat material number
1353 // isvol sensitive volume flag
1354 // ifield magnetic field
1355 // fieldm max. field value (kilogauss)
1356 // tmaxfd max. angle due to field (deg/step)
1357 // stemax max. step allowed
1358 // deemax max. fraction of energy lost in a step
1359 // epsil tracking precision (cm)
1360 // stmin min. step due to continuos processes (cm)
1362 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1363 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1364 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1366 Int_t jtmed=fGclink->jtmed;
1372 for(i=1; i<=ns; i++) {
1373 if(fZlq[jtmed-i]==0) {
1379 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1380 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1383 //_____________________________________________________________________________
1384 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1385 Float_t phiy, Float_t thez, Float_t phiz)
1388 // krot rotation matrix number assigned
1389 // theta1 polar angle for axis i
1390 // phi1 azimuthal angle for axis i
1391 // theta2 polar angle for axis ii
1392 // phi2 azimuthal angle for axis ii
1393 // theta3 polar angle for axis iii
1394 // phi3 azimuthal angle for axis iii
1396 // it defines the rotation matrix number irot.
1398 Int_t jrotm=fGclink->jrotm;
1404 for(i=1; i<=ns; i++) {
1405 if(fZlq[jrotm-i]==0) {
1411 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1414 //_____________________________________________________________________________
1415 Int_t TGeant3::GetMedium() const
1418 // Return the number of the current medium
1420 return fGctmed->numed;
1423 //_____________________________________________________________________________
1424 Float_t TGeant3::Edep() const
1427 // Return the energy lost in the current step
1429 return fGctrak->destep;
1432 //_____________________________________________________________________________
1433 Float_t TGeant3::Etot() const
1436 // Return the total energy of the current track
1438 return fGctrak->getot;
1441 //_____________________________________________________________________________
1442 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1445 // Return an array of n random numbers uniformly distributed
1446 // between 0 and 1 not included
1451 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1453 // Functions from GBASE
1455 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1457 //____________________________________________________________________________
1458 void TGeant3::Gfile(const char *filename, const char *option)
1461 // Routine to open a GEANT/RZ data base.
1463 // LUN logical unit number associated to the file
1465 // CHFILE RZ file name
1467 // CHOPT is a character string which may be
1468 // N To create a new file
1469 // U to open an existing file for update
1470 // " " to open an existing file for read only
1471 // Q The initial allocation (default 1000 records)
1472 // is given in IQUEST(10)
1473 // X Open the file in exchange format
1474 // I Read all data structures from file to memory
1475 // O Write all data structures from memory to file
1478 // If options "I" or "O" all data structures are read or
1479 // written from/to file and the file is closed.
1480 // See routine GRMDIR to create subdirectories
1481 // See routines GROUT,GRIN to write,read objects
1483 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1487 //____________________________________________________________________________
1488 void TGeant3::Gpcxyz()
1491 // Print track and volume parameters at current point
1496 //_____________________________________________________________________________
1497 void TGeant3::Ggclos()
1500 // Closes off the geometry setting.
1501 // Initializes the search list for the contents of each
1502 // volume following the order they have been positioned, and
1503 // inserting the content '0' when a call to GSNEXT (-1) has
1504 // been required by the user.
1505 // Performs the development of the JVOLUM structure for all
1506 // volumes with variable parameters, by calling GGDVLP.
1507 // Interprets the user calls to GSORD, through GGORD.
1508 // Computes and stores in a bank (next to JVOLUM mother bank)
1509 // the number of levels in the geometrical tree and the
1510 // maximum number of contents per level, by calling GGNLEV.
1511 // Sets status bit for CONCAVE volumes, through GGCAVE.
1512 // Completes the JSET structure with the list of volume names
1513 // which identify uniquely a given physical detector, the
1514 // list of bit numbers to pack the corresponding volume copy
1515 // numbers, and the generic path(s) in the JVOLUM tree,
1516 // through the routine GHCLOS.
1521 //_____________________________________________________________________________
1522 void TGeant3::Glast()
1525 // Finish a Geant run
1530 //_____________________________________________________________________________
1531 void TGeant3::Gprint(const char *name)
1534 // Routine to print data structures
1535 // CHNAME name of a data structure
1539 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1542 //_____________________________________________________________________________
1543 void TGeant3::Grun()
1546 // Steering function to process one run
1551 //_____________________________________________________________________________
1552 void TGeant3::Gtrig()
1555 // Steering function to process one event
1560 //_____________________________________________________________________________
1561 void TGeant3::Gtrigc()
1564 // Clear event partition
1569 //_____________________________________________________________________________
1570 void TGeant3::Gtrigi()
1573 // Initialises event partition
1578 //_____________________________________________________________________________
1579 void TGeant3::Gwork(Int_t nwork)
1582 // Allocates workspace in ZEBRA memory
1587 //_____________________________________________________________________________
1588 void TGeant3::Gzinit()
1591 // To initialise GEANT/ZEBRA data structures
1596 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1598 // Functions from GCONS
1600 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1602 //_____________________________________________________________________________
1603 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1604 Float_t &dens, Float_t &radl, Float_t &absl,
1605 Float_t* ubuf, Int_t& nbuf)
1608 // Return parameters for material IMAT
1610 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1614 //_____________________________________________________________________________
1615 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1616 Float_t &amass, Float_t &charge, Float_t &tlife)
1619 // Return parameters for particle of type IPART
1623 Int_t igpart = IdFromPDG(ipart);
1624 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1628 //_____________________________________________________________________________
1629 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1630 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1631 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1632 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1635 // Return parameters for tracking medium NUMED
1637 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1638 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1641 //_____________________________________________________________________________
1642 void TGeant3::Gmate()
1645 // Define standard GEANT materials
1650 //_____________________________________________________________________________
1651 void TGeant3::Gpart()
1654 // Define standard GEANT particles plus selected decay modes
1655 // and branching ratios.
1660 //_____________________________________________________________________________
1661 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1663 // Defines branching ratios and decay modes for standard
1665 gsdk(ipart,bratio,mode);
1668 //_____________________________________________________________________________
1669 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1670 Float_t dens, Float_t radl, Float_t absl)
1673 // Defines a Material
1675 // kmat number assigned to the material
1676 // name material name
1677 // a atomic mass in au
1679 // dens density in g/cm3
1680 // absl absorbtion length in cm
1681 // if >=0 it is ignored and the program
1682 // calculates it, if <0. -absl is taken
1683 // radl radiation length in cm
1684 // if >=0 it is ignored and the program
1685 // calculates it, if <0. -radl is taken
1686 // buf pointer to an array of user words
1687 // nbuf number of user words
1691 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1695 //_____________________________________________________________________________
1696 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1697 Float_t dens, Int_t nlmat, Float_t *wmat)
1700 // Defines mixture OR COMPOUND IMAT as composed by
1701 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1703 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1704 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1706 // If NLMAT.LT.0 then WMAT contains the number of atoms
1707 // of a given kind into the molecule of the COMPOUND
1708 // In this case, WMAT in output is changed to relative
1711 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1714 //_____________________________________________________________________________
1715 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1716 Float_t amass, Float_t charge, Float_t tlife)
1719 // Store particle parameters
1721 // ipart particle code
1722 // name particle name
1723 // itrtyp transport method (see GEANT manual)
1724 // amass mass in GeV/c2
1725 // charge charge in electron units
1726 // tlife lifetime in seconds
1730 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1734 //_____________________________________________________________________________
1735 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1736 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1737 Float_t stemax, Float_t deemax, Float_t epsil,
1741 // NTMED Tracking medium number
1742 // NAME Tracking medium name
1743 // NMAT Material number
1744 // ISVOL Sensitive volume flag
1745 // IFIELD Magnetic field
1746 // FIELDM Max. field value (Kilogauss)
1747 // TMAXFD Max. angle due to field (deg/step)
1748 // STEMAX Max. step allowed
1749 // DEEMAX Max. fraction of energy lost in a step
1750 // EPSIL Tracking precision (cm)
1751 // STMIN Min. step due to continuos processes (cm)
1753 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1754 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1755 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1759 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1760 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1763 //_____________________________________________________________________________
1764 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1765 Float_t *absco, Float_t *effic, Float_t *rindex)
1768 // Stores the tables for UV photon tracking in medium ITMED
1769 // Please note that it is the user's responsability to
1770 // provide all the coefficients:
1773 // ITMED Tracking medium number
1774 // NPCKOV Number of bins of each table
1775 // PPCKOV Value of photon momentum (in GeV)
1776 // ABSCO Absorbtion coefficients
1777 // dielectric: absorbtion length in cm
1778 // metals : absorbtion fraction (0<=x<=1)
1779 // EFFIC Detection efficiency for UV photons
1780 // RINDEX Refraction index (if=0 metal)
1782 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1785 //_____________________________________________________________________________
1786 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1789 // To change the value of cut or mechanism "CHPAR"
1790 // to a new value PARVAL for tracking medium ITMED
1791 // The data structure JTMED contains the standard tracking
1792 // parameters (CUTS and flags to control the physics processes) which
1793 // are used by default for all tracking media. It is possible to
1794 // redefine individually with GSTPAR any of these parameters for a
1795 // given tracking medium.
1796 // ITMED tracking medium number
1797 // CHPAR is a character string (variable name)
1798 // PARVAL must be given as a floating point.
1800 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1803 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1805 // Functions from GCONS
1807 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1809 //_____________________________________________________________________________
1810 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1813 // Storing/Retrieving Vertex and Track parameters
1814 // ----------------------------------------------
1816 // Stores vertex parameters.
1817 // VERT array of (x,y,z) position of the vertex
1818 // NTBEAM beam track number origin of the vertex
1819 // =0 if none exists
1820 // NTTARG target track number origin of the vertex
1821 // UBUF user array of NUBUF floating point numbers
1823 // NVTX new vertex number (=0 in case of error).
1824 // Prints vertex parameters.
1825 // IVTX for vertex IVTX.
1826 // (For all vertices if IVTX=0)
1827 // Stores long life track parameters.
1828 // PLAB components of momentum
1829 // IPART type of particle (see GSPART)
1830 // NV vertex number origin of track
1831 // UBUF array of NUBUF floating point user parameters
1833 // NT track number (if=0 error).
1834 // Retrieves long life track parameters.
1835 // ITRA track number for which parameters are requested
1836 // VERT vector origin of the track
1837 // PVERT 4 momentum components at the track origin
1838 // IPART particle type (=0 if track ITRA does not exist)
1839 // NVERT vertex number origin of the track
1840 // UBUF user words stored in GSKINE.
1841 // Prints initial track parameters.
1842 // ITRA for track ITRA
1843 // (For all tracks if ITRA=0)
1847 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1850 //_____________________________________________________________________________
1851 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1855 // Retrieves the parameter of a vertex bank
1856 // Vertex is generated from tracks NTBEAM NTTARG
1857 // NVTX is the new vertex number
1861 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1864 //_____________________________________________________________________________
1865 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1869 // Store kinematics of track NT into data structure
1870 // Track is coming from vertex NV
1873 gskine(plab, ipart, nv, buf, nwbuf, nt);
1877 //_____________________________________________________________________________
1878 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1882 // Creates a new vertex bank
1883 // Vertex is generated from tracks NTBEAM NTTARG
1884 // NVTX is the new vertex number
1887 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1891 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1893 // Functions from GPHYS
1895 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1897 //_____________________________________________________________________________
1898 void TGeant3::Gphysi()
1901 // Initialise material constants for all the physics
1902 // mechanisms used by GEANT
1907 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1909 // Functions from GTRAK
1911 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1913 //_____________________________________________________________________________
1914 void TGeant3::Gdebug()
1917 // Debug the current step
1922 //_____________________________________________________________________________
1923 void TGeant3::Gekbin()
1926 // To find bin number in kinetic energy table
1927 // stored in ELOW(NEKBIN)
1932 //_____________________________________________________________________________
1933 void TGeant3::Gfinds()
1936 // Returns the set/volume parameters corresponding to
1937 // the current space point in /GCTRAK/
1938 // and fill common /GCSETS/
1940 // IHSET user set identifier
1941 // IHDET user detector identifier
1942 // ISET set number in JSET
1943 // IDET detector number in JS=LQ(JSET-ISET)
1944 // IDTYPE detector type (1,2)
1945 // NUMBV detector volume numbers (array of length NVNAME)
1946 // NVNAME number of volume levels
1951 //_____________________________________________________________________________
1952 void TGeant3::Gsking(Int_t igk)
1955 // Stores in stack JSTAK either the IGKth track of /GCKING/,
1956 // or the NGKINE tracks when IGK is 0.
1961 //_____________________________________________________________________________
1962 void TGeant3::Gskpho(Int_t igk)
1965 // Stores in stack JSTAK either the IGKth Cherenkov photon of
1966 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
1971 //_____________________________________________________________________________
1972 void TGeant3::Gsstak(Int_t iflag)
1975 // Stores in auxiliary stack JSTAK the particle currently
1976 // described in common /GCKINE/.
1978 // On request, creates also an entry in structure JKINE :
1980 // 0 : No entry in JKINE structure required (user)
1981 // 1 : New entry in JVERTX / JKINE structures required (user)
1982 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
1983 // 2 : Entry in JKINE structure exists already (from GTREVE)
1988 //_____________________________________________________________________________
1989 void TGeant3::Gsxyz()
1992 // Store space point VECT in banks JXYZ
1997 //_____________________________________________________________________________
1998 void TGeant3::Gtrack()
2001 // Controls tracking of current particle
2006 //_____________________________________________________________________________
2007 void TGeant3::Gtreve()
2010 // Controls tracking of all particles belonging to the current event
2015 //_____________________________________________________________________________
2016 void TGeant3::Gtreve_root()
2019 // Controls tracking of all particles belonging to the current event
2024 //_____________________________________________________________________________
2025 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2028 // To generate a vector RVECV of LEN random numbers
2029 // Copy of the CERN Library routine RANECU
2033 //_____________________________________________________________________________
2034 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2035 const Text_t *chopt)
2038 // To set/retrieve the seed of the random number generator
2040 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2043 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2045 // Functions from GDRAW
2047 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2049 //_____________________________________________________________________________
2050 void TGeant3::Gdxyz(Int_t it)
2053 // Draw the points stored with Gsxyz relative to track it
2058 //_____________________________________________________________________________
2059 void TGeant3::Gdcxyz()
2062 // Draw the position of the current track
2067 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2069 // Functions from GGEOM
2071 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2073 //_____________________________________________________________________________
2074 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2077 // Computes coordinates XM (Master Reference System
2078 // knowing the coordinates XD (Detector Ref System)
2079 // The local reference system can be initialized by
2080 // - the tracking routines and GDTOM used in GUSTEP
2081 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2082 // (inverse routine is GMTOD)
2084 // If IFLAG=1 convert coordinates
2085 // IFLAG=2 convert direction cosinus
2087 gdtom(xd, xm, iflag);
2090 //_____________________________________________________________________________
2091 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2095 // Loads the top part of the Volume tree in LVOLS (IVO's),
2096 // LINDX (IN indices) for a given volume defined through
2097 // its name IUDET and number IUNUM.
2099 // The routine stores only upto the last level where JVOLUM
2100 // data structure is developed. If there is no development
2101 // above the current level, it returns NLEV zero.
2103 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2106 //_____________________________________________________________________________
2107 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2110 // Finds in which volume/medium the point X is, and updates the
2111 // common /GCVOLU/ and the structure JGPAR accordingly.
2113 // NUMED returns the tracking medium number, or 0 if point is
2114 // outside the experimental setup.
2119 //_____________________________________________________________________________
2120 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2123 // Computes coordinates XD (in DRS)
2124 // from known coordinates XM in MRS
2125 // The local reference system can be initialized by
2126 // - the tracking routines and GMTOD used in GUSTEP
2127 // - a call to GMEDIA(XM,NUMED)
2128 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2129 // (inverse routine is GDTOM)
2131 // If IFLAG=1 convert coordinates
2132 // IFLAG=2 convert direction cosinus
2134 gmtod(xm, xd, iflag);
2137 //_____________________________________________________________________________
2138 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2142 // Create a new volume by dividing an existing one
2145 // MOTHER Mother volume name
2146 // NDIV Number of divisions
2149 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2150 // It divides a previously defined volume.
2155 Vname(mother,vmother);
2156 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2157 PASSCHARL(vmother));
2160 //_____________________________________________________________________________
2161 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2162 Int_t iaxis, Float_t c0i, Int_t numed)
2165 // Create a new volume by dividing an existing one
2167 // Divides mother into ndiv divisions called name
2168 // along axis iaxis starting at coordinate value c0.
2169 // the new volume created will be medium number numed.
2174 Vname(mother,vmother);
2175 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2176 PASSCHARL(vname) PASSCHARL(vmother));
2179 //_____________________________________________________________________________
2180 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2181 Int_t iaxis, Int_t numed)
2184 // Create a new volume by dividing an existing one
2189 Vname(mother,vmother);
2190 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2191 PASSCHARL(vname) PASSCHARL(vmother));
2194 //_____________________________________________________________________________
2195 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2196 Int_t iaxis, Float_t c0, Int_t numed)
2199 // Create a new volume by dividing an existing one
2204 Vname(mother,vmother);
2205 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2206 PASSCHARL(vname) PASSCHARL(vmother));
2209 //_____________________________________________________________________________
2210 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2211 Int_t iaxis, Int_t numed, Int_t ndvmx)
2214 // Create a new volume by dividing an existing one
2216 // Divides MOTHER into divisions called NAME along
2217 // axis IAXIS in steps of STEP. If not exactly divisible
2218 // will make as many as possible and will centre them
2219 // with respect to the mother. Divisions will have medium
2220 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2221 // NDVMX is the expected maximum number of divisions
2222 // (If 0, no protection tests are performed)
2227 Vname(mother,vmother);
2228 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2229 PASSCHARL(vname) PASSCHARL(vmother));
2232 //_____________________________________________________________________________
2233 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2234 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2237 // Create a new volume by dividing an existing one
2239 // Divides MOTHER into divisions called NAME along
2240 // axis IAXIS starting at coordinate value C0 with step
2242 // The new volume created will have medium number NUMED.
2243 // If NUMED is 0, NUMED of mother is taken.
2244 // NDVMX is the expected maximum number of divisions
2245 // (If 0, no protection tests are performed)
2250 Vname(mother,vmother);
2251 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2252 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2255 //_____________________________________________________________________________
2256 void TGeant3::Gsord(const char *name, Int_t iax)
2259 // Flags volume CHNAME whose contents will have to be ordered
2260 // along axis IAX, by setting the search flag to -IAX
2264 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2265 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2266 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2267 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2268 // IAX = 6 PHI (PHI=0 => X axis)
2269 // IAX = 7 THETA (THETA=0 => Z axis)
2273 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2276 //_____________________________________________________________________________
2277 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2278 Float_t y, Float_t z, Int_t irot, const char *konly)
2281 // Position a volume into an existing one
2284 // NUMBER Copy number of the volume
2285 // MOTHER Mother volume name
2286 // X X coord. of the volume in mother ref. sys.
2287 // Y Y coord. of the volume in mother ref. sys.
2288 // Z Z coord. of the volume in mother ref. sys.
2289 // IROT Rotation matrix number w.r.t. mother ref. sys.
2290 // ONLY ONLY/MANY flag
2292 // It positions a previously defined volume in the mother.
2297 Vname(mother,vmother);
2298 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2299 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2303 //_____________________________________________________________________________
2304 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2305 Float_t x, Float_t y, Float_t z, Int_t irot,
2306 const char *konly, Float_t *upar, Int_t np )
2309 // Place a copy of generic volume NAME with user number
2310 // NR inside MOTHER, with its parameters UPAR(1..NP)
2315 Vname(mother,vmother);
2316 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2317 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2321 //_____________________________________________________________________________
2322 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2323 Float_t phi2, Float_t theta3, Float_t phi3)
2326 // nmat Rotation matrix number
2327 // THETA1 Polar angle for axis I
2328 // PHI1 Azimuthal angle for axis I
2329 // THETA2 Polar angle for axis II
2330 // PHI2 Azimuthal angle for axis II
2331 // THETA3 Polar angle for axis III
2332 // PHI3 Azimuthal angle for axis III
2334 // It defines the rotation matrix number IROT.
2336 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2339 //_____________________________________________________________________________
2340 void TGeant3::Gprotm(Int_t nmat)
2343 // To print rotation matrices structure JROTM
2344 // nmat Rotation matrix number
2349 //_____________________________________________________________________________
2350 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2351 Float_t *upar, Int_t npar)
2355 // SHAPE Volume type
2356 // NUMED Tracking medium number
2357 // NPAR Number of shape parameters
2358 // UPAR Vector containing shape parameters
2360 // It creates a new volume in the JVOLUM data structure.
2366 Vname(shape,vshape);
2367 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2368 PASSCHARL(vname) PASSCHARL(vshape));
2372 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2374 // T H E D R A W I N G P A C K A G E
2375 // ======================================
2376 // Drawing functions. These functions allow the visualization in several ways
2377 // of the volumes defined in the geometrical data structure. It is possible
2378 // to draw the logical tree of volumes belonging to the detector (DTREE),
2379 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2380 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2381 // these commands when the hidden line removal option is activated; in
2382 // this case, the volumes can be also either translated in the space
2383 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2384 // possible to fill the surfaces of the volumes
2385 // with solid colours when the shading option (SHAD) is activated.
2386 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2387 // of the detectors or to scan physical events as well.
2388 // Finally, the command MOVE will allow the rotation, translation and zooming
2389 // on real time parts of the detectors or tracks and hits of a simulated event.
2390 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2391 // the drawing is performed by the Geant ray-tracing;
2392 // automatically, the color is assigned according to the tracking medium of each
2393 // volume and the volumes with a density lower/equal than the air are considered
2394 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2395 // the user can set color and visibility for the desired volumes via the command
2396 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2397 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2398 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2399 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2400 // first case, we assume that the first mother volume of the tree is a box with
2401 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2402 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2403 // second case, the distance between the observer and the origin of the world
2404 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2405 // or telescopic effects can be achieved changing the scale factors in the command
2406 // (DRAW). When the final picture does not occupy the full window,
2407 // mapping the space before tracing can speed up the drawing, but can also
2408 // produce less precise results; values from 1 to 4 are allowed in the command
2409 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2410 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2411 // The command (VALCUT) allows the cutting of the detector by three planes
2412 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2413 // SATT for any desired volume and can assume values from 0 to 7; it determines
2414 // the different light processing to be performed for different materials:
2415 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2416 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2417 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2418 // is 0.9) and the observer is assumed to have a light source (therefore he will
2419 // produce parallel light in the case of parallel view and point-like-source
2420 // light in the case of perspective view).
2422 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2424 //_____________________________________________________________________________
2425 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2429 // IOPT Name of the attribute to be set
2430 // IVAL Value to which the attribute is to be set
2432 // name= "*" stands for all the volumes.
2433 // iopt can be chosen among the following :
2435 // WORK 0=volume name is inactive for the tracking
2436 // 1=volume name is active for the tracking (default)
2438 // SEEN 0=volume name is invisible
2439 // 1=volume name is visible (default)
2440 // -1=volume invisible with all its descendants in the tree
2441 // -2=volume visible but not its descendants in the tree
2443 // LSTY line style 1,2,3,... (default=1)
2444 // LSTY=7 will produce a very precise approximation for
2445 // revolution bodies.
2447 // LWID line width -7,...,1,2,3,..7 (default=1)
2448 // LWID<0 will act as abs(LWID) was set for the volume
2449 // and for all the levels below it. When SHAD is 'ON', LWID
2450 // represent the linewidth of the scan lines filling the surfaces
2451 // (whereas the FILL value represent their number). Therefore
2452 // tuning this parameter will help to obtain the desired
2453 // quality/performance ratio.
2455 // COLO colour code -166,...,1,2,..166 (default=1)
2457 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2458 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2459 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2460 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2461 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2462 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2463 // colour=n*10+m, m=1,2,...9, will produce the same colour
2464 // as 'n', but with increasing luminosity according to 'm';
2465 // COLO<0 will act as if abs(COLO) was set for the volume
2466 // and for all the levels below it.
2467 // When for a volume the attribute FILL is > 1 (and the
2468 // option SHAD is on), the ABS of its colour code must be < 8
2469 // because an automatic shading of its faces will be
2472 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2473 // when option SHAD is "on" the FILL attribute of any
2474 // volume can be set different from 0 (normal drawing);
2475 // if it is set to 1, the faces of such volume will be filled
2476 // with solid colours; if ABS(FILL) is > 1, then a light
2477 // source is placed along the observer line, and the faces of
2478 // such volumes will be painted by colours whose luminosity
2479 // will depend on the amount of light reflected;
2480 // if ABS(FILL) = 1, then it is possible to use all the 166
2481 // colours of the colour table, becouse the automatic shading
2482 // is not performed;
2483 // for increasing values of FILL the drawing will be performed
2484 // with higher and higher resolution improving the quality (the
2485 // number of scan lines used to fill the faces increases with FILL);
2486 // it is possible to set different values of FILL
2487 // for different volumes, in order to optimize at the same time
2488 // the performance and the quality of the picture;
2489 // FILL<0 will act as if abs(FILL) was set for the volume
2490 // and for all the levels below it.
2491 // This kind of drawing can be saved in 'picture files'
2492 // or in view banks.
2493 // 0=drawing without fill area
2494 // 1=faces filled with solid colours and resolution = 6
2495 // 2=lowest resolution (very fast)
2496 // 3=default resolution
2497 // 4=.................
2498 // 5=.................
2499 // 6=.................
2501 // Finally, if a coloured background is desired, the FILL
2502 // attribute for the first volume of the tree must be set
2503 // equal to -abs(colo), colo being >0 and <166.
2505 // SET set number associated to volume name
2506 // DET detector number associated to volume name
2507 // DTYP detector type (1,2)
2514 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2518 //_____________________________________________________________________________
2519 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2520 Int_t& natt, Float_t* par, Float_t* att)
2523 // Find the parameters of a volume
2525 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2529 //_____________________________________________________________________________
2530 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2533 // Check the parameters of a shape
2535 gckpar(ish,npar,par);
2538 //_____________________________________________________________________________
2539 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2542 // Check the parameters of a tracking medium
2544 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2547 //_____________________________________________________________________________
2548 void TGeant3::Gdelete(Int_t iview)
2551 // IVIEW View number
2553 // It deletes a view bank from memory.
2558 //_____________________________________________________________________________
2559 void TGeant3::Gdopen(Int_t iview)
2562 // IVIEW View number
2564 // When a drawing is very complex and requires a long time to be
2565 // executed, it can be useful to store it in a view bank: after a
2566 // call to DOPEN and the execution of the drawing (nothing will
2567 // appear on the screen), and after a necessary call to DCLOSE,
2568 // the contents of the bank can be displayed in a very fast way
2569 // through a call to DSHOW; therefore, the detector can be easily
2570 // zoomed many times in different ways. Please note that the pictures
2571 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2578 //_____________________________________________________________________________
2579 void TGeant3::Gdclose()
2582 // It closes the currently open view bank; it must be called after the
2583 // end of the drawing to be stored.
2588 //_____________________________________________________________________________
2589 void TGeant3::Gdshow(Int_t iview)
2592 // IVIEW View number
2594 // It shows on the screen the contents of a view bank. It
2595 // can be called after a view bank has been closed.
2600 //_____________________________________________________________________________
2601 void TGeant3::Gdopt(const char *name,const char *value)
2605 // VALUE Option value
2607 // To set/modify the drawing options.
2610 // THRZ ON Draw tracks in R vs Z
2611 // OFF (D) Draw tracks in X,Y,Z
2614 // PROJ PARA (D) Parallel projection
2616 // TRAK LINE (D) Trajectory drawn with lines
2617 // POIN " " with markers
2618 // HIDE ON Hidden line removal using the CG package
2619 // OFF (D) No hidden line removal
2620 // SHAD ON Fill area and shading of surfaces.
2621 // OFF (D) Normal hidden line removal.
2622 // RAYT ON Ray-tracing on.
2623 // OFF (D) Ray-tracing off.
2624 // EDGE OFF Does not draw contours when shad is on.
2625 // ON (D) Normal shading.
2626 // MAPP 1,2,3,4 Mapping before ray-tracing.
2627 // 0 (D) No mapping.
2628 // USER ON User graphics options in the raytracing.
2629 // OFF (D) Automatic graphics options.
2635 Vname(value,vvalue);
2636 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2640 //_____________________________________________________________________________
2641 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2642 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2647 // THETA Viewing angle theta (for 3D projection)
2648 // PHI Viewing angle phi (for 3D projection)
2649 // PSI Viewing angle psi (for 2D rotation)
2650 // U0 U-coord. (horizontal) of volume origin
2651 // V0 V-coord. (vertical) of volume origin
2652 // SU Scale factor for U-coord.
2653 // SV Scale factor for V-coord.
2655 // This function will draw the volumes,
2656 // selected with their graphical attributes, set by the Gsatt
2657 // facility. The drawing may be performed with hidden line removal
2658 // and with shading effects according to the value of the options HIDE
2659 // and SHAD; if the option SHAD is ON, the contour's edges can be
2660 // drawn or not. If the option HIDE is ON, the detector can be
2661 // exploded (BOMB), clipped with different shapes (CVOL), and some
2662 // of its parts can be shifted from their original
2663 // position (SHIFT). When HIDE is ON, if
2664 // the drawing requires more than the available memory, the program
2665 // will evaluate and display the number of missing words
2666 // (so that the user can increase the
2667 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2668 // the program will print messages about the memory used and
2669 // statistics on the volumes' visibility.
2670 // The following commands will produce the drawing of a green
2671 // volume, specified by NAME, without using the hidden line removal
2672 // technique, using the hidden line removal technique,
2673 // with different linewidth and colour (red), with
2674 // solid colour, with shading of surfaces, and without edges.
2675 // Finally, some examples are given for the ray-tracing. (A possible
2676 // string for the NAME of the volume can be found using the command DTREE).
2682 if (fGcvdma->raytra != 1) {
2683 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2685 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2689 //_____________________________________________________________________________
2690 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2691 Float_t v0,Float_t ul,Float_t vl)
2696 // CUTVAL Cut plane distance from the origin along the axis
2698 // U0 U-coord. (horizontal) of volume origin
2699 // V0 V-coord. (vertical) of volume origin
2700 // SU Scale factor for U-coord.
2701 // SV Scale factor for V-coord.
2703 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2704 // and placed at the distance cutval from the origin.
2705 // The resulting picture is seen from the the same axis.
2706 // When HIDE Mode is ON, it is possible to get the same effect with
2707 // the CVOL/BOX function.
2713 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2716 //_____________________________________________________________________________
2717 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2718 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2719 Float_t v0,Float_t ul,Float_t vl)
2723 // CUTTHE Theta angle of the line normal to cut plane
2724 // CUTPHI Phi angle of the line normal to cut plane
2725 // CUTVAL Cut plane distance from the origin along the axis
2727 // THETA Viewing angle theta (for 3D projection)
2728 // PHI Viewing angle phi (for 3D projection)
2729 // U0 U-coord. (horizontal) of volume origin
2730 // V0 V-coord. (vertical) of volume origin
2731 // SU Scale factor for U-coord.
2732 // SV Scale factor for V-coord.
2734 // The cut plane is normal to the line given by the cut angles
2735 // cutthe and cutphi and placed at the distance cutval from the origin.
2736 // The resulting picture is seen from the viewing angles theta,phi.
2742 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2746 //_____________________________________________________________________________
2747 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2752 // ISEL Option flag D=111110
2754 // CHRSIZ Character size (cm) of title NAME D=0.6
2757 // 0 to have only the header lines
2758 // xxxxx1 to add the text name centered on top of header
2759 // xxxx1x to add global detector name (first volume) on left
2760 // xxx1xx to add date on right
2761 // xx1xxx to select thick characters for text on top of header
2762 // x1xxxx to add the text 'EVENT NR x' on top of header
2763 // 1xxxxx to add the text 'RUN NR x' on top of header
2764 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2765 // i.e. they generate overwritten text.
2767 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2770 //_____________________________________________________________________________
2771 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2774 // Draw a 2D-man at position (U0,V0)
2776 // U U-coord. (horizontal) of the centre of man' R
2777 // V V-coord. (vertical) of the centre of man' R
2778 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2780 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2781 // It superimposes the picure of a man or of a woman, chosen among
2782 // three different ones, with the same scale factors as the detector
2783 // in the current drawing.
2786 if (opt.Contains("WM1")) {
2788 } else if (opt.Contains("WM3")) {
2790 } else if (opt.Contains("WM2")) {
2797 //_____________________________________________________________________________
2798 void TGeant3::Gdspec(const char *name)
2803 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2804 // its geometrical specifications. The 3D drawing will
2805 // be performed according the current values of the options HIDE and
2806 // SHAD and according the current SetClipBox clipping parameters for that
2813 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2816 //_____________________________________________________________________________
2817 void TGeant3::DrawOneSpec(const char *name)
2820 // Function called when one double-clicks on a volume name
2821 // in a TPavelabel drawn by Gdtree.
2823 THIGZ *higzSave = higz;
2824 higzSave->SetName("higzSave");
2825 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2826 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2827 if (higzSpec) higz = higzSpec;
2828 else higzSpec = new THIGZ(defSize);
2829 higzSpec->SetName("higzSpec");
2834 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2837 higzSave->SetName("higz");
2841 //_____________________________________________________________________________
2842 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2846 // LEVMAX Depth level
2849 // This function draws the logical tree,
2850 // Each volume in the tree is represented by a TPaveTree object.
2851 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2852 // Use TPaveTree pop-up menu to select:
2855 // - drawing tree of parent
2861 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2865 //_____________________________________________________________________________
2866 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2870 // LEVMAX Depth level
2873 // This function draws the logical tree of the parent of name.
2877 // Scan list of volumes in JVOLUM
2879 Int_t gname, i, jvo, in, nin, jin, num;
2880 strncpy((char *) &gname, name, 4);
2881 for(i=1; i<=fGcnum->nvolum; i++) {
2882 jvo = fZlq[fGclink->jvolum-i];
2883 nin = Int_t(fZq[jvo+3]);
2884 if (nin == -1) nin = 1;
2885 for (in=1;in<=nin;in++) {
2887 num = Int_t(fZq[jin+2]);
2888 if(gname == fZiq[fGclink->jvolum+num]) {
2889 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2891 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2899 //_____________________________________________________________________________
2900 void TGeant3::SetABAN(Int_t par)
2903 // par = 1 particles will be stopped according to their residual
2904 // range if they are not in a sensitive material and are
2905 // far enough from the boundary
2906 // 0 particles are transported normally
2908 fGcphys->dphys1 = par;
2912 //_____________________________________________________________________________
2913 void TGeant3::SetANNI(Int_t par)
2916 // To control positron annihilation.
2917 // par =0 no annihilation
2918 // =1 annihilation. Decays processed.
2919 // =2 annihilation. No decay products stored.
2921 fGcphys->ianni = par;
2925 //_____________________________________________________________________________
2926 void TGeant3::SetAUTO(Int_t par)
2929 // To control automatic calculation of tracking medium parameters:
2930 // par =0 no automatic calculation;
2931 // =1 automati calculation.
2933 fGctrak->igauto = par;
2937 //_____________________________________________________________________________
2938 void TGeant3::SetBOMB(Float_t boom)
2941 // BOOM : Exploding factor for volumes position
2943 // To 'explode' the detector. If BOOM is positive (values smaller
2944 // than 1. are suggested, but any value is possible)
2945 // all the volumes are shifted by a distance
2946 // proportional to BOOM along the direction between their centre
2947 // and the origin of the MARS; the volumes which are symmetric
2948 // with respect to this origin are simply not shown.
2949 // BOOM equal to 0 resets the normal mode.
2950 // A negative (greater than -1.) value of
2951 // BOOM will cause an 'implosion'; for even lower values of BOOM
2952 // the volumes' positions will be reflected respect to the origin.
2953 // This command can be useful to improve the 3D effect for very
2954 // complex detectors. The following commands will make explode the
2961 //_____________________________________________________________________________
2962 void TGeant3::SetBREM(Int_t par)
2965 // To control bremstrahlung.
2966 // par =0 no bremstrahlung
2967 // =1 bremstrahlung. Photon processed.
2968 // =2 bremstrahlung. No photon stored.
2970 fGcphys->ibrem = par;
2974 //_____________________________________________________________________________
2975 void TGeant3::SetCKOV(Int_t par)
2978 // To control Cerenkov production
2979 // par =0 no Cerenkov;
2981 // =2 Cerenkov with primary stopped at each step.
2983 fGctlit->itckov = par;
2987 //_____________________________________________________________________________
2988 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
2989 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
2992 // The hidden line removal technique is necessary to visualize properly
2993 // very complex detectors. At the same time, it can be useful to visualize
2994 // the inner elements of a detector in detail. This function allows
2995 // subtractions (via boolean operation) of BOX shape from any part of
2996 // the detector, therefore showing its inner contents.
2997 // If "*" is given as the name of the
2998 // volume to be clipped, all volumes are clipped by the given box.
2999 // A volume can be clipped at most twice.
3000 // if a volume is explicitely clipped twice,
3001 // the "*" will not act on it anymore. Giving "." as the name
3002 // of the volume to be clipped will reset the clipping.
3004 // NAME Name of volume to be clipped
3006 // XMIN Lower limit of the Shape X coordinate
3007 // XMAX Upper limit of the Shape X coordinate
3008 // YMIN Lower limit of the Shape Y coordinate
3009 // YMAX Upper limit of the Shape Y coordinate
3010 // ZMIN Lower limit of the Shape Z coordinate
3011 // ZMAX Upper limit of the Shape Z coordinate
3013 // This function performs a boolean subtraction between the volume
3014 // NAME and a box placed in the MARS according the values of the given
3020 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3023 //_____________________________________________________________________________
3024 void TGeant3::SetCOMP(Int_t par)
3027 // To control Compton scattering
3028 // par =0 no Compton
3029 // =1 Compton. Electron processed.
3030 // =2 Compton. No electron stored.
3033 fGcphys->icomp = par;
3036 //_____________________________________________________________________________
3037 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3038 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3039 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3040 Float_t ppcutm, Float_t tofmax)
3043 // CUTGAM Cut for gammas D=0.001
3044 // CUTELE Cut for electrons D=0.001
3045 // CUTHAD Cut for charged hadrons D=0.01
3046 // CUTNEU Cut for neutral hadrons D=0.01
3047 // CUTMUO Cut for muons D=0.01
3048 // BCUTE Cut for electron brems. D=-1.
3049 // BCUTM Cut for muon brems. D=-1.
3050 // DCUTE Cut for electron delta-rays D=-1.
3051 // DCUTM Cut for muon delta-rays D=-1.
3052 // PPCUTM Cut for e+e- pairs by muons D=0.01
3053 // TOFMAX Time of flight cut D=1.E+10
3055 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3056 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3058 // If one of the parameters from CUTGAM to PPCUTM included
3059 // is modified, cross-sections and energy loss tables must be
3060 // recomputed via the function Gphysi.
3062 fGccuts->cutgam = cutgam;
3063 fGccuts->cutele = cutele;
3064 fGccuts->cutneu = cutneu;
3065 fGccuts->cuthad = cuthad;
3066 fGccuts->cutmuo = cutmuo;
3067 fGccuts->bcute = bcute;
3068 fGccuts->bcutm = bcutm;
3069 fGccuts->dcute = dcute;
3070 fGccuts->dcutm = dcutm;
3071 fGccuts->ppcutm = ppcutm;
3072 fGccuts->tofmax = tofmax;
3075 //_____________________________________________________________________________
3076 void TGeant3::SetDCAY(Int_t par)
3079 // To control Decay mechanism.
3080 // par =0 no decays.
3081 // =1 Decays. secondaries processed.
3082 // =2 Decays. No secondaries stored.
3084 fGcphys->idcay = par;
3088 //_____________________________________________________________________________
3089 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3092 // Set the debug flag and frequency
3093 // Selected debug output will be printed from
3094 // event emin to even emax each emod event
3096 fGcflag->idemin = emin;
3097 fGcflag->idemax = emax;
3098 fGcflag->itest = emod;
3102 //_____________________________________________________________________________
3103 void TGeant3::SetDRAY(Int_t par)
3106 // To control delta rays mechanism.
3107 // par =0 no delta rays.
3108 // =1 Delta rays. secondaries processed.
3109 // =2 Delta rays. No secondaries stored.
3111 fGcphys->idray = par;
3114 //_____________________________________________________________________________
3115 void TGeant3::SetHADR(Int_t par)
3118 // To control hadronic interactions.
3119 // par =0 no hadronic interactions.
3120 // =1 Hadronic interactions. secondaries processed.
3121 // =2 Hadronic interactions. No secondaries stored.
3123 fGcphys->ihadr = par;
3126 //_____________________________________________________________________________
3127 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3128 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3129 Float_t xk8, Float_t xk9, Float_t xk10)
3132 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3133 // Their meaning is user defined
3135 fGckine->ikine = kine;
3136 fGckine->pkine[0] = xk1;
3137 fGckine->pkine[1] = xk2;
3138 fGckine->pkine[2] = xk3;
3139 fGckine->pkine[3] = xk4;
3140 fGckine->pkine[4] = xk5;
3141 fGckine->pkine[5] = xk6;
3142 fGckine->pkine[6] = xk7;
3143 fGckine->pkine[7] = xk8;
3144 fGckine->pkine[8] = xk9;
3145 fGckine->pkine[9] = xk10;
3148 //_____________________________________________________________________________
3149 void TGeant3::SetLOSS(Int_t par)
3152 // To control energy loss.
3153 // par =0 no energy loss;
3154 // =1 restricted energy loss fluctuations;
3155 // =2 complete energy loss fluctuations;
3157 // =4 no energy loss fluctuations.
3158 // If the value ILOSS is changed, then cross-sections and energy loss
3159 // tables must be recomputed via the command 'PHYSI'.
3161 fGcphys->iloss = par;
3165 //_____________________________________________________________________________
3166 void TGeant3::SetMULS(Int_t par)
3169 // To control multiple scattering.
3170 // par =0 no multiple scattering.
3171 // =1 Moliere or Coulomb scattering.
3172 // =2 Moliere or Coulomb scattering.
3173 // =3 Gaussian scattering.
3175 fGcphys->imuls = par;
3179 //_____________________________________________________________________________
3180 void TGeant3::SetMUNU(Int_t par)
3183 // To control muon nuclear interactions.
3184 // par =0 no muon-nuclear interactions.
3185 // =1 Nuclear interactions. Secondaries processed.
3186 // =2 Nuclear interactions. Secondaries not processed.
3188 fGcphys->imunu = par;
3191 //_____________________________________________________________________________
3192 void TGeant3::SetOPTI(Int_t par)
3195 // This flag controls the tracking optimisation performed via the
3197 // 1 no optimisation at all; GSORD calls disabled;
3198 // 0 no optimisation; only user calls to GSORD kept;
3199 // 1 all non-GSORDered volumes are ordered along the best axis;
3200 // 2 all volumes are ordered along the best axis.
3202 fGcopti->ioptim = par;
3205 //_____________________________________________________________________________
3206 void TGeant3::SetPAIR(Int_t par)
3209 // To control pair production mechanism.
3210 // par =0 no pair production.
3211 // =1 Pair production. secondaries processed.
3212 // =2 Pair production. No secondaries stored.
3214 fGcphys->ipair = par;
3218 //_____________________________________________________________________________
3219 void TGeant3::SetPFIS(Int_t par)
3222 // To control photo fission mechanism.
3223 // par =0 no photo fission.
3224 // =1 Photo fission. secondaries processed.
3225 // =2 Photo fission. No secondaries stored.
3227 fGcphys->ipfis = par;
3230 //_____________________________________________________________________________
3231 void TGeant3::SetPHOT(Int_t par)
3234 // To control Photo effect.
3235 // par =0 no photo electric effect.
3236 // =1 Photo effect. Electron processed.
3237 // =2 Photo effect. No electron stored.
3239 fGcphys->iphot = par;
3242 //_____________________________________________________________________________
3243 void TGeant3::SetRAYL(Int_t par)
3246 // To control Rayleigh scattering.
3247 // par =0 no Rayleigh scattering.
3250 fGcphys->irayl = par;
3253 //_____________________________________________________________________________
3254 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3258 // val New switch value
3260 // Change one element of array ISWIT(10) in /GCFLAG/
3262 if (sw <= 0 || sw > 10) return;
3263 fGcflag->iswit[sw-1] = val;
3267 //_____________________________________________________________________________
3268 void TGeant3::SetTRIG(Int_t nevents)
3271 // Set number of events to be run
3273 fGcflag->nevent = nevents;
3276 //_____________________________________________________________________________
3277 void TGeant3::SetUserDecay(Int_t pdg)
3280 // Force the decays of particles to be done with Pythia
3281 // and not with the Geant routines.
3282 // just kill pointers doing mzdrop
3284 Int_t ipart = IdFromPDG(pdg);
3286 printf("Particle %d not in geant\n",pdg);
3289 Int_t jpart=fGclink->jpart;
3290 Int_t jpa=fZlq[jpart-ipart];
3293 Int_t jpa1=fZlq[jpa-1];
3295 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3296 Int_t jpa2=fZlq[jpa-2];
3298 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3302 //______________________________________________________________________________
3303 void TGeant3::Vname(const char *name, char *vname)
3306 // convert name to upper case. Make vname at least 4 chars
3308 Int_t l = strlen(name);
3311 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3312 for (i=l;i<4;i++) vname[i] = ' ';
3316 //_____________________________________________________________________________
3317 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3318 Int_t number, Int_t nlevel)
3322 // ******************************************************************
3324 // * Write out the geometry of the detector in EUCLID file format *
3326 // * filnam : will be with the extension .euc *
3327 // * topvol : volume name of the starting node *
3328 // * number : copy number of topvol (relevant for gsposp) *
3329 // * nlevel : number of levels in the tree structure *
3330 // * to be written out, starting from topvol *
3332 // * Author : M. Maire *
3334 // ******************************************************************
3336 // File filnam.tme is written out with the definitions of tracking
3337 // medias and materials.
3338 // As to restore original numbers for materials and medias, program
3339 // searches in the file euc_medi.dat and comparing main parameters of
3340 // the mat. defined inside geant and the one in file recognizes them
3341 // and is able to take number from file. If for any material or medium,
3342 // this procedure fails, ordering starts from 1.
3343 // Arrays IOTMED and IOMATE are used for this procedure
3345 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3346 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3348 Int_t i, end, itm, irm, jrm, k, nmed;
3352 char *filext, *filetme;
3353 char natmed[21], namate[21];
3354 char natmedc[21], namatec[21];
3355 char key[5], name[5], mother[5], konly[5];
3357 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3358 Int_t mlevel, numbr, natt, numed, nin, ndata;
3359 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3360 Int_t jdiv, ivin, in, jin, jvin, irot;
3361 Int_t jtm, imat, jma, flag=0, imatc;
3362 Float_t az, dens, radl, absl, a, step, x, y, z;
3363 Int_t npar, ndvmx, left;
3364 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3366 Int_t iomate[100], iotmed[100];
3367 Float_t par[50], att[20], ubuf[50];
3370 Int_t level, ndiv, iaxe;
3371 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3372 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3373 Float_t tmaxf, stemax, deemax, epsil, stmin;
3374 const char *f10000="!\n%s\n!\n";
3375 //Open the input file
3377 for(i=0;i<end;i++) if(filnam[i]=='.') {
3381 filext=new char[end+4];
3382 filetme=new char[end+4];
3383 strncpy(filext,filnam,end);
3384 strncpy(filetme,filnam,end);
3386 // *** The output filnam name will be with extension '.euc'
3387 strcpy(&filext[end],".euc");
3388 strcpy(&filetme[end],".tme");
3389 lun=fopen(filext,"w");
3391 // *** Initialisation of the working space
3392 iadvol=fGcnum->nvolum;
3393 iadtmd=iadvol+fGcnum->nvolum;
3394 iadrot=iadtmd+fGcnum->ntmed;
3395 if(fGclink->jrotm) {
3396 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3400 nwtot=iadrot+fGcnum->nrotm;
3401 qws = new float[nwtot+1];
3402 for (i=0;i<nwtot+1;i++) qws[i]=0;
3405 if(nlevel==0) mlevel=20;
3407 // *** find the top volume and put it in the stak
3408 numbr = number>0 ? number : 1;
3409 Gfpara(topvol,numbr,1,npar,natt,par,att);
3411 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3416 // *** authorized shape ?
3417 strncpy((char *)&iname, topvol, 4);
3419 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3423 jvo = fZlq[fGclink->jvolum-ivo];
3424 ish = Int_t (fZq[jvo+2]);
3426 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3433 iws[iadvol+ivo] = level;
3436 //*** flag all volumes and fill the stak
3440 // pick the next volume in stak
3442 ivo = TMath::Abs(iws[ivstak]);
3443 jvo = fZlq[fGclink->jvolum - ivo];
3445 // flag the tracking medium
3446 numed = Int_t (fZq[jvo + 4]);
3447 iws[iadtmd + numed] = 1;
3449 // get the daughters ...
3450 level = iws[iadvol+ivo];
3451 if (level < mlevel) {
3453 nin = Int_t (fZq[jvo + 3]);
3455 // from division ...
3457 jdiv = fZlq[jvo - 1];
3458 ivin = Int_t (fZq[jdiv + 2]);
3460 iws[nvstak] = -ivin;
3461 iws[iadvol+ivin] = level;
3463 // from position ...
3464 } else if (nin > 0) {
3465 for(in=1; in<=nin; in++) {
3466 jin = fZlq[jvo - in];
3467 ivin = Int_t (fZq[jin + 2 ]);
3468 jvin = fZlq[fGclink->jvolum - ivin];
3469 ish = Int_t (fZq[jvin + 2]);
3470 // authorized shape ?
3472 // not yet flagged ?
3473 if (iws[iadvol+ivin]==0) {
3476 iws[iadvol+ivin] = level;
3478 // flag the rotation matrix
3479 irot = Int_t ( fZq[jin + 4 ]);
3480 if (irot > 0) iws[iadrot+irot] = 1;
3486 // next volume in stak ?
3487 if (ivstak < nvstak) goto L10;
3489 // *** restore original material and media numbers
3490 // file euc_medi.dat is needed to compare materials and medias
3492 FILE* luncor=fopen("euc_medi.dat","r");
3495 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3496 if (iws[iadtmd+itm] > 0) {
3497 jtm = fZlq[fGclink->jtmed-itm];
3498 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3499 imat = Int_t (fZq[jtm+6]);
3500 jma = fZlq[fGclink->jmate-imat];
3502 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3505 strncpy(namate,(char *)&fZiq[jma+1],20);
3508 //** find the material original number
3511 iret=fscanf(luncor,"%4s,%130s",key,card);
3512 if(iret<=0) goto L26;
3514 if(!strcmp(key,"MATE")) {
3515 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3516 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3517 if(!strcmp(namatec,namate)) {
3518 if(az==a && zc==z && densc==dens && radlc==radl
3519 && abslc==absl && nparc==nparc) {
3522 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3524 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3528 if(strcmp(key,"END") && !flag) goto L23;
3530 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3534 //*** restore original tracking medium number
3537 iret=fscanf(luncor,"%4s,%130s",key,card);
3538 if(iret<=0) goto L26;
3540 if (!strcmp(key,"TMED")) {
3541 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3542 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3543 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3544 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3545 epsil,stmin,ubuf,&nwbuf);
3546 if(!strcmp(natmedc,natmed)) {
3547 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3550 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3553 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3557 if(strcmp(key,"END") && !flag) goto L24;
3559 printf("cannot restore original number for medium : %s\n",natmed);
3567 L26: printf("*** GWEUCL *** cannot read the data file\n");
3569 L29: if(luncor) fclose (luncor);
3572 // *** write down the tracking medium definition
3574 strcpy(card,"! Tracking medium");
3575 fprintf(lun,f10000,card);
3577 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3578 if (iws[iadtmd+itm]>0) {
3579 jtm = fZlq[fGclink->jtmed-itm];
3580 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3582 imat = Int_t (fZq[jtm+6]);
3583 jma = fZlq[fGclink->jmate-imat];
3584 //* order media from one, if comparing with database failed
3586 iotmed[itm]=++imxtmed;
3587 iomate[imat]=++imxmate;
3592 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3595 strncpy(namate,(char *)&fZiq[jma+1],20);
3598 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3602 //* *** write down the rotation matrix
3604 strcpy(card,"! Reperes");
3605 fprintf(lun,f10000,card);
3607 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3608 if (iws[iadrot+irm]>0) {
3609 jrm = fZlq[fGclink->jrotm-irm];
3610 fprintf(lun,"ROTM %3d",irm);
3611 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3616 //* *** write down the volume definition
3618 strcpy(card,"! Volumes");
3619 fprintf(lun,f10000,card);
3621 for(ivstak=1;ivstak<=nvstak;ivstak++) {