1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.19 1999/12/17 09:03:12 fca
19 Introduce a names array
21 Revision 1.18 1999/11/26 16:55:39 fca
22 Reimplement CurrentVolName() to avoid memory leaks
24 Revision 1.17 1999/11/03 16:58:28 fca
25 Correct source of address violation in creating character string
27 Revision 1.16 1999/11/03 13:17:08 fca
28 Have ProdProcess return const char*
30 Revision 1.15 1999/10/26 06:04:50 fca
31 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
33 Revision 1.14 1999/09/29 09:24:30 fca
34 Introduction of the Copyright and cvs Log
38 ///////////////////////////////////////////////////////////////////////////////
40 // Interface Class to the Geant3.21 MonteCarlo //
44 <img src="picts/TGeant3Class.gif">
49 ///////////////////////////////////////////////////////////////////////////////
55 #include <TDatabasePDG.h>
56 #include "AliCallf77.h"
59 # define gzebra gzebra_
60 # define grfile grfile_
61 # define gpcxyz gpcxyz_
62 # define ggclos ggclos_
65 # define gcinit gcinit_
68 # define gtrigc gtrigc_
69 # define gtrigi gtrigi_
71 # define gzinit gzinit_
72 # define gfmate gfmate_
73 # define gfpart gfpart_
74 # define gftmed gftmed_
78 # define gsmate gsmate_
79 # define gsmixt gsmixt_
80 # define gspart gspart_
81 # define gstmed gstmed_
82 # define gsckov gsckov_
83 # define gstpar gstpar_
84 # define gfkine gfkine_
85 # define gfvert gfvert_
86 # define gskine gskine_
87 # define gsvert gsvert_
88 # define gphysi gphysi_
89 # define gdebug gdebug_
90 # define gekbin gekbin_
91 # define gfinds gfinds_
92 # define gsking gsking_
93 # define gskpho gskpho_
94 # define gsstak gsstak_
96 # define gtrack gtrack_
97 # define gtreve gtreve_
98 # define gtreve_root gtreve_root_
100 # define grndmq grndmq_
101 # define gdtom gdtom_
102 # define glmoth glmoth_
103 # define gmedia gmedia_
104 # define gmtod gmtod_
105 # define gsdvn gsdvn_
106 # define gsdvn2 gsdvn2_
107 # define gsdvs gsdvs_
108 # define gsdvs2 gsdvs2_
109 # define gsdvt gsdvt_
110 # define gsdvt2 gsdvt2_
111 # define gsord gsord_
112 # define gspos gspos_
113 # define gsposp gsposp_
114 # define gsrotm gsrotm_
115 # define gprotm gprotm_
116 # define gsvolu gsvolu_
117 # define gprint gprint_
118 # define gdinit gdinit_
119 # define gdopt gdopt_
120 # define gdraw gdraw_
121 # define gdrayt gdrayt_
122 # define gdrawc gdrawc_
123 # define gdrawx gdrawx_
124 # define gdhead gdhead_
125 # define gdwmn1 gdwmn1_
126 # define gdwmn2 gdwmn2_
127 # define gdwmn3 gdwmn3_
128 # define gdxyz gdxyz_
129 # define gdcxyz gdcxyz_
130 # define gdman gdman_
131 # define gdspec gdspec_
132 # define gdtree gdtree_
133 # define gdelet gdelet_
134 # define gdclos gdclos_
135 # define gdshow gdshow_
136 # define gdopen gdopen_
137 # define dzshow dzshow_
138 # define gsatt gsatt_
139 # define gfpara gfpara_
140 # define gckpar gckpar_
141 # define gckmat gckmat_
142 # define geditv geditv_
143 # define mzdrop mzdrop_
145 # define ertrak ertrak_
146 # define ertrgo ertrgo_
148 # define setbomb setbomb_
149 # define setclip setclip_
150 # define gcomad gcomad_
153 # define gzebra GZEBRA
154 # define grfile GRFILE
155 # define gpcxyz GPCXYZ
156 # define ggclos GGCLOS
159 # define gcinit GCINIT
162 # define gtrigc GTRIGC
163 # define gtrigi GTRIGI
165 # define gzinit GZINIT
166 # define gfmate GFMATE
167 # define gfpart GFPART
168 # define gftmed GFTMED
172 # define gsmate GSMATE
173 # define gsmixt GSMIXT
174 # define gspart GSPART
175 # define gstmed GSTMED
176 # define gsckov GSCKOV
177 # define gstpar GSTPAR
178 # define gfkine GFKINE
179 # define gfvert GFVERT
180 # define gskine GSKINE
181 # define gsvert GSVERT
182 # define gphysi GPHYSI
183 # define gdebug GDEBUG
184 # define gekbin GEKBIN
185 # define gfinds GFINDS
186 # define gsking GSKING
187 # define gskpho GSKPHO
188 # define gsstak GSSTAK
190 # define gtrack GTRACK
191 # define gtreve GTREVE
192 # define gtreve_root GTREVE_ROOT
194 # define grndmq GRNDMQ
196 # define glmoth GLMOTH
197 # define gmedia GMEDIA
200 # define gsdvn2 GSDVN2
202 # define gsdvs2 GSDVS2
204 # define gsdvt2 GSDVT2
207 # define gsposp GSPOSP
208 # define gsrotm GSROTM
209 # define gprotm GPROTM
210 # define gsvolu GSVOLU
211 # define gprint GPRINT
212 # define gdinit GDINIT
215 # define gdrayt GDRAYT
216 # define gdrawc GDRAWC
217 # define gdrawx GDRAWX
218 # define gdhead GDHEAD
219 # define gdwmn1 GDWMN1
220 # define gdwmn2 GDWMN2
221 # define gdwmn3 GDWMN3
223 # define gdcxyz GDCXYZ
225 # define gdfspc GDFSPC
226 # define gdspec GDSPEC
227 # define gdtree GDTREE
228 # define gdelet GDELET
229 # define gdclos GDCLOS
230 # define gdshow GDSHOW
231 # define gdopen GDOPEN
232 # define dzshow DZSHOW
234 # define gfpara GFPARA
235 # define gckpar GCKPAR
236 # define gckmat GCKMAT
237 # define geditv GEDITV
238 # define mzdrop MZDROP
240 # define ertrak ERTRAK
241 # define ertrgo ERTRGO
243 # define setbomb SETBOMB
244 # define setclip SETCLIP
245 # define gcomad GCOMAD
249 //____________________________________________________________________________
253 // Prototypes for GEANT functions
255 void type_of_call gzebra(const int&);
257 void type_of_call gpcxyz();
259 void type_of_call ggclos();
261 void type_of_call glast();
263 void type_of_call ginit();
265 void type_of_call gcinit();
267 void type_of_call grun();
269 void type_of_call gtrig();
271 void type_of_call gtrigc();
273 void type_of_call gtrigi();
275 void type_of_call gwork(const int&);
277 void type_of_call gzinit();
279 void type_of_call gmate();
281 void type_of_call gpart();
283 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
285 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
286 Int_t &, Float_t *, Int_t &);
288 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
289 Float_t &, Float_t *, Int_t &);
291 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
294 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
297 void type_of_call gphysi();
299 void type_of_call gdebug();
301 void type_of_call gekbin();
303 void type_of_call gfinds();
305 void type_of_call gsking(Int_t &);
307 void type_of_call gskpho(Int_t &);
309 void type_of_call gsstak(Int_t &);
311 void type_of_call gsxyz();
313 void type_of_call gtrack();
315 void type_of_call gtreve();
317 void type_of_call gtreve_root();
319 void type_of_call grndm(Float_t *, const Int_t &);
321 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
324 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
326 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
327 Int_t *, Int_t * DEFCHARL);
329 void type_of_call gmedia(Float_t *, Int_t &);
331 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
333 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
334 const Float_t &, const Float_t &, const Float_t &,
337 void type_of_call gprotm(const Int_t &);
339 void type_of_call grfile(const Int_t&, DEFCHARD,
340 DEFCHARD DEFCHARL DEFCHARL);
342 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
343 Float_t &, Float_t &, Float_t &, Float_t *,
346 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
347 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
349 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
350 Float_t &, Float_t &, Float_t &, Float_t &,
351 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
353 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
354 Float_t &, Float_t &, Float_t &, Float_t *,
357 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
358 Float_t &, Int_t &, Float_t * DEFCHARL);
360 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
361 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
364 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
365 Float_t &, Float_t &, Float_t &, Float_t &,
366 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
368 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
369 Float_t *absco, Float_t *effic, Float_t *rindex);
370 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
372 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
375 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
376 Int_t & DEFCHARL DEFCHARL);
378 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
381 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
382 Int_t & DEFCHARL DEFCHARL);
384 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
385 Int_t & DEFCHARL DEFCHARL);
387 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
388 Int_t &, Int_t & DEFCHARL DEFCHARL);
390 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
392 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
393 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
396 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
397 Float_t &, Int_t &, DEFCHARD,
398 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
400 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
401 Int_t & DEFCHARL DEFCHARL);
403 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
405 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
408 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
410 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
412 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
414 void type_of_call gdinit();
416 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
418 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
419 Float_t &, Float_t &, Float_t & DEFCHARL);
420 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
421 Float_t &, Float_t &, Float_t & DEFCHARL);
422 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
423 Float_t &, Float_t & DEFCHARL);
424 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
425 Float_t &, Float_t &, Float_t &, Float_t &,
427 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
428 void type_of_call gdxyz(Int_t &);
429 void type_of_call gdcxyz();
430 void type_of_call gdman(Float_t &, Float_t &);
431 void type_of_call gdwmn1(Float_t &, Float_t &);
432 void type_of_call gdwmn2(Float_t &, Float_t &);
433 void type_of_call gdwmn3(Float_t &, Float_t &);
434 void type_of_call gdspec(DEFCHARD DEFCHARL);
435 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
436 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
438 void type_of_call gdopen(Int_t &);
439 void type_of_call gdclos();
440 void type_of_call gdelet(Int_t &);
441 void type_of_call gdshow(Int_t &);
442 void type_of_call geditv(Int_t &) {;}
445 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
446 const int&, const int&, const int& DEFCHARL
449 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
451 void type_of_call setbomb(Float_t &);
452 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
453 Float_t &, Float_t & DEFCHARL);
454 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
456 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
457 const Float_t *x2, const Float_t *p2,
458 const Int_t &ipa, DEFCHARD DEFCHARL);
460 void type_of_call ertrgo();
464 // Geant3 global pointer
466 static Int_t defSize = 600;
470 //____________________________________________________________________________
474 // Default constructor
478 //____________________________________________________________________________
479 TGeant3::TGeant3(const char *title, Int_t nwgeant)
480 :AliMC("TGeant3",title)
483 // Standard constructor for TGeant3 with ZEBRA initialisation
494 // Load Address of Geant3 commons
497 // Zero number of particles
501 //____________________________________________________________________________
502 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
503 Float_t &radl, Float_t &absl) const
506 // Return the parameters of the current material during transport
510 dens = fGcmate->dens;
511 radl = fGcmate->radl;
512 absl = fGcmate->absl;
513 return 1; //this could be the number of elements in mixture
516 //____________________________________________________________________________
517 void TGeant3::DefaultRange()
520 // Set range of current drawing pad to 20x20 cm
526 higz->Range(0,0,20,20);
529 //____________________________________________________________________________
530 void TGeant3::InitHIGZ()
541 //____________________________________________________________________________
542 void TGeant3::LoadAddress()
545 // Assigns the address of the GEANT common blocks to the structures
546 // that allow their access from C++
549 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
550 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
551 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
552 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
553 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
554 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
555 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
556 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
557 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
558 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
559 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
560 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
561 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
562 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
563 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
564 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
565 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
566 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
567 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
568 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
571 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
572 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
573 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
574 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
576 // Variables for ZEBRA store
577 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
579 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
584 //_____________________________________________________________________________
585 void TGeant3::GeomIter()
588 // Geometry iterator for moving upward in the geometry tree
589 // Initialise the iterator
591 fNextVol=fGcvolu->nlevel;
594 //____________________________________________________________________________
595 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
598 // Geometry iterator for moving upward in the geometry tree
599 // Return next volume up
604 gname=fGcvolu->names[fNextVol];
605 copy=fGcvolu->number[fNextVol];
606 i=fGcvolu->lvolum[fNextVol];
607 name = fVolNames[i-1];
608 if(gname == fZiq[fGclink->jvolum+i]) return i;
609 else printf("GeomTree: Volume %s not found in bank\n",name);
614 //_____________________________________________________________________________
615 Int_t TGeant3::CurrentVolID(Int_t ©) const
618 // Returns the current volume ID and copy number
621 if( (i=fGcvolu->nlevel-1) < 0 ) {
622 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
624 gname=fGcvolu->names[i];
625 copy=fGcvolu->number[i];
626 i=fGcvolu->lvolum[i];
627 if(gname == fZiq[fGclink->jvolum+i]) return i;
628 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
633 //_____________________________________________________________________________
634 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
637 // Return the current volume "off" upward in the geometrical tree
638 // ID and copy number
641 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
642 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
643 off,fGcvolu->nlevel);
645 gname=fGcvolu->names[i];
646 copy=fGcvolu->number[i];
647 i=fGcvolu->lvolum[i];
648 if(gname == fZiq[fGclink->jvolum+i]) return i;
649 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
654 //_____________________________________________________________________________
655 const char* TGeant3::CurrentVolName() const
658 // Returns the current volume name
661 if( (i=fGcvolu->nlevel-1) < 0 ) {
662 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
664 gname=fGcvolu->names[i];
665 i=fGcvolu->lvolum[i];
666 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
667 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
672 //_____________________________________________________________________________
673 const char* TGeant3::CurrentVolOffName(Int_t off) const
676 // Return the current volume "off" upward in the geometrical tree
677 // ID, name and copy number
678 // if name=0 no name is returned
681 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
682 Warning("CurrentVolOffName",
683 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
685 gname=fGcvolu->names[i];
686 i=fGcvolu->lvolum[i];
687 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
688 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
693 //_____________________________________________________________________________
694 Int_t TGeant3::IdFromPDG(Int_t pdg) const
697 // Return Geant3 code from PDG and pseudo ENDF code
699 for(Int_t i=0;i<fNPDGCodes;++i)
700 if(pdg==fPDGCode[i]) return i;
704 //_____________________________________________________________________________
705 Int_t TGeant3::PDGFromId(Int_t id) const
707 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
711 //_____________________________________________________________________________
712 void TGeant3::DefineParticles()
715 // Define standard Geant 3 particles
718 // Load standard numbers for GEANT particles and PDG conversion
719 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
720 fPDGCode[fNPDGCodes++]=22; // 1 = photon
721 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
722 fPDGCode[fNPDGCodes++]=11; // 3 = electron
723 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
724 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
725 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
726 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
727 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
728 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
729 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
730 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
731 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
732 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
733 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
734 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
735 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
736 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
737 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
738 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
739 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
740 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
741 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
742 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
743 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
744 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
745 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
746 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
747 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
748 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
749 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
750 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
751 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
758 /* --- Define additional particles */
759 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
760 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
762 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
763 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
765 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
766 fPDGCode[fNPDGCodes++]=411; // 35 = D+
768 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
769 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
771 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
772 fPDGCode[fNPDGCodes++]=421; // 37 = D0
774 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
775 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
777 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
779 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
781 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
783 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
784 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
786 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
787 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
789 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
790 fPDGCode[fNPDGCodes++]=113; // 37 = D0
793 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
795 // and numbers above 5 000 000 for special applications
798 const Int_t kion=10000000;
800 const Int_t kspe=50000000;
802 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
804 const Double_t autogev=0.9314943228;
805 const Double_t hslash = 1.0545726663e-27;
806 const Double_t erggev = 1/1.6021773349e-3;
807 const Double_t hshgev = hslash*erggev;
808 const Double_t yearstosec = 3600*24*365.25;
811 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
812 0,1,"Ion",kion+10020);
813 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
815 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
816 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
817 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
819 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
820 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
821 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
823 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
825 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
826 0,2,"Ion",kion+20030);
827 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
829 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
830 0,0,"Special",kspe+50);
831 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
833 /* --- Define additional decay modes --- */
834 /* --- omega(783) --- */
835 for (kz = 0; kz < 6; ++kz) {
846 Gsdk(ipa, bratio, mode);
847 /* --- phi(1020) --- */
848 for (kz = 0; kz < 6; ++kz) {
863 Gsdk(ipa, bratio, mode);
865 for (kz = 0; kz < 6; ++kz) {
878 Gsdk(ipa, bratio, mode);
880 for (kz = 0; kz < 6; ++kz) {
893 Gsdk(ipa, bratio, mode);
895 for (kz = 0; kz < 6; ++kz) {
906 Gsdk(ipa, bratio, mode);
907 /* --- Anti D0 --- */
908 for (kz = 0; kz < 6; ++kz) {
919 Gsdk(ipa, bratio, mode);
921 for (kz = 0; kz < 6; ++kz) {
928 Gsdk(ipa, bratio, mode);
930 for (kz = 0; kz < 6; ++kz) {
937 Gsdk(ipa, bratio, mode);
939 for (kz = 0; kz < 6; ++kz) {
946 Gsdk(ipa, bratio, mode);
949 for (kz = 0; kz < 6; ++kz) {
958 Gsdk(ipa, bratio, mode);
961 Gsdk(ipa, bratio, mode);
964 Gsdk(ipa, bratio, mode);
969 //_____________________________________________________________________________
970 Int_t TGeant3::VolId(Text_t *name) const
973 // Return the unique numeric identifier for volume name
976 strncpy((char *) &gname, name, 4);
977 for(i=1; i<=fGcnum->nvolum; i++)
978 if(gname == fZiq[fGclink->jvolum+i]) return i;
979 printf("VolId: Volume %s not found\n",name);
983 //_____________________________________________________________________________
984 Int_t TGeant3::NofVolumes() const
987 // Return total number of volumes in the geometry
989 return fGcnum->nvolum;
992 //_____________________________________________________________________________
993 const char* TGeant3::VolName(Int_t id) const
996 // Return the volume name given the volume identifier
998 const char name[5]="NULL";
999 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1002 return fVolNames[id-1];
1005 //_____________________________________________________________________________
1006 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
1008 Int_t gpart = IdFromPDG(part);
1009 if(!strcmp(reac,"PHOT"))
1012 Error("Xsec","Can calculate photoelectric only for photons\n");
1018 //_____________________________________________________________________________
1019 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1022 // Return the current position in the master reference frame of the
1023 // track being transported
1025 xyz[0]=fGctrak->vect[0];
1026 xyz[1]=fGctrak->vect[1];
1027 xyz[2]=fGctrak->vect[2];
1028 xyz[3]=fGctrak->tofg;
1031 //_____________________________________________________________________________
1032 Float_t TGeant3::TrackTime() const
1035 // Return the current time of flight of the track being transported
1037 return fGctrak->tofg;
1040 //_____________________________________________________________________________
1041 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1044 // Return the direction and the momentum (GeV/c) of the track
1045 // currently being transported
1047 Double_t ptot=fGctrak->vect[6];
1048 xyz[0]=fGctrak->vect[3]*ptot;
1049 xyz[1]=fGctrak->vect[4]*ptot;
1050 xyz[2]=fGctrak->vect[5]*ptot;
1051 xyz[3]=fGctrak->getot;
1054 //_____________________________________________________________________________
1055 Float_t TGeant3::TrackCharge() const
1058 // Return charge of the track currently transported
1060 return fGckine->charge;
1063 //_____________________________________________________________________________
1064 Float_t TGeant3::TrackMass() const
1067 // Return the mass of the track currently transported
1069 return fGckine->amass;
1072 //_____________________________________________________________________________
1073 Int_t TGeant3::TrackPid() const
1076 // Return the id of the particle transported
1078 return PDGFromId(fGckine->ipart);
1081 //_____________________________________________________________________________
1082 Float_t TGeant3::TrackStep() const
1085 // Return the length in centimeters of the current step
1087 return fGctrak->step;
1090 //_____________________________________________________________________________
1091 Float_t TGeant3::TrackLength() const
1094 // Return the length of the current track from its origin
1096 return fGctrak->sleng;
1099 //_____________________________________________________________________________
1100 Bool_t TGeant3::IsTrackInside() const
1103 // True if the track is not at the boundary of the current volume
1105 return (fGctrak->inwvol==0);
1108 //_____________________________________________________________________________
1109 Bool_t TGeant3::IsTrackEntering() const
1112 // True if this is the first step of the track in the current volume
1114 return (fGctrak->inwvol==1);
1117 //_____________________________________________________________________________
1118 Bool_t TGeant3::IsTrackExiting() const
1121 // True if this is the last step of the track in the current volume
1123 return (fGctrak->inwvol==2);
1126 //_____________________________________________________________________________
1127 Bool_t TGeant3::IsTrackOut() const
1130 // True if the track is out of the setup
1132 return (fGctrak->inwvol==3);
1135 //_____________________________________________________________________________
1136 Bool_t TGeant3::IsTrackStop() const
1139 // True if the track energy has fallen below the threshold
1141 return (fGctrak->istop==2);
1144 //_____________________________________________________________________________
1145 Int_t TGeant3::NSecondaries() const
1148 // Number of secondary particles generated in the current step
1150 return fGcking->ngkine;
1153 //_____________________________________________________________________________
1154 Int_t TGeant3::CurrentEvent() const
1157 // Number of the current event
1159 return fGcflag->idevt;
1162 //_____________________________________________________________________________
1163 const char* TGeant3::ProdProcess() const
1166 // Name of the process that has produced the secondary particles
1167 // in the current step
1169 static char proc[5];
1170 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1173 if(fGcking->ngkine>0) {
1174 for (km = 0; km < fGctrak->nmec; ++km) {
1175 for (im = 0; im < 13; ++im) {
1176 if (fGctrak->lmec[km] == ipmec[im]) {
1177 mec = fGctrak->lmec[km];
1178 if (0 < mec && mec < 31) {
1179 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1180 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1181 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1188 strcpy(proc,"UNKN");
1189 } else strcpy(proc,"NONE");
1193 //_____________________________________________________________________________
1194 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1195 TLorentzVector &x, TLorentzVector &p)
1198 // Get the parameters of the secondary track number isec produced
1199 // in the current step
1202 if(-1<isec && isec<fGcking->ngkine) {
1203 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1205 x[i]=fGckin3->gpos[isec][i];
1206 p[i]=fGcking->gkin[isec][i];
1208 x[3]=fGcking->tofd[isec];
1209 p[3]=fGcking->gkin[isec][3];
1211 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1212 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1217 //_____________________________________________________________________________
1218 void TGeant3::InitLego()
1221 SetDEBU(0,0,0); //do not print a message
1224 //_____________________________________________________________________________
1225 Bool_t TGeant3::IsTrackDisappeared() const
1228 // True if the current particle has disappered
1229 // either because it decayed or because it underwent
1230 // an inelastic collision
1232 return (fGctrak->istop==1);
1235 //_____________________________________________________________________________
1236 Bool_t TGeant3::IsTrackAlive() const
1239 // True if the current particle is alive and will continue to be
1242 return (fGctrak->istop==0);
1245 //_____________________________________________________________________________
1246 void TGeant3::StopTrack()
1249 // Stop the transport of the current particle and skip to the next
1254 //_____________________________________________________________________________
1255 void TGeant3::StopEvent()
1258 // Stop simulation of the current event and skip to the next
1263 //_____________________________________________________________________________
1264 Float_t TGeant3::MaxStep() const
1267 // Return the maximum step length in the current medium
1269 return fGctmed->stemax;
1272 //_____________________________________________________________________________
1273 void TGeant3::SetColors()
1276 // Set the colors for all the volumes
1277 // this is done sequentially for all volumes
1278 // based on the number of their medium
1281 Int_t jvolum=fGclink->jvolum;
1282 //Int_t jtmed=fGclink->jtmed;
1283 //Int_t jmate=fGclink->jmate;
1284 Int_t nvolum=fGcnum->nvolum;
1287 // Now for all the volumes
1288 for(kv=1;kv<=nvolum;kv++) {
1289 // Get the tracking medium
1290 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1292 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1294 //Float_t z=fZq[fZlq[jmate-ima]+7];
1295 // Find color number
1296 //icol = Int_t(z)%6+2;
1297 //icol = 17+Int_t(z*150./92.);
1300 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1302 Gsatt(name,"COLO",icol);
1306 //_____________________________________________________________________________
1307 void TGeant3::SetMaxStep(Float_t maxstep)
1310 // Set the maximum step allowed till the particle is in the current medium
1312 fGctmed->stemax=maxstep;
1315 //_____________________________________________________________________________
1316 void TGeant3::SetMaxNStep(Int_t maxnstp)
1319 // Set the maximum number of steps till the particle is in the current medium
1321 fGctrak->maxnst=maxnstp;
1324 //_____________________________________________________________________________
1325 Int_t TGeant3::GetMaxNStep() const
1328 // Maximum number of steps allowed in current medium
1330 return fGctrak->maxnst;
1333 //_____________________________________________________________________________
1334 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1335 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1339 // Defines a Material
1341 // kmat number assigned to the material
1342 // name material name
1343 // a atomic mass in au
1345 // dens density in g/cm3
1346 // absl absorbtion length in cm
1347 // if >=0 it is ignored and the program
1348 // calculates it, if <0. -absl is taken
1349 // radl radiation length in cm
1350 // if >=0 it is ignored and the program
1351 // calculates it, if <0. -radl is taken
1352 // buf pointer to an array of user words
1353 // nbuf number of user words
1355 Int_t jmate=fGclink->jmate;
1361 for(i=1; i<=ns; i++) {
1362 if(fZlq[jmate-i]==0) {
1368 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1369 nwbuf PASSCHARL(name));
1372 //_____________________________________________________________________________
1373 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1374 Float_t dens, Int_t nlmat, Float_t* wmat)
1377 // Defines mixture OR COMPOUND IMAT as composed by
1378 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1380 // If NLMAT > 0 then wmat contains the proportion by
1381 // weights of each basic material in the mixture.
1383 // If nlmat < 0 then WMAT contains the number of atoms
1384 // of a given kind into the molecule of the COMPOUND
1385 // In this case, WMAT in output is changed to relative
1388 Int_t jmate=fGclink->jmate;
1394 for(i=1; i<=ns; i++) {
1395 if(fZlq[jmate-i]==0) {
1401 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1404 //_____________________________________________________________________________
1405 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1406 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1407 Float_t stemax, Float_t deemax, Float_t epsil,
1408 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1411 // kmed tracking medium number assigned
1412 // name tracking medium name
1413 // nmat material number
1414 // isvol sensitive volume flag
1415 // ifield magnetic field
1416 // fieldm max. field value (kilogauss)
1417 // tmaxfd max. angle due to field (deg/step)
1418 // stemax max. step allowed
1419 // deemax max. fraction of energy lost in a step
1420 // epsil tracking precision (cm)
1421 // stmin min. step due to continuos processes (cm)
1423 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1424 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1425 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1427 Int_t jtmed=fGclink->jtmed;
1433 for(i=1; i<=ns; i++) {
1434 if(fZlq[jtmed-i]==0) {
1440 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1441 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1444 //_____________________________________________________________________________
1445 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1446 Float_t phiy, Float_t thez, Float_t phiz)
1449 // krot rotation matrix number assigned
1450 // theta1 polar angle for axis i
1451 // phi1 azimuthal angle for axis i
1452 // theta2 polar angle for axis ii
1453 // phi2 azimuthal angle for axis ii
1454 // theta3 polar angle for axis iii
1455 // phi3 azimuthal angle for axis iii
1457 // it defines the rotation matrix number irot.
1459 Int_t jrotm=fGclink->jrotm;
1465 for(i=1; i<=ns; i++) {
1466 if(fZlq[jrotm-i]==0) {
1472 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1475 //_____________________________________________________________________________
1476 Int_t TGeant3::GetMedium() const
1479 // Return the number of the current medium
1481 return fGctmed->numed;
1484 //_____________________________________________________________________________
1485 Float_t TGeant3::Edep() const
1488 // Return the energy lost in the current step
1490 return fGctrak->destep;
1493 //_____________________________________________________________________________
1494 Float_t TGeant3::Etot() const
1497 // Return the total energy of the current track
1499 return fGctrak->getot;
1502 //_____________________________________________________________________________
1503 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1506 // Return an array of n random numbers uniformly distributed
1507 // between 0 and 1 not included
1512 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1514 // Functions from GBASE
1516 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1518 //____________________________________________________________________________
1519 void TGeant3::Gfile(const char *filename, const char *option)
1522 // Routine to open a GEANT/RZ data base.
1524 // LUN logical unit number associated to the file
1526 // CHFILE RZ file name
1528 // CHOPT is a character string which may be
1529 // N To create a new file
1530 // U to open an existing file for update
1531 // " " to open an existing file for read only
1532 // Q The initial allocation (default 1000 records)
1533 // is given in IQUEST(10)
1534 // X Open the file in exchange format
1535 // I Read all data structures from file to memory
1536 // O Write all data structures from memory to file
1539 // If options "I" or "O" all data structures are read or
1540 // written from/to file and the file is closed.
1541 // See routine GRMDIR to create subdirectories
1542 // See routines GROUT,GRIN to write,read objects
1544 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1548 //____________________________________________________________________________
1549 void TGeant3::Gpcxyz()
1552 // Print track and volume parameters at current point
1557 //_____________________________________________________________________________
1558 void TGeant3::Ggclos()
1561 // Closes off the geometry setting.
1562 // Initializes the search list for the contents of each
1563 // volume following the order they have been positioned, and
1564 // inserting the content '0' when a call to GSNEXT (-1) has
1565 // been required by the user.
1566 // Performs the development of the JVOLUM structure for all
1567 // volumes with variable parameters, by calling GGDVLP.
1568 // Interprets the user calls to GSORD, through GGORD.
1569 // Computes and stores in a bank (next to JVOLUM mother bank)
1570 // the number of levels in the geometrical tree and the
1571 // maximum number of contents per level, by calling GGNLEV.
1572 // Sets status bit for CONCAVE volumes, through GGCAVE.
1573 // Completes the JSET structure with the list of volume names
1574 // which identify uniquely a given physical detector, the
1575 // list of bit numbers to pack the corresponding volume copy
1576 // numbers, and the generic path(s) in the JVOLUM tree,
1577 // through the routine GHCLOS.
1580 // Create internal list of volumes
1581 fVolNames = new char[fGcnum->nvolum][5];
1583 for(i=0; i<fGcnum->nvolum; ++i) {
1584 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1585 fVolNames[i][4]='\0';
1589 //_____________________________________________________________________________
1590 void TGeant3::Glast()
1593 // Finish a Geant run
1598 //_____________________________________________________________________________
1599 void TGeant3::Gprint(const char *name)
1602 // Routine to print data structures
1603 // CHNAME name of a data structure
1607 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1610 //_____________________________________________________________________________
1611 void TGeant3::Grun()
1614 // Steering function to process one run
1619 //_____________________________________________________________________________
1620 void TGeant3::Gtrig()
1623 // Steering function to process one event
1628 //_____________________________________________________________________________
1629 void TGeant3::Gtrigc()
1632 // Clear event partition
1637 //_____________________________________________________________________________
1638 void TGeant3::Gtrigi()
1641 // Initialises event partition
1646 //_____________________________________________________________________________
1647 void TGeant3::Gwork(Int_t nwork)
1650 // Allocates workspace in ZEBRA memory
1655 //_____________________________________________________________________________
1656 void TGeant3::Gzinit()
1659 // To initialise GEANT/ZEBRA data structures
1664 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1666 // Functions from GCONS
1668 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1670 //_____________________________________________________________________________
1671 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1672 Float_t &dens, Float_t &radl, Float_t &absl,
1673 Float_t* ubuf, Int_t& nbuf)
1676 // Return parameters for material IMAT
1678 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1682 //_____________________________________________________________________________
1683 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1684 Float_t &amass, Float_t &charge, Float_t &tlife)
1687 // Return parameters for particle of type IPART
1691 Int_t igpart = IdFromPDG(ipart);
1692 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1696 //_____________________________________________________________________________
1697 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1698 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1699 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1700 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1703 // Return parameters for tracking medium NUMED
1705 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1706 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1709 //_____________________________________________________________________________
1710 void TGeant3::Gmate()
1713 // Define standard GEANT materials
1718 //_____________________________________________________________________________
1719 void TGeant3::Gpart()
1722 // Define standard GEANT particles plus selected decay modes
1723 // and branching ratios.
1728 //_____________________________________________________________________________
1729 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1731 // Defines branching ratios and decay modes for standard
1733 gsdk(ipart,bratio,mode);
1736 //_____________________________________________________________________________
1737 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1738 Float_t dens, Float_t radl, Float_t absl)
1741 // Defines a Material
1743 // kmat number assigned to the material
1744 // name material name
1745 // a atomic mass in au
1747 // dens density in g/cm3
1748 // absl absorbtion length in cm
1749 // if >=0 it is ignored and the program
1750 // calculates it, if <0. -absl is taken
1751 // radl radiation length in cm
1752 // if >=0 it is ignored and the program
1753 // calculates it, if <0. -radl is taken
1754 // buf pointer to an array of user words
1755 // nbuf number of user words
1759 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1763 //_____________________________________________________________________________
1764 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1765 Float_t dens, Int_t nlmat, Float_t *wmat)
1768 // Defines mixture OR COMPOUND IMAT as composed by
1769 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1771 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1772 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1774 // If NLMAT.LT.0 then WMAT contains the number of atoms
1775 // of a given kind into the molecule of the COMPOUND
1776 // In this case, WMAT in output is changed to relative
1779 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1782 //_____________________________________________________________________________
1783 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1784 Float_t amass, Float_t charge, Float_t tlife)
1787 // Store particle parameters
1789 // ipart particle code
1790 // name particle name
1791 // itrtyp transport method (see GEANT manual)
1792 // amass mass in GeV/c2
1793 // charge charge in electron units
1794 // tlife lifetime in seconds
1798 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1802 //_____________________________________________________________________________
1803 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1804 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1805 Float_t stemax, Float_t deemax, Float_t epsil,
1809 // NTMED Tracking medium number
1810 // NAME Tracking medium name
1811 // NMAT Material number
1812 // ISVOL Sensitive volume flag
1813 // IFIELD Magnetic field
1814 // FIELDM Max. field value (Kilogauss)
1815 // TMAXFD Max. angle due to field (deg/step)
1816 // STEMAX Max. step allowed
1817 // DEEMAX Max. fraction of energy lost in a step
1818 // EPSIL Tracking precision (cm)
1819 // STMIN Min. step due to continuos processes (cm)
1821 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1822 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1823 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1827 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1828 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1831 //_____________________________________________________________________________
1832 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1833 Float_t *absco, Float_t *effic, Float_t *rindex)
1836 // Stores the tables for UV photon tracking in medium ITMED
1837 // Please note that it is the user's responsability to
1838 // provide all the coefficients:
1841 // ITMED Tracking medium number
1842 // NPCKOV Number of bins of each table
1843 // PPCKOV Value of photon momentum (in GeV)
1844 // ABSCO Absorbtion coefficients
1845 // dielectric: absorbtion length in cm
1846 // metals : absorbtion fraction (0<=x<=1)
1847 // EFFIC Detection efficiency for UV photons
1848 // RINDEX Refraction index (if=0 metal)
1850 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1853 //_____________________________________________________________________________
1854 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1857 // To change the value of cut or mechanism "CHPAR"
1858 // to a new value PARVAL for tracking medium ITMED
1859 // The data structure JTMED contains the standard tracking
1860 // parameters (CUTS and flags to control the physics processes) which
1861 // are used by default for all tracking media. It is possible to
1862 // redefine individually with GSTPAR any of these parameters for a
1863 // given tracking medium.
1864 // ITMED tracking medium number
1865 // CHPAR is a character string (variable name)
1866 // PARVAL must be given as a floating point.
1868 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1871 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1873 // Functions from GCONS
1875 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1877 //_____________________________________________________________________________
1878 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1881 // Storing/Retrieving Vertex and Track parameters
1882 // ----------------------------------------------
1884 // Stores vertex parameters.
1885 // VERT array of (x,y,z) position of the vertex
1886 // NTBEAM beam track number origin of the vertex
1887 // =0 if none exists
1888 // NTTARG target track number origin of the vertex
1889 // UBUF user array of NUBUF floating point numbers
1891 // NVTX new vertex number (=0 in case of error).
1892 // Prints vertex parameters.
1893 // IVTX for vertex IVTX.
1894 // (For all vertices if IVTX=0)
1895 // Stores long life track parameters.
1896 // PLAB components of momentum
1897 // IPART type of particle (see GSPART)
1898 // NV vertex number origin of track
1899 // UBUF array of NUBUF floating point user parameters
1901 // NT track number (if=0 error).
1902 // Retrieves long life track parameters.
1903 // ITRA track number for which parameters are requested
1904 // VERT vector origin of the track
1905 // PVERT 4 momentum components at the track origin
1906 // IPART particle type (=0 if track ITRA does not exist)
1907 // NVERT vertex number origin of the track
1908 // UBUF user words stored in GSKINE.
1909 // Prints initial track parameters.
1910 // ITRA for track ITRA
1911 // (For all tracks if ITRA=0)
1915 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1918 //_____________________________________________________________________________
1919 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1923 // Retrieves the parameter of a vertex bank
1924 // Vertex is generated from tracks NTBEAM NTTARG
1925 // NVTX is the new vertex number
1929 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1932 //_____________________________________________________________________________
1933 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1937 // Store kinematics of track NT into data structure
1938 // Track is coming from vertex NV
1941 gskine(plab, ipart, nv, buf, nwbuf, nt);
1945 //_____________________________________________________________________________
1946 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1950 // Creates a new vertex bank
1951 // Vertex is generated from tracks NTBEAM NTTARG
1952 // NVTX is the new vertex number
1955 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1959 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1961 // Functions from GPHYS
1963 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1965 //_____________________________________________________________________________
1966 void TGeant3::Gphysi()
1969 // Initialise material constants for all the physics
1970 // mechanisms used by GEANT
1975 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1977 // Functions from GTRAK
1979 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1981 //_____________________________________________________________________________
1982 void TGeant3::Gdebug()
1985 // Debug the current step
1990 //_____________________________________________________________________________
1991 void TGeant3::Gekbin()
1994 // To find bin number in kinetic energy table
1995 // stored in ELOW(NEKBIN)
2000 //_____________________________________________________________________________
2001 void TGeant3::Gfinds()
2004 // Returns the set/volume parameters corresponding to
2005 // the current space point in /GCTRAK/
2006 // and fill common /GCSETS/
2008 // IHSET user set identifier
2009 // IHDET user detector identifier
2010 // ISET set number in JSET
2011 // IDET detector number in JS=LQ(JSET-ISET)
2012 // IDTYPE detector type (1,2)
2013 // NUMBV detector volume numbers (array of length NVNAME)
2014 // NVNAME number of volume levels
2019 //_____________________________________________________________________________
2020 void TGeant3::Gsking(Int_t igk)
2023 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2024 // or the NGKINE tracks when IGK is 0.
2029 //_____________________________________________________________________________
2030 void TGeant3::Gskpho(Int_t igk)
2033 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2034 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2039 //_____________________________________________________________________________
2040 void TGeant3::Gsstak(Int_t iflag)
2043 // Stores in auxiliary stack JSTAK the particle currently
2044 // described in common /GCKINE/.
2046 // On request, creates also an entry in structure JKINE :
2048 // 0 : No entry in JKINE structure required (user)
2049 // 1 : New entry in JVERTX / JKINE structures required (user)
2050 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2051 // 2 : Entry in JKINE structure exists already (from GTREVE)
2056 //_____________________________________________________________________________
2057 void TGeant3::Gsxyz()
2060 // Store space point VECT in banks JXYZ
2065 //_____________________________________________________________________________
2066 void TGeant3::Gtrack()
2069 // Controls tracking of current particle
2074 //_____________________________________________________________________________
2075 void TGeant3::Gtreve()
2078 // Controls tracking of all particles belonging to the current event
2083 //_____________________________________________________________________________
2084 void TGeant3::Gtreve_root()
2087 // Controls tracking of all particles belonging to the current event
2092 //_____________________________________________________________________________
2093 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2096 // To generate a vector RVECV of LEN random numbers
2097 // Copy of the CERN Library routine RANECU
2101 //_____________________________________________________________________________
2102 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2103 const Text_t *chopt)
2106 // To set/retrieve the seed of the random number generator
2108 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2111 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2113 // Functions from GDRAW
2115 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2117 //_____________________________________________________________________________
2118 void TGeant3::Gdxyz(Int_t it)
2121 // Draw the points stored with Gsxyz relative to track it
2126 //_____________________________________________________________________________
2127 void TGeant3::Gdcxyz()
2130 // Draw the position of the current track
2135 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2137 // Functions from GGEOM
2139 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2141 //_____________________________________________________________________________
2142 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2145 // Computes coordinates XM (Master Reference System
2146 // knowing the coordinates XD (Detector Ref System)
2147 // The local reference system can be initialized by
2148 // - the tracking routines and GDTOM used in GUSTEP
2149 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2150 // (inverse routine is GMTOD)
2152 // If IFLAG=1 convert coordinates
2153 // IFLAG=2 convert direction cosinus
2155 gdtom(xd, xm, iflag);
2158 //_____________________________________________________________________________
2159 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2163 // Loads the top part of the Volume tree in LVOLS (IVO's),
2164 // LINDX (IN indices) for a given volume defined through
2165 // its name IUDET and number IUNUM.
2167 // The routine stores only upto the last level where JVOLUM
2168 // data structure is developed. If there is no development
2169 // above the current level, it returns NLEV zero.
2171 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2174 //_____________________________________________________________________________
2175 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2178 // Finds in which volume/medium the point X is, and updates the
2179 // common /GCVOLU/ and the structure JGPAR accordingly.
2181 // NUMED returns the tracking medium number, or 0 if point is
2182 // outside the experimental setup.
2187 //_____________________________________________________________________________
2188 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2191 // Computes coordinates XD (in DRS)
2192 // from known coordinates XM in MRS
2193 // The local reference system can be initialized by
2194 // - the tracking routines and GMTOD used in GUSTEP
2195 // - a call to GMEDIA(XM,NUMED)
2196 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2197 // (inverse routine is GDTOM)
2199 // If IFLAG=1 convert coordinates
2200 // IFLAG=2 convert direction cosinus
2202 gmtod(xm, xd, iflag);
2205 //_____________________________________________________________________________
2206 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2210 // Create a new volume by dividing an existing one
2213 // MOTHER Mother volume name
2214 // NDIV Number of divisions
2217 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2218 // It divides a previously defined volume.
2223 Vname(mother,vmother);
2224 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2225 PASSCHARL(vmother));
2228 //_____________________________________________________________________________
2229 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2230 Int_t iaxis, Float_t c0i, Int_t numed)
2233 // Create a new volume by dividing an existing one
2235 // Divides mother into ndiv divisions called name
2236 // along axis iaxis starting at coordinate value c0.
2237 // the new volume created will be medium number numed.
2242 Vname(mother,vmother);
2243 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2244 PASSCHARL(vname) PASSCHARL(vmother));
2247 //_____________________________________________________________________________
2248 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2249 Int_t iaxis, Int_t numed)
2252 // Create a new volume by dividing an existing one
2257 Vname(mother,vmother);
2258 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2259 PASSCHARL(vname) PASSCHARL(vmother));
2262 //_____________________________________________________________________________
2263 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2264 Int_t iaxis, Float_t c0, Int_t numed)
2267 // Create a new volume by dividing an existing one
2272 Vname(mother,vmother);
2273 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2274 PASSCHARL(vname) PASSCHARL(vmother));
2277 //_____________________________________________________________________________
2278 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2279 Int_t iaxis, Int_t numed, Int_t ndvmx)
2282 // Create a new volume by dividing an existing one
2284 // Divides MOTHER into divisions called NAME along
2285 // axis IAXIS in steps of STEP. If not exactly divisible
2286 // will make as many as possible and will centre them
2287 // with respect to the mother. Divisions will have medium
2288 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2289 // NDVMX is the expected maximum number of divisions
2290 // (If 0, no protection tests are performed)
2295 Vname(mother,vmother);
2296 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2297 PASSCHARL(vname) PASSCHARL(vmother));
2300 //_____________________________________________________________________________
2301 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2302 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2305 // Create a new volume by dividing an existing one
2307 // Divides MOTHER into divisions called NAME along
2308 // axis IAXIS starting at coordinate value C0 with step
2310 // The new volume created will have medium number NUMED.
2311 // If NUMED is 0, NUMED of mother is taken.
2312 // NDVMX is the expected maximum number of divisions
2313 // (If 0, no protection tests are performed)
2318 Vname(mother,vmother);
2319 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2320 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2323 //_____________________________________________________________________________
2324 void TGeant3::Gsord(const char *name, Int_t iax)
2327 // Flags volume CHNAME whose contents will have to be ordered
2328 // along axis IAX, by setting the search flag to -IAX
2332 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2333 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2334 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2335 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2336 // IAX = 6 PHI (PHI=0 => X axis)
2337 // IAX = 7 THETA (THETA=0 => Z axis)
2341 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2344 //_____________________________________________________________________________
2345 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2346 Float_t y, Float_t z, Int_t irot, const char *konly)
2349 // Position a volume into an existing one
2352 // NUMBER Copy number of the volume
2353 // MOTHER Mother volume name
2354 // X X coord. of the volume in mother ref. sys.
2355 // Y Y coord. of the volume in mother ref. sys.
2356 // Z Z coord. of the volume in mother ref. sys.
2357 // IROT Rotation matrix number w.r.t. mother ref. sys.
2358 // ONLY ONLY/MANY flag
2360 // It positions a previously defined volume in the mother.
2365 Vname(mother,vmother);
2366 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2367 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2371 //_____________________________________________________________________________
2372 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2373 Float_t x, Float_t y, Float_t z, Int_t irot,
2374 const char *konly, Float_t *upar, Int_t np )
2377 // Place a copy of generic volume NAME with user number
2378 // NR inside MOTHER, with its parameters UPAR(1..NP)
2383 Vname(mother,vmother);
2384 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2385 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2389 //_____________________________________________________________________________
2390 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2391 Float_t phi2, Float_t theta3, Float_t phi3)
2394 // nmat Rotation matrix number
2395 // THETA1 Polar angle for axis I
2396 // PHI1 Azimuthal angle for axis I
2397 // THETA2 Polar angle for axis II
2398 // PHI2 Azimuthal angle for axis II
2399 // THETA3 Polar angle for axis III
2400 // PHI3 Azimuthal angle for axis III
2402 // It defines the rotation matrix number IROT.
2404 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2407 //_____________________________________________________________________________
2408 void TGeant3::Gprotm(Int_t nmat)
2411 // To print rotation matrices structure JROTM
2412 // nmat Rotation matrix number
2417 //_____________________________________________________________________________
2418 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2419 Float_t *upar, Int_t npar)
2423 // SHAPE Volume type
2424 // NUMED Tracking medium number
2425 // NPAR Number of shape parameters
2426 // UPAR Vector containing shape parameters
2428 // It creates a new volume in the JVOLUM data structure.
2434 Vname(shape,vshape);
2435 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2436 PASSCHARL(vname) PASSCHARL(vshape));
2440 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2442 // T H E D R A W I N G P A C K A G E
2443 // ======================================
2444 // Drawing functions. These functions allow the visualization in several ways
2445 // of the volumes defined in the geometrical data structure. It is possible
2446 // to draw the logical tree of volumes belonging to the detector (DTREE),
2447 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2448 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2449 // these commands when the hidden line removal option is activated; in
2450 // this case, the volumes can be also either translated in the space
2451 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2452 // possible to fill the surfaces of the volumes
2453 // with solid colours when the shading option (SHAD) is activated.
2454 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2455 // of the detectors or to scan physical events as well.
2456 // Finally, the command MOVE will allow the rotation, translation and zooming
2457 // on real time parts of the detectors or tracks and hits of a simulated event.
2458 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2459 // the drawing is performed by the Geant ray-tracing;
2460 // automatically, the color is assigned according to the tracking medium of each
2461 // volume and the volumes with a density lower/equal than the air are considered
2462 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2463 // the user can set color and visibility for the desired volumes via the command
2464 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2465 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2466 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2467 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2468 // first case, we assume that the first mother volume of the tree is a box with
2469 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2470 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2471 // second case, the distance between the observer and the origin of the world
2472 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2473 // or telescopic effects can be achieved changing the scale factors in the command
2474 // (DRAW). When the final picture does not occupy the full window,
2475 // mapping the space before tracing can speed up the drawing, but can also
2476 // produce less precise results; values from 1 to 4 are allowed in the command
2477 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2478 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2479 // The command (VALCUT) allows the cutting of the detector by three planes
2480 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2481 // SATT for any desired volume and can assume values from 0 to 7; it determines
2482 // the different light processing to be performed for different materials:
2483 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2484 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2485 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2486 // is 0.9) and the observer is assumed to have a light source (therefore he will
2487 // produce parallel light in the case of parallel view and point-like-source
2488 // light in the case of perspective view).
2490 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2492 //_____________________________________________________________________________
2493 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2497 // IOPT Name of the attribute to be set
2498 // IVAL Value to which the attribute is to be set
2500 // name= "*" stands for all the volumes.
2501 // iopt can be chosen among the following :
2503 // WORK 0=volume name is inactive for the tracking
2504 // 1=volume name is active for the tracking (default)
2506 // SEEN 0=volume name is invisible
2507 // 1=volume name is visible (default)
2508 // -1=volume invisible with all its descendants in the tree
2509 // -2=volume visible but not its descendants in the tree
2511 // LSTY line style 1,2,3,... (default=1)
2512 // LSTY=7 will produce a very precise approximation for
2513 // revolution bodies.
2515 // LWID line width -7,...,1,2,3,..7 (default=1)
2516 // LWID<0 will act as abs(LWID) was set for the volume
2517 // and for all the levels below it. When SHAD is 'ON', LWID
2518 // represent the linewidth of the scan lines filling the surfaces
2519 // (whereas the FILL value represent their number). Therefore
2520 // tuning this parameter will help to obtain the desired
2521 // quality/performance ratio.
2523 // COLO colour code -166,...,1,2,..166 (default=1)
2525 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2526 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2527 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2528 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2529 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2530 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2531 // colour=n*10+m, m=1,2,...9, will produce the same colour
2532 // as 'n', but with increasing luminosity according to 'm';
2533 // COLO<0 will act as if abs(COLO) was set for the volume
2534 // and for all the levels below it.
2535 // When for a volume the attribute FILL is > 1 (and the
2536 // option SHAD is on), the ABS of its colour code must be < 8
2537 // because an automatic shading of its faces will be
2540 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2541 // when option SHAD is "on" the FILL attribute of any
2542 // volume can be set different from 0 (normal drawing);
2543 // if it is set to 1, the faces of such volume will be filled
2544 // with solid colours; if ABS(FILL) is > 1, then a light
2545 // source is placed along the observer line, and the faces of
2546 // such volumes will be painted by colours whose luminosity
2547 // will depend on the amount of light reflected;
2548 // if ABS(FILL) = 1, then it is possible to use all the 166
2549 // colours of the colour table, becouse the automatic shading
2550 // is not performed;
2551 // for increasing values of FILL the drawing will be performed
2552 // with higher and higher resolution improving the quality (the
2553 // number of scan lines used to fill the faces increases with FILL);
2554 // it is possible to set different values of FILL
2555 // for different volumes, in order to optimize at the same time
2556 // the performance and the quality of the picture;
2557 // FILL<0 will act as if abs(FILL) was set for the volume
2558 // and for all the levels below it.
2559 // This kind of drawing can be saved in 'picture files'
2560 // or in view banks.
2561 // 0=drawing without fill area
2562 // 1=faces filled with solid colours and resolution = 6
2563 // 2=lowest resolution (very fast)
2564 // 3=default resolution
2565 // 4=.................
2566 // 5=.................
2567 // 6=.................
2569 // Finally, if a coloured background is desired, the FILL
2570 // attribute for the first volume of the tree must be set
2571 // equal to -abs(colo), colo being >0 and <166.
2573 // SET set number associated to volume name
2574 // DET detector number associated to volume name
2575 // DTYP detector type (1,2)
2582 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2586 //_____________________________________________________________________________
2587 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2588 Int_t& natt, Float_t* par, Float_t* att)
2591 // Find the parameters of a volume
2593 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2597 //_____________________________________________________________________________
2598 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2601 // Check the parameters of a shape
2603 gckpar(ish,npar,par);
2606 //_____________________________________________________________________________
2607 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2610 // Check the parameters of a tracking medium
2612 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2615 //_____________________________________________________________________________
2616 void TGeant3::Gdelete(Int_t iview)
2619 // IVIEW View number
2621 // It deletes a view bank from memory.
2626 //_____________________________________________________________________________
2627 void TGeant3::Gdopen(Int_t iview)
2630 // IVIEW View number
2632 // When a drawing is very complex and requires a long time to be
2633 // executed, it can be useful to store it in a view bank: after a
2634 // call to DOPEN and the execution of the drawing (nothing will
2635 // appear on the screen), and after a necessary call to DCLOSE,
2636 // the contents of the bank can be displayed in a very fast way
2637 // through a call to DSHOW; therefore, the detector can be easily
2638 // zoomed many times in different ways. Please note that the pictures
2639 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2646 //_____________________________________________________________________________
2647 void TGeant3::Gdclose()
2650 // It closes the currently open view bank; it must be called after the
2651 // end of the drawing to be stored.
2656 //_____________________________________________________________________________
2657 void TGeant3::Gdshow(Int_t iview)
2660 // IVIEW View number
2662 // It shows on the screen the contents of a view bank. It
2663 // can be called after a view bank has been closed.
2668 //_____________________________________________________________________________
2669 void TGeant3::Gdopt(const char *name,const char *value)
2673 // VALUE Option value
2675 // To set/modify the drawing options.
2678 // THRZ ON Draw tracks in R vs Z
2679 // OFF (D) Draw tracks in X,Y,Z
2682 // PROJ PARA (D) Parallel projection
2684 // TRAK LINE (D) Trajectory drawn with lines
2685 // POIN " " with markers
2686 // HIDE ON Hidden line removal using the CG package
2687 // OFF (D) No hidden line removal
2688 // SHAD ON Fill area and shading of surfaces.
2689 // OFF (D) Normal hidden line removal.
2690 // RAYT ON Ray-tracing on.
2691 // OFF (D) Ray-tracing off.
2692 // EDGE OFF Does not draw contours when shad is on.
2693 // ON (D) Normal shading.
2694 // MAPP 1,2,3,4 Mapping before ray-tracing.
2695 // 0 (D) No mapping.
2696 // USER ON User graphics options in the raytracing.
2697 // OFF (D) Automatic graphics options.
2703 Vname(value,vvalue);
2704 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2708 //_____________________________________________________________________________
2709 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2710 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2715 // THETA Viewing angle theta (for 3D projection)
2716 // PHI Viewing angle phi (for 3D projection)
2717 // PSI Viewing angle psi (for 2D rotation)
2718 // U0 U-coord. (horizontal) of volume origin
2719 // V0 V-coord. (vertical) of volume origin
2720 // SU Scale factor for U-coord.
2721 // SV Scale factor for V-coord.
2723 // This function will draw the volumes,
2724 // selected with their graphical attributes, set by the Gsatt
2725 // facility. The drawing may be performed with hidden line removal
2726 // and with shading effects according to the value of the options HIDE
2727 // and SHAD; if the option SHAD is ON, the contour's edges can be
2728 // drawn or not. If the option HIDE is ON, the detector can be
2729 // exploded (BOMB), clipped with different shapes (CVOL), and some
2730 // of its parts can be shifted from their original
2731 // position (SHIFT). When HIDE is ON, if
2732 // the drawing requires more than the available memory, the program
2733 // will evaluate and display the number of missing words
2734 // (so that the user can increase the
2735 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2736 // the program will print messages about the memory used and
2737 // statistics on the volumes' visibility.
2738 // The following commands will produce the drawing of a green
2739 // volume, specified by NAME, without using the hidden line removal
2740 // technique, using the hidden line removal technique,
2741 // with different linewidth and colour (red), with
2742 // solid colour, with shading of surfaces, and without edges.
2743 // Finally, some examples are given for the ray-tracing. (A possible
2744 // string for the NAME of the volume can be found using the command DTREE).
2750 if (fGcvdma->raytra != 1) {
2751 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2753 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2757 //_____________________________________________________________________________
2758 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2759 Float_t v0,Float_t ul,Float_t vl)
2764 // CUTVAL Cut plane distance from the origin along the axis
2766 // U0 U-coord. (horizontal) of volume origin
2767 // V0 V-coord. (vertical) of volume origin
2768 // SU Scale factor for U-coord.
2769 // SV Scale factor for V-coord.
2771 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2772 // and placed at the distance cutval from the origin.
2773 // The resulting picture is seen from the the same axis.
2774 // When HIDE Mode is ON, it is possible to get the same effect with
2775 // the CVOL/BOX function.
2781 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2784 //_____________________________________________________________________________
2785 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2786 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2787 Float_t v0,Float_t ul,Float_t vl)
2791 // CUTTHE Theta angle of the line normal to cut plane
2792 // CUTPHI Phi angle of the line normal to cut plane
2793 // CUTVAL Cut plane distance from the origin along the axis
2795 // THETA Viewing angle theta (for 3D projection)
2796 // PHI Viewing angle phi (for 3D projection)
2797 // U0 U-coord. (horizontal) of volume origin
2798 // V0 V-coord. (vertical) of volume origin
2799 // SU Scale factor for U-coord.
2800 // SV Scale factor for V-coord.
2802 // The cut plane is normal to the line given by the cut angles
2803 // cutthe and cutphi and placed at the distance cutval from the origin.
2804 // The resulting picture is seen from the viewing angles theta,phi.
2810 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2814 //_____________________________________________________________________________
2815 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2820 // ISEL Option flag D=111110
2822 // CHRSIZ Character size (cm) of title NAME D=0.6
2825 // 0 to have only the header lines
2826 // xxxxx1 to add the text name centered on top of header
2827 // xxxx1x to add global detector name (first volume) on left
2828 // xxx1xx to add date on right
2829 // xx1xxx to select thick characters for text on top of header
2830 // x1xxxx to add the text 'EVENT NR x' on top of header
2831 // 1xxxxx to add the text 'RUN NR x' on top of header
2832 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2833 // i.e. they generate overwritten text.
2835 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2838 //_____________________________________________________________________________
2839 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2842 // Draw a 2D-man at position (U0,V0)
2844 // U U-coord. (horizontal) of the centre of man' R
2845 // V V-coord. (vertical) of the centre of man' R
2846 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2848 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2849 // It superimposes the picure of a man or of a woman, chosen among
2850 // three different ones, with the same scale factors as the detector
2851 // in the current drawing.
2854 if (opt.Contains("WM1")) {
2856 } else if (opt.Contains("WM3")) {
2858 } else if (opt.Contains("WM2")) {
2865 //_____________________________________________________________________________
2866 void TGeant3::Gdspec(const char *name)
2871 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2872 // its geometrical specifications. The 3D drawing will
2873 // be performed according the current values of the options HIDE and
2874 // SHAD and according the current SetClipBox clipping parameters for that
2881 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2884 //_____________________________________________________________________________
2885 void TGeant3::DrawOneSpec(const char *name)
2888 // Function called when one double-clicks on a volume name
2889 // in a TPavelabel drawn by Gdtree.
2891 THIGZ *higzSave = higz;
2892 higzSave->SetName("higzSave");
2893 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2894 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2895 if (higzSpec) higz = higzSpec;
2896 else higzSpec = new THIGZ(defSize);
2897 higzSpec->SetName("higzSpec");
2902 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2905 higzSave->SetName("higz");
2909 //_____________________________________________________________________________
2910 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2914 // LEVMAX Depth level
2917 // This function draws the logical tree,
2918 // Each volume in the tree is represented by a TPaveTree object.
2919 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2920 // Use TPaveTree pop-up menu to select:
2923 // - drawing tree of parent
2929 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2933 //_____________________________________________________________________________
2934 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2938 // LEVMAX Depth level
2941 // This function draws the logical tree of the parent of name.
2945 // Scan list of volumes in JVOLUM
2947 Int_t gname, i, jvo, in, nin, jin, num;
2948 strncpy((char *) &gname, name, 4);
2949 for(i=1; i<=fGcnum->nvolum; i++) {
2950 jvo = fZlq[fGclink->jvolum-i];
2951 nin = Int_t(fZq[jvo+3]);
2952 if (nin == -1) nin = 1;
2953 for (in=1;in<=nin;in++) {
2955 num = Int_t(fZq[jin+2]);
2956 if(gname == fZiq[fGclink->jvolum+num]) {
2957 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2959 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2967 //_____________________________________________________________________________
2968 void TGeant3::SetABAN(Int_t par)
2971 // par = 1 particles will be stopped according to their residual
2972 // range if they are not in a sensitive material and are
2973 // far enough from the boundary
2974 // 0 particles are transported normally
2976 fGcphys->dphys1 = par;
2980 //_____________________________________________________________________________
2981 void TGeant3::SetANNI(Int_t par)
2984 // To control positron annihilation.
2985 // par =0 no annihilation
2986 // =1 annihilation. Decays processed.
2987 // =2 annihilation. No decay products stored.
2989 fGcphys->ianni = par;
2993 //_____________________________________________________________________________
2994 void TGeant3::SetAUTO(Int_t par)
2997 // To control automatic calculation of tracking medium parameters:
2998 // par =0 no automatic calculation;
2999 // =1 automati calculation.
3001 fGctrak->igauto = par;
3005 //_____________________________________________________________________________
3006 void TGeant3::SetBOMB(Float_t boom)
3009 // BOOM : Exploding factor for volumes position
3011 // To 'explode' the detector. If BOOM is positive (values smaller
3012 // than 1. are suggested, but any value is possible)
3013 // all the volumes are shifted by a distance
3014 // proportional to BOOM along the direction between their centre
3015 // and the origin of the MARS; the volumes which are symmetric
3016 // with respect to this origin are simply not shown.
3017 // BOOM equal to 0 resets the normal mode.
3018 // A negative (greater than -1.) value of
3019 // BOOM will cause an 'implosion'; for even lower values of BOOM
3020 // the volumes' positions will be reflected respect to the origin.
3021 // This command can be useful to improve the 3D effect for very
3022 // complex detectors. The following commands will make explode the
3029 //_____________________________________________________________________________
3030 void TGeant3::SetBREM(Int_t par)
3033 // To control bremstrahlung.
3034 // par =0 no bremstrahlung
3035 // =1 bremstrahlung. Photon processed.
3036 // =2 bremstrahlung. No photon stored.
3038 fGcphys->ibrem = par;
3042 //_____________________________________________________________________________
3043 void TGeant3::SetCKOV(Int_t par)
3046 // To control Cerenkov production
3047 // par =0 no Cerenkov;
3049 // =2 Cerenkov with primary stopped at each step.
3051 fGctlit->itckov = par;
3055 //_____________________________________________________________________________
3056 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3057 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3060 // The hidden line removal technique is necessary to visualize properly
3061 // very complex detectors. At the same time, it can be useful to visualize
3062 // the inner elements of a detector in detail. This function allows
3063 // subtractions (via boolean operation) of BOX shape from any part of
3064 // the detector, therefore showing its inner contents.
3065 // If "*" is given as the name of the
3066 // volume to be clipped, all volumes are clipped by the given box.
3067 // A volume can be clipped at most twice.
3068 // if a volume is explicitely clipped twice,
3069 // the "*" will not act on it anymore. Giving "." as the name
3070 // of the volume to be clipped will reset the clipping.
3072 // NAME Name of volume to be clipped
3074 // XMIN Lower limit of the Shape X coordinate
3075 // XMAX Upper limit of the Shape X coordinate
3076 // YMIN Lower limit of the Shape Y coordinate
3077 // YMAX Upper limit of the Shape Y coordinate
3078 // ZMIN Lower limit of the Shape Z coordinate
3079 // ZMAX Upper limit of the Shape Z coordinate
3081 // This function performs a boolean subtraction between the volume
3082 // NAME and a box placed in the MARS according the values of the given
3088 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3091 //_____________________________________________________________________________
3092 void TGeant3::SetCOMP(Int_t par)
3095 // To control Compton scattering
3096 // par =0 no Compton
3097 // =1 Compton. Electron processed.
3098 // =2 Compton. No electron stored.
3101 fGcphys->icomp = par;
3104 //_____________________________________________________________________________
3105 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3106 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3107 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3108 Float_t ppcutm, Float_t tofmax)
3111 // CUTGAM Cut for gammas D=0.001
3112 // CUTELE Cut for electrons D=0.001
3113 // CUTHAD Cut for charged hadrons D=0.01
3114 // CUTNEU Cut for neutral hadrons D=0.01
3115 // CUTMUO Cut for muons D=0.01
3116 // BCUTE Cut for electron brems. D=-1.
3117 // BCUTM Cut for muon brems. D=-1.
3118 // DCUTE Cut for electron delta-rays D=-1.
3119 // DCUTM Cut for muon delta-rays D=-1.
3120 // PPCUTM Cut for e+e- pairs by muons D=0.01
3121 // TOFMAX Time of flight cut D=1.E+10
3123 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3124 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3126 // If one of the parameters from CUTGAM to PPCUTM included
3127 // is modified, cross-sections and energy loss tables must be
3128 // recomputed via the function Gphysi.
3130 fGccuts->cutgam = cutgam;
3131 fGccuts->cutele = cutele;
3132 fGccuts->cutneu = cutneu;
3133 fGccuts->cuthad = cuthad;
3134 fGccuts->cutmuo = cutmuo;
3135 fGccuts->bcute = bcute;
3136 fGccuts->bcutm = bcutm;
3137 fGccuts->dcute = dcute;
3138 fGccuts->dcutm = dcutm;
3139 fGccuts->ppcutm = ppcutm;
3140 fGccuts->tofmax = tofmax;
3143 //_____________________________________________________________________________
3144 void TGeant3::SetDCAY(Int_t par)
3147 // To control Decay mechanism.
3148 // par =0 no decays.
3149 // =1 Decays. secondaries processed.
3150 // =2 Decays. No secondaries stored.
3152 fGcphys->idcay = par;
3156 //_____________________________________________________________________________
3157 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3160 // Set the debug flag and frequency
3161 // Selected debug output will be printed from
3162 // event emin to even emax each emod event
3164 fGcflag->idemin = emin;
3165 fGcflag->idemax = emax;
3166 fGcflag->itest = emod;
3170 //_____________________________________________________________________________
3171 void TGeant3::SetDRAY(Int_t par)
3174 // To control delta rays mechanism.
3175 // par =0 no delta rays.
3176 // =1 Delta rays. secondaries processed.
3177 // =2 Delta rays. No secondaries stored.
3179 fGcphys->idray = par;
3182 //_____________________________________________________________________________
3183 void TGeant3::SetHADR(Int_t par)
3186 // To control hadronic interactions.
3187 // par =0 no hadronic interactions.
3188 // =1 Hadronic interactions. secondaries processed.
3189 // =2 Hadronic interactions. No secondaries stored.
3191 fGcphys->ihadr = par;
3194 //_____________________________________________________________________________
3195 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3196 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3197 Float_t xk8, Float_t xk9, Float_t xk10)
3200 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3201 // Their meaning is user defined
3203 fGckine->ikine = kine;
3204 fGckine->pkine[0] = xk1;
3205 fGckine->pkine[1] = xk2;
3206 fGckine->pkine[2] = xk3;
3207 fGckine->pkine[3] = xk4;
3208 fGckine->pkine[4] = xk5;
3209 fGckine->pkine[5] = xk6;
3210 fGckine->pkine[6] = xk7;
3211 fGckine->pkine[7] = xk8;
3212 fGckine->pkine[8] = xk9;
3213 fGckine->pkine[9] = xk10;
3216 //_____________________________________________________________________________
3217 void TGeant3::SetLOSS(Int_t par)
3220 // To control energy loss.
3221 // par =0 no energy loss;
3222 // =1 restricted energy loss fluctuations;
3223 // =2 complete energy loss fluctuations;
3225 // =4 no energy loss fluctuations.
3226 // If the value ILOSS is changed, then cross-sections and energy loss
3227 // tables must be recomputed via the command 'PHYSI'.
3229 fGcphys->iloss = par;
3233 //_____________________________________________________________________________
3234 void TGeant3::SetMULS(Int_t par)
3237 // To control multiple scattering.
3238 // par =0 no multiple scattering.
3239 // =1 Moliere or Coulomb scattering.
3240 // =2 Moliere or Coulomb scattering.
3241 // =3 Gaussian scattering.
3243 fGcphys->imuls = par;
3247 //_____________________________________________________________________________
3248 void TGeant3::SetMUNU(Int_t par)
3251 // To control muon nuclear interactions.
3252 // par =0 no muon-nuclear interactions.
3253 // =1 Nuclear interactions. Secondaries processed.
3254 // =2 Nuclear interactions. Secondaries not processed.
3256 fGcphys->imunu = par;
3259 //_____________________________________________________________________________
3260 void TGeant3::SetOPTI(Int_t par)
3263 // This flag controls the tracking optimisation performed via the
3265 // 1 no optimisation at all; GSORD calls disabled;
3266 // 0 no optimisation; only user calls to GSORD kept;
3267 // 1 all non-GSORDered volumes are ordered along the best axis;
3268 // 2 all volumes are ordered along the best axis.
3270 fGcopti->ioptim = par;
3273 //_____________________________________________________________________________
3274 void TGeant3::SetPAIR(Int_t par)
3277 // To control pair production mechanism.
3278 // par =0 no pair production.
3279 // =1 Pair production. secondaries processed.
3280 // =2 Pair production. No secondaries stored.
3282 fGcphys->ipair = par;
3286 //_____________________________________________________________________________
3287 void TGeant3::SetPFIS(Int_t par)
3290 // To control photo fission mechanism.
3291 // par =0 no photo fission.
3292 // =1 Photo fission. secondaries processed.
3293 // =2 Photo fission. No secondaries stored.
3295 fGcphys->ipfis = par;
3298 //_____________________________________________________________________________
3299 void TGeant3::SetPHOT(Int_t par)
3302 // To control Photo effect.
3303 // par =0 no photo electric effect.
3304 // =1 Photo effect. Electron processed.
3305 // =2 Photo effect. No electron stored.
3307 fGcphys->iphot = par;
3310 //_____________________________________________________________________________
3311 void TGeant3::SetRAYL(Int_t par)
3314 // To control Rayleigh scattering.
3315 // par =0 no Rayleigh scattering.
3318 fGcphys->irayl = par;
3321 //_____________________________________________________________________________
3322 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3326 // val New switch value
3328 // Change one element of array ISWIT(10) in /GCFLAG/
3330 if (sw <= 0 || sw > 10) return;
3331 fGcflag->iswit[sw-1] = val;
3335 //_____________________________________________________________________________
3336 void TGeant3::SetTRIG(Int_t nevents)
3339 // Set number of events to be run
3341 fGcflag->nevent = nevents;
3344 //_____________________________________________________________________________
3345 void TGeant3::SetUserDecay(Int_t pdg)
3348 // Force the decays of particles to be done with Pythia
3349 // and not with the Geant routines.
3350 // just kill pointers doing mzdrop
3352 Int_t ipart = IdFromPDG(pdg);
3354 printf("Particle %d not in geant\n",pdg);
3357 Int_t jpart=fGclink->jpart;
3358 Int_t jpa=fZlq[jpart-ipart];
3361 Int_t jpa1=fZlq[jpa-1];
3363 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3364 Int_t jpa2=fZlq[jpa-2];
3366 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3370 //______________________________________________________________________________
3371 void TGeant3::Vname(const char *name, char *vname)
3374 // convert name to upper case. Make vname at least 4 chars
3376 Int_t l = strlen(name);
3379 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3380 for (i=l;i<4;i++) vname[i] = ' ';
3384 //______________________________________________________________________________
3385 void TGeant3::Ertrgo()
3390 //______________________________________________________________________________
3391 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3392 const Float_t *x2, const Float_t *p2,
3393 Int_t ipa, Option_t *chopt)
3395 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3398 //_____________________________________________________________________________
3399 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3400 Int_t number, Int_t nlevel)
3404 // ******************************************************************
3406 // * Write out the geometry of the detector in EUCLID file format *
3408 // * filnam : will be with the extension .euc *
3409 // * topvol : volume name of the starting node *
3410 // * number : copy number of topvol (relevant for gsposp) *
3411 // * nlevel : number of levels in the tree structure *
3412 // * to be written out, starting from topvol *
3414 // * Author : M. Maire *
3416 // ******************************************************************
3418 // File filnam.tme is written out with the definitions of tracking
3419 // medias and materials.
3420 // As to restore original numbers for materials and medias, program
3421 // searches in the file euc_medi.dat and comparing main parameters of
3422 // the mat. defined inside geant and the one in file recognizes them
3423 // and is able to take number from file. If for any material or medium,
3424 // this procedure fails, ordering starts from 1.
3425 // Arrays IOTMED and IOMATE are used for this procedure
3427 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3428 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3430 Int_t i, end, itm, irm, jrm, k, nmed;
3434 char *filext, *filetme;
3435 char natmed[21], namate[21];
3436 char natmedc[21], namatec[21];
3437 char key[5], name[5], mother[5], konly[5];
3439 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3440 Int_t mlevel, numbr, natt, numed, nin, ndata;
3441 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3442 Int_t jdiv, ivin, in, jin, jvin, irot;
3443 Int_t jtm, imat, jma, flag=0, imatc;
3444 Float_t az, dens, radl, absl, a, step, x, y, z;
3445 Int_t npar, ndvmx, left;
3446 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3448 Int_t iomate[100], iotmed[100];
3449 Float_t par[50], att[20], ubuf[50];
3452 Int_t level, ndiv, iaxe;
3453 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3454 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3455 Float_t tmaxf, stemax, deemax, epsil, stmin;
3456 const char *f10000="!\n%s\n!\n";
3457 //Open the input file
3459 for(i=0;i<end;i++) if(filnam[i]=='.') {
3463 filext=new char[end+5];
3464 filetme=new char[end+5];
3465 strncpy(filext,filnam,end);
3466 strncpy(filetme,filnam,end);
3468 // *** The output filnam name will be with extension '.euc'
3469 strcpy(&filext[end],".euc");
3470 strcpy(&filetme[end],".tme");
3471 lun=fopen(filext,"w");
3473 // *** Initialisation of the working space
3474 iadvol=fGcnum->nvolum;
3475 iadtmd=iadvol+fGcnum->nvolum;
3476 iadrot=iadtmd+fGcnum->ntmed;
3477 if(fGclink->jrotm) {
3478 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3482 nwtot=iadrot+fGcnum->nrotm;
3483 qws = new float[nwtot+1];
3484 for (i=0;i<nwtot+1;i++) qws[i]=0;
3487 if(nlevel==0) mlevel=20;
3489 // *** find the top volume and put it in the stak
3490 numbr = number>0 ? number : 1;
3491 Gfpara(topvol,numbr,1,npar,natt,par,att);
3493 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3498 // *** authorized shape ?
3499 strncpy((char *)&iname, topvol, 4);
3501 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3505 jvo = fZlq[fGclink->jvolum-ivo];
3506 ish = Int_t (fZq[jvo+2]);
3508 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3515 iws[iadvol+ivo] = level;
3518 //*** flag all volumes and fill the stak
3522 // pick the next volume in stak
3524 ivo = TMath::Abs(iws[ivstak]);
3525 jvo = fZlq[fGclink->jvolum - ivo];
3527 // flag the tracking medium
3528 numed = Int_t (fZq[jvo + 4]);
3529 iws[iadtmd + numed] = 1;
3531 // get the daughters ...
3532 level = iws[iadvol+ivo];
3533 if (level < mlevel) {
3535 nin = Int_t (fZq[jvo + 3]);
3537 // from division ...
3539 jdiv = fZlq[jvo - 1];
3540 ivin = Int_t (fZq[jdiv + 2]);
3542 iws[nvstak] = -ivin;
3543 iws[iadvol+ivin] = level;
3545 // from position ...
3546 } else if (nin > 0) {
3547 for(in=1; in<=nin; in++) {
3548 jin = fZlq[jvo - in];
3549 ivin = Int_t (fZq[jin + 2 ]);
3550 jvin = fZlq[fGclink->jvolum - ivin];
3551 ish = Int_t (fZq[jvin + 2]);
3552 // authorized shape ?
3554 // not yet flagged ?
3555 if (iws[iadvol+ivin]==0) {
3558 iws[iadvol+ivin] = level;
3560 // flag the rotation matrix
3561 irot = Int_t ( fZq[jin + 4 ]);
3562 if (irot > 0) iws[iadrot+irot] = 1;
3568 // next volume in stak ?
3569 if (ivstak < nvstak) goto L10;
3571 // *** restore original material and media numbers
3572 // file euc_medi.dat is needed to compare materials and medias
3574 FILE* luncor=fopen("euc_medi.dat","r");
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);
3581 imat = Int_t (fZq[jtm+6]);
3582 jma = fZlq[fGclink->jmate-imat];
3584 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3587 strncpy(namate,(char *)&fZiq[jma+1],20);
3590 //** find the material original number
3593 iret=fscanf(luncor,"%4s,%130s",key,card);
3594 if(iret<=0) goto L26;
3596 if(!strcmp(key,"MATE")) {
3597 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3598 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3599 if(!strcmp(namatec,namate)) {
3600 if(az==a && zc==z && densc==dens && radlc==radl
3601 && abslc==absl && nparc==nparc) {
3604 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3606 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3610 if(strcmp(key,"END") && !flag) goto L23;
3612 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3616 //*** restore original tracking medium number
3619 iret=fscanf(luncor,"%4s,%130s",key,card);
3620 if(iret<=0) goto L26;
3622 if (!strcmp(key,"TMED")) {