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.22 2000/01/18 15:40:13 morsch
19 Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
20 Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
22 Revision 1.21 2000/01/17 19:41:17 fca
25 Revision 1.20 2000/01/12 11:29:27 fca
28 Revision 1.19 1999/12/17 09:03:12 fca
29 Introduce a names array
31 Revision 1.18 1999/11/26 16:55:39 fca
32 Reimplement CurrentVolName() to avoid memory leaks
34 Revision 1.17 1999/11/03 16:58:28 fca
35 Correct source of address violation in creating character string
37 Revision 1.16 1999/11/03 13:17:08 fca
38 Have ProdProcess return const char*
40 Revision 1.15 1999/10/26 06:04:50 fca
41 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
43 Revision 1.14 1999/09/29 09:24:30 fca
44 Introduction of the Copyright and cvs Log
48 ///////////////////////////////////////////////////////////////////////////////
50 // Interface Class to the Geant3.21 MonteCarlo //
54 <img src="picts/TGeant3Class.gif">
59 ///////////////////////////////////////////////////////////////////////////////
65 #include <TDatabasePDG.h>
66 #include "AliCallf77.h"
69 # define gzebra gzebra_
70 # define grfile grfile_
71 # define gpcxyz gpcxyz_
72 # define ggclos ggclos_
75 # define gcinit gcinit_
78 # define gtrigc gtrigc_
79 # define gtrigi gtrigi_
81 # define gzinit gzinit_
82 # define gfmate gfmate_
83 # define gfpart gfpart_
84 # define gftmed gftmed_
85 # define gftmat gftmat_
89 # define gsmate gsmate_
90 # define gsmixt gsmixt_
91 # define gspart gspart_
92 # define gstmed gstmed_
93 # define gsckov gsckov_
94 # define gstpar gstpar_
95 # define gfkine gfkine_
96 # define gfvert gfvert_
97 # define gskine gskine_
98 # define gsvert gsvert_
99 # define gphysi gphysi_
100 # define gdebug gdebug_
101 # define gekbin gekbin_
102 # define gfinds gfinds_
103 # define gsking gsking_
104 # define gskpho gskpho_
105 # define gsstak gsstak_
106 # define gsxyz gsxyz_
107 # define gtrack gtrack_
108 # define gtreve gtreve_
109 # define gtreve_root gtreve_root_
110 # define grndm grndm_
111 # define grndmq grndmq_
112 # define gdtom gdtom_
113 # define glmoth glmoth_
114 # define gmedia gmedia_
115 # define gmtod gmtod_
116 # define gsdvn gsdvn_
117 # define gsdvn2 gsdvn2_
118 # define gsdvs gsdvs_
119 # define gsdvs2 gsdvs2_
120 # define gsdvt gsdvt_
121 # define gsdvt2 gsdvt2_
122 # define gsord gsord_
123 # define gspos gspos_
124 # define gsposp gsposp_
125 # define gsrotm gsrotm_
126 # define gprotm gprotm_
127 # define gsvolu gsvolu_
128 # define gprint gprint_
129 # define gdinit gdinit_
130 # define gdopt gdopt_
131 # define gdraw gdraw_
132 # define gdrayt gdrayt_
133 # define gdrawc gdrawc_
134 # define gdrawx gdrawx_
135 # define gdhead gdhead_
136 # define gdwmn1 gdwmn1_
137 # define gdwmn2 gdwmn2_
138 # define gdwmn3 gdwmn3_
139 # define gdxyz gdxyz_
140 # define gdcxyz gdcxyz_
141 # define gdman gdman_
142 # define gdspec gdspec_
143 # define gdtree gdtree_
144 # define gdelet gdelet_
145 # define gdclos gdclos_
146 # define gdshow gdshow_
147 # define gdopen gdopen_
148 # define dzshow dzshow_
149 # define gsatt gsatt_
150 # define gfpara gfpara_
151 # define gckpar gckpar_
152 # define gckmat gckmat_
153 # define geditv geditv_
154 # define mzdrop mzdrop_
156 # define ertrak ertrak_
157 # define ertrgo ertrgo_
159 # define setbomb setbomb_
160 # define setclip setclip_
161 # define gcomad gcomad_
163 # define gbrelm gbrelm_
164 # define gprelm gprelm_
166 # define gzebra GZEBRA
167 # define grfile GRFILE
168 # define gpcxyz GPCXYZ
169 # define ggclos GGCLOS
172 # define gcinit GCINIT
175 # define gtrigc GTRIGC
176 # define gtrigi GTRIGI
178 # define gzinit GZINIT
179 # define gfmate GFMATE
180 # define gfpart GFPART
181 # define gftmed GFTMED
182 # define gftmat GFTMAT
186 # define gsmate GSMATE
187 # define gsmixt GSMIXT
188 # define gspart GSPART
189 # define gstmed GSTMED
190 # define gsckov GSCKOV
191 # define gstpar GSTPAR
192 # define gfkine GFKINE
193 # define gfvert GFVERT
194 # define gskine GSKINE
195 # define gsvert GSVERT
196 # define gphysi GPHYSI
197 # define gdebug GDEBUG
198 # define gekbin GEKBIN
199 # define gfinds GFINDS
200 # define gsking GSKING
201 # define gskpho GSKPHO
202 # define gsstak GSSTAK
204 # define gtrack GTRACK
205 # define gtreve GTREVE
206 # define gtreve_root GTREVE_ROOT
208 # define grndmq GRNDMQ
210 # define glmoth GLMOTH
211 # define gmedia GMEDIA
214 # define gsdvn2 GSDVN2
216 # define gsdvs2 GSDVS2
218 # define gsdvt2 GSDVT2
221 # define gsposp GSPOSP
222 # define gsrotm GSROTM
223 # define gprotm GPROTM
224 # define gsvolu GSVOLU
225 # define gprint GPRINT
226 # define gdinit GDINIT
229 # define gdrayt GDRAYT
230 # define gdrawc GDRAWC
231 # define gdrawx GDRAWX
232 # define gdhead GDHEAD
233 # define gdwmn1 GDWMN1
234 # define gdwmn2 GDWMN2
235 # define gdwmn3 GDWMN3
237 # define gdcxyz GDCXYZ
239 # define gdfspc GDFSPC
240 # define gdspec GDSPEC
241 # define gdtree GDTREE
242 # define gdelet GDELET
243 # define gdclos GDCLOS
244 # define gdshow GDSHOW
245 # define gdopen GDOPEN
246 # define dzshow DZSHOW
248 # define gfpara GFPARA
249 # define gckpar GCKPAR
250 # define gckmat GCKMAT
251 # define geditv GEDITV
252 # define mzdrop MZDROP
254 # define ertrak ERTRAK
255 # define ertrgo ERTRGO
257 # define setbomb SETBOMB
258 # define setclip SETCLIP
259 # define gcomad GCOMAD
261 # define gbrelm GBRELM
262 # define gprelm GPRELM
266 //____________________________________________________________________________
270 // Prototypes for GEANT functions
272 void type_of_call gzebra(const int&);
274 void type_of_call gpcxyz();
276 void type_of_call ggclos();
278 void type_of_call glast();
280 void type_of_call ginit();
282 void type_of_call gcinit();
284 void type_of_call grun();
286 void type_of_call gtrig();
288 void type_of_call gtrigc();
290 void type_of_call gtrigi();
292 void type_of_call gwork(const int&);
294 void type_of_call gzinit();
296 void type_of_call gmate();
298 void type_of_call gpart();
300 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
302 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
303 Int_t &, Float_t *, Int_t &);
305 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
306 Float_t &, Float_t *, Int_t &);
308 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
311 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
314 void type_of_call gphysi();
316 void type_of_call gdebug();
318 void type_of_call gekbin();
320 void type_of_call gfinds();
322 void type_of_call gsking(Int_t &);
324 void type_of_call gskpho(Int_t &);
326 void type_of_call gsstak(Int_t &);
328 void type_of_call gsxyz();
330 void type_of_call gtrack();
332 void type_of_call gtreve();
334 void type_of_call gtreve_root();
336 void type_of_call grndm(Float_t *, const Int_t &);
338 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
341 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
343 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
344 Int_t *, Int_t * DEFCHARL);
346 void type_of_call gmedia(Float_t *, Int_t &);
348 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
350 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
351 const Float_t &, const Float_t &, const Float_t &,
354 void type_of_call gprotm(const Int_t &);
356 void type_of_call grfile(const Int_t&, DEFCHARD,
357 DEFCHARD DEFCHARL DEFCHARL);
359 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
360 Float_t &, Float_t &, Float_t &, Float_t *,
363 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
364 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
366 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
367 Float_t &, Float_t &, Float_t &, Float_t &,
368 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
370 void type_of_call gftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
372 ,Float_t *, Int_t & DEFCHARL);
374 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
375 Float_t &, Float_t &, Float_t &, Float_t *,
378 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
379 Float_t &, Int_t &, Float_t * DEFCHARL);
381 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
382 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
385 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
386 Float_t &, Float_t &, Float_t &, Float_t &,
387 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
389 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
390 Float_t *absco, Float_t *effic, Float_t *rindex);
391 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
393 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
396 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
397 Int_t & DEFCHARL DEFCHARL);
399 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
402 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
403 Int_t & DEFCHARL DEFCHARL);
405 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
406 Int_t & DEFCHARL DEFCHARL);
408 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
409 Int_t &, Int_t & DEFCHARL DEFCHARL);
411 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
413 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
414 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
417 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
418 Float_t &, Int_t &, DEFCHARD,
419 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
421 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
422 Int_t & DEFCHARL DEFCHARL);
424 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
426 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
429 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
431 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
433 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
435 void type_of_call gdinit();
437 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
439 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
440 Float_t &, Float_t &, Float_t & DEFCHARL);
441 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
442 Float_t &, Float_t &, Float_t & DEFCHARL);
443 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
444 Float_t &, Float_t & DEFCHARL);
445 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
446 Float_t &, Float_t &, Float_t &, Float_t &,
448 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
449 void type_of_call gdxyz(Int_t &);
450 void type_of_call gdcxyz();
451 void type_of_call gdman(Float_t &, Float_t &);
452 void type_of_call gdwmn1(Float_t &, Float_t &);
453 void type_of_call gdwmn2(Float_t &, Float_t &);
454 void type_of_call gdwmn3(Float_t &, Float_t &);
455 void type_of_call gdspec(DEFCHARD DEFCHARL);
456 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
457 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
459 void type_of_call gdopen(Int_t &);
460 void type_of_call gdclos();
461 void type_of_call gdelet(Int_t &);
462 void type_of_call gdshow(Int_t &);
463 void type_of_call geditv(Int_t &) {;}
466 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
467 const int&, const int&, const int& DEFCHARL
470 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
472 void type_of_call setbomb(Float_t &);
473 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
474 Float_t &, Float_t & DEFCHARL);
475 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
477 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
478 const Float_t *x2, const Float_t *p2,
479 const Int_t &ipa, DEFCHARD DEFCHARL);
481 void type_of_call ertrgo();
483 float type_of_call gbrelm(const Float_t &z, const Float_t& t, const Float_t& cut);
484 float type_of_call gprelm(const Float_t &z, const Float_t& t, const Float_t& cut);
488 // Geant3 global pointer
490 static Int_t defSize = 600;
494 //____________________________________________________________________________
498 // Default constructor
502 //____________________________________________________________________________
503 TGeant3::TGeant3(const char *title, Int_t nwgeant)
504 :AliMC("TGeant3",title)
507 // Standard constructor for TGeant3 with ZEBRA initialisation
518 // Load Address of Geant3 commons
521 // Zero number of particles
525 //____________________________________________________________________________
526 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
527 Float_t &radl, Float_t &absl) const
530 // Return the parameters of the current material during transport
534 dens = fGcmate->dens;
535 radl = fGcmate->radl;
536 absl = fGcmate->absl;
537 return 1; //this could be the number of elements in mixture
540 //____________________________________________________________________________
541 void TGeant3::DefaultRange()
544 // Set range of current drawing pad to 20x20 cm
550 higz->Range(0,0,20,20);
553 //____________________________________________________________________________
554 void TGeant3::InitHIGZ()
565 //____________________________________________________________________________
566 void TGeant3::LoadAddress()
569 // Assigns the address of the GEANT common blocks to the structures
570 // that allow their access from C++
573 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
574 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
575 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
576 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
577 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
578 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
579 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
580 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
581 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
582 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
583 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
584 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
585 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
586 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
587 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
588 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
589 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
590 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
591 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
592 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
593 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
596 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
597 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
598 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
599 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
601 // Variables for ZEBRA store
602 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
604 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
609 //_____________________________________________________________________________
610 void TGeant3::GeomIter()
613 // Geometry iterator for moving upward in the geometry tree
614 // Initialise the iterator
616 fNextVol=fGcvolu->nlevel;
619 //____________________________________________________________________________
620 void TGeant3::FinishGeometry()
622 //Close the geometry structure
626 //____________________________________________________________________________
627 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
630 // Geometry iterator for moving upward in the geometry tree
631 // Return next volume up
636 gname=fGcvolu->names[fNextVol];
637 copy=fGcvolu->number[fNextVol];
638 i=fGcvolu->lvolum[fNextVol];
639 name = fVolNames[i-1];
640 if(gname == fZiq[fGclink->jvolum+i]) return i;
641 else printf("GeomTree: Volume %s not found in bank\n",name);
646 //_____________________________________________________________________________
647 Int_t TGeant3::CurrentVolID(Int_t ©) const
650 // Returns the current volume ID and copy number
653 if( (i=fGcvolu->nlevel-1) < 0 ) {
654 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
656 gname=fGcvolu->names[i];
657 copy=fGcvolu->number[i];
658 i=fGcvolu->lvolum[i];
659 if(gname == fZiq[fGclink->jvolum+i]) return i;
660 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
665 //_____________________________________________________________________________
666 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
669 // Return the current volume "off" upward in the geometrical tree
670 // ID and copy number
673 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
674 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
675 off,fGcvolu->nlevel);
677 gname=fGcvolu->names[i];
678 copy=fGcvolu->number[i];
679 i=fGcvolu->lvolum[i];
680 if(gname == fZiq[fGclink->jvolum+i]) return i;
681 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
686 //_____________________________________________________________________________
687 const char* TGeant3::CurrentVolName() const
690 // Returns the current volume name
693 if( (i=fGcvolu->nlevel-1) < 0 ) {
694 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
696 gname=fGcvolu->names[i];
697 i=fGcvolu->lvolum[i];
698 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
699 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
704 //_____________________________________________________________________________
705 const char* TGeant3::CurrentVolOffName(Int_t off) const
708 // Return the current volume "off" upward in the geometrical tree
709 // ID, name and copy number
710 // if name=0 no name is returned
713 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
714 Warning("CurrentVolOffName",
715 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
717 gname=fGcvolu->names[i];
718 i=fGcvolu->lvolum[i];
719 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
720 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
725 //_____________________________________________________________________________
726 Int_t TGeant3::IdFromPDG(Int_t pdg) const
729 // Return Geant3 code from PDG and pseudo ENDF code
731 for(Int_t i=0;i<fNPDGCodes;++i)
732 if(pdg==fPDGCode[i]) return i;
736 //_____________________________________________________________________________
737 Int_t TGeant3::PDGFromId(Int_t id) const
739 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
743 //_____________________________________________________________________________
744 void TGeant3::DefineParticles()
747 // Define standard Geant 3 particles
750 // Load standard numbers for GEANT particles and PDG conversion
751 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
752 fPDGCode[fNPDGCodes++]=22; // 1 = photon
753 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
754 fPDGCode[fNPDGCodes++]=11; // 3 = electron
755 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
756 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
757 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
758 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
759 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
760 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
761 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
762 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
763 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
764 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
765 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
766 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
767 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
768 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
769 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
770 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
771 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
772 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
773 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
774 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
775 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
776 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
777 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
778 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
779 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
780 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
781 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
782 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
783 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
790 /* --- Define additional particles */
791 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
792 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
794 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
795 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
797 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
798 fPDGCode[fNPDGCodes++]=411; // 35 = D+
800 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
801 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
803 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
804 fPDGCode[fNPDGCodes++]=421; // 37 = D0
806 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
807 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
809 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
811 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
813 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
815 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
816 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
818 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
819 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
821 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
822 fPDGCode[fNPDGCodes++]=113; // 37 = D0
825 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
827 // and numbers above 5 000 000 for special applications
830 const Int_t kion=10000000;
832 const Int_t kspe=50000000;
834 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
836 const Double_t autogev=0.9314943228;
837 const Double_t hslash = 1.0545726663e-27;
838 const Double_t erggev = 1/1.6021773349e-3;
839 const Double_t hshgev = hslash*erggev;
840 const Double_t yearstosec = 3600*24*365.25;
843 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
844 0,1,"Ion",kion+10020);
845 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
847 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
848 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
849 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
851 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
852 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
853 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
855 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
857 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
858 0,2,"Ion",kion+20030);
859 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
861 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
862 0,0,"Special",kspe+50);
863 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
865 Gspart(51, "FeedbackPhoton", 7, 0., 0.,1.e20 );
866 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
867 0,0,"Special",kspe+51);
868 fPDGCode[fNPDGCodes++]=kspe+51; // 51 = FeedbackPhoton
870 /* --- Define additional decay modes --- */
871 /* --- omega(783) --- */
872 for (kz = 0; kz < 6; ++kz) {
883 Gsdk(ipa, bratio, mode);
884 /* --- phi(1020) --- */
885 for (kz = 0; kz < 6; ++kz) {
900 Gsdk(ipa, bratio, mode);
902 for (kz = 0; kz < 6; ++kz) {
915 Gsdk(ipa, bratio, mode);
917 for (kz = 0; kz < 6; ++kz) {
930 Gsdk(ipa, bratio, mode);
932 for (kz = 0; kz < 6; ++kz) {
943 Gsdk(ipa, bratio, mode);
944 /* --- Anti D0 --- */
945 for (kz = 0; kz < 6; ++kz) {
956 Gsdk(ipa, bratio, mode);
958 for (kz = 0; kz < 6; ++kz) {
965 Gsdk(ipa, bratio, mode);
967 for (kz = 0; kz < 6; ++kz) {
974 Gsdk(ipa, bratio, mode);
976 for (kz = 0; kz < 6; ++kz) {
983 Gsdk(ipa, bratio, mode);
986 for (kz = 0; kz < 6; ++kz) {
995 Gsdk(ipa, bratio, mode);
998 Gsdk(ipa, bratio, mode);
1001 Gsdk(ipa, bratio, mode);
1006 //_____________________________________________________________________________
1007 Int_t TGeant3::VolId(Text_t *name) const
1010 // Return the unique numeric identifier for volume name
1013 strncpy((char *) &gname, name, 4);
1014 for(i=1; i<=fGcnum->nvolum; i++)
1015 if(gname == fZiq[fGclink->jvolum+i]) return i;
1016 printf("VolId: Volume %s not found\n",name);
1020 //_____________________________________________________________________________
1021 Int_t TGeant3::NofVolumes() const
1024 // Return total number of volumes in the geometry
1026 return fGcnum->nvolum;
1029 //_____________________________________________________________________________
1030 const char* TGeant3::VolName(Int_t id) const
1033 // Return the volume name given the volume identifier
1035 const char name[5]="NULL";
1036 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1039 return fVolNames[id-1];
1042 //_____________________________________________________________________________
1043 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
1045 Int_t gpart = IdFromPDG(part);
1046 if(!strcmp(reac,"PHOT"))
1049 Error("Xsec","Can calculate photoelectric only for photons\n");
1055 //_____________________________________________________________________________
1056 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1059 // Return the current position in the master reference frame of the
1060 // track being transported
1062 xyz[0]=fGctrak->vect[0];
1063 xyz[1]=fGctrak->vect[1];
1064 xyz[2]=fGctrak->vect[2];
1065 xyz[3]=fGctrak->tofg;
1068 //_____________________________________________________________________________
1069 Float_t TGeant3::TrackTime() const
1072 // Return the current time of flight of the track being transported
1074 return fGctrak->tofg;
1077 //_____________________________________________________________________________
1078 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1081 // Return the direction and the momentum (GeV/c) of the track
1082 // currently being transported
1084 Double_t ptot=fGctrak->vect[6];
1085 xyz[0]=fGctrak->vect[3]*ptot;
1086 xyz[1]=fGctrak->vect[4]*ptot;
1087 xyz[2]=fGctrak->vect[5]*ptot;
1088 xyz[3]=fGctrak->getot;
1091 //_____________________________________________________________________________
1092 Float_t TGeant3::TrackCharge() const
1095 // Return charge of the track currently transported
1097 return fGckine->charge;
1100 //_____________________________________________________________________________
1101 Float_t TGeant3::TrackMass() const
1104 // Return the mass of the track currently transported
1106 return fGckine->amass;
1109 //_____________________________________________________________________________
1110 Int_t TGeant3::TrackPid() const
1113 // Return the id of the particle transported
1115 return PDGFromId(fGckine->ipart);
1118 //_____________________________________________________________________________
1119 Float_t TGeant3::TrackStep() const
1122 // Return the length in centimeters of the current step
1124 return fGctrak->step;
1127 //_____________________________________________________________________________
1128 Float_t TGeant3::TrackLength() const
1131 // Return the length of the current track from its origin
1133 return fGctrak->sleng;
1136 //_____________________________________________________________________________
1137 Bool_t TGeant3::IsTrackInside() const
1140 // True if the track is not at the boundary of the current volume
1142 return (fGctrak->inwvol==0);
1145 //_____________________________________________________________________________
1146 Bool_t TGeant3::IsTrackEntering() const
1149 // True if this is the first step of the track in the current volume
1151 return (fGctrak->inwvol==1);
1154 //_____________________________________________________________________________
1155 Bool_t TGeant3::IsTrackExiting() const
1158 // True if this is the last step of the track in the current volume
1160 return (fGctrak->inwvol==2);
1163 //_____________________________________________________________________________
1164 Bool_t TGeant3::IsTrackOut() const
1167 // True if the track is out of the setup
1169 return (fGctrak->inwvol==3);
1172 //_____________________________________________________________________________
1173 Bool_t TGeant3::IsTrackStop() const
1176 // True if the track energy has fallen below the threshold
1178 return (fGctrak->istop==2);
1181 //_____________________________________________________________________________
1182 Int_t TGeant3::NSecondaries() const
1185 // Number of secondary particles generated in the current step
1187 return fGcking->ngkine;
1190 //_____________________________________________________________________________
1191 Int_t TGeant3::CurrentEvent() const
1194 // Number of the current event
1196 return fGcflag->idevt;
1199 //_____________________________________________________________________________
1200 const char* TGeant3::ProdProcess() const
1203 // Name of the process that has produced the secondary particles
1204 // in the current step
1206 static char proc[5];
1207 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1210 if(fGcking->ngkine>0) {
1211 for (km = 0; km < fGctrak->nmec; ++km) {
1212 for (im = 0; im < 13; ++im) {
1213 if (fGctrak->lmec[km] == ipmec[im]) {
1214 mec = fGctrak->lmec[km];
1215 if (0 < mec && mec < 31) {
1216 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1217 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1218 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1225 strcpy(proc,"UNKN");
1226 } else strcpy(proc,"NONE");
1230 //_____________________________________________________________________________
1231 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1232 TLorentzVector &x, TLorentzVector &p)
1235 // Get the parameters of the secondary track number isec produced
1236 // in the current step
1239 if(-1<isec && isec<fGcking->ngkine) {
1240 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1242 x[i]=fGckin3->gpos[isec][i];
1243 p[i]=fGcking->gkin[isec][i];
1245 x[3]=fGcking->tofd[isec];
1246 p[3]=fGcking->gkin[isec][3];
1248 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1249 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1254 //_____________________________________________________________________________
1255 void TGeant3::InitLego()
1258 SetDEBU(0,0,0); //do not print a message
1261 //_____________________________________________________________________________
1262 Bool_t TGeant3::IsTrackDisappeared() const
1265 // True if the current particle has disappered
1266 // either because it decayed or because it underwent
1267 // an inelastic collision
1269 return (fGctrak->istop==1);
1272 //_____________________________________________________________________________
1273 Bool_t TGeant3::IsTrackAlive() const
1276 // True if the current particle is alive and will continue to be
1279 return (fGctrak->istop==0);
1282 //_____________________________________________________________________________
1283 void TGeant3::StopTrack()
1286 // Stop the transport of the current particle and skip to the next
1291 //_____________________________________________________________________________
1292 void TGeant3::StopEvent()
1295 // Stop simulation of the current event and skip to the next
1300 //_____________________________________________________________________________
1301 Float_t TGeant3::MaxStep() const
1304 // Return the maximum step length in the current medium
1306 return fGctmed->stemax;
1309 //_____________________________________________________________________________
1310 void TGeant3::SetColors()
1313 // Set the colors for all the volumes
1314 // this is done sequentially for all volumes
1315 // based on the number of their medium
1318 Int_t jvolum=fGclink->jvolum;
1319 //Int_t jtmed=fGclink->jtmed;
1320 //Int_t jmate=fGclink->jmate;
1321 Int_t nvolum=fGcnum->nvolum;
1324 // Now for all the volumes
1325 for(kv=1;kv<=nvolum;kv++) {
1326 // Get the tracking medium
1327 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
1329 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
1331 //Float_t z=fZq[fZlq[jmate-ima]+7];
1332 // Find color number
1333 //icol = Int_t(z)%6+2;
1334 //icol = 17+Int_t(z*150./92.);
1337 strncpy(name,(char*)&fZiq[jvolum+kv],4);
1339 Gsatt(name,"COLO",icol);
1343 //_____________________________________________________________________________
1344 void TGeant3::SetMaxStep(Float_t maxstep)
1347 // Set the maximum step allowed till the particle is in the current medium
1349 fGctmed->stemax=maxstep;
1352 //_____________________________________________________________________________
1353 void TGeant3::SetMaxNStep(Int_t maxnstp)
1356 // Set the maximum number of steps till the particle is in the current medium
1358 fGctrak->maxnst=maxnstp;
1361 //_____________________________________________________________________________
1362 Int_t TGeant3::GetMaxNStep() const
1365 // Maximum number of steps allowed in current medium
1367 return fGctrak->maxnst;
1370 //_____________________________________________________________________________
1371 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1372 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1376 // Defines a Material
1378 // kmat number assigned to the material
1379 // name material name
1380 // a atomic mass in au
1382 // dens density in g/cm3
1383 // absl absorbtion length in cm
1384 // if >=0 it is ignored and the program
1385 // calculates it, if <0. -absl is taken
1386 // radl radiation length in cm
1387 // if >=0 it is ignored and the program
1388 // calculates it, if <0. -radl is taken
1389 // buf pointer to an array of user words
1390 // nbuf number of user words
1392 Int_t jmate=fGclink->jmate;
1398 for(i=1; i<=ns; i++) {
1399 if(fZlq[jmate-i]==0) {
1405 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1406 nwbuf PASSCHARL(name));
1409 //_____________________________________________________________________________
1410 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1411 Float_t dens, Int_t nlmat, Float_t* wmat)
1414 // Defines mixture OR COMPOUND IMAT as composed by
1415 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1417 // If NLMAT > 0 then wmat contains the proportion by
1418 // weights of each basic material in the mixture.
1420 // If nlmat < 0 then WMAT contains the number of atoms
1421 // of a given kind into the molecule of the COMPOUND
1422 // In this case, WMAT in output is changed to relative
1425 Int_t jmate=fGclink->jmate;
1431 for(i=1; i<=ns; i++) {
1432 if(fZlq[jmate-i]==0) {
1438 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1441 //_____________________________________________________________________________
1442 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1443 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1444 Float_t stemax, Float_t deemax, Float_t epsil,
1445 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1448 // kmed tracking medium number assigned
1449 // name tracking medium name
1450 // nmat material number
1451 // isvol sensitive volume flag
1452 // ifield magnetic field
1453 // fieldm max. field value (kilogauss)
1454 // tmaxfd max. angle due to field (deg/step)
1455 // stemax max. step allowed
1456 // deemax max. fraction of energy lost in a step
1457 // epsil tracking precision (cm)
1458 // stmin min. step due to continuos processes (cm)
1460 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1461 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1462 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1464 Int_t jtmed=fGclink->jtmed;
1470 for(i=1; i<=ns; i++) {
1471 if(fZlq[jtmed-i]==0) {
1477 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1478 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1481 //_____________________________________________________________________________
1482 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1483 Float_t phiy, Float_t thez, Float_t phiz)
1486 // krot rotation matrix number assigned
1487 // theta1 polar angle for axis i
1488 // phi1 azimuthal angle for axis i
1489 // theta2 polar angle for axis ii
1490 // phi2 azimuthal angle for axis ii
1491 // theta3 polar angle for axis iii
1492 // phi3 azimuthal angle for axis iii
1494 // it defines the rotation matrix number irot.
1496 Int_t jrotm=fGclink->jrotm;
1502 for(i=1; i<=ns; i++) {
1503 if(fZlq[jrotm-i]==0) {
1509 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1512 //_____________________________________________________________________________
1513 Int_t TGeant3::GetMedium() const
1516 // Return the number of the current medium
1518 return fGctmed->numed;
1521 //_____________________________________________________________________________
1522 Float_t TGeant3::Edep() const
1525 // Return the energy lost in the current step
1527 return fGctrak->destep;
1530 //_____________________________________________________________________________
1531 Float_t TGeant3::Etot() const
1534 // Return the total energy of the current track
1536 return fGctrak->getot;
1539 //_____________________________________________________________________________
1540 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1543 // Return an array of n random numbers uniformly distributed
1544 // between 0 and 1 not included
1549 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1551 // Functions from GBASE
1553 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1555 //____________________________________________________________________________
1556 void TGeant3::Gfile(const char *filename, const char *option)
1559 // Routine to open a GEANT/RZ data base.
1561 // LUN logical unit number associated to the file
1563 // CHFILE RZ file name
1565 // CHOPT is a character string which may be
1566 // N To create a new file
1567 // U to open an existing file for update
1568 // " " to open an existing file for read only
1569 // Q The initial allocation (default 1000 records)
1570 // is given in IQUEST(10)
1571 // X Open the file in exchange format
1572 // I Read all data structures from file to memory
1573 // O Write all data structures from memory to file
1576 // If options "I" or "O" all data structures are read or
1577 // written from/to file and the file is closed.
1578 // See routine GRMDIR to create subdirectories
1579 // See routines GROUT,GRIN to write,read objects
1581 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1585 //____________________________________________________________________________
1586 void TGeant3::Gpcxyz()
1589 // Print track and volume parameters at current point
1594 //_____________________________________________________________________________
1595 void TGeant3::Ggclos()
1598 // Closes off the geometry setting.
1599 // Initializes the search list for the contents of each
1600 // volume following the order they have been positioned, and
1601 // inserting the content '0' when a call to GSNEXT (-1) has
1602 // been required by the user.
1603 // Performs the development of the JVOLUM structure for all
1604 // volumes with variable parameters, by calling GGDVLP.
1605 // Interprets the user calls to GSORD, through GGORD.
1606 // Computes and stores in a bank (next to JVOLUM mother bank)
1607 // the number of levels in the geometrical tree and the
1608 // maximum number of contents per level, by calling GGNLEV.
1609 // Sets status bit for CONCAVE volumes, through GGCAVE.
1610 // Completes the JSET structure with the list of volume names
1611 // which identify uniquely a given physical detector, the
1612 // list of bit numbers to pack the corresponding volume copy
1613 // numbers, and the generic path(s) in the JVOLUM tree,
1614 // through the routine GHCLOS.
1617 // Create internal list of volumes
1618 fVolNames = new char[fGcnum->nvolum][5];
1620 for(i=0; i<fGcnum->nvolum; ++i) {
1621 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1622 fVolNames[i][4]='\0';
1626 //_____________________________________________________________________________
1627 void TGeant3::Glast()
1630 // Finish a Geant run
1635 //_____________________________________________________________________________
1636 void TGeant3::Gprint(const char *name)
1639 // Routine to print data structures
1640 // CHNAME name of a data structure
1644 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1647 //_____________________________________________________________________________
1648 void TGeant3::Grun()
1651 // Steering function to process one run
1656 //_____________________________________________________________________________
1657 void TGeant3::Gtrig()
1660 // Steering function to process one event
1665 //_____________________________________________________________________________
1666 void TGeant3::Gtrigc()
1669 // Clear event partition
1674 //_____________________________________________________________________________
1675 void TGeant3::Gtrigi()
1678 // Initialises event partition
1683 //_____________________________________________________________________________
1684 void TGeant3::Gwork(Int_t nwork)
1687 // Allocates workspace in ZEBRA memory
1692 //_____________________________________________________________________________
1693 void TGeant3::Gzinit()
1696 // To initialise GEANT/ZEBRA data structures
1701 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1703 // Functions from GCONS
1705 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1707 //_____________________________________________________________________________
1708 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1709 Float_t &dens, Float_t &radl, Float_t &absl,
1710 Float_t* ubuf, Int_t& nbuf)
1713 // Return parameters for material IMAT
1715 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1719 //_____________________________________________________________________________
1720 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1721 Float_t &amass, Float_t &charge, Float_t &tlife)
1724 // Return parameters for particle of type IPART
1728 Int_t igpart = IdFromPDG(ipart);
1729 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1733 //_____________________________________________________________________________
1734 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1735 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1736 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1737 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1740 // Return parameters for tracking medium NUMED
1742 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1743 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1747 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
1748 Float_t* tkin, Float_t* value, Float_t* pcut,
1752 // Return parameters for tracking medium NUMED
1754 gftmat(imate, ipart, PASSCHARD(chmeca), kdim,
1755 tkin, value, pcut, ixst PASSCHARL(chmeca));
1759 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
1761 return gbrelm(z,t,bcut);
1764 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
1766 return gprelm(z,t,bcut);
1769 //_____________________________________________________________________________
1770 void TGeant3::Gmate()
1773 // Define standard GEANT materials
1778 //_____________________________________________________________________________
1779 void TGeant3::Gpart()
1782 // Define standard GEANT particles plus selected decay modes
1783 // and branching ratios.
1788 //_____________________________________________________________________________
1789 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1791 // Defines branching ratios and decay modes for standard
1793 gsdk(ipart,bratio,mode);
1796 //_____________________________________________________________________________
1797 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1798 Float_t dens, Float_t radl, Float_t absl)
1801 // Defines a Material
1803 // kmat number assigned to the material
1804 // name material name
1805 // a atomic mass in au
1807 // dens density in g/cm3
1808 // absl absorbtion length in cm
1809 // if >=0 it is ignored and the program
1810 // calculates it, if <0. -absl is taken
1811 // radl radiation length in cm
1812 // if >=0 it is ignored and the program
1813 // calculates it, if <0. -radl is taken
1814 // buf pointer to an array of user words
1815 // nbuf number of user words
1819 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1823 //_____________________________________________________________________________
1824 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1825 Float_t dens, Int_t nlmat, Float_t *wmat)
1828 // Defines mixture OR COMPOUND IMAT as composed by
1829 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1831 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1832 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1834 // If NLMAT.LT.0 then WMAT contains the number of atoms
1835 // of a given kind into the molecule of the COMPOUND
1836 // In this case, WMAT in output is changed to relative
1839 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1842 //_____________________________________________________________________________
1843 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1844 Float_t amass, Float_t charge, Float_t tlife)
1847 // Store particle parameters
1849 // ipart particle code
1850 // name particle name
1851 // itrtyp transport method (see GEANT manual)
1852 // amass mass in GeV/c2
1853 // charge charge in electron units
1854 // tlife lifetime in seconds
1858 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1862 //_____________________________________________________________________________
1863 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1864 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1865 Float_t stemax, Float_t deemax, Float_t epsil,
1869 // NTMED Tracking medium number
1870 // NAME Tracking medium name
1871 // NMAT Material number
1872 // ISVOL Sensitive volume flag
1873 // IFIELD Magnetic field
1874 // FIELDM Max. field value (Kilogauss)
1875 // TMAXFD Max. angle due to field (deg/step)
1876 // STEMAX Max. step allowed
1877 // DEEMAX Max. fraction of energy lost in a step
1878 // EPSIL Tracking precision (cm)
1879 // STMIN Min. step due to continuos processes (cm)
1881 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1882 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1883 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1887 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1888 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1891 //_____________________________________________________________________________
1892 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1893 Float_t *absco, Float_t *effic, Float_t *rindex)
1896 // Stores the tables for UV photon tracking in medium ITMED
1897 // Please note that it is the user's responsability to
1898 // provide all the coefficients:
1901 // ITMED Tracking medium number
1902 // NPCKOV Number of bins of each table
1903 // PPCKOV Value of photon momentum (in GeV)
1904 // ABSCO Absorbtion coefficients
1905 // dielectric: absorbtion length in cm
1906 // metals : absorbtion fraction (0<=x<=1)
1907 // EFFIC Detection efficiency for UV photons
1908 // RINDEX Refraction index (if=0 metal)
1910 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1913 //_____________________________________________________________________________
1914 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1917 // To change the value of cut or mechanism "CHPAR"
1918 // to a new value PARVAL for tracking medium ITMED
1919 // The data structure JTMED contains the standard tracking
1920 // parameters (CUTS and flags to control the physics processes) which
1921 // are used by default for all tracking media. It is possible to
1922 // redefine individually with GSTPAR any of these parameters for a
1923 // given tracking medium.
1924 // ITMED tracking medium number
1925 // CHPAR is a character string (variable name)
1926 // PARVAL must be given as a floating point.
1928 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1931 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1933 // Functions from GCONS
1935 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1937 //_____________________________________________________________________________
1938 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1941 // Storing/Retrieving Vertex and Track parameters
1942 // ----------------------------------------------
1944 // Stores vertex parameters.
1945 // VERT array of (x,y,z) position of the vertex
1946 // NTBEAM beam track number origin of the vertex
1947 // =0 if none exists
1948 // NTTARG target track number origin of the vertex
1949 // UBUF user array of NUBUF floating point numbers
1951 // NVTX new vertex number (=0 in case of error).
1952 // Prints vertex parameters.
1953 // IVTX for vertex IVTX.
1954 // (For all vertices if IVTX=0)
1955 // Stores long life track parameters.
1956 // PLAB components of momentum
1957 // IPART type of particle (see GSPART)
1958 // NV vertex number origin of track
1959 // UBUF array of NUBUF floating point user parameters
1961 // NT track number (if=0 error).
1962 // Retrieves long life track parameters.
1963 // ITRA track number for which parameters are requested
1964 // VERT vector origin of the track
1965 // PVERT 4 momentum components at the track origin
1966 // IPART particle type (=0 if track ITRA does not exist)
1967 // NVERT vertex number origin of the track
1968 // UBUF user words stored in GSKINE.
1969 // Prints initial track parameters.
1970 // ITRA for track ITRA
1971 // (For all tracks if ITRA=0)
1975 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1978 //_____________________________________________________________________________
1979 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1983 // Retrieves the parameter of a vertex bank
1984 // Vertex is generated from tracks NTBEAM NTTARG
1985 // NVTX is the new vertex number
1989 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1992 //_____________________________________________________________________________
1993 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1997 // Store kinematics of track NT into data structure
1998 // Track is coming from vertex NV
2001 gskine(plab, ipart, nv, buf, nwbuf, nt);
2005 //_____________________________________________________________________________
2006 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
2010 // Creates a new vertex bank
2011 // Vertex is generated from tracks NTBEAM NTTARG
2012 // NVTX is the new vertex number
2015 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
2019 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2021 // Functions from GPHYS
2023 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2025 //_____________________________________________________________________________
2026 void TGeant3::Gphysi()
2029 // Initialise material constants for all the physics
2030 // mechanisms used by GEANT
2035 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2037 // Functions from GTRAK
2039 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2041 //_____________________________________________________________________________
2042 void TGeant3::Gdebug()
2045 // Debug the current step
2050 //_____________________________________________________________________________
2051 void TGeant3::Gekbin()
2054 // To find bin number in kinetic energy table
2055 // stored in ELOW(NEKBIN)
2060 //_____________________________________________________________________________
2061 void TGeant3::Gfinds()
2064 // Returns the set/volume parameters corresponding to
2065 // the current space point in /GCTRAK/
2066 // and fill common /GCSETS/
2068 // IHSET user set identifier
2069 // IHDET user detector identifier
2070 // ISET set number in JSET
2071 // IDET detector number in JS=LQ(JSET-ISET)
2072 // IDTYPE detector type (1,2)
2073 // NUMBV detector volume numbers (array of length NVNAME)
2074 // NVNAME number of volume levels
2079 //_____________________________________________________________________________
2080 void TGeant3::Gsking(Int_t igk)
2083 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2084 // or the NGKINE tracks when IGK is 0.
2089 //_____________________________________________________________________________
2090 void TGeant3::Gskpho(Int_t igk)
2093 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2094 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2099 //_____________________________________________________________________________
2100 void TGeant3::Gsstak(Int_t iflag)
2103 // Stores in auxiliary stack JSTAK the particle currently
2104 // described in common /GCKINE/.
2106 // On request, creates also an entry in structure JKINE :
2108 // 0 : No entry in JKINE structure required (user)
2109 // 1 : New entry in JVERTX / JKINE structures required (user)
2110 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2111 // 2 : Entry in JKINE structure exists already (from GTREVE)
2116 //_____________________________________________________________________________
2117 void TGeant3::Gsxyz()
2120 // Store space point VECT in banks JXYZ
2125 //_____________________________________________________________________________
2126 void TGeant3::Gtrack()
2129 // Controls tracking of current particle
2134 //_____________________________________________________________________________
2135 void TGeant3::Gtreve()
2138 // Controls tracking of all particles belonging to the current event
2143 //_____________________________________________________________________________
2144 void TGeant3::Gtreve_root()
2147 // Controls tracking of all particles belonging to the current event
2152 //_____________________________________________________________________________
2153 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2156 // To generate a vector RVECV of LEN random numbers
2157 // Copy of the CERN Library routine RANECU
2161 //_____________________________________________________________________________
2162 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2163 const Text_t *chopt)
2166 // To set/retrieve the seed of the random number generator
2168 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2171 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2173 // Functions from GDRAW
2175 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2177 //_____________________________________________________________________________
2178 void TGeant3::Gdxyz(Int_t it)
2181 // Draw the points stored with Gsxyz relative to track it
2186 //_____________________________________________________________________________
2187 void TGeant3::Gdcxyz()
2190 // Draw the position of the current track
2195 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2197 // Functions from GGEOM
2199 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2201 //_____________________________________________________________________________
2202 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2205 // Computes coordinates XM (Master Reference System
2206 // knowing the coordinates XD (Detector Ref System)
2207 // The local reference system can be initialized by
2208 // - the tracking routines and GDTOM used in GUSTEP
2209 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2210 // (inverse routine is GMTOD)
2212 // If IFLAG=1 convert coordinates
2213 // IFLAG=2 convert direction cosinus
2215 gdtom(xd, xm, iflag);
2218 //_____________________________________________________________________________
2219 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2223 // Loads the top part of the Volume tree in LVOLS (IVO's),
2224 // LINDX (IN indices) for a given volume defined through
2225 // its name IUDET and number IUNUM.
2227 // The routine stores only upto the last level where JVOLUM
2228 // data structure is developed. If there is no development
2229 // above the current level, it returns NLEV zero.
2231 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2234 //_____________________________________________________________________________
2235 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2238 // Finds in which volume/medium the point X is, and updates the
2239 // common /GCVOLU/ and the structure JGPAR accordingly.
2241 // NUMED returns the tracking medium number, or 0 if point is
2242 // outside the experimental setup.
2247 //_____________________________________________________________________________
2248 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2251 // Computes coordinates XD (in DRS)
2252 // from known coordinates XM in MRS
2253 // The local reference system can be initialized by
2254 // - the tracking routines and GMTOD used in GUSTEP
2255 // - a call to GMEDIA(XM,NUMED)
2256 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2257 // (inverse routine is GDTOM)
2259 // If IFLAG=1 convert coordinates
2260 // IFLAG=2 convert direction cosinus
2262 gmtod(xm, xd, iflag);
2265 //_____________________________________________________________________________
2266 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2270 // Create a new volume by dividing an existing one
2273 // MOTHER Mother volume name
2274 // NDIV Number of divisions
2277 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2278 // It divides a previously defined volume.
2283 Vname(mother,vmother);
2284 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2285 PASSCHARL(vmother));
2288 //_____________________________________________________________________________
2289 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2290 Int_t iaxis, Float_t c0i, Int_t numed)
2293 // Create a new volume by dividing an existing one
2295 // Divides mother into ndiv divisions called name
2296 // along axis iaxis starting at coordinate value c0.
2297 // the new volume created will be medium number numed.
2302 Vname(mother,vmother);
2303 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2304 PASSCHARL(vname) PASSCHARL(vmother));
2307 //_____________________________________________________________________________
2308 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2309 Int_t iaxis, Int_t numed)
2312 // Create a new volume by dividing an existing one
2317 Vname(mother,vmother);
2318 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2319 PASSCHARL(vname) PASSCHARL(vmother));
2322 //_____________________________________________________________________________
2323 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2324 Int_t iaxis, Float_t c0, Int_t numed)
2327 // Create a new volume by dividing an existing one
2332 Vname(mother,vmother);
2333 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2334 PASSCHARL(vname) PASSCHARL(vmother));
2337 //_____________________________________________________________________________
2338 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2339 Int_t iaxis, Int_t numed, Int_t ndvmx)
2342 // Create a new volume by dividing an existing one
2344 // Divides MOTHER into divisions called NAME along
2345 // axis IAXIS in steps of STEP. If not exactly divisible
2346 // will make as many as possible and will centre them
2347 // with respect to the mother. Divisions will have medium
2348 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2349 // NDVMX is the expected maximum number of divisions
2350 // (If 0, no protection tests are performed)
2355 Vname(mother,vmother);
2356 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2357 PASSCHARL(vname) PASSCHARL(vmother));
2360 //_____________________________________________________________________________
2361 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2362 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2365 // Create a new volume by dividing an existing one
2367 // Divides MOTHER into divisions called NAME along
2368 // axis IAXIS starting at coordinate value C0 with step
2370 // The new volume created will have medium number NUMED.
2371 // If NUMED is 0, NUMED of mother is taken.
2372 // NDVMX is the expected maximum number of divisions
2373 // (If 0, no protection tests are performed)
2378 Vname(mother,vmother);
2379 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2380 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2383 //_____________________________________________________________________________
2384 void TGeant3::Gsord(const char *name, Int_t iax)
2387 // Flags volume CHNAME whose contents will have to be ordered
2388 // along axis IAX, by setting the search flag to -IAX
2392 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2393 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2394 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2395 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2396 // IAX = 6 PHI (PHI=0 => X axis)
2397 // IAX = 7 THETA (THETA=0 => Z axis)
2401 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2404 //_____________________________________________________________________________
2405 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2406 Float_t y, Float_t z, Int_t irot, const char *konly)
2409 // Position a volume into an existing one
2412 // NUMBER Copy number of the volume
2413 // MOTHER Mother volume name
2414 // X X coord. of the volume in mother ref. sys.
2415 // Y Y coord. of the volume in mother ref. sys.
2416 // Z Z coord. of the volume in mother ref. sys.
2417 // IROT Rotation matrix number w.r.t. mother ref. sys.
2418 // ONLY ONLY/MANY flag
2420 // It positions a previously defined volume in the mother.
2425 Vname(mother,vmother);
2426 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2427 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2431 //_____________________________________________________________________________
2432 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2433 Float_t x, Float_t y, Float_t z, Int_t irot,
2434 const char *konly, Float_t *upar, Int_t np )
2437 // Place a copy of generic volume NAME with user number
2438 // NR inside MOTHER, with its parameters UPAR(1..NP)
2443 Vname(mother,vmother);
2444 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2445 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2449 //_____________________________________________________________________________
2450 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2451 Float_t phi2, Float_t theta3, Float_t phi3)
2454 // nmat Rotation matrix number
2455 // THETA1 Polar angle for axis I
2456 // PHI1 Azimuthal angle for axis I
2457 // THETA2 Polar angle for axis II
2458 // PHI2 Azimuthal angle for axis II
2459 // THETA3 Polar angle for axis III
2460 // PHI3 Azimuthal angle for axis III
2462 // It defines the rotation matrix number IROT.
2464 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2467 //_____________________________________________________________________________
2468 void TGeant3::Gprotm(Int_t nmat)
2471 // To print rotation matrices structure JROTM
2472 // nmat Rotation matrix number
2477 //_____________________________________________________________________________
2478 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2479 Float_t *upar, Int_t npar)
2483 // SHAPE Volume type
2484 // NUMED Tracking medium number
2485 // NPAR Number of shape parameters
2486 // UPAR Vector containing shape parameters
2488 // It creates a new volume in the JVOLUM data structure.
2494 Vname(shape,vshape);
2495 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2496 PASSCHARL(vname) PASSCHARL(vshape));
2500 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2502 // T H E D R A W I N G P A C K A G E
2503 // ======================================
2504 // Drawing functions. These functions allow the visualization in several ways
2505 // of the volumes defined in the geometrical data structure. It is possible
2506 // to draw the logical tree of volumes belonging to the detector (DTREE),
2507 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2508 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2509 // these commands when the hidden line removal option is activated; in
2510 // this case, the volumes can be also either translated in the space
2511 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2512 // possible to fill the surfaces of the volumes
2513 // with solid colours when the shading option (SHAD) is activated.
2514 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2515 // of the detectors or to scan physical events as well.
2516 // Finally, the command MOVE will allow the rotation, translation and zooming
2517 // on real time parts of the detectors or tracks and hits of a simulated event.
2518 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2519 // the drawing is performed by the Geant ray-tracing;
2520 // automatically, the color is assigned according to the tracking medium of each
2521 // volume and the volumes with a density lower/equal than the air are considered
2522 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2523 // the user can set color and visibility for the desired volumes via the command
2524 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2525 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2526 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2527 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2528 // first case, we assume that the first mother volume of the tree is a box with
2529 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2530 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2531 // second case, the distance between the observer and the origin of the world
2532 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2533 // or telescopic effects can be achieved changing the scale factors in the command
2534 // (DRAW). When the final picture does not occupy the full window,
2535 // mapping the space before tracing can speed up the drawing, but can also
2536 // produce less precise results; values from 1 to 4 are allowed in the command
2537 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2538 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2539 // The command (VALCUT) allows the cutting of the detector by three planes
2540 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2541 // SATT for any desired volume and can assume values from 0 to 7; it determines
2542 // the different light processing to be performed for different materials:
2543 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2544 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2545 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2546 // is 0.9) and the observer is assumed to have a light source (therefore he will
2547 // produce parallel light in the case of parallel view and point-like-source
2548 // light in the case of perspective view).
2550 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2552 //_____________________________________________________________________________
2553 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2557 // IOPT Name of the attribute to be set
2558 // IVAL Value to which the attribute is to be set
2560 // name= "*" stands for all the volumes.
2561 // iopt can be chosen among the following :
2563 // WORK 0=volume name is inactive for the tracking
2564 // 1=volume name is active for the tracking (default)
2566 // SEEN 0=volume name is invisible
2567 // 1=volume name is visible (default)
2568 // -1=volume invisible with all its descendants in the tree
2569 // -2=volume visible but not its descendants in the tree
2571 // LSTY line style 1,2,3,... (default=1)
2572 // LSTY=7 will produce a very precise approximation for
2573 // revolution bodies.
2575 // LWID line width -7,...,1,2,3,..7 (default=1)
2576 // LWID<0 will act as abs(LWID) was set for the volume
2577 // and for all the levels below it. When SHAD is 'ON', LWID
2578 // represent the linewidth of the scan lines filling the surfaces
2579 // (whereas the FILL value represent their number). Therefore
2580 // tuning this parameter will help to obtain the desired
2581 // quality/performance ratio.
2583 // COLO colour code -166,...,1,2,..166 (default=1)
2585 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2586 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2587 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2588 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2589 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2590 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2591 // colour=n*10+m, m=1,2,...9, will produce the same colour
2592 // as 'n', but with increasing luminosity according to 'm';
2593 // COLO<0 will act as if abs(COLO) was set for the volume
2594 // and for all the levels below it.
2595 // When for a volume the attribute FILL is > 1 (and the
2596 // option SHAD is on), the ABS of its colour code must be < 8
2597 // because an automatic shading of its faces will be
2600 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2601 // when option SHAD is "on" the FILL attribute of any
2602 // volume can be set different from 0 (normal drawing);
2603 // if it is set to 1, the faces of such volume will be filled
2604 // with solid colours; if ABS(FILL) is > 1, then a light
2605 // source is placed along the observer line, and the faces of
2606 // such volumes will be painted by colours whose luminosity
2607 // will depend on the amount of light reflected;
2608 // if ABS(FILL) = 1, then it is possible to use all the 166
2609 // colours of the colour table, becouse the automatic shading
2610 // is not performed;
2611 // for increasing values of FILL the drawing will be performed
2612 // with higher and higher resolution improving the quality (the
2613 // number of scan lines used to fill the faces increases with FILL);
2614 // it is possible to set different values of FILL
2615 // for different volumes, in order to optimize at the same time
2616 // the performance and the quality of the picture;
2617 // FILL<0 will act as if abs(FILL) was set for the volume
2618 // and for all the levels below it.
2619 // This kind of drawing can be saved in 'picture files'
2620 // or in view banks.
2621 // 0=drawing without fill area
2622 // 1=faces filled with solid colours and resolution = 6
2623 // 2=lowest resolution (very fast)
2624 // 3=default resolution
2625 // 4=.................
2626 // 5=.................
2627 // 6=.................
2629 // Finally, if a coloured background is desired, the FILL
2630 // attribute for the first volume of the tree must be set
2631 // equal to -abs(colo), colo being >0 and <166.
2633 // SET set number associated to volume name
2634 // DET detector number associated to volume name
2635 // DTYP detector type (1,2)
2642 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2646 //_____________________________________________________________________________
2647 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2648 Int_t& natt, Float_t* par, Float_t* att)
2651 // Find the parameters of a volume
2653 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2657 //_____________________________________________________________________________
2658 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2661 // Check the parameters of a shape
2663 gckpar(ish,npar,par);
2666 //_____________________________________________________________________________
2667 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2670 // Check the parameters of a tracking medium
2672 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2675 //_____________________________________________________________________________
2676 void TGeant3::Gdelete(Int_t iview)
2679 // IVIEW View number
2681 // It deletes a view bank from memory.
2686 //_____________________________________________________________________________
2687 void TGeant3::Gdopen(Int_t iview)
2690 // IVIEW View number
2692 // When a drawing is very complex and requires a long time to be
2693 // executed, it can be useful to store it in a view bank: after a
2694 // call to DOPEN and the execution of the drawing (nothing will
2695 // appear on the screen), and after a necessary call to DCLOSE,
2696 // the contents of the bank can be displayed in a very fast way
2697 // through a call to DSHOW; therefore, the detector can be easily
2698 // zoomed many times in different ways. Please note that the pictures
2699 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2706 //_____________________________________________________________________________
2707 void TGeant3::Gdclose()
2710 // It closes the currently open view bank; it must be called after the
2711 // end of the drawing to be stored.
2716 //_____________________________________________________________________________
2717 void TGeant3::Gdshow(Int_t iview)
2720 // IVIEW View number
2722 // It shows on the screen the contents of a view bank. It
2723 // can be called after a view bank has been closed.
2728 //_____________________________________________________________________________
2729 void TGeant3::Gdopt(const char *name,const char *value)
2733 // VALUE Option value
2735 // To set/modify the drawing options.
2738 // THRZ ON Draw tracks in R vs Z
2739 // OFF (D) Draw tracks in X,Y,Z
2742 // PROJ PARA (D) Parallel projection
2744 // TRAK LINE (D) Trajectory drawn with lines
2745 // POIN " " with markers
2746 // HIDE ON Hidden line removal using the CG package
2747 // OFF (D) No hidden line removal
2748 // SHAD ON Fill area and shading of surfaces.
2749 // OFF (D) Normal hidden line removal.
2750 // RAYT ON Ray-tracing on.
2751 // OFF (D) Ray-tracing off.
2752 // EDGE OFF Does not draw contours when shad is on.
2753 // ON (D) Normal shading.
2754 // MAPP 1,2,3,4 Mapping before ray-tracing.
2755 // 0 (D) No mapping.
2756 // USER ON User graphics options in the raytracing.
2757 // OFF (D) Automatic graphics options.
2763 Vname(value,vvalue);
2764 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2768 //_____________________________________________________________________________
2769 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2770 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2775 // THETA Viewing angle theta (for 3D projection)
2776 // PHI Viewing angle phi (for 3D projection)
2777 // PSI Viewing angle psi (for 2D rotation)
2778 // U0 U-coord. (horizontal) of volume origin
2779 // V0 V-coord. (vertical) of volume origin
2780 // SU Scale factor for U-coord.
2781 // SV Scale factor for V-coord.
2783 // This function will draw the volumes,
2784 // selected with their graphical attributes, set by the Gsatt
2785 // facility. The drawing may be performed with hidden line removal
2786 // and with shading effects according to the value of the options HIDE
2787 // and SHAD; if the option SHAD is ON, the contour's edges can be
2788 // drawn or not. If the option HIDE is ON, the detector can be
2789 // exploded (BOMB), clipped with different shapes (CVOL), and some
2790 // of its parts can be shifted from their original
2791 // position (SHIFT). When HIDE is ON, if
2792 // the drawing requires more than the available memory, the program
2793 // will evaluate and display the number of missing words
2794 // (so that the user can increase the
2795 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2796 // the program will print messages about the memory used and
2797 // statistics on the volumes' visibility.
2798 // The following commands will produce the drawing of a green
2799 // volume, specified by NAME, without using the hidden line removal
2800 // technique, using the hidden line removal technique,
2801 // with different linewidth and colour (red), with
2802 // solid colour, with shading of surfaces, and without edges.
2803 // Finally, some examples are given for the ray-tracing. (A possible
2804 // string for the NAME of the volume can be found using the command DTREE).
2810 if (fGcvdma->raytra != 1) {
2811 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2813 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2817 //_____________________________________________________________________________
2818 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2819 Float_t v0,Float_t ul,Float_t vl)
2824 // CUTVAL Cut plane distance from the origin along the axis
2826 // U0 U-coord. (horizontal) of volume origin
2827 // V0 V-coord. (vertical) of volume origin
2828 // SU Scale factor for U-coord.
2829 // SV Scale factor for V-coord.
2831 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2832 // and placed at the distance cutval from the origin.
2833 // The resulting picture is seen from the the same axis.
2834 // When HIDE Mode is ON, it is possible to get the same effect with
2835 // the CVOL/BOX function.
2841 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2844 //_____________________________________________________________________________
2845 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2846 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2847 Float_t v0,Float_t ul,Float_t vl)
2851 // CUTTHE Theta angle of the line normal to cut plane
2852 // CUTPHI Phi angle of the line normal to cut plane
2853 // CUTVAL Cut plane distance from the origin along the axis
2855 // THETA Viewing angle theta (for 3D projection)
2856 // PHI Viewing angle phi (for 3D projection)
2857 // U0 U-coord. (horizontal) of volume origin
2858 // V0 V-coord. (vertical) of volume origin
2859 // SU Scale factor for U-coord.
2860 // SV Scale factor for V-coord.
2862 // The cut plane is normal to the line given by the cut angles
2863 // cutthe and cutphi and placed at the distance cutval from the origin.
2864 // The resulting picture is seen from the viewing angles theta,phi.
2870 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2874 //_____________________________________________________________________________
2875 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2880 // ISEL Option flag D=111110
2882 // CHRSIZ Character size (cm) of title NAME D=0.6
2885 // 0 to have only the header lines
2886 // xxxxx1 to add the text name centered on top of header
2887 // xxxx1x to add global detector name (first volume) on left
2888 // xxx1xx to add date on right
2889 // xx1xxx to select thick characters for text on top of header
2890 // x1xxxx to add the text 'EVENT NR x' on top of header
2891 // 1xxxxx to add the text 'RUN NR x' on top of header
2892 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2893 // i.e. they generate overwritten text.
2895 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2898 //_____________________________________________________________________________
2899 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2902 // Draw a 2D-man at position (U0,V0)
2904 // U U-coord. (horizontal) of the centre of man' R
2905 // V V-coord. (vertical) of the centre of man' R
2906 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2908 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2909 // It superimposes the picure of a man or of a woman, chosen among
2910 // three different ones, with the same scale factors as the detector
2911 // in the current drawing.
2914 if (opt.Contains("WM1")) {
2916 } else if (opt.Contains("WM3")) {
2918 } else if (opt.Contains("WM2")) {
2925 //_____________________________________________________________________________
2926 void TGeant3::Gdspec(const char *name)
2931 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2932 // its geometrical specifications. The 3D drawing will
2933 // be performed according the current values of the options HIDE and
2934 // SHAD and according the current SetClipBox clipping parameters for that
2941 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2944 //_____________________________________________________________________________
2945 void TGeant3::DrawOneSpec(const char *name)
2948 // Function called when one double-clicks on a volume name
2949 // in a TPavelabel drawn by Gdtree.
2951 THIGZ *higzSave = higz;
2952 higzSave->SetName("higzSave");
2953 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2954 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2955 if (higzSpec) higz = higzSpec;
2956 else higzSpec = new THIGZ(defSize);
2957 higzSpec->SetName("higzSpec");
2962 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2965 higzSave->SetName("higz");
2969 //_____________________________________________________________________________
2970 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2974 // LEVMAX Depth level
2977 // This function draws the logical tree,
2978 // Each volume in the tree is represented by a TPaveTree object.
2979 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2980 // Use TPaveTree pop-up menu to select:
2983 // - drawing tree of parent
2989 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2993 //_____________________________________________________________________________
2994 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2998 // LEVMAX Depth level
3001 // This function draws the logical tree of the parent of name.
3005 // Scan list of volumes in JVOLUM
3007 Int_t gname, i, jvo, in, nin, jin, num;
3008 strncpy((char *) &gname, name, 4);
3009 for(i=1; i<=fGcnum->nvolum; i++) {
3010 jvo = fZlq[fGclink->jvolum-i];
3011 nin = Int_t(fZq[jvo+3]);
3012 if (nin == -1) nin = 1;
3013 for (in=1;in<=nin;in++) {
3015 num = Int_t(fZq[jin+2]);
3016 if(gname == fZiq[fGclink->jvolum+num]) {
3017 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
3019 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3027 //_____________________________________________________________________________
3028 void TGeant3::SetABAN(Int_t par)
3031 // par = 1 particles will be stopped according to their residual
3032 // range if they are not in a sensitive material and are
3033 // far enough from the boundary
3034 // 0 particles are transported normally
3036 fGcphys->dphys1 = par;
3040 //_____________________________________________________________________________
3041 void TGeant3::SetANNI(Int_t par)
3044 // To control positron annihilation.
3045 // par =0 no annihilation
3046 // =1 annihilation. Decays processed.
3047 // =2 annihilation. No decay products stored.
3049 fGcphys->ianni = par;
3053 //_____________________________________________________________________________
3054 void TGeant3::SetAUTO(Int_t par)
3057 // To control automatic calculation of tracking medium parameters:
3058 // par =0 no automatic calculation;
3059 // =1 automati calculation.
3061 fGctrak->igauto = par;
3065 //_____________________________________________________________________________
3066 void TGeant3::SetBOMB(Float_t boom)
3069 // BOOM : Exploding factor for volumes position
3071 // To 'explode' the detector. If BOOM is positive (values smaller
3072 // than 1. are suggested, but any value is possible)
3073 // all the volumes are shifted by a distance
3074 // proportional to BOOM along the direction between their centre
3075 // and the origin of the MARS; the volumes which are symmetric
3076 // with respect to this origin are simply not shown.
3077 // BOOM equal to 0 resets the normal mode.
3078 // A negative (greater than -1.) value of
3079 // BOOM will cause an 'implosion'; for even lower values of BOOM
3080 // the volumes' positions will be reflected respect to the origin.
3081 // This command can be useful to improve the 3D effect for very
3082 // complex detectors. The following commands will make explode the
3089 //_____________________________________________________________________________
3090 void TGeant3::SetBREM(Int_t par)
3093 // To control bremstrahlung.
3094 // par =0 no bremstrahlung
3095 // =1 bremstrahlung. Photon processed.
3096 // =2 bremstrahlung. No photon stored.
3098 fGcphys->ibrem = par;
3102 //_____________________________________________________________________________
3103 void TGeant3::SetCKOV(Int_t par)
3106 // To control Cerenkov production
3107 // par =0 no Cerenkov;
3109 // =2 Cerenkov with primary stopped at each step.
3111 fGctlit->itckov = par;
3115 //_____________________________________________________________________________
3116 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3117 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3120 // The hidden line removal technique is necessary to visualize properly
3121 // very complex detectors. At the same time, it can be useful to visualize
3122 // the inner elements of a detector in detail. This function allows
3123 // subtractions (via boolean operation) of BOX shape from any part of
3124 // the detector, therefore showing its inner contents.
3125 // If "*" is given as the name of the
3126 // volume to be clipped, all volumes are clipped by the given box.
3127 // A volume can be clipped at most twice.
3128 // if a volume is explicitely clipped twice,
3129 // the "*" will not act on it anymore. Giving "." as the name
3130 // of the volume to be clipped will reset the clipping.
3132 // NAME Name of volume to be clipped
3134 // XMIN Lower limit of the Shape X coordinate
3135 // XMAX Upper limit of the Shape X coordinate
3136 // YMIN Lower limit of the Shape Y coordinate
3137 // YMAX Upper limit of the Shape Y coordinate
3138 // ZMIN Lower limit of the Shape Z coordinate
3139 // ZMAX Upper limit of the Shape Z coordinate
3141 // This function performs a boolean subtraction between the volume
3142 // NAME and a box placed in the MARS according the values of the given
3148 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3151 //_____________________________________________________________________________
3152 void TGeant3::SetCOMP(Int_t par)
3155 // To control Compton scattering
3156 // par =0 no Compton
3157 // =1 Compton. Electron processed.
3158 // =2 Compton. No electron stored.
3161 fGcphys->icomp = par;
3164 //_____________________________________________________________________________
3165 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3166 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3167 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3168 Float_t ppcutm, Float_t tofmax)
3171 // CUTGAM Cut for gammas D=0.001
3172 // CUTELE Cut for electrons D=0.001
3173 // CUTHAD Cut for charged hadrons D=0.01
3174 // CUTNEU Cut for neutral hadrons D=0.01
3175 // CUTMUO Cut for muons D=0.01
3176 // BCUTE Cut for electron brems. D=-1.
3177 // BCUTM Cut for muon brems. D=-1.
3178 // DCUTE Cut for electron delta-rays D=-1.
3179 // DCUTM Cut for muon delta-rays D=-1.
3180 // PPCUTM Cut for e+e- pairs by muons D=0.01
3181 // TOFMAX Time of flight cut D=1.E+10
3183 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3184 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3186 // If one of the parameters from CUTGAM to PPCUTM included
3187 // is modified, cross-sections and energy loss tables must be
3188 // recomputed via the function Gphysi.
3190 fGccuts->cutgam = cutgam;
3191 fGccuts->cutele = cutele;
3192 fGccuts->cutneu = cutneu;
3193 fGccuts->cuthad = cuthad;
3194 fGccuts->cutmuo = cutmuo;
3195 fGccuts->bcute = bcute;
3196 fGccuts->bcutm = bcutm;
3197 fGccuts->dcute = dcute;
3198 fGccuts->dcutm = dcutm;
3199 fGccuts->ppcutm = ppcutm;
3200 fGccuts->tofmax = tofmax;
3203 //_____________________________________________________________________________
3204 void TGeant3::SetDCAY(Int_t par)
3207 // To control Decay mechanism.
3208 // par =0 no decays.
3209 // =1 Decays. secondaries processed.
3210 // =2 Decays. No secondaries stored.
3212 fGcphys->idcay = par;
3216 //_____________________________________________________________________________
3217 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3220 // Set the debug flag and frequency
3221 // Selected debug output will be printed from
3222 // event emin to even emax each emod event
3224 fGcflag->idemin = emin;
3225 fGcflag->idemax = emax;
3226 fGcflag->itest = emod;
3230 //_____________________________________________________________________________
3231 void TGeant3::SetDRAY(Int_t par)
3234 // To control delta rays mechanism.
3235 // par =0 no delta rays.
3236 // =1 Delta rays. secondaries processed.
3237 // =2 Delta rays. No secondaries stored.
3239 fGcphys->idray = par;
3242 //_____________________________________________________________________________
3243 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3246 // To control cross section tabulations
3247 // ekmin = minimum kinetic energy in GeV
3248 // ekmax = maximum kinetic energy in GeV
3249 // nekbin = number of logatithmic bins (<200)
3251 fGcmulo->ekmin = ekmin;
3252 fGcmulo->ekmax = ekmax;
3253 fGcmulo->nekbin = nekbin;
3256 //_____________________________________________________________________________
3257 void TGeant3::SetHADR(Int_t par)
3260 // To control hadronic interactions.
3261 // par =0 no hadronic interactions.
3262 // =1 Hadronic interactions. secondaries processed.
3263 // =2 Hadronic interactions. No secondaries stored.
3265 fGcphys->ihadr = par;
3268 //_____________________________________________________________________________
3269 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3270 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3271 Float_t xk8, Float_t xk9, Float_t xk10)
3274 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3275 // Their meaning is user defined
3277 fGckine->ikine = kine;
3278 fGckine->pkine[0] = xk1;
3279 fGckine->pkine[1] = xk2;
3280 fGckine->pkine[2] = xk3;
3281 fGckine->pkine[3] = xk4;
3282 fGckine->pkine[4] = xk5;
3283 fGckine->pkine[5] = xk6;
3284 fGckine->pkine[6] = xk7;
3285 fGckine->pkine[7] = xk8;
3286 fGckine->pkine[8] = xk9;
3287 fGckine->pkine[9] = xk10;
3290 //_____________________________________________________________________________
3291 void TGeant3::SetLOSS(Int_t par)
3294 // To control energy loss.
3295 // par =0 no energy loss;
3296 // =1 restricted energy loss fluctuations;
3297 // =2 complete energy loss fluctuations;
3299 // =4 no energy loss fluctuations.
3300 // If the value ILOSS is changed, then cross-sections and energy loss
3301 // tables must be recomputed via the command 'PHYSI'.
3303 fGcphys->iloss = par;
3307 //_____________________________________________________________________________
3308 void TGeant3::SetMULS(Int_t par)
3311 // To control multiple scattering.
3312 // par =0 no multiple scattering.
3313 // =1 Moliere or Coulomb scattering.
3314 // =2 Moliere or Coulomb scattering.
3315 // =3 Gaussian scattering.
3317 fGcphys->imuls = par;
3321 //_____________________________________________________________________________
3322 void TGeant3::SetMUNU(Int_t par)
3325 // To control muon nuclear interactions.
3326 // par =0 no muon-nuclear interactions.
3327 // =1 Nuclear interactions. Secondaries processed.
3328 // =2 Nuclear interactions. Secondaries not processed.
3330 fGcphys->imunu = par;
3333 //_____________________________________________________________________________
3334 void TGeant3::SetOPTI(Int_t par)
3337 // This flag controls the tracking optimisation performed via the
3339 // 1 no optimisation at all; GSORD calls disabled;
3340 // 0 no optimisation; only user calls to GSORD kept;
3341 // 1 all non-GSORDered volumes are ordered along the best axis;
3342 // 2 all volumes are ordered along the best axis.
3344 fGcopti->ioptim = par;
3347 //_____________________________________________________________________________
3348 void TGeant3::SetPAIR(Int_t par)
3351 // To control pair production mechanism.
3352 // par =0 no pair production.
3353 // =1 Pair production. secondaries processed.
3354 // =2 Pair production. No secondaries stored.
3356 fGcphys->ipair = par;
3360 //_____________________________________________________________________________
3361 void TGeant3::SetPFIS(Int_t par)
3364 // To control photo fission mechanism.
3365 // par =0 no photo fission.
3366 // =1 Photo fission. secondaries processed.
3367 // =2 Photo fission. No secondaries stored.
3369 fGcphys->ipfis = par;
3372 //_____________________________________________________________________________
3373 void TGeant3::SetPHOT(Int_t par)
3376 // To control Photo effect.
3377 // par =0 no photo electric effect.
3378 // =1 Photo effect. Electron processed.
3379 // =2 Photo effect. No electron stored.
3381 fGcphys->iphot = par;
3384 //_____________________________________________________________________________
3385 void TGeant3::SetRAYL(Int_t par)
3388 // To control Rayleigh scattering.
3389 // par =0 no Rayleigh scattering.
3392 fGcphys->irayl = par;
3395 //_____________________________________________________________________________
3396 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3400 // val New switch value
3402 // Change one element of array ISWIT(10) in /GCFLAG/
3404 if (sw <= 0 || sw > 10) return;
3405 fGcflag->iswit[sw-1] = val;
3409 //_____________________________________________________________________________
3410 void TGeant3::SetTRIG(Int_t nevents)
3413 // Set number of events to be run
3415 fGcflag->nevent = nevents;
3418 //_____________________________________________________________________________
3419 void TGeant3::SetUserDecay(Int_t pdg)
3422 // Force the decays of particles to be done with Pythia
3423 // and not with the Geant routines.
3424 // just kill pointers doing mzdrop
3426 Int_t ipart = IdFromPDG(pdg);
3428 printf("Particle %d not in geant\n",pdg);
3431 Int_t jpart=fGclink->jpart;
3432 Int_t jpa=fZlq[jpart-ipart];
3435 Int_t jpa1=fZlq[jpa-1];
3437 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3438 Int_t jpa2=fZlq[jpa-2];
3440 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3444 //______________________________________________________________________________
3445 void TGeant3::Vname(const char *name, char *vname)
3448 // convert name to upper case. Make vname at least 4 chars
3450 Int_t l = strlen(name);
3453 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3454 for (i=l;i<4;i++) vname[i] = ' ';
3458 //______________________________________________________________________________
3459 void TGeant3::Ertrgo()
3464 //______________________________________________________________________________
3465 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3466 const Float_t *x2, const Float_t *p2,
3467 Int_t ipa, Option_t *chopt)
3469 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3472 //_____________________________________________________________________________
3473 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3474 Int_t number, Int_t nlevel)
3478 // ******************************************************************
3480 // * Write out the geometry of the detector in EUCLID file format *
3482 // * filnam : will be with the extension .euc *
3483 // * topvol : volume name of the starting node *
3484 // * number : copy number of topvol (relevant for gsposp) *
3485 // * nlevel : number of levels in the tree structure *
3486 // * to be written out, starting from topvol *
3488 // * Author : M. Maire *
3490 // ******************************************************************
3492 // File filnam.tme is written out with the definitions of tracking
3493 // medias and materials.
3494 // As to restore original numbers for materials and medias, program
3495 // searches in the file euc_medi.dat and comparing main parameters of
3496 // the mat. defined inside geant and the one in file recognizes them
3497 // and is able to take number from file. If for any material or medium,
3498 // this procedure fails, ordering starts from 1.
3499 // Arrays IOTMED and IOMATE are used for this procedure
3501 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3502 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3504 Int_t i, end, itm, irm, jrm, k, nmed;
3508 char *filext, *filetme;
3509 char natmed[21], namate[21];
3510 char natmedc[21], namatec[21];
3511 char key[5], name[5], mother[5], konly[5];
3513 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3514 Int_t mlevel, numbr, natt, numed, nin, ndata;
3515 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3516 Int_t jdiv, ivin, in, jin, jvin, irot;
3517 Int_t jtm, imat, jma, flag=0, imatc;
3518 Float_t az, dens, radl, absl, a, step, x, y, z;
3519 Int_t npar, ndvmx, left;
3520 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3522 Int_t iomate[100], iotmed[100];
3523 Float_t par[50], att[20], ubuf[50];
3526 Int_t level, ndiv, iaxe;
3527 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3528 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3529 Float_t tmaxf, stemax, deemax, epsil, stmin;
3530 const char *f10000="!\n%s\n!\n";
3531 //Open the input file
3533 for(i=0;i<end;i++) if(filnam[i]=='.') {
3537 filext=new char[end+5];
3538 filetme=new char[end+5];
3539 strncpy(filext,filnam,end);
3540 strncpy(filetme,filnam,end);
3542 // *** The output filnam name will be with extension '.euc'
3543 strcpy(&filext[end],".euc");
3544 strcpy(&filetme[end],".tme");
3545 lun=fopen(filext,"w");
3547 // *** Initialisation of the working space
3548 iadvol=fGcnum->nvolum;
3549 iadtmd=iadvol+fGcnum->nvolum;
3550 iadrot=iadtmd+fGcnum->ntmed;
3551 if(fGclink->jrotm) {
3552 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3556 nwtot=iadrot+fGcnum->nrotm;
3557 qws = new float[nwtot+1];
3558 for (i=0;i<nwtot+1;i++) qws[i]=0;
3561 if(nlevel==0) mlevel=20;
3563 // *** find the top volume and put it in the stak
3564 numbr = number>0 ? number : 1;
3565 Gfpara(topvol,numbr,1,npar,natt,par,att);
3567 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3572 // *** authorized shape ?
3573 strncpy((char *)&iname, topvol, 4);
3575 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3579 jvo = fZlq[fGclink->jvolum-ivo];
3580 ish = Int_t (fZq[jvo+2]);
3582 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3589 iws[iadvol+ivo] = level;
3592 //*** flag all volumes and fill the stak
3596 // pick the next volume in stak
3598 ivo = TMath::Abs(iws[ivstak]);
3599 jvo = fZlq[fGclink->jvolum - ivo];
3601 // flag the tracking medium
3602 numed = Int_t (fZq[jvo + 4]);
3603 iws[iadtmd + numed] = 1;
3605 // get the daughters ...
3606 level = iws[iadvol+ivo];
3607 if (level < mlevel) {
3609 nin = Int_t (fZq[jvo + 3]);
3611 // from division ...
3613 jdiv = fZlq[jvo - 1];
3614 ivin = Int_t (fZq[jdiv + 2]);
3616 iws[nvstak] = -ivin;
3617 iws[iadvol+ivin] = level;
3619 // from position ...
3620 } else if (nin > 0) {
3621 for(in=1; in<=nin; in++) {
3622 jin = fZlq[jvo - in];
3623 ivin = Int_t (fZq[jin + 2 ]);
3624 jvin = fZlq[fGclink->jvolum - ivin];
3625 ish = Int_t (fZq[jvin + 2]);
3626 // authorized shape ?
3628 // not yet flagged ?
3629 if (iws[iadvol+ivin]==0) {
3632 iws[iadvol+ivin] = level;
3634 // flag the rotation matrix
3635 irot = Int_t ( fZq[jin + 4 ]);
3636 if (irot > 0) iws[iadrot+irot] = 1;
3642 // next volume in stak ?
3643 if (ivstak < nvstak) goto L10;
3645 // *** restore original material and media numbers
3646 // file euc_medi.dat is needed to compare materials and medias
3648 FILE* luncor=fopen("euc_medi.dat","r");
3651 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3652 if (iws[iadtmd+itm] > 0) {
3653 jtm = fZlq[fGclink->jtmed-itm];
3654 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3655 imat = Int_t (fZq[jtm+6]);
3656 jma = fZlq[fGclink->jmate-imat];
3658 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3661 strncpy(namate,(char *)&fZiq[jma+1],20);
3664 //** find the material original number
3667 iret=fscanf(luncor,"%4s,%130s",key,card);
3668 if(iret<=0) goto L26;
3670 if(!strcmp(key,"MATE")) {
3671 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3672 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3673 if(!strcmp(namatec,namate)) {
3674 if(az==a && zc==z && densc==dens && radlc==radl
3675 && abslc==absl && nparc==nparc) {
3678 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3680 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3684 if(strcmp(key,"END") && !flag) goto L23;
3686 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3690 //*** restore original tracking medium number
3693 iret=fscanf(luncor,"%4s,%130s",key,card);
3694 if(iret<=0) goto L26;
3696 if (!strcmp(key,"TMED")) {
3697 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3698 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3699 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3700 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3701 epsil,stmin,ubuf,&nwbuf);
3702 if(!strcmp(natmedc,natmed)) {
3703 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3706 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3709 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3713 if(strcmp(key,"END") && !flag) goto L24;
3715 printf("cannot restore original number for medium : %s\n",natmed);
3723 L26: printf("*** GWEUCL *** cannot read the data file\n");
3725 L29: if(luncor) fclose (luncor);
3728 // *** write down the tracking medium definition
3730 strcpy(card,"! Tracking medium");
3731 fprintf(lun,f10000,card);
3733 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3734 if (iws[iadtmd+itm]>0) {
3735 jtm = fZlq[fGclink->jtmed-itm];
3736 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3738 imat = Int_t (fZq[jtm+6]);
3739 jma = fZlq[fGclink->jmate-imat];
3740 //* order media from one, if comparing with database failed
3742 iotmed[itm]=++imxtmed;
3743 iomate[imat]=++imxmate;
3748 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3751 strncpy(namate,(char *)&fZiq[jma+1],20);
3754 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3758 //* *** write down the rotation matrix
3760 strcpy(card,"! Reperes");
3761 fprintf(lun,f10000,card);
3763 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3764 if (iws[iadrot+irm]>0) {
3765 jrm = fZlq[fGclink->jrotm-irm];
3766 fprintf(lun,"ROTM %3d",irm);
3767 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3772 //* *** write down the volume definition
3774 strcpy(card,"! Volumes");
3775 fprintf(lun,f10000,card);
3777 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3780 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3782 jvo = fZlq[fGclink->jvolum-ivo];
3783 ish = Int_t (fZq[jvo+2]);
3784 nmed = Int_t (fZq[jvo+4]);
3785 npar = Int_t (fZq[jvo+5]);
3787 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3788 Gckpar (ish,npar,par);
3789 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3790 for(i=0;i<(npar-1)/6+1;i++) {
3793 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3797 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3802 //* *** write down the division of volumes
3804 fprintf(lun,f10000,"! Divisions");
3805 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3806 ivo = TMath::Abs(iws[ivstak]);
3807 jvo = fZlq[fGclink->jvolum-ivo];
3808 ish = Int_t (fZq[jvo+2]);
3809 nin = Int_t (fZq[jvo+3]);
3810 //* this volume is divided ...
3813 iaxe = Int_t ( fZq[jdiv+1]);
3814 ivin = Int_t ( fZq[jdiv+2]);
3815 ndiv = Int_t ( fZq[jdiv+3]);
3818 jvin = fZlq[fGclink->jvolum-ivin];
3819 nmed = Int_t ( fZq[jvin+4]);
3820 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3822 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3824 if ((step<=0.)||(ish>=11)) {
3825 //* volume with negative parameter or gsposp or pgon ...
3826 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3827 } else if ((ndiv<=0)||(ish==10)) {
3828 //* volume with negative parameter or gsposp or para ...
3829 ndvmx = TMath::Abs(ndiv);
3830 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3831 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3833 //* normal volume : all kind of division are equivalent
3834 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3835 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3840 //* *** write down the the positionnement of volumes
3842 fprintf(lun,f10000,"! Positionnements\n");
3844 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3845 ivo = TMath::Abs(iws[ivstak]);
3846 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3848 jvo = fZlq[fGclink->jvolum-ivo];
3849 nin = Int_t( fZq[jvo+3]);
3850 //* this volume has daughters ...
3852 for (in=1;in<=nin;in++) {
3854 ivin = Int_t (fZq[jin +2]);
3855 numb = Int_t (fZq[jin +3]);
3856 irot = Int_t (fZq[jin +4]);
3860 strcpy(konly,"ONLY");
3861 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
3862 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
3864 jvin = fZlq[fGclink->jvolum-ivin];
3865 ish = Int_t (fZq[jvin+2]);
3866 //* gspos or gsposp ?
3867 ndata = fZiq[jin-1];
3869 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
3870 name,numb,mother,x,y,z,irot,konly);
3872 npar = Int_t (fZq[jin+9]);
3873 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
3874 Gckpar (ish,npar,par);
3875 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
3876 name,numb,mother,x,y,z,irot,konly,npar);
3878 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3885 fprintf(lun,"END\n");
3888 //****** write down the materials and medias *****
3890 lun=fopen(filetme,"w");
3892 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3893 if (iws[iadtmd+itm]>0) {
3894 jtm = fZlq[fGclink->jtmed-itm];
3895 strncpy(natmed,(char*)&fZiq[jtm+1],4);
3896 imat = Int_t (fZq[jtm+6]);
3897 jma = Int_t (fZlq[fGclink->jmate-imat]);
3899 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
3900 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
3901 iomate[imat],namate,a,z,dens,radl,absl,npar);
3905 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3909 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
3910 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
3911 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
3912 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
3916 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3922 fprintf(lun,"END\n");
3924 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
3925 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
3934 //_____________________________________________________________________________
3935 void TGeant3::Streamer(TBuffer &R__b)
3938 // Stream an object of class TGeant3.
3940 if (R__b.IsReading()) {
3941 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
3942 AliMC::Streamer(R__b);
3945 R__b.ReadStaticArray(fPDGCode);
3947 R__b.WriteVersion(TGeant3::IsA());
3948 AliMC::Streamer(R__b);
3951 R__b.WriteArray(fPDGCode, fNPDGCodes);