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.31 2000/07/13 16:19:10 fca
19 Mainly coding conventions + some small bug fixes
21 Revision 1.30 2000/07/12 08:56:30 fca
22 Coding convention correction and warning removal
24 Revision 1.29 2000/07/11 18:24:59 fca
25 Coding convention corrections + few minor bug fixes
27 Revision 1.28 2000/06/29 10:51:55 morsch
28 Add some charmed and bottom baryons to the particle list (TDatabasePDG). This
29 is needed by Hijing. Should be part of a future review of TDatabasePDG.
31 Revision 1.27 2000/06/21 17:40:15 fca
32 Adding possibility to set ISTRA, PAI model
34 Revision 1.26 2000/05/16 13:10:41 fca
35 New method IsNewTrack and fix for a problem in Father-Daughter relations
37 Revision 1.25 2000/04/07 11:12:35 fca
38 G4 compatibility changes
40 Revision 1.24 2000/02/28 21:03:57 fca
41 Some additions to improve the compatibility with G4
43 Revision 1.23 2000/02/23 16:25:25 fca
44 AliVMC and AliGeant3 classes introduced
45 ReadEuclid moved from AliRun to AliModule
47 Revision 1.22 2000/01/18 15:40:13 morsch
48 Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
49 Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
51 Revision 1.21 2000/01/17 19:41:17 fca
54 Revision 1.20 2000/01/12 11:29:27 fca
57 Revision 1.19 1999/12/17 09:03:12 fca
58 Introduce a names array
60 Revision 1.18 1999/11/26 16:55:39 fca
61 Reimplement CurrentVolName() to avoid memory leaks
63 Revision 1.17 1999/11/03 16:58:28 fca
64 Correct source of address violation in creating character string
66 Revision 1.16 1999/11/03 13:17:08 fca
67 Have ProdProcess return const char*
69 Revision 1.15 1999/10/26 06:04:50 fca
70 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
72 Revision 1.14 1999/09/29 09:24:30 fca
73 Introduction of the Copyright and cvs Log
77 ///////////////////////////////////////////////////////////////////////////////
79 // Interface Class to the Geant3.21 MonteCarlo //
83 <img src="picts/TGeant3Class.gif">
88 ///////////////////////////////////////////////////////////////////////////////
94 #include <TDatabasePDG.h>
95 #include "AliCallf77.h"
98 # define gzebra gzebra_
99 # define grfile grfile_
100 # define gpcxyz gpcxyz_
101 # define ggclos ggclos_
102 # define glast glast_
103 # define ginit ginit_
104 # define gcinit gcinit_
106 # define gtrig gtrig_
107 # define gtrigc gtrigc_
108 # define gtrigi gtrigi_
109 # define gwork gwork_
110 # define gzinit gzinit_
111 # define gfmate gfmate_
112 # define gfpart gfpart_
113 # define gftmed gftmed_
114 # define gftmat gftmat_
115 # define gmate gmate_
116 # define gpart gpart_
118 # define gsmate gsmate_
119 # define gsmixt gsmixt_
120 # define gspart gspart_
121 # define gstmed gstmed_
122 # define gsckov gsckov_
123 # define gstpar gstpar_
124 # define gfkine gfkine_
125 # define gfvert gfvert_
126 # define gskine gskine_
127 # define gsvert gsvert_
128 # define gphysi gphysi_
129 # define gdebug gdebug_
130 # define gekbin gekbin_
131 # define gfinds gfinds_
132 # define gsking gsking_
133 # define gskpho gskpho_
134 # define gsstak gsstak_
135 # define gsxyz gsxyz_
136 # define gtrack gtrack_
137 # define gtreve gtreve_
138 # define gtreveroot gtreveroot_
139 # define grndm grndm_
140 # define grndmq grndmq_
141 # define gdtom gdtom_
142 # define glmoth glmoth_
143 # define gmedia gmedia_
144 # define gmtod gmtod_
145 # define gsdvn gsdvn_
146 # define gsdvn2 gsdvn2_
147 # define gsdvs gsdvs_
148 # define gsdvs2 gsdvs2_
149 # define gsdvt gsdvt_
150 # define gsdvt2 gsdvt2_
151 # define gsord gsord_
152 # define gspos gspos_
153 # define gsposp gsposp_
154 # define gsrotm gsrotm_
155 # define gprotm gprotm_
156 # define gsvolu gsvolu_
157 # define gprint gprint_
158 # define gdinit gdinit_
159 # define gdopt gdopt_
160 # define gdraw gdraw_
161 # define gdrayt gdrayt_
162 # define gdrawc gdrawc_
163 # define gdrawx gdrawx_
164 # define gdhead gdhead_
165 # define gdwmn1 gdwmn1_
166 # define gdwmn2 gdwmn2_
167 # define gdwmn3 gdwmn3_
168 # define gdxyz gdxyz_
169 # define gdcxyz gdcxyz_
170 # define gdman gdman_
171 # define gdspec gdspec_
172 # define gdtree gdtree_
173 # define gdelet gdelet_
174 # define gdclos gdclos_
175 # define gdshow gdshow_
176 # define gdopen gdopen_
177 # define dzshow dzshow_
178 # define gsatt gsatt_
179 # define gfpara gfpara_
180 # define gckpar gckpar_
181 # define gckmat gckmat_
182 # define geditv geditv_
183 # define mzdrop mzdrop_
185 # define ertrak ertrak_
186 # define ertrgo ertrgo_
188 # define setbomb setbomb_
189 # define setclip setclip_
190 # define gcomad gcomad_
192 # define gbrelm gbrelm_
193 # define gprelm gprelm_
195 # define gzebra GZEBRA
196 # define grfile GRFILE
197 # define gpcxyz GPCXYZ
198 # define ggclos GGCLOS
201 # define gcinit GCINIT
204 # define gtrigc GTRIGC
205 # define gtrigi GTRIGI
207 # define gzinit GZINIT
208 # define gfmate GFMATE
209 # define gfpart GFPART
210 # define gftmed GFTMED
211 # define gftmat GFTMAT
215 # define gsmate GSMATE
216 # define gsmixt GSMIXT
217 # define gspart GSPART
218 # define gstmed GSTMED
219 # define gsckov GSCKOV
220 # define gstpar GSTPAR
221 # define gfkine GFKINE
222 # define gfvert GFVERT
223 # define gskine GSKINE
224 # define gsvert GSVERT
225 # define gphysi GPHYSI
226 # define gdebug GDEBUG
227 # define gekbin GEKBIN
228 # define gfinds GFINDS
229 # define gsking GSKING
230 # define gskpho GSKPHO
231 # define gsstak GSSTAK
233 # define gtrack GTRACK
234 # define gtreve GTREVE
235 # define gtreveroot GTREVEROOT
237 # define grndmq GRNDMQ
239 # define glmoth GLMOTH
240 # define gmedia GMEDIA
243 # define gsdvn2 GSDVN2
245 # define gsdvs2 GSDVS2
247 # define gsdvt2 GSDVT2
250 # define gsposp GSPOSP
251 # define gsrotm GSROTM
252 # define gprotm GPROTM
253 # define gsvolu GSVOLU
254 # define gprint GPRINT
255 # define gdinit GDINIT
258 # define gdrayt GDRAYT
259 # define gdrawc GDRAWC
260 # define gdrawx GDRAWX
261 # define gdhead GDHEAD
262 # define gdwmn1 GDWMN1
263 # define gdwmn2 GDWMN2
264 # define gdwmn3 GDWMN3
266 # define gdcxyz GDCXYZ
268 # define gdfspc GDFSPC
269 # define gdspec GDSPEC
270 # define gdtree GDTREE
271 # define gdelet GDELET
272 # define gdclos GDCLOS
273 # define gdshow GDSHOW
274 # define gdopen GDOPEN
275 # define dzshow DZSHOW
277 # define gfpara GFPARA
278 # define gckpar GCKPAR
279 # define gckmat GCKMAT
280 # define geditv GEDITV
281 # define mzdrop MZDROP
283 # define ertrak ERTRAK
284 # define ertrgo ERTRGO
286 # define setbomb SETBOMB
287 # define setclip SETCLIP
288 # define gcomad GCOMAD
290 # define gbrelm GBRELM
291 # define gprelm GPRELM
295 //____________________________________________________________________________
299 // Prototypes for GEANT functions
301 void type_of_call gzebra(const int&);
303 void type_of_call gpcxyz();
305 void type_of_call ggclos();
307 void type_of_call glast();
309 void type_of_call ginit();
311 void type_of_call gcinit();
313 void type_of_call grun();
315 void type_of_call gtrig();
317 void type_of_call gtrigc();
319 void type_of_call gtrigi();
321 void type_of_call gwork(const int&);
323 void type_of_call gzinit();
325 void type_of_call gmate();
327 void type_of_call gpart();
329 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
331 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
332 Int_t &, Float_t *, Int_t &);
334 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
335 Float_t &, Float_t *, Int_t &);
337 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
340 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
343 void type_of_call gphysi();
345 void type_of_call gdebug();
347 void type_of_call gekbin();
349 void type_of_call gfinds();
351 void type_of_call gsking(Int_t &);
353 void type_of_call gskpho(Int_t &);
355 void type_of_call gsstak(Int_t &);
357 void type_of_call gsxyz();
359 void type_of_call gtrack();
361 void type_of_call gtreve();
363 void type_of_call gtreveroot();
365 void type_of_call grndm(Float_t *, const Int_t &);
367 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
370 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
372 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
373 Int_t *, Int_t * DEFCHARL);
375 void type_of_call gmedia(Float_t *, Int_t &);
377 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
379 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
380 const Float_t &, const Float_t &, const Float_t &,
383 void type_of_call gprotm(const Int_t &);
385 void type_of_call grfile(const Int_t&, DEFCHARD,
386 DEFCHARD DEFCHARL DEFCHARL);
388 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
389 Float_t &, Float_t &, Float_t &, Float_t *,
392 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
393 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
395 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
396 Float_t &, Float_t &, Float_t &, Float_t &,
397 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
399 void type_of_call gftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
401 ,Float_t *, Int_t & DEFCHARL);
403 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
404 Float_t &, Float_t &, Float_t &, Float_t *,
407 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
408 Float_t &, Int_t &, Float_t * DEFCHARL);
410 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
411 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
414 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
415 Float_t &, Float_t &, Float_t &, Float_t &,
416 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
418 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
419 Float_t *absco, Float_t *effic, Float_t *rindex);
420 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
422 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
425 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
426 Int_t & DEFCHARL DEFCHARL);
428 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
431 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
432 Int_t & DEFCHARL DEFCHARL);
434 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
435 Int_t & DEFCHARL DEFCHARL);
437 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
438 Int_t &, Int_t & DEFCHARL DEFCHARL);
440 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
442 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
443 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
446 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
447 Float_t &, Int_t &, DEFCHARD,
448 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
450 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
451 Int_t & DEFCHARL DEFCHARL);
453 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
455 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
458 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
460 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
462 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
464 void type_of_call gdinit();
466 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
468 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
469 Float_t &, Float_t &, Float_t & DEFCHARL);
470 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
471 Float_t &, Float_t &, Float_t & DEFCHARL);
472 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
473 Float_t &, Float_t & DEFCHARL);
474 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
475 Float_t &, Float_t &, Float_t &, Float_t &,
477 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
478 void type_of_call gdxyz(Int_t &);
479 void type_of_call gdcxyz();
480 void type_of_call gdman(Float_t &, Float_t &);
481 void type_of_call gdwmn1(Float_t &, Float_t &);
482 void type_of_call gdwmn2(Float_t &, Float_t &);
483 void type_of_call gdwmn3(Float_t &, Float_t &);
484 void type_of_call gdspec(DEFCHARD DEFCHARL);
485 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
486 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
488 void type_of_call gdopen(Int_t &);
489 void type_of_call gdclos();
490 void type_of_call gdelet(Int_t &);
491 void type_of_call gdshow(Int_t &);
492 void type_of_call geditv(Int_t &) {;}
495 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
496 const int&, const int&, const int& DEFCHARL
499 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
501 void type_of_call setbomb(Float_t &);
502 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
503 Float_t &, Float_t & DEFCHARL);
504 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
506 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
507 const Float_t *x2, const Float_t *p2,
508 const Int_t &ipa, DEFCHARD DEFCHARL);
510 void type_of_call ertrgo();
512 float type_of_call gbrelm(const Float_t &z, const Float_t& t, const Float_t& cut);
513 float type_of_call gprelm(const Float_t &z, const Float_t& t, const Float_t& cut);
517 // Geant3 global pointer
519 static const Int_t kDefSize = 600;
523 //____________________________________________________________________________
527 // Default constructor
531 //____________________________________________________________________________
532 TGeant3::TGeant3(const char *title, Int_t nwgeant)
533 :AliMC("TGeant3",title)
536 // Standard constructor for TGeant3 with ZEBRA initialisation
547 // Load Address of Geant3 commons
550 // Zero number of particles
554 //____________________________________________________________________________
555 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
556 Float_t &radl, Float_t &absl) const
559 // Return the parameters of the current material during transport
563 dens = fGcmate->dens;
564 radl = fGcmate->radl;
565 absl = fGcmate->absl;
566 return 1; //this could be the number of elements in mixture
569 //____________________________________________________________________________
570 void TGeant3::DefaultRange()
573 // Set range of current drawing pad to 20x20 cm
579 gHigz->Range(0,0,20,20);
582 //____________________________________________________________________________
583 void TGeant3::InitHIGZ()
594 //____________________________________________________________________________
595 void TGeant3::LoadAddress()
598 // Assigns the address of the GEANT common blocks to the structures
599 // that allow their access from C++
602 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
603 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
604 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
605 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
606 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
607 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
608 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
609 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
610 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
611 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
612 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
613 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
614 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
615 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
616 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
617 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
618 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
619 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
620 gcomad(PASSCHARD("GCPHLT"),(int*&) fGcphlt PASSCHARL("GCPHLT"));
621 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
622 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
623 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
626 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
627 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
628 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
629 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
631 // Variables for ZEBRA store
632 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
634 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
639 //_____________________________________________________________________________
640 void TGeant3::GeomIter()
643 // Geometry iterator for moving upward in the geometry tree
644 // Initialise the iterator
646 fNextVol=fGcvolu->nlevel;
649 //____________________________________________________________________________
650 void TGeant3::FinishGeometry()
652 //Close the geometry structure
656 //____________________________________________________________________________
657 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
660 // Geometry iterator for moving upward in the geometry tree
661 // Return next volume up
666 gname=fGcvolu->names[fNextVol];
667 copy=fGcvolu->number[fNextVol];
668 i=fGcvolu->lvolum[fNextVol];
669 name = fVolNames[i-1];
670 if(gname == fZiq[fGclink->jvolum+i]) return i;
671 else printf("GeomTree: Volume %s not found in bank\n",name);
676 //_____________________________________________________________________________
677 void TGeant3::BuildPhysics()
682 //_____________________________________________________________________________
683 Int_t TGeant3::CurrentVolID(Int_t ©) const
686 // Returns the current volume ID and copy number
689 if( (i=fGcvolu->nlevel-1) < 0 ) {
690 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
692 gname=fGcvolu->names[i];
693 copy=fGcvolu->number[i];
694 i=fGcvolu->lvolum[i];
695 if(gname == fZiq[fGclink->jvolum+i]) return i;
696 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
701 //_____________________________________________________________________________
702 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
705 // Return the current volume "off" upward in the geometrical tree
706 // ID and copy number
709 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
710 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
711 off,fGcvolu->nlevel);
713 gname=fGcvolu->names[i];
714 copy=fGcvolu->number[i];
715 i=fGcvolu->lvolum[i];
716 if(gname == fZiq[fGclink->jvolum+i]) return i;
717 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
722 //_____________________________________________________________________________
723 const char* TGeant3::CurrentVolName() const
726 // Returns the current volume name
729 if( (i=fGcvolu->nlevel-1) < 0 ) {
730 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
732 gname=fGcvolu->names[i];
733 i=fGcvolu->lvolum[i];
734 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
735 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
740 //_____________________________________________________________________________
741 const char* TGeant3::CurrentVolOffName(Int_t off) const
744 // Return the current volume "off" upward in the geometrical tree
745 // ID, name and copy number
746 // if name=0 no name is returned
749 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
750 Warning("CurrentVolOffName",
751 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
753 gname=fGcvolu->names[i];
754 i=fGcvolu->lvolum[i];
755 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
756 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
761 //_____________________________________________________________________________
762 Int_t TGeant3::IdFromPDG(Int_t pdg) const
765 // Return Geant3 code from PDG and pseudo ENDF code
767 for(Int_t i=0;i<fNPDGCodes;++i)
768 if(pdg==fPDGCode[i]) return i;
772 //_____________________________________________________________________________
773 Int_t TGeant3::PDGFromId(Int_t id) const
776 // Return PDG code and pseudo ENDF code from Geant3 code
778 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
782 //_____________________________________________________________________________
783 void TGeant3::DefineParticles()
786 // Define standard Geant 3 particles
789 // Load standard numbers for GEANT particles and PDG conversion
790 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
791 fPDGCode[fNPDGCodes++]=22; // 1 = photon
792 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
793 fPDGCode[fNPDGCodes++]=11; // 3 = electron
794 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
795 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
796 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
797 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
798 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
799 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
800 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
801 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
802 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
803 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
804 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
805 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
806 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
807 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
808 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
809 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
810 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
811 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
812 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
813 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
814 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
815 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
816 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
817 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
818 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
819 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
820 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
821 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
822 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
829 /* --- Define additional particles */
830 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
831 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
833 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
834 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
836 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
837 fPDGCode[fNPDGCodes++]=411; // 35 = D+
839 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
840 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
842 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
843 fPDGCode[fNPDGCodes++]=421; // 37 = D0
845 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
846 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
848 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
850 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
852 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
854 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
855 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
857 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
858 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
860 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
861 fPDGCode[fNPDGCodes++]=113; // 37 = D0
864 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
866 // and numbers above 5 000 000 for special applications
869 const Int_t kion=10000000;
871 const Int_t kspe=50000000;
873 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
875 const Double_t kAu2Gev=0.9314943228;
876 const Double_t khSlash = 1.0545726663e-27;
877 const Double_t kErg2Gev = 1/1.6021773349e-3;
878 const Double_t khShGev = khSlash*kErg2Gev;
879 const Double_t kYear2Sec = 3600*24*365.25;
882 // mass and life-time from PDG
883 pdgDB->AddParticle("B(s)*0","B(s)*0",
884 5.4163, kTRUE, 0.047, +0.,"Meson", 533);
886 pdgDB->AddParticle("B(s)*0 bar","B(s)*0 bar",
887 5.4163, kTRUE, 0.047, -0.,"Meson", -533);
891 // value for mass used by Hijing
892 pdgDB->AddParticle("Sigma(c)*+","Sigma(c)*+",
893 2.4536, kTRUE, -1., +1.,"Baryon", 4214);
895 pdgDB->AddParticle("Sigma(c)*-","Sigma(c)*-",
896 2.4536, kTRUE, -1., -1.,"Baryon", -4214);
897 // equivalent to 4312 ? Hijing uses m=2.55
898 pdgDB->AddParticle("Xsi(c)0","Xsi(c)0",
899 2.4703, kTRUE, -1., +0.,"Baryon", 4132);
901 pdgDB->AddParticle("Xsi(c)0 bar","Xsi(c)0 bar",
902 2.4703, kTRUE, -1., -0.,"Baryon", -4132);
903 // equivalent to 4322 ? Hijing uses m=2.55
904 pdgDB->AddParticle("Xi(c)+","Xi(c)+",
905 2.4656, kFALSE, -1., +1.,"Baryon", 4232);
907 pdgDB->AddParticle("Xi(c)-","Xi(c)-",
908 2.4656, kFALSE, -1., -1.,"Baryon", -4232);
909 // mass values from Hijing
911 pdgDB->AddParticle("Xsi(c)*0","Xsi(c)*0",
912 2.63, kTRUE, -1., +0.,"Baryon", 4314);
914 pdgDB->AddParticle("Xsi(c)*0 bar","Xsi(c)*0 bar",
915 2.63, kTRUE, -1., -0.,"Baryon", -4314);
917 pdgDB->AddParticle("Xsi(c)*+","Xsi(c)*+",
918 2.63, kTRUE, -1., +1.,"Baryon", 4324);
920 pdgDB->AddParticle("Xsi(c)*-","Xsi(c)*-",
921 2.63, kTRUE, -1., -1.,"Baryon", -4324);
923 // pdg mass value, Hijing uses m=2.73.
924 pdgDB->AddParticle("Omega(c)0","Omega(c)0",
925 2.7040, kFALSE, khShGev/0.064e-12, +0.,"Baryon", 4332);
927 pdgDB->AddParticle("Omega(c)0 bar","Omega(c)0 bar",
928 2.7040, kFALSE, khShGev/0.064e-12, -0.,"Baryon", -4332);
929 // mass value from Hijing
930 pdgDB->AddParticle("Omega(c)*0","Omega(c)*0",
931 2.8000, kFALSE, -1., +0.,"Baryon", 4334);
933 pdgDB->AddParticle("Omega(c)*0 bar","Omega(c)*0",
934 2.8000, kFALSE, -1., -0.,"Baryon", -4334);
938 // mass value from Hijing
939 pdgDB->AddParticle("Sigma(b)*+","Sigma(b)*+",
940 5.8100, kFALSE, -1., +1.,"Baryon", 5224);
942 pdgDB->AddParticle("Sigma(b)*-","Sigma(b)*-",
943 5.8100, kFALSE, -1., -1.,"Baryon", -5224);
947 pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
948 0,1,"Ion",kion+10020);
949 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
951 pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
952 khShGev/(12.33*kYear2Sec),1,"Ion",kion+10030);
953 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
955 pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
956 khShGev/(12.33*kYear2Sec),2,"Ion",kion+20040);
957 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
959 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
961 pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
962 0,2,"Ion",kion+20030);
963 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
965 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
966 0,0,"Special",kspe+50);
967 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
969 Gspart(51, "FeedbackPhoton", 7, 0., 0.,1.e20 );
970 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
971 0,0,"Special",kspe+51);
972 fPDGCode[fNPDGCodes++]=kspe+51; // 51 = FeedbackPhoton
974 /* --- Define additional decay modes --- */
975 /* --- omega(783) --- */
976 for (kz = 0; kz < 6; ++kz) {
987 Gsdk(ipa, bratio, mode);
988 /* --- phi(1020) --- */
989 for (kz = 0; kz < 6; ++kz) {
1004 Gsdk(ipa, bratio, mode);
1006 for (kz = 0; kz < 6; ++kz) {
1019 Gsdk(ipa, bratio, mode);
1021 for (kz = 0; kz < 6; ++kz) {
1034 Gsdk(ipa, bratio, mode);
1036 for (kz = 0; kz < 6; ++kz) {
1047 Gsdk(ipa, bratio, mode);
1048 /* --- Anti D0 --- */
1049 for (kz = 0; kz < 6; ++kz) {
1060 Gsdk(ipa, bratio, mode);
1062 for (kz = 0; kz < 6; ++kz) {
1069 Gsdk(ipa, bratio, mode);
1071 for (kz = 0; kz < 6; ++kz) {
1078 Gsdk(ipa, bratio, mode);
1080 for (kz = 0; kz < 6; ++kz) {
1087 Gsdk(ipa, bratio, mode);
1090 for (kz = 0; kz < 6; ++kz) {
1099 Gsdk(ipa, bratio, mode);
1102 Gsdk(ipa, bratio, mode);
1105 Gsdk(ipa, bratio, mode);
1110 //_____________________________________________________________________________
1111 Int_t TGeant3::VolId(const Text_t *name) const
1114 // Return the unique numeric identifier for volume name
1117 strncpy((char *) &gname, name, 4);
1118 for(i=1; i<=fGcnum->nvolum; i++)
1119 if(gname == fZiq[fGclink->jvolum+i]) return i;
1120 printf("VolId: Volume %s not found\n",name);
1124 //_____________________________________________________________________________
1125 Int_t TGeant3::NofVolumes() const
1128 // Return total number of volumes in the geometry
1130 return fGcnum->nvolum;
1133 //_____________________________________________________________________________
1134 const char* TGeant3::VolName(Int_t id) const
1137 // Return the volume name given the volume identifier
1139 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1140 return fVolNames[fGcnum->nvolum];
1142 return fVolNames[id-1];
1145 //_____________________________________________________________________________
1146 void TGeant3::SetCut(const char* cutName, Float_t cutValue)
1149 // Set transport cuts for particles
1151 if(!strcmp(cutName,"CUTGAM"))
1152 fGccuts->cutgam=cutValue;
1153 else if(!strcmp(cutName,"CUTGAM"))
1154 fGccuts->cutele=cutValue;
1155 else if(!strcmp(cutName,"CUTELE"))
1156 fGccuts->cutneu=cutValue;
1157 else if(!strcmp(cutName,"CUTHAD"))
1158 fGccuts->cuthad=cutValue;
1159 else if(!strcmp(cutName,"CUTMUO"))
1160 fGccuts->cutmuo=cutValue;
1161 else if(!strcmp(cutName,"BCUTE"))
1162 fGccuts->bcute=cutValue;
1163 else if(!strcmp(cutName,"BCUTM"))
1164 fGccuts->bcutm=cutValue;
1165 else if(!strcmp(cutName,"DCUTE"))
1166 fGccuts->dcute=cutValue;
1167 else if(!strcmp(cutName,"DCUTM"))
1168 fGccuts->dcutm=cutValue;
1169 else if(!strcmp(cutName,"PPCUTM"))
1170 fGccuts->ppcutm=cutValue;
1171 else if(!strcmp(cutName,"TOFMAX"))
1172 fGccuts->tofmax=cutValue;
1173 else Warning("SetCut","Cut %s not implemented\n",cutName);
1176 //_____________________________________________________________________________
1177 void TGeant3::SetProcess(const char* flagName, Int_t flagValue)
1180 // Set thresholds for different processes
1182 if(!strcmp(flagName,"PAIR"))
1183 fGcphys->ipair=flagValue;
1184 else if(!strcmp(flagName,"COMP"))
1185 fGcphys->icomp=flagValue;
1186 else if(!strcmp(flagName,"PHOT"))
1187 fGcphys->iphot=flagValue;
1188 else if(!strcmp(flagName,"PFIS"))
1189 fGcphys->ipfis=flagValue;
1190 else if(!strcmp(flagName,"DRAY"))
1191 fGcphys->idray=flagValue;
1192 else if(!strcmp(flagName,"ANNI"))
1193 fGcphys->ianni=flagValue;
1194 else if(!strcmp(flagName,"BREM"))
1195 fGcphys->ibrem=flagValue;
1196 else if(!strcmp(flagName,"HADR"))
1197 fGcphys->ihadr=flagValue;
1198 else if(!strcmp(flagName,"MUNU"))
1199 fGcphys->imunu=flagValue;
1200 else if(!strcmp(flagName,"DCAY"))
1201 fGcphys->idcay=flagValue;
1202 else if(!strcmp(flagName,"LOSS"))
1203 fGcphys->iloss=flagValue;
1204 else if(!strcmp(flagName,"MULS"))
1205 fGcphys->imuls=flagValue;
1206 else if(!strcmp(flagName,"RAYL"))
1207 fGcphys->irayl=flagValue;
1208 else if(!strcmp(flagName,"STRA"))
1209 fGcphlt->istra=flagValue;
1210 else if(!strcmp(flagName,"SYNC"))
1211 fGcphlt->isync=flagValue;
1212 else Warning("SetFlag","Flag %s not implemented\n",flagName);
1215 //_____________________________________________________________________________
1216 Float_t TGeant3::Xsec(char* reac, Float_t /* energy */,
1217 Int_t part, Int_t /* mate */)
1220 // Calculate X-sections -- dummy for the moment
1222 if(!strcmp(reac,"PHOT"))
1225 Error("Xsec","Can calculate photoelectric only for photons\n");
1231 //_____________________________________________________________________________
1232 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1235 // Return the current position in the master reference frame of the
1236 // track being transported
1238 xyz[0]=fGctrak->vect[0];
1239 xyz[1]=fGctrak->vect[1];
1240 xyz[2]=fGctrak->vect[2];
1241 xyz[3]=fGctrak->tofg;
1244 //_____________________________________________________________________________
1245 Float_t TGeant3::TrackTime() const
1248 // Return the current time of flight of the track being transported
1250 return fGctrak->tofg;
1253 //_____________________________________________________________________________
1254 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1257 // Return the direction and the momentum (GeV/c) of the track
1258 // currently being transported
1260 Double_t ptot=fGctrak->vect[6];
1261 xyz[0]=fGctrak->vect[3]*ptot;
1262 xyz[1]=fGctrak->vect[4]*ptot;
1263 xyz[2]=fGctrak->vect[5]*ptot;
1264 xyz[3]=fGctrak->getot;
1267 //_____________________________________________________________________________
1268 Float_t TGeant3::TrackCharge() const
1271 // Return charge of the track currently transported
1273 return fGckine->charge;
1276 //_____________________________________________________________________________
1277 Float_t TGeant3::TrackMass() const
1280 // Return the mass of the track currently transported
1282 return fGckine->amass;
1285 //_____________________________________________________________________________
1286 Int_t TGeant3::TrackPid() const
1289 // Return the id of the particle transported
1291 return PDGFromId(fGckine->ipart);
1294 //_____________________________________________________________________________
1295 Float_t TGeant3::TrackStep() const
1298 // Return the length in centimeters of the current step
1300 return fGctrak->step;
1303 //_____________________________________________________________________________
1304 Float_t TGeant3::TrackLength() const
1307 // Return the length of the current track from its origin
1309 return fGctrak->sleng;
1312 //_____________________________________________________________________________
1313 Bool_t TGeant3::IsNewTrack() const
1316 // True if the track is not at the boundary of the current volume
1318 return (fGctrak->sleng==0);
1321 //_____________________________________________________________________________
1322 Bool_t TGeant3::IsTrackInside() const
1325 // True if the track is not at the boundary of the current volume
1327 return (fGctrak->inwvol==0);
1330 //_____________________________________________________________________________
1331 Bool_t TGeant3::IsTrackEntering() const
1334 // True if this is the first step of the track in the current volume
1336 return (fGctrak->inwvol==1);
1339 //_____________________________________________________________________________
1340 Bool_t TGeant3::IsTrackExiting() const
1343 // True if this is the last step of the track in the current volume
1345 return (fGctrak->inwvol==2);
1348 //_____________________________________________________________________________
1349 Bool_t TGeant3::IsTrackOut() const
1352 // True if the track is out of the setup
1354 return (fGctrak->inwvol==3);
1357 //_____________________________________________________________________________
1358 Bool_t TGeant3::IsTrackStop() const
1361 // True if the track energy has fallen below the threshold
1363 return (fGctrak->istop==2);
1366 //_____________________________________________________________________________
1367 Int_t TGeant3::NSecondaries() const
1370 // Number of secondary particles generated in the current step
1372 return fGcking->ngkine;
1375 //_____________________________________________________________________________
1376 Int_t TGeant3::CurrentEvent() const
1379 // Number of the current event
1381 return fGcflag->idevt;
1384 //_____________________________________________________________________________
1385 const char* TGeant3::ProdProcess() const
1388 // Name of the process that has produced the secondary particles
1389 // in the current step
1391 static char proc[5];
1392 const Int_t kIpMec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1395 if(fGcking->ngkine>0) {
1396 for (km = 0; km < fGctrak->nmec; ++km) {
1397 for (im = 0; im < 13; ++im) {
1398 if (fGctrak->lmec[km] == kIpMec[im]) {
1399 mec = fGctrak->lmec[km];
1400 if (0 < mec && mec < 31) {
1401 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1402 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1403 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1410 strcpy(proc,"UNKN");
1411 } else strcpy(proc,"NONE");
1415 //_____________________________________________________________________________
1416 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1417 TLorentzVector &x, TLorentzVector &p)
1420 // Get the parameters of the secondary track number isec produced
1421 // in the current step
1424 if(-1<isec && isec<fGcking->ngkine) {
1425 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1427 x[i]=fGckin3->gpos[isec][i];
1428 p[i]=fGcking->gkin[isec][i];
1430 x[3]=fGcking->tofd[isec];
1431 p[3]=fGcking->gkin[isec][3];
1433 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1434 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1439 //_____________________________________________________________________________
1440 void TGeant3::InitLego()
1443 // Set switches for lego transport
1446 SetDEBU(0,0,0); //do not print a message
1449 //_____________________________________________________________________________
1450 Bool_t TGeant3::IsTrackDisappeared() const
1453 // True if the current particle has disappered
1454 // either because it decayed or because it underwent
1455 // an inelastic collision
1457 return (fGctrak->istop==1);
1460 //_____________________________________________________________________________
1461 Bool_t TGeant3::IsTrackAlive() const
1464 // True if the current particle is alive and will continue to be
1467 return (fGctrak->istop==0);
1470 //_____________________________________________________________________________
1471 void TGeant3::StopTrack()
1474 // Stop the transport of the current particle and skip to the next
1479 //_____________________________________________________________________________
1480 void TGeant3::StopEvent()
1483 // Stop simulation of the current event and skip to the next
1488 //_____________________________________________________________________________
1489 Float_t TGeant3::MaxStep() const
1492 // Return the maximum step length in the current medium
1494 return fGctmed->stemax;
1497 //_____________________________________________________________________________
1498 void TGeant3::SetMaxStep(Float_t maxstep)
1501 // Set the maximum step allowed till the particle is in the current medium
1503 fGctmed->stemax=maxstep;
1506 //_____________________________________________________________________________
1507 void TGeant3::SetMaxNStep(Int_t maxnstp)
1510 // Set the maximum number of steps till the particle is in the current medium
1512 fGctrak->maxnst=maxnstp;
1515 //_____________________________________________________________________________
1516 Int_t TGeant3::GetMaxNStep() const
1519 // Maximum number of steps allowed in current medium
1521 return fGctrak->maxnst;
1524 //_____________________________________________________________________________
1525 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1526 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1530 // Defines a Material
1532 // kmat number assigned to the material
1533 // name material name
1534 // a atomic mass in au
1536 // dens density in g/cm3
1537 // absl absorbtion length in cm
1538 // if >=0 it is ignored and the program
1539 // calculates it, if <0. -absl is taken
1540 // radl radiation length in cm
1541 // if >=0 it is ignored and the program
1542 // calculates it, if <0. -radl is taken
1543 // buf pointer to an array of user words
1544 // nbuf number of user words
1546 Int_t jmate=fGclink->jmate;
1552 for(i=1; i<=ns; i++) {
1553 if(fZlq[jmate-i]==0) {
1559 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1560 nwbuf PASSCHARL(name));
1563 //_____________________________________________________________________________
1564 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1565 Float_t dens, Int_t nlmat, Float_t* wmat)
1568 // Defines mixture OR COMPOUND IMAT as composed by
1569 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1571 // If NLMAT > 0 then wmat contains the proportion by
1572 // weights of each basic material in the mixture.
1574 // If nlmat < 0 then WMAT contains the number of atoms
1575 // of a given kind into the molecule of the COMPOUND
1576 // In this case, WMAT in output is changed to relative
1579 Int_t jmate=fGclink->jmate;
1585 for(i=1; i<=ns; i++) {
1586 if(fZlq[jmate-i]==0) {
1592 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1595 //_____________________________________________________________________________
1596 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1597 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1598 Float_t stemax, Float_t deemax, Float_t epsil,
1599 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1602 // kmed tracking medium number assigned
1603 // name tracking medium name
1604 // nmat material number
1605 // isvol sensitive volume flag
1606 // ifield magnetic field
1607 // fieldm max. field value (kilogauss)
1608 // tmaxfd max. angle due to field (deg/step)
1609 // stemax max. step allowed
1610 // deemax max. fraction of energy lost in a step
1611 // epsil tracking precision (cm)
1612 // stmin min. step due to continuos processes (cm)
1614 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1615 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1616 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1618 Int_t jtmed=fGclink->jtmed;
1624 for(i=1; i<=ns; i++) {
1625 if(fZlq[jtmed-i]==0) {
1631 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1632 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1635 //_____________________________________________________________________________
1636 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1637 Float_t phiy, Float_t thez, Float_t phiz)
1640 // krot rotation matrix number assigned
1641 // theta1 polar angle for axis i
1642 // phi1 azimuthal angle for axis i
1643 // theta2 polar angle for axis ii
1644 // phi2 azimuthal angle for axis ii
1645 // theta3 polar angle for axis iii
1646 // phi3 azimuthal angle for axis iii
1648 // it defines the rotation matrix number irot.
1650 Int_t jrotm=fGclink->jrotm;
1656 for(i=1; i<=ns; i++) {
1657 if(fZlq[jrotm-i]==0) {
1663 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1666 //_____________________________________________________________________________
1667 Int_t TGeant3::GetMedium() const
1670 // Return the number of the current medium
1672 return fGctmed->numed;
1675 //_____________________________________________________________________________
1676 Float_t TGeant3::Edep() const
1679 // Return the energy lost in the current step
1681 return fGctrak->destep;
1684 //_____________________________________________________________________________
1685 Float_t TGeant3::Etot() const
1688 // Return the total energy of the current track
1690 return fGctrak->getot;
1693 //_____________________________________________________________________________
1694 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1697 // Return an array of n random numbers uniformly distributed
1698 // between 0 and 1 not included
1703 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1705 // Functions from GBASE
1707 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1709 //____________________________________________________________________________
1710 void TGeant3::Gfile(const char *filename, const char *option)
1713 // Routine to open a GEANT/RZ data base.
1715 // LUN logical unit number associated to the file
1717 // CHFILE RZ file name
1719 // CHOPT is a character string which may be
1720 // N To create a new file
1721 // U to open an existing file for update
1722 // " " to open an existing file for read only
1723 // Q The initial allocation (default 1000 records)
1724 // is given in IQUEST(10)
1725 // X Open the file in exchange format
1726 // I Read all data structures from file to memory
1727 // O Write all data structures from memory to file
1730 // If options "I" or "O" all data structures are read or
1731 // written from/to file and the file is closed.
1732 // See routine GRMDIR to create subdirectories
1733 // See routines GROUT,GRIN to write,read objects
1735 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1739 //____________________________________________________________________________
1740 void TGeant3::Gpcxyz()
1743 // Print track and volume parameters at current point
1748 //_____________________________________________________________________________
1749 void TGeant3::Ggclos()
1752 // Closes off the geometry setting.
1753 // Initializes the search list for the contents of each
1754 // volume following the order they have been positioned, and
1755 // inserting the content '0' when a call to GSNEXT (-1) has
1756 // been required by the user.
1757 // Performs the development of the JVOLUM structure for all
1758 // volumes with variable parameters, by calling GGDVLP.
1759 // Interprets the user calls to GSORD, through GGORD.
1760 // Computes and stores in a bank (next to JVOLUM mother bank)
1761 // the number of levels in the geometrical tree and the
1762 // maximum number of contents per level, by calling GGNLEV.
1763 // Sets status bit for CONCAVE volumes, through GGCAVE.
1764 // Completes the JSET structure with the list of volume names
1765 // which identify uniquely a given physical detector, the
1766 // list of bit numbers to pack the corresponding volume copy
1767 // numbers, and the generic path(s) in the JVOLUM tree,
1768 // through the routine GHCLOS.
1771 // Create internal list of volumes
1772 fVolNames = new char[fGcnum->nvolum+1][5];
1774 for(i=0; i<fGcnum->nvolum; ++i) {
1775 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1776 fVolNames[i][4]='\0';
1778 strcpy(fVolNames[fGcnum->nvolum],"NULL");
1781 //_____________________________________________________________________________
1782 void TGeant3::Glast()
1785 // Finish a Geant run
1790 //_____________________________________________________________________________
1791 void TGeant3::Gprint(const char *name)
1794 // Routine to print data structures
1795 // CHNAME name of a data structure
1799 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1802 //_____________________________________________________________________________
1803 void TGeant3::Grun()
1806 // Steering function to process one run
1811 //_____________________________________________________________________________
1812 void TGeant3::Gtrig()
1815 // Steering function to process one event
1820 //_____________________________________________________________________________
1821 void TGeant3::Gtrigc()
1824 // Clear event partition
1829 //_____________________________________________________________________________
1830 void TGeant3::Gtrigi()
1833 // Initialises event partition
1838 //_____________________________________________________________________________
1839 void TGeant3::Gwork(Int_t nwork)
1842 // Allocates workspace in ZEBRA memory
1847 //_____________________________________________________________________________
1848 void TGeant3::Gzinit()
1851 // To initialise GEANT/ZEBRA data structures
1856 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1858 // Functions from GCONS
1860 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1862 //_____________________________________________________________________________
1863 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1864 Float_t &dens, Float_t &radl, Float_t &absl,
1865 Float_t* ubuf, Int_t& nbuf)
1868 // Return parameters for material IMAT
1870 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1874 //_____________________________________________________________________________
1875 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1876 Float_t &amass, Float_t &charge, Float_t &tlife)
1879 // Return parameters for particle of type IPART
1883 Int_t igpart = IdFromPDG(ipart);
1884 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1888 //_____________________________________________________________________________
1889 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1890 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1891 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1892 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1895 // Return parameters for tracking medium NUMED
1897 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1898 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1902 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
1903 Float_t* tkin, Float_t* value, Float_t* pcut,
1907 // Return parameters for tracking medium NUMED
1909 gftmat(imate, ipart, PASSCHARD(chmeca), kdim,
1910 tkin, value, pcut, ixst PASSCHARL(chmeca));
1914 //_____________________________________________________________________________
1915 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
1918 // To calculate energy loss due to soft muon BREMSSTRAHLUNG
1920 return gbrelm(z,t,bcut);
1923 //_____________________________________________________________________________
1924 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
1927 // To calculate DE/DX in GeV*barn/atom for direct pair production by muons
1929 return gprelm(z,t,bcut);
1932 //_____________________________________________________________________________
1933 void TGeant3::Gmate()
1936 // Define standard GEANT materials
1941 //_____________________________________________________________________________
1942 void TGeant3::Gpart()
1945 // Define standard GEANT particles plus selected decay modes
1946 // and branching ratios.
1951 //_____________________________________________________________________________
1952 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1954 // Defines branching ratios and decay modes for standard
1956 gsdk(ipart,bratio,mode);
1959 //_____________________________________________________________________________
1960 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1961 Float_t dens, Float_t radl, Float_t absl)
1964 // Defines a Material
1966 // kmat number assigned to the material
1967 // name material name
1968 // a atomic mass in au
1970 // dens density in g/cm3
1971 // absl absorbtion length in cm
1972 // if >=0 it is ignored and the program
1973 // calculates it, if <0. -absl is taken
1974 // radl radiation length in cm
1975 // if >=0 it is ignored and the program
1976 // calculates it, if <0. -radl is taken
1977 // buf pointer to an array of user words
1978 // nbuf number of user words
1982 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1986 //_____________________________________________________________________________
1987 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1988 Float_t dens, Int_t nlmat, Float_t *wmat)
1991 // Defines mixture OR COMPOUND IMAT as composed by
1992 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1994 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1995 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1997 // If NLMAT.LT.0 then WMAT contains the number of atoms
1998 // of a given kind into the molecule of the COMPOUND
1999 // In this case, WMAT in output is changed to relative
2002 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
2005 //_____________________________________________________________________________
2006 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
2007 Float_t amass, Float_t charge, Float_t tlife)
2010 // Store particle parameters
2012 // ipart particle code
2013 // name particle name
2014 // itrtyp transport method (see GEANT manual)
2015 // amass mass in GeV/c2
2016 // charge charge in electron units
2017 // tlife lifetime in seconds
2021 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
2025 //_____________________________________________________________________________
2026 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
2027 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
2028 Float_t stemax, Float_t deemax, Float_t epsil,
2032 // NTMED Tracking medium number
2033 // NAME Tracking medium name
2034 // NMAT Material number
2035 // ISVOL Sensitive volume flag
2036 // IFIELD Magnetic field
2037 // FIELDM Max. field value (Kilogauss)
2038 // TMAXFD Max. angle due to field (deg/step)
2039 // STEMAX Max. step allowed
2040 // DEEMAX Max. fraction of energy lost in a step
2041 // EPSIL Tracking precision (cm)
2042 // STMIN Min. step due to continuos processes (cm)
2044 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
2045 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
2046 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
2050 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
2051 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
2054 //_____________________________________________________________________________
2055 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
2056 Float_t *absco, Float_t *effic, Float_t *rindex)
2059 // Stores the tables for UV photon tracking in medium ITMED
2060 // Please note that it is the user's responsability to
2061 // provide all the coefficients:
2064 // ITMED Tracking medium number
2065 // NPCKOV Number of bins of each table
2066 // PPCKOV Value of photon momentum (in GeV)
2067 // ABSCO Absorbtion coefficients
2068 // dielectric: absorbtion length in cm
2069 // metals : absorbtion fraction (0<=x<=1)
2070 // EFFIC Detection efficiency for UV photons
2071 // RINDEX Refraction index (if=0 metal)
2073 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
2076 //_____________________________________________________________________________
2077 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
2080 // To change the value of cut or mechanism "CHPAR"
2081 // to a new value PARVAL for tracking medium ITMED
2082 // The data structure JTMED contains the standard tracking
2083 // parameters (CUTS and flags to control the physics processes) which
2084 // are used by default for all tracking media. It is possible to
2085 // redefine individually with GSTPAR any of these parameters for a
2086 // given tracking medium.
2087 // ITMED tracking medium number
2088 // CHPAR is a character string (variable name)
2089 // PARVAL must be given as a floating point.
2091 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
2094 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2096 // Functions from GCONS
2098 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2100 //_____________________________________________________________________________
2101 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
2104 // Storing/Retrieving Vertex and Track parameters
2105 // ----------------------------------------------
2107 // Stores vertex parameters.
2108 // VERT array of (x,y,z) position of the vertex
2109 // NTBEAM beam track number origin of the vertex
2110 // =0 if none exists
2111 // NTTARG target track number origin of the vertex
2112 // UBUF user array of NUBUF floating point numbers
2114 // NVTX new vertex number (=0 in case of error).
2115 // Prints vertex parameters.
2116 // IVTX for vertex IVTX.
2117 // (For all vertices if IVTX=0)
2118 // Stores long life track parameters.
2119 // PLAB components of momentum
2120 // IPART type of particle (see GSPART)
2121 // NV vertex number origin of track
2122 // UBUF array of NUBUF floating point user parameters
2124 // NT track number (if=0 error).
2125 // Retrieves long life track parameters.
2126 // ITRA track number for which parameters are requested
2127 // VERT vector origin of the track
2128 // PVERT 4 momentum components at the track origin
2129 // IPART particle type (=0 if track ITRA does not exist)
2130 // NVERT vertex number origin of the track
2131 // UBUF user words stored in GSKINE.
2132 // Prints initial track parameters.
2133 // ITRA for track ITRA
2134 // (For all tracks if ITRA=0)
2138 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
2141 //_____________________________________________________________________________
2142 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
2146 // Retrieves the parameter of a vertex bank
2147 // Vertex is generated from tracks NTBEAM NTTARG
2148 // NVTX is the new vertex number
2152 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
2155 //_____________________________________________________________________________
2156 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
2160 // Store kinematics of track NT into data structure
2161 // Track is coming from vertex NV
2164 gskine(plab, ipart, nv, buf, nwbuf, nt);
2168 //_____________________________________________________________________________
2169 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
2173 // Creates a new vertex bank
2174 // Vertex is generated from tracks NTBEAM NTTARG
2175 // NVTX is the new vertex number
2178 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
2182 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2184 // Functions from GPHYS
2186 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2188 //_____________________________________________________________________________
2189 void TGeant3::Gphysi()
2192 // Initialise material constants for all the physics
2193 // mechanisms used by GEANT
2198 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2200 // Functions from GTRAK
2202 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2204 //_____________________________________________________________________________
2205 void TGeant3::Gdebug()
2208 // Debug the current step
2213 //_____________________________________________________________________________
2214 void TGeant3::Gekbin()
2217 // To find bin number in kinetic energy table
2218 // stored in ELOW(NEKBIN)
2223 //_____________________________________________________________________________
2224 void TGeant3::Gfinds()
2227 // Returns the set/volume parameters corresponding to
2228 // the current space point in /GCTRAK/
2229 // and fill common /GCSETS/
2231 // IHSET user set identifier
2232 // IHDET user detector identifier
2233 // ISET set number in JSET
2234 // IDET detector number in JS=LQ(JSET-ISET)
2235 // IDTYPE detector type (1,2)
2236 // NUMBV detector volume numbers (array of length NVNAME)
2237 // NVNAME number of volume levels
2242 //_____________________________________________________________________________
2243 void TGeant3::Gsking(Int_t igk)
2246 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2247 // or the NGKINE tracks when IGK is 0.
2252 //_____________________________________________________________________________
2253 void TGeant3::Gskpho(Int_t igk)
2256 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2257 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2262 //_____________________________________________________________________________
2263 void TGeant3::Gsstak(Int_t iflag)
2266 // Stores in auxiliary stack JSTAK the particle currently
2267 // described in common /GCKINE/.
2269 // On request, creates also an entry in structure JKINE :
2271 // 0 : No entry in JKINE structure required (user)
2272 // 1 : New entry in JVERTX / JKINE structures required (user)
2273 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2274 // 2 : Entry in JKINE structure exists already (from GTREVE)
2279 //_____________________________________________________________________________
2280 void TGeant3::Gsxyz()
2283 // Store space point VECT in banks JXYZ
2288 //_____________________________________________________________________________
2289 void TGeant3::Gtrack()
2292 // Controls tracking of current particle
2297 //_____________________________________________________________________________
2298 void TGeant3::Gtreve()
2301 // Controls tracking of all particles belonging to the current event
2306 //_____________________________________________________________________________
2307 void TGeant3::GtreveRoot()
2310 // Controls tracking of all particles belonging to the current event
2315 //_____________________________________________________________________________
2316 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2319 // To generate a vector RVECV of LEN random numbers
2320 // Copy of the CERN Library routine RANECU
2324 //_____________________________________________________________________________
2325 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2326 const Text_t *chopt)
2329 // To set/retrieve the seed of the random number generator
2331 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2334 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2336 // Functions from GDRAW
2338 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2340 //_____________________________________________________________________________
2341 void TGeant3::Gdxyz(Int_t it)
2344 // Draw the points stored with Gsxyz relative to track it
2349 //_____________________________________________________________________________
2350 void TGeant3::Gdcxyz()
2353 // Draw the position of the current track
2358 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2360 // Functions from GGEOM
2362 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2364 //_____________________________________________________________________________
2365 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2368 // Computes coordinates XM (Master Reference System
2369 // knowing the coordinates XD (Detector Ref System)
2370 // The local reference system can be initialized by
2371 // - the tracking routines and GDTOM used in GUSTEP
2372 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2373 // (inverse routine is GMTOD)
2375 // If IFLAG=1 convert coordinates
2376 // IFLAG=2 convert direction cosinus
2378 gdtom(xd, xm, iflag);
2381 //_____________________________________________________________________________
2382 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2386 // Loads the top part of the Volume tree in LVOLS (IVO's),
2387 // LINDX (IN indices) for a given volume defined through
2388 // its name IUDET and number IUNUM.
2390 // The routine stores only upto the last level where JVOLUM
2391 // data structure is developed. If there is no development
2392 // above the current level, it returns NLEV zero.
2394 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2397 //_____________________________________________________________________________
2398 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2401 // Finds in which volume/medium the point X is, and updates the
2402 // common /GCVOLU/ and the structure JGPAR accordingly.
2404 // NUMED returns the tracking medium number, or 0 if point is
2405 // outside the experimental setup.
2410 //_____________________________________________________________________________
2411 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2414 // Computes coordinates XD (in DRS)
2415 // from known coordinates XM in MRS
2416 // The local reference system can be initialized by
2417 // - the tracking routines and GMTOD used in GUSTEP
2418 // - a call to GMEDIA(XM,NUMED)
2419 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2420 // (inverse routine is GDTOM)
2422 // If IFLAG=1 convert coordinates
2423 // IFLAG=2 convert direction cosinus
2425 gmtod(xm, xd, iflag);
2428 //_____________________________________________________________________________
2429 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2433 // Create a new volume by dividing an existing one
2436 // MOTHER Mother volume name
2437 // NDIV Number of divisions
2440 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2441 // It divides a previously defined volume.
2446 Vname(mother,vmother);
2447 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2448 PASSCHARL(vmother));
2451 //_____________________________________________________________________________
2452 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2453 Int_t iaxis, Float_t c0i, Int_t numed)
2456 // Create a new volume by dividing an existing one
2458 // Divides mother into ndiv divisions called name
2459 // along axis iaxis starting at coordinate value c0.
2460 // the new volume created will be medium number numed.
2465 Vname(mother,vmother);
2466 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2467 PASSCHARL(vname) PASSCHARL(vmother));
2470 //_____________________________________________________________________________
2471 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2472 Int_t iaxis, Int_t numed)
2475 // Create a new volume by dividing an existing one
2480 Vname(mother,vmother);
2481 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2482 PASSCHARL(vname) PASSCHARL(vmother));
2485 //_____________________________________________________________________________
2486 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2487 Int_t iaxis, Float_t c0, Int_t numed)
2490 // Create a new volume by dividing an existing one
2495 Vname(mother,vmother);
2496 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2497 PASSCHARL(vname) PASSCHARL(vmother));
2500 //_____________________________________________________________________________
2501 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2502 Int_t iaxis, Int_t numed, Int_t ndvmx)
2505 // Create a new volume by dividing an existing one
2507 // Divides MOTHER into divisions called NAME along
2508 // axis IAXIS in steps of STEP. If not exactly divisible
2509 // will make as many as possible and will centre them
2510 // with respect to the mother. Divisions will have medium
2511 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2512 // NDVMX is the expected maximum number of divisions
2513 // (If 0, no protection tests are performed)
2518 Vname(mother,vmother);
2519 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2520 PASSCHARL(vname) PASSCHARL(vmother));
2523 //_____________________________________________________________________________
2524 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2525 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2528 // Create a new volume by dividing an existing one
2530 // Divides MOTHER into divisions called NAME along
2531 // axis IAXIS starting at coordinate value C0 with step
2533 // The new volume created will have medium number NUMED.
2534 // If NUMED is 0, NUMED of mother is taken.
2535 // NDVMX is the expected maximum number of divisions
2536 // (If 0, no protection tests are performed)
2541 Vname(mother,vmother);
2542 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2543 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2546 //_____________________________________________________________________________
2547 void TGeant3::Gsord(const char *name, Int_t iax)
2550 // Flags volume CHNAME whose contents will have to be ordered
2551 // along axis IAX, by setting the search flag to -IAX
2555 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2556 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2557 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2558 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2559 // IAX = 6 PHI (PHI=0 => X axis)
2560 // IAX = 7 THETA (THETA=0 => Z axis)
2564 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2567 //_____________________________________________________________________________
2568 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2569 Float_t y, Float_t z, Int_t irot, const char *konly)
2572 // Position a volume into an existing one
2575 // NUMBER Copy number of the volume
2576 // MOTHER Mother volume name
2577 // X X coord. of the volume in mother ref. sys.
2578 // Y Y coord. of the volume in mother ref. sys.
2579 // Z Z coord. of the volume in mother ref. sys.
2580 // IROT Rotation matrix number w.r.t. mother ref. sys.
2581 // ONLY ONLY/MANY flag
2583 // It positions a previously defined volume in the mother.
2588 Vname(mother,vmother);
2589 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2590 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2594 //_____________________________________________________________________________
2595 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2596 Float_t x, Float_t y, Float_t z, Int_t irot,
2597 const char *konly, Float_t *upar, Int_t np )
2600 // Place a copy of generic volume NAME with user number
2601 // NR inside MOTHER, with its parameters UPAR(1..NP)
2606 Vname(mother,vmother);
2607 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2608 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2612 //_____________________________________________________________________________
2613 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2614 Float_t phi2, Float_t theta3, Float_t phi3)
2617 // nmat Rotation matrix number
2618 // THETA1 Polar angle for axis I
2619 // PHI1 Azimuthal angle for axis I
2620 // THETA2 Polar angle for axis II
2621 // PHI2 Azimuthal angle for axis II
2622 // THETA3 Polar angle for axis III
2623 // PHI3 Azimuthal angle for axis III
2625 // It defines the rotation matrix number IROT.
2627 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2630 //_____________________________________________________________________________
2631 void TGeant3::Gprotm(Int_t nmat)
2634 // To print rotation matrices structure JROTM
2635 // nmat Rotation matrix number
2640 //_____________________________________________________________________________
2641 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2642 Float_t *upar, Int_t npar)
2646 // SHAPE Volume type
2647 // NUMED Tracking medium number
2648 // NPAR Number of shape parameters
2649 // UPAR Vector containing shape parameters
2651 // It creates a new volume in the JVOLUM data structure.
2657 Vname(shape,vshape);
2658 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2659 PASSCHARL(vname) PASSCHARL(vshape));
2663 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2665 // T H E D R A W I N G P A C K A G E
2666 // ======================================
2667 // Drawing functions. These functions allow the visualization in several ways
2668 // of the volumes defined in the geometrical data structure. It is possible
2669 // to draw the logical tree of volumes belonging to the detector (DTREE),
2670 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2671 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2672 // these commands when the hidden line removal option is activated; in
2673 // this case, the volumes can be also either translated in the space
2674 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2675 // possible to fill the surfaces of the volumes
2676 // with solid colours when the shading option (SHAD) is activated.
2677 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2678 // of the detectors or to scan physical events as well.
2679 // Finally, the command MOVE will allow the rotation, translation and zooming
2680 // on real time parts of the detectors or tracks and hits of a simulated event.
2681 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2682 // the drawing is performed by the Geant ray-tracing;
2683 // automatically, the color is assigned according to the tracking medium of each
2684 // volume and the volumes with a density lower/equal than the air are considered
2685 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2686 // the user can set color and visibility for the desired volumes via the command
2687 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2688 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2689 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2690 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2691 // first case, we assume that the first mother volume of the tree is a box with
2692 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2693 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2694 // second case, the distance between the observer and the origin of the world
2695 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2696 // or telescopic effects can be achieved changing the scale factors in the command
2697 // (DRAW). When the final picture does not occupy the full window,
2698 // mapping the space before tracing can speed up the drawing, but can also
2699 // produce less precise results; values from 1 to 4 are allowed in the command
2700 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2701 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2702 // The command (VALCUT) allows the cutting of the detector by three planes
2703 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2704 // SATT for any desired volume and can assume values from 0 to 7; it determines
2705 // the different light processing to be performed for different materials:
2706 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2707 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2708 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2709 // is 0.9) and the observer is assumed to have a light source (therefore he will
2710 // produce parallel light in the case of parallel view and point-like-source
2711 // light in the case of perspective view).
2713 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2715 //_____________________________________________________________________________
2716 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2720 // IOPT Name of the attribute to be set
2721 // IVAL Value to which the attribute is to be set
2723 // name= "*" stands for all the volumes.
2724 // iopt can be chosen among the following :
2726 // WORK 0=volume name is inactive for the tracking
2727 // 1=volume name is active for the tracking (default)
2729 // SEEN 0=volume name is invisible
2730 // 1=volume name is visible (default)
2731 // -1=volume invisible with all its descendants in the tree
2732 // -2=volume visible but not its descendants in the tree
2734 // LSTY line style 1,2,3,... (default=1)
2735 // LSTY=7 will produce a very precise approximation for
2736 // revolution bodies.
2738 // LWID line width -7,...,1,2,3,..7 (default=1)
2739 // LWID<0 will act as abs(LWID) was set for the volume
2740 // and for all the levels below it. When SHAD is 'ON', LWID
2741 // represent the linewidth of the scan lines filling the surfaces
2742 // (whereas the FILL value represent their number). Therefore
2743 // tuning this parameter will help to obtain the desired
2744 // quality/performance ratio.
2746 // COLO colour code -166,...,1,2,..166 (default=1)
2748 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2749 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2750 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2751 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2752 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2753 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2754 // colour=n*10+m, m=1,2,...9, will produce the same colour
2755 // as 'n', but with increasing luminosity according to 'm';
2756 // COLO<0 will act as if abs(COLO) was set for the volume
2757 // and for all the levels below it.
2758 // When for a volume the attribute FILL is > 1 (and the
2759 // option SHAD is on), the ABS of its colour code must be < 8
2760 // because an automatic shading of its faces will be
2763 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2764 // when option SHAD is "on" the FILL attribute of any
2765 // volume can be set different from 0 (normal drawing);
2766 // if it is set to 1, the faces of such volume will be filled
2767 // with solid colours; if ABS(FILL) is > 1, then a light
2768 // source is placed along the observer line, and the faces of
2769 // such volumes will be painted by colours whose luminosity
2770 // will depend on the amount of light reflected;
2771 // if ABS(FILL) = 1, then it is possible to use all the 166
2772 // colours of the colour table, becouse the automatic shading
2773 // is not performed;
2774 // for increasing values of FILL the drawing will be performed
2775 // with higher and higher resolution improving the quality (the
2776 // number of scan lines used to fill the faces increases with FILL);
2777 // it is possible to set different values of FILL
2778 // for different volumes, in order to optimize at the same time
2779 // the performance and the quality of the picture;
2780 // FILL<0 will act as if abs(FILL) was set for the volume
2781 // and for all the levels below it.
2782 // This kind of drawing can be saved in 'picture files'
2783 // or in view banks.
2784 // 0=drawing without fill area
2785 // 1=faces filled with solid colours and resolution = 6
2786 // 2=lowest resolution (very fast)
2787 // 3=default resolution
2788 // 4=.................
2789 // 5=.................
2790 // 6=.................
2792 // Finally, if a coloured background is desired, the FILL
2793 // attribute for the first volume of the tree must be set
2794 // equal to -abs(colo), colo being >0 and <166.
2796 // SET set number associated to volume name
2797 // DET detector number associated to volume name
2798 // DTYP detector type (1,2)
2805 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2809 //_____________________________________________________________________________
2810 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2811 Int_t& natt, Float_t* par, Float_t* att)
2814 // Find the parameters of a volume
2816 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2820 //_____________________________________________________________________________
2821 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2824 // Check the parameters of a shape
2826 gckpar(ish,npar,par);
2829 //_____________________________________________________________________________
2830 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2833 // Check the parameters of a tracking medium
2835 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2838 //_____________________________________________________________________________
2839 void TGeant3::Gdelete(Int_t iview)
2842 // IVIEW View number
2844 // It deletes a view bank from memory.
2849 //_____________________________________________________________________________
2850 void TGeant3::Gdopen(Int_t iview)
2853 // IVIEW View number
2855 // When a drawing is very complex and requires a long time to be
2856 // executed, it can be useful to store it in a view bank: after a
2857 // call to DOPEN and the execution of the drawing (nothing will
2858 // appear on the screen), and after a necessary call to DCLOSE,
2859 // the contents of the bank can be displayed in a very fast way
2860 // through a call to DSHOW; therefore, the detector can be easily
2861 // zoomed many times in different ways. Please note that the pictures
2862 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2869 //_____________________________________________________________________________
2870 void TGeant3::Gdclose()
2873 // It closes the currently open view bank; it must be called after the
2874 // end of the drawing to be stored.
2879 //_____________________________________________________________________________
2880 void TGeant3::Gdshow(Int_t iview)
2883 // IVIEW View number
2885 // It shows on the screen the contents of a view bank. It
2886 // can be called after a view bank has been closed.
2891 //_____________________________________________________________________________
2892 void TGeant3::Gdopt(const char *name,const char *value)
2896 // VALUE Option value
2898 // To set/modify the drawing options.
2901 // THRZ ON Draw tracks in R vs Z
2902 // OFF (D) Draw tracks in X,Y,Z
2905 // PROJ PARA (D) Parallel projection
2907 // TRAK LINE (D) Trajectory drawn with lines
2908 // POIN " " with markers
2909 // HIDE ON Hidden line removal using the CG package
2910 // OFF (D) No hidden line removal
2911 // SHAD ON Fill area and shading of surfaces.
2912 // OFF (D) Normal hidden line removal.
2913 // RAYT ON Ray-tracing on.
2914 // OFF (D) Ray-tracing off.
2915 // EDGE OFF Does not draw contours when shad is on.
2916 // ON (D) Normal shading.
2917 // MAPP 1,2,3,4 Mapping before ray-tracing.
2918 // 0 (D) No mapping.
2919 // USER ON User graphics options in the raytracing.
2920 // OFF (D) Automatic graphics options.
2926 Vname(value,vvalue);
2927 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2931 //_____________________________________________________________________________
2932 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2933 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2938 // THETA Viewing angle theta (for 3D projection)
2939 // PHI Viewing angle phi (for 3D projection)
2940 // PSI Viewing angle psi (for 2D rotation)
2941 // U0 U-coord. (horizontal) of volume origin
2942 // V0 V-coord. (vertical) of volume origin
2943 // SU Scale factor for U-coord.
2944 // SV Scale factor for V-coord.
2946 // This function will draw the volumes,
2947 // selected with their graphical attributes, set by the Gsatt
2948 // facility. The drawing may be performed with hidden line removal
2949 // and with shading effects according to the value of the options HIDE
2950 // and SHAD; if the option SHAD is ON, the contour's edges can be
2951 // drawn or not. If the option HIDE is ON, the detector can be
2952 // exploded (BOMB), clipped with different shapes (CVOL), and some
2953 // of its parts can be shifted from their original
2954 // position (SHIFT). When HIDE is ON, if
2955 // the drawing requires more than the available memory, the program
2956 // will evaluate and display the number of missing words
2957 // (so that the user can increase the
2958 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2959 // the program will print messages about the memory used and
2960 // statistics on the volumes' visibility.
2961 // The following commands will produce the drawing of a green
2962 // volume, specified by NAME, without using the hidden line removal
2963 // technique, using the hidden line removal technique,
2964 // with different linewidth and colour (red), with
2965 // solid colour, with shading of surfaces, and without edges.
2966 // Finally, some examples are given for the ray-tracing. (A possible
2967 // string for the NAME of the volume can be found using the command DTREE).
2973 if (fGcvdma->raytra != 1) {
2974 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2976 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2980 //_____________________________________________________________________________
2981 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2982 Float_t v0,Float_t ul,Float_t vl)
2987 // CUTVAL Cut plane distance from the origin along the axis
2989 // U0 U-coord. (horizontal) of volume origin
2990 // V0 V-coord. (vertical) of volume origin
2991 // SU Scale factor for U-coord.
2992 // SV Scale factor for V-coord.
2994 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2995 // and placed at the distance cutval from the origin.
2996 // The resulting picture is seen from the the same axis.
2997 // When HIDE Mode is ON, it is possible to get the same effect with
2998 // the CVOL/BOX function.
3004 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
3007 //_____________________________________________________________________________
3008 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
3009 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
3010 Float_t v0,Float_t ul,Float_t vl)
3014 // CUTTHE Theta angle of the line normal to cut plane
3015 // CUTPHI Phi angle of the line normal to cut plane
3016 // CUTVAL Cut plane distance from the origin along the axis
3018 // THETA Viewing angle theta (for 3D projection)
3019 // PHI Viewing angle phi (for 3D projection)
3020 // U0 U-coord. (horizontal) of volume origin
3021 // V0 V-coord. (vertical) of volume origin
3022 // SU Scale factor for U-coord.
3023 // SV Scale factor for V-coord.
3025 // The cut plane is normal to the line given by the cut angles
3026 // cutthe and cutphi and placed at the distance cutval from the origin.
3027 // The resulting picture is seen from the viewing angles theta,phi.
3033 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
3037 //_____________________________________________________________________________
3038 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
3043 // ISEL Option flag D=111110
3045 // CHRSIZ Character size (cm) of title NAME D=0.6
3048 // 0 to have only the header lines
3049 // xxxxx1 to add the text name centered on top of header
3050 // xxxx1x to add global detector name (first volume) on left
3051 // xxx1xx to add date on right
3052 // xx1xxx to select thick characters for text on top of header
3053 // x1xxxx to add the text 'EVENT NR x' on top of header
3054 // 1xxxxx to add the text 'RUN NR x' on top of header
3055 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
3056 // i.e. they generate overwritten text.
3058 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
3061 //_____________________________________________________________________________
3062 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
3065 // Draw a 2D-man at position (U0,V0)
3067 // U U-coord. (horizontal) of the centre of man' R
3068 // V V-coord. (vertical) of the centre of man' R
3069 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
3071 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
3072 // It superimposes the picure of a man or of a woman, chosen among
3073 // three different ones, with the same scale factors as the detector
3074 // in the current drawing.
3077 if (opt.Contains("WM1")) {
3079 } else if (opt.Contains("WM3")) {
3081 } else if (opt.Contains("WM2")) {
3088 //_____________________________________________________________________________
3089 void TGeant3::Gdspec(const char *name)
3094 // Shows 3 views of the volume (two cut-views and a 3D view), together with
3095 // its geometrical specifications. The 3D drawing will
3096 // be performed according the current values of the options HIDE and
3097 // SHAD and according the current SetClipBox clipping parameters for that
3104 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3107 //_____________________________________________________________________________
3108 void TGeant3::DrawOneSpec(const char *name)
3111 // Function called when one double-clicks on a volume name
3112 // in a TPavelabel drawn by Gdtree.
3114 THIGZ *higzSave = gHigz;
3115 higzSave->SetName("higzSave");
3116 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
3117 //printf("DrawOneSpec, gHigz=%x, higzSpec=%x\n",gHigz,higzSpec);
3118 if (higzSpec) gHigz = higzSpec;
3119 else higzSpec = new THIGZ(kDefSize);
3120 higzSpec->SetName("higzSpec");
3125 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3128 higzSave->SetName("higz");
3132 //_____________________________________________________________________________
3133 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
3137 // LEVMAX Depth level
3140 // This function draws the logical tree,
3141 // Each volume in the tree is represented by a TPaveTree object.
3142 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
3143 // Use TPaveTree pop-up menu to select:
3146 // - drawing tree of parent
3152 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3153 gHigz->SetPname("");
3156 //_____________________________________________________________________________
3157 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
3161 // LEVMAX Depth level
3164 // This function draws the logical tree of the parent of name.
3168 // Scan list of volumes in JVOLUM
3170 Int_t gname, i, jvo, in, nin, jin, num;
3171 strncpy((char *) &gname, name, 4);
3172 for(i=1; i<=fGcnum->nvolum; i++) {
3173 jvo = fZlq[fGclink->jvolum-i];
3174 nin = Int_t(fZq[jvo+3]);
3175 if (nin == -1) nin = 1;
3176 for (in=1;in<=nin;in++) {
3178 num = Int_t(fZq[jin+2]);
3179 if(gname == fZiq[fGclink->jvolum+num]) {
3180 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
3182 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3183 gHigz->SetPname("");
3190 //_____________________________________________________________________________
3191 void TGeant3::SetABAN(Int_t par)
3194 // par = 1 particles will be stopped according to their residual
3195 // range if they are not in a sensitive material and are
3196 // far enough from the boundary
3197 // 0 particles are transported normally
3199 fGcphys->dphys1 = par;
3203 //_____________________________________________________________________________
3204 void TGeant3::SetANNI(Int_t par)
3207 // To control positron annihilation.
3208 // par =0 no annihilation
3209 // =1 annihilation. Decays processed.
3210 // =2 annihilation. No decay products stored.
3212 fGcphys->ianni = par;
3216 //_____________________________________________________________________________
3217 void TGeant3::SetAUTO(Int_t par)
3220 // To control automatic calculation of tracking medium parameters:
3221 // par =0 no automatic calculation;
3222 // =1 automati calculation.
3224 fGctrak->igauto = par;
3228 //_____________________________________________________________________________
3229 void TGeant3::SetBOMB(Float_t boom)
3232 // BOOM : Exploding factor for volumes position
3234 // To 'explode' the detector. If BOOM is positive (values smaller
3235 // than 1. are suggested, but any value is possible)
3236 // all the volumes are shifted by a distance
3237 // proportional to BOOM along the direction between their centre
3238 // and the origin of the MARS; the volumes which are symmetric
3239 // with respect to this origin are simply not shown.
3240 // BOOM equal to 0 resets the normal mode.
3241 // A negative (greater than -1.) value of
3242 // BOOM will cause an 'implosion'; for even lower values of BOOM
3243 // the volumes' positions will be reflected respect to the origin.
3244 // This command can be useful to improve the 3D effect for very
3245 // complex detectors. The following commands will make explode the
3252 //_____________________________________________________________________________
3253 void TGeant3::SetBREM(Int_t par)
3256 // To control bremstrahlung.
3257 // par =0 no bremstrahlung
3258 // =1 bremstrahlung. Photon processed.
3259 // =2 bremstrahlung. No photon stored.
3261 fGcphys->ibrem = par;
3265 //_____________________________________________________________________________
3266 void TGeant3::SetCKOV(Int_t par)
3269 // To control Cerenkov production
3270 // par =0 no Cerenkov;
3272 // =2 Cerenkov with primary stopped at each step.
3274 fGctlit->itckov = par;
3278 //_____________________________________________________________________________
3279 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3280 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3283 // The hidden line removal technique is necessary to visualize properly
3284 // very complex detectors. At the same time, it can be useful to visualize
3285 // the inner elements of a detector in detail. This function allows
3286 // subtractions (via boolean operation) of BOX shape from any part of
3287 // the detector, therefore showing its inner contents.
3288 // If "*" is given as the name of the
3289 // volume to be clipped, all volumes are clipped by the given box.
3290 // A volume can be clipped at most twice.
3291 // if a volume is explicitely clipped twice,
3292 // the "*" will not act on it anymore. Giving "." as the name
3293 // of the volume to be clipped will reset the clipping.
3295 // NAME Name of volume to be clipped
3297 // XMIN Lower limit of the Shape X coordinate
3298 // XMAX Upper limit of the Shape X coordinate
3299 // YMIN Lower limit of the Shape Y coordinate
3300 // YMAX Upper limit of the Shape Y coordinate
3301 // ZMIN Lower limit of the Shape Z coordinate
3302 // ZMAX Upper limit of the Shape Z coordinate
3304 // This function performs a boolean subtraction between the volume
3305 // NAME and a box placed in the MARS according the values of the given
3311 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3314 //_____________________________________________________________________________
3315 void TGeant3::SetCOMP(Int_t par)
3318 // To control Compton scattering
3319 // par =0 no Compton
3320 // =1 Compton. Electron processed.
3321 // =2 Compton. No electron stored.
3324 fGcphys->icomp = par;
3327 //_____________________________________________________________________________
3328 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3329 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3330 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3331 Float_t ppcutm, Float_t tofmax)
3334 // CUTGAM Cut for gammas D=0.001
3335 // CUTELE Cut for electrons D=0.001
3336 // CUTHAD Cut for charged hadrons D=0.01
3337 // CUTNEU Cut for neutral hadrons D=0.01
3338 // CUTMUO Cut for muons D=0.01
3339 // BCUTE Cut for electron brems. D=-1.
3340 // BCUTM Cut for muon brems. D=-1.
3341 // DCUTE Cut for electron delta-rays D=-1.
3342 // DCUTM Cut for muon delta-rays D=-1.
3343 // PPCUTM Cut for e+e- pairs by muons D=0.01
3344 // TOFMAX Time of flight cut D=1.E+10
3346 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3347 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3349 // If one of the parameters from CUTGAM to PPCUTM included
3350 // is modified, cross-sections and energy loss tables must be
3351 // recomputed via the function Gphysi.
3353 fGccuts->cutgam = cutgam;
3354 fGccuts->cutele = cutele;
3355 fGccuts->cutneu = cutneu;
3356 fGccuts->cuthad = cuthad;
3357 fGccuts->cutmuo = cutmuo;
3358 fGccuts->bcute = bcute;
3359 fGccuts->bcutm = bcutm;
3360 fGccuts->dcute = dcute;
3361 fGccuts->dcutm = dcutm;
3362 fGccuts->ppcutm = ppcutm;
3363 fGccuts->tofmax = tofmax;
3366 //_____________________________________________________________________________
3367 void TGeant3::SetDCAY(Int_t par)
3370 // To control Decay mechanism.
3371 // par =0 no decays.
3372 // =1 Decays. secondaries processed.
3373 // =2 Decays. No secondaries stored.
3375 fGcphys->idcay = par;
3379 //_____________________________________________________________________________
3380 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3383 // Set the debug flag and frequency
3384 // Selected debug output will be printed from
3385 // event emin to even emax each emod event
3387 fGcflag->idemin = emin;
3388 fGcflag->idemax = emax;
3389 fGcflag->itest = emod;
3393 //_____________________________________________________________________________
3394 void TGeant3::SetDRAY(Int_t par)
3397 // To control delta rays mechanism.
3398 // par =0 no delta rays.
3399 // =1 Delta rays. secondaries processed.
3400 // =2 Delta rays. No secondaries stored.
3402 fGcphys->idray = par;
3405 //_____________________________________________________________________________
3406 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3409 // To control cross section tabulations
3410 // ekmin = minimum kinetic energy in GeV
3411 // ekmax = maximum kinetic energy in GeV
3412 // nekbin = number of logatithmic bins (<200)
3414 fGcmulo->ekmin = ekmin;
3415 fGcmulo->ekmax = ekmax;
3416 fGcmulo->nekbin = nekbin;
3419 //_____________________________________________________________________________
3420 void TGeant3::SetHADR(Int_t par)
3423 // To control hadronic interactions.
3424 // par =0 no hadronic interactions.
3425 // =1 Hadronic interactions. secondaries processed.
3426 // =2 Hadronic interactions. No secondaries stored.
3428 fGcphys->ihadr = par;
3431 //_____________________________________________________________________________
3432 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3433 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3434 Float_t xk8, Float_t xk9, Float_t xk10)
3437 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3438 // Their meaning is user defined
3440 fGckine->ikine = kine;
3441 fGckine->pkine[0] = xk1;
3442 fGckine->pkine[1] = xk2;
3443 fGckine->pkine[2] = xk3;
3444 fGckine->pkine[3] = xk4;
3445 fGckine->pkine[4] = xk5;
3446 fGckine->pkine[5] = xk6;
3447 fGckine->pkine[6] = xk7;
3448 fGckine->pkine[7] = xk8;
3449 fGckine->pkine[8] = xk9;
3450 fGckine->pkine[9] = xk10;
3453 //_____________________________________________________________________________
3454 void TGeant3::SetLOSS(Int_t par)
3457 // To control energy loss.
3458 // par =0 no energy loss;
3459 // =1 restricted energy loss fluctuations;
3460 // =2 complete energy loss fluctuations;
3462 // =4 no energy loss fluctuations.
3463 // If the value ILOSS is changed, then cross-sections and energy loss
3464 // tables must be recomputed via the command 'PHYSI'.
3466 fGcphys->iloss = par;
3470 //_____________________________________________________________________________
3471 void TGeant3::SetMULS(Int_t par)
3474 // To control multiple scattering.
3475 // par =0 no multiple scattering.
3476 // =1 Moliere or Coulomb scattering.
3477 // =2 Moliere or Coulomb scattering.
3478 // =3 Gaussian scattering.
3480 fGcphys->imuls = par;
3484 //_____________________________________________________________________________
3485 void TGeant3::SetMUNU(Int_t par)
3488 // To control muon nuclear interactions.
3489 // par =0 no muon-nuclear interactions.
3490 // =1 Nuclear interactions. Secondaries processed.
3491 // =2 Nuclear interactions. Secondaries not processed.
3493 fGcphys->imunu = par;
3496 //_____________________________________________________________________________
3497 void TGeant3::SetOPTI(Int_t par)
3500 // This flag controls the tracking optimisation performed via the
3502 // 1 no optimisation at all; GSORD calls disabled;
3503 // 0 no optimisation; only user calls to GSORD kept;
3504 // 1 all non-GSORDered volumes are ordered along the best axis;
3505 // 2 all volumes are ordered along the best axis.
3507 fGcopti->ioptim = par;
3510 //_____________________________________________________________________________
3511 void TGeant3::SetPAIR(Int_t par)
3514 // To control pair production mechanism.
3515 // par =0 no pair production.
3516 // =1 Pair production. secondaries processed.
3517 // =2 Pair production. No secondaries stored.
3519 fGcphys->ipair = par;
3523 //_____________________________________________________________________________
3524 void TGeant3::SetPFIS(Int_t par)
3527 // To control photo fission mechanism.
3528 // par =0 no photo fission.
3529 // =1 Photo fission. secondaries processed.
3530 // =2 Photo fission. No secondaries stored.
3532 fGcphys->ipfis = par;
3535 //_____________________________________________________________________________
3536 void TGeant3::SetPHOT(Int_t par)
3539 // To control Photo effect.
3540 // par =0 no photo electric effect.
3541 // =1 Photo effect. Electron processed.
3542 // =2 Photo effect. No electron stored.
3544 fGcphys->iphot = par;
3547 //_____________________________________________________________________________
3548 void TGeant3::SetRAYL(Int_t par)
3551 // To control Rayleigh scattering.
3552 // par =0 no Rayleigh scattering.
3555 fGcphys->irayl = par;
3558 //_____________________________________________________________________________
3559 void TGeant3::SetSTRA(Int_t par)
3562 // To control energy loss fluctuations
3563 // with the PhotoAbsorption Ionisation model.
3564 // par =0 no Straggling.
3565 // =1 Straggling yes => no Delta rays.
3567 fGcphlt->istra = par;
3570 //_____________________________________________________________________________
3571 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3575 // val New switch value
3577 // Change one element of array ISWIT(10) in /GCFLAG/
3579 if (sw <= 0 || sw > 10) return;
3580 fGcflag->iswit[sw-1] = val;
3584 //_____________________________________________________________________________
3585 void TGeant3::SetTRIG(Int_t nevents)
3588 // Set number of events to be run
3590 fGcflag->nevent = nevents;
3593 //_____________________________________________________________________________
3594 void TGeant3::SetUserDecay(Int_t pdg)
3597 // Force the decays of particles to be done with Pythia
3598 // and not with the Geant routines.
3599 // just kill pointers doing mzdrop
3601 Int_t ipart = IdFromPDG(pdg);
3603 printf("Particle %d not in geant\n",pdg);
3606 Int_t jpart=fGclink->jpart;
3607 Int_t jpa=fZlq[jpart-ipart];
3610 Int_t jpa1=fZlq[jpa-1];
3612 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3613 Int_t jpa2=fZlq[jpa-2];
3615 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3619 //______________________________________________________________________________
3620 void TGeant3::Vname(const char *name, char *vname)
3623 // convert name to upper case. Make vname at least 4 chars
3625 Int_t l = strlen(name);
3628 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3629 for (i=l;i<4;i++) vname[i] = ' ';
3633 //______________________________________________________________________________
3634 void TGeant3::Ertrgo()
3637 // Perform the tracking of the track Track parameters are in VECT
3642 //______________________________________________________________________________
3643 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3644 const Float_t *x2, const Float_t *p2,
3645 Int_t ipa, Option_t *chopt)
3647 //************************************************************************
3649 //* Perform the tracking of the track from point X1 to *
3651 //* (Before calling this routine the user should also provide *
3652 //* the input informations in /EROPTS/ and /ERTRIO/ *
3653 //* using subroutine EUFIL(L/P/V) *
3654 //* X1 - Starting coordinates (Cartesian) *
3655 //* P1 - Starting 3-momentum (Cartesian) *
3656 //* X2 - Final coordinates (Cartesian) *
3657 //* P2 - Final 3-momentum (Cartesian) *
3658 //* IPA - Particle code (a la GEANT) of the track *
3661 //* 'B' 'Backward tracking' - i.e. energy loss *
3662 //* added to the current energy *
3663 //* 'E' 'Exact' calculation of errors assuming *
3664 //* helix (i.e. pathlength not *
3665 //* assumed as infinitesimal) *
3666 //* 'L' Tracking upto prescribed Lengths reached *
3667 //* 'M' 'Mixed' prediction (not yet coded) *
3668 //* 'O' Tracking 'Only' without calculating errors *
3669 //* 'P' Tracking upto prescribed Planes reached *
3670 //* 'V' Tracking upto prescribed Volumes reached *
3671 //* 'X' Tracking upto prescribed Point approached *
3673 //* Interface with GEANT : *
3674 //* Track parameters are in /CGKINE/ and /GCTRAK/ *
3676 //* ==>Called by : USER *
3677 //* Authors M.Maire, E.Nagy ********//* *
3679 //************************************************************************
3680 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3683 //_____________________________________________________________________________
3684 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3685 Int_t number, Int_t nlevel)
3689 // ******************************************************************
3691 // * Write out the geometry of the detector in EUCLID file format *
3693 // * filnam : will be with the extension .euc *
3694 // * topvol : volume name of the starting node *
3695 // * number : copy number of topvol (relevant for gsposp) *
3696 // * nlevel : number of levels in the tree structure *
3697 // * to be written out, starting from topvol *
3699 // * Author : M. Maire *
3701 // ******************************************************************
3703 // File filnam.tme is written out with the definitions of tracking
3704 // medias and materials.
3705 // As to restore original numbers for materials and medias, program
3706 // searches in the file euc_medi.dat and comparing main parameters of
3707 // the mat. defined inside geant and the one in file recognizes them
3708 // and is able to take number from file. If for any material or medium,
3709 // this procedure fails, ordering starts from 1.
3710 // Arrays IOTMED and IOMATE are used for this procedure
3712 const char kShape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3713 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3715 Int_t i, end, itm, irm, jrm, k, nmed;
3719 char *filext, *filetme;
3720 char natmed[21], namate[21];
3721 char natmedc[21], namatec[21];
3722 char key[5], name[5], mother[5], konly[5];
3724 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3725 Int_t mlevel, numbr, natt, numed, nin, ndata;
3726 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3727 Int_t jdiv, ivin, in, jin, jvin, irot;
3728 Int_t jtm, imat, jma, flag=0, imatc;
3729 Float_t az, dens, radl, absl, a, step, x, y, z;
3730 Int_t npar, ndvmx, left;
3731 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3733 Int_t iomate[100], iotmed[100];
3734 Float_t par[50], att[20], ubuf[50];
3737 Int_t level, ndiv, iaxe;
3738 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3739 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3740 Float_t tmaxf, stemax, deemax, epsil, stmin;
3741 const char *k10000="!\n%s\n!\n";
3742 //Open the input file
3744 for(i=0;i<end;i++) if(filnam[i]=='.') {
3748 filext=new char[end+5];
3749 filetme=new char[end+5];
3750 strncpy(filext,filnam,end);
3751 strncpy(filetme,filnam,end);
3753 // *** The output filnam name will be with extension '.euc'
3754 strcpy(&filext[end],".euc");
3755 strcpy(&filetme[end],".tme");
3756 lun=fopen(filext,"w");
3758 // *** Initialisation of the working space
3759 iadvol=fGcnum->nvolum;
3760 iadtmd=iadvol+fGcnum->nvolum;
3761 iadrot=iadtmd+fGcnum->ntmed;
3762 if(fGclink->jrotm) {
3763 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3767 nwtot=iadrot+fGcnum->nrotm;
3768 qws = new float[nwtot+1];
3769 for (i=0;i<nwtot+1;i++) qws[i]=0;
3772 if(nlevel==0) mlevel=20;
3774 // *** find the top volume and put it in the stak
3775 numbr = number>0 ? number : 1;
3776 Gfpara(topvol,numbr,1,npar,natt,par,att);
3778 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3783 // *** authorized shape ?
3784 strncpy((char *)&iname, topvol, 4);
3786 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3790 jvo = fZlq[fGclink->jvolum-ivo];
3791 ish = Int_t (fZq[jvo+2]);
3793 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3800 iws[iadvol+ivo] = level;
3803 //*** flag all volumes and fill the stak
3807 // pick the next volume in stak
3809 ivo = TMath::Abs(iws[ivstak]);
3810 jvo = fZlq[fGclink->jvolum - ivo];
3812 // flag the tracking medium
3813 numed = Int_t (fZq[jvo + 4]);
3814 iws[iadtmd + numed] = 1;
3816 // get the daughters ...
3817 level = iws[iadvol+ivo];
3818 if (level < mlevel) {
3820 nin = Int_t (fZq[jvo + 3]);
3822 // from division ...
3824 jdiv = fZlq[jvo - 1];
3825 ivin = Int_t (fZq[jdiv + 2]);
3827 iws[nvstak] = -ivin;
3828 iws[iadvol+ivin] = level;
3830 // from position ...
3831 } else if (nin > 0) {
3832 for(in=1; in<=nin; in++) {
3833 jin = fZlq[jvo - in];
3834 ivin = Int_t (fZq[jin + 2 ]);
3835 jvin = fZlq[fGclink->jvolum - ivin];
3836 ish = Int_t (fZq[jvin + 2]);
3837 // authorized shape ?
3839 // not yet flagged ?
3840 if (iws[iadvol+ivin]==0) {
3843 iws[iadvol+ivin] = level;
3845 // flag the rotation matrix
3846 irot = Int_t ( fZq[jin + 4 ]);
3847 if (irot > 0) iws[iadrot+irot] = 1;
3853 // next volume in stak ?
3854 if (ivstak < nvstak) goto L10;
3856 // *** restore original material and media numbers
3857 // file euc_medi.dat is needed to compare materials and medias
3859 FILE* luncor=fopen("euc_medi.dat","r");
3862 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3863 if (iws[iadtmd+itm] > 0) {
3864 jtm = fZlq[fGclink->jtmed-itm];
3865 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3866 imat = Int_t (fZq[jtm+6]);
3867 jma = fZlq[fGclink->jmate-imat];
3869 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3872 strncpy(namate,(char *)&fZiq[jma+1],20);
3875 //** find the material original number
3878 iret=fscanf(luncor,"%4s,%130s",key,card);
3879 if(iret<=0) goto L26;
3881 if(!strcmp(key,"MATE")) {
3882 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3883 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3884 if(!strcmp(namatec,namate)) {
3885 if(az==a && zc==z && densc==dens && radlc==radl
3886 && abslc==absl && nparc==nparc) {
3889 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3891 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3895 if(strcmp(key,"END") && !flag) goto L23;
3897 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3901 //*** restore original tracking medium number
3904 iret=fscanf(luncor,"%4s,%130s",key,card);
3905 if(iret<=0) goto L26;
3907 if (!strcmp(key,"TMED")) {
3908 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3909 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3910 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3911 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3912 epsil,stmin,ubuf,&nwbuf);
3913 if(!strcmp(natmedc,natmed)) {
3914 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3917 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3920 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3924 if(strcmp(key,"END") && !flag) goto L24;
3926 printf("cannot restore original number for medium : %s\n",natmed);
3934 L26: printf("*** GWEUCL *** cannot read the data file\n");
3936 L29: if(luncor) fclose (luncor);
3939 // *** write down the tracking medium definition
3941 strcpy(card,"! Tracking medium");
3942 fprintf(lun,k10000,card);
3944 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3945 if (iws[iadtmd+itm]>0) {
3946 jtm = fZlq[fGclink->jtmed-itm];
3947 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3949 imat = Int_t (fZq[jtm+6]);
3950 jma = fZlq[fGclink->jmate-imat];
3951 //* order media from one, if comparing with database failed
3953 iotmed[itm]=++imxtmed;
3954 iomate[imat]=++imxmate;
3959 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3962 strncpy(namate,(char *)&fZiq[jma+1],20);
3965 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3969 //* *** write down the rotation matrix
3971 strcpy(card,"! Reperes");
3972 fprintf(lun,k10000,card);
3974 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3975 if (iws[iadrot+irm]>0) {
3976 jrm = fZlq[fGclink->jrotm-irm];
3977 fprintf(lun,"ROTM %3d",irm);
3978 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3983 //* *** write down the volume definition
3985 strcpy(card,"! Volumes");
3986 fprintf(lun,k10000,card);
3988 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3991 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3993 jvo = fZlq[fGclink->jvolum-ivo];
3994 ish = Int_t (fZq[jvo+2]);
3995 nmed = Int_t (fZq[jvo+4]);
3996 npar = Int_t (fZq[jvo+5]);
3998 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3999 Gckpar (ish,npar,par);
4000 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],iotmed[nmed],npar);
4001 for(i=0;i<(npar-1)/6+1;i++) {
4004 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
4008 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],iotmed[nmed],npar);
4013 //* *** write down the division of volumes
4015 fprintf(lun,k10000,"! Divisions");
4016 for(ivstak=1;ivstak<=nvstak;ivstak++) {
4017 ivo = TMath::Abs(iws[ivstak]);
4018 jvo = fZlq[fGclink->jvolum-ivo];
4019 ish = Int_t (fZq[jvo+2]);
4020 nin = Int_t (fZq[jvo+3]);
4021 //* this volume is divided ...
4024 iaxe = Int_t ( fZq[jdiv+1]);
4025 ivin = Int_t ( fZq[jdiv+2]);
4026 ndiv = Int_t ( fZq[jdiv+3]);
4029 jvin = fZlq[fGclink->jvolum-ivin];
4030 nmed = Int_t ( fZq[jvin+4]);
4031 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
4033 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
4035 if ((step<=0.)||(ish>=11)) {
4036 //* volume with negative parameter or gsposp or pgon ...
4037 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
4038 } else if ((ndiv<=0)||(ish==10)) {
4039 //* volume with negative parameter or gsposp or para ...
4040 ndvmx = TMath::Abs(ndiv);
4041 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
4042 name,mother,step,iaxe,iotmed[nmed],ndvmx);
4044 //* normal volume : all kind of division are equivalent
4045 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
4046 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
4051 //* *** write down the the positionnement of volumes
4053 fprintf(lun,k10000,"! Positionnements\n");
4055 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
4056 ivo = TMath::Abs(iws[ivstak]);
4057 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
4059 jvo = fZlq[fGclink->jvolum-ivo];
4060 nin = Int_t( fZq[jvo+3]);
4061 //* this volume has daughters ...
4063 for (in=1;in<=nin;in++) {
4065 ivin = Int_t (fZq[jin +2]);
4066 numb = Int_t (fZq[jin +3]);
4067 irot = Int_t (fZq[jin +4]);
4071 strcpy(konly,"ONLY");
4072 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
4073 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
4075 jvin = fZlq[fGclink->jvolum-ivin];
4076 ish = Int_t (fZq[jvin+2]);
4077 //* gspos or gsposp ?
4078 ndata = fZiq[jin-1];
4080 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
4081 name,numb,mother,x,y,z,irot,konly);
4083 npar = Int_t (fZq[jin+9]);
4084 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
4085 Gckpar (ish,npar,par);
4086 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
4087 name,numb,mother,x,y,z,irot,konly,npar);
4089 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4096 fprintf(lun,"END\n");
4099 //****** write down the materials and medias *****
4101 lun=fopen(filetme,"w");
4103 for(itm=1;itm<=fGcnum->ntmed;itm++) {
4104 if (iws[iadtmd+itm]>0) {
4105 jtm = fZlq[fGclink->jtmed-itm];
4106 strncpy(natmed,(char*)&fZiq[jtm+1],4);
4107 imat = Int_t (fZq[jtm+6]);
4108 jma = Int_t (fZlq[fGclink->jmate-imat]);
4110 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
4111 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
4112 iomate[imat],namate,a,z,dens,radl,absl,npar);
4116 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4120 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
4121 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
4122 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
4123 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
4127 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4133 fprintf(lun,"END\n");
4135 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
4136 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
4145 //_____________________________________________________________________________
4146 void TGeant3::Streamer(TBuffer &R__b)
4149 // Stream an object of class TGeant3.
4151 if (R__b.IsReading()) {
4152 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
4153 AliMC::Streamer(R__b);
4156 R__b.ReadStaticArray(fPDGCode);
4158 R__b.WriteVersion(TGeant3::IsA());
4159 AliMC::Streamer(R__b);
4162 R__b.WriteArray(fPDGCode, fNPDGCodes);