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.29 2000/07/11 18:24:59 fca
19 Coding convention corrections + few minor bug fixes
21 Revision 1.28 2000/06/29 10:51:55 morsch
22 Add some charmed and bottom baryons to the particle list (TDatabasePDG). This
23 is needed by Hijing. Should be part of a future review of TDatabasePDG.
25 Revision 1.27 2000/06/21 17:40:15 fca
26 Adding possibility to set ISTRA, PAI model
28 Revision 1.26 2000/05/16 13:10:41 fca
29 New method IsNewTrack and fix for a problem in Father-Daughter relations
31 Revision 1.25 2000/04/07 11:12:35 fca
32 G4 compatibility changes
34 Revision 1.24 2000/02/28 21:03:57 fca
35 Some additions to improve the compatibility with G4
37 Revision 1.23 2000/02/23 16:25:25 fca
38 AliVMC and AliGeant3 classes introduced
39 ReadEuclid moved from AliRun to AliModule
41 Revision 1.22 2000/01/18 15:40:13 morsch
42 Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
43 Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
45 Revision 1.21 2000/01/17 19:41:17 fca
48 Revision 1.20 2000/01/12 11:29:27 fca
51 Revision 1.19 1999/12/17 09:03:12 fca
52 Introduce a names array
54 Revision 1.18 1999/11/26 16:55:39 fca
55 Reimplement CurrentVolName() to avoid memory leaks
57 Revision 1.17 1999/11/03 16:58:28 fca
58 Correct source of address violation in creating character string
60 Revision 1.16 1999/11/03 13:17:08 fca
61 Have ProdProcess return const char*
63 Revision 1.15 1999/10/26 06:04:50 fca
64 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
66 Revision 1.14 1999/09/29 09:24:30 fca
67 Introduction of the Copyright and cvs Log
71 ///////////////////////////////////////////////////////////////////////////////
73 // Interface Class to the Geant3.21 MonteCarlo //
77 <img src="picts/TGeant3Class.gif">
82 ///////////////////////////////////////////////////////////////////////////////
88 #include <TDatabasePDG.h>
89 #include "AliCallf77.h"
92 # define gzebra gzebra_
93 # define grfile grfile_
94 # define gpcxyz gpcxyz_
95 # define ggclos ggclos_
98 # define gcinit gcinit_
100 # define gtrig gtrig_
101 # define gtrigc gtrigc_
102 # define gtrigi gtrigi_
103 # define gwork gwork_
104 # define gzinit gzinit_
105 # define gfmate gfmate_
106 # define gfpart gfpart_
107 # define gftmed gftmed_
108 # define gftmat gftmat_
109 # define gmate gmate_
110 # define gpart gpart_
112 # define gsmate gsmate_
113 # define gsmixt gsmixt_
114 # define gspart gspart_
115 # define gstmed gstmed_
116 # define gsckov gsckov_
117 # define gstpar gstpar_
118 # define gfkine gfkine_
119 # define gfvert gfvert_
120 # define gskine gskine_
121 # define gsvert gsvert_
122 # define gphysi gphysi_
123 # define gdebug gdebug_
124 # define gekbin gekbin_
125 # define gfinds gfinds_
126 # define gsking gsking_
127 # define gskpho gskpho_
128 # define gsstak gsstak_
129 # define gsxyz gsxyz_
130 # define gtrack gtrack_
131 # define gtreve gtreve_
132 # define gtreveroot gtreveroot_
133 # define grndm grndm_
134 # define grndmq grndmq_
135 # define gdtom gdtom_
136 # define glmoth glmoth_
137 # define gmedia gmedia_
138 # define gmtod gmtod_
139 # define gsdvn gsdvn_
140 # define gsdvn2 gsdvn2_
141 # define gsdvs gsdvs_
142 # define gsdvs2 gsdvs2_
143 # define gsdvt gsdvt_
144 # define gsdvt2 gsdvt2_
145 # define gsord gsord_
146 # define gspos gspos_
147 # define gsposp gsposp_
148 # define gsrotm gsrotm_
149 # define gprotm gprotm_
150 # define gsvolu gsvolu_
151 # define gprint gprint_
152 # define gdinit gdinit_
153 # define gdopt gdopt_
154 # define gdraw gdraw_
155 # define gdrayt gdrayt_
156 # define gdrawc gdrawc_
157 # define gdrawx gdrawx_
158 # define gdhead gdhead_
159 # define gdwmn1 gdwmn1_
160 # define gdwmn2 gdwmn2_
161 # define gdwmn3 gdwmn3_
162 # define gdxyz gdxyz_
163 # define gdcxyz gdcxyz_
164 # define gdman gdman_
165 # define gdspec gdspec_
166 # define gdtree gdtree_
167 # define gdelet gdelet_
168 # define gdclos gdclos_
169 # define gdshow gdshow_
170 # define gdopen gdopen_
171 # define dzshow dzshow_
172 # define gsatt gsatt_
173 # define gfpara gfpara_
174 # define gckpar gckpar_
175 # define gckmat gckmat_
176 # define geditv geditv_
177 # define mzdrop mzdrop_
179 # define ertrak ertrak_
180 # define ertrgo ertrgo_
182 # define setbomb setbomb_
183 # define setclip setclip_
184 # define gcomad gcomad_
186 # define gbrelm gbrelm_
187 # define gprelm gprelm_
189 # define gzebra GZEBRA
190 # define grfile GRFILE
191 # define gpcxyz GPCXYZ
192 # define ggclos GGCLOS
195 # define gcinit GCINIT
198 # define gtrigc GTRIGC
199 # define gtrigi GTRIGI
201 # define gzinit GZINIT
202 # define gfmate GFMATE
203 # define gfpart GFPART
204 # define gftmed GFTMED
205 # define gftmat GFTMAT
209 # define gsmate GSMATE
210 # define gsmixt GSMIXT
211 # define gspart GSPART
212 # define gstmed GSTMED
213 # define gsckov GSCKOV
214 # define gstpar GSTPAR
215 # define gfkine GFKINE
216 # define gfvert GFVERT
217 # define gskine GSKINE
218 # define gsvert GSVERT
219 # define gphysi GPHYSI
220 # define gdebug GDEBUG
221 # define gekbin GEKBIN
222 # define gfinds GFINDS
223 # define gsking GSKING
224 # define gskpho GSKPHO
225 # define gsstak GSSTAK
227 # define gtrack GTRACK
228 # define gtreve GTREVE
229 # define gtreveroot GTREVEROOT
231 # define grndmq GRNDMQ
233 # define glmoth GLMOTH
234 # define gmedia GMEDIA
237 # define gsdvn2 GSDVN2
239 # define gsdvs2 GSDVS2
241 # define gsdvt2 GSDVT2
244 # define gsposp GSPOSP
245 # define gsrotm GSROTM
246 # define gprotm GPROTM
247 # define gsvolu GSVOLU
248 # define gprint GPRINT
249 # define gdinit GDINIT
252 # define gdrayt GDRAYT
253 # define gdrawc GDRAWC
254 # define gdrawx GDRAWX
255 # define gdhead GDHEAD
256 # define gdwmn1 GDWMN1
257 # define gdwmn2 GDWMN2
258 # define gdwmn3 GDWMN3
260 # define gdcxyz GDCXYZ
262 # define gdfspc GDFSPC
263 # define gdspec GDSPEC
264 # define gdtree GDTREE
265 # define gdelet GDELET
266 # define gdclos GDCLOS
267 # define gdshow GDSHOW
268 # define gdopen GDOPEN
269 # define dzshow DZSHOW
271 # define gfpara GFPARA
272 # define gckpar GCKPAR
273 # define gckmat GCKMAT
274 # define geditv GEDITV
275 # define mzdrop MZDROP
277 # define ertrak ERTRAK
278 # define ertrgo ERTRGO
280 # define setbomb SETBOMB
281 # define setclip SETCLIP
282 # define gcomad GCOMAD
284 # define gbrelm GBRELM
285 # define gprelm GPRELM
289 //____________________________________________________________________________
293 // Prototypes for GEANT functions
295 void type_of_call gzebra(const int&);
297 void type_of_call gpcxyz();
299 void type_of_call ggclos();
301 void type_of_call glast();
303 void type_of_call ginit();
305 void type_of_call gcinit();
307 void type_of_call grun();
309 void type_of_call gtrig();
311 void type_of_call gtrigc();
313 void type_of_call gtrigi();
315 void type_of_call gwork(const int&);
317 void type_of_call gzinit();
319 void type_of_call gmate();
321 void type_of_call gpart();
323 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
325 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
326 Int_t &, Float_t *, Int_t &);
328 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
329 Float_t &, Float_t *, Int_t &);
331 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
334 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
337 void type_of_call gphysi();
339 void type_of_call gdebug();
341 void type_of_call gekbin();
343 void type_of_call gfinds();
345 void type_of_call gsking(Int_t &);
347 void type_of_call gskpho(Int_t &);
349 void type_of_call gsstak(Int_t &);
351 void type_of_call gsxyz();
353 void type_of_call gtrack();
355 void type_of_call gtreve();
357 void type_of_call gtreveroot();
359 void type_of_call grndm(Float_t *, const Int_t &);
361 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
364 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
366 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
367 Int_t *, Int_t * DEFCHARL);
369 void type_of_call gmedia(Float_t *, Int_t &);
371 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
373 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
374 const Float_t &, const Float_t &, const Float_t &,
377 void type_of_call gprotm(const Int_t &);
379 void type_of_call grfile(const Int_t&, DEFCHARD,
380 DEFCHARD DEFCHARL DEFCHARL);
382 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
383 Float_t &, Float_t &, Float_t &, Float_t *,
386 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
387 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
389 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
390 Float_t &, Float_t &, Float_t &, Float_t &,
391 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
393 void type_of_call gftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
395 ,Float_t *, Int_t & DEFCHARL);
397 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
398 Float_t &, Float_t &, Float_t &, Float_t *,
401 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
402 Float_t &, Int_t &, Float_t * DEFCHARL);
404 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
405 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
408 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
409 Float_t &, Float_t &, Float_t &, Float_t &,
410 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
412 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
413 Float_t *absco, Float_t *effic, Float_t *rindex);
414 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
416 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
419 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
420 Int_t & DEFCHARL DEFCHARL);
422 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
425 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
426 Int_t & DEFCHARL DEFCHARL);
428 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
429 Int_t & DEFCHARL DEFCHARL);
431 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
432 Int_t &, Int_t & DEFCHARL DEFCHARL);
434 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
436 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
437 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
440 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
441 Float_t &, Int_t &, DEFCHARD,
442 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
444 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
445 Int_t & DEFCHARL DEFCHARL);
447 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
449 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
452 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
454 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
456 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
458 void type_of_call gdinit();
460 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
462 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
463 Float_t &, Float_t &, Float_t & DEFCHARL);
464 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
465 Float_t &, Float_t &, Float_t & DEFCHARL);
466 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
467 Float_t &, Float_t & DEFCHARL);
468 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
469 Float_t &, Float_t &, Float_t &, Float_t &,
471 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
472 void type_of_call gdxyz(Int_t &);
473 void type_of_call gdcxyz();
474 void type_of_call gdman(Float_t &, Float_t &);
475 void type_of_call gdwmn1(Float_t &, Float_t &);
476 void type_of_call gdwmn2(Float_t &, Float_t &);
477 void type_of_call gdwmn3(Float_t &, Float_t &);
478 void type_of_call gdspec(DEFCHARD DEFCHARL);
479 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
480 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
482 void type_of_call gdopen(Int_t &);
483 void type_of_call gdclos();
484 void type_of_call gdelet(Int_t &);
485 void type_of_call gdshow(Int_t &);
486 void type_of_call geditv(Int_t &) {;}
489 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
490 const int&, const int&, const int& DEFCHARL
493 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
495 void type_of_call setbomb(Float_t &);
496 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
497 Float_t &, Float_t & DEFCHARL);
498 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
500 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
501 const Float_t *x2, const Float_t *p2,
502 const Int_t &ipa, DEFCHARD DEFCHARL);
504 void type_of_call ertrgo();
506 float type_of_call gbrelm(const Float_t &z, const Float_t& t, const Float_t& cut);
507 float type_of_call gprelm(const Float_t &z, const Float_t& t, const Float_t& cut);
511 // Geant3 global pointer
513 static Int_t defSize = 600;
517 //____________________________________________________________________________
521 // Default constructor
525 //____________________________________________________________________________
526 TGeant3::TGeant3(const char *title, Int_t nwgeant)
527 :AliMC("TGeant3",title)
530 // Standard constructor for TGeant3 with ZEBRA initialisation
541 // Load Address of Geant3 commons
544 // Zero number of particles
548 //____________________________________________________________________________
549 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
550 Float_t &radl, Float_t &absl) const
553 // Return the parameters of the current material during transport
557 dens = fGcmate->dens;
558 radl = fGcmate->radl;
559 absl = fGcmate->absl;
560 return 1; //this could be the number of elements in mixture
563 //____________________________________________________________________________
564 void TGeant3::DefaultRange()
567 // Set range of current drawing pad to 20x20 cm
573 gHigz->Range(0,0,20,20);
576 //____________________________________________________________________________
577 void TGeant3::InitHIGZ()
588 //____________________________________________________________________________
589 void TGeant3::LoadAddress()
592 // Assigns the address of the GEANT common blocks to the structures
593 // that allow their access from C++
596 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
597 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
598 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
599 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
600 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
601 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
602 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
603 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
604 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
605 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
606 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
607 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
608 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
609 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
610 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
611 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
612 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
613 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
614 gcomad(PASSCHARD("GCPHLT"),(int*&) fGcphlt PASSCHARL("GCPHLT"));
615 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
616 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
617 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
620 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
621 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
622 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
623 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
625 // Variables for ZEBRA store
626 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
628 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
633 //_____________________________________________________________________________
634 void TGeant3::GeomIter()
637 // Geometry iterator for moving upward in the geometry tree
638 // Initialise the iterator
640 fNextVol=fGcvolu->nlevel;
643 //____________________________________________________________________________
644 void TGeant3::FinishGeometry()
646 //Close the geometry structure
650 //____________________________________________________________________________
651 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
654 // Geometry iterator for moving upward in the geometry tree
655 // Return next volume up
660 gname=fGcvolu->names[fNextVol];
661 copy=fGcvolu->number[fNextVol];
662 i=fGcvolu->lvolum[fNextVol];
663 name = fVolNames[i-1];
664 if(gname == fZiq[fGclink->jvolum+i]) return i;
665 else printf("GeomTree: Volume %s not found in bank\n",name);
670 //_____________________________________________________________________________
671 void TGeant3::BuildPhysics()
676 //_____________________________________________________________________________
677 Int_t TGeant3::CurrentVolID(Int_t ©) const
680 // Returns the current volume ID and copy number
683 if( (i=fGcvolu->nlevel-1) < 0 ) {
684 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
686 gname=fGcvolu->names[i];
687 copy=fGcvolu->number[i];
688 i=fGcvolu->lvolum[i];
689 if(gname == fZiq[fGclink->jvolum+i]) return i;
690 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
695 //_____________________________________________________________________________
696 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
699 // Return the current volume "off" upward in the geometrical tree
700 // ID and copy number
703 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
704 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
705 off,fGcvolu->nlevel);
707 gname=fGcvolu->names[i];
708 copy=fGcvolu->number[i];
709 i=fGcvolu->lvolum[i];
710 if(gname == fZiq[fGclink->jvolum+i]) return i;
711 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
716 //_____________________________________________________________________________
717 const char* TGeant3::CurrentVolName() const
720 // Returns the current volume name
723 if( (i=fGcvolu->nlevel-1) < 0 ) {
724 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
726 gname=fGcvolu->names[i];
727 i=fGcvolu->lvolum[i];
728 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
729 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
734 //_____________________________________________________________________________
735 const char* TGeant3::CurrentVolOffName(Int_t off) const
738 // Return the current volume "off" upward in the geometrical tree
739 // ID, name and copy number
740 // if name=0 no name is returned
743 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
744 Warning("CurrentVolOffName",
745 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
747 gname=fGcvolu->names[i];
748 i=fGcvolu->lvolum[i];
749 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
750 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
755 //_____________________________________________________________________________
756 Int_t TGeant3::IdFromPDG(Int_t pdg) const
759 // Return Geant3 code from PDG and pseudo ENDF code
761 for(Int_t i=0;i<fNPDGCodes;++i)
762 if(pdg==fPDGCode[i]) return i;
766 //_____________________________________________________________________________
767 Int_t TGeant3::PDGFromId(Int_t id) const
769 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
773 //_____________________________________________________________________________
774 void TGeant3::DefineParticles()
777 // Define standard Geant 3 particles
780 // Load standard numbers for GEANT particles and PDG conversion
781 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
782 fPDGCode[fNPDGCodes++]=22; // 1 = photon
783 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
784 fPDGCode[fNPDGCodes++]=11; // 3 = electron
785 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
786 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
787 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
788 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
789 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
790 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
791 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
792 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
793 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
794 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
795 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
796 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
797 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
798 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
799 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
800 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
801 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
802 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
803 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
804 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
805 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
806 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
807 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
808 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
809 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
810 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
811 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
812 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
813 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
820 /* --- Define additional particles */
821 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
822 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
824 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
825 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
827 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
828 fPDGCode[fNPDGCodes++]=411; // 35 = D+
830 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
831 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
833 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
834 fPDGCode[fNPDGCodes++]=421; // 37 = D0
836 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
837 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
839 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
841 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
843 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
845 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
846 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
848 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
849 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
851 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
852 fPDGCode[fNPDGCodes++]=113; // 37 = D0
855 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
857 // and numbers above 5 000 000 for special applications
860 const Int_t kion=10000000;
862 const Int_t kspe=50000000;
864 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
866 const Double_t autogev=0.9314943228;
867 const Double_t hslash = 1.0545726663e-27;
868 const Double_t erggev = 1/1.6021773349e-3;
869 const Double_t hshgev = hslash*erggev;
870 const Double_t yearstosec = 3600*24*365.25;
873 // mass and life-time from PDG
874 pdgDB->AddParticle("B(s)*0","B(s)*0",
875 5.4163, kTRUE, 0.047, +0.,"Meson", 533);
877 pdgDB->AddParticle("B(s)*0 bar","B(s)*0 bar",
878 5.4163, kTRUE, 0.047, -0.,"Meson", -533);
882 // value for mass used by Hijing
883 pdgDB->AddParticle("Sigma(c)*+","Sigma(c)*+",
884 2.4536, kTRUE, -1., +1.,"Baryon", 4214);
886 pdgDB->AddParticle("Sigma(c)*-","Sigma(c)*-",
887 2.4536, kTRUE, -1., -1.,"Baryon", -4214);
888 // equivalent to 4312 ? Hijing uses m=2.55
889 pdgDB->AddParticle("Xsi(c)0","Xsi(c)0",
890 2.4703, kTRUE, -1., +0.,"Baryon", 4132);
892 pdgDB->AddParticle("Xsi(c)0 bar","Xsi(c)0 bar",
893 2.4703, kTRUE, -1., -0.,"Baryon", -4132);
894 // equivalent to 4322 ? Hijing uses m=2.55
895 pdgDB->AddParticle("Xi(c)+","Xi(c)+",
896 2.4656, kFALSE, -1., +1.,"Baryon", 4232);
898 pdgDB->AddParticle("Xi(c)-","Xi(c)-",
899 2.4656, kFALSE, -1., -1.,"Baryon", -4232);
900 // mass values from Hijing
902 pdgDB->AddParticle("Xsi(c)*0","Xsi(c)*0",
903 2.63, kTRUE, -1., +0.,"Baryon", 4314);
905 pdgDB->AddParticle("Xsi(c)*0 bar","Xsi(c)*0 bar",
906 2.63, kTRUE, -1., -0.,"Baryon", -4314);
908 pdgDB->AddParticle("Xsi(c)*+","Xsi(c)*+",
909 2.63, kTRUE, -1., +1.,"Baryon", 4324);
911 pdgDB->AddParticle("Xsi(c)*-","Xsi(c)*-",
912 2.63, kTRUE, -1., -1.,"Baryon", -4324);
914 // pdg mass value, Hijing uses m=2.73.
915 pdgDB->AddParticle("Omega(c)0","Omega(c)0",
916 2.7040, kFALSE, hshgev/0.064e-12, +0.,"Baryon", 4332);
918 pdgDB->AddParticle("Omega(c)0 bar","Omega(c)0 bar",
919 2.7040, kFALSE, hshgev/0.064e-12, -0.,"Baryon", -4332);
920 // mass value from Hijing
921 pdgDB->AddParticle("Omega(c)*0","Omega(c)*0",
922 2.8000, kFALSE, -1., +0.,"Baryon", 4334);
924 pdgDB->AddParticle("Omega(c)*0 bar","Omega(c)*0",
925 2.8000, kFALSE, -1., -0.,"Baryon", -4334);
929 // mass value from Hijing
930 pdgDB->AddParticle("Sigma(b)*+","Sigma(b)*+",
931 5.8100, kFALSE, -1., +1.,"Baryon", 5224);
933 pdgDB->AddParticle("Sigma(b)*-","Sigma(b)*-",
934 5.8100, kFALSE, -1., -1.,"Baryon", -5224);
938 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
939 0,1,"Ion",kion+10020);
940 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
942 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
943 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
944 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
946 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
947 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
948 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
950 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
952 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
953 0,2,"Ion",kion+20030);
954 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
956 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
957 0,0,"Special",kspe+50);
958 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
960 Gspart(51, "FeedbackPhoton", 7, 0., 0.,1.e20 );
961 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
962 0,0,"Special",kspe+51);
963 fPDGCode[fNPDGCodes++]=kspe+51; // 51 = FeedbackPhoton
965 /* --- Define additional decay modes --- */
966 /* --- omega(783) --- */
967 for (kz = 0; kz < 6; ++kz) {
978 Gsdk(ipa, bratio, mode);
979 /* --- phi(1020) --- */
980 for (kz = 0; kz < 6; ++kz) {
995 Gsdk(ipa, bratio, mode);
997 for (kz = 0; kz < 6; ++kz) {
1010 Gsdk(ipa, bratio, mode);
1012 for (kz = 0; kz < 6; ++kz) {
1025 Gsdk(ipa, bratio, mode);
1027 for (kz = 0; kz < 6; ++kz) {
1038 Gsdk(ipa, bratio, mode);
1039 /* --- Anti D0 --- */
1040 for (kz = 0; kz < 6; ++kz) {
1051 Gsdk(ipa, bratio, mode);
1053 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);
1081 for (kz = 0; kz < 6; ++kz) {
1090 Gsdk(ipa, bratio, mode);
1093 Gsdk(ipa, bratio, mode);
1096 Gsdk(ipa, bratio, mode);
1101 //_____________________________________________________________________________
1102 Int_t TGeant3::VolId(const Text_t *name) const
1105 // Return the unique numeric identifier for volume name
1108 strncpy((char *) &gname, name, 4);
1109 for(i=1; i<=fGcnum->nvolum; i++)
1110 if(gname == fZiq[fGclink->jvolum+i]) return i;
1111 printf("VolId: Volume %s not found\n",name);
1115 //_____________________________________________________________________________
1116 Int_t TGeant3::NofVolumes() const
1119 // Return total number of volumes in the geometry
1121 return fGcnum->nvolum;
1124 //_____________________________________________________________________________
1125 const char* TGeant3::VolName(Int_t id) const
1128 // Return the volume name given the volume identifier
1130 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1131 return fVolNames[fGcnum->nvolum];
1133 return fVolNames[id-1];
1136 //_____________________________________________________________________________
1137 void TGeant3::SetCut(const char* cutName, Float_t cutValue)
1139 if(!strcmp(cutName,"CUTGAM"))
1140 fGccuts->cutgam=cutValue;
1141 else if(!strcmp(cutName,"CUTGAM"))
1142 fGccuts->cutele=cutValue;
1143 else if(!strcmp(cutName,"CUTELE"))
1144 fGccuts->cutneu=cutValue;
1145 else if(!strcmp(cutName,"CUTHAD"))
1146 fGccuts->cuthad=cutValue;
1147 else if(!strcmp(cutName,"CUTMUO"))
1148 fGccuts->cutmuo=cutValue;
1149 else if(!strcmp(cutName,"BCUTE"))
1150 fGccuts->bcute=cutValue;
1151 else if(!strcmp(cutName,"BCUTM"))
1152 fGccuts->bcutm=cutValue;
1153 else if(!strcmp(cutName,"DCUTE"))
1154 fGccuts->dcute=cutValue;
1155 else if(!strcmp(cutName,"DCUTM"))
1156 fGccuts->dcutm=cutValue;
1157 else if(!strcmp(cutName,"PPCUTM"))
1158 fGccuts->ppcutm=cutValue;
1159 else if(!strcmp(cutName,"TOFMAX"))
1160 fGccuts->tofmax=cutValue;
1161 else Warning("SetCut","Cut %s not implemented\n",cutName);
1164 //_____________________________________________________________________________
1165 void TGeant3::SetProcess(const char* flagName, Int_t flagValue)
1167 if(!strcmp(flagName,"PAIR"))
1168 fGcphys->ipair=flagValue;
1169 else if(!strcmp(flagName,"COMP"))
1170 fGcphys->icomp=flagValue;
1171 else if(!strcmp(flagName,"PHOT"))
1172 fGcphys->iphot=flagValue;
1173 else if(!strcmp(flagName,"PFIS"))
1174 fGcphys->ipfis=flagValue;
1175 else if(!strcmp(flagName,"DRAY"))
1176 fGcphys->idray=flagValue;
1177 else if(!strcmp(flagName,"ANNI"))
1178 fGcphys->ianni=flagValue;
1179 else if(!strcmp(flagName,"BREM"))
1180 fGcphys->ibrem=flagValue;
1181 else if(!strcmp(flagName,"HADR"))
1182 fGcphys->ihadr=flagValue;
1183 else if(!strcmp(flagName,"MUNU"))
1184 fGcphys->imunu=flagValue;
1185 else if(!strcmp(flagName,"DCAY"))
1186 fGcphys->idcay=flagValue;
1187 else if(!strcmp(flagName,"LOSS"))
1188 fGcphys->iloss=flagValue;
1189 else if(!strcmp(flagName,"MULS"))
1190 fGcphys->imuls=flagValue;
1191 else if(!strcmp(flagName,"RAYL"))
1192 fGcphys->irayl=flagValue;
1193 else if(!strcmp(flagName,"STRA"))
1194 fGcphlt->istra=flagValue;
1195 else if(!strcmp(flagName,"SYNC"))
1196 fGcphlt->isync=flagValue;
1197 else Warning("SetFlag","Flag %s not implemented\n",flagName);
1200 //_____________________________________________________________________________
1201 Float_t TGeant3::Xsec(char* reac, Float_t /* energy */,
1202 Int_t part, Int_t /* mate */)
1204 if(!strcmp(reac,"PHOT"))
1207 Error("Xsec","Can calculate photoelectric only for photons\n");
1213 //_____________________________________________________________________________
1214 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1217 // Return the current position in the master reference frame of the
1218 // track being transported
1220 xyz[0]=fGctrak->vect[0];
1221 xyz[1]=fGctrak->vect[1];
1222 xyz[2]=fGctrak->vect[2];
1223 xyz[3]=fGctrak->tofg;
1226 //_____________________________________________________________________________
1227 Float_t TGeant3::TrackTime() const
1230 // Return the current time of flight of the track being transported
1232 return fGctrak->tofg;
1235 //_____________________________________________________________________________
1236 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1239 // Return the direction and the momentum (GeV/c) of the track
1240 // currently being transported
1242 Double_t ptot=fGctrak->vect[6];
1243 xyz[0]=fGctrak->vect[3]*ptot;
1244 xyz[1]=fGctrak->vect[4]*ptot;
1245 xyz[2]=fGctrak->vect[5]*ptot;
1246 xyz[3]=fGctrak->getot;
1249 //_____________________________________________________________________________
1250 Float_t TGeant3::TrackCharge() const
1253 // Return charge of the track currently transported
1255 return fGckine->charge;
1258 //_____________________________________________________________________________
1259 Float_t TGeant3::TrackMass() const
1262 // Return the mass of the track currently transported
1264 return fGckine->amass;
1267 //_____________________________________________________________________________
1268 Int_t TGeant3::TrackPid() const
1271 // Return the id of the particle transported
1273 return PDGFromId(fGckine->ipart);
1276 //_____________________________________________________________________________
1277 Float_t TGeant3::TrackStep() const
1280 // Return the length in centimeters of the current step
1282 return fGctrak->step;
1285 //_____________________________________________________________________________
1286 Float_t TGeant3::TrackLength() const
1289 // Return the length of the current track from its origin
1291 return fGctrak->sleng;
1294 //_____________________________________________________________________________
1295 Bool_t TGeant3::IsNewTrack() const
1298 // True if the track is not at the boundary of the current volume
1300 return (fGctrak->sleng>0);
1303 //_____________________________________________________________________________
1304 Bool_t TGeant3::IsTrackInside() const
1307 // True if the track is not at the boundary of the current volume
1309 return (fGctrak->inwvol==0);
1312 //_____________________________________________________________________________
1313 Bool_t TGeant3::IsTrackEntering() const
1316 // True if this is the first step of the track in the current volume
1318 return (fGctrak->inwvol==1);
1321 //_____________________________________________________________________________
1322 Bool_t TGeant3::IsTrackExiting() const
1325 // True if this is the last step of the track in the current volume
1327 return (fGctrak->inwvol==2);
1330 //_____________________________________________________________________________
1331 Bool_t TGeant3::IsTrackOut() const
1334 // True if the track is out of the setup
1336 return (fGctrak->inwvol==3);
1339 //_____________________________________________________________________________
1340 Bool_t TGeant3::IsTrackStop() const
1343 // True if the track energy has fallen below the threshold
1345 return (fGctrak->istop==2);
1348 //_____________________________________________________________________________
1349 Int_t TGeant3::NSecondaries() const
1352 // Number of secondary particles generated in the current step
1354 return fGcking->ngkine;
1357 //_____________________________________________________________________________
1358 Int_t TGeant3::CurrentEvent() const
1361 // Number of the current event
1363 return fGcflag->idevt;
1366 //_____________________________________________________________________________
1367 const char* TGeant3::ProdProcess() const
1370 // Name of the process that has produced the secondary particles
1371 // in the current step
1373 static char proc[5];
1374 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1377 if(fGcking->ngkine>0) {
1378 for (km = 0; km < fGctrak->nmec; ++km) {
1379 for (im = 0; im < 13; ++im) {
1380 if (fGctrak->lmec[km] == ipmec[im]) {
1381 mec = fGctrak->lmec[km];
1382 if (0 < mec && mec < 31) {
1383 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1384 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1385 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1392 strcpy(proc,"UNKN");
1393 } else strcpy(proc,"NONE");
1397 //_____________________________________________________________________________
1398 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1399 TLorentzVector &x, TLorentzVector &p)
1402 // Get the parameters of the secondary track number isec produced
1403 // in the current step
1406 if(-1<isec && isec<fGcking->ngkine) {
1407 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1409 x[i]=fGckin3->gpos[isec][i];
1410 p[i]=fGcking->gkin[isec][i];
1412 x[3]=fGcking->tofd[isec];
1413 p[3]=fGcking->gkin[isec][3];
1415 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1416 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1421 //_____________________________________________________________________________
1422 void TGeant3::InitLego()
1425 SetDEBU(0,0,0); //do not print a message
1428 //_____________________________________________________________________________
1429 Bool_t TGeant3::IsTrackDisappeared() const
1432 // True if the current particle has disappered
1433 // either because it decayed or because it underwent
1434 // an inelastic collision
1436 return (fGctrak->istop==1);
1439 //_____________________________________________________________________________
1440 Bool_t TGeant3::IsTrackAlive() const
1443 // True if the current particle is alive and will continue to be
1446 return (fGctrak->istop==0);
1449 //_____________________________________________________________________________
1450 void TGeant3::StopTrack()
1453 // Stop the transport of the current particle and skip to the next
1458 //_____________________________________________________________________________
1459 void TGeant3::StopEvent()
1462 // Stop simulation of the current event and skip to the next
1467 //_____________________________________________________________________________
1468 Float_t TGeant3::MaxStep() const
1471 // Return the maximum step length in the current medium
1473 return fGctmed->stemax;
1476 //_____________________________________________________________________________
1477 void TGeant3::SetMaxStep(Float_t maxstep)
1480 // Set the maximum step allowed till the particle is in the current medium
1482 fGctmed->stemax=maxstep;
1485 //_____________________________________________________________________________
1486 void TGeant3::SetMaxNStep(Int_t maxnstp)
1489 // Set the maximum number of steps till the particle is in the current medium
1491 fGctrak->maxnst=maxnstp;
1494 //_____________________________________________________________________________
1495 Int_t TGeant3::GetMaxNStep() const
1498 // Maximum number of steps allowed in current medium
1500 return fGctrak->maxnst;
1503 //_____________________________________________________________________________
1504 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1505 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1509 // Defines a Material
1511 // kmat number assigned to the material
1512 // name material name
1513 // a atomic mass in au
1515 // dens density in g/cm3
1516 // absl absorbtion length in cm
1517 // if >=0 it is ignored and the program
1518 // calculates it, if <0. -absl is taken
1519 // radl radiation length in cm
1520 // if >=0 it is ignored and the program
1521 // calculates it, if <0. -radl is taken
1522 // buf pointer to an array of user words
1523 // nbuf number of user words
1525 Int_t jmate=fGclink->jmate;
1531 for(i=1; i<=ns; i++) {
1532 if(fZlq[jmate-i]==0) {
1538 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1539 nwbuf PASSCHARL(name));
1542 //_____________________________________________________________________________
1543 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1544 Float_t dens, Int_t nlmat, Float_t* wmat)
1547 // Defines mixture OR COMPOUND IMAT as composed by
1548 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1550 // If NLMAT > 0 then wmat contains the proportion by
1551 // weights of each basic material in the mixture.
1553 // If nlmat < 0 then WMAT contains the number of atoms
1554 // of a given kind into the molecule of the COMPOUND
1555 // In this case, WMAT in output is changed to relative
1558 Int_t jmate=fGclink->jmate;
1564 for(i=1; i<=ns; i++) {
1565 if(fZlq[jmate-i]==0) {
1571 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1574 //_____________________________________________________________________________
1575 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1576 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1577 Float_t stemax, Float_t deemax, Float_t epsil,
1578 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1581 // kmed tracking medium number assigned
1582 // name tracking medium name
1583 // nmat material number
1584 // isvol sensitive volume flag
1585 // ifield magnetic field
1586 // fieldm max. field value (kilogauss)
1587 // tmaxfd max. angle due to field (deg/step)
1588 // stemax max. step allowed
1589 // deemax max. fraction of energy lost in a step
1590 // epsil tracking precision (cm)
1591 // stmin min. step due to continuos processes (cm)
1593 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1594 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1595 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1597 Int_t jtmed=fGclink->jtmed;
1603 for(i=1; i<=ns; i++) {
1604 if(fZlq[jtmed-i]==0) {
1610 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1611 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1614 //_____________________________________________________________________________
1615 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1616 Float_t phiy, Float_t thez, Float_t phiz)
1619 // krot rotation matrix number assigned
1620 // theta1 polar angle for axis i
1621 // phi1 azimuthal angle for axis i
1622 // theta2 polar angle for axis ii
1623 // phi2 azimuthal angle for axis ii
1624 // theta3 polar angle for axis iii
1625 // phi3 azimuthal angle for axis iii
1627 // it defines the rotation matrix number irot.
1629 Int_t jrotm=fGclink->jrotm;
1635 for(i=1; i<=ns; i++) {
1636 if(fZlq[jrotm-i]==0) {
1642 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1645 //_____________________________________________________________________________
1646 Int_t TGeant3::GetMedium() const
1649 // Return the number of the current medium
1651 return fGctmed->numed;
1654 //_____________________________________________________________________________
1655 Float_t TGeant3::Edep() const
1658 // Return the energy lost in the current step
1660 return fGctrak->destep;
1663 //_____________________________________________________________________________
1664 Float_t TGeant3::Etot() const
1667 // Return the total energy of the current track
1669 return fGctrak->getot;
1672 //_____________________________________________________________________________
1673 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1676 // Return an array of n random numbers uniformly distributed
1677 // between 0 and 1 not included
1682 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1684 // Functions from GBASE
1686 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1688 //____________________________________________________________________________
1689 void TGeant3::Gfile(const char *filename, const char *option)
1692 // Routine to open a GEANT/RZ data base.
1694 // LUN logical unit number associated to the file
1696 // CHFILE RZ file name
1698 // CHOPT is a character string which may be
1699 // N To create a new file
1700 // U to open an existing file for update
1701 // " " to open an existing file for read only
1702 // Q The initial allocation (default 1000 records)
1703 // is given in IQUEST(10)
1704 // X Open the file in exchange format
1705 // I Read all data structures from file to memory
1706 // O Write all data structures from memory to file
1709 // If options "I" or "O" all data structures are read or
1710 // written from/to file and the file is closed.
1711 // See routine GRMDIR to create subdirectories
1712 // See routines GROUT,GRIN to write,read objects
1714 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1718 //____________________________________________________________________________
1719 void TGeant3::Gpcxyz()
1722 // Print track and volume parameters at current point
1727 //_____________________________________________________________________________
1728 void TGeant3::Ggclos()
1731 // Closes off the geometry setting.
1732 // Initializes the search list for the contents of each
1733 // volume following the order they have been positioned, and
1734 // inserting the content '0' when a call to GSNEXT (-1) has
1735 // been required by the user.
1736 // Performs the development of the JVOLUM structure for all
1737 // volumes with variable parameters, by calling GGDVLP.
1738 // Interprets the user calls to GSORD, through GGORD.
1739 // Computes and stores in a bank (next to JVOLUM mother bank)
1740 // the number of levels in the geometrical tree and the
1741 // maximum number of contents per level, by calling GGNLEV.
1742 // Sets status bit for CONCAVE volumes, through GGCAVE.
1743 // Completes the JSET structure with the list of volume names
1744 // which identify uniquely a given physical detector, the
1745 // list of bit numbers to pack the corresponding volume copy
1746 // numbers, and the generic path(s) in the JVOLUM tree,
1747 // through the routine GHCLOS.
1750 // Create internal list of volumes
1751 fVolNames = new char[fGcnum->nvolum+1][5];
1753 for(i=0; i<fGcnum->nvolum; ++i) {
1754 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1755 fVolNames[i][4]='\0';
1757 strcpy(fVolNames[fGcnum->nvolum],"NULL");
1760 //_____________________________________________________________________________
1761 void TGeant3::Glast()
1764 // Finish a Geant run
1769 //_____________________________________________________________________________
1770 void TGeant3::Gprint(const char *name)
1773 // Routine to print data structures
1774 // CHNAME name of a data structure
1778 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1781 //_____________________________________________________________________________
1782 void TGeant3::Grun()
1785 // Steering function to process one run
1790 //_____________________________________________________________________________
1791 void TGeant3::Gtrig()
1794 // Steering function to process one event
1799 //_____________________________________________________________________________
1800 void TGeant3::Gtrigc()
1803 // Clear event partition
1808 //_____________________________________________________________________________
1809 void TGeant3::Gtrigi()
1812 // Initialises event partition
1817 //_____________________________________________________________________________
1818 void TGeant3::Gwork(Int_t nwork)
1821 // Allocates workspace in ZEBRA memory
1826 //_____________________________________________________________________________
1827 void TGeant3::Gzinit()
1830 // To initialise GEANT/ZEBRA data structures
1835 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1837 // Functions from GCONS
1839 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1841 //_____________________________________________________________________________
1842 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1843 Float_t &dens, Float_t &radl, Float_t &absl,
1844 Float_t* ubuf, Int_t& nbuf)
1847 // Return parameters for material IMAT
1849 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1853 //_____________________________________________________________________________
1854 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1855 Float_t &amass, Float_t &charge, Float_t &tlife)
1858 // Return parameters for particle of type IPART
1862 Int_t igpart = IdFromPDG(ipart);
1863 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1867 //_____________________________________________________________________________
1868 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1869 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1870 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1871 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1874 // Return parameters for tracking medium NUMED
1876 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1877 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1881 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
1882 Float_t* tkin, Float_t* value, Float_t* pcut,
1886 // Return parameters for tracking medium NUMED
1888 gftmat(imate, ipart, PASSCHARD(chmeca), kdim,
1889 tkin, value, pcut, ixst PASSCHARL(chmeca));
1893 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
1895 return gbrelm(z,t,bcut);
1898 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
1900 return gprelm(z,t,bcut);
1903 //_____________________________________________________________________________
1904 void TGeant3::Gmate()
1907 // Define standard GEANT materials
1912 //_____________________________________________________________________________
1913 void TGeant3::Gpart()
1916 // Define standard GEANT particles plus selected decay modes
1917 // and branching ratios.
1922 //_____________________________________________________________________________
1923 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1925 // Defines branching ratios and decay modes for standard
1927 gsdk(ipart,bratio,mode);
1930 //_____________________________________________________________________________
1931 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1932 Float_t dens, Float_t radl, Float_t absl)
1935 // Defines a Material
1937 // kmat number assigned to the material
1938 // name material name
1939 // a atomic mass in au
1941 // dens density in g/cm3
1942 // absl absorbtion length in cm
1943 // if >=0 it is ignored and the program
1944 // calculates it, if <0. -absl is taken
1945 // radl radiation length in cm
1946 // if >=0 it is ignored and the program
1947 // calculates it, if <0. -radl is taken
1948 // buf pointer to an array of user words
1949 // nbuf number of user words
1953 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1957 //_____________________________________________________________________________
1958 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1959 Float_t dens, Int_t nlmat, Float_t *wmat)
1962 // Defines mixture OR COMPOUND IMAT as composed by
1963 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1965 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1966 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1968 // If NLMAT.LT.0 then WMAT contains the number of atoms
1969 // of a given kind into the molecule of the COMPOUND
1970 // In this case, WMAT in output is changed to relative
1973 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1976 //_____________________________________________________________________________
1977 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1978 Float_t amass, Float_t charge, Float_t tlife)
1981 // Store particle parameters
1983 // ipart particle code
1984 // name particle name
1985 // itrtyp transport method (see GEANT manual)
1986 // amass mass in GeV/c2
1987 // charge charge in electron units
1988 // tlife lifetime in seconds
1992 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1996 //_____________________________________________________________________________
1997 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1998 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1999 Float_t stemax, Float_t deemax, Float_t epsil,
2003 // NTMED Tracking medium number
2004 // NAME Tracking medium name
2005 // NMAT Material number
2006 // ISVOL Sensitive volume flag
2007 // IFIELD Magnetic field
2008 // FIELDM Max. field value (Kilogauss)
2009 // TMAXFD Max. angle due to field (deg/step)
2010 // STEMAX Max. step allowed
2011 // DEEMAX Max. fraction of energy lost in a step
2012 // EPSIL Tracking precision (cm)
2013 // STMIN Min. step due to continuos processes (cm)
2015 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
2016 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
2017 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
2021 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
2022 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
2025 //_____________________________________________________________________________
2026 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
2027 Float_t *absco, Float_t *effic, Float_t *rindex)
2030 // Stores the tables for UV photon tracking in medium ITMED
2031 // Please note that it is the user's responsability to
2032 // provide all the coefficients:
2035 // ITMED Tracking medium number
2036 // NPCKOV Number of bins of each table
2037 // PPCKOV Value of photon momentum (in GeV)
2038 // ABSCO Absorbtion coefficients
2039 // dielectric: absorbtion length in cm
2040 // metals : absorbtion fraction (0<=x<=1)
2041 // EFFIC Detection efficiency for UV photons
2042 // RINDEX Refraction index (if=0 metal)
2044 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
2047 //_____________________________________________________________________________
2048 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
2051 // To change the value of cut or mechanism "CHPAR"
2052 // to a new value PARVAL for tracking medium ITMED
2053 // The data structure JTMED contains the standard tracking
2054 // parameters (CUTS and flags to control the physics processes) which
2055 // are used by default for all tracking media. It is possible to
2056 // redefine individually with GSTPAR any of these parameters for a
2057 // given tracking medium.
2058 // ITMED tracking medium number
2059 // CHPAR is a character string (variable name)
2060 // PARVAL must be given as a floating point.
2062 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
2065 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2067 // Functions from GCONS
2069 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2071 //_____________________________________________________________________________
2072 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
2075 // Storing/Retrieving Vertex and Track parameters
2076 // ----------------------------------------------
2078 // Stores vertex parameters.
2079 // VERT array of (x,y,z) position of the vertex
2080 // NTBEAM beam track number origin of the vertex
2081 // =0 if none exists
2082 // NTTARG target track number origin of the vertex
2083 // UBUF user array of NUBUF floating point numbers
2085 // NVTX new vertex number (=0 in case of error).
2086 // Prints vertex parameters.
2087 // IVTX for vertex IVTX.
2088 // (For all vertices if IVTX=0)
2089 // Stores long life track parameters.
2090 // PLAB components of momentum
2091 // IPART type of particle (see GSPART)
2092 // NV vertex number origin of track
2093 // UBUF array of NUBUF floating point user parameters
2095 // NT track number (if=0 error).
2096 // Retrieves long life track parameters.
2097 // ITRA track number for which parameters are requested
2098 // VERT vector origin of the track
2099 // PVERT 4 momentum components at the track origin
2100 // IPART particle type (=0 if track ITRA does not exist)
2101 // NVERT vertex number origin of the track
2102 // UBUF user words stored in GSKINE.
2103 // Prints initial track parameters.
2104 // ITRA for track ITRA
2105 // (For all tracks if ITRA=0)
2109 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
2112 //_____________________________________________________________________________
2113 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
2117 // Retrieves the parameter of a vertex bank
2118 // Vertex is generated from tracks NTBEAM NTTARG
2119 // NVTX is the new vertex number
2123 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
2126 //_____________________________________________________________________________
2127 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
2131 // Store kinematics of track NT into data structure
2132 // Track is coming from vertex NV
2135 gskine(plab, ipart, nv, buf, nwbuf, nt);
2139 //_____________________________________________________________________________
2140 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
2144 // Creates a new vertex bank
2145 // Vertex is generated from tracks NTBEAM NTTARG
2146 // NVTX is the new vertex number
2149 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
2153 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2155 // Functions from GPHYS
2157 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2159 //_____________________________________________________________________________
2160 void TGeant3::Gphysi()
2163 // Initialise material constants for all the physics
2164 // mechanisms used by GEANT
2169 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2171 // Functions from GTRAK
2173 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2175 //_____________________________________________________________________________
2176 void TGeant3::Gdebug()
2179 // Debug the current step
2184 //_____________________________________________________________________________
2185 void TGeant3::Gekbin()
2188 // To find bin number in kinetic energy table
2189 // stored in ELOW(NEKBIN)
2194 //_____________________________________________________________________________
2195 void TGeant3::Gfinds()
2198 // Returns the set/volume parameters corresponding to
2199 // the current space point in /GCTRAK/
2200 // and fill common /GCSETS/
2202 // IHSET user set identifier
2203 // IHDET user detector identifier
2204 // ISET set number in JSET
2205 // IDET detector number in JS=LQ(JSET-ISET)
2206 // IDTYPE detector type (1,2)
2207 // NUMBV detector volume numbers (array of length NVNAME)
2208 // NVNAME number of volume levels
2213 //_____________________________________________________________________________
2214 void TGeant3::Gsking(Int_t igk)
2217 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2218 // or the NGKINE tracks when IGK is 0.
2223 //_____________________________________________________________________________
2224 void TGeant3::Gskpho(Int_t igk)
2227 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2228 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2233 //_____________________________________________________________________________
2234 void TGeant3::Gsstak(Int_t iflag)
2237 // Stores in auxiliary stack JSTAK the particle currently
2238 // described in common /GCKINE/.
2240 // On request, creates also an entry in structure JKINE :
2242 // 0 : No entry in JKINE structure required (user)
2243 // 1 : New entry in JVERTX / JKINE structures required (user)
2244 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2245 // 2 : Entry in JKINE structure exists already (from GTREVE)
2250 //_____________________________________________________________________________
2251 void TGeant3::Gsxyz()
2254 // Store space point VECT in banks JXYZ
2259 //_____________________________________________________________________________
2260 void TGeant3::Gtrack()
2263 // Controls tracking of current particle
2268 //_____________________________________________________________________________
2269 void TGeant3::Gtreve()
2272 // Controls tracking of all particles belonging to the current event
2277 //_____________________________________________________________________________
2278 void TGeant3::GtreveRoot()
2281 // Controls tracking of all particles belonging to the current event
2286 //_____________________________________________________________________________
2287 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2290 // To generate a vector RVECV of LEN random numbers
2291 // Copy of the CERN Library routine RANECU
2295 //_____________________________________________________________________________
2296 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2297 const Text_t *chopt)
2300 // To set/retrieve the seed of the random number generator
2302 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2305 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2307 // Functions from GDRAW
2309 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2311 //_____________________________________________________________________________
2312 void TGeant3::Gdxyz(Int_t it)
2315 // Draw the points stored with Gsxyz relative to track it
2320 //_____________________________________________________________________________
2321 void TGeant3::Gdcxyz()
2324 // Draw the position of the current track
2329 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2331 // Functions from GGEOM
2333 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2335 //_____________________________________________________________________________
2336 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2339 // Computes coordinates XM (Master Reference System
2340 // knowing the coordinates XD (Detector Ref System)
2341 // The local reference system can be initialized by
2342 // - the tracking routines and GDTOM used in GUSTEP
2343 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2344 // (inverse routine is GMTOD)
2346 // If IFLAG=1 convert coordinates
2347 // IFLAG=2 convert direction cosinus
2349 gdtom(xd, xm, iflag);
2352 //_____________________________________________________________________________
2353 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2357 // Loads the top part of the Volume tree in LVOLS (IVO's),
2358 // LINDX (IN indices) for a given volume defined through
2359 // its name IUDET and number IUNUM.
2361 // The routine stores only upto the last level where JVOLUM
2362 // data structure is developed. If there is no development
2363 // above the current level, it returns NLEV zero.
2365 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2368 //_____________________________________________________________________________
2369 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2372 // Finds in which volume/medium the point X is, and updates the
2373 // common /GCVOLU/ and the structure JGPAR accordingly.
2375 // NUMED returns the tracking medium number, or 0 if point is
2376 // outside the experimental setup.
2381 //_____________________________________________________________________________
2382 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2385 // Computes coordinates XD (in DRS)
2386 // from known coordinates XM in MRS
2387 // The local reference system can be initialized by
2388 // - the tracking routines and GMTOD used in GUSTEP
2389 // - a call to GMEDIA(XM,NUMED)
2390 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2391 // (inverse routine is GDTOM)
2393 // If IFLAG=1 convert coordinates
2394 // IFLAG=2 convert direction cosinus
2396 gmtod(xm, xd, iflag);
2399 //_____________________________________________________________________________
2400 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2404 // Create a new volume by dividing an existing one
2407 // MOTHER Mother volume name
2408 // NDIV Number of divisions
2411 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2412 // It divides a previously defined volume.
2417 Vname(mother,vmother);
2418 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2419 PASSCHARL(vmother));
2422 //_____________________________________________________________________________
2423 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2424 Int_t iaxis, Float_t c0i, Int_t numed)
2427 // Create a new volume by dividing an existing one
2429 // Divides mother into ndiv divisions called name
2430 // along axis iaxis starting at coordinate value c0.
2431 // the new volume created will be medium number numed.
2436 Vname(mother,vmother);
2437 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2438 PASSCHARL(vname) PASSCHARL(vmother));
2441 //_____________________________________________________________________________
2442 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2443 Int_t iaxis, Int_t numed)
2446 // Create a new volume by dividing an existing one
2451 Vname(mother,vmother);
2452 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2453 PASSCHARL(vname) PASSCHARL(vmother));
2456 //_____________________________________________________________________________
2457 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2458 Int_t iaxis, Float_t c0, Int_t numed)
2461 // Create a new volume by dividing an existing one
2466 Vname(mother,vmother);
2467 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2468 PASSCHARL(vname) PASSCHARL(vmother));
2471 //_____________________________________________________________________________
2472 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2473 Int_t iaxis, Int_t numed, Int_t ndvmx)
2476 // Create a new volume by dividing an existing one
2478 // Divides MOTHER into divisions called NAME along
2479 // axis IAXIS in steps of STEP. If not exactly divisible
2480 // will make as many as possible and will centre them
2481 // with respect to the mother. Divisions will have medium
2482 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2483 // NDVMX is the expected maximum number of divisions
2484 // (If 0, no protection tests are performed)
2489 Vname(mother,vmother);
2490 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2491 PASSCHARL(vname) PASSCHARL(vmother));
2494 //_____________________________________________________________________________
2495 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2496 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2499 // Create a new volume by dividing an existing one
2501 // Divides MOTHER into divisions called NAME along
2502 // axis IAXIS starting at coordinate value C0 with step
2504 // The new volume created will have medium number NUMED.
2505 // If NUMED is 0, NUMED of mother is taken.
2506 // NDVMX is the expected maximum number of divisions
2507 // (If 0, no protection tests are performed)
2512 Vname(mother,vmother);
2513 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2514 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2517 //_____________________________________________________________________________
2518 void TGeant3::Gsord(const char *name, Int_t iax)
2521 // Flags volume CHNAME whose contents will have to be ordered
2522 // along axis IAX, by setting the search flag to -IAX
2526 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2527 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2528 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2529 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2530 // IAX = 6 PHI (PHI=0 => X axis)
2531 // IAX = 7 THETA (THETA=0 => Z axis)
2535 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2538 //_____________________________________________________________________________
2539 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2540 Float_t y, Float_t z, Int_t irot, const char *konly)
2543 // Position a volume into an existing one
2546 // NUMBER Copy number of the volume
2547 // MOTHER Mother volume name
2548 // X X coord. of the volume in mother ref. sys.
2549 // Y Y coord. of the volume in mother ref. sys.
2550 // Z Z coord. of the volume in mother ref. sys.
2551 // IROT Rotation matrix number w.r.t. mother ref. sys.
2552 // ONLY ONLY/MANY flag
2554 // It positions a previously defined volume in the mother.
2559 Vname(mother,vmother);
2560 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2561 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2565 //_____________________________________________________________________________
2566 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2567 Float_t x, Float_t y, Float_t z, Int_t irot,
2568 const char *konly, Float_t *upar, Int_t np )
2571 // Place a copy of generic volume NAME with user number
2572 // NR inside MOTHER, with its parameters UPAR(1..NP)
2577 Vname(mother,vmother);
2578 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2579 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2583 //_____________________________________________________________________________
2584 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2585 Float_t phi2, Float_t theta3, Float_t phi3)
2588 // nmat Rotation matrix number
2589 // THETA1 Polar angle for axis I
2590 // PHI1 Azimuthal angle for axis I
2591 // THETA2 Polar angle for axis II
2592 // PHI2 Azimuthal angle for axis II
2593 // THETA3 Polar angle for axis III
2594 // PHI3 Azimuthal angle for axis III
2596 // It defines the rotation matrix number IROT.
2598 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2601 //_____________________________________________________________________________
2602 void TGeant3::Gprotm(Int_t nmat)
2605 // To print rotation matrices structure JROTM
2606 // nmat Rotation matrix number
2611 //_____________________________________________________________________________
2612 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2613 Float_t *upar, Int_t npar)
2617 // SHAPE Volume type
2618 // NUMED Tracking medium number
2619 // NPAR Number of shape parameters
2620 // UPAR Vector containing shape parameters
2622 // It creates a new volume in the JVOLUM data structure.
2628 Vname(shape,vshape);
2629 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2630 PASSCHARL(vname) PASSCHARL(vshape));
2634 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2636 // T H E D R A W I N G P A C K A G E
2637 // ======================================
2638 // Drawing functions. These functions allow the visualization in several ways
2639 // of the volumes defined in the geometrical data structure. It is possible
2640 // to draw the logical tree of volumes belonging to the detector (DTREE),
2641 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2642 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2643 // these commands when the hidden line removal option is activated; in
2644 // this case, the volumes can be also either translated in the space
2645 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2646 // possible to fill the surfaces of the volumes
2647 // with solid colours when the shading option (SHAD) is activated.
2648 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2649 // of the detectors or to scan physical events as well.
2650 // Finally, the command MOVE will allow the rotation, translation and zooming
2651 // on real time parts of the detectors or tracks and hits of a simulated event.
2652 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2653 // the drawing is performed by the Geant ray-tracing;
2654 // automatically, the color is assigned according to the tracking medium of each
2655 // volume and the volumes with a density lower/equal than the air are considered
2656 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2657 // the user can set color and visibility for the desired volumes via the command
2658 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2659 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2660 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2661 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2662 // first case, we assume that the first mother volume of the tree is a box with
2663 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2664 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2665 // second case, the distance between the observer and the origin of the world
2666 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2667 // or telescopic effects can be achieved changing the scale factors in the command
2668 // (DRAW). When the final picture does not occupy the full window,
2669 // mapping the space before tracing can speed up the drawing, but can also
2670 // produce less precise results; values from 1 to 4 are allowed in the command
2671 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2672 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2673 // The command (VALCUT) allows the cutting of the detector by three planes
2674 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2675 // SATT for any desired volume and can assume values from 0 to 7; it determines
2676 // the different light processing to be performed for different materials:
2677 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2678 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2679 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2680 // is 0.9) and the observer is assumed to have a light source (therefore he will
2681 // produce parallel light in the case of parallel view and point-like-source
2682 // light in the case of perspective view).
2684 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2686 //_____________________________________________________________________________
2687 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2691 // IOPT Name of the attribute to be set
2692 // IVAL Value to which the attribute is to be set
2694 // name= "*" stands for all the volumes.
2695 // iopt can be chosen among the following :
2697 // WORK 0=volume name is inactive for the tracking
2698 // 1=volume name is active for the tracking (default)
2700 // SEEN 0=volume name is invisible
2701 // 1=volume name is visible (default)
2702 // -1=volume invisible with all its descendants in the tree
2703 // -2=volume visible but not its descendants in the tree
2705 // LSTY line style 1,2,3,... (default=1)
2706 // LSTY=7 will produce a very precise approximation for
2707 // revolution bodies.
2709 // LWID line width -7,...,1,2,3,..7 (default=1)
2710 // LWID<0 will act as abs(LWID) was set for the volume
2711 // and for all the levels below it. When SHAD is 'ON', LWID
2712 // represent the linewidth of the scan lines filling the surfaces
2713 // (whereas the FILL value represent their number). Therefore
2714 // tuning this parameter will help to obtain the desired
2715 // quality/performance ratio.
2717 // COLO colour code -166,...,1,2,..166 (default=1)
2719 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2720 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2721 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2722 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2723 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2724 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2725 // colour=n*10+m, m=1,2,...9, will produce the same colour
2726 // as 'n', but with increasing luminosity according to 'm';
2727 // COLO<0 will act as if abs(COLO) was set for the volume
2728 // and for all the levels below it.
2729 // When for a volume the attribute FILL is > 1 (and the
2730 // option SHAD is on), the ABS of its colour code must be < 8
2731 // because an automatic shading of its faces will be
2734 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2735 // when option SHAD is "on" the FILL attribute of any
2736 // volume can be set different from 0 (normal drawing);
2737 // if it is set to 1, the faces of such volume will be filled
2738 // with solid colours; if ABS(FILL) is > 1, then a light
2739 // source is placed along the observer line, and the faces of
2740 // such volumes will be painted by colours whose luminosity
2741 // will depend on the amount of light reflected;
2742 // if ABS(FILL) = 1, then it is possible to use all the 166
2743 // colours of the colour table, becouse the automatic shading
2744 // is not performed;
2745 // for increasing values of FILL the drawing will be performed
2746 // with higher and higher resolution improving the quality (the
2747 // number of scan lines used to fill the faces increases with FILL);
2748 // it is possible to set different values of FILL
2749 // for different volumes, in order to optimize at the same time
2750 // the performance and the quality of the picture;
2751 // FILL<0 will act as if abs(FILL) was set for the volume
2752 // and for all the levels below it.
2753 // This kind of drawing can be saved in 'picture files'
2754 // or in view banks.
2755 // 0=drawing without fill area
2756 // 1=faces filled with solid colours and resolution = 6
2757 // 2=lowest resolution (very fast)
2758 // 3=default resolution
2759 // 4=.................
2760 // 5=.................
2761 // 6=.................
2763 // Finally, if a coloured background is desired, the FILL
2764 // attribute for the first volume of the tree must be set
2765 // equal to -abs(colo), colo being >0 and <166.
2767 // SET set number associated to volume name
2768 // DET detector number associated to volume name
2769 // DTYP detector type (1,2)
2776 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2780 //_____________________________________________________________________________
2781 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2782 Int_t& natt, Float_t* par, Float_t* att)
2785 // Find the parameters of a volume
2787 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2791 //_____________________________________________________________________________
2792 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2795 // Check the parameters of a shape
2797 gckpar(ish,npar,par);
2800 //_____________________________________________________________________________
2801 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2804 // Check the parameters of a tracking medium
2806 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2809 //_____________________________________________________________________________
2810 void TGeant3::Gdelete(Int_t iview)
2813 // IVIEW View number
2815 // It deletes a view bank from memory.
2820 //_____________________________________________________________________________
2821 void TGeant3::Gdopen(Int_t iview)
2824 // IVIEW View number
2826 // When a drawing is very complex and requires a long time to be
2827 // executed, it can be useful to store it in a view bank: after a
2828 // call to DOPEN and the execution of the drawing (nothing will
2829 // appear on the screen), and after a necessary call to DCLOSE,
2830 // the contents of the bank can be displayed in a very fast way
2831 // through a call to DSHOW; therefore, the detector can be easily
2832 // zoomed many times in different ways. Please note that the pictures
2833 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2840 //_____________________________________________________________________________
2841 void TGeant3::Gdclose()
2844 // It closes the currently open view bank; it must be called after the
2845 // end of the drawing to be stored.
2850 //_____________________________________________________________________________
2851 void TGeant3::Gdshow(Int_t iview)
2854 // IVIEW View number
2856 // It shows on the screen the contents of a view bank. It
2857 // can be called after a view bank has been closed.
2862 //_____________________________________________________________________________
2863 void TGeant3::Gdopt(const char *name,const char *value)
2867 // VALUE Option value
2869 // To set/modify the drawing options.
2872 // THRZ ON Draw tracks in R vs Z
2873 // OFF (D) Draw tracks in X,Y,Z
2876 // PROJ PARA (D) Parallel projection
2878 // TRAK LINE (D) Trajectory drawn with lines
2879 // POIN " " with markers
2880 // HIDE ON Hidden line removal using the CG package
2881 // OFF (D) No hidden line removal
2882 // SHAD ON Fill area and shading of surfaces.
2883 // OFF (D) Normal hidden line removal.
2884 // RAYT ON Ray-tracing on.
2885 // OFF (D) Ray-tracing off.
2886 // EDGE OFF Does not draw contours when shad is on.
2887 // ON (D) Normal shading.
2888 // MAPP 1,2,3,4 Mapping before ray-tracing.
2889 // 0 (D) No mapping.
2890 // USER ON User graphics options in the raytracing.
2891 // OFF (D) Automatic graphics options.
2897 Vname(value,vvalue);
2898 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2902 //_____________________________________________________________________________
2903 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2904 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2909 // THETA Viewing angle theta (for 3D projection)
2910 // PHI Viewing angle phi (for 3D projection)
2911 // PSI Viewing angle psi (for 2D rotation)
2912 // U0 U-coord. (horizontal) of volume origin
2913 // V0 V-coord. (vertical) of volume origin
2914 // SU Scale factor for U-coord.
2915 // SV Scale factor for V-coord.
2917 // This function will draw the volumes,
2918 // selected with their graphical attributes, set by the Gsatt
2919 // facility. The drawing may be performed with hidden line removal
2920 // and with shading effects according to the value of the options HIDE
2921 // and SHAD; if the option SHAD is ON, the contour's edges can be
2922 // drawn or not. If the option HIDE is ON, the detector can be
2923 // exploded (BOMB), clipped with different shapes (CVOL), and some
2924 // of its parts can be shifted from their original
2925 // position (SHIFT). When HIDE is ON, if
2926 // the drawing requires more than the available memory, the program
2927 // will evaluate and display the number of missing words
2928 // (so that the user can increase the
2929 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2930 // the program will print messages about the memory used and
2931 // statistics on the volumes' visibility.
2932 // The following commands will produce the drawing of a green
2933 // volume, specified by NAME, without using the hidden line removal
2934 // technique, using the hidden line removal technique,
2935 // with different linewidth and colour (red), with
2936 // solid colour, with shading of surfaces, and without edges.
2937 // Finally, some examples are given for the ray-tracing. (A possible
2938 // string for the NAME of the volume can be found using the command DTREE).
2944 if (fGcvdma->raytra != 1) {
2945 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2947 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2951 //_____________________________________________________________________________
2952 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2953 Float_t v0,Float_t ul,Float_t vl)
2958 // CUTVAL Cut plane distance from the origin along the axis
2960 // U0 U-coord. (horizontal) of volume origin
2961 // V0 V-coord. (vertical) of volume origin
2962 // SU Scale factor for U-coord.
2963 // SV Scale factor for V-coord.
2965 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2966 // and placed at the distance cutval from the origin.
2967 // The resulting picture is seen from the the same axis.
2968 // When HIDE Mode is ON, it is possible to get the same effect with
2969 // the CVOL/BOX function.
2975 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2978 //_____________________________________________________________________________
2979 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2980 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2981 Float_t v0,Float_t ul,Float_t vl)
2985 // CUTTHE Theta angle of the line normal to cut plane
2986 // CUTPHI Phi angle of the line normal to cut plane
2987 // CUTVAL Cut plane distance from the origin along the axis
2989 // THETA Viewing angle theta (for 3D projection)
2990 // PHI Viewing angle phi (for 3D projection)
2991 // U0 U-coord. (horizontal) of volume origin
2992 // V0 V-coord. (vertical) of volume origin
2993 // SU Scale factor for U-coord.
2994 // SV Scale factor for V-coord.
2996 // The cut plane is normal to the line given by the cut angles
2997 // cutthe and cutphi and placed at the distance cutval from the origin.
2998 // The resulting picture is seen from the viewing angles theta,phi.
3004 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
3008 //_____________________________________________________________________________
3009 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
3014 // ISEL Option flag D=111110
3016 // CHRSIZ Character size (cm) of title NAME D=0.6
3019 // 0 to have only the header lines
3020 // xxxxx1 to add the text name centered on top of header
3021 // xxxx1x to add global detector name (first volume) on left
3022 // xxx1xx to add date on right
3023 // xx1xxx to select thick characters for text on top of header
3024 // x1xxxx to add the text 'EVENT NR x' on top of header
3025 // 1xxxxx to add the text 'RUN NR x' on top of header
3026 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
3027 // i.e. they generate overwritten text.
3029 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
3032 //_____________________________________________________________________________
3033 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
3036 // Draw a 2D-man at position (U0,V0)
3038 // U U-coord. (horizontal) of the centre of man' R
3039 // V V-coord. (vertical) of the centre of man' R
3040 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
3042 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
3043 // It superimposes the picure of a man or of a woman, chosen among
3044 // three different ones, with the same scale factors as the detector
3045 // in the current drawing.
3048 if (opt.Contains("WM1")) {
3050 } else if (opt.Contains("WM3")) {
3052 } else if (opt.Contains("WM2")) {
3059 //_____________________________________________________________________________
3060 void TGeant3::Gdspec(const char *name)
3065 // Shows 3 views of the volume (two cut-views and a 3D view), together with
3066 // its geometrical specifications. The 3D drawing will
3067 // be performed according the current values of the options HIDE and
3068 // SHAD and according the current SetClipBox clipping parameters for that
3075 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3078 //_____________________________________________________________________________
3079 void TGeant3::DrawOneSpec(const char *name)
3082 // Function called when one double-clicks on a volume name
3083 // in a TPavelabel drawn by Gdtree.
3085 THIGZ *higzSave = gHigz;
3086 higzSave->SetName("higzSave");
3087 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
3088 //printf("DrawOneSpec, gHigz=%x, higzSpec=%x\n",gHigz,higzSpec);
3089 if (higzSpec) gHigz = higzSpec;
3090 else higzSpec = new THIGZ(defSize);
3091 higzSpec->SetName("higzSpec");
3096 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3099 higzSave->SetName("higz");
3103 //_____________________________________________________________________________
3104 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
3108 // LEVMAX Depth level
3111 // This function draws the logical tree,
3112 // Each volume in the tree is represented by a TPaveTree object.
3113 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
3114 // Use TPaveTree pop-up menu to select:
3117 // - drawing tree of parent
3123 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3127 //_____________________________________________________________________________
3128 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
3132 // LEVMAX Depth level
3135 // This function draws the logical tree of the parent of name.
3139 // Scan list of volumes in JVOLUM
3141 Int_t gname, i, jvo, in, nin, jin, num;
3142 strncpy((char *) &gname, name, 4);
3143 for(i=1; i<=fGcnum->nvolum; i++) {
3144 jvo = fZlq[fGclink->jvolum-i];
3145 nin = Int_t(fZq[jvo+3]);
3146 if (nin == -1) nin = 1;
3147 for (in=1;in<=nin;in++) {
3149 num = Int_t(fZq[jin+2]);
3150 if(gname == fZiq[fGclink->jvolum+num]) {
3151 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
3153 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3161 //_____________________________________________________________________________
3162 void TGeant3::SetABAN(Int_t par)
3165 // par = 1 particles will be stopped according to their residual
3166 // range if they are not in a sensitive material and are
3167 // far enough from the boundary
3168 // 0 particles are transported normally
3170 fGcphys->dphys1 = par;
3174 //_____________________________________________________________________________
3175 void TGeant3::SetANNI(Int_t par)
3178 // To control positron annihilation.
3179 // par =0 no annihilation
3180 // =1 annihilation. Decays processed.
3181 // =2 annihilation. No decay products stored.
3183 fGcphys->ianni = par;
3187 //_____________________________________________________________________________
3188 void TGeant3::SetAUTO(Int_t par)
3191 // To control automatic calculation of tracking medium parameters:
3192 // par =0 no automatic calculation;
3193 // =1 automati calculation.
3195 fGctrak->igauto = par;
3199 //_____________________________________________________________________________
3200 void TGeant3::SetBOMB(Float_t boom)
3203 // BOOM : Exploding factor for volumes position
3205 // To 'explode' the detector. If BOOM is positive (values smaller
3206 // than 1. are suggested, but any value is possible)
3207 // all the volumes are shifted by a distance
3208 // proportional to BOOM along the direction between their centre
3209 // and the origin of the MARS; the volumes which are symmetric
3210 // with respect to this origin are simply not shown.
3211 // BOOM equal to 0 resets the normal mode.
3212 // A negative (greater than -1.) value of
3213 // BOOM will cause an 'implosion'; for even lower values of BOOM
3214 // the volumes' positions will be reflected respect to the origin.
3215 // This command can be useful to improve the 3D effect for very
3216 // complex detectors. The following commands will make explode the
3223 //_____________________________________________________________________________
3224 void TGeant3::SetBREM(Int_t par)
3227 // To control bremstrahlung.
3228 // par =0 no bremstrahlung
3229 // =1 bremstrahlung. Photon processed.
3230 // =2 bremstrahlung. No photon stored.
3232 fGcphys->ibrem = par;
3236 //_____________________________________________________________________________
3237 void TGeant3::SetCKOV(Int_t par)
3240 // To control Cerenkov production
3241 // par =0 no Cerenkov;
3243 // =2 Cerenkov with primary stopped at each step.
3245 fGctlit->itckov = par;
3249 //_____________________________________________________________________________
3250 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3251 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3254 // The hidden line removal technique is necessary to visualize properly
3255 // very complex detectors. At the same time, it can be useful to visualize
3256 // the inner elements of a detector in detail. This function allows
3257 // subtractions (via boolean operation) of BOX shape from any part of
3258 // the detector, therefore showing its inner contents.
3259 // If "*" is given as the name of the
3260 // volume to be clipped, all volumes are clipped by the given box.
3261 // A volume can be clipped at most twice.
3262 // if a volume is explicitely clipped twice,
3263 // the "*" will not act on it anymore. Giving "." as the name
3264 // of the volume to be clipped will reset the clipping.
3266 // NAME Name of volume to be clipped
3268 // XMIN Lower limit of the Shape X coordinate
3269 // XMAX Upper limit of the Shape X coordinate
3270 // YMIN Lower limit of the Shape Y coordinate
3271 // YMAX Upper limit of the Shape Y coordinate
3272 // ZMIN Lower limit of the Shape Z coordinate
3273 // ZMAX Upper limit of the Shape Z coordinate
3275 // This function performs a boolean subtraction between the volume
3276 // NAME and a box placed in the MARS according the values of the given
3282 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3285 //_____________________________________________________________________________
3286 void TGeant3::SetCOMP(Int_t par)
3289 // To control Compton scattering
3290 // par =0 no Compton
3291 // =1 Compton. Electron processed.
3292 // =2 Compton. No electron stored.
3295 fGcphys->icomp = par;
3298 //_____________________________________________________________________________
3299 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3300 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3301 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3302 Float_t ppcutm, Float_t tofmax)
3305 // CUTGAM Cut for gammas D=0.001
3306 // CUTELE Cut for electrons D=0.001
3307 // CUTHAD Cut for charged hadrons D=0.01
3308 // CUTNEU Cut for neutral hadrons D=0.01
3309 // CUTMUO Cut for muons D=0.01
3310 // BCUTE Cut for electron brems. D=-1.
3311 // BCUTM Cut for muon brems. D=-1.
3312 // DCUTE Cut for electron delta-rays D=-1.
3313 // DCUTM Cut for muon delta-rays D=-1.
3314 // PPCUTM Cut for e+e- pairs by muons D=0.01
3315 // TOFMAX Time of flight cut D=1.E+10
3317 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3318 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3320 // If one of the parameters from CUTGAM to PPCUTM included
3321 // is modified, cross-sections and energy loss tables must be
3322 // recomputed via the function Gphysi.
3324 fGccuts->cutgam = cutgam;
3325 fGccuts->cutele = cutele;
3326 fGccuts->cutneu = cutneu;
3327 fGccuts->cuthad = cuthad;
3328 fGccuts->cutmuo = cutmuo;
3329 fGccuts->bcute = bcute;
3330 fGccuts->bcutm = bcutm;
3331 fGccuts->dcute = dcute;
3332 fGccuts->dcutm = dcutm;
3333 fGccuts->ppcutm = ppcutm;
3334 fGccuts->tofmax = tofmax;
3337 //_____________________________________________________________________________
3338 void TGeant3::SetDCAY(Int_t par)
3341 // To control Decay mechanism.
3342 // par =0 no decays.
3343 // =1 Decays. secondaries processed.
3344 // =2 Decays. No secondaries stored.
3346 fGcphys->idcay = par;
3350 //_____________________________________________________________________________
3351 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3354 // Set the debug flag and frequency
3355 // Selected debug output will be printed from
3356 // event emin to even emax each emod event
3358 fGcflag->idemin = emin;
3359 fGcflag->idemax = emax;
3360 fGcflag->itest = emod;
3364 //_____________________________________________________________________________
3365 void TGeant3::SetDRAY(Int_t par)
3368 // To control delta rays mechanism.
3369 // par =0 no delta rays.
3370 // =1 Delta rays. secondaries processed.
3371 // =2 Delta rays. No secondaries stored.
3373 fGcphys->idray = par;
3376 //_____________________________________________________________________________
3377 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3380 // To control cross section tabulations
3381 // ekmin = minimum kinetic energy in GeV
3382 // ekmax = maximum kinetic energy in GeV
3383 // nekbin = number of logatithmic bins (<200)
3385 fGcmulo->ekmin = ekmin;
3386 fGcmulo->ekmax = ekmax;
3387 fGcmulo->nekbin = nekbin;
3390 //_____________________________________________________________________________
3391 void TGeant3::SetHADR(Int_t par)
3394 // To control hadronic interactions.
3395 // par =0 no hadronic interactions.
3396 // =1 Hadronic interactions. secondaries processed.
3397 // =2 Hadronic interactions. No secondaries stored.
3399 fGcphys->ihadr = par;
3402 //_____________________________________________________________________________
3403 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3404 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3405 Float_t xk8, Float_t xk9, Float_t xk10)
3408 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3409 // Their meaning is user defined
3411 fGckine->ikine = kine;
3412 fGckine->pkine[0] = xk1;
3413 fGckine->pkine[1] = xk2;
3414 fGckine->pkine[2] = xk3;
3415 fGckine->pkine[3] = xk4;
3416 fGckine->pkine[4] = xk5;
3417 fGckine->pkine[5] = xk6;
3418 fGckine->pkine[6] = xk7;
3419 fGckine->pkine[7] = xk8;
3420 fGckine->pkine[8] = xk9;
3421 fGckine->pkine[9] = xk10;
3424 //_____________________________________________________________________________
3425 void TGeant3::SetLOSS(Int_t par)
3428 // To control energy loss.
3429 // par =0 no energy loss;
3430 // =1 restricted energy loss fluctuations;
3431 // =2 complete energy loss fluctuations;
3433 // =4 no energy loss fluctuations.
3434 // If the value ILOSS is changed, then cross-sections and energy loss
3435 // tables must be recomputed via the command 'PHYSI'.
3437 fGcphys->iloss = par;
3441 //_____________________________________________________________________________
3442 void TGeant3::SetMULS(Int_t par)
3445 // To control multiple scattering.
3446 // par =0 no multiple scattering.
3447 // =1 Moliere or Coulomb scattering.
3448 // =2 Moliere or Coulomb scattering.
3449 // =3 Gaussian scattering.
3451 fGcphys->imuls = par;
3455 //_____________________________________________________________________________
3456 void TGeant3::SetMUNU(Int_t par)
3459 // To control muon nuclear interactions.
3460 // par =0 no muon-nuclear interactions.
3461 // =1 Nuclear interactions. Secondaries processed.
3462 // =2 Nuclear interactions. Secondaries not processed.
3464 fGcphys->imunu = par;
3467 //_____________________________________________________________________________
3468 void TGeant3::SetOPTI(Int_t par)
3471 // This flag controls the tracking optimisation performed via the
3473 // 1 no optimisation at all; GSORD calls disabled;
3474 // 0 no optimisation; only user calls to GSORD kept;
3475 // 1 all non-GSORDered volumes are ordered along the best axis;
3476 // 2 all volumes are ordered along the best axis.
3478 fGcopti->ioptim = par;
3481 //_____________________________________________________________________________
3482 void TGeant3::SetPAIR(Int_t par)
3485 // To control pair production mechanism.
3486 // par =0 no pair production.
3487 // =1 Pair production. secondaries processed.
3488 // =2 Pair production. No secondaries stored.
3490 fGcphys->ipair = par;
3494 //_____________________________________________________________________________
3495 void TGeant3::SetPFIS(Int_t par)
3498 // To control photo fission mechanism.
3499 // par =0 no photo fission.
3500 // =1 Photo fission. secondaries processed.
3501 // =2 Photo fission. No secondaries stored.
3503 fGcphys->ipfis = par;
3506 //_____________________________________________________________________________
3507 void TGeant3::SetPHOT(Int_t par)
3510 // To control Photo effect.
3511 // par =0 no photo electric effect.
3512 // =1 Photo effect. Electron processed.
3513 // =2 Photo effect. No electron stored.
3515 fGcphys->iphot = par;
3518 //_____________________________________________________________________________
3519 void TGeant3::SetRAYL(Int_t par)
3522 // To control Rayleigh scattering.
3523 // par =0 no Rayleigh scattering.
3526 fGcphys->irayl = par;
3529 //_____________________________________________________________________________
3530 void TGeant3::SetSTRA(Int_t par)
3533 // To control energy loss fluctuations
3534 // with the PhotoAbsorption Ionisation model.
3535 // par =0 no Straggling.
3536 // =1 Straggling yes => no Delta rays.
3538 fGcphlt->istra = par;
3541 //_____________________________________________________________________________
3542 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3546 // val New switch value
3548 // Change one element of array ISWIT(10) in /GCFLAG/
3550 if (sw <= 0 || sw > 10) return;
3551 fGcflag->iswit[sw-1] = val;
3555 //_____________________________________________________________________________
3556 void TGeant3::SetTRIG(Int_t nevents)
3559 // Set number of events to be run
3561 fGcflag->nevent = nevents;
3564 //_____________________________________________________________________________
3565 void TGeant3::SetUserDecay(Int_t pdg)
3568 // Force the decays of particles to be done with Pythia
3569 // and not with the Geant routines.
3570 // just kill pointers doing mzdrop
3572 Int_t ipart = IdFromPDG(pdg);
3574 printf("Particle %d not in geant\n",pdg);
3577 Int_t jpart=fGclink->jpart;
3578 Int_t jpa=fZlq[jpart-ipart];
3581 Int_t jpa1=fZlq[jpa-1];
3583 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3584 Int_t jpa2=fZlq[jpa-2];
3586 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3590 //______________________________________________________________________________
3591 void TGeant3::Vname(const char *name, char *vname)
3594 // convert name to upper case. Make vname at least 4 chars
3596 Int_t l = strlen(name);
3599 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3600 for (i=l;i<4;i++) vname[i] = ' ';
3604 //______________________________________________________________________________
3605 void TGeant3::Ertrgo()
3610 //______________________________________________________________________________
3611 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3612 const Float_t *x2, const Float_t *p2,
3613 Int_t ipa, Option_t *chopt)
3615 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3618 //_____________________________________________________________________________
3619 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3620 Int_t number, Int_t nlevel)
3624 // ******************************************************************
3626 // * Write out the geometry of the detector in EUCLID file format *
3628 // * filnam : will be with the extension .euc *
3629 // * topvol : volume name of the starting node *
3630 // * number : copy number of topvol (relevant for gsposp) *
3631 // * nlevel : number of levels in the tree structure *
3632 // * to be written out, starting from topvol *
3634 // * Author : M. Maire *
3636 // ******************************************************************
3638 // File filnam.tme is written out with the definitions of tracking
3639 // medias and materials.
3640 // As to restore original numbers for materials and medias, program
3641 // searches in the file euc_medi.dat and comparing main parameters of
3642 // the mat. defined inside geant and the one in file recognizes them
3643 // and is able to take number from file. If for any material or medium,
3644 // this procedure fails, ordering starts from 1.
3645 // Arrays IOTMED and IOMATE are used for this procedure
3647 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3648 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3650 Int_t i, end, itm, irm, jrm, k, nmed;
3654 char *filext, *filetme;
3655 char natmed[21], namate[21];
3656 char natmedc[21], namatec[21];
3657 char key[5], name[5], mother[5], konly[5];
3659 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3660 Int_t mlevel, numbr, natt, numed, nin, ndata;
3661 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3662 Int_t jdiv, ivin, in, jin, jvin, irot;
3663 Int_t jtm, imat, jma, flag=0, imatc;
3664 Float_t az, dens, radl, absl, a, step, x, y, z;
3665 Int_t npar, ndvmx, left;
3666 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3668 Int_t iomate[100], iotmed[100];
3669 Float_t par[50], att[20], ubuf[50];
3672 Int_t level, ndiv, iaxe;
3673 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3674 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3675 Float_t tmaxf, stemax, deemax, epsil, stmin;
3676 const char *f10000="!\n%s\n!\n";
3677 //Open the input file
3679 for(i=0;i<end;i++) if(filnam[i]=='.') {
3683 filext=new char[end+5];
3684 filetme=new char[end+5];
3685 strncpy(filext,filnam,end);
3686 strncpy(filetme,filnam,end);
3688 // *** The output filnam name will be with extension '.euc'
3689 strcpy(&filext[end],".euc");
3690 strcpy(&filetme[end],".tme");
3691 lun=fopen(filext,"w");
3693 // *** Initialisation of the working space
3694 iadvol=fGcnum->nvolum;
3695 iadtmd=iadvol+fGcnum->nvolum;
3696 iadrot=iadtmd+fGcnum->ntmed;
3697 if(fGclink->jrotm) {
3698 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3702 nwtot=iadrot+fGcnum->nrotm;
3703 qws = new float[nwtot+1];
3704 for (i=0;i<nwtot+1;i++) qws[i]=0;
3707 if(nlevel==0) mlevel=20;
3709 // *** find the top volume and put it in the stak
3710 numbr = number>0 ? number : 1;
3711 Gfpara(topvol,numbr,1,npar,natt,par,att);
3713 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3718 // *** authorized shape ?
3719 strncpy((char *)&iname, topvol, 4);
3721 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3725 jvo = fZlq[fGclink->jvolum-ivo];
3726 ish = Int_t (fZq[jvo+2]);
3728 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3735 iws[iadvol+ivo] = level;
3738 //*** flag all volumes and fill the stak
3742 // pick the next volume in stak
3744 ivo = TMath::Abs(iws[ivstak]);
3745 jvo = fZlq[fGclink->jvolum - ivo];
3747 // flag the tracking medium
3748 numed = Int_t (fZq[jvo + 4]);
3749 iws[iadtmd + numed] = 1;
3751 // get the daughters ...
3752 level = iws[iadvol+ivo];
3753 if (level < mlevel) {
3755 nin = Int_t (fZq[jvo + 3]);
3757 // from division ...
3759 jdiv = fZlq[jvo - 1];
3760 ivin = Int_t (fZq[jdiv + 2]);
3762 iws[nvstak] = -ivin;
3763 iws[iadvol+ivin] = level;
3765 // from position ...
3766 } else if (nin > 0) {
3767 for(in=1; in<=nin; in++) {
3768 jin = fZlq[jvo - in];
3769 ivin = Int_t (fZq[jin + 2 ]);
3770 jvin = fZlq[fGclink->jvolum - ivin];
3771 ish = Int_t (fZq[jvin + 2]);
3772 // authorized shape ?
3774 // not yet flagged ?
3775 if (iws[iadvol+ivin]==0) {
3778 iws[iadvol+ivin] = level;
3780 // flag the rotation matrix
3781 irot = Int_t ( fZq[jin + 4 ]);
3782 if (irot > 0) iws[iadrot+irot] = 1;
3788 // next volume in stak ?
3789 if (ivstak < nvstak) goto L10;
3791 // *** restore original material and media numbers
3792 // file euc_medi.dat is needed to compare materials and medias
3794 FILE* luncor=fopen("euc_medi.dat","r");
3797 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3798 if (iws[iadtmd+itm] > 0) {
3799 jtm = fZlq[fGclink->jtmed-itm];
3800 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3801 imat = Int_t (fZq[jtm+6]);
3802 jma = fZlq[fGclink->jmate-imat];
3804 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3807 strncpy(namate,(char *)&fZiq[jma+1],20);
3810 //** find the material original number
3813 iret=fscanf(luncor,"%4s,%130s",key,card);
3814 if(iret<=0) goto L26;
3816 if(!strcmp(key,"MATE")) {
3817 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3818 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3819 if(!strcmp(namatec,namate)) {
3820 if(az==a && zc==z && densc==dens && radlc==radl
3821 && abslc==absl && nparc==nparc) {
3824 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3826 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3830 if(strcmp(key,"END") && !flag) goto L23;
3832 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3836 //*** restore original tracking medium number
3839 iret=fscanf(luncor,"%4s,%130s",key,card);
3840 if(iret<=0) goto L26;
3842 if (!strcmp(key,"TMED")) {
3843 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3844 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3845 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3846 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3847 epsil,stmin,ubuf,&nwbuf);
3848 if(!strcmp(natmedc,natmed)) {
3849 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3852 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3855 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3859 if(strcmp(key,"END") && !flag) goto L24;
3861 printf("cannot restore original number for medium : %s\n",natmed);
3869 L26: printf("*** GWEUCL *** cannot read the data file\n");
3871 L29: if(luncor) fclose (luncor);
3874 // *** write down the tracking medium definition
3876 strcpy(card,"! Tracking medium");
3877 fprintf(lun,f10000,card);
3879 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3880 if (iws[iadtmd+itm]>0) {
3881 jtm = fZlq[fGclink->jtmed-itm];
3882 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3884 imat = Int_t (fZq[jtm+6]);
3885 jma = fZlq[fGclink->jmate-imat];
3886 //* order media from one, if comparing with database failed
3888 iotmed[itm]=++imxtmed;
3889 iomate[imat]=++imxmate;
3894 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3897 strncpy(namate,(char *)&fZiq[jma+1],20);
3900 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3904 //* *** write down the rotation matrix
3906 strcpy(card,"! Reperes");
3907 fprintf(lun,f10000,card);
3909 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3910 if (iws[iadrot+irm]>0) {
3911 jrm = fZlq[fGclink->jrotm-irm];
3912 fprintf(lun,"ROTM %3d",irm);
3913 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3918 //* *** write down the volume definition
3920 strcpy(card,"! Volumes");
3921 fprintf(lun,f10000,card);
3923 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3926 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3928 jvo = fZlq[fGclink->jvolum-ivo];
3929 ish = Int_t (fZq[jvo+2]);
3930 nmed = Int_t (fZq[jvo+4]);
3931 npar = Int_t (fZq[jvo+5]);
3933 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3934 Gckpar (ish,npar,par);
3935 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3936 for(i=0;i<(npar-1)/6+1;i++) {
3939 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3943 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3948 //* *** write down the division of volumes
3950 fprintf(lun,f10000,"! Divisions");
3951 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3952 ivo = TMath::Abs(iws[ivstak]);
3953 jvo = fZlq[fGclink->jvolum-ivo];
3954 ish = Int_t (fZq[jvo+2]);
3955 nin = Int_t (fZq[jvo+3]);
3956 //* this volume is divided ...
3959 iaxe = Int_t ( fZq[jdiv+1]);
3960 ivin = Int_t ( fZq[jdiv+2]);
3961 ndiv = Int_t ( fZq[jdiv+3]);
3964 jvin = fZlq[fGclink->jvolum-ivin];
3965 nmed = Int_t ( fZq[jvin+4]);
3966 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3968 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3970 if ((step<=0.)||(ish>=11)) {
3971 //* volume with negative parameter or gsposp or pgon ...
3972 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3973 } else if ((ndiv<=0)||(ish==10)) {
3974 //* volume with negative parameter or gsposp or para ...
3975 ndvmx = TMath::Abs(ndiv);
3976 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3977 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3979 //* normal volume : all kind of division are equivalent
3980 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3981 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3986 //* *** write down the the positionnement of volumes
3988 fprintf(lun,f10000,"! Positionnements\n");
3990 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3991 ivo = TMath::Abs(iws[ivstak]);
3992 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3994 jvo = fZlq[fGclink->jvolum-ivo];
3995 nin = Int_t( fZq[jvo+3]);
3996 //* this volume has daughters ...
3998 for (in=1;in<=nin;in++) {
4000 ivin = Int_t (fZq[jin +2]);
4001 numb = Int_t (fZq[jin +3]);
4002 irot = Int_t (fZq[jin +4]);
4006 strcpy(konly,"ONLY");
4007 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
4008 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
4010 jvin = fZlq[fGclink->jvolum-ivin];
4011 ish = Int_t (fZq[jvin+2]);
4012 //* gspos or gsposp ?
4013 ndata = fZiq[jin-1];
4015 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
4016 name,numb,mother,x,y,z,irot,konly);
4018 npar = Int_t (fZq[jin+9]);
4019 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
4020 Gckpar (ish,npar,par);
4021 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
4022 name,numb,mother,x,y,z,irot,konly,npar);
4024 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4031 fprintf(lun,"END\n");
4034 //****** write down the materials and medias *****
4036 lun=fopen(filetme,"w");
4038 for(itm=1;itm<=fGcnum->ntmed;itm++) {
4039 if (iws[iadtmd+itm]>0) {
4040 jtm = fZlq[fGclink->jtmed-itm];
4041 strncpy(natmed,(char*)&fZiq[jtm+1],4);
4042 imat = Int_t (fZq[jtm+6]);
4043 jma = Int_t (fZlq[fGclink->jmate-imat]);
4045 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
4046 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
4047 iomate[imat],namate,a,z,dens,radl,absl,npar);
4051 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4055 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
4056 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
4057 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
4058 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
4062 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
4068 fprintf(lun,"END\n");
4070 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
4071 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
4080 //_____________________________________________________________________________
4081 void TGeant3::Streamer(TBuffer &R__b)
4084 // Stream an object of class TGeant3.
4086 if (R__b.IsReading()) {
4087 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
4088 AliMC::Streamer(R__b);
4091 R__b.ReadStaticArray(fPDGCode);
4093 R__b.WriteVersion(TGeant3::IsA());
4094 AliMC::Streamer(R__b);
4097 R__b.WriteArray(fPDGCode, fNPDGCodes);