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.28 2000/06/29 10:51:55 morsch
19 Add some charmed and bottom baryons to the particle list (TDatabasePDG). This
20 is needed by Hijing. Should be part of a future review of TDatabasePDG.
22 Revision 1.27 2000/06/21 17:40:15 fca
23 Adding possibility to set ISTRA, PAI model
25 Revision 1.26 2000/05/16 13:10:41 fca
26 New method IsNewTrack and fix for a problem in Father-Daughter relations
28 Revision 1.25 2000/04/07 11:12:35 fca
29 G4 compatibility changes
31 Revision 1.24 2000/02/28 21:03:57 fca
32 Some additions to improve the compatibility with G4
34 Revision 1.23 2000/02/23 16:25:25 fca
35 AliVMC and AliGeant3 classes introduced
36 ReadEuclid moved from AliRun to AliModule
38 Revision 1.22 2000/01/18 15:40:13 morsch
39 Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
40 Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
42 Revision 1.21 2000/01/17 19:41:17 fca
45 Revision 1.20 2000/01/12 11:29:27 fca
48 Revision 1.19 1999/12/17 09:03:12 fca
49 Introduce a names array
51 Revision 1.18 1999/11/26 16:55:39 fca
52 Reimplement CurrentVolName() to avoid memory leaks
54 Revision 1.17 1999/11/03 16:58:28 fca
55 Correct source of address violation in creating character string
57 Revision 1.16 1999/11/03 13:17:08 fca
58 Have ProdProcess return const char*
60 Revision 1.15 1999/10/26 06:04:50 fca
61 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
63 Revision 1.14 1999/09/29 09:24:30 fca
64 Introduction of the Copyright and cvs Log
68 ///////////////////////////////////////////////////////////////////////////////
70 // Interface Class to the Geant3.21 MonteCarlo //
74 <img src="picts/TGeant3Class.gif">
79 ///////////////////////////////////////////////////////////////////////////////
85 #include <TDatabasePDG.h>
86 #include "AliCallf77.h"
89 # define gzebra gzebra_
90 # define grfile grfile_
91 # define gpcxyz gpcxyz_
92 # define ggclos ggclos_
95 # define gcinit gcinit_
98 # define gtrigc gtrigc_
99 # define gtrigi gtrigi_
100 # define gwork gwork_
101 # define gzinit gzinit_
102 # define gfmate gfmate_
103 # define gfpart gfpart_
104 # define gftmed gftmed_
105 # define gftmat gftmat_
106 # define gmate gmate_
107 # define gpart gpart_
109 # define gsmate gsmate_
110 # define gsmixt gsmixt_
111 # define gspart gspart_
112 # define gstmed gstmed_
113 # define gsckov gsckov_
114 # define gstpar gstpar_
115 # define gfkine gfkine_
116 # define gfvert gfvert_
117 # define gskine gskine_
118 # define gsvert gsvert_
119 # define gphysi gphysi_
120 # define gdebug gdebug_
121 # define gekbin gekbin_
122 # define gfinds gfinds_
123 # define gsking gsking_
124 # define gskpho gskpho_
125 # define gsstak gsstak_
126 # define gsxyz gsxyz_
127 # define gtrack gtrack_
128 # define gtreve gtreve_
129 # define gtreveroot gtreveroot_
130 # define grndm grndm_
131 # define grndmq grndmq_
132 # define gdtom gdtom_
133 # define glmoth glmoth_
134 # define gmedia gmedia_
135 # define gmtod gmtod_
136 # define gsdvn gsdvn_
137 # define gsdvn2 gsdvn2_
138 # define gsdvs gsdvs_
139 # define gsdvs2 gsdvs2_
140 # define gsdvt gsdvt_
141 # define gsdvt2 gsdvt2_
142 # define gsord gsord_
143 # define gspos gspos_
144 # define gsposp gsposp_
145 # define gsrotm gsrotm_
146 # define gprotm gprotm_
147 # define gsvolu gsvolu_
148 # define gprint gprint_
149 # define gdinit gdinit_
150 # define gdopt gdopt_
151 # define gdraw gdraw_
152 # define gdrayt gdrayt_
153 # define gdrawc gdrawc_
154 # define gdrawx gdrawx_
155 # define gdhead gdhead_
156 # define gdwmn1 gdwmn1_
157 # define gdwmn2 gdwmn2_
158 # define gdwmn3 gdwmn3_
159 # define gdxyz gdxyz_
160 # define gdcxyz gdcxyz_
161 # define gdman gdman_
162 # define gdspec gdspec_
163 # define gdtree gdtree_
164 # define gdelet gdelet_
165 # define gdclos gdclos_
166 # define gdshow gdshow_
167 # define gdopen gdopen_
168 # define dzshow dzshow_
169 # define gsatt gsatt_
170 # define gfpara gfpara_
171 # define gckpar gckpar_
172 # define gckmat gckmat_
173 # define geditv geditv_
174 # define mzdrop mzdrop_
176 # define ertrak ertrak_
177 # define ertrgo ertrgo_
179 # define setbomb setbomb_
180 # define setclip setclip_
181 # define gcomad gcomad_
183 # define gbrelm gbrelm_
184 # define gprelm gprelm_
186 # define gzebra GZEBRA
187 # define grfile GRFILE
188 # define gpcxyz GPCXYZ
189 # define ggclos GGCLOS
192 # define gcinit GCINIT
195 # define gtrigc GTRIGC
196 # define gtrigi GTRIGI
198 # define gzinit GZINIT
199 # define gfmate GFMATE
200 # define gfpart GFPART
201 # define gftmed GFTMED
202 # define gftmat GFTMAT
206 # define gsmate GSMATE
207 # define gsmixt GSMIXT
208 # define gspart GSPART
209 # define gstmed GSTMED
210 # define gsckov GSCKOV
211 # define gstpar GSTPAR
212 # define gfkine GFKINE
213 # define gfvert GFVERT
214 # define gskine GSKINE
215 # define gsvert GSVERT
216 # define gphysi GPHYSI
217 # define gdebug GDEBUG
218 # define gekbin GEKBIN
219 # define gfinds GFINDS
220 # define gsking GSKING
221 # define gskpho GSKPHO
222 # define gsstak GSSTAK
224 # define gtrack GTRACK
225 # define gtreve GTREVE
226 # define gtreveroot GTREVEROOT
228 # define grndmq GRNDMQ
230 # define glmoth GLMOTH
231 # define gmedia GMEDIA
234 # define gsdvn2 GSDVN2
236 # define gsdvs2 GSDVS2
238 # define gsdvt2 GSDVT2
241 # define gsposp GSPOSP
242 # define gsrotm GSROTM
243 # define gprotm GPROTM
244 # define gsvolu GSVOLU
245 # define gprint GPRINT
246 # define gdinit GDINIT
249 # define gdrayt GDRAYT
250 # define gdrawc GDRAWC
251 # define gdrawx GDRAWX
252 # define gdhead GDHEAD
253 # define gdwmn1 GDWMN1
254 # define gdwmn2 GDWMN2
255 # define gdwmn3 GDWMN3
257 # define gdcxyz GDCXYZ
259 # define gdfspc GDFSPC
260 # define gdspec GDSPEC
261 # define gdtree GDTREE
262 # define gdelet GDELET
263 # define gdclos GDCLOS
264 # define gdshow GDSHOW
265 # define gdopen GDOPEN
266 # define dzshow DZSHOW
268 # define gfpara GFPARA
269 # define gckpar GCKPAR
270 # define gckmat GCKMAT
271 # define geditv GEDITV
272 # define mzdrop MZDROP
274 # define ertrak ERTRAK
275 # define ertrgo ERTRGO
277 # define setbomb SETBOMB
278 # define setclip SETCLIP
279 # define gcomad GCOMAD
281 # define gbrelm GBRELM
282 # define gprelm GPRELM
286 //____________________________________________________________________________
290 // Prototypes for GEANT functions
292 void type_of_call gzebra(const int&);
294 void type_of_call gpcxyz();
296 void type_of_call ggclos();
298 void type_of_call glast();
300 void type_of_call ginit();
302 void type_of_call gcinit();
304 void type_of_call grun();
306 void type_of_call gtrig();
308 void type_of_call gtrigc();
310 void type_of_call gtrigi();
312 void type_of_call gwork(const int&);
314 void type_of_call gzinit();
316 void type_of_call gmate();
318 void type_of_call gpart();
320 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
322 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
323 Int_t &, Float_t *, Int_t &);
325 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
326 Float_t &, Float_t *, Int_t &);
328 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
331 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
334 void type_of_call gphysi();
336 void type_of_call gdebug();
338 void type_of_call gekbin();
340 void type_of_call gfinds();
342 void type_of_call gsking(Int_t &);
344 void type_of_call gskpho(Int_t &);
346 void type_of_call gsstak(Int_t &);
348 void type_of_call gsxyz();
350 void type_of_call gtrack();
352 void type_of_call gtreve();
354 void type_of_call gtreveroot();
356 void type_of_call grndm(Float_t *, const Int_t &);
358 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
361 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
363 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
364 Int_t *, Int_t * DEFCHARL);
366 void type_of_call gmedia(Float_t *, Int_t &);
368 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
370 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
371 const Float_t &, const Float_t &, const Float_t &,
374 void type_of_call gprotm(const Int_t &);
376 void type_of_call grfile(const Int_t&, DEFCHARD,
377 DEFCHARD DEFCHARL DEFCHARL);
379 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
380 Float_t &, Float_t &, Float_t &, Float_t *,
383 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
384 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
386 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
387 Float_t &, Float_t &, Float_t &, Float_t &,
388 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
390 void type_of_call gftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
392 ,Float_t *, Int_t & DEFCHARL);
394 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
395 Float_t &, Float_t &, Float_t &, Float_t *,
398 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
399 Float_t &, Int_t &, Float_t * DEFCHARL);
401 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
402 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
405 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
406 Float_t &, Float_t &, Float_t &, Float_t &,
407 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
409 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
410 Float_t *absco, Float_t *effic, Float_t *rindex);
411 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
413 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
416 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
417 Int_t & DEFCHARL DEFCHARL);
419 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
422 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
423 Int_t & DEFCHARL DEFCHARL);
425 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
426 Int_t & DEFCHARL DEFCHARL);
428 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
429 Int_t &, Int_t & DEFCHARL DEFCHARL);
431 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
433 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
434 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
437 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
438 Float_t &, Int_t &, DEFCHARD,
439 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
441 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
442 Int_t & DEFCHARL DEFCHARL);
444 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
446 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
449 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
451 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
453 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
455 void type_of_call gdinit();
457 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
459 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
460 Float_t &, Float_t &, Float_t & DEFCHARL);
461 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
462 Float_t &, Float_t &, Float_t & DEFCHARL);
463 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
464 Float_t &, Float_t & DEFCHARL);
465 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
466 Float_t &, Float_t &, Float_t &, Float_t &,
468 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
469 void type_of_call gdxyz(Int_t &);
470 void type_of_call gdcxyz();
471 void type_of_call gdman(Float_t &, Float_t &);
472 void type_of_call gdwmn1(Float_t &, Float_t &);
473 void type_of_call gdwmn2(Float_t &, Float_t &);
474 void type_of_call gdwmn3(Float_t &, Float_t &);
475 void type_of_call gdspec(DEFCHARD DEFCHARL);
476 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
477 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
479 void type_of_call gdopen(Int_t &);
480 void type_of_call gdclos();
481 void type_of_call gdelet(Int_t &);
482 void type_of_call gdshow(Int_t &);
483 void type_of_call geditv(Int_t &) {;}
486 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
487 const int&, const int&, const int& DEFCHARL
490 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
492 void type_of_call setbomb(Float_t &);
493 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
494 Float_t &, Float_t & DEFCHARL);
495 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
497 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
498 const Float_t *x2, const Float_t *p2,
499 const Int_t &ipa, DEFCHARD DEFCHARL);
501 void type_of_call ertrgo();
503 float type_of_call gbrelm(const Float_t &z, const Float_t& t, const Float_t& cut);
504 float type_of_call gprelm(const Float_t &z, const Float_t& t, const Float_t& cut);
508 // Geant3 global pointer
510 static Int_t defSize = 600;
514 //____________________________________________________________________________
518 // Default constructor
522 //____________________________________________________________________________
523 TGeant3::TGeant3(const char *title, Int_t nwgeant)
524 :AliMC("TGeant3",title)
527 // Standard constructor for TGeant3 with ZEBRA initialisation
538 // Load Address of Geant3 commons
541 // Zero number of particles
545 //____________________________________________________________________________
546 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
547 Float_t &radl, Float_t &absl) const
550 // Return the parameters of the current material during transport
554 dens = fGcmate->dens;
555 radl = fGcmate->radl;
556 absl = fGcmate->absl;
557 return 1; //this could be the number of elements in mixture
560 //____________________________________________________________________________
561 void TGeant3::DefaultRange()
564 // Set range of current drawing pad to 20x20 cm
570 higz->Range(0,0,20,20);
573 //____________________________________________________________________________
574 void TGeant3::InitHIGZ()
585 //____________________________________________________________________________
586 void TGeant3::LoadAddress()
589 // Assigns the address of the GEANT common blocks to the structures
590 // that allow their access from C++
593 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
594 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
595 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
596 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
597 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
598 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
599 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
600 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
601 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
602 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
603 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
604 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
605 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
606 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
607 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
608 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
609 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
610 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
611 gcomad(PASSCHARD("GCPHLT"),(int*&) fGcphlt PASSCHARL("GCPHLT"));
612 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
613 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
614 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
617 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
618 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
619 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
620 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
622 // Variables for ZEBRA store
623 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
625 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
630 //_____________________________________________________________________________
631 void TGeant3::GeomIter()
634 // Geometry iterator for moving upward in the geometry tree
635 // Initialise the iterator
637 fNextVol=fGcvolu->nlevel;
640 //____________________________________________________________________________
641 void TGeant3::FinishGeometry()
643 //Close the geometry structure
647 //____________________________________________________________________________
648 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
651 // Geometry iterator for moving upward in the geometry tree
652 // Return next volume up
657 gname=fGcvolu->names[fNextVol];
658 copy=fGcvolu->number[fNextVol];
659 i=fGcvolu->lvolum[fNextVol];
660 name = fVolNames[i-1];
661 if(gname == fZiq[fGclink->jvolum+i]) return i;
662 else printf("GeomTree: Volume %s not found in bank\n",name);
667 //_____________________________________________________________________________
668 void TGeant3::BuildPhysics()
673 //_____________________________________________________________________________
674 Int_t TGeant3::CurrentVolID(Int_t ©) const
677 // Returns the current volume ID and copy number
680 if( (i=fGcvolu->nlevel-1) < 0 ) {
681 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
683 gname=fGcvolu->names[i];
684 copy=fGcvolu->number[i];
685 i=fGcvolu->lvolum[i];
686 if(gname == fZiq[fGclink->jvolum+i]) return i;
687 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
692 //_____________________________________________________________________________
693 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
696 // Return the current volume "off" upward in the geometrical tree
697 // ID and copy number
700 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
701 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
702 off,fGcvolu->nlevel);
704 gname=fGcvolu->names[i];
705 copy=fGcvolu->number[i];
706 i=fGcvolu->lvolum[i];
707 if(gname == fZiq[fGclink->jvolum+i]) return i;
708 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
713 //_____________________________________________________________________________
714 const char* TGeant3::CurrentVolName() const
717 // Returns the current volume name
720 if( (i=fGcvolu->nlevel-1) < 0 ) {
721 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
723 gname=fGcvolu->names[i];
724 i=fGcvolu->lvolum[i];
725 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
726 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
731 //_____________________________________________________________________________
732 const char* TGeant3::CurrentVolOffName(Int_t off) const
735 // Return the current volume "off" upward in the geometrical tree
736 // ID, name and copy number
737 // if name=0 no name is returned
740 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
741 Warning("CurrentVolOffName",
742 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
744 gname=fGcvolu->names[i];
745 i=fGcvolu->lvolum[i];
746 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
747 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
752 //_____________________________________________________________________________
753 Int_t TGeant3::IdFromPDG(Int_t pdg) const
756 // Return Geant3 code from PDG and pseudo ENDF code
758 for(Int_t i=0;i<fNPDGCodes;++i)
759 if(pdg==fPDGCode[i]) return i;
763 //_____________________________________________________________________________
764 Int_t TGeant3::PDGFromId(Int_t id) const
766 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
770 //_____________________________________________________________________________
771 void TGeant3::DefineParticles()
774 // Define standard Geant 3 particles
777 // Load standard numbers for GEANT particles and PDG conversion
778 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
779 fPDGCode[fNPDGCodes++]=22; // 1 = photon
780 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
781 fPDGCode[fNPDGCodes++]=11; // 3 = electron
782 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
783 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
784 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
785 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
786 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
787 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
788 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
789 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
790 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
791 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
792 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
793 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
794 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
795 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
796 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
797 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
798 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
799 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
800 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
801 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
802 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
803 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
804 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
805 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
806 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
807 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
808 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
809 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
810 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
817 /* --- Define additional particles */
818 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
819 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
821 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
822 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
824 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
825 fPDGCode[fNPDGCodes++]=411; // 35 = D+
827 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
828 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
830 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
831 fPDGCode[fNPDGCodes++]=421; // 37 = D0
833 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
834 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
836 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
838 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
840 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
842 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
843 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
845 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
846 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
848 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
849 fPDGCode[fNPDGCodes++]=113; // 37 = D0
852 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
854 // and numbers above 5 000 000 for special applications
857 const Int_t kion=10000000;
859 const Int_t kspe=50000000;
861 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
863 const Double_t autogev=0.9314943228;
864 const Double_t hslash = 1.0545726663e-27;
865 const Double_t erggev = 1/1.6021773349e-3;
866 const Double_t hshgev = hslash*erggev;
867 const Double_t yearstosec = 3600*24*365.25;
870 // mass and life-time from PDG
871 pdgDB->AddParticle("B(s)*0","B(s)*0",
872 5.4163, kTRUE, 0.047, +0.,"Meson", 533);
874 pdgDB->AddParticle("B(s)*0 bar","B(s)*0 bar",
875 5.4163, kTRUE, 0.047, -0.,"Meson", -533);
879 // value for mass used by Hijing
880 pdgDB->AddParticle("Sigma(c)*+","Sigma(c)*+",
881 2.4536, kTRUE, -1., +1.,"Baryon", 4214);
883 pdgDB->AddParticle("Sigma(c)*-","Sigma(c)*-",
884 2.4536, kTRUE, -1., -1.,"Baryon", -4214);
885 // equivalent to 4312 ? Hijing uses m=2.55
886 pdgDB->AddParticle("Xsi(c)0","Xsi(c)0",
887 2.4703, kTRUE, -1., +0.,"Baryon", 4132);
889 pdgDB->AddParticle("Xsi(c)0 bar","Xsi(c)0 bar",
890 2.4703, kTRUE, -1., -0.,"Baryon", -4132);
891 // equivalent to 4322 ? Hijing uses m=2.55
892 pdgDB->AddParticle("Xi(c)+","Xi(c)+",
893 2.4656, kFALSE, -1., +1.,"Baryon", 4232);
895 pdgDB->AddParticle("Xi(c)-","Xi(c)-",
896 2.4656, kFALSE, -1., -1.,"Baryon", -4232);
897 // mass values from Hijing
899 pdgDB->AddParticle("Xsi(c)*0","Xsi(c)*0",
900 2.63, kTRUE, -1., +0.,"Baryon", 4314);
902 pdgDB->AddParticle("Xsi(c)*0 bar","Xsi(c)*0 bar",
903 2.63, kTRUE, -1., -0.,"Baryon", -4314);
905 pdgDB->AddParticle("Xsi(c)*+","Xsi(c)*+",
906 2.63, kTRUE, -1., +1.,"Baryon", 4324);
908 pdgDB->AddParticle("Xsi(c)*-","Xsi(c)*-",
909 2.63, kTRUE, -1., -1.,"Baryon", -4324);
911 // pdg mass value, Hijing uses m=2.73.
912 pdgDB->AddParticle("Omega(c)0","Omega(c)0",
913 2.7040, kFALSE, hshgev/0.064e-12, +0.,"Baryon", 4332);
915 pdgDB->AddParticle("Omega(c)0 bar","Omega(c)0 bar",
916 2.7040, kFALSE, hshgev/0.064e-12, -0.,"Baryon", -4332);
917 // mass value from Hijing
918 pdgDB->AddParticle("Omega(c)*0","Omega(c)*0",
919 2.8000, kFALSE, -1., +0.,"Baryon", 4334);
921 pdgDB->AddParticle("Omega(c)*0 bar","Omega(c)*0",
922 2.8000, kFALSE, -1., -0.,"Baryon", -4334);
926 // mass value from Hijing
927 pdgDB->AddParticle("Sigma(b)*+","Sigma(b)*+",
928 5.8100, kFALSE, -1., +1.,"Baryon", 5224);
930 pdgDB->AddParticle("Sigma(b)*-","Sigma(b)*-",
931 5.8100, kFALSE, -1., -1.,"Baryon", -5224);
935 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
936 0,1,"Ion",kion+10020);
937 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
939 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
940 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
941 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
943 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
944 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
945 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
947 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
949 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
950 0,2,"Ion",kion+20030);
951 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
953 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
954 0,0,"Special",kspe+50);
955 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
957 Gspart(51, "FeedbackPhoton", 7, 0., 0.,1.e20 );
958 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
959 0,0,"Special",kspe+51);
960 fPDGCode[fNPDGCodes++]=kspe+51; // 51 = FeedbackPhoton
962 /* --- Define additional decay modes --- */
963 /* --- omega(783) --- */
964 for (kz = 0; kz < 6; ++kz) {
975 Gsdk(ipa, bratio, mode);
976 /* --- phi(1020) --- */
977 for (kz = 0; kz < 6; ++kz) {
992 Gsdk(ipa, bratio, mode);
994 for (kz = 0; kz < 6; ++kz) {
1007 Gsdk(ipa, bratio, mode);
1009 for (kz = 0; kz < 6; ++kz) {
1022 Gsdk(ipa, bratio, mode);
1024 for (kz = 0; kz < 6; ++kz) {
1035 Gsdk(ipa, bratio, mode);
1036 /* --- Anti D0 --- */
1037 for (kz = 0; kz < 6; ++kz) {
1048 Gsdk(ipa, bratio, mode);
1050 for (kz = 0; kz < 6; ++kz) {
1057 Gsdk(ipa, bratio, mode);
1059 for (kz = 0; kz < 6; ++kz) {
1066 Gsdk(ipa, bratio, mode);
1068 for (kz = 0; kz < 6; ++kz) {
1075 Gsdk(ipa, bratio, mode);
1078 for (kz = 0; kz < 6; ++kz) {
1087 Gsdk(ipa, bratio, mode);
1090 Gsdk(ipa, bratio, mode);
1093 Gsdk(ipa, bratio, mode);
1098 //_____________________________________________________________________________
1099 Int_t TGeant3::VolId(const Text_t *name) const
1102 // Return the unique numeric identifier for volume name
1105 strncpy((char *) &gname, name, 4);
1106 for(i=1; i<=fGcnum->nvolum; i++)
1107 if(gname == fZiq[fGclink->jvolum+i]) return i;
1108 printf("VolId: Volume %s not found\n",name);
1112 //_____________________________________________________________________________
1113 Int_t TGeant3::NofVolumes() const
1116 // Return total number of volumes in the geometry
1118 return fGcnum->nvolum;
1121 //_____________________________________________________________________________
1122 const char* TGeant3::VolName(Int_t id) const
1125 // Return the volume name given the volume identifier
1127 const char name[5]="NULL";
1128 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1131 return fVolNames[id-1];
1134 //_____________________________________________________________________________
1135 void TGeant3::SetCut(const char* cutName, Float_t cutValue)
1137 if(!strcmp(cutName,"CUTGAM"))
1138 fGccuts->cutgam=cutValue;
1139 else if(!strcmp(cutName,"CUTGAM"))
1140 fGccuts->cutele=cutValue;
1141 else if(!strcmp(cutName,"CUTELE"))
1142 fGccuts->cutneu=cutValue;
1143 else if(!strcmp(cutName,"CUTHAD"))
1144 fGccuts->cuthad=cutValue;
1145 else if(!strcmp(cutName,"CUTMUO"))
1146 fGccuts->cutmuo=cutValue;
1147 else if(!strcmp(cutName,"BCUTE"))
1148 fGccuts->bcute=cutValue;
1149 else if(!strcmp(cutName,"BCUTM"))
1150 fGccuts->bcutm=cutValue;
1151 else if(!strcmp(cutName,"DCUTE"))
1152 fGccuts->dcute=cutValue;
1153 else if(!strcmp(cutName,"DCUTM"))
1154 fGccuts->dcutm=cutValue;
1155 else if(!strcmp(cutName,"PPCUTM"))
1156 fGccuts->ppcutm=cutValue;
1157 else if(!strcmp(cutName,"TOFMAX"))
1158 fGccuts->tofmax=cutValue;
1159 else Warning("SetCut","Cut %s not implemented\n",cutName);
1162 //_____________________________________________________________________________
1163 void TGeant3::SetProcess(const char* flagName, Int_t flagValue)
1165 if(!strcmp(flagName,"PAIR"))
1166 fGcphys->ipair=flagValue;
1167 else if(!strcmp(flagName,"COMP"))
1168 fGcphys->icomp=flagValue;
1169 else if(!strcmp(flagName,"PHOT"))
1170 fGcphys->iphot=flagValue;
1171 else if(!strcmp(flagName,"PFIS"))
1172 fGcphys->ipfis=flagValue;
1173 else if(!strcmp(flagName,"DRAY"))
1174 fGcphys->idray=flagValue;
1175 else if(!strcmp(flagName,"ANNI"))
1176 fGcphys->ianni=flagValue;
1177 else if(!strcmp(flagName,"BREM"))
1178 fGcphys->ibrem=flagValue;
1179 else if(!strcmp(flagName,"HADR"))
1180 fGcphys->ihadr=flagValue;
1181 else if(!strcmp(flagName,"MUNU"))
1182 fGcphys->imunu=flagValue;
1183 else if(!strcmp(flagName,"DCAY"))
1184 fGcphys->idcay=flagValue;
1185 else if(!strcmp(flagName,"LOSS"))
1186 fGcphys->iloss=flagValue;
1187 else if(!strcmp(flagName,"MULS"))
1188 fGcphys->imuls=flagValue;
1189 else if(!strcmp(flagName,"RAYL"))
1190 fGcphys->irayl=flagValue;
1191 else if(!strcmp(flagName,"STRA"))
1192 fGcphlt->istra=flagValue;
1193 else if(!strcmp(flagName,"SYNC"))
1194 fGcphlt->isync=flagValue;
1195 else Warning("SetFlag","Flag %s not implemented\n",flagName);
1198 //_____________________________________________________________________________
1199 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
1201 Int_t gpart = IdFromPDG(part);
1202 if(!strcmp(reac,"PHOT"))
1205 Error("Xsec","Can calculate photoelectric only for photons\n");
1211 //_____________________________________________________________________________
1212 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1215 // Return the current position in the master reference frame of the
1216 // track being transported
1218 xyz[0]=fGctrak->vect[0];
1219 xyz[1]=fGctrak->vect[1];
1220 xyz[2]=fGctrak->vect[2];
1221 xyz[3]=fGctrak->tofg;
1224 //_____________________________________________________________________________
1225 Float_t TGeant3::TrackTime() const
1228 // Return the current time of flight of the track being transported
1230 return fGctrak->tofg;
1233 //_____________________________________________________________________________
1234 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1237 // Return the direction and the momentum (GeV/c) of the track
1238 // currently being transported
1240 Double_t ptot=fGctrak->vect[6];
1241 xyz[0]=fGctrak->vect[3]*ptot;
1242 xyz[1]=fGctrak->vect[4]*ptot;
1243 xyz[2]=fGctrak->vect[5]*ptot;
1244 xyz[3]=fGctrak->getot;
1247 //_____________________________________________________________________________
1248 Float_t TGeant3::TrackCharge() const
1251 // Return charge of the track currently transported
1253 return fGckine->charge;
1256 //_____________________________________________________________________________
1257 Float_t TGeant3::TrackMass() const
1260 // Return the mass of the track currently transported
1262 return fGckine->amass;
1265 //_____________________________________________________________________________
1266 Int_t TGeant3::TrackPid() const
1269 // Return the id of the particle transported
1271 return PDGFromId(fGckine->ipart);
1274 //_____________________________________________________________________________
1275 Float_t TGeant3::TrackStep() const
1278 // Return the length in centimeters of the current step
1280 return fGctrak->step;
1283 //_____________________________________________________________________________
1284 Float_t TGeant3::TrackLength() const
1287 // Return the length of the current track from its origin
1289 return fGctrak->sleng;
1292 //_____________________________________________________________________________
1293 Bool_t TGeant3::IsNewTrack() const
1296 // True if the track is not at the boundary of the current volume
1298 return (fGctrak->sleng>0);
1301 //_____________________________________________________________________________
1302 Bool_t TGeant3::IsTrackInside() const
1305 // True if the track is not at the boundary of the current volume
1307 return (fGctrak->inwvol==0);
1310 //_____________________________________________________________________________
1311 Bool_t TGeant3::IsTrackEntering() const
1314 // True if this is the first step of the track in the current volume
1316 return (fGctrak->inwvol==1);
1319 //_____________________________________________________________________________
1320 Bool_t TGeant3::IsTrackExiting() const
1323 // True if this is the last step of the track in the current volume
1325 return (fGctrak->inwvol==2);
1328 //_____________________________________________________________________________
1329 Bool_t TGeant3::IsTrackOut() const
1332 // True if the track is out of the setup
1334 return (fGctrak->inwvol==3);
1337 //_____________________________________________________________________________
1338 Bool_t TGeant3::IsTrackStop() const
1341 // True if the track energy has fallen below the threshold
1343 return (fGctrak->istop==2);
1346 //_____________________________________________________________________________
1347 Int_t TGeant3::NSecondaries() const
1350 // Number of secondary particles generated in the current step
1352 return fGcking->ngkine;
1355 //_____________________________________________________________________________
1356 Int_t TGeant3::CurrentEvent() const
1359 // Number of the current event
1361 return fGcflag->idevt;
1364 //_____________________________________________________________________________
1365 const char* TGeant3::ProdProcess() const
1368 // Name of the process that has produced the secondary particles
1369 // in the current step
1371 static char proc[5];
1372 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1375 if(fGcking->ngkine>0) {
1376 for (km = 0; km < fGctrak->nmec; ++km) {
1377 for (im = 0; im < 13; ++im) {
1378 if (fGctrak->lmec[km] == ipmec[im]) {
1379 mec = fGctrak->lmec[km];
1380 if (0 < mec && mec < 31) {
1381 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1382 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1383 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1390 strcpy(proc,"UNKN");
1391 } else strcpy(proc,"NONE");
1395 //_____________________________________________________________________________
1396 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1397 TLorentzVector &x, TLorentzVector &p)
1400 // Get the parameters of the secondary track number isec produced
1401 // in the current step
1404 if(-1<isec && isec<fGcking->ngkine) {
1405 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1407 x[i]=fGckin3->gpos[isec][i];
1408 p[i]=fGcking->gkin[isec][i];
1410 x[3]=fGcking->tofd[isec];
1411 p[3]=fGcking->gkin[isec][3];
1413 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1414 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1419 //_____________________________________________________________________________
1420 void TGeant3::InitLego()
1423 SetDEBU(0,0,0); //do not print a message
1426 //_____________________________________________________________________________
1427 Bool_t TGeant3::IsTrackDisappeared() const
1430 // True if the current particle has disappered
1431 // either because it decayed or because it underwent
1432 // an inelastic collision
1434 return (fGctrak->istop==1);
1437 //_____________________________________________________________________________
1438 Bool_t TGeant3::IsTrackAlive() const
1441 // True if the current particle is alive and will continue to be
1444 return (fGctrak->istop==0);
1447 //_____________________________________________________________________________
1448 void TGeant3::StopTrack()
1451 // Stop the transport of the current particle and skip to the next
1456 //_____________________________________________________________________________
1457 void TGeant3::StopEvent()
1460 // Stop simulation of the current event and skip to the next
1465 //_____________________________________________________________________________
1466 Float_t TGeant3::MaxStep() const
1469 // Return the maximum step length in the current medium
1471 return fGctmed->stemax;
1474 //_____________________________________________________________________________
1475 void TGeant3::SetMaxStep(Float_t maxstep)
1478 // Set the maximum step allowed till the particle is in the current medium
1480 fGctmed->stemax=maxstep;
1483 //_____________________________________________________________________________
1484 void TGeant3::SetMaxNStep(Int_t maxnstp)
1487 // Set the maximum number of steps till the particle is in the current medium
1489 fGctrak->maxnst=maxnstp;
1492 //_____________________________________________________________________________
1493 Int_t TGeant3::GetMaxNStep() const
1496 // Maximum number of steps allowed in current medium
1498 return fGctrak->maxnst;
1501 //_____________________________________________________________________________
1502 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1503 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1507 // Defines a Material
1509 // kmat number assigned to the material
1510 // name material name
1511 // a atomic mass in au
1513 // dens density in g/cm3
1514 // absl absorbtion length in cm
1515 // if >=0 it is ignored and the program
1516 // calculates it, if <0. -absl is taken
1517 // radl radiation length in cm
1518 // if >=0 it is ignored and the program
1519 // calculates it, if <0. -radl is taken
1520 // buf pointer to an array of user words
1521 // nbuf number of user words
1523 Int_t jmate=fGclink->jmate;
1529 for(i=1; i<=ns; i++) {
1530 if(fZlq[jmate-i]==0) {
1536 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1537 nwbuf PASSCHARL(name));
1540 //_____________________________________________________________________________
1541 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1542 Float_t dens, Int_t nlmat, Float_t* wmat)
1545 // Defines mixture OR COMPOUND IMAT as composed by
1546 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1548 // If NLMAT > 0 then wmat contains the proportion by
1549 // weights of each basic material in the mixture.
1551 // If nlmat < 0 then WMAT contains the number of atoms
1552 // of a given kind into the molecule of the COMPOUND
1553 // In this case, WMAT in output is changed to relative
1556 Int_t jmate=fGclink->jmate;
1562 for(i=1; i<=ns; i++) {
1563 if(fZlq[jmate-i]==0) {
1569 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1572 //_____________________________________________________________________________
1573 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1574 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1575 Float_t stemax, Float_t deemax, Float_t epsil,
1576 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1579 // kmed tracking medium number assigned
1580 // name tracking medium name
1581 // nmat material number
1582 // isvol sensitive volume flag
1583 // ifield magnetic field
1584 // fieldm max. field value (kilogauss)
1585 // tmaxfd max. angle due to field (deg/step)
1586 // stemax max. step allowed
1587 // deemax max. fraction of energy lost in a step
1588 // epsil tracking precision (cm)
1589 // stmin min. step due to continuos processes (cm)
1591 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1592 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1593 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1595 Int_t jtmed=fGclink->jtmed;
1601 for(i=1; i<=ns; i++) {
1602 if(fZlq[jtmed-i]==0) {
1608 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1609 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1612 //_____________________________________________________________________________
1613 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1614 Float_t phiy, Float_t thez, Float_t phiz)
1617 // krot rotation matrix number assigned
1618 // theta1 polar angle for axis i
1619 // phi1 azimuthal angle for axis i
1620 // theta2 polar angle for axis ii
1621 // phi2 azimuthal angle for axis ii
1622 // theta3 polar angle for axis iii
1623 // phi3 azimuthal angle for axis iii
1625 // it defines the rotation matrix number irot.
1627 Int_t jrotm=fGclink->jrotm;
1633 for(i=1; i<=ns; i++) {
1634 if(fZlq[jrotm-i]==0) {
1640 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1643 //_____________________________________________________________________________
1644 Int_t TGeant3::GetMedium() const
1647 // Return the number of the current medium
1649 return fGctmed->numed;
1652 //_____________________________________________________________________________
1653 Float_t TGeant3::Edep() const
1656 // Return the energy lost in the current step
1658 return fGctrak->destep;
1661 //_____________________________________________________________________________
1662 Float_t TGeant3::Etot() const
1665 // Return the total energy of the current track
1667 return fGctrak->getot;
1670 //_____________________________________________________________________________
1671 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1674 // Return an array of n random numbers uniformly distributed
1675 // between 0 and 1 not included
1680 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1682 // Functions from GBASE
1684 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1686 //____________________________________________________________________________
1687 void TGeant3::Gfile(const char *filename, const char *option)
1690 // Routine to open a GEANT/RZ data base.
1692 // LUN logical unit number associated to the file
1694 // CHFILE RZ file name
1696 // CHOPT is a character string which may be
1697 // N To create a new file
1698 // U to open an existing file for update
1699 // " " to open an existing file for read only
1700 // Q The initial allocation (default 1000 records)
1701 // is given in IQUEST(10)
1702 // X Open the file in exchange format
1703 // I Read all data structures from file to memory
1704 // O Write all data structures from memory to file
1707 // If options "I" or "O" all data structures are read or
1708 // written from/to file and the file is closed.
1709 // See routine GRMDIR to create subdirectories
1710 // See routines GROUT,GRIN to write,read objects
1712 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1716 //____________________________________________________________________________
1717 void TGeant3::Gpcxyz()
1720 // Print track and volume parameters at current point
1725 //_____________________________________________________________________________
1726 void TGeant3::Ggclos()
1729 // Closes off the geometry setting.
1730 // Initializes the search list for the contents of each
1731 // volume following the order they have been positioned, and
1732 // inserting the content '0' when a call to GSNEXT (-1) has
1733 // been required by the user.
1734 // Performs the development of the JVOLUM structure for all
1735 // volumes with variable parameters, by calling GGDVLP.
1736 // Interprets the user calls to GSORD, through GGORD.
1737 // Computes and stores in a bank (next to JVOLUM mother bank)
1738 // the number of levels in the geometrical tree and the
1739 // maximum number of contents per level, by calling GGNLEV.
1740 // Sets status bit for CONCAVE volumes, through GGCAVE.
1741 // Completes the JSET structure with the list of volume names
1742 // which identify uniquely a given physical detector, the
1743 // list of bit numbers to pack the corresponding volume copy
1744 // numbers, and the generic path(s) in the JVOLUM tree,
1745 // through the routine GHCLOS.
1748 // Create internal list of volumes
1749 fVolNames = new char[fGcnum->nvolum][5];
1751 for(i=0; i<fGcnum->nvolum; ++i) {
1752 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1753 fVolNames[i][4]='\0';
1757 //_____________________________________________________________________________
1758 void TGeant3::Glast()
1761 // Finish a Geant run
1766 //_____________________________________________________________________________
1767 void TGeant3::Gprint(const char *name)
1770 // Routine to print data structures
1771 // CHNAME name of a data structure
1775 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1778 //_____________________________________________________________________________
1779 void TGeant3::Grun()
1782 // Steering function to process one run
1787 //_____________________________________________________________________________
1788 void TGeant3::Gtrig()
1791 // Steering function to process one event
1796 //_____________________________________________________________________________
1797 void TGeant3::Gtrigc()
1800 // Clear event partition
1805 //_____________________________________________________________________________
1806 void TGeant3::Gtrigi()
1809 // Initialises event partition
1814 //_____________________________________________________________________________
1815 void TGeant3::Gwork(Int_t nwork)
1818 // Allocates workspace in ZEBRA memory
1823 //_____________________________________________________________________________
1824 void TGeant3::Gzinit()
1827 // To initialise GEANT/ZEBRA data structures
1832 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1834 // Functions from GCONS
1836 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1838 //_____________________________________________________________________________
1839 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1840 Float_t &dens, Float_t &radl, Float_t &absl,
1841 Float_t* ubuf, Int_t& nbuf)
1844 // Return parameters for material IMAT
1846 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1850 //_____________________________________________________________________________
1851 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1852 Float_t &amass, Float_t &charge, Float_t &tlife)
1855 // Return parameters for particle of type IPART
1859 Int_t igpart = IdFromPDG(ipart);
1860 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1864 //_____________________________________________________________________________
1865 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1866 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1867 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1868 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1871 // Return parameters for tracking medium NUMED
1873 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1874 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1878 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
1879 Float_t* tkin, Float_t* value, Float_t* pcut,
1883 // Return parameters for tracking medium NUMED
1885 gftmat(imate, ipart, PASSCHARD(chmeca), kdim,
1886 tkin, value, pcut, ixst PASSCHARL(chmeca));
1890 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
1892 return gbrelm(z,t,bcut);
1895 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
1897 return gprelm(z,t,bcut);
1900 //_____________________________________________________________________________
1901 void TGeant3::Gmate()
1904 // Define standard GEANT materials
1909 //_____________________________________________________________________________
1910 void TGeant3::Gpart()
1913 // Define standard GEANT particles plus selected decay modes
1914 // and branching ratios.
1919 //_____________________________________________________________________________
1920 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1922 // Defines branching ratios and decay modes for standard
1924 gsdk(ipart,bratio,mode);
1927 //_____________________________________________________________________________
1928 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1929 Float_t dens, Float_t radl, Float_t absl)
1932 // Defines a Material
1934 // kmat number assigned to the material
1935 // name material name
1936 // a atomic mass in au
1938 // dens density in g/cm3
1939 // absl absorbtion length in cm
1940 // if >=0 it is ignored and the program
1941 // calculates it, if <0. -absl is taken
1942 // radl radiation length in cm
1943 // if >=0 it is ignored and the program
1944 // calculates it, if <0. -radl is taken
1945 // buf pointer to an array of user words
1946 // nbuf number of user words
1950 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1954 //_____________________________________________________________________________
1955 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1956 Float_t dens, Int_t nlmat, Float_t *wmat)
1959 // Defines mixture OR COMPOUND IMAT as composed by
1960 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1962 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1963 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1965 // If NLMAT.LT.0 then WMAT contains the number of atoms
1966 // of a given kind into the molecule of the COMPOUND
1967 // In this case, WMAT in output is changed to relative
1970 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1973 //_____________________________________________________________________________
1974 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1975 Float_t amass, Float_t charge, Float_t tlife)
1978 // Store particle parameters
1980 // ipart particle code
1981 // name particle name
1982 // itrtyp transport method (see GEANT manual)
1983 // amass mass in GeV/c2
1984 // charge charge in electron units
1985 // tlife lifetime in seconds
1989 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1993 //_____________________________________________________________________________
1994 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1995 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1996 Float_t stemax, Float_t deemax, Float_t epsil,
2000 // NTMED Tracking medium number
2001 // NAME Tracking medium name
2002 // NMAT Material number
2003 // ISVOL Sensitive volume flag
2004 // IFIELD Magnetic field
2005 // FIELDM Max. field value (Kilogauss)
2006 // TMAXFD Max. angle due to field (deg/step)
2007 // STEMAX Max. step allowed
2008 // DEEMAX Max. fraction of energy lost in a step
2009 // EPSIL Tracking precision (cm)
2010 // STMIN Min. step due to continuos processes (cm)
2012 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
2013 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
2014 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
2018 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
2019 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
2022 //_____________________________________________________________________________
2023 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
2024 Float_t *absco, Float_t *effic, Float_t *rindex)
2027 // Stores the tables for UV photon tracking in medium ITMED
2028 // Please note that it is the user's responsability to
2029 // provide all the coefficients:
2032 // ITMED Tracking medium number
2033 // NPCKOV Number of bins of each table
2034 // PPCKOV Value of photon momentum (in GeV)
2035 // ABSCO Absorbtion coefficients
2036 // dielectric: absorbtion length in cm
2037 // metals : absorbtion fraction (0<=x<=1)
2038 // EFFIC Detection efficiency for UV photons
2039 // RINDEX Refraction index (if=0 metal)
2041 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
2044 //_____________________________________________________________________________
2045 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
2048 // To change the value of cut or mechanism "CHPAR"
2049 // to a new value PARVAL for tracking medium ITMED
2050 // The data structure JTMED contains the standard tracking
2051 // parameters (CUTS and flags to control the physics processes) which
2052 // are used by default for all tracking media. It is possible to
2053 // redefine individually with GSTPAR any of these parameters for a
2054 // given tracking medium.
2055 // ITMED tracking medium number
2056 // CHPAR is a character string (variable name)
2057 // PARVAL must be given as a floating point.
2059 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
2062 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2064 // Functions from GCONS
2066 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2068 //_____________________________________________________________________________
2069 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
2072 // Storing/Retrieving Vertex and Track parameters
2073 // ----------------------------------------------
2075 // Stores vertex parameters.
2076 // VERT array of (x,y,z) position of the vertex
2077 // NTBEAM beam track number origin of the vertex
2078 // =0 if none exists
2079 // NTTARG target track number origin of the vertex
2080 // UBUF user array of NUBUF floating point numbers
2082 // NVTX new vertex number (=0 in case of error).
2083 // Prints vertex parameters.
2084 // IVTX for vertex IVTX.
2085 // (For all vertices if IVTX=0)
2086 // Stores long life track parameters.
2087 // PLAB components of momentum
2088 // IPART type of particle (see GSPART)
2089 // NV vertex number origin of track
2090 // UBUF array of NUBUF floating point user parameters
2092 // NT track number (if=0 error).
2093 // Retrieves long life track parameters.
2094 // ITRA track number for which parameters are requested
2095 // VERT vector origin of the track
2096 // PVERT 4 momentum components at the track origin
2097 // IPART particle type (=0 if track ITRA does not exist)
2098 // NVERT vertex number origin of the track
2099 // UBUF user words stored in GSKINE.
2100 // Prints initial track parameters.
2101 // ITRA for track ITRA
2102 // (For all tracks if ITRA=0)
2106 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
2109 //_____________________________________________________________________________
2110 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
2114 // Retrieves the parameter of a vertex bank
2115 // Vertex is generated from tracks NTBEAM NTTARG
2116 // NVTX is the new vertex number
2120 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
2123 //_____________________________________________________________________________
2124 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
2128 // Store kinematics of track NT into data structure
2129 // Track is coming from vertex NV
2132 gskine(plab, ipart, nv, buf, nwbuf, nt);
2136 //_____________________________________________________________________________
2137 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
2141 // Creates a new vertex bank
2142 // Vertex is generated from tracks NTBEAM NTTARG
2143 // NVTX is the new vertex number
2146 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
2150 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2152 // Functions from GPHYS
2154 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2156 //_____________________________________________________________________________
2157 void TGeant3::Gphysi()
2160 // Initialise material constants for all the physics
2161 // mechanisms used by GEANT
2166 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2168 // Functions from GTRAK
2170 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2172 //_____________________________________________________________________________
2173 void TGeant3::Gdebug()
2176 // Debug the current step
2181 //_____________________________________________________________________________
2182 void TGeant3::Gekbin()
2185 // To find bin number in kinetic energy table
2186 // stored in ELOW(NEKBIN)
2191 //_____________________________________________________________________________
2192 void TGeant3::Gfinds()
2195 // Returns the set/volume parameters corresponding to
2196 // the current space point in /GCTRAK/
2197 // and fill common /GCSETS/
2199 // IHSET user set identifier
2200 // IHDET user detector identifier
2201 // ISET set number in JSET
2202 // IDET detector number in JS=LQ(JSET-ISET)
2203 // IDTYPE detector type (1,2)
2204 // NUMBV detector volume numbers (array of length NVNAME)
2205 // NVNAME number of volume levels
2210 //_____________________________________________________________________________
2211 void TGeant3::Gsking(Int_t igk)
2214 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2215 // or the NGKINE tracks when IGK is 0.
2220 //_____________________________________________________________________________
2221 void TGeant3::Gskpho(Int_t igk)
2224 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2225 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2230 //_____________________________________________________________________________
2231 void TGeant3::Gsstak(Int_t iflag)
2234 // Stores in auxiliary stack JSTAK the particle currently
2235 // described in common /GCKINE/.
2237 // On request, creates also an entry in structure JKINE :
2239 // 0 : No entry in JKINE structure required (user)
2240 // 1 : New entry in JVERTX / JKINE structures required (user)
2241 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2242 // 2 : Entry in JKINE structure exists already (from GTREVE)
2247 //_____________________________________________________________________________
2248 void TGeant3::Gsxyz()
2251 // Store space point VECT in banks JXYZ
2256 //_____________________________________________________________________________
2257 void TGeant3::Gtrack()
2260 // Controls tracking of current particle
2265 //_____________________________________________________________________________
2266 void TGeant3::Gtreve()
2269 // Controls tracking of all particles belonging to the current event
2274 //_____________________________________________________________________________
2275 void TGeant3::GtreveRoot()
2278 // Controls tracking of all particles belonging to the current event
2283 //_____________________________________________________________________________
2284 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2287 // To generate a vector RVECV of LEN random numbers
2288 // Copy of the CERN Library routine RANECU
2292 //_____________________________________________________________________________
2293 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2294 const Text_t *chopt)
2297 // To set/retrieve the seed of the random number generator
2299 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2302 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2304 // Functions from GDRAW
2306 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2308 //_____________________________________________________________________________
2309 void TGeant3::Gdxyz(Int_t it)
2312 // Draw the points stored with Gsxyz relative to track it
2317 //_____________________________________________________________________________
2318 void TGeant3::Gdcxyz()
2321 // Draw the position of the current track
2326 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2328 // Functions from GGEOM
2330 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2332 //_____________________________________________________________________________
2333 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2336 // Computes coordinates XM (Master Reference System
2337 // knowing the coordinates XD (Detector Ref System)
2338 // The local reference system can be initialized by
2339 // - the tracking routines and GDTOM used in GUSTEP
2340 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2341 // (inverse routine is GMTOD)
2343 // If IFLAG=1 convert coordinates
2344 // IFLAG=2 convert direction cosinus
2346 gdtom(xd, xm, iflag);
2349 //_____________________________________________________________________________
2350 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2354 // Loads the top part of the Volume tree in LVOLS (IVO's),
2355 // LINDX (IN indices) for a given volume defined through
2356 // its name IUDET and number IUNUM.
2358 // The routine stores only upto the last level where JVOLUM
2359 // data structure is developed. If there is no development
2360 // above the current level, it returns NLEV zero.
2362 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2365 //_____________________________________________________________________________
2366 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2369 // Finds in which volume/medium the point X is, and updates the
2370 // common /GCVOLU/ and the structure JGPAR accordingly.
2372 // NUMED returns the tracking medium number, or 0 if point is
2373 // outside the experimental setup.
2378 //_____________________________________________________________________________
2379 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2382 // Computes coordinates XD (in DRS)
2383 // from known coordinates XM in MRS
2384 // The local reference system can be initialized by
2385 // - the tracking routines and GMTOD used in GUSTEP
2386 // - a call to GMEDIA(XM,NUMED)
2387 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2388 // (inverse routine is GDTOM)
2390 // If IFLAG=1 convert coordinates
2391 // IFLAG=2 convert direction cosinus
2393 gmtod(xm, xd, iflag);
2396 //_____________________________________________________________________________
2397 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2401 // Create a new volume by dividing an existing one
2404 // MOTHER Mother volume name
2405 // NDIV Number of divisions
2408 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2409 // It divides a previously defined volume.
2414 Vname(mother,vmother);
2415 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2416 PASSCHARL(vmother));
2419 //_____________________________________________________________________________
2420 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2421 Int_t iaxis, Float_t c0i, Int_t numed)
2424 // Create a new volume by dividing an existing one
2426 // Divides mother into ndiv divisions called name
2427 // along axis iaxis starting at coordinate value c0.
2428 // the new volume created will be medium number numed.
2433 Vname(mother,vmother);
2434 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2435 PASSCHARL(vname) PASSCHARL(vmother));
2438 //_____________________________________________________________________________
2439 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2440 Int_t iaxis, Int_t numed)
2443 // Create a new volume by dividing an existing one
2448 Vname(mother,vmother);
2449 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2450 PASSCHARL(vname) PASSCHARL(vmother));
2453 //_____________________________________________________________________________
2454 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2455 Int_t iaxis, Float_t c0, Int_t numed)
2458 // Create a new volume by dividing an existing one
2463 Vname(mother,vmother);
2464 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2465 PASSCHARL(vname) PASSCHARL(vmother));
2468 //_____________________________________________________________________________
2469 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2470 Int_t iaxis, Int_t numed, Int_t ndvmx)
2473 // Create a new volume by dividing an existing one
2475 // Divides MOTHER into divisions called NAME along
2476 // axis IAXIS in steps of STEP. If not exactly divisible
2477 // will make as many as possible and will centre them
2478 // with respect to the mother. Divisions will have medium
2479 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2480 // NDVMX is the expected maximum number of divisions
2481 // (If 0, no protection tests are performed)
2486 Vname(mother,vmother);
2487 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2488 PASSCHARL(vname) PASSCHARL(vmother));
2491 //_____________________________________________________________________________
2492 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2493 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2496 // Create a new volume by dividing an existing one
2498 // Divides MOTHER into divisions called NAME along
2499 // axis IAXIS starting at coordinate value C0 with step
2501 // The new volume created will have medium number NUMED.
2502 // If NUMED is 0, NUMED of mother is taken.
2503 // NDVMX is the expected maximum number of divisions
2504 // (If 0, no protection tests are performed)
2509 Vname(mother,vmother);
2510 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2511 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2514 //_____________________________________________________________________________
2515 void TGeant3::Gsord(const char *name, Int_t iax)
2518 // Flags volume CHNAME whose contents will have to be ordered
2519 // along axis IAX, by setting the search flag to -IAX
2523 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2524 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2525 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2526 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2527 // IAX = 6 PHI (PHI=0 => X axis)
2528 // IAX = 7 THETA (THETA=0 => Z axis)
2532 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2535 //_____________________________________________________________________________
2536 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2537 Float_t y, Float_t z, Int_t irot, const char *konly)
2540 // Position a volume into an existing one
2543 // NUMBER Copy number of the volume
2544 // MOTHER Mother volume name
2545 // X X coord. of the volume in mother ref. sys.
2546 // Y Y coord. of the volume in mother ref. sys.
2547 // Z Z coord. of the volume in mother ref. sys.
2548 // IROT Rotation matrix number w.r.t. mother ref. sys.
2549 // ONLY ONLY/MANY flag
2551 // It positions a previously defined volume in the mother.
2556 Vname(mother,vmother);
2557 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2558 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2562 //_____________________________________________________________________________
2563 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2564 Float_t x, Float_t y, Float_t z, Int_t irot,
2565 const char *konly, Float_t *upar, Int_t np )
2568 // Place a copy of generic volume NAME with user number
2569 // NR inside MOTHER, with its parameters UPAR(1..NP)
2574 Vname(mother,vmother);
2575 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2576 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2580 //_____________________________________________________________________________
2581 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2582 Float_t phi2, Float_t theta3, Float_t phi3)
2585 // nmat Rotation matrix number
2586 // THETA1 Polar angle for axis I
2587 // PHI1 Azimuthal angle for axis I
2588 // THETA2 Polar angle for axis II
2589 // PHI2 Azimuthal angle for axis II
2590 // THETA3 Polar angle for axis III
2591 // PHI3 Azimuthal angle for axis III
2593 // It defines the rotation matrix number IROT.
2595 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2598 //_____________________________________________________________________________
2599 void TGeant3::Gprotm(Int_t nmat)
2602 // To print rotation matrices structure JROTM
2603 // nmat Rotation matrix number
2608 //_____________________________________________________________________________
2609 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2610 Float_t *upar, Int_t npar)
2614 // SHAPE Volume type
2615 // NUMED Tracking medium number
2616 // NPAR Number of shape parameters
2617 // UPAR Vector containing shape parameters
2619 // It creates a new volume in the JVOLUM data structure.
2625 Vname(shape,vshape);
2626 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2627 PASSCHARL(vname) PASSCHARL(vshape));
2631 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2633 // T H E D R A W I N G P A C K A G E
2634 // ======================================
2635 // Drawing functions. These functions allow the visualization in several ways
2636 // of the volumes defined in the geometrical data structure. It is possible
2637 // to draw the logical tree of volumes belonging to the detector (DTREE),
2638 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2639 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2640 // these commands when the hidden line removal option is activated; in
2641 // this case, the volumes can be also either translated in the space
2642 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2643 // possible to fill the surfaces of the volumes
2644 // with solid colours when the shading option (SHAD) is activated.
2645 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2646 // of the detectors or to scan physical events as well.
2647 // Finally, the command MOVE will allow the rotation, translation and zooming
2648 // on real time parts of the detectors or tracks and hits of a simulated event.
2649 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2650 // the drawing is performed by the Geant ray-tracing;
2651 // automatically, the color is assigned according to the tracking medium of each
2652 // volume and the volumes with a density lower/equal than the air are considered
2653 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2654 // the user can set color and visibility for the desired volumes via the command
2655 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2656 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2657 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2658 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2659 // first case, we assume that the first mother volume of the tree is a box with
2660 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2661 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2662 // second case, the distance between the observer and the origin of the world
2663 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2664 // or telescopic effects can be achieved changing the scale factors in the command
2665 // (DRAW). When the final picture does not occupy the full window,
2666 // mapping the space before tracing can speed up the drawing, but can also
2667 // produce less precise results; values from 1 to 4 are allowed in the command
2668 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2669 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2670 // The command (VALCUT) allows the cutting of the detector by three planes
2671 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2672 // SATT for any desired volume and can assume values from 0 to 7; it determines
2673 // the different light processing to be performed for different materials:
2674 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2675 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2676 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2677 // is 0.9) and the observer is assumed to have a light source (therefore he will
2678 // produce parallel light in the case of parallel view and point-like-source
2679 // light in the case of perspective view).
2681 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2683 //_____________________________________________________________________________
2684 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2688 // IOPT Name of the attribute to be set
2689 // IVAL Value to which the attribute is to be set
2691 // name= "*" stands for all the volumes.
2692 // iopt can be chosen among the following :
2694 // WORK 0=volume name is inactive for the tracking
2695 // 1=volume name is active for the tracking (default)
2697 // SEEN 0=volume name is invisible
2698 // 1=volume name is visible (default)
2699 // -1=volume invisible with all its descendants in the tree
2700 // -2=volume visible but not its descendants in the tree
2702 // LSTY line style 1,2,3,... (default=1)
2703 // LSTY=7 will produce a very precise approximation for
2704 // revolution bodies.
2706 // LWID line width -7,...,1,2,3,..7 (default=1)
2707 // LWID<0 will act as abs(LWID) was set for the volume
2708 // and for all the levels below it. When SHAD is 'ON', LWID
2709 // represent the linewidth of the scan lines filling the surfaces
2710 // (whereas the FILL value represent their number). Therefore
2711 // tuning this parameter will help to obtain the desired
2712 // quality/performance ratio.
2714 // COLO colour code -166,...,1,2,..166 (default=1)
2716 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2717 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2718 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2719 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2720 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2721 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2722 // colour=n*10+m, m=1,2,...9, will produce the same colour
2723 // as 'n', but with increasing luminosity according to 'm';
2724 // COLO<0 will act as if abs(COLO) was set for the volume
2725 // and for all the levels below it.
2726 // When for a volume the attribute FILL is > 1 (and the
2727 // option SHAD is on), the ABS of its colour code must be < 8
2728 // because an automatic shading of its faces will be
2731 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2732 // when option SHAD is "on" the FILL attribute of any
2733 // volume can be set different from 0 (normal drawing);
2734 // if it is set to 1, the faces of such volume will be filled
2735 // with solid colours; if ABS(FILL) is > 1, then a light
2736 // source is placed along the observer line, and the faces of
2737 // such volumes will be painted by colours whose luminosity
2738 // will depend on the amount of light reflected;
2739 // if ABS(FILL) = 1, then it is possible to use all the 166
2740 // colours of the colour table, becouse the automatic shading
2741 // is not performed;
2742 // for increasing values of FILL the drawing will be performed
2743 // with higher and higher resolution improving the quality (the
2744 // number of scan lines used to fill the faces increases with FILL);
2745 // it is possible to set different values of FILL
2746 // for different volumes, in order to optimize at the same time
2747 // the performance and the quality of the picture;
2748 // FILL<0 will act as if abs(FILL) was set for the volume
2749 // and for all the levels below it.
2750 // This kind of drawing can be saved in 'picture files'
2751 // or in view banks.
2752 // 0=drawing without fill area
2753 // 1=faces filled with solid colours and resolution = 6
2754 // 2=lowest resolution (very fast)
2755 // 3=default resolution
2756 // 4=.................
2757 // 5=.................
2758 // 6=.................
2760 // Finally, if a coloured background is desired, the FILL
2761 // attribute for the first volume of the tree must be set
2762 // equal to -abs(colo), colo being >0 and <166.
2764 // SET set number associated to volume name
2765 // DET detector number associated to volume name
2766 // DTYP detector type (1,2)
2773 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2777 //_____________________________________________________________________________
2778 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2779 Int_t& natt, Float_t* par, Float_t* att)
2782 // Find the parameters of a volume
2784 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2788 //_____________________________________________________________________________
2789 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2792 // Check the parameters of a shape
2794 gckpar(ish,npar,par);
2797 //_____________________________________________________________________________
2798 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2801 // Check the parameters of a tracking medium
2803 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2806 //_____________________________________________________________________________
2807 void TGeant3::Gdelete(Int_t iview)
2810 // IVIEW View number
2812 // It deletes a view bank from memory.
2817 //_____________________________________________________________________________
2818 void TGeant3::Gdopen(Int_t iview)
2821 // IVIEW View number
2823 // When a drawing is very complex and requires a long time to be
2824 // executed, it can be useful to store it in a view bank: after a
2825 // call to DOPEN and the execution of the drawing (nothing will
2826 // appear on the screen), and after a necessary call to DCLOSE,
2827 // the contents of the bank can be displayed in a very fast way
2828 // through a call to DSHOW; therefore, the detector can be easily
2829 // zoomed many times in different ways. Please note that the pictures
2830 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2837 //_____________________________________________________________________________
2838 void TGeant3::Gdclose()
2841 // It closes the currently open view bank; it must be called after the
2842 // end of the drawing to be stored.
2847 //_____________________________________________________________________________
2848 void TGeant3::Gdshow(Int_t iview)
2851 // IVIEW View number
2853 // It shows on the screen the contents of a view bank. It
2854 // can be called after a view bank has been closed.
2859 //_____________________________________________________________________________
2860 void TGeant3::Gdopt(const char *name,const char *value)
2864 // VALUE Option value
2866 // To set/modify the drawing options.
2869 // THRZ ON Draw tracks in R vs Z
2870 // OFF (D) Draw tracks in X,Y,Z
2873 // PROJ PARA (D) Parallel projection
2875 // TRAK LINE (D) Trajectory drawn with lines
2876 // POIN " " with markers
2877 // HIDE ON Hidden line removal using the CG package
2878 // OFF (D) No hidden line removal
2879 // SHAD ON Fill area and shading of surfaces.
2880 // OFF (D) Normal hidden line removal.
2881 // RAYT ON Ray-tracing on.
2882 // OFF (D) Ray-tracing off.
2883 // EDGE OFF Does not draw contours when shad is on.
2884 // ON (D) Normal shading.
2885 // MAPP 1,2,3,4 Mapping before ray-tracing.
2886 // 0 (D) No mapping.
2887 // USER ON User graphics options in the raytracing.
2888 // OFF (D) Automatic graphics options.
2894 Vname(value,vvalue);
2895 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2899 //_____________________________________________________________________________
2900 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2901 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2906 // THETA Viewing angle theta (for 3D projection)
2907 // PHI Viewing angle phi (for 3D projection)
2908 // PSI Viewing angle psi (for 2D rotation)
2909 // U0 U-coord. (horizontal) of volume origin
2910 // V0 V-coord. (vertical) of volume origin
2911 // SU Scale factor for U-coord.
2912 // SV Scale factor for V-coord.
2914 // This function will draw the volumes,
2915 // selected with their graphical attributes, set by the Gsatt
2916 // facility. The drawing may be performed with hidden line removal
2917 // and with shading effects according to the value of the options HIDE
2918 // and SHAD; if the option SHAD is ON, the contour's edges can be
2919 // drawn or not. If the option HIDE is ON, the detector can be
2920 // exploded (BOMB), clipped with different shapes (CVOL), and some
2921 // of its parts can be shifted from their original
2922 // position (SHIFT). When HIDE is ON, if
2923 // the drawing requires more than the available memory, the program
2924 // will evaluate and display the number of missing words
2925 // (so that the user can increase the
2926 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2927 // the program will print messages about the memory used and
2928 // statistics on the volumes' visibility.
2929 // The following commands will produce the drawing of a green
2930 // volume, specified by NAME, without using the hidden line removal
2931 // technique, using the hidden line removal technique,
2932 // with different linewidth and colour (red), with
2933 // solid colour, with shading of surfaces, and without edges.
2934 // Finally, some examples are given for the ray-tracing. (A possible
2935 // string for the NAME of the volume can be found using the command DTREE).
2941 if (fGcvdma->raytra != 1) {
2942 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2944 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2948 //_____________________________________________________________________________
2949 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2950 Float_t v0,Float_t ul,Float_t vl)
2955 // CUTVAL Cut plane distance from the origin along the axis
2957 // U0 U-coord. (horizontal) of volume origin
2958 // V0 V-coord. (vertical) of volume origin
2959 // SU Scale factor for U-coord.
2960 // SV Scale factor for V-coord.
2962 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2963 // and placed at the distance cutval from the origin.
2964 // The resulting picture is seen from the the same axis.
2965 // When HIDE Mode is ON, it is possible to get the same effect with
2966 // the CVOL/BOX function.
2972 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2975 //_____________________________________________________________________________
2976 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2977 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2978 Float_t v0,Float_t ul,Float_t vl)
2982 // CUTTHE Theta angle of the line normal to cut plane
2983 // CUTPHI Phi angle of the line normal to cut plane
2984 // CUTVAL Cut plane distance from the origin along the axis
2986 // THETA Viewing angle theta (for 3D projection)
2987 // PHI Viewing angle phi (for 3D projection)
2988 // U0 U-coord. (horizontal) of volume origin
2989 // V0 V-coord. (vertical) of volume origin
2990 // SU Scale factor for U-coord.
2991 // SV Scale factor for V-coord.
2993 // The cut plane is normal to the line given by the cut angles
2994 // cutthe and cutphi and placed at the distance cutval from the origin.
2995 // The resulting picture is seen from the viewing angles theta,phi.
3001 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
3005 //_____________________________________________________________________________
3006 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
3011 // ISEL Option flag D=111110
3013 // CHRSIZ Character size (cm) of title NAME D=0.6
3016 // 0 to have only the header lines
3017 // xxxxx1 to add the text name centered on top of header
3018 // xxxx1x to add global detector name (first volume) on left
3019 // xxx1xx to add date on right
3020 // xx1xxx to select thick characters for text on top of header
3021 // x1xxxx to add the text 'EVENT NR x' on top of header
3022 // 1xxxxx to add the text 'RUN NR x' on top of header
3023 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
3024 // i.e. they generate overwritten text.
3026 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
3029 //_____________________________________________________________________________
3030 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
3033 // Draw a 2D-man at position (U0,V0)
3035 // U U-coord. (horizontal) of the centre of man' R
3036 // V V-coord. (vertical) of the centre of man' R
3037 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
3039 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
3040 // It superimposes the picure of a man or of a woman, chosen among
3041 // three different ones, with the same scale factors as the detector
3042 // in the current drawing.
3045 if (opt.Contains("WM1")) {
3047 } else if (opt.Contains("WM3")) {
3049 } else if (opt.Contains("WM2")) {
3056 //_____________________________________________________________________________
3057 void TGeant3::Gdspec(const char *name)
3062 // Shows 3 views of the volume (two cut-views and a 3D view), together with
3063 // its geometrical specifications. The 3D drawing will
3064 // be performed according the current values of the options HIDE and
3065 // SHAD and according the current SetClipBox clipping parameters for that
3072 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3075 //_____________________________________________________________________________
3076 void TGeant3::DrawOneSpec(const char *name)
3079 // Function called when one double-clicks on a volume name
3080 // in a TPavelabel drawn by Gdtree.
3082 THIGZ *higzSave = higz;
3083 higzSave->SetName("higzSave");
3084 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
3085 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
3086 if (higzSpec) higz = higzSpec;
3087 else higzSpec = new THIGZ(defSize);
3088 higzSpec->SetName("higzSpec");
3093 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3096 higzSave->SetName("higz");
3100 //_____________________________________________________________________________
3101 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
3105 // LEVMAX Depth level
3108 // This function draws the logical tree,
3109 // Each volume in the tree is represented by a TPaveTree object.
3110 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
3111 // Use TPaveTree pop-up menu to select:
3114 // - drawing tree of parent
3120 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3124 //_____________________________________________________________________________
3125 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
3129 // LEVMAX Depth level
3132 // This function draws the logical tree of the parent of name.
3136 // Scan list of volumes in JVOLUM
3138 Int_t gname, i, jvo, in, nin, jin, num;
3139 strncpy((char *) &gname, name, 4);
3140 for(i=1; i<=fGcnum->nvolum; i++) {
3141 jvo = fZlq[fGclink->jvolum-i];
3142 nin = Int_t(fZq[jvo+3]);
3143 if (nin == -1) nin = 1;
3144 for (in=1;in<=nin;in++) {
3146 num = Int_t(fZq[jin+2]);
3147 if(gname == fZiq[fGclink->jvolum+num]) {
3148 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
3150 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3158 //_____________________________________________________________________________
3159 void TGeant3::SetABAN(Int_t par)
3162 // par = 1 particles will be stopped according to their residual
3163 // range if they are not in a sensitive material and are
3164 // far enough from the boundary
3165 // 0 particles are transported normally
3167 fGcphys->dphys1 = par;
3171 //_____________________________________________________________________________
3172 void TGeant3::SetANNI(Int_t par)
3175 // To control positron annihilation.
3176 // par =0 no annihilation
3177 // =1 annihilation. Decays processed.
3178 // =2 annihilation. No decay products stored.
3180 fGcphys->ianni = par;
3184 //_____________________________________________________________________________
3185 void TGeant3::SetAUTO(Int_t par)
3188 // To control automatic calculation of tracking medium parameters:
3189 // par =0 no automatic calculation;
3190 // =1 automati calculation.
3192 fGctrak->igauto = par;
3196 //_____________________________________________________________________________
3197 void TGeant3::SetBOMB(Float_t boom)
3200 // BOOM : Exploding factor for volumes position
3202 // To 'explode' the detector. If BOOM is positive (values smaller
3203 // than 1. are suggested, but any value is possible)
3204 // all the volumes are shifted by a distance
3205 // proportional to BOOM along the direction between their centre
3206 // and the origin of the MARS; the volumes which are symmetric
3207 // with respect to this origin are simply not shown.
3208 // BOOM equal to 0 resets the normal mode.
3209 // A negative (greater than -1.) value of
3210 // BOOM will cause an 'implosion'; for even lower values of BOOM
3211 // the volumes' positions will be reflected respect to the origin.
3212 // This command can be useful to improve the 3D effect for very
3213 // complex detectors. The following commands will make explode the
3220 //_____________________________________________________________________________
3221 void TGeant3::SetBREM(Int_t par)
3224 // To control bremstrahlung.
3225 // par =0 no bremstrahlung
3226 // =1 bremstrahlung. Photon processed.
3227 // =2 bremstrahlung. No photon stored.
3229 fGcphys->ibrem = par;
3233 //_____________________________________________________________________________
3234 void TGeant3::SetCKOV(Int_t par)
3237 // To control Cerenkov production
3238 // par =0 no Cerenkov;
3240 // =2 Cerenkov with primary stopped at each step.
3242 fGctlit->itckov = par;
3246 //_____________________________________________________________________________
3247 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3248 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3251 // The hidden line removal technique is necessary to visualize properly
3252 // very complex detectors. At the same time, it can be useful to visualize
3253 // the inner elements of a detector in detail. This function allows
3254 // subtractions (via boolean operation) of BOX shape from any part of
3255 // the detector, therefore showing its inner contents.
3256 // If "*" is given as the name of the
3257 // volume to be clipped, all volumes are clipped by the given box.
3258 // A volume can be clipped at most twice.
3259 // if a volume is explicitely clipped twice,
3260 // the "*" will not act on it anymore. Giving "." as the name
3261 // of the volume to be clipped will reset the clipping.
3263 // NAME Name of volume to be clipped
3265 // XMIN Lower limit of the Shape X coordinate
3266 // XMAX Upper limit of the Shape X coordinate
3267 // YMIN Lower limit of the Shape Y coordinate
3268 // YMAX Upper limit of the Shape Y coordinate
3269 // ZMIN Lower limit of the Shape Z coordinate
3270 // ZMAX Upper limit of the Shape Z coordinate
3272 // This function performs a boolean subtraction between the volume
3273 // NAME and a box placed in the MARS according the values of the given
3279 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3282 //_____________________________________________________________________________
3283 void TGeant3::SetCOMP(Int_t par)
3286 // To control Compton scattering
3287 // par =0 no Compton
3288 // =1 Compton. Electron processed.
3289 // =2 Compton. No electron stored.
3292 fGcphys->icomp = par;
3295 //_____________________________________________________________________________
3296 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3297 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3298 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3299 Float_t ppcutm, Float_t tofmax)
3302 // CUTGAM Cut for gammas D=0.001
3303 // CUTELE Cut for electrons D=0.001
3304 // CUTHAD Cut for charged hadrons D=0.01
3305 // CUTNEU Cut for neutral hadrons D=0.01
3306 // CUTMUO Cut for muons D=0.01
3307 // BCUTE Cut for electron brems. D=-1.
3308 // BCUTM Cut for muon brems. D=-1.
3309 // DCUTE Cut for electron delta-rays D=-1.
3310 // DCUTM Cut for muon delta-rays D=-1.
3311 // PPCUTM Cut for e+e- pairs by muons D=0.01
3312 // TOFMAX Time of flight cut D=1.E+10
3314 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3315 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3317 // If one of the parameters from CUTGAM to PPCUTM included
3318 // is modified, cross-sections and energy loss tables must be
3319 // recomputed via the function Gphysi.
3321 fGccuts->cutgam = cutgam;
3322 fGccuts->cutele = cutele;
3323 fGccuts->cutneu = cutneu;
3324 fGccuts->cuthad = cuthad;
3325 fGccuts->cutmuo = cutmuo;
3326 fGccuts->bcute = bcute;
3327 fGccuts->bcutm = bcutm;
3328 fGccuts->dcute = dcute;
3329 fGccuts->dcutm = dcutm;
3330 fGccuts->ppcutm = ppcutm;
3331 fGccuts->tofmax = tofmax;
3334 //_____________________________________________________________________________
3335 void TGeant3::SetDCAY(Int_t par)
3338 // To control Decay mechanism.
3339 // par =0 no decays.
3340 // =1 Decays. secondaries processed.
3341 // =2 Decays. No secondaries stored.
3343 fGcphys->idcay = par;
3347 //_____________________________________________________________________________
3348 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3351 // Set the debug flag and frequency
3352 // Selected debug output will be printed from
3353 // event emin to even emax each emod event
3355 fGcflag->idemin = emin;
3356 fGcflag->idemax = emax;
3357 fGcflag->itest = emod;
3361 //_____________________________________________________________________________
3362 void TGeant3::SetDRAY(Int_t par)
3365 // To control delta rays mechanism.
3366 // par =0 no delta rays.
3367 // =1 Delta rays. secondaries processed.
3368 // =2 Delta rays. No secondaries stored.
3370 fGcphys->idray = par;
3373 //_____________________________________________________________________________
3374 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3377 // To control cross section tabulations
3378 // ekmin = minimum kinetic energy in GeV
3379 // ekmax = maximum kinetic energy in GeV
3380 // nekbin = number of logatithmic bins (<200)
3382 fGcmulo->ekmin = ekmin;
3383 fGcmulo->ekmax = ekmax;
3384 fGcmulo->nekbin = nekbin;
3387 //_____________________________________________________________________________
3388 void TGeant3::SetHADR(Int_t par)
3391 // To control hadronic interactions.
3392 // par =0 no hadronic interactions.
3393 // =1 Hadronic interactions. secondaries processed.
3394 // =2 Hadronic interactions. No secondaries stored.
3396 fGcphys->ihadr = par;
3399 //_____________________________________________________________________________
3400 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3401 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3402 Float_t xk8, Float_t xk9, Float_t xk10)
3405 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3406 // Their meaning is user defined
3408 fGckine->ikine = kine;
3409 fGckine->pkine[0] = xk1;
3410 fGckine->pkine[1] = xk2;
3411 fGckine->pkine[2] = xk3;
3412 fGckine->pkine[3] = xk4;
3413 fGckine->pkine[4] = xk5;
3414 fGckine->pkine[5] = xk6;
3415 fGckine->pkine[6] = xk7;
3416 fGckine->pkine[7] = xk8;
3417 fGckine->pkine[8] = xk9;
3418 fGckine->pkine[9] = xk10;
3421 //_____________________________________________________________________________
3422 void TGeant3::SetLOSS(Int_t par)
3425 // To control energy loss.
3426 // par =0 no energy loss;
3427 // =1 restricted energy loss fluctuations;
3428 // =2 complete energy loss fluctuations;
3430 // =4 no energy loss fluctuations.
3431 // If the value ILOSS is changed, then cross-sections and energy loss
3432 // tables must be recomputed via the command 'PHYSI'.
3434 fGcphys->iloss = par;
3438 //_____________________________________________________________________________
3439 void TGeant3::SetMULS(Int_t par)
3442 // To control multiple scattering.
3443 // par =0 no multiple scattering.
3444 // =1 Moliere or Coulomb scattering.
3445 // =2 Moliere or Coulomb scattering.
3446 // =3 Gaussian scattering.
3448 fGcphys->imuls = par;
3452 //_____________________________________________________________________________
3453 void TGeant3::SetMUNU(Int_t par)
3456 // To control muon nuclear interactions.
3457 // par =0 no muon-nuclear interactions.
3458 // =1 Nuclear interactions. Secondaries processed.
3459 // =2 Nuclear interactions. Secondaries not processed.
3461 fGcphys->imunu = par;
3464 //_____________________________________________________________________________
3465 void TGeant3::SetOPTI(Int_t par)
3468 // This flag controls the tracking optimisation performed via the
3470 // 1 no optimisation at all; GSORD calls disabled;
3471 // 0 no optimisation; only user calls to GSORD kept;
3472 // 1 all non-GSORDered volumes are ordered along the best axis;
3473 // 2 all volumes are ordered along the best axis.
3475 fGcopti->ioptim = par;
3478 //_____________________________________________________________________________
3479 void TGeant3::SetPAIR(Int_t par)
3482 // To control pair production mechanism.
3483 // par =0 no pair production.
3484 // =1 Pair production. secondaries processed.
3485 // =2 Pair production. No secondaries stored.
3487 fGcphys->ipair = par;
3491 //_____________________________________________________________________________
3492 void TGeant3::SetPFIS(Int_t par)
3495 // To control photo fission mechanism.
3496 // par =0 no photo fission.
3497 // =1 Photo fission. secondaries processed.
3498 // =2 Photo fission. No secondaries stored.
3500 fGcphys->ipfis = par;
3503 //_____________________________________________________________________________
3504 void TGeant3::SetPHOT(Int_t par)
3507 // To control Photo effect.
3508 // par =0 no photo electric effect.
3509 // =1 Photo effect. Electron processed.
3510 // =2 Photo effect. No electron stored.
3512 fGcphys->iphot = par;
3515 //_____________________________________________________________________________
3516 void TGeant3::SetRAYL(Int_t par)
3519 // To control Rayleigh scattering.
3520 // par =0 no Rayleigh scattering.
3523 fGcphys->irayl = par;
3526 //_____________________________________________________________________________
3527 void TGeant3::SetSTRA(Int_t par)
3530 // To control energy loss fluctuations
3531 // with the PhotoAbsorption Ionisation model.
3532 // par =0 no Straggling.
3533 // =1 Straggling yes => no Delta rays.
3535 fGcphlt->istra = par;
3538 //_____________________________________________________________________________
3539 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3543 // val New switch value
3545 // Change one element of array ISWIT(10) in /GCFLAG/
3547 if (sw <= 0 || sw > 10) return;
3548 fGcflag->iswit[sw-1] = val;
3552 //_____________________________________________________________________________
3553 void TGeant3::SetTRIG(Int_t nevents)
3556 // Set number of events to be run
3558 fGcflag->nevent = nevents;
3561 //_____________________________________________________________________________
3562 void TGeant3::SetUserDecay(Int_t pdg)
3565 // Force the decays of particles to be done with Pythia
3566 // and not with the Geant routines.
3567 // just kill pointers doing mzdrop
3569 Int_t ipart = IdFromPDG(pdg);
3571 printf("Particle %d not in geant\n",pdg);
3574 Int_t jpart=fGclink->jpart;
3575 Int_t jpa=fZlq[jpart-ipart];
3578 Int_t jpa1=fZlq[jpa-1];
3580 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3581 Int_t jpa2=fZlq[jpa-2];
3583 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3587 //______________________________________________________________________________
3588 void TGeant3::Vname(const char *name, char *vname)
3591 // convert name to upper case. Make vname at least 4 chars
3593 Int_t l = strlen(name);
3596 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3597 for (i=l;i<4;i++) vname[i] = ' ';
3601 //______________________________________________________________________________
3602 void TGeant3::Ertrgo()
3607 //______________________________________________________________________________
3608 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3609 const Float_t *x2, const Float_t *p2,
3610 Int_t ipa, Option_t *chopt)
3612 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3615 //_____________________________________________________________________________
3616 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3617 Int_t number, Int_t nlevel)
3621 // ******************************************************************
3623 // * Write out the geometry of the detector in EUCLID file format *
3625 // * filnam : will be with the extension .euc *
3626 // * topvol : volume name of the starting node *
3627 // * number : copy number of topvol (relevant for gsposp) *
3628 // * nlevel : number of levels in the tree structure *
3629 // * to be written out, starting from topvol *
3631 // * Author : M. Maire *
3633 // ******************************************************************
3635 // File filnam.tme is written out with the definitions of tracking
3636 // medias and materials.
3637 // As to restore original numbers for materials and medias, program
3638 // searches in the file euc_medi.dat and comparing main parameters of
3639 // the mat. defined inside geant and the one in file recognizes them
3640 // and is able to take number from file. If for any material or medium,
3641 // this procedure fails, ordering starts from 1.
3642 // Arrays IOTMED and IOMATE are used for this procedure
3644 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3645 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3647 Int_t i, end, itm, irm, jrm, k, nmed;
3651 char *filext, *filetme;
3652 char natmed[21], namate[21];
3653 char natmedc[21], namatec[21];
3654 char key[5], name[5], mother[5], konly[5];
3656 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3657 Int_t mlevel, numbr, natt, numed, nin, ndata;
3658 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3659 Int_t jdiv, ivin, in, jin, jvin, irot;
3660 Int_t jtm, imat, jma, flag=0, imatc;
3661 Float_t az, dens, radl, absl, a, step, x, y, z;
3662 Int_t npar, ndvmx, left;
3663 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3665 Int_t iomate[100], iotmed[100];
3666 Float_t par[50], att[20], ubuf[50];
3669 Int_t level, ndiv, iaxe;
3670 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3671 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3672 Float_t tmaxf, stemax, deemax, epsil, stmin;
3673 const char *f10000="!\n%s\n!\n";
3674 //Open the input file
3676 for(i=0;i<end;i++) if(filnam[i]=='.') {
3680 filext=new char[end+5];
3681 filetme=new char[end+5];
3682 strncpy(filext,filnam,end);
3683 strncpy(filetme,filnam,end);
3685 // *** The output filnam name will be with extension '.euc'
3686 strcpy(&filext[end],".euc");
3687 strcpy(&filetme[end],".tme");
3688 lun=fopen(filext,"w");
3690 // *** Initialisation of the working space
3691 iadvol=fGcnum->nvolum;
3692 iadtmd=iadvol+fGcnum->nvolum;
3693 iadrot=iadtmd+fGcnum->ntmed;
3694 if(fGclink->jrotm) {
3695 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3699 nwtot=iadrot+fGcnum->nrotm;
3700 qws = new float[nwtot+1];
3701 for (i=0;i<nwtot+1;i++) qws[i]=0;
3704 if(nlevel==0) mlevel=20;
3706 // *** find the top volume and put it in the stak
3707 numbr = number>0 ? number : 1;
3708 Gfpara(topvol,numbr,1,npar,natt,par,att);
3710 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3715 // *** authorized shape ?
3716 strncpy((char *)&iname, topvol, 4);
3718 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3722 jvo = fZlq[fGclink->jvolum-ivo];
3723 ish = Int_t (fZq[jvo+2]);
3725 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3732 iws[iadvol+ivo] = level;
3735 //*** flag all volumes and fill the stak
3739 // pick the next volume in stak
3741 ivo = TMath::Abs(iws[ivstak]);
3742 jvo = fZlq[fGclink->jvolum - ivo];
3744 // flag the tracking medium
3745 numed = Int_t (fZq[jvo + 4]);
3746 iws[iadtmd + numed] = 1;
3748 // get the daughters ...
3749 level = iws[iadvol+ivo];
3750 if (level < mlevel) {
3752 nin = Int_t (fZq[jvo + 3]);
3754 // from division ...
3756 jdiv = fZlq[jvo - 1];
3757 ivin = Int_t (fZq[jdiv + 2]);
3759 iws[nvstak] = -ivin;
3760 iws[iadvol+ivin] = level;
3762 // from position ...
3763 } else if (nin > 0) {
3764 for(in=1; in<=nin; in++) {
3765 jin = fZlq[jvo - in];
3766 ivin = Int_t (fZq[jin + 2 ]);
3767 jvin = fZlq[fGclink->jvolum - ivin];
3768 ish = Int_t (fZq[jvin + 2]);
3769 // authorized shape ?
3771 // not yet flagged ?
3772 if (iws[iadvol+ivin]==0) {
3775 iws[iadvol+ivin] = level;
3777 // flag the rotation matrix
3778 irot = Int_t ( fZq[jin + 4 ]);
3779 if (irot > 0) iws[iadrot+irot] = 1;
3785 // next volume in stak ?
3786 if (ivstak < nvstak) goto L10;
3788 // *** restore original material and media numbers
3789 // file euc_medi.dat is needed to compare materials and medias
3791 FILE* luncor=fopen("euc_medi.dat","r");
3794 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3795 if (iws[iadtmd+itm] > 0) {
3796 jtm = fZlq[fGclink->jtmed-itm];
3797 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3798 imat = Int_t (fZq[jtm+6]);
3799 jma = fZlq[fGclink->jmate-imat];
3801 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3804 strncpy(namate,(char *)&fZiq[jma+1],20);
3807 //** find the material original number
3810 iret=fscanf(luncor,"%4s,%130s",key,card);
3811 if(iret<=0) goto L26;
3813 if(!strcmp(key,"MATE")) {
3814 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3815 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3816 if(!strcmp(namatec,namate)) {
3817 if(az==a && zc==z && densc==dens && radlc==radl
3818 && abslc==absl && nparc==nparc) {
3821 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3823 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3827 if(strcmp(key,"END") && !flag) goto L23;
3829 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3833 //*** restore original tracking medium number
3836 iret=fscanf(luncor,"%4s,%130s",key,card);
3837 if(iret<=0) goto L26;
3839 if (!strcmp(key,"TMED")) {
3840 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3841 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3842 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3843 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3844 epsil,stmin,ubuf,&nwbuf);
3845 if(!strcmp(natmedc,natmed)) {
3846 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3849 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3852 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3856 if(strcmp(key,"END") && !flag) goto L24;
3858 printf("cannot restore original number for medium : %s\n",natmed);
3866 L26: printf("*** GWEUCL *** cannot read the data file\n");
3868 L29: if(luncor) fclose (luncor);
3871 // *** write down the tracking medium definition
3873 strcpy(card,"! Tracking medium");
3874 fprintf(lun,f10000,card);
3876 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3877 if (iws[iadtmd+itm]>0) {
3878 jtm = fZlq[fGclink->jtmed-itm];
3879 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3881 imat = Int_t (fZq[jtm+6]);
3882 jma = fZlq[fGclink->jmate-imat];
3883 //* order media from one, if comparing with database failed
3885 iotmed[itm]=++imxtmed;
3886 iomate[imat]=++imxmate;
3891 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3894 strncpy(namate,(char *)&fZiq[jma+1],20);
3897 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3901 //* *** write down the rotation matrix
3903 strcpy(card,"! Reperes");
3904 fprintf(lun,f10000,card);
3906 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3907 if (iws[iadrot+irm]>0) {
3908 jrm = fZlq[fGclink->jrotm-irm];
3909 fprintf(lun,"ROTM %3d",irm);
3910 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3915 //* *** write down the volume definition
3917 strcpy(card,"! Volumes");
3918 fprintf(lun,f10000,card);
3920 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3923 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3925 jvo = fZlq[fGclink->jvolum-ivo];
3926 ish = Int_t (fZq[jvo+2]);
3927 nmed = Int_t (fZq[jvo+4]);
3928 npar = Int_t (fZq[jvo+5]);
3930 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3931 Gckpar (ish,npar,par);
3932 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3933 for(i=0;i<(npar-1)/6+1;i++) {
3936 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3940 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3945 //* *** write down the division of volumes
3947 fprintf(lun,f10000,"! Divisions");
3948 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3949 ivo = TMath::Abs(iws[ivstak]);
3950 jvo = fZlq[fGclink->jvolum-ivo];
3951 ish = Int_t (fZq[jvo+2]);
3952 nin = Int_t (fZq[jvo+3]);
3953 //* this volume is divided ...
3956 iaxe = Int_t ( fZq[jdiv+1]);
3957 ivin = Int_t ( fZq[jdiv+2]);
3958 ndiv = Int_t ( fZq[jdiv+3]);
3961 jvin = fZlq[fGclink->jvolum-ivin];
3962 nmed = Int_t ( fZq[jvin+4]);
3963 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3965 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3967 if ((step<=0.)||(ish>=11)) {
3968 //* volume with negative parameter or gsposp or pgon ...
3969 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3970 } else if ((ndiv<=0)||(ish==10)) {
3971 //* volume with negative parameter or gsposp or para ...
3972 ndvmx = TMath::Abs(ndiv);
3973 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3974 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3976 //* normal volume : all kind of division are equivalent
3977 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3978 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3983 //* *** write down the the positionnement of volumes
3985 fprintf(lun,f10000,"! Positionnements\n");
3987 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3988 ivo = TMath::Abs(iws[ivstak]);
3989 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3991 jvo = fZlq[fGclink->jvolum-ivo];
3992 nin = Int_t( fZq[jvo+3]);
3993 //* this volume has daughters ...
3995 for (in=1;in<=nin;in++) {
3997 ivin = Int_t (fZq[jin +2]);
3998 numb = Int_t (fZq[jin +3]);
3999 irot = Int_t (fZq[jin +4]);
4003 strcpy(konly,"ONLY");
4004 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
4005 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
4007 jvin = fZlq[fGclink->jvolum-ivin];
4008 ish = Int_t (fZq[jvin+2]);
4009 //* gspos or gsposp ?
4010 ndata = fZiq[jin-1];
4012 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
4013 name,numb,mother,x,y,z,irot,konly);
4015 npar = Int_t (fZq[jin+9]);
4016 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
4017 Gckpar (ish,npar,par);
4018 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
4019 name,numb,mother,x,y,z,irot,konly,npar);
4021 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4028 fprintf(lun,"END\n");
4031 //****** write down the materials and medias *****
4033 lun=fopen(filetme,"w");
4035 for(itm=1;itm<=fGcnum->ntmed;itm++) {
4036 if (iws[iadtmd+itm]>0) {
4037 jtm = fZlq[fGclink->jtmed-itm];
4038 strncpy(natmed,(char*)&fZiq[jtm+1],4);
4039 imat = Int_t (fZq[jtm+6]);
4040 jma = Int_t (fZlq[fGclink->jmate-imat]);
4042 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
4043 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
4044 iomate[imat],namate,a,z,dens,radl,absl,npar);
4048 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4052 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
4053 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
4054 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
4055 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
4059 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4065 fprintf(lun,"END\n");
4067 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
4068 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
4077 //_____________________________________________________________________________
4078 void TGeant3::Streamer(TBuffer &R__b)
4081 // Stream an object of class TGeant3.
4083 if (R__b.IsReading()) {
4084 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
4085 AliMC::Streamer(R__b);
4088 R__b.ReadStaticArray(fPDGCode);
4090 R__b.WriteVersion(TGeant3::IsA());
4091 AliMC::Streamer(R__b);
4094 R__b.WriteArray(fPDGCode, fNPDGCodes);