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.20 2000/01/12 11:29:27 fca
21 Revision 1.19 1999/12/17 09:03:12 fca
22 Introduce a names array
24 Revision 1.18 1999/11/26 16:55:39 fca
25 Reimplement CurrentVolName() to avoid memory leaks
27 Revision 1.17 1999/11/03 16:58:28 fca
28 Correct source of address violation in creating character string
30 Revision 1.16 1999/11/03 13:17:08 fca
31 Have ProdProcess return const char*
33 Revision 1.15 1999/10/26 06:04:50 fca
34 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
36 Revision 1.14 1999/09/29 09:24:30 fca
37 Introduction of the Copyright and cvs Log
41 ///////////////////////////////////////////////////////////////////////////////
43 // Interface Class to the Geant3.21 MonteCarlo //
47 <img src="picts/TGeant3Class.gif">
52 ///////////////////////////////////////////////////////////////////////////////
58 #include <TDatabasePDG.h>
59 #include "AliCallf77.h"
62 # define gzebra gzebra_
63 # define grfile grfile_
64 # define gpcxyz gpcxyz_
65 # define ggclos ggclos_
68 # define gcinit gcinit_
71 # define gtrigc gtrigc_
72 # define gtrigi gtrigi_
74 # define gzinit gzinit_
75 # define gfmate gfmate_
76 # define gfpart gfpart_
77 # define gftmed gftmed_
81 # define gsmate gsmate_
82 # define gsmixt gsmixt_
83 # define gspart gspart_
84 # define gstmed gstmed_
85 # define gsckov gsckov_
86 # define gstpar gstpar_
87 # define gfkine gfkine_
88 # define gfvert gfvert_
89 # define gskine gskine_
90 # define gsvert gsvert_
91 # define gphysi gphysi_
92 # define gdebug gdebug_
93 # define gekbin gekbin_
94 # define gfinds gfinds_
95 # define gsking gsking_
96 # define gskpho gskpho_
97 # define gsstak gsstak_
99 # define gtrack gtrack_
100 # define gtreve gtreve_
101 # define gtreve_root gtreve_root_
102 # define grndm grndm_
103 # define grndmq grndmq_
104 # define gdtom gdtom_
105 # define glmoth glmoth_
106 # define gmedia gmedia_
107 # define gmtod gmtod_
108 # define gsdvn gsdvn_
109 # define gsdvn2 gsdvn2_
110 # define gsdvs gsdvs_
111 # define gsdvs2 gsdvs2_
112 # define gsdvt gsdvt_
113 # define gsdvt2 gsdvt2_
114 # define gsord gsord_
115 # define gspos gspos_
116 # define gsposp gsposp_
117 # define gsrotm gsrotm_
118 # define gprotm gprotm_
119 # define gsvolu gsvolu_
120 # define gprint gprint_
121 # define gdinit gdinit_
122 # define gdopt gdopt_
123 # define gdraw gdraw_
124 # define gdrayt gdrayt_
125 # define gdrawc gdrawc_
126 # define gdrawx gdrawx_
127 # define gdhead gdhead_
128 # define gdwmn1 gdwmn1_
129 # define gdwmn2 gdwmn2_
130 # define gdwmn3 gdwmn3_
131 # define gdxyz gdxyz_
132 # define gdcxyz gdcxyz_
133 # define gdman gdman_
134 # define gdspec gdspec_
135 # define gdtree gdtree_
136 # define gdelet gdelet_
137 # define gdclos gdclos_
138 # define gdshow gdshow_
139 # define gdopen gdopen_
140 # define dzshow dzshow_
141 # define gsatt gsatt_
142 # define gfpara gfpara_
143 # define gckpar gckpar_
144 # define gckmat gckmat_
145 # define geditv geditv_
146 # define mzdrop mzdrop_
148 # define ertrak ertrak_
149 # define ertrgo ertrgo_
151 # define setbomb setbomb_
152 # define setclip setclip_
153 # define gcomad gcomad_
156 # define gzebra GZEBRA
157 # define grfile GRFILE
158 # define gpcxyz GPCXYZ
159 # define ggclos GGCLOS
162 # define gcinit GCINIT
165 # define gtrigc GTRIGC
166 # define gtrigi GTRIGI
168 # define gzinit GZINIT
169 # define gfmate GFMATE
170 # define gfpart GFPART
171 # define gftmed GFTMED
175 # define gsmate GSMATE
176 # define gsmixt GSMIXT
177 # define gspart GSPART
178 # define gstmed GSTMED
179 # define gsckov GSCKOV
180 # define gstpar GSTPAR
181 # define gfkine GFKINE
182 # define gfvert GFVERT
183 # define gskine GSKINE
184 # define gsvert GSVERT
185 # define gphysi GPHYSI
186 # define gdebug GDEBUG
187 # define gekbin GEKBIN
188 # define gfinds GFINDS
189 # define gsking GSKING
190 # define gskpho GSKPHO
191 # define gsstak GSSTAK
193 # define gtrack GTRACK
194 # define gtreve GTREVE
195 # define gtreve_root GTREVE_ROOT
197 # define grndmq GRNDMQ
199 # define glmoth GLMOTH
200 # define gmedia GMEDIA
203 # define gsdvn2 GSDVN2
205 # define gsdvs2 GSDVS2
207 # define gsdvt2 GSDVT2
210 # define gsposp GSPOSP
211 # define gsrotm GSROTM
212 # define gprotm GPROTM
213 # define gsvolu GSVOLU
214 # define gprint GPRINT
215 # define gdinit GDINIT
218 # define gdrayt GDRAYT
219 # define gdrawc GDRAWC
220 # define gdrawx GDRAWX
221 # define gdhead GDHEAD
222 # define gdwmn1 GDWMN1
223 # define gdwmn2 GDWMN2
224 # define gdwmn3 GDWMN3
226 # define gdcxyz GDCXYZ
228 # define gdfspc GDFSPC
229 # define gdspec GDSPEC
230 # define gdtree GDTREE
231 # define gdelet GDELET
232 # define gdclos GDCLOS
233 # define gdshow GDSHOW
234 # define gdopen GDOPEN
235 # define dzshow DZSHOW
237 # define gfpara GFPARA
238 # define gckpar GCKPAR
239 # define gckmat GCKMAT
240 # define geditv GEDITV
241 # define mzdrop MZDROP
243 # define ertrak ERTRAK
244 # define ertrgo ERTRGO
246 # define setbomb SETBOMB
247 # define setclip SETCLIP
248 # define gcomad GCOMAD
252 //____________________________________________________________________________
256 // Prototypes for GEANT functions
258 void type_of_call gzebra(const int&);
260 void type_of_call gpcxyz();
262 void type_of_call ggclos();
264 void type_of_call glast();
266 void type_of_call ginit();
268 void type_of_call gcinit();
270 void type_of_call grun();
272 void type_of_call gtrig();
274 void type_of_call gtrigc();
276 void type_of_call gtrigi();
278 void type_of_call gwork(const int&);
280 void type_of_call gzinit();
282 void type_of_call gmate();
284 void type_of_call gpart();
286 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
288 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
289 Int_t &, Float_t *, Int_t &);
291 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
292 Float_t &, Float_t *, Int_t &);
294 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
297 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
300 void type_of_call gphysi();
302 void type_of_call gdebug();
304 void type_of_call gekbin();
306 void type_of_call gfinds();
308 void type_of_call gsking(Int_t &);
310 void type_of_call gskpho(Int_t &);
312 void type_of_call gsstak(Int_t &);
314 void type_of_call gsxyz();
316 void type_of_call gtrack();
318 void type_of_call gtreve();
320 void type_of_call gtreve_root();
322 void type_of_call grndm(Float_t *, const Int_t &);
324 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
327 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
329 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
330 Int_t *, Int_t * DEFCHARL);
332 void type_of_call gmedia(Float_t *, Int_t &);
334 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
336 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
337 const Float_t &, const Float_t &, const Float_t &,
340 void type_of_call gprotm(const Int_t &);
342 void type_of_call grfile(const Int_t&, DEFCHARD,
343 DEFCHARD DEFCHARL DEFCHARL);
345 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
346 Float_t &, Float_t &, Float_t &, Float_t *,
349 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
350 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
352 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
353 Float_t &, Float_t &, Float_t &, Float_t &,
354 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
356 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
357 Float_t &, Float_t &, Float_t &, Float_t *,
360 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
361 Float_t &, Int_t &, Float_t * DEFCHARL);
363 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
364 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
367 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
368 Float_t &, Float_t &, Float_t &, Float_t &,
369 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
371 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
372 Float_t *absco, Float_t *effic, Float_t *rindex);
373 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
375 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
378 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
379 Int_t & DEFCHARL DEFCHARL);
381 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
384 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
385 Int_t & DEFCHARL DEFCHARL);
387 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
388 Int_t & DEFCHARL DEFCHARL);
390 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
391 Int_t &, Int_t & DEFCHARL DEFCHARL);
393 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
395 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
396 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
399 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
400 Float_t &, Int_t &, DEFCHARD,
401 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
403 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
404 Int_t & DEFCHARL DEFCHARL);
406 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
408 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
411 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
413 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
415 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
417 void type_of_call gdinit();
419 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
421 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
422 Float_t &, Float_t &, Float_t & DEFCHARL);
423 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
424 Float_t &, Float_t &, Float_t & DEFCHARL);
425 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
426 Float_t &, Float_t & DEFCHARL);
427 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
428 Float_t &, Float_t &, Float_t &, Float_t &,
430 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
431 void type_of_call gdxyz(Int_t &);
432 void type_of_call gdcxyz();
433 void type_of_call gdman(Float_t &, Float_t &);
434 void type_of_call gdwmn1(Float_t &, Float_t &);
435 void type_of_call gdwmn2(Float_t &, Float_t &);
436 void type_of_call gdwmn3(Float_t &, Float_t &);
437 void type_of_call gdspec(DEFCHARD DEFCHARL);
438 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
439 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
441 void type_of_call gdopen(Int_t &);
442 void type_of_call gdclos();
443 void type_of_call gdelet(Int_t &);
444 void type_of_call gdshow(Int_t &);
445 void type_of_call geditv(Int_t &) {;}
448 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
449 const int&, const int&, const int& DEFCHARL
452 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
454 void type_of_call setbomb(Float_t &);
455 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
456 Float_t &, Float_t & DEFCHARL);
457 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
459 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
460 const Float_t *x2, const Float_t *p2,
461 const Int_t &ipa, DEFCHARD DEFCHARL);
463 void type_of_call ertrgo();
467 // Geant3 global pointer
469 static Int_t defSize = 600;
473 //____________________________________________________________________________
477 // Default constructor
481 //____________________________________________________________________________
482 TGeant3::TGeant3(const char *title, Int_t nwgeant)
483 :AliMC("TGeant3",title)
486 // Standard constructor for TGeant3 with ZEBRA initialisation
497 // Load Address of Geant3 commons
500 // Zero number of particles
504 //____________________________________________________________________________
505 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
506 Float_t &radl, Float_t &absl) const
509 // Return the parameters of the current material during transport
513 dens = fGcmate->dens;
514 radl = fGcmate->radl;
515 absl = fGcmate->absl;
516 return 1; //this could be the number of elements in mixture
519 //____________________________________________________________________________
520 void TGeant3::DefaultRange()
523 // Set range of current drawing pad to 20x20 cm
529 higz->Range(0,0,20,20);
532 //____________________________________________________________________________
533 void TGeant3::InitHIGZ()
544 //____________________________________________________________________________
545 void TGeant3::LoadAddress()
548 // Assigns the address of the GEANT common blocks to the structures
549 // that allow their access from C++
552 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
553 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
554 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
555 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
556 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
557 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
558 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
559 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
560 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
561 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
562 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
563 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
564 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
565 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
566 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
567 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
568 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
569 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
570 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
571 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
572 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
575 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
576 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
577 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
578 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
580 // Variables for ZEBRA store
581 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
583 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
588 //_____________________________________________________________________________
589 void TGeant3::GeomIter()
592 // Geometry iterator for moving upward in the geometry tree
593 // Initialise the iterator
595 fNextVol=fGcvolu->nlevel;
598 //____________________________________________________________________________
599 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
602 // Geometry iterator for moving upward in the geometry tree
603 // Return next volume up
608 gname=fGcvolu->names[fNextVol];
609 copy=fGcvolu->number[fNextVol];
610 i=fGcvolu->lvolum[fNextVol];
611 name = fVolNames[i-1];
612 if(gname == fZiq[fGclink->jvolum+i]) return i;
613 else printf("GeomTree: Volume %s not found in bank\n",name);
618 //_____________________________________________________________________________
619 Int_t TGeant3::CurrentVolID(Int_t ©) const
622 // Returns the current volume ID and copy number
625 if( (i=fGcvolu->nlevel-1) < 0 ) {
626 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
628 gname=fGcvolu->names[i];
629 copy=fGcvolu->number[i];
630 i=fGcvolu->lvolum[i];
631 if(gname == fZiq[fGclink->jvolum+i]) return i;
632 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
637 //_____________________________________________________________________________
638 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
641 // Return the current volume "off" upward in the geometrical tree
642 // ID and copy number
645 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
646 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
647 off,fGcvolu->nlevel);
649 gname=fGcvolu->names[i];
650 copy=fGcvolu->number[i];
651 i=fGcvolu->lvolum[i];
652 if(gname == fZiq[fGclink->jvolum+i]) return i;
653 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
658 //_____________________________________________________________________________
659 const char* TGeant3::CurrentVolName() const
662 // Returns the current volume name
665 if( (i=fGcvolu->nlevel-1) < 0 ) {
666 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
668 gname=fGcvolu->names[i];
669 i=fGcvolu->lvolum[i];
670 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
671 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
676 //_____________________________________________________________________________
677 const char* TGeant3::CurrentVolOffName(Int_t off) const
680 // Return the current volume "off" upward in the geometrical tree
681 // ID, name and copy number
682 // if name=0 no name is returned
685 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
686 Warning("CurrentVolOffName",
687 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
689 gname=fGcvolu->names[i];
690 i=fGcvolu->lvolum[i];
691 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
692 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
697 //_____________________________________________________________________________
698 Int_t TGeant3::IdFromPDG(Int_t pdg) const
701 // Return Geant3 code from PDG and pseudo ENDF code
703 for(Int_t i=0;i<fNPDGCodes;++i)
704 if(pdg==fPDGCode[i]) return i;
708 //_____________________________________________________________________________
709 Int_t TGeant3::PDGFromId(Int_t id) const
711 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
715 //_____________________________________________________________________________
716 void TGeant3::DefineParticles()
719 // Define standard Geant 3 particles
722 // Load standard numbers for GEANT particles and PDG conversion
723 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
724 fPDGCode[fNPDGCodes++]=22; // 1 = photon
725 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
726 fPDGCode[fNPDGCodes++]=11; // 3 = electron
727 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
728 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
729 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
730 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
731 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
732 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
733 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
734 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
735 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
736 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
737 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
738 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
739 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
740 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
741 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
742 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
743 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
744 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
745 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
746 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
747 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
748 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
749 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
750 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
751 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
752 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
753 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
754 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
755 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
762 /* --- Define additional particles */
763 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
764 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
766 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
767 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
769 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
770 fPDGCode[fNPDGCodes++]=411; // 35 = D+
772 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
773 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
775 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
776 fPDGCode[fNPDGCodes++]=421; // 37 = D0
778 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
779 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
781 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
783 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
785 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
787 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
788 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
790 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
791 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
793 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
794 fPDGCode[fNPDGCodes++]=113; // 37 = D0
797 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
799 // and numbers above 5 000 000 for special applications
802 const Int_t kion=10000000;
804 const Int_t kspe=50000000;
806 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
808 const Double_t autogev=0.9314943228;
809 const Double_t hslash = 1.0545726663e-27;
810 const Double_t erggev = 1/1.6021773349e-3;
811 const Double_t hshgev = hslash*erggev;
812 const Double_t yearstosec = 3600*24*365.25;
815 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
816 0,1,"Ion",kion+10020);
817 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
819 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
820 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
821 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
823 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
824 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
825 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
827 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
829 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
830 0,2,"Ion",kion+20030);
831 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
833 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
834 0,0,"Special",kspe+50);
835 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
837 /* --- Define additional decay modes --- */
838 /* --- omega(783) --- */
839 for (kz = 0; kz < 6; ++kz) {
850 Gsdk(ipa, bratio, mode);
851 /* --- phi(1020) --- */
852 for (kz = 0; kz < 6; ++kz) {
867 Gsdk(ipa, bratio, mode);
869 for (kz = 0; kz < 6; ++kz) {
882 Gsdk(ipa, bratio, mode);
884 for (kz = 0; kz < 6; ++kz) {
897 Gsdk(ipa, bratio, mode);
899 for (kz = 0; kz < 6; ++kz) {
910 Gsdk(ipa, bratio, mode);
911 /* --- Anti D0 --- */
912 for (kz = 0; kz < 6; ++kz) {
923 Gsdk(ipa, bratio, mode);
925 for (kz = 0; kz < 6; ++kz) {
932 Gsdk(ipa, bratio, mode);
934 for (kz = 0; kz < 6; ++kz) {
941 Gsdk(ipa, bratio, mode);
943 for (kz = 0; kz < 6; ++kz) {
950 Gsdk(ipa, bratio, mode);
953 for (kz = 0; kz < 6; ++kz) {
962 Gsdk(ipa, bratio, mode);
965 Gsdk(ipa, bratio, mode);
968 Gsdk(ipa, bratio, mode);
973 //_____________________________________________________________________________
974 Int_t TGeant3::VolId(Text_t *name) const
977 // Return the unique numeric identifier for volume name
980 strncpy((char *) &gname, name, 4);
981 for(i=1; i<=fGcnum->nvolum; i++)
982 if(gname == fZiq[fGclink->jvolum+i]) return i;
983 printf("VolId: Volume %s not found\n",name);
987 //_____________________________________________________________________________
988 Int_t TGeant3::NofVolumes() const
991 // Return total number of volumes in the geometry
993 return fGcnum->nvolum;
996 //_____________________________________________________________________________
997 const char* TGeant3::VolName(Int_t id) const
1000 // Return the volume name given the volume identifier
1002 const char name[5]="NULL";
1003 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1006 return fVolNames[id-1];
1009 //_____________________________________________________________________________
1010 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
1012 Int_t gpart = IdFromPDG(part);
1013 if(!strcmp(reac,"PHOT"))
1016 Error("Xsec","Can calculate photoelectric only for photons\n");
1022 //_____________________________________________________________________________
1023 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1026 // Return the current position in the master reference frame of the
1027 // track being transported
1029 xyz[0]=fGctrak->vect[0];
1030 xyz[1]=fGctrak->vect[1];
1031 xyz[2]=fGctrak->vect[2];
1032 xyz[3]=fGctrak->tofg;
1035 //_____________________________________________________________________________
1036 Float_t TGeant3::TrackTime() const
1039 // Return the current time of flight of the track being transported
1041 return fGctrak->tofg;
1044 //_____________________________________________________________________________
1045 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1048 // Return the direction and the momentum (GeV/c) of the track
1049 // currently being transported
1051 Double_t ptot=fGctrak->vect[6];
1052 xyz[0]=fGctrak->vect[3]*ptot;
1053 xyz[1]=fGctrak->vect[4]*ptot;
1054 xyz[2]=fGctrak->vect[5]*ptot;
1055 xyz[3]=fGctrak->getot;
1058 //_____________________________________________________________________________
1059 Float_t TGeant3::TrackCharge() const
1062 // Return charge of the track currently transported
1064 return fGckine->charge;
1067 //_____________________________________________________________________________
1068 Float_t TGeant3::TrackMass() const
1071 // Return the mass of the track currently transported
1073 return fGckine->amass;
1076 //_____________________________________________________________________________
1077 Int_t TGeant3::TrackPid() const
1080 // Return the id of the particle transported
1082 return PDGFromId(fGckine->ipart);
1085 //_____________________________________________________________________________
1086 Float_t TGeant3::TrackStep() const
1089 // Return the length in centimeters of the current step
1091 return fGctrak->step;
1094 //_____________________________________________________________________________
1095 Float_t TGeant3::TrackLength() const
1098 // Return the length of the current track from its origin
1100 return fGctrak->sleng;
1103 //_____________________________________________________________________________
1104 Bool_t TGeant3::IsTrackInside() const
1107 // True if the track is not at the boundary of the current volume
1109 return (fGctrak->inwvol==0);
1112 //_____________________________________________________________________________
1113 Bool_t TGeant3::IsTrackEntering() const
1116 // True if this is the first step of the track in the current volume
1118 return (fGctrak->inwvol==1);
1121 //_____________________________________________________________________________
1122 Bool_t TGeant3::IsTrackExiting() const
1125 // True if this is the last step of the track in the current volume
1127 return (fGctrak->inwvol==2);
1130 //_____________________________________________________________________________
1131 Bool_t TGeant3::IsTrackOut() const
1134 // True if the track is out of the setup
1136 return (fGctrak->inwvol==3);
1139 //_____________________________________________________________________________
1140 Bool_t TGeant3::IsTrackStop() const
1143 // True if the track energy has fallen below the threshold
1145 return (fGctrak->istop==2);
1148 //_____________________________________________________________________________
1149 Int_t TGeant3::NSecondaries() const
1152 // Number of secondary particles generated in the current step
1154 return fGcking->ngkine;
1157 //_____________________________________________________________________________
1158 Int_t TGeant3::CurrentEvent() const
1161 // Number of the current event
1163 return fGcflag->idevt;
1166 //_____________________________________________________________________________
1167 const char* TGeant3::ProdProcess() const
1170 // Name of the process that has produced the secondary particles
1171 // in the current step
1173 static char proc[5];
1174 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1177 if(fGcking->ngkine>0) {
1178 for (km = 0; km < fGctrak->nmec; ++km) {
1179 for (im = 0; im < 13; ++im) {
1180 if (fGctrak->lmec[km] == ipmec[im]) {
1181 mec = fGctrak->lmec[km];
1182 if (0 < mec && mec < 31) {
1183 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1184 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1185 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1192 strcpy(proc,"UNKN");
1193 } else strcpy(proc,"NONE");
1197 //_____________________________________________________________________________
1198 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1199 TLorentzVector &x, TLorentzVector &p)
1202 // Get the parameters of the secondary track number isec produced
1203 // in the current step
1206 if(-1<isec && isec<fGcking->ngkine) {
1207 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1209 x[i]=fGckin3->gpos[isec][i];
1210 p[i]=fGcking->gkin[isec][i];
1212 x[3]=fGcking->tofd[isec];
1213 p[3]=fGcking->gkin[isec][3];
1215 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1216 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1221 //_____________________________________________________________________________
1222 void TGeant3::InitLego()
1225 SetDEBU(0,0,0); //do not print a message
1228 //_____________________________________________________________________________
1229 Bool_t TGeant3::IsTrackDisappeared() const
1232 // True if the current particle has disappered
1233 // either because it decayed or because it underwent
1234 // an inelastic collision
1236 return (fGctrak->istop==1);
1239 //_____________________________________________________________________________
1240 Bool_t TGeant3::IsTrackAlive() const
1243 // True if the current particle is alive and will continue to be
1246 return (fGctrak->istop==0);
1249 //_____________________________________________________________________________
1250 void TGeant3::StopTrack()
1253 // Stop the transport of the current particle and skip to the next
1258 //_____________________________________________________________________________
1259 void TGeant3::StopEvent()
1262 // Stop simulation of the current event and skip to the next
1267 //_____________________________________________________________________________
1268 Float_t TGeant3::MaxStep() const
1271 // Return the maximum step length in the current medium
1273 return fGctmed->stemax;
1276 //_____________________________________________________________________________
1277 void TGeant3::SetColors()
1280 // Set the colors for all the volumes
1281 // this is done sequentially for all volumes
1282 // based on the number of their medium
1285 Int_t jvolum=fGclink->jvolum;
1286 //Int_t jtmed=fGclink->jtmed;
1287 //Int_t jmate=fGclink->jmate;
1288 Int_t nvolum=fGcnum->nvolum;
1291 // Now for all the volumes
1292 for(kv=1;kv<=nvolum;kv++) {
1293 // Get the tracking medium
1294 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1296 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1298 //Float_t z=fZq[fZlq[jmate-ima]+7];
1299 // Find color number
1300 //icol = Int_t(z)%6+2;
1301 //icol = 17+Int_t(z*150./92.);
1304 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1306 Gsatt(name,"COLO",icol);
1310 //_____________________________________________________________________________
1311 void TGeant3::SetMaxStep(Float_t maxstep)
1314 // Set the maximum step allowed till the particle is in the current medium
1316 fGctmed->stemax=maxstep;
1319 //_____________________________________________________________________________
1320 void TGeant3::SetMaxNStep(Int_t maxnstp)
1323 // Set the maximum number of steps till the particle is in the current medium
1325 fGctrak->maxnst=maxnstp;
1328 //_____________________________________________________________________________
1329 Int_t TGeant3::GetMaxNStep() const
1332 // Maximum number of steps allowed in current medium
1334 return fGctrak->maxnst;
1337 //_____________________________________________________________________________
1338 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1339 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1343 // Defines a Material
1345 // kmat number assigned to the material
1346 // name material name
1347 // a atomic mass in au
1349 // dens density in g/cm3
1350 // absl absorbtion length in cm
1351 // if >=0 it is ignored and the program
1352 // calculates it, if <0. -absl is taken
1353 // radl radiation length in cm
1354 // if >=0 it is ignored and the program
1355 // calculates it, if <0. -radl is taken
1356 // buf pointer to an array of user words
1357 // nbuf number of user words
1359 Int_t jmate=fGclink->jmate;
1365 for(i=1; i<=ns; i++) {
1366 if(fZlq[jmate-i]==0) {
1372 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1373 nwbuf PASSCHARL(name));
1376 //_____________________________________________________________________________
1377 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1378 Float_t dens, Int_t nlmat, Float_t* wmat)
1381 // Defines mixture OR COMPOUND IMAT as composed by
1382 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1384 // If NLMAT > 0 then wmat contains the proportion by
1385 // weights of each basic material in the mixture.
1387 // If nlmat < 0 then WMAT contains the number of atoms
1388 // of a given kind into the molecule of the COMPOUND
1389 // In this case, WMAT in output is changed to relative
1392 Int_t jmate=fGclink->jmate;
1398 for(i=1; i<=ns; i++) {
1399 if(fZlq[jmate-i]==0) {
1405 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1408 //_____________________________________________________________________________
1409 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1410 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1411 Float_t stemax, Float_t deemax, Float_t epsil,
1412 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1415 // kmed tracking medium number assigned
1416 // name tracking medium name
1417 // nmat material number
1418 // isvol sensitive volume flag
1419 // ifield magnetic field
1420 // fieldm max. field value (kilogauss)
1421 // tmaxfd max. angle due to field (deg/step)
1422 // stemax max. step allowed
1423 // deemax max. fraction of energy lost in a step
1424 // epsil tracking precision (cm)
1425 // stmin min. step due to continuos processes (cm)
1427 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1428 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1429 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1431 Int_t jtmed=fGclink->jtmed;
1437 for(i=1; i<=ns; i++) {
1438 if(fZlq[jtmed-i]==0) {
1444 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1445 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1448 //_____________________________________________________________________________
1449 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1450 Float_t phiy, Float_t thez, Float_t phiz)
1453 // krot rotation matrix number assigned
1454 // theta1 polar angle for axis i
1455 // phi1 azimuthal angle for axis i
1456 // theta2 polar angle for axis ii
1457 // phi2 azimuthal angle for axis ii
1458 // theta3 polar angle for axis iii
1459 // phi3 azimuthal angle for axis iii
1461 // it defines the rotation matrix number irot.
1463 Int_t jrotm=fGclink->jrotm;
1469 for(i=1; i<=ns; i++) {
1470 if(fZlq[jrotm-i]==0) {
1476 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1479 //_____________________________________________________________________________
1480 Int_t TGeant3::GetMedium() const
1483 // Return the number of the current medium
1485 return fGctmed->numed;
1488 //_____________________________________________________________________________
1489 Float_t TGeant3::Edep() const
1492 // Return the energy lost in the current step
1494 return fGctrak->destep;
1497 //_____________________________________________________________________________
1498 Float_t TGeant3::Etot() const
1501 // Return the total energy of the current track
1503 return fGctrak->getot;
1506 //_____________________________________________________________________________
1507 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1510 // Return an array of n random numbers uniformly distributed
1511 // between 0 and 1 not included
1516 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1518 // Functions from GBASE
1520 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1522 //____________________________________________________________________________
1523 void TGeant3::Gfile(const char *filename, const char *option)
1526 // Routine to open a GEANT/RZ data base.
1528 // LUN logical unit number associated to the file
1530 // CHFILE RZ file name
1532 // CHOPT is a character string which may be
1533 // N To create a new file
1534 // U to open an existing file for update
1535 // " " to open an existing file for read only
1536 // Q The initial allocation (default 1000 records)
1537 // is given in IQUEST(10)
1538 // X Open the file in exchange format
1539 // I Read all data structures from file to memory
1540 // O Write all data structures from memory to file
1543 // If options "I" or "O" all data structures are read or
1544 // written from/to file and the file is closed.
1545 // See routine GRMDIR to create subdirectories
1546 // See routines GROUT,GRIN to write,read objects
1548 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1552 //____________________________________________________________________________
1553 void TGeant3::Gpcxyz()
1556 // Print track and volume parameters at current point
1561 //_____________________________________________________________________________
1562 void TGeant3::Ggclos()
1565 // Closes off the geometry setting.
1566 // Initializes the search list for the contents of each
1567 // volume following the order they have been positioned, and
1568 // inserting the content '0' when a call to GSNEXT (-1) has
1569 // been required by the user.
1570 // Performs the development of the JVOLUM structure for all
1571 // volumes with variable parameters, by calling GGDVLP.
1572 // Interprets the user calls to GSORD, through GGORD.
1573 // Computes and stores in a bank (next to JVOLUM mother bank)
1574 // the number of levels in the geometrical tree and the
1575 // maximum number of contents per level, by calling GGNLEV.
1576 // Sets status bit for CONCAVE volumes, through GGCAVE.
1577 // Completes the JSET structure with the list of volume names
1578 // which identify uniquely a given physical detector, the
1579 // list of bit numbers to pack the corresponding volume copy
1580 // numbers, and the generic path(s) in the JVOLUM tree,
1581 // through the routine GHCLOS.
1584 // Create internal list of volumes
1585 fVolNames = new char[fGcnum->nvolum][5];
1587 for(i=0; i<fGcnum->nvolum; ++i) {
1588 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1589 fVolNames[i][4]='\0';
1593 //_____________________________________________________________________________
1594 void TGeant3::Glast()
1597 // Finish a Geant run
1602 //_____________________________________________________________________________
1603 void TGeant3::Gprint(const char *name)
1606 // Routine to print data structures
1607 // CHNAME name of a data structure
1611 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1614 //_____________________________________________________________________________
1615 void TGeant3::Grun()
1618 // Steering function to process one run
1623 //_____________________________________________________________________________
1624 void TGeant3::Gtrig()
1627 // Steering function to process one event
1632 //_____________________________________________________________________________
1633 void TGeant3::Gtrigc()
1636 // Clear event partition
1641 //_____________________________________________________________________________
1642 void TGeant3::Gtrigi()
1645 // Initialises event partition
1650 //_____________________________________________________________________________
1651 void TGeant3::Gwork(Int_t nwork)
1654 // Allocates workspace in ZEBRA memory
1659 //_____________________________________________________________________________
1660 void TGeant3::Gzinit()
1663 // To initialise GEANT/ZEBRA data structures
1668 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1670 // Functions from GCONS
1672 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1674 //_____________________________________________________________________________
1675 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1676 Float_t &dens, Float_t &radl, Float_t &absl,
1677 Float_t* ubuf, Int_t& nbuf)
1680 // Return parameters for material IMAT
1682 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1686 //_____________________________________________________________________________
1687 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1688 Float_t &amass, Float_t &charge, Float_t &tlife)
1691 // Return parameters for particle of type IPART
1695 Int_t igpart = IdFromPDG(ipart);
1696 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1700 //_____________________________________________________________________________
1701 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1702 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1703 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1704 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1707 // Return parameters for tracking medium NUMED
1709 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1710 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1713 //_____________________________________________________________________________
1714 void TGeant3::Gmate()
1717 // Define standard GEANT materials
1722 //_____________________________________________________________________________
1723 void TGeant3::Gpart()
1726 // Define standard GEANT particles plus selected decay modes
1727 // and branching ratios.
1732 //_____________________________________________________________________________
1733 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1735 // Defines branching ratios and decay modes for standard
1737 gsdk(ipart,bratio,mode);
1740 //_____________________________________________________________________________
1741 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1742 Float_t dens, Float_t radl, Float_t absl)
1745 // Defines a Material
1747 // kmat number assigned to the material
1748 // name material name
1749 // a atomic mass in au
1751 // dens density in g/cm3
1752 // absl absorbtion length in cm
1753 // if >=0 it is ignored and the program
1754 // calculates it, if <0. -absl is taken
1755 // radl radiation length in cm
1756 // if >=0 it is ignored and the program
1757 // calculates it, if <0. -radl is taken
1758 // buf pointer to an array of user words
1759 // nbuf number of user words
1763 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1767 //_____________________________________________________________________________
1768 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1769 Float_t dens, Int_t nlmat, Float_t *wmat)
1772 // Defines mixture OR COMPOUND IMAT as composed by
1773 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1775 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1776 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1778 // If NLMAT.LT.0 then WMAT contains the number of atoms
1779 // of a given kind into the molecule of the COMPOUND
1780 // In this case, WMAT in output is changed to relative
1783 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1786 //_____________________________________________________________________________
1787 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1788 Float_t amass, Float_t charge, Float_t tlife)
1791 // Store particle parameters
1793 // ipart particle code
1794 // name particle name
1795 // itrtyp transport method (see GEANT manual)
1796 // amass mass in GeV/c2
1797 // charge charge in electron units
1798 // tlife lifetime in seconds
1802 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1806 //_____________________________________________________________________________
1807 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1808 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1809 Float_t stemax, Float_t deemax, Float_t epsil,
1813 // NTMED Tracking medium number
1814 // NAME Tracking medium name
1815 // NMAT Material number
1816 // ISVOL Sensitive volume flag
1817 // IFIELD Magnetic field
1818 // FIELDM Max. field value (Kilogauss)
1819 // TMAXFD Max. angle due to field (deg/step)
1820 // STEMAX Max. step allowed
1821 // DEEMAX Max. fraction of energy lost in a step
1822 // EPSIL Tracking precision (cm)
1823 // STMIN Min. step due to continuos processes (cm)
1825 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1826 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1827 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1831 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1832 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1835 //_____________________________________________________________________________
1836 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1837 Float_t *absco, Float_t *effic, Float_t *rindex)
1840 // Stores the tables for UV photon tracking in medium ITMED
1841 // Please note that it is the user's responsability to
1842 // provide all the coefficients:
1845 // ITMED Tracking medium number
1846 // NPCKOV Number of bins of each table
1847 // PPCKOV Value of photon momentum (in GeV)
1848 // ABSCO Absorbtion coefficients
1849 // dielectric: absorbtion length in cm
1850 // metals : absorbtion fraction (0<=x<=1)
1851 // EFFIC Detection efficiency for UV photons
1852 // RINDEX Refraction index (if=0 metal)
1854 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1857 //_____________________________________________________________________________
1858 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1861 // To change the value of cut or mechanism "CHPAR"
1862 // to a new value PARVAL for tracking medium ITMED
1863 // The data structure JTMED contains the standard tracking
1864 // parameters (CUTS and flags to control the physics processes) which
1865 // are used by default for all tracking media. It is possible to
1866 // redefine individually with GSTPAR any of these parameters for a
1867 // given tracking medium.
1868 // ITMED tracking medium number
1869 // CHPAR is a character string (variable name)
1870 // PARVAL must be given as a floating point.
1872 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1875 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1877 // Functions from GCONS
1879 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1881 //_____________________________________________________________________________
1882 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1885 // Storing/Retrieving Vertex and Track parameters
1886 // ----------------------------------------------
1888 // Stores vertex parameters.
1889 // VERT array of (x,y,z) position of the vertex
1890 // NTBEAM beam track number origin of the vertex
1891 // =0 if none exists
1892 // NTTARG target track number origin of the vertex
1893 // UBUF user array of NUBUF floating point numbers
1895 // NVTX new vertex number (=0 in case of error).
1896 // Prints vertex parameters.
1897 // IVTX for vertex IVTX.
1898 // (For all vertices if IVTX=0)
1899 // Stores long life track parameters.
1900 // PLAB components of momentum
1901 // IPART type of particle (see GSPART)
1902 // NV vertex number origin of track
1903 // UBUF array of NUBUF floating point user parameters
1905 // NT track number (if=0 error).
1906 // Retrieves long life track parameters.
1907 // ITRA track number for which parameters are requested
1908 // VERT vector origin of the track
1909 // PVERT 4 momentum components at the track origin
1910 // IPART particle type (=0 if track ITRA does not exist)
1911 // NVERT vertex number origin of the track
1912 // UBUF user words stored in GSKINE.
1913 // Prints initial track parameters.
1914 // ITRA for track ITRA
1915 // (For all tracks if ITRA=0)
1919 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1922 //_____________________________________________________________________________
1923 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1927 // Retrieves the parameter of a vertex bank
1928 // Vertex is generated from tracks NTBEAM NTTARG
1929 // NVTX is the new vertex number
1933 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1936 //_____________________________________________________________________________
1937 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1941 // Store kinematics of track NT into data structure
1942 // Track is coming from vertex NV
1945 gskine(plab, ipart, nv, buf, nwbuf, nt);
1949 //_____________________________________________________________________________
1950 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1954 // Creates a new vertex bank
1955 // Vertex is generated from tracks NTBEAM NTTARG
1956 // NVTX is the new vertex number
1959 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1963 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1965 // Functions from GPHYS
1967 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1969 //_____________________________________________________________________________
1970 void TGeant3::Gphysi()
1973 // Initialise material constants for all the physics
1974 // mechanisms used by GEANT
1979 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1981 // Functions from GTRAK
1983 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1985 //_____________________________________________________________________________
1986 void TGeant3::Gdebug()
1989 // Debug the current step
1994 //_____________________________________________________________________________
1995 void TGeant3::Gekbin()
1998 // To find bin number in kinetic energy table
1999 // stored in ELOW(NEKBIN)
2004 //_____________________________________________________________________________
2005 void TGeant3::Gfinds()
2008 // Returns the set/volume parameters corresponding to
2009 // the current space point in /GCTRAK/
2010 // and fill common /GCSETS/
2012 // IHSET user set identifier
2013 // IHDET user detector identifier
2014 // ISET set number in JSET
2015 // IDET detector number in JS=LQ(JSET-ISET)
2016 // IDTYPE detector type (1,2)
2017 // NUMBV detector volume numbers (array of length NVNAME)
2018 // NVNAME number of volume levels
2023 //_____________________________________________________________________________
2024 void TGeant3::Gsking(Int_t igk)
2027 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2028 // or the NGKINE tracks when IGK is 0.
2033 //_____________________________________________________________________________
2034 void TGeant3::Gskpho(Int_t igk)
2037 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2038 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2043 //_____________________________________________________________________________
2044 void TGeant3::Gsstak(Int_t iflag)
2047 // Stores in auxiliary stack JSTAK the particle currently
2048 // described in common /GCKINE/.
2050 // On request, creates also an entry in structure JKINE :
2052 // 0 : No entry in JKINE structure required (user)
2053 // 1 : New entry in JVERTX / JKINE structures required (user)
2054 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2055 // 2 : Entry in JKINE structure exists already (from GTREVE)
2060 //_____________________________________________________________________________
2061 void TGeant3::Gsxyz()
2064 // Store space point VECT in banks JXYZ
2069 //_____________________________________________________________________________
2070 void TGeant3::Gtrack()
2073 // Controls tracking of current particle
2078 //_____________________________________________________________________________
2079 void TGeant3::Gtreve()
2082 // Controls tracking of all particles belonging to the current event
2087 //_____________________________________________________________________________
2088 void TGeant3::Gtreve_root()
2091 // Controls tracking of all particles belonging to the current event
2096 //_____________________________________________________________________________
2097 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2100 // To generate a vector RVECV of LEN random numbers
2101 // Copy of the CERN Library routine RANECU
2105 //_____________________________________________________________________________
2106 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2107 const Text_t *chopt)
2110 // To set/retrieve the seed of the random number generator
2112 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2115 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2117 // Functions from GDRAW
2119 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2121 //_____________________________________________________________________________
2122 void TGeant3::Gdxyz(Int_t it)
2125 // Draw the points stored with Gsxyz relative to track it
2130 //_____________________________________________________________________________
2131 void TGeant3::Gdcxyz()
2134 // Draw the position of the current track
2139 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2141 // Functions from GGEOM
2143 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2145 //_____________________________________________________________________________
2146 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2149 // Computes coordinates XM (Master Reference System
2150 // knowing the coordinates XD (Detector Ref System)
2151 // The local reference system can be initialized by
2152 // - the tracking routines and GDTOM used in GUSTEP
2153 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2154 // (inverse routine is GMTOD)
2156 // If IFLAG=1 convert coordinates
2157 // IFLAG=2 convert direction cosinus
2159 gdtom(xd, xm, iflag);
2162 //_____________________________________________________________________________
2163 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2167 // Loads the top part of the Volume tree in LVOLS (IVO's),
2168 // LINDX (IN indices) for a given volume defined through
2169 // its name IUDET and number IUNUM.
2171 // The routine stores only upto the last level where JVOLUM
2172 // data structure is developed. If there is no development
2173 // above the current level, it returns NLEV zero.
2175 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2178 //_____________________________________________________________________________
2179 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2182 // Finds in which volume/medium the point X is, and updates the
2183 // common /GCVOLU/ and the structure JGPAR accordingly.
2185 // NUMED returns the tracking medium number, or 0 if point is
2186 // outside the experimental setup.
2191 //_____________________________________________________________________________
2192 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2195 // Computes coordinates XD (in DRS)
2196 // from known coordinates XM in MRS
2197 // The local reference system can be initialized by
2198 // - the tracking routines and GMTOD used in GUSTEP
2199 // - a call to GMEDIA(XM,NUMED)
2200 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2201 // (inverse routine is GDTOM)
2203 // If IFLAG=1 convert coordinates
2204 // IFLAG=2 convert direction cosinus
2206 gmtod(xm, xd, iflag);
2209 //_____________________________________________________________________________
2210 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2214 // Create a new volume by dividing an existing one
2217 // MOTHER Mother volume name
2218 // NDIV Number of divisions
2221 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2222 // It divides a previously defined volume.
2227 Vname(mother,vmother);
2228 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2229 PASSCHARL(vmother));
2232 //_____________________________________________________________________________
2233 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2234 Int_t iaxis, Float_t c0i, Int_t numed)
2237 // Create a new volume by dividing an existing one
2239 // Divides mother into ndiv divisions called name
2240 // along axis iaxis starting at coordinate value c0.
2241 // the new volume created will be medium number numed.
2246 Vname(mother,vmother);
2247 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2248 PASSCHARL(vname) PASSCHARL(vmother));
2251 //_____________________________________________________________________________
2252 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2253 Int_t iaxis, Int_t numed)
2256 // Create a new volume by dividing an existing one
2261 Vname(mother,vmother);
2262 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2263 PASSCHARL(vname) PASSCHARL(vmother));
2266 //_____________________________________________________________________________
2267 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2268 Int_t iaxis, Float_t c0, Int_t numed)
2271 // Create a new volume by dividing an existing one
2276 Vname(mother,vmother);
2277 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2278 PASSCHARL(vname) PASSCHARL(vmother));
2281 //_____________________________________________________________________________
2282 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2283 Int_t iaxis, Int_t numed, Int_t ndvmx)
2286 // Create a new volume by dividing an existing one
2288 // Divides MOTHER into divisions called NAME along
2289 // axis IAXIS in steps of STEP. If not exactly divisible
2290 // will make as many as possible and will centre them
2291 // with respect to the mother. Divisions will have medium
2292 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2293 // NDVMX is the expected maximum number of divisions
2294 // (If 0, no protection tests are performed)
2299 Vname(mother,vmother);
2300 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2301 PASSCHARL(vname) PASSCHARL(vmother));
2304 //_____________________________________________________________________________
2305 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2306 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2309 // Create a new volume by dividing an existing one
2311 // Divides MOTHER into divisions called NAME along
2312 // axis IAXIS starting at coordinate value C0 with step
2314 // The new volume created will have medium number NUMED.
2315 // If NUMED is 0, NUMED of mother is taken.
2316 // NDVMX is the expected maximum number of divisions
2317 // (If 0, no protection tests are performed)
2322 Vname(mother,vmother);
2323 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2324 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2327 //_____________________________________________________________________________
2328 void TGeant3::Gsord(const char *name, Int_t iax)
2331 // Flags volume CHNAME whose contents will have to be ordered
2332 // along axis IAX, by setting the search flag to -IAX
2336 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2337 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2338 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2339 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2340 // IAX = 6 PHI (PHI=0 => X axis)
2341 // IAX = 7 THETA (THETA=0 => Z axis)
2345 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2348 //_____________________________________________________________________________
2349 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2350 Float_t y, Float_t z, Int_t irot, const char *konly)
2353 // Position a volume into an existing one
2356 // NUMBER Copy number of the volume
2357 // MOTHER Mother volume name
2358 // X X coord. of the volume in mother ref. sys.
2359 // Y Y coord. of the volume in mother ref. sys.
2360 // Z Z coord. of the volume in mother ref. sys.
2361 // IROT Rotation matrix number w.r.t. mother ref. sys.
2362 // ONLY ONLY/MANY flag
2364 // It positions a previously defined volume in the mother.
2369 Vname(mother,vmother);
2370 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2371 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2375 //_____________________________________________________________________________
2376 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2377 Float_t x, Float_t y, Float_t z, Int_t irot,
2378 const char *konly, Float_t *upar, Int_t np )
2381 // Place a copy of generic volume NAME with user number
2382 // NR inside MOTHER, with its parameters UPAR(1..NP)
2387 Vname(mother,vmother);
2388 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2389 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2393 //_____________________________________________________________________________
2394 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2395 Float_t phi2, Float_t theta3, Float_t phi3)
2398 // nmat Rotation matrix number
2399 // THETA1 Polar angle for axis I
2400 // PHI1 Azimuthal angle for axis I
2401 // THETA2 Polar angle for axis II
2402 // PHI2 Azimuthal angle for axis II
2403 // THETA3 Polar angle for axis III
2404 // PHI3 Azimuthal angle for axis III
2406 // It defines the rotation matrix number IROT.
2408 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2411 //_____________________________________________________________________________
2412 void TGeant3::Gprotm(Int_t nmat)
2415 // To print rotation matrices structure JROTM
2416 // nmat Rotation matrix number
2421 //_____________________________________________________________________________
2422 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2423 Float_t *upar, Int_t npar)
2427 // SHAPE Volume type
2428 // NUMED Tracking medium number
2429 // NPAR Number of shape parameters
2430 // UPAR Vector containing shape parameters
2432 // It creates a new volume in the JVOLUM data structure.
2438 Vname(shape,vshape);
2439 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2440 PASSCHARL(vname) PASSCHARL(vshape));
2444 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2446 // T H E D R A W I N G P A C K A G E
2447 // ======================================
2448 // Drawing functions. These functions allow the visualization in several ways
2449 // of the volumes defined in the geometrical data structure. It is possible
2450 // to draw the logical tree of volumes belonging to the detector (DTREE),
2451 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2452 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2453 // these commands when the hidden line removal option is activated; in
2454 // this case, the volumes can be also either translated in the space
2455 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2456 // possible to fill the surfaces of the volumes
2457 // with solid colours when the shading option (SHAD) is activated.
2458 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2459 // of the detectors or to scan physical events as well.
2460 // Finally, the command MOVE will allow the rotation, translation and zooming
2461 // on real time parts of the detectors or tracks and hits of a simulated event.
2462 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2463 // the drawing is performed by the Geant ray-tracing;
2464 // automatically, the color is assigned according to the tracking medium of each
2465 // volume and the volumes with a density lower/equal than the air are considered
2466 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2467 // the user can set color and visibility for the desired volumes via the command
2468 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2469 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2470 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2471 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2472 // first case, we assume that the first mother volume of the tree is a box with
2473 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2474 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2475 // second case, the distance between the observer and the origin of the world
2476 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2477 // or telescopic effects can be achieved changing the scale factors in the command
2478 // (DRAW). When the final picture does not occupy the full window,
2479 // mapping the space before tracing can speed up the drawing, but can also
2480 // produce less precise results; values from 1 to 4 are allowed in the command
2481 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2482 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2483 // The command (VALCUT) allows the cutting of the detector by three planes
2484 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2485 // SATT for any desired volume and can assume values from 0 to 7; it determines
2486 // the different light processing to be performed for different materials:
2487 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2488 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2489 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2490 // is 0.9) and the observer is assumed to have a light source (therefore he will
2491 // produce parallel light in the case of parallel view and point-like-source
2492 // light in the case of perspective view).
2494 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2496 //_____________________________________________________________________________
2497 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2501 // IOPT Name of the attribute to be set
2502 // IVAL Value to which the attribute is to be set
2504 // name= "*" stands for all the volumes.
2505 // iopt can be chosen among the following :
2507 // WORK 0=volume name is inactive for the tracking
2508 // 1=volume name is active for the tracking (default)
2510 // SEEN 0=volume name is invisible
2511 // 1=volume name is visible (default)
2512 // -1=volume invisible with all its descendants in the tree
2513 // -2=volume visible but not its descendants in the tree
2515 // LSTY line style 1,2,3,... (default=1)
2516 // LSTY=7 will produce a very precise approximation for
2517 // revolution bodies.
2519 // LWID line width -7,...,1,2,3,..7 (default=1)
2520 // LWID<0 will act as abs(LWID) was set for the volume
2521 // and for all the levels below it. When SHAD is 'ON', LWID
2522 // represent the linewidth of the scan lines filling the surfaces
2523 // (whereas the FILL value represent their number). Therefore
2524 // tuning this parameter will help to obtain the desired
2525 // quality/performance ratio.
2527 // COLO colour code -166,...,1,2,..166 (default=1)
2529 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2530 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2531 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2532 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2533 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2534 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2535 // colour=n*10+m, m=1,2,...9, will produce the same colour
2536 // as 'n', but with increasing luminosity according to 'm';
2537 // COLO<0 will act as if abs(COLO) was set for the volume
2538 // and for all the levels below it.
2539 // When for a volume the attribute FILL is > 1 (and the
2540 // option SHAD is on), the ABS of its colour code must be < 8
2541 // because an automatic shading of its faces will be
2544 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2545 // when option SHAD is "on" the FILL attribute of any
2546 // volume can be set different from 0 (normal drawing);
2547 // if it is set to 1, the faces of such volume will be filled
2548 // with solid colours; if ABS(FILL) is > 1, then a light
2549 // source is placed along the observer line, and the faces of
2550 // such volumes will be painted by colours whose luminosity
2551 // will depend on the amount of light reflected;
2552 // if ABS(FILL) = 1, then it is possible to use all the 166
2553 // colours of the colour table, becouse the automatic shading
2554 // is not performed;
2555 // for increasing values of FILL the drawing will be performed
2556 // with higher and higher resolution improving the quality (the
2557 // number of scan lines used to fill the faces increases with FILL);
2558 // it is possible to set different values of FILL
2559 // for different volumes, in order to optimize at the same time
2560 // the performance and the quality of the picture;
2561 // FILL<0 will act as if abs(FILL) was set for the volume
2562 // and for all the levels below it.
2563 // This kind of drawing can be saved in 'picture files'
2564 // or in view banks.
2565 // 0=drawing without fill area
2566 // 1=faces filled with solid colours and resolution = 6
2567 // 2=lowest resolution (very fast)
2568 // 3=default resolution
2569 // 4=.................
2570 // 5=.................
2571 // 6=.................
2573 // Finally, if a coloured background is desired, the FILL
2574 // attribute for the first volume of the tree must be set
2575 // equal to -abs(colo), colo being >0 and <166.
2577 // SET set number associated to volume name
2578 // DET detector number associated to volume name
2579 // DTYP detector type (1,2)
2586 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2590 //_____________________________________________________________________________
2591 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2592 Int_t& natt, Float_t* par, Float_t* att)
2595 // Find the parameters of a volume
2597 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2601 //_____________________________________________________________________________
2602 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2605 // Check the parameters of a shape
2607 gckpar(ish,npar,par);
2610 //_____________________________________________________________________________
2611 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2614 // Check the parameters of a tracking medium
2616 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2619 //_____________________________________________________________________________
2620 void TGeant3::Gdelete(Int_t iview)
2623 // IVIEW View number
2625 // It deletes a view bank from memory.
2630 //_____________________________________________________________________________
2631 void TGeant3::Gdopen(Int_t iview)
2634 // IVIEW View number
2636 // When a drawing is very complex and requires a long time to be
2637 // executed, it can be useful to store it in a view bank: after a
2638 // call to DOPEN and the execution of the drawing (nothing will
2639 // appear on the screen), and after a necessary call to DCLOSE,
2640 // the contents of the bank can be displayed in a very fast way
2641 // through a call to DSHOW; therefore, the detector can be easily
2642 // zoomed many times in different ways. Please note that the pictures
2643 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2650 //_____________________________________________________________________________
2651 void TGeant3::Gdclose()
2654 // It closes the currently open view bank; it must be called after the
2655 // end of the drawing to be stored.
2660 //_____________________________________________________________________________
2661 void TGeant3::Gdshow(Int_t iview)
2664 // IVIEW View number
2666 // It shows on the screen the contents of a view bank. It
2667 // can be called after a view bank has been closed.
2672 //_____________________________________________________________________________
2673 void TGeant3::Gdopt(const char *name,const char *value)
2677 // VALUE Option value
2679 // To set/modify the drawing options.
2682 // THRZ ON Draw tracks in R vs Z
2683 // OFF (D) Draw tracks in X,Y,Z
2686 // PROJ PARA (D) Parallel projection
2688 // TRAK LINE (D) Trajectory drawn with lines
2689 // POIN " " with markers
2690 // HIDE ON Hidden line removal using the CG package
2691 // OFF (D) No hidden line removal
2692 // SHAD ON Fill area and shading of surfaces.
2693 // OFF (D) Normal hidden line removal.
2694 // RAYT ON Ray-tracing on.
2695 // OFF (D) Ray-tracing off.
2696 // EDGE OFF Does not draw contours when shad is on.
2697 // ON (D) Normal shading.
2698 // MAPP 1,2,3,4 Mapping before ray-tracing.
2699 // 0 (D) No mapping.
2700 // USER ON User graphics options in the raytracing.
2701 // OFF (D) Automatic graphics options.
2707 Vname(value,vvalue);
2708 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2712 //_____________________________________________________________________________
2713 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2714 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2719 // THETA Viewing angle theta (for 3D projection)
2720 // PHI Viewing angle phi (for 3D projection)
2721 // PSI Viewing angle psi (for 2D rotation)
2722 // U0 U-coord. (horizontal) of volume origin
2723 // V0 V-coord. (vertical) of volume origin
2724 // SU Scale factor for U-coord.
2725 // SV Scale factor for V-coord.
2727 // This function will draw the volumes,
2728 // selected with their graphical attributes, set by the Gsatt
2729 // facility. The drawing may be performed with hidden line removal
2730 // and with shading effects according to the value of the options HIDE
2731 // and SHAD; if the option SHAD is ON, the contour's edges can be
2732 // drawn or not. If the option HIDE is ON, the detector can be
2733 // exploded (BOMB), clipped with different shapes (CVOL), and some
2734 // of its parts can be shifted from their original
2735 // position (SHIFT). When HIDE is ON, if
2736 // the drawing requires more than the available memory, the program
2737 // will evaluate and display the number of missing words
2738 // (so that the user can increase the
2739 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2740 // the program will print messages about the memory used and
2741 // statistics on the volumes' visibility.
2742 // The following commands will produce the drawing of a green
2743 // volume, specified by NAME, without using the hidden line removal
2744 // technique, using the hidden line removal technique,
2745 // with different linewidth and colour (red), with
2746 // solid colour, with shading of surfaces, and without edges.
2747 // Finally, some examples are given for the ray-tracing. (A possible
2748 // string for the NAME of the volume can be found using the command DTREE).
2754 if (fGcvdma->raytra != 1) {
2755 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2757 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2761 //_____________________________________________________________________________
2762 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2763 Float_t v0,Float_t ul,Float_t vl)
2768 // CUTVAL Cut plane distance from the origin along the axis
2770 // U0 U-coord. (horizontal) of volume origin
2771 // V0 V-coord. (vertical) of volume origin
2772 // SU Scale factor for U-coord.
2773 // SV Scale factor for V-coord.
2775 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2776 // and placed at the distance cutval from the origin.
2777 // The resulting picture is seen from the the same axis.
2778 // When HIDE Mode is ON, it is possible to get the same effect with
2779 // the CVOL/BOX function.
2785 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2788 //_____________________________________________________________________________
2789 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2790 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2791 Float_t v0,Float_t ul,Float_t vl)
2795 // CUTTHE Theta angle of the line normal to cut plane
2796 // CUTPHI Phi angle of the line normal to cut plane
2797 // CUTVAL Cut plane distance from the origin along the axis
2799 // THETA Viewing angle theta (for 3D projection)
2800 // PHI Viewing angle phi (for 3D projection)
2801 // U0 U-coord. (horizontal) of volume origin
2802 // V0 V-coord. (vertical) of volume origin
2803 // SU Scale factor for U-coord.
2804 // SV Scale factor for V-coord.
2806 // The cut plane is normal to the line given by the cut angles
2807 // cutthe and cutphi and placed at the distance cutval from the origin.
2808 // The resulting picture is seen from the viewing angles theta,phi.
2814 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2818 //_____________________________________________________________________________
2819 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2824 // ISEL Option flag D=111110
2826 // CHRSIZ Character size (cm) of title NAME D=0.6
2829 // 0 to have only the header lines
2830 // xxxxx1 to add the text name centered on top of header
2831 // xxxx1x to add global detector name (first volume) on left
2832 // xxx1xx to add date on right
2833 // xx1xxx to select thick characters for text on top of header
2834 // x1xxxx to add the text 'EVENT NR x' on top of header
2835 // 1xxxxx to add the text 'RUN NR x' on top of header
2836 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2837 // i.e. they generate overwritten text.
2839 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2842 //_____________________________________________________________________________
2843 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2846 // Draw a 2D-man at position (U0,V0)
2848 // U U-coord. (horizontal) of the centre of man' R
2849 // V V-coord. (vertical) of the centre of man' R
2850 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2852 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2853 // It superimposes the picure of a man or of a woman, chosen among
2854 // three different ones, with the same scale factors as the detector
2855 // in the current drawing.
2858 if (opt.Contains("WM1")) {
2860 } else if (opt.Contains("WM3")) {
2862 } else if (opt.Contains("WM2")) {
2869 //_____________________________________________________________________________
2870 void TGeant3::Gdspec(const char *name)
2875 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2876 // its geometrical specifications. The 3D drawing will
2877 // be performed according the current values of the options HIDE and
2878 // SHAD and according the current SetClipBox clipping parameters for that
2885 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2888 //_____________________________________________________________________________
2889 void TGeant3::DrawOneSpec(const char *name)
2892 // Function called when one double-clicks on a volume name
2893 // in a TPavelabel drawn by Gdtree.
2895 THIGZ *higzSave = higz;
2896 higzSave->SetName("higzSave");
2897 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2898 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2899 if (higzSpec) higz = higzSpec;
2900 else higzSpec = new THIGZ(defSize);
2901 higzSpec->SetName("higzSpec");
2906 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2909 higzSave->SetName("higz");
2913 //_____________________________________________________________________________
2914 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2918 // LEVMAX Depth level
2921 // This function draws the logical tree,
2922 // Each volume in the tree is represented by a TPaveTree object.
2923 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2924 // Use TPaveTree pop-up menu to select:
2927 // - drawing tree of parent
2933 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2937 //_____________________________________________________________________________
2938 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2942 // LEVMAX Depth level
2945 // This function draws the logical tree of the parent of name.
2949 // Scan list of volumes in JVOLUM
2951 Int_t gname, i, jvo, in, nin, jin, num;
2952 strncpy((char *) &gname, name, 4);
2953 for(i=1; i<=fGcnum->nvolum; i++) {
2954 jvo = fZlq[fGclink->jvolum-i];
2955 nin = Int_t(fZq[jvo+3]);
2956 if (nin == -1) nin = 1;
2957 for (in=1;in<=nin;in++) {
2959 num = Int_t(fZq[jin+2]);
2960 if(gname == fZiq[fGclink->jvolum+num]) {
2961 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2963 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2971 //_____________________________________________________________________________
2972 void TGeant3::SetABAN(Int_t par)
2975 // par = 1 particles will be stopped according to their residual
2976 // range if they are not in a sensitive material and are
2977 // far enough from the boundary
2978 // 0 particles are transported normally
2980 fGcphys->dphys1 = par;
2984 //_____________________________________________________________________________
2985 void TGeant3::SetANNI(Int_t par)
2988 // To control positron annihilation.
2989 // par =0 no annihilation
2990 // =1 annihilation. Decays processed.
2991 // =2 annihilation. No decay products stored.
2993 fGcphys->ianni = par;
2997 //_____________________________________________________________________________
2998 void TGeant3::SetAUTO(Int_t par)
3001 // To control automatic calculation of tracking medium parameters:
3002 // par =0 no automatic calculation;
3003 // =1 automati calculation.
3005 fGctrak->igauto = par;
3009 //_____________________________________________________________________________
3010 void TGeant3::SetBOMB(Float_t boom)
3013 // BOOM : Exploding factor for volumes position
3015 // To 'explode' the detector. If BOOM is positive (values smaller
3016 // than 1. are suggested, but any value is possible)
3017 // all the volumes are shifted by a distance
3018 // proportional to BOOM along the direction between their centre
3019 // and the origin of the MARS; the volumes which are symmetric
3020 // with respect to this origin are simply not shown.
3021 // BOOM equal to 0 resets the normal mode.
3022 // A negative (greater than -1.) value of
3023 // BOOM will cause an 'implosion'; for even lower values of BOOM
3024 // the volumes' positions will be reflected respect to the origin.
3025 // This command can be useful to improve the 3D effect for very
3026 // complex detectors. The following commands will make explode the
3033 //_____________________________________________________________________________
3034 void TGeant3::SetBREM(Int_t par)
3037 // To control bremstrahlung.
3038 // par =0 no bremstrahlung
3039 // =1 bremstrahlung. Photon processed.
3040 // =2 bremstrahlung. No photon stored.
3042 fGcphys->ibrem = par;
3046 //_____________________________________________________________________________
3047 void TGeant3::SetCKOV(Int_t par)
3050 // To control Cerenkov production
3051 // par =0 no Cerenkov;
3053 // =2 Cerenkov with primary stopped at each step.
3055 fGctlit->itckov = par;
3059 //_____________________________________________________________________________
3060 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3061 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3064 // The hidden line removal technique is necessary to visualize properly
3065 // very complex detectors. At the same time, it can be useful to visualize
3066 // the inner elements of a detector in detail. This function allows
3067 // subtractions (via boolean operation) of BOX shape from any part of
3068 // the detector, therefore showing its inner contents.
3069 // If "*" is given as the name of the
3070 // volume to be clipped, all volumes are clipped by the given box.
3071 // A volume can be clipped at most twice.
3072 // if a volume is explicitely clipped twice,
3073 // the "*" will not act on it anymore. Giving "." as the name
3074 // of the volume to be clipped will reset the clipping.
3076 // NAME Name of volume to be clipped
3078 // XMIN Lower limit of the Shape X coordinate
3079 // XMAX Upper limit of the Shape X coordinate
3080 // YMIN Lower limit of the Shape Y coordinate
3081 // YMAX Upper limit of the Shape Y coordinate
3082 // ZMIN Lower limit of the Shape Z coordinate
3083 // ZMAX Upper limit of the Shape Z coordinate
3085 // This function performs a boolean subtraction between the volume
3086 // NAME and a box placed in the MARS according the values of the given
3092 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3095 //_____________________________________________________________________________
3096 void TGeant3::SetCOMP(Int_t par)
3099 // To control Compton scattering
3100 // par =0 no Compton
3101 // =1 Compton. Electron processed.
3102 // =2 Compton. No electron stored.
3105 fGcphys->icomp = par;
3108 //_____________________________________________________________________________
3109 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3110 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3111 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3112 Float_t ppcutm, Float_t tofmax)
3115 // CUTGAM Cut for gammas D=0.001
3116 // CUTELE Cut for electrons D=0.001
3117 // CUTHAD Cut for charged hadrons D=0.01
3118 // CUTNEU Cut for neutral hadrons D=0.01
3119 // CUTMUO Cut for muons D=0.01
3120 // BCUTE Cut for electron brems. D=-1.
3121 // BCUTM Cut for muon brems. D=-1.
3122 // DCUTE Cut for electron delta-rays D=-1.
3123 // DCUTM Cut for muon delta-rays D=-1.
3124 // PPCUTM Cut for e+e- pairs by muons D=0.01
3125 // TOFMAX Time of flight cut D=1.E+10
3127 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3128 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3130 // If one of the parameters from CUTGAM to PPCUTM included
3131 // is modified, cross-sections and energy loss tables must be
3132 // recomputed via the function Gphysi.
3134 fGccuts->cutgam = cutgam;
3135 fGccuts->cutele = cutele;
3136 fGccuts->cutneu = cutneu;
3137 fGccuts->cuthad = cuthad;
3138 fGccuts->cutmuo = cutmuo;
3139 fGccuts->bcute = bcute;
3140 fGccuts->bcutm = bcutm;
3141 fGccuts->dcute = dcute;
3142 fGccuts->dcutm = dcutm;
3143 fGccuts->ppcutm = ppcutm;
3144 fGccuts->tofmax = tofmax;
3147 //_____________________________________________________________________________
3148 void TGeant3::SetDCAY(Int_t par)
3151 // To control Decay mechanism.
3152 // par =0 no decays.
3153 // =1 Decays. secondaries processed.
3154 // =2 Decays. No secondaries stored.
3156 fGcphys->idcay = par;
3160 //_____________________________________________________________________________
3161 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3164 // Set the debug flag and frequency
3165 // Selected debug output will be printed from
3166 // event emin to even emax each emod event
3168 fGcflag->idemin = emin;
3169 fGcflag->idemax = emax;
3170 fGcflag->itest = emod;
3174 //_____________________________________________________________________________
3175 void TGeant3::SetDRAY(Int_t par)
3178 // To control delta rays mechanism.
3179 // par =0 no delta rays.
3180 // =1 Delta rays. secondaries processed.
3181 // =2 Delta rays. No secondaries stored.
3183 fGcphys->idray = par;
3186 //_____________________________________________________________________________
3187 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3190 // To control cross section tabulations
3191 // ekmin = minimum kinetic energy in GeV
3192 // ekmax = maximum kinetic energy in GeV
3193 // nekbin = number of logatithmic bins (<200)
3195 fGcmulo->ekmin = ekmin;
3196 fGcmulo->ekmax = ekmax;
3197 fGcmulo->nekbin = nekbin;
3200 //_____________________________________________________________________________
3201 void TGeant3::SetHADR(Int_t par)
3204 // To control hadronic interactions.
3205 // par =0 no hadronic interactions.
3206 // =1 Hadronic interactions. secondaries processed.
3207 // =2 Hadronic interactions. No secondaries stored.
3209 fGcphys->ihadr = par;
3212 //_____________________________________________________________________________
3213 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3214 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3215 Float_t xk8, Float_t xk9, Float_t xk10)
3218 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3219 // Their meaning is user defined
3221 fGckine->ikine = kine;
3222 fGckine->pkine[0] = xk1;
3223 fGckine->pkine[1] = xk2;
3224 fGckine->pkine[2] = xk3;
3225 fGckine->pkine[3] = xk4;
3226 fGckine->pkine[4] = xk5;
3227 fGckine->pkine[5] = xk6;
3228 fGckine->pkine[6] = xk7;
3229 fGckine->pkine[7] = xk8;
3230 fGckine->pkine[8] = xk9;
3231 fGckine->pkine[9] = xk10;
3234 //_____________________________________________________________________________
3235 void TGeant3::SetLOSS(Int_t par)
3238 // To control energy loss.
3239 // par =0 no energy loss;
3240 // =1 restricted energy loss fluctuations;
3241 // =2 complete energy loss fluctuations;
3243 // =4 no energy loss fluctuations.
3244 // If the value ILOSS is changed, then cross-sections and energy loss
3245 // tables must be recomputed via the command 'PHYSI'.
3247 fGcphys->iloss = par;
3251 //_____________________________________________________________________________
3252 void TGeant3::SetMULS(Int_t par)
3255 // To control multiple scattering.
3256 // par =0 no multiple scattering.
3257 // =1 Moliere or Coulomb scattering.
3258 // =2 Moliere or Coulomb scattering.
3259 // =3 Gaussian scattering.
3261 fGcphys->imuls = par;
3265 //_____________________________________________________________________________
3266 void TGeant3::SetMUNU(Int_t par)
3269 // To control muon nuclear interactions.
3270 // par =0 no muon-nuclear interactions.
3271 // =1 Nuclear interactions. Secondaries processed.
3272 // =2 Nuclear interactions. Secondaries not processed.
3274 fGcphys->imunu = par;
3277 //_____________________________________________________________________________
3278 void TGeant3::SetOPTI(Int_t par)
3281 // This flag controls the tracking optimisation performed via the
3283 // 1 no optimisation at all; GSORD calls disabled;
3284 // 0 no optimisation; only user calls to GSORD kept;
3285 // 1 all non-GSORDered volumes are ordered along the best axis;
3286 // 2 all volumes are ordered along the best axis.
3288 fGcopti->ioptim = par;
3291 //_____________________________________________________________________________
3292 void TGeant3::SetPAIR(Int_t par)
3295 // To control pair production mechanism.
3296 // par =0 no pair production.
3297 // =1 Pair production. secondaries processed.
3298 // =2 Pair production. No secondaries stored.
3300 fGcphys->ipair = par;
3304 //_____________________________________________________________________________
3305 void TGeant3::SetPFIS(Int_t par)
3308 // To control photo fission mechanism.
3309 // par =0 no photo fission.
3310 // =1 Photo fission. secondaries processed.
3311 // =2 Photo fission. No secondaries stored.
3313 fGcphys->ipfis = par;
3316 //_____________________________________________________________________________
3317 void TGeant3::SetPHOT(Int_t par)
3320 // To control Photo effect.
3321 // par =0 no photo electric effect.
3322 // =1 Photo effect. Electron processed.
3323 // =2 Photo effect. No electron stored.
3325 fGcphys->iphot = par;
3328 //_____________________________________________________________________________
3329 void TGeant3::SetRAYL(Int_t par)
3332 // To control Rayleigh scattering.
3333 // par =0 no Rayleigh scattering.
3336 fGcphys->irayl = par;
3339 //_____________________________________________________________________________
3340 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3344 // val New switch value
3346 // Change one element of array ISWIT(10) in /GCFLAG/
3348 if (sw <= 0 || sw > 10) return;
3349 fGcflag->iswit[sw-1] = val;
3353 //_____________________________________________________________________________
3354 void TGeant3::SetTRIG(Int_t nevents)
3357 // Set number of events to be run
3359 fGcflag->nevent = nevents;
3362 //_____________________________________________________________________________
3363 void TGeant3::SetUserDecay(Int_t pdg)
3366 // Force the decays of particles to be done with Pythia
3367 // and not with the Geant routines.
3368 // just kill pointers doing mzdrop
3370 Int_t ipart = IdFromPDG(pdg);
3372 printf("Particle %d not in geant\n",pdg);
3375 Int_t jpart=fGclink->jpart;
3376 Int_t jpa=fZlq[jpart-ipart];
3379 Int_t jpa1=fZlq[jpa-1];
3381 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3382 Int_t jpa2=fZlq[jpa-2];
3384 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3388 //______________________________________________________________________________
3389 void TGeant3::Vname(const char *name, char *vname)
3392 // convert name to upper case. Make vname at least 4 chars
3394 Int_t l = strlen(name);
3397 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3398 for (i=l;i<4;i++) vname[i] = ' ';
3402 //______________________________________________________________________________
3403 void TGeant3::Ertrgo()
3408 //______________________________________________________________________________
3409 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3410 const Float_t *x2, const Float_t *p2,
3411 Int_t ipa, Option_t *chopt)
3413 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3416 //_____________________________________________________________________________
3417 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3418 Int_t number, Int_t nlevel)
3422 // ******************************************************************
3424 // * Write out the geometry of the detector in EUCLID file format *
3426 // * filnam : will be with the extension .euc *
3427 // * topvol : volume name of the starting node *
3428 // * number : copy number of topvol (relevant for gsposp) *
3429 // * nlevel : number of levels in the tree structure *
3430 // * to be written out, starting from topvol *
3432 // * Author : M. Maire *
3434 // ******************************************************************
3436 // File filnam.tme is written out with the definitions of tracking
3437 // medias and materials.
3438 // As to restore original numbers for materials and medias, program
3439 // searches in the file euc_medi.dat and comparing main parameters of
3440 // the mat. defined inside geant and the one in file recognizes them
3441 // and is able to take number from file. If for any material or medium,
3442 // this procedure fails, ordering starts from 1.
3443 // Arrays IOTMED and IOMATE are used for this procedure
3445 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3446 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3448 Int_t i, end, itm, irm, jrm, k, nmed;
3452 char *filext, *filetme;
3453 char natmed[21], namate[21];
3454 char natmedc[21], namatec[21];
3455 char key[5], name[5], mother[5], konly[5];
3457 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3458 Int_t mlevel, numbr, natt, numed, nin, ndata;
3459 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3460 Int_t jdiv, ivin, in, jin, jvin, irot;
3461 Int_t jtm, imat, jma, flag=0, imatc;
3462 Float_t az, dens, radl, absl, a, step, x, y, z;
3463 Int_t npar, ndvmx, left;
3464 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3466 Int_t iomate[100], iotmed[100];
3467 Float_t par[50], att[20], ubuf[50];
3470 Int_t level, ndiv, iaxe;
3471 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3472 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3473 Float_t tmaxf, stemax, deemax, epsil, stmin;
3474 const char *f10000="!\n%s\n!\n";
3475 //Open the input file
3477 for(i=0;i<end;i++) if(filnam[i]=='.') {
3481 filext=new char[end+5];
3482 filetme=new char[end+5];
3483 strncpy(filext,filnam,end);
3484 strncpy(filetme,filnam,end);
3486 // *** The output filnam name will be with extension '.euc'
3487 strcpy(&filext[end],".euc");
3488 strcpy(&filetme[end],".tme");
3489 lun=fopen(filext,"w");
3491 // *** Initialisation of the working space
3492 iadvol=fGcnum->nvolum;
3493 iadtmd=iadvol+fGcnum->nvolum;
3494 iadrot=iadtmd+fGcnum->ntmed;
3495 if(fGclink->jrotm) {
3496 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3500 nwtot=iadrot+fGcnum->nrotm;
3501 qws = new float[nwtot+1];
3502 for (i=0;i<nwtot+1;i++) qws[i]=0;
3505 if(nlevel==0) mlevel=20;
3507 // *** find the top volume and put it in the stak
3508 numbr = number>0 ? number : 1;
3509 Gfpara(topvol,numbr,1,npar,natt,par,att);
3511 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3516 // *** authorized shape ?
3517 strncpy((char *)&iname, topvol, 4);
3519 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3523 jvo = fZlq[fGclink->jvolum-ivo];
3524 ish = Int_t (fZq[jvo+2]);
3526 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3533 iws[iadvol+ivo] = level;
3536 //*** flag all volumes and fill the stak
3540 // pick the next volume in stak
3542 ivo = TMath::Abs(iws[ivstak]);
3543 jvo = fZlq[fGclink->jvolum - ivo];
3545 // flag the tracking medium
3546 numed = Int_t (fZq[jvo + 4]);
3547 iws[iadtmd + numed] = 1;
3549 // get the daughters ...
3550 level = iws[iadvol+ivo];
3551 if (level < mlevel) {
3553 nin = Int_t (fZq[jvo + 3]);
3555 // from division ...
3557 jdiv = fZlq[jvo - 1];
3558 ivin = Int_t (fZq[jdiv + 2]);
3560 iws[nvstak] = -ivin;
3561 iws[iadvol+ivin] = level;
3563 // from position ...
3564 } else if (nin > 0) {
3565 for(in=1; in<=nin; in++) {
3566 jin = fZlq[jvo - in];
3567 ivin = Int_t (fZq[jin + 2 ]);
3568 jvin = fZlq[fGclink->jvolum - ivin];
3569 ish = Int_t (fZq[jvin + 2]);
3570 // authorized shape ?
3572 // not yet flagged ?
3573 if (iws[iadvol+ivin]==0) {
3576 iws[iadvol+ivin] = level;
3578 // flag the rotation matrix
3579 irot = Int_t ( fZq[jin + 4 ]);
3580 if (irot > 0) iws[iadrot+irot] = 1;
3586 // next volume in stak ?
3587 if (ivstak < nvstak) goto L10;
3589 // *** restore original material and media numbers
3590 // file euc_medi.dat is needed to compare materials and medias
3592 FILE* luncor=fopen("euc_medi.dat","r");
3595 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3596 if (iws[iadtmd+itm] > 0) {
3597 jtm = fZlq[fGclink->jtmed-itm];
3598 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3599 imat = Int_t (fZq[jtm+6]);
3600 jma = fZlq[fGclink->jmate-imat];
3602 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3605 strncpy(namate,(char *)&fZiq[jma+1],20);
3608 //** find the material original number
3611 iret=fscanf(luncor,"%4s,%130s",key,card);
3612 if(iret<=0) goto L26;
3614 if(!strcmp(key,"MATE")) {
3615 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3616 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3617 if(!strcmp(namatec,namate)) {
3618 if(az==a && zc==z && densc==dens && radlc==radl
3619 && abslc==absl && nparc==nparc) {