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.38 2000/10/30 15:19:06 morsch
19 Xi(b) (pdg code 5232) added to Pdg data base.
21 Revision 1.37 2000/10/02 21:28:16 fca
22 Removal of useless dependecies via forward declarations
24 Revision 1.36 2000/09/14 07:08:41 fca
25 Introducing glvolu in the interface
27 Revision 1.35 2000/09/12 14:27:10 morsch
28 No instance of AliDecayer created to initialize fDecayer.
30 Revision 1.34 2000/09/07 12:12:01 morsch
31 Comment inside comment removed.
33 Revision 1.33 2000/09/06 16:03:42 morsch
34 Set ExternalDecayer, Decayer and SetForceDecay methods added.
35 Gspart calls for charmed and bottom hadrons added.
36 Decay mode definitions for charmed and beauty hadrons have been taken out.
37 They will be handled by an external decayer.
39 Revision 1.32 2000/08/24 16:28:53 hristov
40 TGeant3::IsNewTrack corrected by F.Carminati
42 Revision 1.31 2000/07/13 16:19:10 fca
43 Mainly coding conventions + some small bug fixes
45 Revision 1.30 2000/07/12 08:56:30 fca
46 Coding convention correction and warning removal
48 Revision 1.29 2000/07/11 18:24:59 fca
49 Coding convention corrections + few minor bug fixes
51 Revision 1.28 2000/06/29 10:51:55 morsch
52 Add some charmed and bottom baryons to the particle list (TDatabasePDG). This
53 is needed by Hijing. Should be part of a future review of TDatabasePDG.
55 Revision 1.27 2000/06/21 17:40:15 fca
56 Adding possibility to set ISTRA, PAI model
58 Revision 1.26 2000/05/16 13:10:41 fca
59 New method IsNewTrack and fix for a problem in Father-Daughter relations
61 Revision 1.25 2000/04/07 11:12:35 fca
62 G4 compatibility changes
64 Revision 1.24 2000/02/28 21:03:57 fca
65 Some additions to improve the compatibility with G4
67 Revision 1.23 2000/02/23 16:25:25 fca
68 AliVMC and AliGeant3 classes introduced
69 ReadEuclid moved from AliRun to AliModule
71 Revision 1.22 2000/01/18 15:40:13 morsch
72 Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
73 Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
75 Revision 1.21 2000/01/17 19:41:17 fca
78 Revision 1.20 2000/01/12 11:29:27 fca
81 Revision 1.19 1999/12/17 09:03:12 fca
82 Introduce a names array
84 Revision 1.18 1999/11/26 16:55:39 fca
85 Reimplement CurrentVolName() to avoid memory leaks
87 Revision 1.17 1999/11/03 16:58:28 fca
88 Correct source of address violation in creating character string
90 Revision 1.16 1999/11/03 13:17:08 fca
91 Have ProdProcess return const char*
93 Revision 1.15 1999/10/26 06:04:50 fca
94 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
96 Revision 1.14 1999/09/29 09:24:30 fca
97 Introduction of the Copyright and cvs Log
101 ///////////////////////////////////////////////////////////////////////////////
103 // Interface Class to the Geant3.21 MonteCarlo //
107 <img src="picts/TGeant3Class.gif">
112 ///////////////////////////////////////////////////////////////////////////////
118 #include <TDatabasePDG.h>
119 #include "AliCallf77.h"
120 #include "AliDecayer.h"
121 #include "TLorentzVector.h"
124 # define gzebra gzebra_
125 # define grfile grfile_
126 # define gpcxyz gpcxyz_
127 # define ggclos ggclos_
128 # define glast glast_
129 # define ginit ginit_
130 # define gcinit gcinit_
132 # define gtrig gtrig_
133 # define gtrigc gtrigc_
134 # define gtrigi gtrigi_
135 # define gwork gwork_
136 # define gzinit gzinit_
137 # define gfmate gfmate_
138 # define gfpart gfpart_
139 # define gftmed gftmed_
140 # define gftmat gftmat_
141 # define gmate gmate_
142 # define gpart gpart_
144 # define gsmate gsmate_
145 # define gsmixt gsmixt_
146 # define gspart gspart_
147 # define gstmed gstmed_
148 # define gsckov gsckov_
149 # define gstpar gstpar_
150 # define gfkine gfkine_
151 # define gfvert gfvert_
152 # define gskine gskine_
153 # define gsvert gsvert_
154 # define gphysi gphysi_
155 # define gdebug gdebug_
156 # define gekbin gekbin_
157 # define gfinds gfinds_
158 # define gsking gsking_
159 # define gskpho gskpho_
160 # define gsstak gsstak_
161 # define gsxyz gsxyz_
162 # define gtrack gtrack_
163 # define gtreve gtreve_
164 # define gtreveroot gtreveroot_
165 # define grndm grndm_
166 # define grndmq grndmq_
167 # define gdtom gdtom_
168 # define glmoth glmoth_
169 # define gmedia gmedia_
170 # define gmtod gmtod_
171 # define gsdvn gsdvn_
172 # define gsdvn2 gsdvn2_
173 # define gsdvs gsdvs_
174 # define gsdvs2 gsdvs2_
175 # define gsdvt gsdvt_
176 # define gsdvt2 gsdvt2_
177 # define gsord gsord_
178 # define gspos gspos_
179 # define gsposp gsposp_
180 # define gsrotm gsrotm_
181 # define gprotm gprotm_
182 # define gsvolu gsvolu_
183 # define gprint gprint_
184 # define gdinit gdinit_
185 # define gdopt gdopt_
186 # define gdraw gdraw_
187 # define gdrayt gdrayt_
188 # define gdrawc gdrawc_
189 # define gdrawx gdrawx_
190 # define gdhead gdhead_
191 # define gdwmn1 gdwmn1_
192 # define gdwmn2 gdwmn2_
193 # define gdwmn3 gdwmn3_
194 # define gdxyz gdxyz_
195 # define gdcxyz gdcxyz_
196 # define gdman gdman_
197 # define gdspec gdspec_
198 # define gdtree gdtree_
199 # define gdelet gdelet_
200 # define gdclos gdclos_
201 # define gdshow gdshow_
202 # define gdopen gdopen_
203 # define dzshow dzshow_
204 # define gsatt gsatt_
205 # define gfpara gfpara_
206 # define gckpar gckpar_
207 # define gckmat gckmat_
208 # define glvolu glvolu_
209 # define geditv geditv_
210 # define mzdrop mzdrop_
212 # define ertrak ertrak_
213 # define ertrgo ertrgo_
215 # define setbomb setbomb_
216 # define setclip setclip_
217 # define gcomad gcomad_
219 # define gbrelm gbrelm_
220 # define gprelm gprelm_
222 # define gzebra GZEBRA
223 # define grfile GRFILE
224 # define gpcxyz GPCXYZ
225 # define ggclos GGCLOS
228 # define gcinit GCINIT
231 # define gtrigc GTRIGC
232 # define gtrigi GTRIGI
234 # define gzinit GZINIT
235 # define gfmate GFMATE
236 # define gfpart GFPART
237 # define gftmed GFTMED
238 # define gftmat GFTMAT
242 # define gsmate GSMATE
243 # define gsmixt GSMIXT
244 # define gspart GSPART
245 # define gstmed GSTMED
246 # define gsckov GSCKOV
247 # define gstpar GSTPAR
248 # define gfkine GFKINE
249 # define gfvert GFVERT
250 # define gskine GSKINE
251 # define gsvert GSVERT
252 # define gphysi GPHYSI
253 # define gdebug GDEBUG
254 # define gekbin GEKBIN
255 # define gfinds GFINDS
256 # define gsking GSKING
257 # define gskpho GSKPHO
258 # define gsstak GSSTAK
260 # define gtrack GTRACK
261 # define gtreve GTREVE
262 # define gtreveroot GTREVEROOT
264 # define grndmq GRNDMQ
266 # define glmoth GLMOTH
267 # define gmedia GMEDIA
270 # define gsdvn2 GSDVN2
272 # define gsdvs2 GSDVS2
274 # define gsdvt2 GSDVT2
277 # define gsposp GSPOSP
278 # define gsrotm GSROTM
279 # define gprotm GPROTM
280 # define gsvolu GSVOLU
281 # define gprint GPRINT
282 # define gdinit GDINIT
285 # define gdrayt GDRAYT
286 # define gdrawc GDRAWC
287 # define gdrawx GDRAWX
288 # define gdhead GDHEAD
289 # define gdwmn1 GDWMN1
290 # define gdwmn2 GDWMN2
291 # define gdwmn3 GDWMN3
293 # define gdcxyz GDCXYZ
295 # define gdfspc GDFSPC
296 # define gdspec GDSPEC
297 # define gdtree GDTREE
298 # define gdelet GDELET
299 # define gdclos GDCLOS
300 # define gdshow GDSHOW
301 # define gdopen GDOPEN
302 # define dzshow DZSHOW
304 # define gfpara GFPARA
305 # define gckpar GCKPAR
306 # define gckmat GCKMAT
307 # define glvolu GLVOLU
308 # define geditv GEDITV
309 # define mzdrop MZDROP
311 # define ertrak ERTRAK
312 # define ertrgo ERTRGO
314 # define setbomb SETBOMB
315 # define setclip SETCLIP
316 # define gcomad GCOMAD
318 # define gbrelm GBRELM
319 # define gprelm GPRELM
323 //____________________________________________________________________________
327 // Prototypes for GEANT functions
329 void type_of_call gzebra(const int&);
331 void type_of_call gpcxyz();
333 void type_of_call ggclos();
335 void type_of_call glast();
337 void type_of_call ginit();
339 void type_of_call gcinit();
341 void type_of_call grun();
343 void type_of_call gtrig();
345 void type_of_call gtrigc();
347 void type_of_call gtrigi();
349 void type_of_call gwork(const int&);
351 void type_of_call gzinit();
353 void type_of_call gmate();
355 void type_of_call gpart();
357 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
359 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
360 Int_t &, Float_t *, Int_t &);
362 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
363 Float_t &, Float_t *, Int_t &);
365 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
368 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
371 void type_of_call gphysi();
373 void type_of_call gdebug();
375 void type_of_call gekbin();
377 void type_of_call gfinds();
379 void type_of_call gsking(Int_t &);
381 void type_of_call gskpho(Int_t &);
383 void type_of_call gsstak(Int_t &);
385 void type_of_call gsxyz();
387 void type_of_call gtrack();
389 void type_of_call gtreve();
391 void type_of_call gtreveroot();
393 void type_of_call grndm(Float_t *r, const Int_t &n)
396 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
398 {/*printf("Dummy grndmq called\n");*/}
400 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
402 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
403 Int_t *, Int_t * DEFCHARL);
405 void type_of_call gmedia(Float_t *, Int_t &);
407 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
409 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
410 const Float_t &, const Float_t &, const Float_t &,
413 void type_of_call gprotm(const Int_t &);
415 void type_of_call grfile(const Int_t&, DEFCHARD,
416 DEFCHARD DEFCHARL DEFCHARL);
418 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
419 Float_t &, Float_t &, Float_t &, Float_t *,
422 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
423 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
425 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
426 Float_t &, Float_t &, Float_t &, Float_t &,
427 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
429 void type_of_call gftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
431 ,Float_t *, Int_t & DEFCHARL);
433 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
434 Float_t &, Float_t &, Float_t &, Float_t *,
437 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
438 Float_t &, Int_t &, Float_t * DEFCHARL);
440 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
441 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
444 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
445 Float_t &, Float_t &, Float_t &, Float_t &,
446 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
448 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
449 Float_t *absco, Float_t *effic, Float_t *rindex);
450 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
452 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
455 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
456 Int_t & DEFCHARL DEFCHARL);
458 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
461 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
462 Int_t & DEFCHARL DEFCHARL);
464 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
465 Int_t & DEFCHARL DEFCHARL);
467 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
468 Int_t &, Int_t & DEFCHARL DEFCHARL);
470 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
472 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
473 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
476 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
477 Float_t &, Int_t &, DEFCHARD,
478 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
480 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
481 Int_t & DEFCHARL DEFCHARL);
483 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
485 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
488 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
490 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
492 void type_of_call glvolu(Int_t&, Int_t*, Int_t*, Int_t&);
494 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
496 void type_of_call gdinit();
498 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
500 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
501 Float_t &, Float_t &, Float_t & DEFCHARL);
502 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
503 Float_t &, Float_t &, Float_t & DEFCHARL);
504 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
505 Float_t &, Float_t & DEFCHARL);
506 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
507 Float_t &, Float_t &, Float_t &, Float_t &,
509 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
510 void type_of_call gdxyz(Int_t &);
511 void type_of_call gdcxyz();
512 void type_of_call gdman(Float_t &, Float_t &);
513 void type_of_call gdwmn1(Float_t &, Float_t &);
514 void type_of_call gdwmn2(Float_t &, Float_t &);
515 void type_of_call gdwmn3(Float_t &, Float_t &);
516 void type_of_call gdspec(DEFCHARD DEFCHARL);
517 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
518 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
520 void type_of_call gdopen(Int_t &);
521 void type_of_call gdclos();
522 void type_of_call gdelet(Int_t &);
523 void type_of_call gdshow(Int_t &);
524 void type_of_call geditv(Int_t &) {;}
527 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
528 const int&, const int&, const int& DEFCHARL
531 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
533 void type_of_call setbomb(Float_t &);
534 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
535 Float_t &, Float_t & DEFCHARL);
536 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
538 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
539 const Float_t *x2, const Float_t *p2,
540 const Int_t &ipa, DEFCHARD DEFCHARL);
542 void type_of_call ertrgo();
544 float type_of_call gbrelm(const Float_t &z, const Float_t& t, const Float_t& cut);
545 float type_of_call gprelm(const Float_t &z, const Float_t& t, const Float_t& cut);
549 // Geant3 global pointer
551 static const Int_t kDefSize = 600;
555 //____________________________________________________________________________
559 // Default constructor
563 //____________________________________________________________________________
564 TGeant3::TGeant3(const char *title, Int_t nwgeant)
565 :AliMC("TGeant3",title)
568 // Standard constructor for TGeant3 with ZEBRA initialisation
579 // Load Address of Geant3 commons
582 // Zero number of particles
587 //____________________________________________________________________________
588 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
589 Float_t &radl, Float_t &absl) const
592 // Return the parameters of the current material during transport
596 dens = fGcmate->dens;
597 radl = fGcmate->radl;
598 absl = fGcmate->absl;
599 return 1; //this could be the number of elements in mixture
602 //____________________________________________________________________________
603 void TGeant3::DefaultRange()
606 // Set range of current drawing pad to 20x20 cm
612 gHigz->Range(0,0,20,20);
615 //____________________________________________________________________________
616 void TGeant3::InitHIGZ()
627 //____________________________________________________________________________
628 void TGeant3::LoadAddress()
631 // Assigns the address of the GEANT common blocks to the structures
632 // that allow their access from C++
635 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
636 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
637 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
638 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
639 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
640 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
641 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
642 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
643 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
644 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
645 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
646 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
647 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
648 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
649 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
650 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
651 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
652 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
653 gcomad(PASSCHARD("GCPHLT"),(int*&) fGcphlt PASSCHARL("GCPHLT"));
654 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
655 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
656 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
659 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
660 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
661 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
662 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
664 // Variables for ZEBRA store
665 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
667 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
672 //_____________________________________________________________________________
673 void TGeant3::GeomIter()
676 // Geometry iterator for moving upward in the geometry tree
677 // Initialise the iterator
679 fNextVol=fGcvolu->nlevel;
682 //____________________________________________________________________________
683 void TGeant3::FinishGeometry()
685 //Close the geometry structure
689 //____________________________________________________________________________
690 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
693 // Geometry iterator for moving upward in the geometry tree
694 // Return next volume up
699 gname=fGcvolu->names[fNextVol];
700 copy=fGcvolu->number[fNextVol];
701 i=fGcvolu->lvolum[fNextVol];
702 name = fVolNames[i-1];
703 if(gname == fZiq[fGclink->jvolum+i]) return i;
704 else printf("GeomTree: Volume %s not found in bank\n",name);
709 //_____________________________________________________________________________
710 void TGeant3::BuildPhysics()
715 //_____________________________________________________________________________
716 Int_t TGeant3::CurrentVolID(Int_t ©) const
719 // Returns the current volume ID and copy number
722 if( (i=fGcvolu->nlevel-1) < 0 ) {
723 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
725 gname=fGcvolu->names[i];
726 copy=fGcvolu->number[i];
727 i=fGcvolu->lvolum[i];
728 if(gname == fZiq[fGclink->jvolum+i]) return i;
729 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
734 //_____________________________________________________________________________
735 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
738 // Return the current volume "off" upward in the geometrical tree
739 // ID and copy number
742 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
743 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
744 off,fGcvolu->nlevel);
746 gname=fGcvolu->names[i];
747 copy=fGcvolu->number[i];
748 i=fGcvolu->lvolum[i];
749 if(gname == fZiq[fGclink->jvolum+i]) return i;
750 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
755 //_____________________________________________________________________________
756 const char* TGeant3::CurrentVolName() const
759 // Returns the current volume name
762 if( (i=fGcvolu->nlevel-1) < 0 ) {
763 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
765 gname=fGcvolu->names[i];
766 i=fGcvolu->lvolum[i];
767 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
768 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
773 //_____________________________________________________________________________
774 const char* TGeant3::CurrentVolOffName(Int_t off) const
777 // Return the current volume "off" upward in the geometrical tree
778 // ID, name and copy number
779 // if name=0 no name is returned
782 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
783 Warning("CurrentVolOffName",
784 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
786 gname=fGcvolu->names[i];
787 i=fGcvolu->lvolum[i];
788 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
789 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
794 //_____________________________________________________________________________
795 Int_t TGeant3::IdFromPDG(Int_t pdg) const
798 // Return Geant3 code from PDG and pseudo ENDF code
800 for(Int_t i=0;i<fNPDGCodes;++i)
801 if(pdg==fPDGCode[i]) return i;
805 //_____________________________________________________________________________
806 Int_t TGeant3::PDGFromId(Int_t id) const
809 // Return PDG code and pseudo ENDF code from Geant3 code
811 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
815 //_____________________________________________________________________________
816 void TGeant3::DefineParticles()
819 // Define standard Geant 3 particles
822 // Load standard numbers for GEANT particles and PDG conversion
823 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
824 fPDGCode[fNPDGCodes++]=22; // 1 = photon
825 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
826 fPDGCode[fNPDGCodes++]=11; // 3 = electron
827 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
828 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
829 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
830 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
831 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
832 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
833 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
834 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
835 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
836 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
837 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
838 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
839 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
840 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
841 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
842 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
843 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
844 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
845 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
846 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
847 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
848 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
849 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
850 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
851 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
852 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
853 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
854 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
855 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
862 /* --- Define additional particles */
863 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
864 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
866 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
867 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
869 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
870 fPDGCode[fNPDGCodes++]=411; // 35 = D+
872 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
873 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
875 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
876 fPDGCode[fNPDGCodes++]=421; // 37 = D0
878 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
879 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
881 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
883 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
885 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
887 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
888 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
890 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
891 fPDGCode[fNPDGCodes++]=-213; // 43 = RHO-
893 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
894 fPDGCode[fNPDGCodes++]=113; // 44 = RHO0
897 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
899 // and numbers above 5 000 000 for special applications
902 const Int_t kion=10000000;
904 const Int_t kspe=50000000;
906 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
908 const Double_t kAu2Gev=0.9314943228;
909 const Double_t khSlash = 1.0545726663e-27;
910 const Double_t kErg2Gev = 1/1.6021773349e-3;
911 const Double_t khShGev = khSlash*kErg2Gev;
912 const Double_t kYear2Sec = 3600*24*365.25;
915 // mass and life-time from PDG
916 pdgDB->AddParticle("B(s)*0","B(s)*0",
917 5.4163, kTRUE, 0.047, +0.,"Meson", 533);
919 pdgDB->AddParticle("B(s)*0 bar","B(s)*0 bar",
920 5.4163, kTRUE, 0.047, -0.,"Meson", -533);
924 // value for mass used by Hijing
925 pdgDB->AddParticle("Sigma(c)*+","Sigma(c)*+",
926 2.4536, kTRUE, -1., +1.,"Baryon", 4214);
928 pdgDB->AddParticle("Sigma(c)*-","Sigma(c)*-",
929 2.4536, kTRUE, -1., -1.,"Baryon", -4214);
930 // equivalent to 4312 ? Hijing uses m=2.55
931 pdgDB->AddParticle("Xsi(c)0","Xsi(c)0",
932 2.4703, kTRUE, -1., +0.,"Baryon", 4132);
934 pdgDB->AddParticle("Xsi(c)0 bar","Xsi(c)0 bar",
935 2.4703, kTRUE, -1., -0.,"Baryon", -4132);
936 // equivalent to 4322 ? Hijing uses m=2.55
937 pdgDB->AddParticle("Xi(c)+","Xi(c)+",
938 2.4656, kFALSE, -1., +1.,"Baryon", 4232);
940 pdgDB->AddParticle("Xi(c)-","Xi(c)-",
941 2.4656, kFALSE, -1., -1.,"Baryon", -4232);
942 // mass values from Hijing
944 pdgDB->AddParticle("Xsi(c)*0","Xsi(c)*0",
945 2.63, kTRUE, -1., +0.,"Baryon", 4314);
947 pdgDB->AddParticle("Xsi(c)*0 bar","Xsi(c)*0 bar",
948 2.63, kTRUE, -1., -0.,"Baryon", -4314);
950 pdgDB->AddParticle("Xsi(c)*+","Xsi(c)*+",
951 2.63, kTRUE, -1., +1.,"Baryon", 4324);
953 pdgDB->AddParticle("Xsi(c)*-","Xsi(c)*-",
954 2.63, kTRUE, -1., -1.,"Baryon", -4324);
956 // pdg mass value, Hijing uses m=2.73.
957 pdgDB->AddParticle("Omega(c)0","Omega(c)0",
958 2.7040, kFALSE, khShGev/0.064e-12, +0.,"Baryon", 4332);
960 pdgDB->AddParticle("Omega(c)0 bar","Omega(c)0 bar",
961 2.7040, kFALSE, khShGev/0.064e-12, -0.,"Baryon", -4332);
962 // mass value from Hijing
963 pdgDB->AddParticle("Omega(c)*0","Omega(c)*0",
964 2.8000, kFALSE, -1., +0.,"Baryon", 4334);
966 pdgDB->AddParticle("Omega(c)*0 bar","Omega(c)*0",
967 2.8000, kFALSE, -1., -0.,"Baryon", -4334);
971 // mass value from Hijing
972 pdgDB->AddParticle("Sigma(b)*+","Sigma(b)*+",
973 5.8100, kFALSE, -1., +1.,"Baryon", 5224);
975 pdgDB->AddParticle("Sigma(b)*-","Sigma(b)*-",
976 5.8100, kFALSE, -1., -1.,"Baryon", -5224);
979 pdgDB->AddParticle("Xi(b)0","Xi(b)0",
980 5.8400, kFALSE, -1., +0.,"Baryon", 5232);
982 pdgDB->AddParticle("Xi(b)0 bar","Xi(b)0 bar",
983 5.8100, kFALSE, -1., -0.,"Baryon", -5232);
987 pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
988 0,1,"Ion",kion+10020);
989 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
991 pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
992 khShGev/(12.33*kYear2Sec),1,"Ion",kion+10030);
993 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
995 pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
996 khShGev/(12.33*kYear2Sec),2,"Ion",kion+20040);
997 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
999 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
1001 pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
1002 0,2,"Ion",kion+20030);
1003 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
1005 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
1006 0,0,"Special",kspe+50);
1007 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
1009 Gspart(51, "FeedbackPhoton", 7, 0., 0.,1.e20 );
1010 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
1011 0,0,"Special",kspe+51);
1012 fPDGCode[fNPDGCodes++]=kspe+51; // 51 = FeedbackPhoton
1013 Gspart(52, "Lambda_c+", 4, 2.2849, +1., 2.06e-13);
1014 fPDGCode[fNPDGCodes++]=4122; //52 = Lambda_c+
1016 Gspart(53, "Lambda_c-", 4, 2.2849, -1., 2.06e-13);
1017 fPDGCode[fNPDGCodes++]=-4122; //53 = Lambda_c-
1019 Gspart(54, "D_s+", 4, 1.9685, +1., 4.67e-13);
1020 fPDGCode[fNPDGCodes++]=431; //54 = D_s+
1022 Gspart(55, "D_s-", 4, 1.9685, -1., 4.67e-13);
1023 fPDGCode[fNPDGCodes++]=-431; //55 = D_s-
1025 Gspart(56, "Tau+", 5, 1.77705, +1., 2.9e-13);
1026 fPDGCode[fNPDGCodes++]=15; //56 = Tau+
1028 Gspart(57, "Tau-", 5, 1.77705, -1., 2.9e-13);
1029 fPDGCode[fNPDGCodes++]=-15; //57 = Tau-
1031 Gspart(58, "B0", 3, 5.2792, +0., 1.56e-12);
1032 fPDGCode[fNPDGCodes++]=511; //58 = B0
1034 Gspart(59, "B0 bar", 3, 5.2792, -0., 1.56e-12);
1035 fPDGCode[fNPDGCodes++]=-511; //58 = B0bar
1037 Gspart(60, "B+", 4, 5.2789, +1., 1.65e-12);
1038 fPDGCode[fNPDGCodes++]=521; //60 = B+
1040 Gspart(61, "B-", 4, 5.2789, -1., 1.65e-12);
1041 fPDGCode[fNPDGCodes++]=-521; //61 = B-
1043 Gspart(62, "Bs", 3, 5.3693, +0., 1.54e-12);
1044 fPDGCode[fNPDGCodes++]=521; //62 = B_s
1046 Gspart(63, "Bs bar", 3, 5.3693, -0., 1.54e-12);
1047 fPDGCode[fNPDGCodes++]=-521; //63 = B_s bar
1049 Gspart(64, "Lambda_b", 3, 5.624, +0., 1.24e-12);
1050 fPDGCode[fNPDGCodes++]=5122; //64 = Lambda_b
1052 Gspart(65, "Lambda_b bar", 3, 5.624, -0., 1.24e-12);
1053 fPDGCode[fNPDGCodes++]=-5122; //65 = Lambda_b bar
1055 Gspart(66, "J/Psi", 3.09688, 3, 0., 0.);
1056 fPDGCode[fNPDGCodes++]=443; // 66 = J/Psi
1058 Gspart(67, "Psi Prime", 3, 3.686, 0., 0.);
1059 fPDGCode[fNPDGCodes++]=20443; // 67 = Psi prime
1061 Gspart(68, "Upsilon(1S)", 9.46037, 3, 0., 0.);
1062 fPDGCode[fNPDGCodes++]=553; // 68 = Upsilon(1S)
1064 Gspart(69, "Upsilon(2S)", 10.0233, 3, 0., 0.);
1065 fPDGCode[fNPDGCodes++]=20553; // 69 = Upsilon(2S)
1067 Gspart(70, "Upsilon(3S)", 10.3553, 3, 0., 0.);
1068 fPDGCode[fNPDGCodes++]=30553; // 70 = Upsilon(3S)
1070 /* --- Define additional decay modes --- */
1071 /* --- omega(783) --- */
1072 for (kz = 0; kz < 6; ++kz) {
1083 Gsdk(ipa, bratio, mode);
1084 /* --- phi(1020) --- */
1085 for (kz = 0; kz < 6; ++kz) {
1100 Gsdk(ipa, bratio, mode);
1103 for (kz = 0; kz < 6; ++kz) {
1116 Gsdk(ipa, bratio, mode);
1120 for (kz = 0; kz < 6; ++kz) {
1133 Gsdk(ipa, bratio, mode);
1137 for (kz = 0; kz < 6; ++kz) {
1148 Gsdk(ipa, bratio, mode);
1150 /* --- Anti D0 --- */
1152 for (kz = 0; kz < 6; ++kz) {
1163 Gsdk(ipa, bratio, mode);
1166 for (kz = 0; kz < 6; ++kz) {
1173 Gsdk(ipa, bratio, mode);
1175 for (kz = 0; kz < 6; ++kz) {
1182 Gsdk(ipa, bratio, mode);
1184 for (kz = 0; kz < 6; ++kz) {
1191 Gsdk(ipa, bratio, mode);
1194 for (kz = 0; kz < 6; ++kz) {
1203 Gsdk(ipa, bratio, mode);
1206 Gsdk(ipa, bratio, mode);
1209 Gsdk(ipa, bratio, mode);
1214 //_____________________________________________________________________________
1215 Int_t TGeant3::VolId(const Text_t *name) const
1218 // Return the unique numeric identifier for volume name
1221 strncpy((char *) &gname, name, 4);
1222 for(i=1; i<=fGcnum->nvolum; i++)
1223 if(gname == fZiq[fGclink->jvolum+i]) return i;
1224 printf("VolId: Volume %s not found\n",name);
1228 //_____________________________________________________________________________
1229 Int_t TGeant3::NofVolumes() const
1232 // Return total number of volumes in the geometry
1234 return fGcnum->nvolum;
1237 //_____________________________________________________________________________
1238 const char* TGeant3::VolName(Int_t id) const
1241 // Return the volume name given the volume identifier
1243 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1244 return fVolNames[fGcnum->nvolum];
1246 return fVolNames[id-1];
1249 //_____________________________________________________________________________
1250 void TGeant3::SetCut(const char* cutName, Float_t cutValue)
1253 // Set transport cuts for particles
1255 if(!strcmp(cutName,"CUTGAM"))
1256 fGccuts->cutgam=cutValue;
1257 else if(!strcmp(cutName,"CUTGAM"))
1258 fGccuts->cutele=cutValue;
1259 else if(!strcmp(cutName,"CUTELE"))
1260 fGccuts->cutneu=cutValue;
1261 else if(!strcmp(cutName,"CUTHAD"))
1262 fGccuts->cuthad=cutValue;
1263 else if(!strcmp(cutName,"CUTMUO"))
1264 fGccuts->cutmuo=cutValue;
1265 else if(!strcmp(cutName,"BCUTE"))
1266 fGccuts->bcute=cutValue;
1267 else if(!strcmp(cutName,"BCUTM"))
1268 fGccuts->bcutm=cutValue;
1269 else if(!strcmp(cutName,"DCUTE"))
1270 fGccuts->dcute=cutValue;
1271 else if(!strcmp(cutName,"DCUTM"))
1272 fGccuts->dcutm=cutValue;
1273 else if(!strcmp(cutName,"PPCUTM"))
1274 fGccuts->ppcutm=cutValue;
1275 else if(!strcmp(cutName,"TOFMAX"))
1276 fGccuts->tofmax=cutValue;
1277 else Warning("SetCut","Cut %s not implemented\n",cutName);
1280 //_____________________________________________________________________________
1281 void TGeant3::SetProcess(const char* flagName, Int_t flagValue)
1284 // Set thresholds for different processes
1286 if(!strcmp(flagName,"PAIR"))
1287 fGcphys->ipair=flagValue;
1288 else if(!strcmp(flagName,"COMP"))
1289 fGcphys->icomp=flagValue;
1290 else if(!strcmp(flagName,"PHOT"))
1291 fGcphys->iphot=flagValue;
1292 else if(!strcmp(flagName,"PFIS"))
1293 fGcphys->ipfis=flagValue;
1294 else if(!strcmp(flagName,"DRAY"))
1295 fGcphys->idray=flagValue;
1296 else if(!strcmp(flagName,"ANNI"))
1297 fGcphys->ianni=flagValue;
1298 else if(!strcmp(flagName,"BREM"))
1299 fGcphys->ibrem=flagValue;
1300 else if(!strcmp(flagName,"HADR"))
1301 fGcphys->ihadr=flagValue;
1302 else if(!strcmp(flagName,"MUNU"))
1303 fGcphys->imunu=flagValue;
1304 else if(!strcmp(flagName,"DCAY"))
1305 fGcphys->idcay=flagValue;
1306 else if(!strcmp(flagName,"LOSS"))
1307 fGcphys->iloss=flagValue;
1308 else if(!strcmp(flagName,"MULS"))
1309 fGcphys->imuls=flagValue;
1310 else if(!strcmp(flagName,"RAYL"))
1311 fGcphys->irayl=flagValue;
1312 else if(!strcmp(flagName,"STRA"))
1313 fGcphlt->istra=flagValue;
1314 else if(!strcmp(flagName,"SYNC"))
1315 fGcphlt->isync=flagValue;
1316 else Warning("SetFlag","Flag %s not implemented\n",flagName);
1319 //_____________________________________________________________________________
1320 Float_t TGeant3::Xsec(char* reac, Float_t /* energy */,
1321 Int_t part, Int_t /* mate */)
1324 // Calculate X-sections -- dummy for the moment
1326 if(!strcmp(reac,"PHOT"))
1329 Error("Xsec","Can calculate photoelectric only for photons\n");
1335 //_____________________________________________________________________________
1336 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1339 // Return the current position in the master reference frame of the
1340 // track being transported
1342 xyz[0]=fGctrak->vect[0];
1343 xyz[1]=fGctrak->vect[1];
1344 xyz[2]=fGctrak->vect[2];
1345 xyz[3]=fGctrak->tofg;
1348 //_____________________________________________________________________________
1349 Float_t TGeant3::TrackTime() const
1352 // Return the current time of flight of the track being transported
1354 return fGctrak->tofg;
1357 //_____________________________________________________________________________
1358 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1361 // Return the direction and the momentum (GeV/c) of the track
1362 // currently being transported
1364 Double_t ptot=fGctrak->vect[6];
1365 xyz[0]=fGctrak->vect[3]*ptot;
1366 xyz[1]=fGctrak->vect[4]*ptot;
1367 xyz[2]=fGctrak->vect[5]*ptot;
1368 xyz[3]=fGctrak->getot;
1371 //_____________________________________________________________________________
1372 Float_t TGeant3::TrackCharge() const
1375 // Return charge of the track currently transported
1377 return fGckine->charge;
1380 //_____________________________________________________________________________
1381 Float_t TGeant3::TrackMass() const
1384 // Return the mass of the track currently transported
1386 return fGckine->amass;
1389 //_____________________________________________________________________________
1390 Int_t TGeant3::TrackPid() const
1393 // Return the id of the particle transported
1395 return PDGFromId(fGckine->ipart);
1398 //_____________________________________________________________________________
1399 Float_t TGeant3::TrackStep() const
1402 // Return the length in centimeters of the current step
1404 return fGctrak->step;
1407 //_____________________________________________________________________________
1408 Float_t TGeant3::TrackLength() const
1411 // Return the length of the current track from its origin
1413 return fGctrak->sleng;
1416 //_____________________________________________________________________________
1417 Bool_t TGeant3::IsNewTrack() const
1420 // True if the track is not at the boundary of the current volume
1422 return (fGctrak->sleng==0);
1425 //_____________________________________________________________________________
1426 Bool_t TGeant3::IsTrackInside() const
1429 // True if the track is not at the boundary of the current volume
1431 return (fGctrak->inwvol==0);
1434 //_____________________________________________________________________________
1435 Bool_t TGeant3::IsTrackEntering() const
1438 // True if this is the first step of the track in the current volume
1440 return (fGctrak->inwvol==1);
1443 //_____________________________________________________________________________
1444 Bool_t TGeant3::IsTrackExiting() const
1447 // True if this is the last step of the track in the current volume
1449 return (fGctrak->inwvol==2);
1452 //_____________________________________________________________________________
1453 Bool_t TGeant3::IsTrackOut() const
1456 // True if the track is out of the setup
1458 return (fGctrak->inwvol==3);
1461 //_____________________________________________________________________________
1462 Bool_t TGeant3::IsTrackStop() const
1465 // True if the track energy has fallen below the threshold
1467 return (fGctrak->istop==2);
1470 //_____________________________________________________________________________
1471 Int_t TGeant3::NSecondaries() const
1474 // Number of secondary particles generated in the current step
1476 return fGcking->ngkine;
1479 //_____________________________________________________________________________
1480 Int_t TGeant3::CurrentEvent() const
1483 // Number of the current event
1485 return fGcflag->idevt;
1488 //_____________________________________________________________________________
1489 AliMCProcess TGeant3::ProdProcess() const
1492 // Name of the process that has produced the secondary particles
1493 // in the current step
1495 const Int_t kIpMec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1496 const Int_t kIpProc[13] = { kPDecay, kPPair, kPCompton,
1497 kPPhotoelectric, kPBrem, kPDeltaRay,
1498 kPAnnihilation, kPHadronic,
1499 kPMuonNuclear, kPPhotoFission,
1500 kPRayleigh, kPCerenkov, kPSynchrotron};
1503 if(fGcking->ngkine>0)
1504 for (km = 0; km < fGctrak->nmec; ++km)
1505 for (im = 0; im < 13; ++im)
1506 if (fGctrak->lmec[km] == kIpMec[im])
1507 return (AliMCProcess) kIpProc[im];
1509 return (AliMCProcess) kPNoProcess;
1512 //_____________________________________________________________________________
1513 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1514 TLorentzVector &x, TLorentzVector &p)
1517 // Get the parameters of the secondary track number isec produced
1518 // in the current step
1521 if(-1<isec && isec<fGcking->ngkine) {
1522 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1524 x[i]=fGckin3->gpos[isec][i];
1525 p[i]=fGcking->gkin[isec][i];
1527 x[3]=fGcking->tofd[isec];
1528 p[3]=fGcking->gkin[isec][3];
1530 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1531 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1536 //_____________________________________________________________________________
1537 void TGeant3::InitLego()
1540 // Set switches for lego transport
1543 SetDEBU(0,0,0); //do not print a message
1546 //_____________________________________________________________________________
1547 Bool_t TGeant3::IsTrackDisappeared() const
1550 // True if the current particle has disappered
1551 // either because it decayed or because it underwent
1552 // an inelastic collision
1554 return (fGctrak->istop==1);
1557 //_____________________________________________________________________________
1558 Bool_t TGeant3::IsTrackAlive() const
1561 // True if the current particle is alive and will continue to be
1564 return (fGctrak->istop==0);
1567 //_____________________________________________________________________________
1568 void TGeant3::StopTrack()
1571 // Stop the transport of the current particle and skip to the next
1576 //_____________________________________________________________________________
1577 void TGeant3::StopEvent()
1580 // Stop simulation of the current event and skip to the next
1585 //_____________________________________________________________________________
1586 Float_t TGeant3::MaxStep() const
1589 // Return the maximum step length in the current medium
1591 return fGctmed->stemax;
1594 //_____________________________________________________________________________
1595 void TGeant3::SetMaxStep(Float_t maxstep)
1598 // Set the maximum step allowed till the particle is in the current medium
1600 fGctmed->stemax=maxstep;
1603 //_____________________________________________________________________________
1604 void TGeant3::SetMaxNStep(Int_t maxnstp)
1607 // Set the maximum number of steps till the particle is in the current medium
1609 fGctrak->maxnst=maxnstp;
1612 //_____________________________________________________________________________
1613 Int_t TGeant3::GetMaxNStep() const
1616 // Maximum number of steps allowed in current medium
1618 return fGctrak->maxnst;
1621 //_____________________________________________________________________________
1622 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1623 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1627 // Defines a Material
1629 // kmat number assigned to the material
1630 // name material name
1631 // a atomic mass in au
1633 // dens density in g/cm3
1634 // absl absorbtion length in cm
1635 // if >=0 it is ignored and the program
1636 // calculates it, if <0. -absl is taken
1637 // radl radiation length in cm
1638 // if >=0 it is ignored and the program
1639 // calculates it, if <0. -radl is taken
1640 // buf pointer to an array of user words
1641 // nbuf number of user words
1643 Int_t jmate=fGclink->jmate;
1649 for(i=1; i<=ns; i++) {
1650 if(fZlq[jmate-i]==0) {
1656 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1657 nwbuf PASSCHARL(name));
1660 //_____________________________________________________________________________
1661 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1662 Float_t dens, Int_t nlmat, Float_t* wmat)
1665 // Defines mixture OR COMPOUND IMAT as composed by
1666 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1668 // If NLMAT > 0 then wmat contains the proportion by
1669 // weights of each basic material in the mixture.
1671 // If nlmat < 0 then WMAT contains the number of atoms
1672 // of a given kind into the molecule of the COMPOUND
1673 // In this case, WMAT in output is changed to relative
1676 Int_t jmate=fGclink->jmate;
1682 for(i=1; i<=ns; i++) {
1683 if(fZlq[jmate-i]==0) {
1689 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1692 //_____________________________________________________________________________
1693 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1694 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1695 Float_t stemax, Float_t deemax, Float_t epsil,
1696 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1699 // kmed tracking medium number assigned
1700 // name tracking medium name
1701 // nmat material number
1702 // isvol sensitive volume flag
1703 // ifield magnetic field
1704 // fieldm max. field value (kilogauss)
1705 // tmaxfd max. angle due to field (deg/step)
1706 // stemax max. step allowed
1707 // deemax max. fraction of energy lost in a step
1708 // epsil tracking precision (cm)
1709 // stmin min. step due to continuos processes (cm)
1711 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1712 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1713 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1715 Int_t jtmed=fGclink->jtmed;
1721 for(i=1; i<=ns; i++) {
1722 if(fZlq[jtmed-i]==0) {
1728 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1729 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1732 //_____________________________________________________________________________
1733 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1734 Float_t phiy, Float_t thez, Float_t phiz)
1737 // krot rotation matrix number assigned
1738 // theta1 polar angle for axis i
1739 // phi1 azimuthal angle for axis i
1740 // theta2 polar angle for axis ii
1741 // phi2 azimuthal angle for axis ii
1742 // theta3 polar angle for axis iii
1743 // phi3 azimuthal angle for axis iii
1745 // it defines the rotation matrix number irot.
1747 Int_t jrotm=fGclink->jrotm;
1753 for(i=1; i<=ns; i++) {
1754 if(fZlq[jrotm-i]==0) {
1760 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1763 //_____________________________________________________________________________
1764 Int_t TGeant3::GetMedium() const
1767 // Return the number of the current medium
1769 return fGctmed->numed;
1772 //_____________________________________________________________________________
1773 Float_t TGeant3::Edep() const
1776 // Return the energy lost in the current step
1778 return fGctrak->destep;
1781 //_____________________________________________________________________________
1782 Float_t TGeant3::Etot() const
1785 // Return the total energy of the current track
1787 return fGctrak->getot;
1790 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1792 // Functions from GBASE
1794 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1796 //____________________________________________________________________________
1797 void TGeant3::Gfile(const char *filename, const char *option)
1800 // Routine to open a GEANT/RZ data base.
1802 // LUN logical unit number associated to the file
1804 // CHFILE RZ file name
1806 // CHOPT is a character string which may be
1807 // N To create a new file
1808 // U to open an existing file for update
1809 // " " to open an existing file for read only
1810 // Q The initial allocation (default 1000 records)
1811 // is given in IQUEST(10)
1812 // X Open the file in exchange format
1813 // I Read all data structures from file to memory
1814 // O Write all data structures from memory to file
1817 // If options "I" or "O" all data structures are read or
1818 // written from/to file and the file is closed.
1819 // See routine GRMDIR to create subdirectories
1820 // See routines GROUT,GRIN to write,read objects
1822 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1826 //____________________________________________________________________________
1827 void TGeant3::Gpcxyz()
1830 // Print track and volume parameters at current point
1835 //_____________________________________________________________________________
1836 void TGeant3::Ggclos()
1839 // Closes off the geometry setting.
1840 // Initializes the search list for the contents of each
1841 // volume following the order they have been positioned, and
1842 // inserting the content '0' when a call to GSNEXT (-1) has
1843 // been required by the user.
1844 // Performs the development of the JVOLUM structure for all
1845 // volumes with variable parameters, by calling GGDVLP.
1846 // Interprets the user calls to GSORD, through GGORD.
1847 // Computes and stores in a bank (next to JVOLUM mother bank)
1848 // the number of levels in the geometrical tree and the
1849 // maximum number of contents per level, by calling GGNLEV.
1850 // Sets status bit for CONCAVE volumes, through GGCAVE.
1851 // Completes the JSET structure with the list of volume names
1852 // which identify uniquely a given physical detector, the
1853 // list of bit numbers to pack the corresponding volume copy
1854 // numbers, and the generic path(s) in the JVOLUM tree,
1855 // through the routine GHCLOS.
1858 // Create internal list of volumes
1859 fVolNames = new char[fGcnum->nvolum+1][5];
1861 for(i=0; i<fGcnum->nvolum; ++i) {
1862 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1863 fVolNames[i][4]='\0';
1865 strcpy(fVolNames[fGcnum->nvolum],"NULL");
1868 //_____________________________________________________________________________
1869 void TGeant3::Glast()
1872 // Finish a Geant run
1877 //_____________________________________________________________________________
1878 void TGeant3::Gprint(const char *name)
1881 // Routine to print data structures
1882 // CHNAME name of a data structure
1886 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1889 //_____________________________________________________________________________
1890 void TGeant3::Grun()
1893 // Steering function to process one run
1898 //_____________________________________________________________________________
1899 void TGeant3::Gtrig()
1902 // Steering function to process one event
1907 //_____________________________________________________________________________
1908 void TGeant3::Gtrigc()
1911 // Clear event partition
1916 //_____________________________________________________________________________
1917 void TGeant3::Gtrigi()
1920 // Initialises event partition
1925 //_____________________________________________________________________________
1926 void TGeant3::Gwork(Int_t nwork)
1929 // Allocates workspace in ZEBRA memory
1934 //_____________________________________________________________________________
1935 void TGeant3::Gzinit()
1938 // To initialise GEANT/ZEBRA data structures
1943 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1945 // Functions from GCONS
1947 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1949 //_____________________________________________________________________________
1950 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1951 Float_t &dens, Float_t &radl, Float_t &absl,
1952 Float_t* ubuf, Int_t& nbuf)
1955 // Return parameters for material IMAT
1957 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1961 //_____________________________________________________________________________
1962 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1963 Float_t &amass, Float_t &charge, Float_t &tlife)
1966 // Return parameters for particle of type IPART
1970 Int_t igpart = IdFromPDG(ipart);
1971 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1975 //_____________________________________________________________________________
1976 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1977 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1978 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1979 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1982 // Return parameters for tracking medium NUMED
1984 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1985 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1989 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
1990 Float_t* tkin, Float_t* value, Float_t* pcut,
1994 // Return parameters for tracking medium NUMED
1996 gftmat(imate, ipart, PASSCHARD(chmeca), kdim,
1997 tkin, value, pcut, ixst PASSCHARL(chmeca));
2001 //_____________________________________________________________________________
2002 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
2005 // To calculate energy loss due to soft muon BREMSSTRAHLUNG
2007 return gbrelm(z,t,bcut);
2010 //_____________________________________________________________________________
2011 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
2014 // To calculate DE/DX in GeV*barn/atom for direct pair production by muons
2016 return gprelm(z,t,bcut);
2019 //_____________________________________________________________________________
2020 void TGeant3::Gmate()
2023 // Define standard GEANT materials
2028 //_____________________________________________________________________________
2029 void TGeant3::Gpart()
2032 // Define standard GEANT particles plus selected decay modes
2033 // and branching ratios.
2038 //_____________________________________________________________________________
2039 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
2041 // Defines branching ratios and decay modes for standard
2043 gsdk(ipart,bratio,mode);
2046 //_____________________________________________________________________________
2047 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
2048 Float_t dens, Float_t radl, Float_t absl)
2051 // Defines a Material
2053 // kmat number assigned to the material
2054 // name material name
2055 // a atomic mass in au
2057 // dens density in g/cm3
2058 // absl absorbtion length in cm
2059 // if >=0 it is ignored and the program
2060 // calculates it, if <0. -absl is taken
2061 // radl radiation length in cm
2062 // if >=0 it is ignored and the program
2063 // calculates it, if <0. -radl is taken
2064 // buf pointer to an array of user words
2065 // nbuf number of user words
2069 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
2073 //_____________________________________________________________________________
2074 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
2075 Float_t dens, Int_t nlmat, Float_t *wmat)
2078 // Defines mixture OR COMPOUND IMAT as composed by
2079 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
2081 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
2082 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
2084 // If NLMAT.LT.0 then WMAT contains the number of atoms
2085 // of a given kind into the molecule of the COMPOUND
2086 // In this case, WMAT in output is changed to relative
2089 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
2092 //_____________________________________________________________________________
2093 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
2094 Float_t amass, Float_t charge, Float_t tlife)
2097 // Store particle parameters
2099 // ipart particle code
2100 // name particle name
2101 // itrtyp transport method (see GEANT manual)
2102 // amass mass in GeV/c2
2103 // charge charge in electron units
2104 // tlife lifetime in seconds
2108 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
2112 //_____________________________________________________________________________
2113 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
2114 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
2115 Float_t stemax, Float_t deemax, Float_t epsil,
2119 // NTMED Tracking medium number
2120 // NAME Tracking medium name
2121 // NMAT Material number
2122 // ISVOL Sensitive volume flag
2123 // IFIELD Magnetic field
2124 // FIELDM Max. field value (Kilogauss)
2125 // TMAXFD Max. angle due to field (deg/step)
2126 // STEMAX Max. step allowed
2127 // DEEMAX Max. fraction of energy lost in a step
2128 // EPSIL Tracking precision (cm)
2129 // STMIN Min. step due to continuos processes (cm)
2131 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
2132 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
2133 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
2137 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
2138 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
2141 //_____________________________________________________________________________
2142 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
2143 Float_t *absco, Float_t *effic, Float_t *rindex)
2146 // Stores the tables for UV photon tracking in medium ITMED
2147 // Please note that it is the user's responsability to
2148 // provide all the coefficients:
2151 // ITMED Tracking medium number
2152 // NPCKOV Number of bins of each table
2153 // PPCKOV Value of photon momentum (in GeV)
2154 // ABSCO Absorbtion coefficients
2155 // dielectric: absorbtion length in cm
2156 // metals : absorbtion fraction (0<=x<=1)
2157 // EFFIC Detection efficiency for UV photons
2158 // RINDEX Refraction index (if=0 metal)
2160 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
2163 //_____________________________________________________________________________
2164 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
2167 // To change the value of cut or mechanism "CHPAR"
2168 // to a new value PARVAL for tracking medium ITMED
2169 // The data structure JTMED contains the standard tracking
2170 // parameters (CUTS and flags to control the physics processes) which
2171 // are used by default for all tracking media. It is possible to
2172 // redefine individually with GSTPAR any of these parameters for a
2173 // given tracking medium.
2174 // ITMED tracking medium number
2175 // CHPAR is a character string (variable name)
2176 // PARVAL must be given as a floating point.
2178 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
2181 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2183 // Functions from GCONS
2185 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2187 //_____________________________________________________________________________
2188 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
2191 // Storing/Retrieving Vertex and Track parameters
2192 // ----------------------------------------------
2194 // Stores vertex parameters.
2195 // VERT array of (x,y,z) position of the vertex
2196 // NTBEAM beam track number origin of the vertex
2197 // =0 if none exists
2198 // NTTARG target track number origin of the vertex
2199 // UBUF user array of NUBUF floating point numbers
2201 // NVTX new vertex number (=0 in case of error).
2202 // Prints vertex parameters.
2203 // IVTX for vertex IVTX.
2204 // (For all vertices if IVTX=0)
2205 // Stores long life track parameters.
2206 // PLAB components of momentum
2207 // IPART type of particle (see GSPART)
2208 // NV vertex number origin of track
2209 // UBUF array of NUBUF floating point user parameters
2211 // NT track number (if=0 error).
2212 // Retrieves long life track parameters.
2213 // ITRA track number for which parameters are requested
2214 // VERT vector origin of the track
2215 // PVERT 4 momentum components at the track origin
2216 // IPART particle type (=0 if track ITRA does not exist)
2217 // NVERT vertex number origin of the track
2218 // UBUF user words stored in GSKINE.
2219 // Prints initial track parameters.
2220 // ITRA for track ITRA
2221 // (For all tracks if ITRA=0)
2225 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
2228 //_____________________________________________________________________________
2229 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
2233 // Retrieves the parameter of a vertex bank
2234 // Vertex is generated from tracks NTBEAM NTTARG
2235 // NVTX is the new vertex number
2239 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
2242 //_____________________________________________________________________________
2243 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
2247 // Store kinematics of track NT into data structure
2248 // Track is coming from vertex NV
2251 gskine(plab, ipart, nv, buf, nwbuf, nt);
2255 //_____________________________________________________________________________
2256 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
2260 // Creates a new vertex bank
2261 // Vertex is generated from tracks NTBEAM NTTARG
2262 // NVTX is the new vertex number
2265 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
2269 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2271 // Functions from GPHYS
2273 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2275 //_____________________________________________________________________________
2276 void TGeant3::Gphysi()
2279 // Initialise material constants for all the physics
2280 // mechanisms used by GEANT
2285 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2287 // Functions from GTRAK
2289 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2291 //_____________________________________________________________________________
2292 void TGeant3::Gdebug()
2295 // Debug the current step
2300 //_____________________________________________________________________________
2301 void TGeant3::Gekbin()
2304 // To find bin number in kinetic energy table
2305 // stored in ELOW(NEKBIN)
2310 //_____________________________________________________________________________
2311 void TGeant3::Gfinds()
2314 // Returns the set/volume parameters corresponding to
2315 // the current space point in /GCTRAK/
2316 // and fill common /GCSETS/
2318 // IHSET user set identifier
2319 // IHDET user detector identifier
2320 // ISET set number in JSET
2321 // IDET detector number in JS=LQ(JSET-ISET)
2322 // IDTYPE detector type (1,2)
2323 // NUMBV detector volume numbers (array of length NVNAME)
2324 // NVNAME number of volume levels
2329 //_____________________________________________________________________________
2330 void TGeant3::Gsking(Int_t igk)
2333 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2334 // or the NGKINE tracks when IGK is 0.
2339 //_____________________________________________________________________________
2340 void TGeant3::Gskpho(Int_t igk)
2343 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2344 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2349 //_____________________________________________________________________________
2350 void TGeant3::Gsstak(Int_t iflag)
2353 // Stores in auxiliary stack JSTAK the particle currently
2354 // described in common /GCKINE/.
2356 // On request, creates also an entry in structure JKINE :
2358 // 0 : No entry in JKINE structure required (user)
2359 // 1 : New entry in JVERTX / JKINE structures required (user)
2360 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2361 // 2 : Entry in JKINE structure exists already (from GTREVE)
2366 //_____________________________________________________________________________
2367 void TGeant3::Gsxyz()
2370 // Store space point VECT in banks JXYZ
2375 //_____________________________________________________________________________
2376 void TGeant3::Gtrack()
2379 // Controls tracking of current particle
2384 //_____________________________________________________________________________
2385 void TGeant3::Gtreve()
2388 // Controls tracking of all particles belonging to the current event
2393 //_____________________________________________________________________________
2394 void TGeant3::GtreveRoot()
2397 // Controls tracking of all particles belonging to the current event
2402 //_____________________________________________________________________________
2403 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2406 // To generate a vector RVECV of LEN random numbers
2407 // Copy of the CERN Library routine RANECU
2411 //_____________________________________________________________________________
2412 void TGeant3::Grndmq(Int_t &/*is1*/, Int_t &/*is2*/, const Int_t /*iseq*/,
2413 const Text_t */*chopt*/)
2416 // To set/retrieve the seed of the random number generator
2418 /*printf("Dummy grndmq called\n");*/
2421 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2423 // Functions from GDRAW
2425 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2427 //_____________________________________________________________________________
2428 void TGeant3::Gdxyz(Int_t it)
2431 // Draw the points stored with Gsxyz relative to track it
2436 //_____________________________________________________________________________
2437 void TGeant3::Gdcxyz()
2440 // Draw the position of the current track
2445 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2447 // Functions from GGEOM
2449 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2451 //_____________________________________________________________________________
2452 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2455 // Computes coordinates XM (Master Reference System
2456 // knowing the coordinates XD (Detector Ref System)
2457 // The local reference system can be initialized by
2458 // - the tracking routines and GDTOM used in GUSTEP
2459 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2460 // (inverse routine is GMTOD)
2462 // If IFLAG=1 convert coordinates
2463 // IFLAG=2 convert direction cosinus
2465 gdtom(xd, xm, iflag);
2468 //_____________________________________________________________________________
2469 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2473 // Loads the top part of the Volume tree in LVOLS (IVO's),
2474 // LINDX (IN indices) for a given volume defined through
2475 // its name IUDET and number IUNUM.
2477 // The routine stores only upto the last level where JVOLUM
2478 // data structure is developed. If there is no development
2479 // above the current level, it returns NLEV zero.
2481 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2484 //_____________________________________________________________________________
2485 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2488 // Finds in which volume/medium the point X is, and updates the
2489 // common /GCVOLU/ and the structure JGPAR accordingly.
2491 // NUMED returns the tracking medium number, or 0 if point is
2492 // outside the experimental setup.
2497 //_____________________________________________________________________________
2498 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2501 // Computes coordinates XD (in DRS)
2502 // from known coordinates XM in MRS
2503 // The local reference system can be initialized by
2504 // - the tracking routines and GMTOD used in GUSTEP
2505 // - a call to GMEDIA(XM,NUMED)
2506 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2507 // (inverse routine is GDTOM)
2509 // If IFLAG=1 convert coordinates
2510 // IFLAG=2 convert direction cosinus
2512 gmtod(xm, xd, iflag);
2515 //_____________________________________________________________________________
2516 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2520 // Create a new volume by dividing an existing one
2523 // MOTHER Mother volume name
2524 // NDIV Number of divisions
2527 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2528 // It divides a previously defined volume.
2533 Vname(mother,vmother);
2534 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2535 PASSCHARL(vmother));
2538 //_____________________________________________________________________________
2539 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2540 Int_t iaxis, Float_t c0i, Int_t numed)
2543 // Create a new volume by dividing an existing one
2545 // Divides mother into ndiv divisions called name
2546 // along axis iaxis starting at coordinate value c0.
2547 // the new volume created will be medium number numed.
2552 Vname(mother,vmother);
2553 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2554 PASSCHARL(vname) PASSCHARL(vmother));
2557 //_____________________________________________________________________________
2558 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2559 Int_t iaxis, Int_t numed)
2562 // Create a new volume by dividing an existing one
2567 Vname(mother,vmother);
2568 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2569 PASSCHARL(vname) PASSCHARL(vmother));
2572 //_____________________________________________________________________________
2573 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2574 Int_t iaxis, Float_t c0, Int_t numed)
2577 // Create a new volume by dividing an existing one
2582 Vname(mother,vmother);
2583 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2584 PASSCHARL(vname) PASSCHARL(vmother));
2587 //_____________________________________________________________________________
2588 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2589 Int_t iaxis, Int_t numed, Int_t ndvmx)
2592 // Create a new volume by dividing an existing one
2594 // Divides MOTHER into divisions called NAME along
2595 // axis IAXIS in steps of STEP. If not exactly divisible
2596 // will make as many as possible and will centre them
2597 // with respect to the mother. Divisions will have medium
2598 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2599 // NDVMX is the expected maximum number of divisions
2600 // (If 0, no protection tests are performed)
2605 Vname(mother,vmother);
2606 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2607 PASSCHARL(vname) PASSCHARL(vmother));
2610 //_____________________________________________________________________________
2611 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2612 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2615 // Create a new volume by dividing an existing one
2617 // Divides MOTHER into divisions called NAME along
2618 // axis IAXIS starting at coordinate value C0 with step
2620 // The new volume created will have medium number NUMED.
2621 // If NUMED is 0, NUMED of mother is taken.
2622 // NDVMX is the expected maximum number of divisions
2623 // (If 0, no protection tests are performed)
2628 Vname(mother,vmother);
2629 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2630 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2633 //_____________________________________________________________________________
2634 void TGeant3::Gsord(const char *name, Int_t iax)
2637 // Flags volume CHNAME whose contents will have to be ordered
2638 // along axis IAX, by setting the search flag to -IAX
2642 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2643 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2644 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2645 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2646 // IAX = 6 PHI (PHI=0 => X axis)
2647 // IAX = 7 THETA (THETA=0 => Z axis)
2651 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2654 //_____________________________________________________________________________
2655 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2656 Float_t y, Float_t z, Int_t irot, const char *konly)
2659 // Position a volume into an existing one
2662 // NUMBER Copy number of the volume
2663 // MOTHER Mother volume name
2664 // X X coord. of the volume in mother ref. sys.
2665 // Y Y coord. of the volume in mother ref. sys.
2666 // Z Z coord. of the volume in mother ref. sys.
2667 // IROT Rotation matrix number w.r.t. mother ref. sys.
2668 // ONLY ONLY/MANY flag
2670 // It positions a previously defined volume in the mother.
2675 Vname(mother,vmother);
2676 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2677 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2681 //_____________________________________________________________________________
2682 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2683 Float_t x, Float_t y, Float_t z, Int_t irot,
2684 const char *konly, Float_t *upar, Int_t np )
2687 // Place a copy of generic volume NAME with user number
2688 // NR inside MOTHER, with its parameters UPAR(1..NP)
2693 Vname(mother,vmother);
2694 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2695 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2699 //_____________________________________________________________________________
2700 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2701 Float_t phi2, Float_t theta3, Float_t phi3)
2704 // nmat Rotation matrix number
2705 // THETA1 Polar angle for axis I
2706 // PHI1 Azimuthal angle for axis I
2707 // THETA2 Polar angle for axis II
2708 // PHI2 Azimuthal angle for axis II
2709 // THETA3 Polar angle for axis III
2710 // PHI3 Azimuthal angle for axis III
2712 // It defines the rotation matrix number IROT.
2714 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2717 //_____________________________________________________________________________
2718 void TGeant3::Gprotm(Int_t nmat)
2721 // To print rotation matrices structure JROTM
2722 // nmat Rotation matrix number
2727 //_____________________________________________________________________________
2728 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2729 Float_t *upar, Int_t npar)
2733 // SHAPE Volume type
2734 // NUMED Tracking medium number
2735 // NPAR Number of shape parameters
2736 // UPAR Vector containing shape parameters
2738 // It creates a new volume in the JVOLUM data structure.
2744 Vname(shape,vshape);
2745 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2746 PASSCHARL(vname) PASSCHARL(vshape));
2750 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2752 // T H E D R A W I N G P A C K A G E
2753 // ======================================
2754 // Drawing functions. These functions allow the visualization in several ways
2755 // of the volumes defined in the geometrical data structure. It is possible
2756 // to draw the logical tree of volumes belonging to the detector (DTREE),
2757 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2758 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2759 // these commands when the hidden line removal option is activated; in
2760 // this case, the volumes can be also either translated in the space
2761 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2762 // possible to fill the surfaces of the volumes
2763 // with solid colours when the shading option (SHAD) is activated.
2764 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2765 // of the detectors or to scan physical events as well.
2766 // Finally, the command MOVE will allow the rotation, translation and zooming
2767 // on real time parts of the detectors or tracks and hits of a simulated event.
2768 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2769 // the drawing is performed by the Geant ray-tracing;
2770 // automatically, the color is assigned according to the tracking medium of each
2771 // volume and the volumes with a density lower/equal than the air are considered
2772 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2773 // the user can set color and visibility for the desired volumes via the command
2774 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2775 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2776 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2777 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2778 // first case, we assume that the first mother volume of the tree is a box with
2779 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2780 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2781 // second case, the distance between the observer and the origin of the world
2782 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2783 // or telescopic effects can be achieved changing the scale factors in the command
2784 // (DRAW). When the final picture does not occupy the full window,
2785 // mapping the space before tracing can speed up the drawing, but can also
2786 // produce less precise results; values from 1 to 4 are allowed in the command
2787 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2788 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2789 // The command (VALCUT) allows the cutting of the detector by three planes
2790 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2791 // SATT for any desired volume and can assume values from 0 to 7; it determines
2792 // the different light processing to be performed for different materials:
2793 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2794 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2795 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2796 // is 0.9) and the observer is assumed to have a light source (therefore he will
2797 // produce parallel light in the case of parallel view and point-like-source
2798 // light in the case of perspective view).
2800 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2802 //_____________________________________________________________________________
2803 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2807 // IOPT Name of the attribute to be set
2808 // IVAL Value to which the attribute is to be set
2810 // name= "*" stands for all the volumes.
2811 // iopt can be chosen among the following :
2813 // WORK 0=volume name is inactive for the tracking
2814 // 1=volume name is active for the tracking (default)
2816 // SEEN 0=volume name is invisible
2817 // 1=volume name is visible (default)
2818 // -1=volume invisible with all its descendants in the tree
2819 // -2=volume visible but not its descendants in the tree
2821 // LSTY line style 1,2,3,... (default=1)
2822 // LSTY=7 will produce a very precise approximation for
2823 // revolution bodies.
2825 // LWID line width -7,...,1,2,3,..7 (default=1)
2826 // LWID<0 will act as abs(LWID) was set for the volume
2827 // and for all the levels below it. When SHAD is 'ON', LWID
2828 // represent the linewidth of the scan lines filling the surfaces
2829 // (whereas the FILL value represent their number). Therefore
2830 // tuning this parameter will help to obtain the desired
2831 // quality/performance ratio.
2833 // COLO colour code -166,...,1,2,..166 (default=1)
2835 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2836 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2837 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2838 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2839 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2840 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2841 // colour=n*10+m, m=1,2,...9, will produce the same colour
2842 // as 'n', but with increasing luminosity according to 'm';
2843 // COLO<0 will act as if abs(COLO) was set for the volume
2844 // and for all the levels below it.
2845 // When for a volume the attribute FILL is > 1 (and the
2846 // option SHAD is on), the ABS of its colour code must be < 8
2847 // because an automatic shading of its faces will be
2850 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2851 // when option SHAD is "on" the FILL attribute of any
2852 // volume can be set different from 0 (normal drawing);
2853 // if it is set to 1, the faces of such volume will be filled
2854 // with solid colours; if ABS(FILL) is > 1, then a light
2855 // source is placed along the observer line, and the faces of
2856 // such volumes will be painted by colours whose luminosity
2857 // will depend on the amount of light reflected;
2858 // if ABS(FILL) = 1, then it is possible to use all the 166
2859 // colours of the colour table, becouse the automatic shading
2860 // is not performed;
2861 // for increasing values of FILL the drawing will be performed
2862 // with higher and higher resolution improving the quality (the
2863 // number of scan lines used to fill the faces increases with FILL);
2864 // it is possible to set different values of FILL
2865 // for different volumes, in order to optimize at the same time
2866 // the performance and the quality of the picture;
2867 // FILL<0 will act as if abs(FILL) was set for the volume
2868 // and for all the levels below it.
2869 // This kind of drawing can be saved in 'picture files'
2870 // or in view banks.
2871 // 0=drawing without fill area
2872 // 1=faces filled with solid colours and resolution = 6
2873 // 2=lowest resolution (very fast)
2874 // 3=default resolution
2875 // 4=.................
2876 // 5=.................
2877 // 6=.................
2879 // Finally, if a coloured background is desired, the FILL
2880 // attribute for the first volume of the tree must be set
2881 // equal to -abs(colo), colo being >0 and <166.
2883 // SET set number associated to volume name
2884 // DET detector number associated to volume name
2885 // DTYP detector type (1,2)
2892 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2896 //_____________________________________________________________________________
2897 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2898 Int_t& natt, Float_t* par, Float_t* att)
2901 // Find the parameters of a volume
2903 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2907 //_____________________________________________________________________________
2908 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2911 // Check the parameters of a shape
2913 gckpar(ish,npar,par);
2916 //_____________________________________________________________________________
2917 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2920 // Check the parameters of a tracking medium
2922 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2925 //_____________________________________________________________________________
2926 Int_t TGeant3::Glvolu(Int_t nlev, Int_t *lnam,Int_t *lnum)
2929 // nlev number of leveles deap into the volume tree
2930 // size of the arrays lnam and lnum
2931 // lnam an integer array whos 4 bytes contain the askii code for the
2933 // lnum an integer array containing the copy numbers for that specific
2936 // This routine fills the volulme paramters in common /gcvolu/ for a
2937 // physical tree, specified by the list lnam and lnum of volume names
2938 // and numbers, and for all its ascendants up to level 1. This routine
2939 // is optimsed and does not re-compute the part of the history already
2940 // available in GCVOLU. This means that if it is used in user programs
2941 // outside the usual framwork of the tracking, the user has to initilise
2942 // to zero NLEVEL in the common GCVOLU. It return 0 if there were no
2943 // problems in make the call.
2946 glvolu(nlev, lnam, lnum, ier);
2950 //_____________________________________________________________________________
2951 void TGeant3::Gdelete(Int_t iview)
2954 // IVIEW View number
2956 // It deletes a view bank from memory.
2961 //_____________________________________________________________________________
2962 void TGeant3::Gdopen(Int_t iview)
2965 // IVIEW View number
2967 // When a drawing is very complex and requires a long time to be
2968 // executed, it can be useful to store it in a view bank: after a
2969 // call to DOPEN and the execution of the drawing (nothing will
2970 // appear on the screen), and after a necessary call to DCLOSE,
2971 // the contents of the bank can be displayed in a very fast way
2972 // through a call to DSHOW; therefore, the detector can be easily
2973 // zoomed many times in different ways. Please note that the pictures
2974 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2981 //_____________________________________________________________________________
2982 void TGeant3::Gdclose()
2985 // It closes the currently open view bank; it must be called after the
2986 // end of the drawing to be stored.
2991 //_____________________________________________________________________________
2992 void TGeant3::Gdshow(Int_t iview)
2995 // IVIEW View number
2997 // It shows on the screen the contents of a view bank. It
2998 // can be called after a view bank has been closed.
3003 //_____________________________________________________________________________
3004 void TGeant3::Gdopt(const char *name,const char *value)
3008 // VALUE Option value
3010 // To set/modify the drawing options.
3013 // THRZ ON Draw tracks in R vs Z
3014 // OFF (D) Draw tracks in X,Y,Z
3017 // PROJ PARA (D) Parallel projection
3019 // TRAK LINE (D) Trajectory drawn with lines
3020 // POIN " " with markers
3021 // HIDE ON Hidden line removal using the CG package
3022 // OFF (D) No hidden line removal
3023 // SHAD ON Fill area and shading of surfaces.
3024 // OFF (D) Normal hidden line removal.
3025 // RAYT ON Ray-tracing on.
3026 // OFF (D) Ray-tracing off.
3027 // EDGE OFF Does not draw contours when shad is on.
3028 // ON (D) Normal shading.
3029 // MAPP 1,2,3,4 Mapping before ray-tracing.
3030 // 0 (D) No mapping.
3031 // USER ON User graphics options in the raytracing.
3032 // OFF (D) Automatic graphics options.
3038 Vname(value,vvalue);
3039 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
3043 //_____________________________________________________________________________
3044 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
3045 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
3050 // THETA Viewing angle theta (for 3D projection)
3051 // PHI Viewing angle phi (for 3D projection)
3052 // PSI Viewing angle psi (for 2D rotation)
3053 // U0 U-coord. (horizontal) of volume origin
3054 // V0 V-coord. (vertical) of volume origin
3055 // SU Scale factor for U-coord.
3056 // SV Scale factor for V-coord.
3058 // This function will draw the volumes,
3059 // selected with their graphical attributes, set by the Gsatt
3060 // facility. The drawing may be performed with hidden line removal
3061 // and with shading effects according to the value of the options HIDE
3062 // and SHAD; if the option SHAD is ON, the contour's edges can be
3063 // drawn or not. If the option HIDE is ON, the detector can be
3064 // exploded (BOMB), clipped with different shapes (CVOL), and some
3065 // of its parts can be shifted from their original
3066 // position (SHIFT). When HIDE is ON, if
3067 // the drawing requires more than the available memory, the program
3068 // will evaluate and display the number of missing words
3069 // (so that the user can increase the
3070 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
3071 // the program will print messages about the memory used and
3072 // statistics on the volumes' visibility.
3073 // The following commands will produce the drawing of a green
3074 // volume, specified by NAME, without using the hidden line removal
3075 // technique, using the hidden line removal technique,
3076 // with different linewidth and colour (red), with
3077 // solid colour, with shading of surfaces, and without edges.
3078 // Finally, some examples are given for the ray-tracing. (A possible
3079 // string for the NAME of the volume can be found using the command DTREE).
3085 if (fGcvdma->raytra != 1) {
3086 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
3088 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
3092 //_____________________________________________________________________________
3093 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
3094 Float_t v0,Float_t ul,Float_t vl)
3099 // CUTVAL Cut plane distance from the origin along the axis
3101 // U0 U-coord. (horizontal) of volume origin
3102 // V0 V-coord. (vertical) of volume origin
3103 // SU Scale factor for U-coord.
3104 // SV Scale factor for V-coord.
3106 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
3107 // and placed at the distance cutval from the origin.
3108 // The resulting picture is seen from the the same axis.
3109 // When HIDE Mode is ON, it is possible to get the same effect with
3110 // the CVOL/BOX function.
3116 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
3119 //_____________________________________________________________________________
3120 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
3121 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
3122 Float_t v0,Float_t ul,Float_t vl)
3126 // CUTTHE Theta angle of the line normal to cut plane
3127 // CUTPHI Phi angle of the line normal to cut plane
3128 // CUTVAL Cut plane distance from the origin along the axis
3130 // THETA Viewing angle theta (for 3D projection)
3131 // PHI Viewing angle phi (for 3D projection)
3132 // U0 U-coord. (horizontal) of volume origin
3133 // V0 V-coord. (vertical) of volume origin
3134 // SU Scale factor for U-coord.
3135 // SV Scale factor for V-coord.
3137 // The cut plane is normal to the line given by the cut angles
3138 // cutthe and cutphi and placed at the distance cutval from the origin.
3139 // The resulting picture is seen from the viewing angles theta,phi.
3145 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
3149 //_____________________________________________________________________________
3150 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
3155 // ISEL Option flag D=111110
3157 // CHRSIZ Character size (cm) of title NAME D=0.6
3160 // 0 to have only the header lines
3161 // xxxxx1 to add the text name centered on top of header
3162 // xxxx1x to add global detector name (first volume) on left
3163 // xxx1xx to add date on right
3164 // xx1xxx to select thick characters for text on top of header
3165 // x1xxxx to add the text 'EVENT NR x' on top of header
3166 // 1xxxxx to add the text 'RUN NR x' on top of header
3167 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
3168 // i.e. they generate overwritten text.
3170 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
3173 //_____________________________________________________________________________
3174 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
3177 // Draw a 2D-man at position (U0,V0)
3179 // U U-coord. (horizontal) of the centre of man' R
3180 // V V-coord. (vertical) of the centre of man' R
3181 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
3183 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
3184 // It superimposes the picure of a man or of a woman, chosen among
3185 // three different ones, with the same scale factors as the detector
3186 // in the current drawing.
3189 if (opt.Contains("WM1")) {
3191 } else if (opt.Contains("WM3")) {
3193 } else if (opt.Contains("WM2")) {
3200 //_____________________________________________________________________________
3201 void TGeant3::Gdspec(const char *name)
3206 // Shows 3 views of the volume (two cut-views and a 3D view), together with
3207 // its geometrical specifications. The 3D drawing will
3208 // be performed according the current values of the options HIDE and
3209 // SHAD and according the current SetClipBox clipping parameters for that
3216 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3219 //_____________________________________________________________________________
3220 void TGeant3::DrawOneSpec(const char *name)
3223 // Function called when one double-clicks on a volume name
3224 // in a TPavelabel drawn by Gdtree.
3226 THIGZ *higzSave = gHigz;
3227 higzSave->SetName("higzSave");
3228 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
3229 //printf("DrawOneSpec, gHigz=%x, higzSpec=%x\n",gHigz,higzSpec);
3230 if (higzSpec) gHigz = higzSpec;
3231 else higzSpec = new THIGZ(kDefSize);
3232 higzSpec->SetName("higzSpec");
3237 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3240 higzSave->SetName("higz");
3244 //_____________________________________________________________________________
3245 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
3249 // LEVMAX Depth level
3252 // This function draws the logical tree,
3253 // Each volume in the tree is represented by a TPaveTree object.
3254 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
3255 // Use TPaveTree pop-up menu to select:
3258 // - drawing tree of parent
3264 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3265 gHigz->SetPname("");
3268 //_____________________________________________________________________________
3269 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
3273 // LEVMAX Depth level
3276 // This function draws the logical tree of the parent of name.
3280 // Scan list of volumes in JVOLUM
3282 Int_t gname, i, jvo, in, nin, jin, num;
3283 strncpy((char *) &gname, name, 4);
3284 for(i=1; i<=fGcnum->nvolum; i++) {
3285 jvo = fZlq[fGclink->jvolum-i];
3286 nin = Int_t(fZq[jvo+3]);
3287 if (nin == -1) nin = 1;
3288 for (in=1;in<=nin;in++) {
3290 num = Int_t(fZq[jin+2]);
3291 if(gname == fZiq[fGclink->jvolum+num]) {
3292 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
3294 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3295 gHigz->SetPname("");
3302 //_____________________________________________________________________________
3303 void TGeant3::SetABAN(Int_t par)
3306 // par = 1 particles will be stopped according to their residual
3307 // range if they are not in a sensitive material and are
3308 // far enough from the boundary
3309 // 0 particles are transported normally
3311 fGcphys->dphys1 = par;
3315 //_____________________________________________________________________________
3316 void TGeant3::SetANNI(Int_t par)
3319 // To control positron annihilation.
3320 // par =0 no annihilation
3321 // =1 annihilation. Decays processed.
3322 // =2 annihilation. No decay products stored.
3324 fGcphys->ianni = par;
3328 //_____________________________________________________________________________
3329 void TGeant3::SetAUTO(Int_t par)
3332 // To control automatic calculation of tracking medium parameters:
3333 // par =0 no automatic calculation;
3334 // =1 automati calculation.
3336 fGctrak->igauto = par;
3340 //_____________________________________________________________________________
3341 void TGeant3::SetBOMB(Float_t boom)
3344 // BOOM : Exploding factor for volumes position
3346 // To 'explode' the detector. If BOOM is positive (values smaller
3347 // than 1. are suggested, but any value is possible)
3348 // all the volumes are shifted by a distance
3349 // proportional to BOOM along the direction between their centre
3350 // and the origin of the MARS; the volumes which are symmetric
3351 // with respect to this origin are simply not shown.
3352 // BOOM equal to 0 resets the normal mode.
3353 // A negative (greater than -1.) value of
3354 // BOOM will cause an 'implosion'; for even lower values of BOOM
3355 // the volumes' positions will be reflected respect to the origin.
3356 // This command can be useful to improve the 3D effect for very
3357 // complex detectors. The following commands will make explode the
3364 //_____________________________________________________________________________
3365 void TGeant3::SetBREM(Int_t par)
3368 // To control bremstrahlung.
3369 // par =0 no bremstrahlung
3370 // =1 bremstrahlung. Photon processed.
3371 // =2 bremstrahlung. No photon stored.
3373 fGcphys->ibrem = par;
3377 //_____________________________________________________________________________
3378 void TGeant3::SetCKOV(Int_t par)
3381 // To control Cerenkov production
3382 // par =0 no Cerenkov;
3384 // =2 Cerenkov with primary stopped at each step.
3386 fGctlit->itckov = par;
3390 //_____________________________________________________________________________
3391 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3392 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3395 // The hidden line removal technique is necessary to visualize properly
3396 // very complex detectors. At the same time, it can be useful to visualize
3397 // the inner elements of a detector in detail. This function allows
3398 // subtractions (via boolean operation) of BOX shape from any part of
3399 // the detector, therefore showing its inner contents.
3400 // If "*" is given as the name of the
3401 // volume to be clipped, all volumes are clipped by the given box.
3402 // A volume can be clipped at most twice.
3403 // if a volume is explicitely clipped twice,
3404 // the "*" will not act on it anymore. Giving "." as the name
3405 // of the volume to be clipped will reset the clipping.
3407 // NAME Name of volume to be clipped
3409 // XMIN Lower limit of the Shape X coordinate
3410 // XMAX Upper limit of the Shape X coordinate
3411 // YMIN Lower limit of the Shape Y coordinate
3412 // YMAX Upper limit of the Shape Y coordinate
3413 // ZMIN Lower limit of the Shape Z coordinate
3414 // ZMAX Upper limit of the Shape Z coordinate
3416 // This function performs a boolean subtraction between the volume
3417 // NAME and a box placed in the MARS according the values of the given
3423 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3426 //_____________________________________________________________________________
3427 void TGeant3::SetCOMP(Int_t par)
3430 // To control Compton scattering
3431 // par =0 no Compton
3432 // =1 Compton. Electron processed.
3433 // =2 Compton. No electron stored.
3436 fGcphys->icomp = par;
3439 //_____________________________________________________________________________
3440 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3441 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3442 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3443 Float_t ppcutm, Float_t tofmax)
3446 // CUTGAM Cut for gammas D=0.001
3447 // CUTELE Cut for electrons D=0.001
3448 // CUTHAD Cut for charged hadrons D=0.01
3449 // CUTNEU Cut for neutral hadrons D=0.01
3450 // CUTMUO Cut for muons D=0.01
3451 // BCUTE Cut for electron brems. D=-1.
3452 // BCUTM Cut for muon brems. D=-1.
3453 // DCUTE Cut for electron delta-rays D=-1.
3454 // DCUTM Cut for muon delta-rays D=-1.
3455 // PPCUTM Cut for e+e- pairs by muons D=0.01
3456 // TOFMAX Time of flight cut D=1.E+10
3458 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3459 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3461 // If one of the parameters from CUTGAM to PPCUTM included
3462 // is modified, cross-sections and energy loss tables must be
3463 // recomputed via the function Gphysi.
3465 fGccuts->cutgam = cutgam;
3466 fGccuts->cutele = cutele;
3467 fGccuts->cutneu = cutneu;
3468 fGccuts->cuthad = cuthad;
3469 fGccuts->cutmuo = cutmuo;
3470 fGccuts->bcute = bcute;
3471 fGccuts->bcutm = bcutm;
3472 fGccuts->dcute = dcute;
3473 fGccuts->dcutm = dcutm;
3474 fGccuts->ppcutm = ppcutm;
3475 fGccuts->tofmax = tofmax;
3478 //_____________________________________________________________________________
3479 void TGeant3::SetDCAY(Int_t par)
3482 // To control Decay mechanism.
3483 // par =0 no decays.
3484 // =1 Decays. secondaries processed.
3485 // =2 Decays. No secondaries stored.
3487 fGcphys->idcay = par;
3491 //_____________________________________________________________________________
3492 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3495 // Set the debug flag and frequency
3496 // Selected debug output will be printed from
3497 // event emin to even emax each emod event
3499 fGcflag->idemin = emin;
3500 fGcflag->idemax = emax;
3501 fGcflag->itest = emod;
3505 //_____________________________________________________________________________
3506 void TGeant3::SetDRAY(Int_t par)
3509 // To control delta rays mechanism.
3510 // par =0 no delta rays.
3511 // =1 Delta rays. secondaries processed.
3512 // =2 Delta rays. No secondaries stored.
3514 fGcphys->idray = par;
3517 //_____________________________________________________________________________
3518 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3521 // To control cross section tabulations
3522 // ekmin = minimum kinetic energy in GeV
3523 // ekmax = maximum kinetic energy in GeV
3524 // nekbin = number of logatithmic bins (<200)
3526 fGcmulo->ekmin = ekmin;
3527 fGcmulo->ekmax = ekmax;
3528 fGcmulo->nekbin = nekbin;
3531 //_____________________________________________________________________________
3532 void TGeant3::SetHADR(Int_t par)
3535 // To control hadronic interactions.
3536 // par =0 no hadronic interactions.
3537 // =1 Hadronic interactions. secondaries processed.
3538 // =2 Hadronic interactions. No secondaries stored.
3540 fGcphys->ihadr = par;
3543 //_____________________________________________________________________________
3544 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3545 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3546 Float_t xk8, Float_t xk9, Float_t xk10)
3549 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3550 // Their meaning is user defined
3552 fGckine->ikine = kine;
3553 fGckine->pkine[0] = xk1;
3554 fGckine->pkine[1] = xk2;
3555 fGckine->pkine[2] = xk3;
3556 fGckine->pkine[3] = xk4;
3557 fGckine->pkine[4] = xk5;
3558 fGckine->pkine[5] = xk6;
3559 fGckine->pkine[6] = xk7;
3560 fGckine->pkine[7] = xk8;
3561 fGckine->pkine[8] = xk9;
3562 fGckine->pkine[9] = xk10;
3565 //_____________________________________________________________________________
3566 void TGeant3::SetLOSS(Int_t par)
3569 // To control energy loss.
3570 // par =0 no energy loss;
3571 // =1 restricted energy loss fluctuations;
3572 // =2 complete energy loss fluctuations;
3574 // =4 no energy loss fluctuations.
3575 // If the value ILOSS is changed, then cross-sections and energy loss
3576 // tables must be recomputed via the command 'PHYSI'.
3578 fGcphys->iloss = par;
3582 //_____________________________________________________________________________
3583 void TGeant3::SetMULS(Int_t par)
3586 // To control multiple scattering.
3587 // par =0 no multiple scattering.
3588 // =1 Moliere or Coulomb scattering.
3589 // =2 Moliere or Coulomb scattering.
3590 // =3 Gaussian scattering.
3592 fGcphys->imuls = par;
3596 //_____________________________________________________________________________
3597 void TGeant3::SetMUNU(Int_t par)
3600 // To control muon nuclear interactions.
3601 // par =0 no muon-nuclear interactions.
3602 // =1 Nuclear interactions. Secondaries processed.
3603 // =2 Nuclear interactions. Secondaries not processed.
3605 fGcphys->imunu = par;
3608 //_____________________________________________________________________________
3609 void TGeant3::SetOPTI(Int_t par)
3612 // This flag controls the tracking optimisation performed via the
3614 // 1 no optimisation at all; GSORD calls disabled;
3615 // 0 no optimisation; only user calls to GSORD kept;
3616 // 1 all non-GSORDered volumes are ordered along the best axis;
3617 // 2 all volumes are ordered along the best axis.
3619 fGcopti->ioptim = par;
3622 //_____________________________________________________________________________
3623 void TGeant3::SetPAIR(Int_t par)
3626 // To control pair production mechanism.
3627 // par =0 no pair production.
3628 // =1 Pair production. secondaries processed.
3629 // =2 Pair production. No secondaries stored.
3631 fGcphys->ipair = par;
3635 //_____________________________________________________________________________
3636 void TGeant3::SetPFIS(Int_t par)
3639 // To control photo fission mechanism.
3640 // par =0 no photo fission.
3641 // =1 Photo fission. secondaries processed.
3642 // =2 Photo fission. No secondaries stored.
3644 fGcphys->ipfis = par;
3647 //_____________________________________________________________________________
3648 void TGeant3::SetPHOT(Int_t par)
3651 // To control Photo effect.
3652 // par =0 no photo electric effect.
3653 // =1 Photo effect. Electron processed.
3654 // =2 Photo effect. No electron stored.
3656 fGcphys->iphot = par;
3659 //_____________________________________________________________________________
3660 void TGeant3::SetRAYL(Int_t par)
3663 // To control Rayleigh scattering.
3664 // par =0 no Rayleigh scattering.
3667 fGcphys->irayl = par;
3670 //_____________________________________________________________________________
3671 void TGeant3::SetSTRA(Int_t par)
3674 // To control energy loss fluctuations
3675 // with the PhotoAbsorption Ionisation model.
3676 // par =0 no Straggling.
3677 // =1 Straggling yes => no Delta rays.
3679 fGcphlt->istra = par;
3682 //_____________________________________________________________________________
3683 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3687 // val New switch value
3689 // Change one element of array ISWIT(10) in /GCFLAG/
3691 if (sw <= 0 || sw > 10) return;
3692 fGcflag->iswit[sw-1] = val;
3696 //_____________________________________________________________________________
3697 void TGeant3::SetTRIG(Int_t nevents)
3700 // Set number of events to be run
3702 fGcflag->nevent = nevents;
3705 //_____________________________________________________________________________
3706 void TGeant3::SetUserDecay(Int_t pdg)
3709 // Force the decays of particles to be done with Pythia
3710 // and not with the Geant routines.
3711 // just kill pointers doing mzdrop
3713 Int_t ipart = IdFromPDG(pdg);
3715 printf("Particle %d not in geant\n",pdg);
3718 Int_t jpart=fGclink->jpart;
3719 Int_t jpa=fZlq[jpart-ipart];
3722 Int_t jpa1=fZlq[jpa-1];
3724 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3725 Int_t jpa2=fZlq[jpa-2];
3727 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3731 //______________________________________________________________________________
3732 void TGeant3::Vname(const char *name, char *vname)
3735 // convert name to upper case. Make vname at least 4 chars
3737 Int_t l = strlen(name);
3740 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3741 for (i=l;i<4;i++) vname[i] = ' ';
3745 //______________________________________________________________________________
3746 void TGeant3::Ertrgo()
3749 // Perform the tracking of the track Track parameters are in VECT
3754 //______________________________________________________________________________
3755 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3756 const Float_t *x2, const Float_t *p2,
3757 Int_t ipa, Option_t *chopt)
3759 //************************************************************************
3761 //* Perform the tracking of the track from point X1 to *
3763 //* (Before calling this routine the user should also provide *
3764 //* the input informations in /EROPTS/ and /ERTRIO/ *
3765 //* using subroutine EUFIL(L/P/V) *
3766 //* X1 - Starting coordinates (Cartesian) *
3767 //* P1 - Starting 3-momentum (Cartesian) *
3768 //* X2 - Final coordinates (Cartesian) *
3769 //* P2 - Final 3-momentum (Cartesian) *
3770 //* IPA - Particle code (a la GEANT) of the track *
3773 //* 'B' 'Backward tracking' - i.e. energy loss *
3774 //* added to the current energy *
3775 //* 'E' 'Exact' calculation of errors assuming *
3776 //* helix (i.e. pathlength not *
3777 //* assumed as infinitesimal) *
3778 //* 'L' Tracking upto prescribed Lengths reached *
3779 //* 'M' 'Mixed' prediction (not yet coded) *
3780 //* 'O' Tracking 'Only' without calculating errors *
3781 //* 'P' Tracking upto prescribed Planes reached *
3782 //* 'V' Tracking upto prescribed Volumes reached *
3783 //* 'X' Tracking upto prescribed Point approached *
3785 //* Interface with GEANT : *
3786 //* Track parameters are in /CGKINE/ and /GCTRAK/ *
3788 //* ==>Called by : USER *
3789 //* Authors M.Maire, E.Nagy ********//* *
3791 //************************************************************************
3792 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3795 //_____________________________________________________________________________
3796 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3797 Int_t number, Int_t nlevel)
3801 // ******************************************************************
3803 // * Write out the geometry of the detector in EUCLID file format *
3805 // * filnam : will be with the extension .euc *
3806 // * topvol : volume name of the starting node *
3807 // * number : copy number of topvol (relevant for gsposp) *
3808 // * nlevel : number of levels in the tree structure *
3809 // * to be written out, starting from topvol *
3811 // * Author : M. Maire *
3813 // ******************************************************************
3815 // File filnam.tme is written out with the definitions of tracking
3816 // medias and materials.
3817 // As to restore original numbers for materials and medias, program
3818 // searches in the file euc_medi.dat and comparing main parameters of
3819 // the mat. defined inside geant and the one in file recognizes them
3820 // and is able to take number from file. If for any material or medium,
3821 // this procedure fails, ordering starts from 1.
3822 // Arrays IOTMED and IOMATE are used for this procedure
3824 const char kShape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3825 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3827 Int_t i, end, itm, irm, jrm, k, nmed;
3831 char *filext, *filetme;
3832 char natmed[21], namate[21];
3833 char natmedc[21], namatec[21];
3834 char key[5], name[5], mother[5], konly[5];
3836 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3837 Int_t mlevel, numbr, natt, numed, nin, ndata;
3838 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3839 Int_t jdiv, ivin, in, jin, jvin, irot;
3840 Int_t jtm, imat, jma, flag=0, imatc;
3841 Float_t az, dens, radl, absl, a, step, x, y, z;
3842 Int_t npar, ndvmx, left;
3843 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3845 Int_t iomate[100], iotmed[100];
3846 Float_t par[50], att[20], ubuf[50];
3849 Int_t level, ndiv, iaxe;
3850 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3851 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3852 Float_t tmaxf, stemax, deemax, epsil, stmin;
3853 const char *k10000="!\n%s\n!\n";
3854 //Open the input file
3856 for(i=0;i<end;i++) if(filnam[i]=='.') {
3860 filext=new char[end+5];
3861 filetme=new char[end+5];
3862 strncpy(filext,filnam,end);
3863 strncpy(filetme,filnam,end);
3865 // *** The output filnam name will be with extension '.euc'
3866 strcpy(&filext[end],".euc");
3867 strcpy(&filetme[end],".tme");
3868 lun=fopen(filext,"w");
3870 // *** Initialisation of the working space
3871 iadvol=fGcnum->nvolum;
3872 iadtmd=iadvol+fGcnum->nvolum;
3873 iadrot=iadtmd+fGcnum->ntmed;
3874 if(fGclink->jrotm) {
3875 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3879 nwtot=iadrot+fGcnum->nrotm;
3880 qws = new float[nwtot+1];
3881 for (i=0;i<nwtot+1;i++) qws[i]=0;
3884 if(nlevel==0) mlevel=20;
3886 // *** find the top volume and put it in the stak
3887 numbr = number>0 ? number : 1;
3888 Gfpara(topvol,numbr,1,npar,natt,par,att);
3890 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3895 // *** authorized shape ?
3896 strncpy((char *)&iname, topvol, 4);
3898 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3902 jvo = fZlq[fGclink->jvolum-ivo];
3903 ish = Int_t (fZq[jvo+2]);
3905 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3912 iws[iadvol+ivo] = level;
3915 //*** flag all volumes and fill the stak
3919 // pick the next volume in stak
3921 ivo = TMath::Abs(iws[ivstak]);
3922 jvo = fZlq[fGclink->jvolum - ivo];
3924 // flag the tracking medium
3925 numed = Int_t (fZq[jvo + 4]);
3926 iws[iadtmd + numed] = 1;
3928 // get the daughters ...
3929 level = iws[iadvol+ivo];
3930 if (level < mlevel) {
3932 nin = Int_t (fZq[jvo + 3]);
3934 // from division ...
3936 jdiv = fZlq[jvo - 1];
3937 ivin = Int_t (fZq[jdiv + 2]);
3939 iws[nvstak] = -ivin;
3940 iws[iadvol+ivin] = level;
3942 // from position ...
3943 } else if (nin > 0) {
3944 for(in=1; in<=nin; in++) {
3945 jin = fZlq[jvo - in];
3946 ivin = Int_t (fZq[jin + 2 ]);
3947 jvin = fZlq[fGclink->jvolum - ivin];
3948 ish = Int_t (fZq[jvin + 2]);
3949 // authorized shape ?
3951 // not yet flagged ?
3952 if (iws[iadvol+ivin]==0) {
3955 iws[iadvol+ivin] = level;
3957 // flag the rotation matrix
3958 irot = Int_t ( fZq[jin + 4 ]);
3959 if (irot > 0) iws[iadrot+irot] = 1;
3965 // next volume in stak ?
3966 if (ivstak < nvstak) goto L10;
3968 // *** restore original material and media numbers
3969 // file euc_medi.dat is needed to compare materials and medias
3971 FILE* luncor=fopen("euc_medi.dat","r");
3974 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3975 if (iws[iadtmd+itm] > 0) {
3976 jtm = fZlq[fGclink->jtmed-itm];
3977 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3978 imat = Int_t (fZq[jtm+6]);
3979 jma = fZlq[fGclink->jmate-imat];
3981 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3984 strncpy(namate,(char *)&fZiq[jma+1],20);
3987 //** find the material original number
3990 iret=fscanf(luncor,"%4s,%130s",key,card);
3991 if(iret<=0) goto L26;
3993 if(!strcmp(key,"MATE")) {
3994 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3995 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3996 if(!strcmp(namatec,namate)) {
3997 if(az==a && zc==z && densc==dens && radlc==radl
3998 && abslc==absl && nparc==nparc) {
4001 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
4003 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
4007 if(strcmp(key,"END") && !flag) goto L23;
4009 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
4013 //*** restore original tracking medium number
4016 iret=fscanf(luncor,"%4s,%130s",key,card);
4017 if(iret<=0) goto L26;
4019 if (!strcmp(key,"TMED")) {
4020 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
4021 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
4022 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
4023 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
4024 epsil,stmin,ubuf,&nwbuf);
4025 if(!strcmp(natmedc,natmed)) {
4026 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
4029 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
4032 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
4036 if(strcmp(key,"END") && !flag) goto L24;
4038 printf("cannot restore original number for medium : %s\n",natmed);
4046 L26: printf("*** GWEUCL *** cannot read the data file\n");
4048 L29: if(luncor) fclose (luncor);
4051 // *** write down the tracking medium definition
4053 strcpy(card,"! Tracking medium");
4054 fprintf(lun,k10000,card);
4056 for(itm=1;itm<=fGcnum->ntmed;itm++) {
4057 if (iws[iadtmd+itm]>0) {
4058 jtm = fZlq[fGclink->jtmed-itm];
4059 strncpy(natmed,(char *)&fZiq[jtm+1],20);
4061 imat = Int_t (fZq[jtm+6]);
4062 jma = fZlq[fGclink->jmate-imat];
4063 //* order media from one, if comparing with database failed
4065 iotmed[itm]=++imxtmed;
4066 iomate[imat]=++imxmate;
4071 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
4074 strncpy(namate,(char *)&fZiq[jma+1],20);
4077 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
4081 //* *** write down the rotation matrix
4083 strcpy(card,"! Reperes");
4084 fprintf(lun,k10000,card);
4086 for(irm=1;irm<=fGcnum->nrotm;irm++) {
4087 if (iws[iadrot+irm]>0) {
4088 jrm = fZlq[fGclink->jrotm-irm];
4089 fprintf(lun,"ROTM %3d",irm);
4090 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
4095 //* *** write down the volume definition
4097 strcpy(card,"! Volumes");
4098 fprintf(lun,k10000,card);
4100 for(ivstak=1;ivstak<=nvstak;ivstak++) {
4103 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
4105 jvo = fZlq[fGclink->jvolum-ivo];
4106 ish = Int_t (fZq[jvo+2]);
4107 nmed = Int_t (fZq[jvo+4]);
4108 npar = Int_t (fZq[jvo+5]);
4110 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
4111 Gckpar (ish,npar,par);
4112 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],iotmed[nmed],npar);
4113 for(i=0;i<(npar-1)/6+1;i++) {
4116 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
4120 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],iotmed[nmed],npar);
4125 //* *** write down the division of volumes
4127 fprintf(lun,k10000,"! Divisions");
4128 for(ivstak=1;ivstak<=nvstak;ivstak++) {
4129 ivo = TMath::Abs(iws[ivstak]);
4130 jvo = fZlq[fGclink->jvolum-ivo];
4131 ish = Int_t (fZq[jvo+2]);
4132 nin = Int_t (fZq[jvo+3]);
4133 //* this volume is divided ...
4136 iaxe = Int_t ( fZq[jdiv+1]);
4137 ivin = Int_t ( fZq[jdiv+2]);
4138 ndiv = Int_t ( fZq[jdiv+3]);
4141 jvin = fZlq[fGclink->jvolum-ivin];
4142 nmed = Int_t ( fZq[jvin+4]);
4143 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
4145 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
4147 if ((step<=0.)||(ish>=11)) {
4148 //* volume with negative parameter or gsposp or pgon ...
4149 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
4150 } else if ((ndiv<=0)||(ish==10)) {
4151 //* volume with negative parameter or gsposp or para ...
4152 ndvmx = TMath::Abs(ndiv);
4153 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
4154 name,mother,step,iaxe,iotmed[nmed],ndvmx);
4156 //* normal volume : all kind of division are equivalent
4157 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
4158 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
4163 //* *** write down the the positionnement of volumes
4165 fprintf(lun,k10000,"! Positionnements\n");
4167 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
4168 ivo = TMath::Abs(iws[ivstak]);
4169 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
4171 jvo = fZlq[fGclink->jvolum-ivo];
4172 nin = Int_t( fZq[jvo+3]);
4173 //* this volume has daughters ...
4175 for (in=1;in<=nin;in++) {
4177 ivin = Int_t (fZq[jin +2]);
4178 numb = Int_t (fZq[jin +3]);
4179 irot = Int_t (fZq[jin +4]);
4183 strcpy(konly,"ONLY");
4184 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
4185 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
4187 jvin = fZlq[fGclink->jvolum-ivin];
4188 ish = Int_t (fZq[jvin+2]);
4189 //* gspos or gsposp ?
4190 ndata = fZiq[jin-1];
4192 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
4193 name,numb,mother,x,y,z,irot,konly);
4195 npar = Int_t (fZq[jin+9]);
4196 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
4197 Gckpar (ish,npar,par);
4198 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
4199 name,numb,mother,x,y,z,irot,konly,npar);
4201 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4208 fprintf(lun,"END\n");
4211 //****** write down the materials and medias *****
4213 lun=fopen(filetme,"w");
4215 for(itm=1;itm<=fGcnum->ntmed;itm++) {
4216 if (iws[iadtmd+itm]>0) {
4217 jtm = fZlq[fGclink->jtmed-itm];
4218 strncpy(natmed,(char*)&fZiq[jtm+1],4);
4219 imat = Int_t (fZq[jtm+6]);
4220 jma = Int_t (fZlq[fGclink->jmate-imat]);
4222 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
4223 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
4224 iomate[imat],namate,a,z,dens,radl,absl,npar);
4228 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4232 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
4233 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
4234 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
4235 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
4239 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4245 fprintf(lun,"END\n");
4247 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
4248 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
4257 //_____________________________________________________________________________
4258 void TGeant3::Streamer(TBuffer &R__b)
4261 // Stream an object of class TGeant3.
4263 if (R__b.IsReading()) {
4264 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
4265 AliMC::Streamer(R__b);
4268 R__b.ReadStaticArray(fPDGCode);
4270 R__b.WriteVersion(TGeant3::IsA());
4271 AliMC::Streamer(R__b);
4274 R__b.WriteArray(fPDGCode, fNPDGCodes);