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.25 2000/04/07 11:12:35 fca
19 G4 compatibility changes
21 Revision 1.24 2000/02/28 21:03:57 fca
22 Some additions to improve the compatibility with G4
24 Revision 1.23 2000/02/23 16:25:25 fca
25 AliVMC and AliGeant3 classes introduced
26 ReadEuclid moved from AliRun to AliModule
28 Revision 1.22 2000/01/18 15:40:13 morsch
29 Interface to GEANT3 routines GFTMAT, GBRELM and GPRELM added
30 Define geant particle type 51: Feedback Photon with Cherenkov photon properties.
32 Revision 1.21 2000/01/17 19:41:17 fca
35 Revision 1.20 2000/01/12 11:29:27 fca
38 Revision 1.19 1999/12/17 09:03:12 fca
39 Introduce a names array
41 Revision 1.18 1999/11/26 16:55:39 fca
42 Reimplement CurrentVolName() to avoid memory leaks
44 Revision 1.17 1999/11/03 16:58:28 fca
45 Correct source of address violation in creating character string
47 Revision 1.16 1999/11/03 13:17:08 fca
48 Have ProdProcess return const char*
50 Revision 1.15 1999/10/26 06:04:50 fca
51 Introduce TLorentzVector in AliMC::GetSecondary. Thanks to I.Hrivnacova
53 Revision 1.14 1999/09/29 09:24:30 fca
54 Introduction of the Copyright and cvs Log
58 ///////////////////////////////////////////////////////////////////////////////
60 // Interface Class to the Geant3.21 MonteCarlo //
64 <img src="picts/TGeant3Class.gif">
69 ///////////////////////////////////////////////////////////////////////////////
75 #include <TDatabasePDG.h>
76 #include "AliCallf77.h"
79 # define gzebra gzebra_
80 # define grfile grfile_
81 # define gpcxyz gpcxyz_
82 # define ggclos ggclos_
85 # define gcinit gcinit_
88 # define gtrigc gtrigc_
89 # define gtrigi gtrigi_
91 # define gzinit gzinit_
92 # define gfmate gfmate_
93 # define gfpart gfpart_
94 # define gftmed gftmed_
95 # define gftmat gftmat_
99 # define gsmate gsmate_
100 # define gsmixt gsmixt_
101 # define gspart gspart_
102 # define gstmed gstmed_
103 # define gsckov gsckov_
104 # define gstpar gstpar_
105 # define gfkine gfkine_
106 # define gfvert gfvert_
107 # define gskine gskine_
108 # define gsvert gsvert_
109 # define gphysi gphysi_
110 # define gdebug gdebug_
111 # define gekbin gekbin_
112 # define gfinds gfinds_
113 # define gsking gsking_
114 # define gskpho gskpho_
115 # define gsstak gsstak_
116 # define gsxyz gsxyz_
117 # define gtrack gtrack_
118 # define gtreve gtreve_
119 # define gtreve_root gtreve_root_
120 # define grndm grndm_
121 # define grndmq grndmq_
122 # define gdtom gdtom_
123 # define glmoth glmoth_
124 # define gmedia gmedia_
125 # define gmtod gmtod_
126 # define gsdvn gsdvn_
127 # define gsdvn2 gsdvn2_
128 # define gsdvs gsdvs_
129 # define gsdvs2 gsdvs2_
130 # define gsdvt gsdvt_
131 # define gsdvt2 gsdvt2_
132 # define gsord gsord_
133 # define gspos gspos_
134 # define gsposp gsposp_
135 # define gsrotm gsrotm_
136 # define gprotm gprotm_
137 # define gsvolu gsvolu_
138 # define gprint gprint_
139 # define gdinit gdinit_
140 # define gdopt gdopt_
141 # define gdraw gdraw_
142 # define gdrayt gdrayt_
143 # define gdrawc gdrawc_
144 # define gdrawx gdrawx_
145 # define gdhead gdhead_
146 # define gdwmn1 gdwmn1_
147 # define gdwmn2 gdwmn2_
148 # define gdwmn3 gdwmn3_
149 # define gdxyz gdxyz_
150 # define gdcxyz gdcxyz_
151 # define gdman gdman_
152 # define gdspec gdspec_
153 # define gdtree gdtree_
154 # define gdelet gdelet_
155 # define gdclos gdclos_
156 # define gdshow gdshow_
157 # define gdopen gdopen_
158 # define dzshow dzshow_
159 # define gsatt gsatt_
160 # define gfpara gfpara_
161 # define gckpar gckpar_
162 # define gckmat gckmat_
163 # define geditv geditv_
164 # define mzdrop mzdrop_
166 # define ertrak ertrak_
167 # define ertrgo ertrgo_
169 # define setbomb setbomb_
170 # define setclip setclip_
171 # define gcomad gcomad_
173 # define gbrelm gbrelm_
174 # define gprelm gprelm_
176 # define gzebra GZEBRA
177 # define grfile GRFILE
178 # define gpcxyz GPCXYZ
179 # define ggclos GGCLOS
182 # define gcinit GCINIT
185 # define gtrigc GTRIGC
186 # define gtrigi GTRIGI
188 # define gzinit GZINIT
189 # define gfmate GFMATE
190 # define gfpart GFPART
191 # define gftmed GFTMED
192 # define gftmat GFTMAT
196 # define gsmate GSMATE
197 # define gsmixt GSMIXT
198 # define gspart GSPART
199 # define gstmed GSTMED
200 # define gsckov GSCKOV
201 # define gstpar GSTPAR
202 # define gfkine GFKINE
203 # define gfvert GFVERT
204 # define gskine GSKINE
205 # define gsvert GSVERT
206 # define gphysi GPHYSI
207 # define gdebug GDEBUG
208 # define gekbin GEKBIN
209 # define gfinds GFINDS
210 # define gsking GSKING
211 # define gskpho GSKPHO
212 # define gsstak GSSTAK
214 # define gtrack GTRACK
215 # define gtreve GTREVE
216 # define gtreve_root GTREVE_ROOT
218 # define grndmq GRNDMQ
220 # define glmoth GLMOTH
221 # define gmedia GMEDIA
224 # define gsdvn2 GSDVN2
226 # define gsdvs2 GSDVS2
228 # define gsdvt2 GSDVT2
231 # define gsposp GSPOSP
232 # define gsrotm GSROTM
233 # define gprotm GPROTM
234 # define gsvolu GSVOLU
235 # define gprint GPRINT
236 # define gdinit GDINIT
239 # define gdrayt GDRAYT
240 # define gdrawc GDRAWC
241 # define gdrawx GDRAWX
242 # define gdhead GDHEAD
243 # define gdwmn1 GDWMN1
244 # define gdwmn2 GDWMN2
245 # define gdwmn3 GDWMN3
247 # define gdcxyz GDCXYZ
249 # define gdfspc GDFSPC
250 # define gdspec GDSPEC
251 # define gdtree GDTREE
252 # define gdelet GDELET
253 # define gdclos GDCLOS
254 # define gdshow GDSHOW
255 # define gdopen GDOPEN
256 # define dzshow DZSHOW
258 # define gfpara GFPARA
259 # define gckpar GCKPAR
260 # define gckmat GCKMAT
261 # define geditv GEDITV
262 # define mzdrop MZDROP
264 # define ertrak ERTRAK
265 # define ertrgo ERTRGO
267 # define setbomb SETBOMB
268 # define setclip SETCLIP
269 # define gcomad GCOMAD
271 # define gbrelm GBRELM
272 # define gprelm GPRELM
276 //____________________________________________________________________________
280 // Prototypes for GEANT functions
282 void type_of_call gzebra(const int&);
284 void type_of_call gpcxyz();
286 void type_of_call ggclos();
288 void type_of_call glast();
290 void type_of_call ginit();
292 void type_of_call gcinit();
294 void type_of_call grun();
296 void type_of_call gtrig();
298 void type_of_call gtrigc();
300 void type_of_call gtrigi();
302 void type_of_call gwork(const int&);
304 void type_of_call gzinit();
306 void type_of_call gmate();
308 void type_of_call gpart();
310 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
312 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
313 Int_t &, Float_t *, Int_t &);
315 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
316 Float_t &, Float_t *, Int_t &);
318 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
321 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
324 void type_of_call gphysi();
326 void type_of_call gdebug();
328 void type_of_call gekbin();
330 void type_of_call gfinds();
332 void type_of_call gsking(Int_t &);
334 void type_of_call gskpho(Int_t &);
336 void type_of_call gsstak(Int_t &);
338 void type_of_call gsxyz();
340 void type_of_call gtrack();
342 void type_of_call gtreve();
344 void type_of_call gtreve_root();
346 void type_of_call grndm(Float_t *, const Int_t &);
348 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
351 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
353 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
354 Int_t *, Int_t * DEFCHARL);
356 void type_of_call gmedia(Float_t *, Int_t &);
358 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
360 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
361 const Float_t &, const Float_t &, const Float_t &,
364 void type_of_call gprotm(const Int_t &);
366 void type_of_call grfile(const Int_t&, DEFCHARD,
367 DEFCHARD DEFCHARL DEFCHARL);
369 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
370 Float_t &, Float_t &, Float_t &, Float_t *,
373 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
374 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
376 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
377 Float_t &, Float_t &, Float_t &, Float_t &,
378 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
380 void type_of_call gftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
382 ,Float_t *, Int_t & DEFCHARL);
384 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
385 Float_t &, Float_t &, Float_t &, Float_t *,
388 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
389 Float_t &, Int_t &, Float_t * DEFCHARL);
391 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
392 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
395 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
396 Float_t &, Float_t &, Float_t &, Float_t &,
397 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
399 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
400 Float_t *absco, Float_t *effic, Float_t *rindex);
401 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
403 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
406 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
407 Int_t & DEFCHARL DEFCHARL);
409 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
412 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
413 Int_t & DEFCHARL DEFCHARL);
415 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
416 Int_t & DEFCHARL DEFCHARL);
418 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
419 Int_t &, Int_t & DEFCHARL DEFCHARL);
421 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
423 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
424 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
427 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
428 Float_t &, Int_t &, DEFCHARD,
429 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
431 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
432 Int_t & DEFCHARL DEFCHARL);
434 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
436 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
439 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
441 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
443 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
445 void type_of_call gdinit();
447 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
449 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
450 Float_t &, Float_t &, Float_t & DEFCHARL);
451 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
452 Float_t &, Float_t &, Float_t & DEFCHARL);
453 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
454 Float_t &, Float_t & DEFCHARL);
455 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
456 Float_t &, Float_t &, Float_t &, Float_t &,
458 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
459 void type_of_call gdxyz(Int_t &);
460 void type_of_call gdcxyz();
461 void type_of_call gdman(Float_t &, Float_t &);
462 void type_of_call gdwmn1(Float_t &, Float_t &);
463 void type_of_call gdwmn2(Float_t &, Float_t &);
464 void type_of_call gdwmn3(Float_t &, Float_t &);
465 void type_of_call gdspec(DEFCHARD DEFCHARL);
466 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
467 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
469 void type_of_call gdopen(Int_t &);
470 void type_of_call gdclos();
471 void type_of_call gdelet(Int_t &);
472 void type_of_call gdshow(Int_t &);
473 void type_of_call geditv(Int_t &) {;}
476 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
477 const int&, const int&, const int& DEFCHARL
480 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
482 void type_of_call setbomb(Float_t &);
483 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
484 Float_t &, Float_t & DEFCHARL);
485 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
487 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
488 const Float_t *x2, const Float_t *p2,
489 const Int_t &ipa, DEFCHARD DEFCHARL);
491 void type_of_call ertrgo();
493 float type_of_call gbrelm(const Float_t &z, const Float_t& t, const Float_t& cut);
494 float type_of_call gprelm(const Float_t &z, const Float_t& t, const Float_t& cut);
498 // Geant3 global pointer
500 static Int_t defSize = 600;
504 //____________________________________________________________________________
508 // Default constructor
512 //____________________________________________________________________________
513 TGeant3::TGeant3(const char *title, Int_t nwgeant)
514 :AliMC("TGeant3",title)
517 // Standard constructor for TGeant3 with ZEBRA initialisation
528 // Load Address of Geant3 commons
531 // Zero number of particles
535 //____________________________________________________________________________
536 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
537 Float_t &radl, Float_t &absl) const
540 // Return the parameters of the current material during transport
544 dens = fGcmate->dens;
545 radl = fGcmate->radl;
546 absl = fGcmate->absl;
547 return 1; //this could be the number of elements in mixture
550 //____________________________________________________________________________
551 void TGeant3::DefaultRange()
554 // Set range of current drawing pad to 20x20 cm
560 higz->Range(0,0,20,20);
563 //____________________________________________________________________________
564 void TGeant3::InitHIGZ()
575 //____________________________________________________________________________
576 void TGeant3::LoadAddress()
579 // Assigns the address of the GEANT common blocks to the structures
580 // that allow their access from C++
583 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
584 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
585 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
586 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
587 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
588 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
589 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
590 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
591 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
592 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
593 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
594 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
595 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
596 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
597 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
598 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
599 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
600 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
601 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
602 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
603 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
606 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
607 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
608 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
609 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
611 // Variables for ZEBRA store
612 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
614 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
619 //_____________________________________________________________________________
620 void TGeant3::GeomIter()
623 // Geometry iterator for moving upward in the geometry tree
624 // Initialise the iterator
626 fNextVol=fGcvolu->nlevel;
629 //____________________________________________________________________________
630 void TGeant3::FinishGeometry()
632 //Close the geometry structure
636 //____________________________________________________________________________
637 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
640 // Geometry iterator for moving upward in the geometry tree
641 // Return next volume up
646 gname=fGcvolu->names[fNextVol];
647 copy=fGcvolu->number[fNextVol];
648 i=fGcvolu->lvolum[fNextVol];
649 name = fVolNames[i-1];
650 if(gname == fZiq[fGclink->jvolum+i]) return i;
651 else printf("GeomTree: Volume %s not found in bank\n",name);
656 //_____________________________________________________________________________
657 void TGeant3::BuildPhysics()
662 //_____________________________________________________________________________
663 Int_t TGeant3::CurrentVolID(Int_t ©) const
666 // Returns the current volume ID and copy number
669 if( (i=fGcvolu->nlevel-1) < 0 ) {
670 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
672 gname=fGcvolu->names[i];
673 copy=fGcvolu->number[i];
674 i=fGcvolu->lvolum[i];
675 if(gname == fZiq[fGclink->jvolum+i]) return i;
676 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
681 //_____________________________________________________________________________
682 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
685 // Return the current volume "off" upward in the geometrical tree
686 // ID and copy number
689 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
690 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
691 off,fGcvolu->nlevel);
693 gname=fGcvolu->names[i];
694 copy=fGcvolu->number[i];
695 i=fGcvolu->lvolum[i];
696 if(gname == fZiq[fGclink->jvolum+i]) return i;
697 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
702 //_____________________________________________________________________________
703 const char* TGeant3::CurrentVolName() const
706 // Returns the current volume name
709 if( (i=fGcvolu->nlevel-1) < 0 ) {
710 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
712 gname=fGcvolu->names[i];
713 i=fGcvolu->lvolum[i];
714 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
715 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
720 //_____________________________________________________________________________
721 const char* TGeant3::CurrentVolOffName(Int_t off) const
724 // Return the current volume "off" upward in the geometrical tree
725 // ID, name and copy number
726 // if name=0 no name is returned
729 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
730 Warning("CurrentVolOffName",
731 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
733 gname=fGcvolu->names[i];
734 i=fGcvolu->lvolum[i];
735 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
736 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
741 //_____________________________________________________________________________
742 Int_t TGeant3::IdFromPDG(Int_t pdg) const
745 // Return Geant3 code from PDG and pseudo ENDF code
747 for(Int_t i=0;i<fNPDGCodes;++i)
748 if(pdg==fPDGCode[i]) return i;
752 //_____________________________________________________________________________
753 Int_t TGeant3::PDGFromId(Int_t id) const
755 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
759 //_____________________________________________________________________________
760 void TGeant3::DefineParticles()
763 // Define standard Geant 3 particles
766 // Load standard numbers for GEANT particles and PDG conversion
767 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
768 fPDGCode[fNPDGCodes++]=22; // 1 = photon
769 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
770 fPDGCode[fNPDGCodes++]=11; // 3 = electron
771 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
772 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
773 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
774 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
775 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
776 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
777 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
778 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
779 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
780 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
781 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
782 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
783 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
784 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
785 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
786 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
787 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
788 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
789 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
790 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
791 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
792 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
793 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
794 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
795 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
796 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
797 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
798 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
799 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
806 /* --- Define additional particles */
807 Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23);
808 fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
810 Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22);
811 fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
813 Gspart(35, "D +", 4, 1.87, 1., 1.066e-12);
814 fPDGCode[fNPDGCodes++]=411; // 35 = D+
816 Gspart(36, "D -", 4, 1.87, -1., 1.066e-12);
817 fPDGCode[fNPDGCodes++]=-411; // 36 = D-
819 Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13);
820 fPDGCode[fNPDGCodes++]=421; // 37 = D0
822 Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13);
823 fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
825 fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
827 fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
829 fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
831 Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24);
832 fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
834 Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24);
835 fPDGCode[fNPDGCodes++]=-213; // 40 = RHO-
837 Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24);
838 fPDGCode[fNPDGCodes++]=113; // 37 = D0
841 // Use ENDF-6 mapping for ions = 10000*z+10*a+iso
843 // and numbers above 5 000 000 for special applications
846 const Int_t kion=10000000;
848 const Int_t kspe=50000000;
850 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
852 const Double_t autogev=0.9314943228;
853 const Double_t hslash = 1.0545726663e-27;
854 const Double_t erggev = 1/1.6021773349e-3;
855 const Double_t hshgev = hslash*erggev;
856 const Double_t yearstosec = 3600*24*365.25;
859 pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE,
860 0,1,"Ion",kion+10020);
861 fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron
863 pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE,
864 hshgev/(12.33*yearstosec),1,"Ion",kion+10030);
865 fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton
867 pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE,
868 hshgev/(12.33*yearstosec),2,"Ion",kion+20040);
869 fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha
871 fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
873 pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE,
874 0,2,"Ion",kion+20030);
875 fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3
877 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
878 0,0,"Special",kspe+50);
879 fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov
881 Gspart(51, "FeedbackPhoton", 7, 0., 0.,1.e20 );
882 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
883 0,0,"Special",kspe+51);
884 fPDGCode[fNPDGCodes++]=kspe+51; // 51 = FeedbackPhoton
886 /* --- Define additional decay modes --- */
887 /* --- omega(783) --- */
888 for (kz = 0; kz < 6; ++kz) {
899 Gsdk(ipa, bratio, mode);
900 /* --- phi(1020) --- */
901 for (kz = 0; kz < 6; ++kz) {
916 Gsdk(ipa, bratio, mode);
918 for (kz = 0; kz < 6; ++kz) {
931 Gsdk(ipa, bratio, mode);
933 for (kz = 0; kz < 6; ++kz) {
946 Gsdk(ipa, bratio, mode);
948 for (kz = 0; kz < 6; ++kz) {
959 Gsdk(ipa, bratio, mode);
960 /* --- Anti D0 --- */
961 for (kz = 0; kz < 6; ++kz) {
972 Gsdk(ipa, bratio, mode);
974 for (kz = 0; kz < 6; ++kz) {
981 Gsdk(ipa, bratio, mode);
983 for (kz = 0; kz < 6; ++kz) {
990 Gsdk(ipa, bratio, mode);
992 for (kz = 0; kz < 6; ++kz) {
999 Gsdk(ipa, bratio, mode);
1002 for (kz = 0; kz < 6; ++kz) {
1011 Gsdk(ipa, bratio, mode);
1014 Gsdk(ipa, bratio, mode);
1017 Gsdk(ipa, bratio, mode);
1022 //_____________________________________________________________________________
1023 Int_t TGeant3::VolId(const Text_t *name) const
1026 // Return the unique numeric identifier for volume name
1029 strncpy((char *) &gname, name, 4);
1030 for(i=1; i<=fGcnum->nvolum; i++)
1031 if(gname == fZiq[fGclink->jvolum+i]) return i;
1032 printf("VolId: Volume %s not found\n",name);
1036 //_____________________________________________________________________________
1037 Int_t TGeant3::NofVolumes() const
1040 // Return total number of volumes in the geometry
1042 return fGcnum->nvolum;
1045 //_____________________________________________________________________________
1046 const char* TGeant3::VolName(Int_t id) const
1049 // Return the volume name given the volume identifier
1051 const char name[5]="NULL";
1052 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1055 return fVolNames[id-1];
1058 //_____________________________________________________________________________
1059 void TGeant3::SetCut(const char* cutName, Float_t cutValue)
1061 if(!strcmp(cutName,"CUTGAM"))
1062 fGccuts->cutgam=cutValue;
1063 else if(!strcmp(cutName,"CUTGAM"))
1064 fGccuts->cutele=cutValue;
1065 else if(!strcmp(cutName,"CUTELE"))
1066 fGccuts->cutneu=cutValue;
1067 else if(!strcmp(cutName,"CUTHAD"))
1068 fGccuts->cuthad=cutValue;
1069 else if(!strcmp(cutName,"CUTMUO"))
1070 fGccuts->cutmuo=cutValue;
1071 else if(!strcmp(cutName,"BCUTE"))
1072 fGccuts->bcute=cutValue;
1073 else if(!strcmp(cutName,"BCUTM"))
1074 fGccuts->bcutm=cutValue;
1075 else if(!strcmp(cutName,"DCUTE"))
1076 fGccuts->dcute=cutValue;
1077 else if(!strcmp(cutName,"DCUTM"))
1078 fGccuts->dcutm=cutValue;
1079 else if(!strcmp(cutName,"PPCUTM"))
1080 fGccuts->ppcutm=cutValue;
1081 else if(!strcmp(cutName,"TOFMAX"))
1082 fGccuts->tofmax=cutValue;
1083 else Warning("SetCut","Cut %s not implemented\n",cutName);
1086 //_____________________________________________________________________________
1087 void TGeant3::SetProcess(const char* flagName, Int_t flagValue)
1089 if(!strcmp(flagName,"PAIR"))
1090 fGcphys->ipair=flagValue;
1091 else if(!strcmp(flagName,"COMP"))
1092 fGcphys->icomp=flagValue;
1093 else if(!strcmp(flagName,"PHOT"))
1094 fGcphys->iphot=flagValue;
1095 else if(!strcmp(flagName,"PFIS"))
1096 fGcphys->ipfis=flagValue;
1097 else if(!strcmp(flagName,"DRAY"))
1098 fGcphys->idray=flagValue;
1099 else if(!strcmp(flagName,"ANNI"))
1100 fGcphys->ianni=flagValue;
1101 else if(!strcmp(flagName,"BREM"))
1102 fGcphys->ibrem=flagValue;
1103 else if(!strcmp(flagName,"HADR"))
1104 fGcphys->ihadr=flagValue;
1105 else if(!strcmp(flagName,"MUNU"))
1106 fGcphys->imunu=flagValue;
1107 else if(!strcmp(flagName,"DCAY"))
1108 fGcphys->idcay=flagValue;
1109 else if(!strcmp(flagName,"LOSS"))
1110 fGcphys->iloss=flagValue;
1111 else if(!strcmp(flagName,"MULS"))
1112 fGcphys->imuls=flagValue;
1113 else if(!strcmp(flagName,"RAYL"))
1114 fGcphys->irayl=flagValue;
1115 else Warning("SetFlag","Flag %s not implemented\n",flagName);
1118 //_____________________________________________________________________________
1119 Float_t TGeant3::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate)
1121 Int_t gpart = IdFromPDG(part);
1122 if(!strcmp(reac,"PHOT"))
1125 Error("Xsec","Can calculate photoelectric only for photons\n");
1131 //_____________________________________________________________________________
1132 void TGeant3::TrackPosition(TLorentzVector &xyz) const
1135 // Return the current position in the master reference frame of the
1136 // track being transported
1138 xyz[0]=fGctrak->vect[0];
1139 xyz[1]=fGctrak->vect[1];
1140 xyz[2]=fGctrak->vect[2];
1141 xyz[3]=fGctrak->tofg;
1144 //_____________________________________________________________________________
1145 Float_t TGeant3::TrackTime() const
1148 // Return the current time of flight of the track being transported
1150 return fGctrak->tofg;
1153 //_____________________________________________________________________________
1154 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
1157 // Return the direction and the momentum (GeV/c) of the track
1158 // currently being transported
1160 Double_t ptot=fGctrak->vect[6];
1161 xyz[0]=fGctrak->vect[3]*ptot;
1162 xyz[1]=fGctrak->vect[4]*ptot;
1163 xyz[2]=fGctrak->vect[5]*ptot;
1164 xyz[3]=fGctrak->getot;
1167 //_____________________________________________________________________________
1168 Float_t TGeant3::TrackCharge() const
1171 // Return charge of the track currently transported
1173 return fGckine->charge;
1176 //_____________________________________________________________________________
1177 Float_t TGeant3::TrackMass() const
1180 // Return the mass of the track currently transported
1182 return fGckine->amass;
1185 //_____________________________________________________________________________
1186 Int_t TGeant3::TrackPid() const
1189 // Return the id of the particle transported
1191 return PDGFromId(fGckine->ipart);
1194 //_____________________________________________________________________________
1195 Float_t TGeant3::TrackStep() const
1198 // Return the length in centimeters of the current step
1200 return fGctrak->step;
1203 //_____________________________________________________________________________
1204 Float_t TGeant3::TrackLength() const
1207 // Return the length of the current track from its origin
1209 return fGctrak->sleng;
1212 //_____________________________________________________________________________
1213 Bool_t TGeant3::IsNewTrack() const
1216 // True if the track is not at the boundary of the current volume
1218 return (fGctrak->sleng>0);
1221 //_____________________________________________________________________________
1222 Bool_t TGeant3::IsTrackInside() const
1225 // True if the track is not at the boundary of the current volume
1227 return (fGctrak->inwvol==0);
1230 //_____________________________________________________________________________
1231 Bool_t TGeant3::IsTrackEntering() const
1234 // True if this is the first step of the track in the current volume
1236 return (fGctrak->inwvol==1);
1239 //_____________________________________________________________________________
1240 Bool_t TGeant3::IsTrackExiting() const
1243 // True if this is the last step of the track in the current volume
1245 return (fGctrak->inwvol==2);
1248 //_____________________________________________________________________________
1249 Bool_t TGeant3::IsTrackOut() const
1252 // True if the track is out of the setup
1254 return (fGctrak->inwvol==3);
1257 //_____________________________________________________________________________
1258 Bool_t TGeant3::IsTrackStop() const
1261 // True if the track energy has fallen below the threshold
1263 return (fGctrak->istop==2);
1266 //_____________________________________________________________________________
1267 Int_t TGeant3::NSecondaries() const
1270 // Number of secondary particles generated in the current step
1272 return fGcking->ngkine;
1275 //_____________________________________________________________________________
1276 Int_t TGeant3::CurrentEvent() const
1279 // Number of the current event
1281 return fGcflag->idevt;
1284 //_____________________________________________________________________________
1285 const char* TGeant3::ProdProcess() const
1288 // Name of the process that has produced the secondary particles
1289 // in the current step
1291 static char proc[5];
1292 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
1295 if(fGcking->ngkine>0) {
1296 for (km = 0; km < fGctrak->nmec; ++km) {
1297 for (im = 0; im < 13; ++im) {
1298 if (fGctrak->lmec[km] == ipmec[im]) {
1299 mec = fGctrak->lmec[km];
1300 if (0 < mec && mec < 31) {
1301 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
1302 } else if (mec - 100 <= 30 && mec - 100 > 0) {
1303 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
1310 strcpy(proc,"UNKN");
1311 } else strcpy(proc,"NONE");
1315 //_____________________________________________________________________________
1316 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
1317 TLorentzVector &x, TLorentzVector &p)
1320 // Get the parameters of the secondary track number isec produced
1321 // in the current step
1324 if(-1<isec && isec<fGcking->ngkine) {
1325 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
1327 x[i]=fGckin3->gpos[isec][i];
1328 p[i]=fGcking->gkin[isec][i];
1330 x[3]=fGcking->tofd[isec];
1331 p[3]=fGcking->gkin[isec][3];
1333 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
1334 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
1339 //_____________________________________________________________________________
1340 void TGeant3::InitLego()
1343 SetDEBU(0,0,0); //do not print a message
1346 //_____________________________________________________________________________
1347 Bool_t TGeant3::IsTrackDisappeared() const
1350 // True if the current particle has disappered
1351 // either because it decayed or because it underwent
1352 // an inelastic collision
1354 return (fGctrak->istop==1);
1357 //_____________________________________________________________________________
1358 Bool_t TGeant3::IsTrackAlive() const
1361 // True if the current particle is alive and will continue to be
1364 return (fGctrak->istop==0);
1367 //_____________________________________________________________________________
1368 void TGeant3::StopTrack()
1371 // Stop the transport of the current particle and skip to the next
1376 //_____________________________________________________________________________
1377 void TGeant3::StopEvent()
1380 // Stop simulation of the current event and skip to the next
1385 //_____________________________________________________________________________
1386 Float_t TGeant3::MaxStep() const
1389 // Return the maximum step length in the current medium
1391 return fGctmed->stemax;
1394 //_____________________________________________________________________________
1395 void TGeant3::SetMaxStep(Float_t maxstep)
1398 // Set the maximum step allowed till the particle is in the current medium
1400 fGctmed->stemax=maxstep;
1403 //_____________________________________________________________________________
1404 void TGeant3::SetMaxNStep(Int_t maxnstp)
1407 // Set the maximum number of steps till the particle is in the current medium
1409 fGctrak->maxnst=maxnstp;
1412 //_____________________________________________________________________________
1413 Int_t TGeant3::GetMaxNStep() const
1416 // Maximum number of steps allowed in current medium
1418 return fGctrak->maxnst;
1421 //_____________________________________________________________________________
1422 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
1423 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
1427 // Defines a Material
1429 // kmat number assigned to the material
1430 // name material name
1431 // a atomic mass in au
1433 // dens density in g/cm3
1434 // absl absorbtion length in cm
1435 // if >=0 it is ignored and the program
1436 // calculates it, if <0. -absl is taken
1437 // radl radiation length in cm
1438 // if >=0 it is ignored and the program
1439 // calculates it, if <0. -radl is taken
1440 // buf pointer to an array of user words
1441 // nbuf number of user words
1443 Int_t jmate=fGclink->jmate;
1449 for(i=1; i<=ns; i++) {
1450 if(fZlq[jmate-i]==0) {
1456 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
1457 nwbuf PASSCHARL(name));
1460 //_____________________________________________________________________________
1461 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
1462 Float_t dens, Int_t nlmat, Float_t* wmat)
1465 // Defines mixture OR COMPOUND IMAT as composed by
1466 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1468 // If NLMAT > 0 then wmat contains the proportion by
1469 // weights of each basic material in the mixture.
1471 // If nlmat < 0 then WMAT contains the number of atoms
1472 // of a given kind into the molecule of the COMPOUND
1473 // In this case, WMAT in output is changed to relative
1476 Int_t jmate=fGclink->jmate;
1482 for(i=1; i<=ns; i++) {
1483 if(fZlq[jmate-i]==0) {
1489 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1492 //_____________________________________________________________________________
1493 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1494 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1495 Float_t stemax, Float_t deemax, Float_t epsil,
1496 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1499 // kmed tracking medium number assigned
1500 // name tracking medium name
1501 // nmat material number
1502 // isvol sensitive volume flag
1503 // ifield magnetic field
1504 // fieldm max. field value (kilogauss)
1505 // tmaxfd max. angle due to field (deg/step)
1506 // stemax max. step allowed
1507 // deemax max. fraction of energy lost in a step
1508 // epsil tracking precision (cm)
1509 // stmin min. step due to continuos processes (cm)
1511 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1512 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1513 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1515 Int_t jtmed=fGclink->jtmed;
1521 for(i=1; i<=ns; i++) {
1522 if(fZlq[jtmed-i]==0) {
1528 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1529 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1532 //_____________________________________________________________________________
1533 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1534 Float_t phiy, Float_t thez, Float_t phiz)
1537 // krot rotation matrix number assigned
1538 // theta1 polar angle for axis i
1539 // phi1 azimuthal angle for axis i
1540 // theta2 polar angle for axis ii
1541 // phi2 azimuthal angle for axis ii
1542 // theta3 polar angle for axis iii
1543 // phi3 azimuthal angle for axis iii
1545 // it defines the rotation matrix number irot.
1547 Int_t jrotm=fGclink->jrotm;
1553 for(i=1; i<=ns; i++) {
1554 if(fZlq[jrotm-i]==0) {
1560 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1563 //_____________________________________________________________________________
1564 Int_t TGeant3::GetMedium() const
1567 // Return the number of the current medium
1569 return fGctmed->numed;
1572 //_____________________________________________________________________________
1573 Float_t TGeant3::Edep() const
1576 // Return the energy lost in the current step
1578 return fGctrak->destep;
1581 //_____________________________________________________________________________
1582 Float_t TGeant3::Etot() const
1585 // Return the total energy of the current track
1587 return fGctrak->getot;
1590 //_____________________________________________________________________________
1591 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1594 // Return an array of n random numbers uniformly distributed
1595 // between 0 and 1 not included
1600 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1602 // Functions from GBASE
1604 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1606 //____________________________________________________________________________
1607 void TGeant3::Gfile(const char *filename, const char *option)
1610 // Routine to open a GEANT/RZ data base.
1612 // LUN logical unit number associated to the file
1614 // CHFILE RZ file name
1616 // CHOPT is a character string which may be
1617 // N To create a new file
1618 // U to open an existing file for update
1619 // " " to open an existing file for read only
1620 // Q The initial allocation (default 1000 records)
1621 // is given in IQUEST(10)
1622 // X Open the file in exchange format
1623 // I Read all data structures from file to memory
1624 // O Write all data structures from memory to file
1627 // If options "I" or "O" all data structures are read or
1628 // written from/to file and the file is closed.
1629 // See routine GRMDIR to create subdirectories
1630 // See routines GROUT,GRIN to write,read objects
1632 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1636 //____________________________________________________________________________
1637 void TGeant3::Gpcxyz()
1640 // Print track and volume parameters at current point
1645 //_____________________________________________________________________________
1646 void TGeant3::Ggclos()
1649 // Closes off the geometry setting.
1650 // Initializes the search list for the contents of each
1651 // volume following the order they have been positioned, and
1652 // inserting the content '0' when a call to GSNEXT (-1) has
1653 // been required by the user.
1654 // Performs the development of the JVOLUM structure for all
1655 // volumes with variable parameters, by calling GGDVLP.
1656 // Interprets the user calls to GSORD, through GGORD.
1657 // Computes and stores in a bank (next to JVOLUM mother bank)
1658 // the number of levels in the geometrical tree and the
1659 // maximum number of contents per level, by calling GGNLEV.
1660 // Sets status bit for CONCAVE volumes, through GGCAVE.
1661 // Completes the JSET structure with the list of volume names
1662 // which identify uniquely a given physical detector, the
1663 // list of bit numbers to pack the corresponding volume copy
1664 // numbers, and the generic path(s) in the JVOLUM tree,
1665 // through the routine GHCLOS.
1668 // Create internal list of volumes
1669 fVolNames = new char[fGcnum->nvolum][5];
1671 for(i=0; i<fGcnum->nvolum; ++i) {
1672 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
1673 fVolNames[i][4]='\0';
1677 //_____________________________________________________________________________
1678 void TGeant3::Glast()
1681 // Finish a Geant run
1686 //_____________________________________________________________________________
1687 void TGeant3::Gprint(const char *name)
1690 // Routine to print data structures
1691 // CHNAME name of a data structure
1695 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1698 //_____________________________________________________________________________
1699 void TGeant3::Grun()
1702 // Steering function to process one run
1707 //_____________________________________________________________________________
1708 void TGeant3::Gtrig()
1711 // Steering function to process one event
1716 //_____________________________________________________________________________
1717 void TGeant3::Gtrigc()
1720 // Clear event partition
1725 //_____________________________________________________________________________
1726 void TGeant3::Gtrigi()
1729 // Initialises event partition
1734 //_____________________________________________________________________________
1735 void TGeant3::Gwork(Int_t nwork)
1738 // Allocates workspace in ZEBRA memory
1743 //_____________________________________________________________________________
1744 void TGeant3::Gzinit()
1747 // To initialise GEANT/ZEBRA data structures
1752 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1754 // Functions from GCONS
1756 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1758 //_____________________________________________________________________________
1759 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1760 Float_t &dens, Float_t &radl, Float_t &absl,
1761 Float_t* ubuf, Int_t& nbuf)
1764 // Return parameters for material IMAT
1766 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1770 //_____________________________________________________________________________
1771 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1772 Float_t &amass, Float_t &charge, Float_t &tlife)
1775 // Return parameters for particle of type IPART
1779 Int_t igpart = IdFromPDG(ipart);
1780 gfpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1784 //_____________________________________________________________________________
1785 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1786 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1787 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1788 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1791 // Return parameters for tracking medium NUMED
1793 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1794 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1798 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
1799 Float_t* tkin, Float_t* value, Float_t* pcut,
1803 // Return parameters for tracking medium NUMED
1805 gftmat(imate, ipart, PASSCHARD(chmeca), kdim,
1806 tkin, value, pcut, ixst PASSCHARL(chmeca));
1810 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
1812 return gbrelm(z,t,bcut);
1815 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
1817 return gprelm(z,t,bcut);
1820 //_____________________________________________________________________________
1821 void TGeant3::Gmate()
1824 // Define standard GEANT materials
1829 //_____________________________________________________________________________
1830 void TGeant3::Gpart()
1833 // Define standard GEANT particles plus selected decay modes
1834 // and branching ratios.
1839 //_____________________________________________________________________________
1840 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1842 // Defines branching ratios and decay modes for standard
1844 gsdk(ipart,bratio,mode);
1847 //_____________________________________________________________________________
1848 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1849 Float_t dens, Float_t radl, Float_t absl)
1852 // Defines a Material
1854 // kmat number assigned to the material
1855 // name material name
1856 // a atomic mass in au
1858 // dens density in g/cm3
1859 // absl absorbtion length in cm
1860 // if >=0 it is ignored and the program
1861 // calculates it, if <0. -absl is taken
1862 // radl radiation length in cm
1863 // if >=0 it is ignored and the program
1864 // calculates it, if <0. -radl is taken
1865 // buf pointer to an array of user words
1866 // nbuf number of user words
1870 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1874 //_____________________________________________________________________________
1875 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1876 Float_t dens, Int_t nlmat, Float_t *wmat)
1879 // Defines mixture OR COMPOUND IMAT as composed by
1880 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1882 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1883 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1885 // If NLMAT.LT.0 then WMAT contains the number of atoms
1886 // of a given kind into the molecule of the COMPOUND
1887 // In this case, WMAT in output is changed to relative
1890 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1893 //_____________________________________________________________________________
1894 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1895 Float_t amass, Float_t charge, Float_t tlife)
1898 // Store particle parameters
1900 // ipart particle code
1901 // name particle name
1902 // itrtyp transport method (see GEANT manual)
1903 // amass mass in GeV/c2
1904 // charge charge in electron units
1905 // tlife lifetime in seconds
1909 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1913 //_____________________________________________________________________________
1914 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1915 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1916 Float_t stemax, Float_t deemax, Float_t epsil,
1920 // NTMED Tracking medium number
1921 // NAME Tracking medium name
1922 // NMAT Material number
1923 // ISVOL Sensitive volume flag
1924 // IFIELD Magnetic field
1925 // FIELDM Max. field value (Kilogauss)
1926 // TMAXFD Max. angle due to field (deg/step)
1927 // STEMAX Max. step allowed
1928 // DEEMAX Max. fraction of energy lost in a step
1929 // EPSIL Tracking precision (cm)
1930 // STMIN Min. step due to continuos processes (cm)
1932 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1933 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1934 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1938 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1939 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1942 //_____________________________________________________________________________
1943 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1944 Float_t *absco, Float_t *effic, Float_t *rindex)
1947 // Stores the tables for UV photon tracking in medium ITMED
1948 // Please note that it is the user's responsability to
1949 // provide all the coefficients:
1952 // ITMED Tracking medium number
1953 // NPCKOV Number of bins of each table
1954 // PPCKOV Value of photon momentum (in GeV)
1955 // ABSCO Absorbtion coefficients
1956 // dielectric: absorbtion length in cm
1957 // metals : absorbtion fraction (0<=x<=1)
1958 // EFFIC Detection efficiency for UV photons
1959 // RINDEX Refraction index (if=0 metal)
1961 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1964 //_____________________________________________________________________________
1965 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1968 // To change the value of cut or mechanism "CHPAR"
1969 // to a new value PARVAL for tracking medium ITMED
1970 // The data structure JTMED contains the standard tracking
1971 // parameters (CUTS and flags to control the physics processes) which
1972 // are used by default for all tracking media. It is possible to
1973 // redefine individually with GSTPAR any of these parameters for a
1974 // given tracking medium.
1975 // ITMED tracking medium number
1976 // CHPAR is a character string (variable name)
1977 // PARVAL must be given as a floating point.
1979 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1982 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1984 // Functions from GCONS
1986 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1988 //_____________________________________________________________________________
1989 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1992 // Storing/Retrieving Vertex and Track parameters
1993 // ----------------------------------------------
1995 // Stores vertex parameters.
1996 // VERT array of (x,y,z) position of the vertex
1997 // NTBEAM beam track number origin of the vertex
1998 // =0 if none exists
1999 // NTTARG target track number origin of the vertex
2000 // UBUF user array of NUBUF floating point numbers
2002 // NVTX new vertex number (=0 in case of error).
2003 // Prints vertex parameters.
2004 // IVTX for vertex IVTX.
2005 // (For all vertices if IVTX=0)
2006 // Stores long life track parameters.
2007 // PLAB components of momentum
2008 // IPART type of particle (see GSPART)
2009 // NV vertex number origin of track
2010 // UBUF array of NUBUF floating point user parameters
2012 // NT track number (if=0 error).
2013 // Retrieves long life track parameters.
2014 // ITRA track number for which parameters are requested
2015 // VERT vector origin of the track
2016 // PVERT 4 momentum components at the track origin
2017 // IPART particle type (=0 if track ITRA does not exist)
2018 // NVERT vertex number origin of the track
2019 // UBUF user words stored in GSKINE.
2020 // Prints initial track parameters.
2021 // ITRA for track ITRA
2022 // (For all tracks if ITRA=0)
2026 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
2029 //_____________________________________________________________________________
2030 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
2034 // Retrieves the parameter of a vertex bank
2035 // Vertex is generated from tracks NTBEAM NTTARG
2036 // NVTX is the new vertex number
2040 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
2043 //_____________________________________________________________________________
2044 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
2048 // Store kinematics of track NT into data structure
2049 // Track is coming from vertex NV
2052 gskine(plab, ipart, nv, buf, nwbuf, nt);
2056 //_____________________________________________________________________________
2057 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
2061 // Creates a new vertex bank
2062 // Vertex is generated from tracks NTBEAM NTTARG
2063 // NVTX is the new vertex number
2066 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
2070 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2072 // Functions from GPHYS
2074 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2076 //_____________________________________________________________________________
2077 void TGeant3::Gphysi()
2080 // Initialise material constants for all the physics
2081 // mechanisms used by GEANT
2086 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2088 // Functions from GTRAK
2090 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2092 //_____________________________________________________________________________
2093 void TGeant3::Gdebug()
2096 // Debug the current step
2101 //_____________________________________________________________________________
2102 void TGeant3::Gekbin()
2105 // To find bin number in kinetic energy table
2106 // stored in ELOW(NEKBIN)
2111 //_____________________________________________________________________________
2112 void TGeant3::Gfinds()
2115 // Returns the set/volume parameters corresponding to
2116 // the current space point in /GCTRAK/
2117 // and fill common /GCSETS/
2119 // IHSET user set identifier
2120 // IHDET user detector identifier
2121 // ISET set number in JSET
2122 // IDET detector number in JS=LQ(JSET-ISET)
2123 // IDTYPE detector type (1,2)
2124 // NUMBV detector volume numbers (array of length NVNAME)
2125 // NVNAME number of volume levels
2130 //_____________________________________________________________________________
2131 void TGeant3::Gsking(Int_t igk)
2134 // Stores in stack JSTAK either the IGKth track of /GCKING/,
2135 // or the NGKINE tracks when IGK is 0.
2140 //_____________________________________________________________________________
2141 void TGeant3::Gskpho(Int_t igk)
2144 // Stores in stack JSTAK either the IGKth Cherenkov photon of
2145 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
2150 //_____________________________________________________________________________
2151 void TGeant3::Gsstak(Int_t iflag)
2154 // Stores in auxiliary stack JSTAK the particle currently
2155 // described in common /GCKINE/.
2157 // On request, creates also an entry in structure JKINE :
2159 // 0 : No entry in JKINE structure required (user)
2160 // 1 : New entry in JVERTX / JKINE structures required (user)
2161 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
2162 // 2 : Entry in JKINE structure exists already (from GTREVE)
2167 //_____________________________________________________________________________
2168 void TGeant3::Gsxyz()
2171 // Store space point VECT in banks JXYZ
2176 //_____________________________________________________________________________
2177 void TGeant3::Gtrack()
2180 // Controls tracking of current particle
2185 //_____________________________________________________________________________
2186 void TGeant3::Gtreve()
2189 // Controls tracking of all particles belonging to the current event
2194 //_____________________________________________________________________________
2195 void TGeant3::Gtreve_root()
2198 // Controls tracking of all particles belonging to the current event
2203 //_____________________________________________________________________________
2204 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
2207 // To generate a vector RVECV of LEN random numbers
2208 // Copy of the CERN Library routine RANECU
2212 //_____________________________________________________________________________
2213 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
2214 const Text_t *chopt)
2217 // To set/retrieve the seed of the random number generator
2219 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
2222 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2224 // Functions from GDRAW
2226 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2228 //_____________________________________________________________________________
2229 void TGeant3::Gdxyz(Int_t it)
2232 // Draw the points stored with Gsxyz relative to track it
2237 //_____________________________________________________________________________
2238 void TGeant3::Gdcxyz()
2241 // Draw the position of the current track
2246 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2248 // Functions from GGEOM
2250 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2252 //_____________________________________________________________________________
2253 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
2256 // Computes coordinates XM (Master Reference System
2257 // knowing the coordinates XD (Detector Ref System)
2258 // The local reference system can be initialized by
2259 // - the tracking routines and GDTOM used in GUSTEP
2260 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2261 // (inverse routine is GMTOD)
2263 // If IFLAG=1 convert coordinates
2264 // IFLAG=2 convert direction cosinus
2266 gdtom(xd, xm, iflag);
2269 //_____________________________________________________________________________
2270 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
2274 // Loads the top part of the Volume tree in LVOLS (IVO's),
2275 // LINDX (IN indices) for a given volume defined through
2276 // its name IUDET and number IUNUM.
2278 // The routine stores only upto the last level where JVOLUM
2279 // data structure is developed. If there is no development
2280 // above the current level, it returns NLEV zero.
2282 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
2285 //_____________________________________________________________________________
2286 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
2289 // Finds in which volume/medium the point X is, and updates the
2290 // common /GCVOLU/ and the structure JGPAR accordingly.
2292 // NUMED returns the tracking medium number, or 0 if point is
2293 // outside the experimental setup.
2298 //_____________________________________________________________________________
2299 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
2302 // Computes coordinates XD (in DRS)
2303 // from known coordinates XM in MRS
2304 // The local reference system can be initialized by
2305 // - the tracking routines and GMTOD used in GUSTEP
2306 // - a call to GMEDIA(XM,NUMED)
2307 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2308 // (inverse routine is GDTOM)
2310 // If IFLAG=1 convert coordinates
2311 // IFLAG=2 convert direction cosinus
2313 gmtod(xm, xd, iflag);
2316 //_____________________________________________________________________________
2317 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
2321 // Create a new volume by dividing an existing one
2324 // MOTHER Mother volume name
2325 // NDIV Number of divisions
2328 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
2329 // It divides a previously defined volume.
2334 Vname(mother,vmother);
2335 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
2336 PASSCHARL(vmother));
2339 //_____________________________________________________________________________
2340 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
2341 Int_t iaxis, Float_t c0i, Int_t numed)
2344 // Create a new volume by dividing an existing one
2346 // Divides mother into ndiv divisions called name
2347 // along axis iaxis starting at coordinate value c0.
2348 // the new volume created will be medium number numed.
2353 Vname(mother,vmother);
2354 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
2355 PASSCHARL(vname) PASSCHARL(vmother));
2358 //_____________________________________________________________________________
2359 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
2360 Int_t iaxis, Int_t numed)
2363 // Create a new volume by dividing an existing one
2368 Vname(mother,vmother);
2369 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
2370 PASSCHARL(vname) PASSCHARL(vmother));
2373 //_____________________________________________________________________________
2374 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
2375 Int_t iaxis, Float_t c0, Int_t numed)
2378 // Create a new volume by dividing an existing one
2383 Vname(mother,vmother);
2384 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
2385 PASSCHARL(vname) PASSCHARL(vmother));
2388 //_____________________________________________________________________________
2389 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
2390 Int_t iaxis, Int_t numed, Int_t ndvmx)
2393 // Create a new volume by dividing an existing one
2395 // Divides MOTHER into divisions called NAME along
2396 // axis IAXIS in steps of STEP. If not exactly divisible
2397 // will make as many as possible and will centre them
2398 // with respect to the mother. Divisions will have medium
2399 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
2400 // NDVMX is the expected maximum number of divisions
2401 // (If 0, no protection tests are performed)
2406 Vname(mother,vmother);
2407 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
2408 PASSCHARL(vname) PASSCHARL(vmother));
2411 //_____________________________________________________________________________
2412 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
2413 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
2416 // Create a new volume by dividing an existing one
2418 // Divides MOTHER into divisions called NAME along
2419 // axis IAXIS starting at coordinate value C0 with step
2421 // The new volume created will have medium number NUMED.
2422 // If NUMED is 0, NUMED of mother is taken.
2423 // NDVMX is the expected maximum number of divisions
2424 // (If 0, no protection tests are performed)
2429 Vname(mother,vmother);
2430 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
2431 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
2434 //_____________________________________________________________________________
2435 void TGeant3::Gsord(const char *name, Int_t iax)
2438 // Flags volume CHNAME whose contents will have to be ordered
2439 // along axis IAX, by setting the search flag to -IAX
2443 // IAX = 4 Rxy (static ordering only -> GTMEDI)
2444 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
2445 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
2446 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
2447 // IAX = 6 PHI (PHI=0 => X axis)
2448 // IAX = 7 THETA (THETA=0 => Z axis)
2452 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
2455 //_____________________________________________________________________________
2456 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
2457 Float_t y, Float_t z, Int_t irot, const char *konly)
2460 // Position a volume into an existing one
2463 // NUMBER Copy number of the volume
2464 // MOTHER Mother volume name
2465 // X X coord. of the volume in mother ref. sys.
2466 // Y Y coord. of the volume in mother ref. sys.
2467 // Z Z coord. of the volume in mother ref. sys.
2468 // IROT Rotation matrix number w.r.t. mother ref. sys.
2469 // ONLY ONLY/MANY flag
2471 // It positions a previously defined volume in the mother.
2476 Vname(mother,vmother);
2477 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2478 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
2482 //_____________________________________________________________________________
2483 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
2484 Float_t x, Float_t y, Float_t z, Int_t irot,
2485 const char *konly, Float_t *upar, Int_t np )
2488 // Place a copy of generic volume NAME with user number
2489 // NR inside MOTHER, with its parameters UPAR(1..NP)
2494 Vname(mother,vmother);
2495 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2496 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2500 //_____________________________________________________________________________
2501 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2502 Float_t phi2, Float_t theta3, Float_t phi3)
2505 // nmat Rotation matrix number
2506 // THETA1 Polar angle for axis I
2507 // PHI1 Azimuthal angle for axis I
2508 // THETA2 Polar angle for axis II
2509 // PHI2 Azimuthal angle for axis II
2510 // THETA3 Polar angle for axis III
2511 // PHI3 Azimuthal angle for axis III
2513 // It defines the rotation matrix number IROT.
2515 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2518 //_____________________________________________________________________________
2519 void TGeant3::Gprotm(Int_t nmat)
2522 // To print rotation matrices structure JROTM
2523 // nmat Rotation matrix number
2528 //_____________________________________________________________________________
2529 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2530 Float_t *upar, Int_t npar)
2534 // SHAPE Volume type
2535 // NUMED Tracking medium number
2536 // NPAR Number of shape parameters
2537 // UPAR Vector containing shape parameters
2539 // It creates a new volume in the JVOLUM data structure.
2545 Vname(shape,vshape);
2546 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2547 PASSCHARL(vname) PASSCHARL(vshape));
2551 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2553 // T H E D R A W I N G P A C K A G E
2554 // ======================================
2555 // Drawing functions. These functions allow the visualization in several ways
2556 // of the volumes defined in the geometrical data structure. It is possible
2557 // to draw the logical tree of volumes belonging to the detector (DTREE),
2558 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2559 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2560 // these commands when the hidden line removal option is activated; in
2561 // this case, the volumes can be also either translated in the space
2562 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2563 // possible to fill the surfaces of the volumes
2564 // with solid colours when the shading option (SHAD) is activated.
2565 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2566 // of the detectors or to scan physical events as well.
2567 // Finally, the command MOVE will allow the rotation, translation and zooming
2568 // on real time parts of the detectors or tracks and hits of a simulated event.
2569 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2570 // the drawing is performed by the Geant ray-tracing;
2571 // automatically, the color is assigned according to the tracking medium of each
2572 // volume and the volumes with a density lower/equal than the air are considered
2573 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2574 // the user can set color and visibility for the desired volumes via the command
2575 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2576 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2577 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2578 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2579 // first case, we assume that the first mother volume of the tree is a box with
2580 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2581 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2582 // second case, the distance between the observer and the origin of the world
2583 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2584 // or telescopic effects can be achieved changing the scale factors in the command
2585 // (DRAW). When the final picture does not occupy the full window,
2586 // mapping the space before tracing can speed up the drawing, but can also
2587 // produce less precise results; values from 1 to 4 are allowed in the command
2588 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2589 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2590 // The command (VALCUT) allows the cutting of the detector by three planes
2591 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2592 // SATT for any desired volume and can assume values from 0 to 7; it determines
2593 // the different light processing to be performed for different materials:
2594 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2595 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2596 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2597 // is 0.9) and the observer is assumed to have a light source (therefore he will
2598 // produce parallel light in the case of parallel view and point-like-source
2599 // light in the case of perspective view).
2601 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2603 //_____________________________________________________________________________
2604 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2608 // IOPT Name of the attribute to be set
2609 // IVAL Value to which the attribute is to be set
2611 // name= "*" stands for all the volumes.
2612 // iopt can be chosen among the following :
2614 // WORK 0=volume name is inactive for the tracking
2615 // 1=volume name is active for the tracking (default)
2617 // SEEN 0=volume name is invisible
2618 // 1=volume name is visible (default)
2619 // -1=volume invisible with all its descendants in the tree
2620 // -2=volume visible but not its descendants in the tree
2622 // LSTY line style 1,2,3,... (default=1)
2623 // LSTY=7 will produce a very precise approximation for
2624 // revolution bodies.
2626 // LWID line width -7,...,1,2,3,..7 (default=1)
2627 // LWID<0 will act as abs(LWID) was set for the volume
2628 // and for all the levels below it. When SHAD is 'ON', LWID
2629 // represent the linewidth of the scan lines filling the surfaces
2630 // (whereas the FILL value represent their number). Therefore
2631 // tuning this parameter will help to obtain the desired
2632 // quality/performance ratio.
2634 // COLO colour code -166,...,1,2,..166 (default=1)
2636 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2637 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2638 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2639 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2640 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2641 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2642 // colour=n*10+m, m=1,2,...9, will produce the same colour
2643 // as 'n', but with increasing luminosity according to 'm';
2644 // COLO<0 will act as if abs(COLO) was set for the volume
2645 // and for all the levels below it.
2646 // When for a volume the attribute FILL is > 1 (and the
2647 // option SHAD is on), the ABS of its colour code must be < 8
2648 // because an automatic shading of its faces will be
2651 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2652 // when option SHAD is "on" the FILL attribute of any
2653 // volume can be set different from 0 (normal drawing);
2654 // if it is set to 1, the faces of such volume will be filled
2655 // with solid colours; if ABS(FILL) is > 1, then a light
2656 // source is placed along the observer line, and the faces of
2657 // such volumes will be painted by colours whose luminosity
2658 // will depend on the amount of light reflected;
2659 // if ABS(FILL) = 1, then it is possible to use all the 166
2660 // colours of the colour table, becouse the automatic shading
2661 // is not performed;
2662 // for increasing values of FILL the drawing will be performed
2663 // with higher and higher resolution improving the quality (the
2664 // number of scan lines used to fill the faces increases with FILL);
2665 // it is possible to set different values of FILL
2666 // for different volumes, in order to optimize at the same time
2667 // the performance and the quality of the picture;
2668 // FILL<0 will act as if abs(FILL) was set for the volume
2669 // and for all the levels below it.
2670 // This kind of drawing can be saved in 'picture files'
2671 // or in view banks.
2672 // 0=drawing without fill area
2673 // 1=faces filled with solid colours and resolution = 6
2674 // 2=lowest resolution (very fast)
2675 // 3=default resolution
2676 // 4=.................
2677 // 5=.................
2678 // 6=.................
2680 // Finally, if a coloured background is desired, the FILL
2681 // attribute for the first volume of the tree must be set
2682 // equal to -abs(colo), colo being >0 and <166.
2684 // SET set number associated to volume name
2685 // DET detector number associated to volume name
2686 // DTYP detector type (1,2)
2693 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2697 //_____________________________________________________________________________
2698 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2699 Int_t& natt, Float_t* par, Float_t* att)
2702 // Find the parameters of a volume
2704 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2708 //_____________________________________________________________________________
2709 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2712 // Check the parameters of a shape
2714 gckpar(ish,npar,par);
2717 //_____________________________________________________________________________
2718 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2721 // Check the parameters of a tracking medium
2723 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2726 //_____________________________________________________________________________
2727 void TGeant3::Gdelete(Int_t iview)
2730 // IVIEW View number
2732 // It deletes a view bank from memory.
2737 //_____________________________________________________________________________
2738 void TGeant3::Gdopen(Int_t iview)
2741 // IVIEW View number
2743 // When a drawing is very complex and requires a long time to be
2744 // executed, it can be useful to store it in a view bank: after a
2745 // call to DOPEN and the execution of the drawing (nothing will
2746 // appear on the screen), and after a necessary call to DCLOSE,
2747 // the contents of the bank can be displayed in a very fast way
2748 // through a call to DSHOW; therefore, the detector can be easily
2749 // zoomed many times in different ways. Please note that the pictures
2750 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2757 //_____________________________________________________________________________
2758 void TGeant3::Gdclose()
2761 // It closes the currently open view bank; it must be called after the
2762 // end of the drawing to be stored.
2767 //_____________________________________________________________________________
2768 void TGeant3::Gdshow(Int_t iview)
2771 // IVIEW View number
2773 // It shows on the screen the contents of a view bank. It
2774 // can be called after a view bank has been closed.
2779 //_____________________________________________________________________________
2780 void TGeant3::Gdopt(const char *name,const char *value)
2784 // VALUE Option value
2786 // To set/modify the drawing options.
2789 // THRZ ON Draw tracks in R vs Z
2790 // OFF (D) Draw tracks in X,Y,Z
2793 // PROJ PARA (D) Parallel projection
2795 // TRAK LINE (D) Trajectory drawn with lines
2796 // POIN " " with markers
2797 // HIDE ON Hidden line removal using the CG package
2798 // OFF (D) No hidden line removal
2799 // SHAD ON Fill area and shading of surfaces.
2800 // OFF (D) Normal hidden line removal.
2801 // RAYT ON Ray-tracing on.
2802 // OFF (D) Ray-tracing off.
2803 // EDGE OFF Does not draw contours when shad is on.
2804 // ON (D) Normal shading.
2805 // MAPP 1,2,3,4 Mapping before ray-tracing.
2806 // 0 (D) No mapping.
2807 // USER ON User graphics options in the raytracing.
2808 // OFF (D) Automatic graphics options.
2814 Vname(value,vvalue);
2815 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2819 //_____________________________________________________________________________
2820 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2821 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2826 // THETA Viewing angle theta (for 3D projection)
2827 // PHI Viewing angle phi (for 3D projection)
2828 // PSI Viewing angle psi (for 2D rotation)
2829 // U0 U-coord. (horizontal) of volume origin
2830 // V0 V-coord. (vertical) of volume origin
2831 // SU Scale factor for U-coord.
2832 // SV Scale factor for V-coord.
2834 // This function will draw the volumes,
2835 // selected with their graphical attributes, set by the Gsatt
2836 // facility. The drawing may be performed with hidden line removal
2837 // and with shading effects according to the value of the options HIDE
2838 // and SHAD; if the option SHAD is ON, the contour's edges can be
2839 // drawn or not. If the option HIDE is ON, the detector can be
2840 // exploded (BOMB), clipped with different shapes (CVOL), and some
2841 // of its parts can be shifted from their original
2842 // position (SHIFT). When HIDE is ON, if
2843 // the drawing requires more than the available memory, the program
2844 // will evaluate and display the number of missing words
2845 // (so that the user can increase the
2846 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2847 // the program will print messages about the memory used and
2848 // statistics on the volumes' visibility.
2849 // The following commands will produce the drawing of a green
2850 // volume, specified by NAME, without using the hidden line removal
2851 // technique, using the hidden line removal technique,
2852 // with different linewidth and colour (red), with
2853 // solid colour, with shading of surfaces, and without edges.
2854 // Finally, some examples are given for the ray-tracing. (A possible
2855 // string for the NAME of the volume can be found using the command DTREE).
2861 if (fGcvdma->raytra != 1) {
2862 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2864 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2868 //_____________________________________________________________________________
2869 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2870 Float_t v0,Float_t ul,Float_t vl)
2875 // CUTVAL Cut plane distance from the origin along the axis
2877 // U0 U-coord. (horizontal) of volume origin
2878 // V0 V-coord. (vertical) of volume origin
2879 // SU Scale factor for U-coord.
2880 // SV Scale factor for V-coord.
2882 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2883 // and placed at the distance cutval from the origin.
2884 // The resulting picture is seen from the the same axis.
2885 // When HIDE Mode is ON, it is possible to get the same effect with
2886 // the CVOL/BOX function.
2892 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2895 //_____________________________________________________________________________
2896 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2897 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2898 Float_t v0,Float_t ul,Float_t vl)
2902 // CUTTHE Theta angle of the line normal to cut plane
2903 // CUTPHI Phi angle of the line normal to cut plane
2904 // CUTVAL Cut plane distance from the origin along the axis
2906 // THETA Viewing angle theta (for 3D projection)
2907 // PHI Viewing angle phi (for 3D projection)
2908 // U0 U-coord. (horizontal) of volume origin
2909 // V0 V-coord. (vertical) of volume origin
2910 // SU Scale factor for U-coord.
2911 // SV Scale factor for V-coord.
2913 // The cut plane is normal to the line given by the cut angles
2914 // cutthe and cutphi and placed at the distance cutval from the origin.
2915 // The resulting picture is seen from the viewing angles theta,phi.
2921 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2925 //_____________________________________________________________________________
2926 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2931 // ISEL Option flag D=111110
2933 // CHRSIZ Character size (cm) of title NAME D=0.6
2936 // 0 to have only the header lines
2937 // xxxxx1 to add the text name centered on top of header
2938 // xxxx1x to add global detector name (first volume) on left
2939 // xxx1xx to add date on right
2940 // xx1xxx to select thick characters for text on top of header
2941 // x1xxxx to add the text 'EVENT NR x' on top of header
2942 // 1xxxxx to add the text 'RUN NR x' on top of header
2943 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2944 // i.e. they generate overwritten text.
2946 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2949 //_____________________________________________________________________________
2950 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2953 // Draw a 2D-man at position (U0,V0)
2955 // U U-coord. (horizontal) of the centre of man' R
2956 // V V-coord. (vertical) of the centre of man' R
2957 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2959 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2960 // It superimposes the picure of a man or of a woman, chosen among
2961 // three different ones, with the same scale factors as the detector
2962 // in the current drawing.
2965 if (opt.Contains("WM1")) {
2967 } else if (opt.Contains("WM3")) {
2969 } else if (opt.Contains("WM2")) {
2976 //_____________________________________________________________________________
2977 void TGeant3::Gdspec(const char *name)
2982 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2983 // its geometrical specifications. The 3D drawing will
2984 // be performed according the current values of the options HIDE and
2985 // SHAD and according the current SetClipBox clipping parameters for that
2992 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2995 //_____________________________________________________________________________
2996 void TGeant3::DrawOneSpec(const char *name)
2999 // Function called when one double-clicks on a volume name
3000 // in a TPavelabel drawn by Gdtree.
3002 THIGZ *higzSave = higz;
3003 higzSave->SetName("higzSave");
3004 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
3005 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
3006 if (higzSpec) higz = higzSpec;
3007 else higzSpec = new THIGZ(defSize);
3008 higzSpec->SetName("higzSpec");
3013 gdspec(PASSCHARD(vname) PASSCHARL(vname));
3016 higzSave->SetName("higz");
3020 //_____________________________________________________________________________
3021 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
3025 // LEVMAX Depth level
3028 // This function draws the logical tree,
3029 // Each volume in the tree is represented by a TPaveTree object.
3030 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
3031 // Use TPaveTree pop-up menu to select:
3034 // - drawing tree of parent
3040 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3044 //_____________________________________________________________________________
3045 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
3049 // LEVMAX Depth level
3052 // This function draws the logical tree of the parent of name.
3056 // Scan list of volumes in JVOLUM
3058 Int_t gname, i, jvo, in, nin, jin, num;
3059 strncpy((char *) &gname, name, 4);
3060 for(i=1; i<=fGcnum->nvolum; i++) {
3061 jvo = fZlq[fGclink->jvolum-i];
3062 nin = Int_t(fZq[jvo+3]);
3063 if (nin == -1) nin = 1;
3064 for (in=1;in<=nin;in++) {
3066 num = Int_t(fZq[jin+2]);
3067 if(gname == fZiq[fGclink->jvolum+num]) {
3068 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
3070 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
3078 //_____________________________________________________________________________
3079 void TGeant3::SetABAN(Int_t par)
3082 // par = 1 particles will be stopped according to their residual
3083 // range if they are not in a sensitive material and are
3084 // far enough from the boundary
3085 // 0 particles are transported normally
3087 fGcphys->dphys1 = par;
3091 //_____________________________________________________________________________
3092 void TGeant3::SetANNI(Int_t par)
3095 // To control positron annihilation.
3096 // par =0 no annihilation
3097 // =1 annihilation. Decays processed.
3098 // =2 annihilation. No decay products stored.
3100 fGcphys->ianni = par;
3104 //_____________________________________________________________________________
3105 void TGeant3::SetAUTO(Int_t par)
3108 // To control automatic calculation of tracking medium parameters:
3109 // par =0 no automatic calculation;
3110 // =1 automati calculation.
3112 fGctrak->igauto = par;
3116 //_____________________________________________________________________________
3117 void TGeant3::SetBOMB(Float_t boom)
3120 // BOOM : Exploding factor for volumes position
3122 // To 'explode' the detector. If BOOM is positive (values smaller
3123 // than 1. are suggested, but any value is possible)
3124 // all the volumes are shifted by a distance
3125 // proportional to BOOM along the direction between their centre
3126 // and the origin of the MARS; the volumes which are symmetric
3127 // with respect to this origin are simply not shown.
3128 // BOOM equal to 0 resets the normal mode.
3129 // A negative (greater than -1.) value of
3130 // BOOM will cause an 'implosion'; for even lower values of BOOM
3131 // the volumes' positions will be reflected respect to the origin.
3132 // This command can be useful to improve the 3D effect for very
3133 // complex detectors. The following commands will make explode the
3140 //_____________________________________________________________________________
3141 void TGeant3::SetBREM(Int_t par)
3144 // To control bremstrahlung.
3145 // par =0 no bremstrahlung
3146 // =1 bremstrahlung. Photon processed.
3147 // =2 bremstrahlung. No photon stored.
3149 fGcphys->ibrem = par;
3153 //_____________________________________________________________________________
3154 void TGeant3::SetCKOV(Int_t par)
3157 // To control Cerenkov production
3158 // par =0 no Cerenkov;
3160 // =2 Cerenkov with primary stopped at each step.
3162 fGctlit->itckov = par;
3166 //_____________________________________________________________________________
3167 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
3168 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
3171 // The hidden line removal technique is necessary to visualize properly
3172 // very complex detectors. At the same time, it can be useful to visualize
3173 // the inner elements of a detector in detail. This function allows
3174 // subtractions (via boolean operation) of BOX shape from any part of
3175 // the detector, therefore showing its inner contents.
3176 // If "*" is given as the name of the
3177 // volume to be clipped, all volumes are clipped by the given box.
3178 // A volume can be clipped at most twice.
3179 // if a volume is explicitely clipped twice,
3180 // the "*" will not act on it anymore. Giving "." as the name
3181 // of the volume to be clipped will reset the clipping.
3183 // NAME Name of volume to be clipped
3185 // XMIN Lower limit of the Shape X coordinate
3186 // XMAX Upper limit of the Shape X coordinate
3187 // YMIN Lower limit of the Shape Y coordinate
3188 // YMAX Upper limit of the Shape Y coordinate
3189 // ZMIN Lower limit of the Shape Z coordinate
3190 // ZMAX Upper limit of the Shape Z coordinate
3192 // This function performs a boolean subtraction between the volume
3193 // NAME and a box placed in the MARS according the values of the given
3199 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
3202 //_____________________________________________________________________________
3203 void TGeant3::SetCOMP(Int_t par)
3206 // To control Compton scattering
3207 // par =0 no Compton
3208 // =1 Compton. Electron processed.
3209 // =2 Compton. No electron stored.
3212 fGcphys->icomp = par;
3215 //_____________________________________________________________________________
3216 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
3217 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
3218 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
3219 Float_t ppcutm, Float_t tofmax)
3222 // CUTGAM Cut for gammas D=0.001
3223 // CUTELE Cut for electrons D=0.001
3224 // CUTHAD Cut for charged hadrons D=0.01
3225 // CUTNEU Cut for neutral hadrons D=0.01
3226 // CUTMUO Cut for muons D=0.01
3227 // BCUTE Cut for electron brems. D=-1.
3228 // BCUTM Cut for muon brems. D=-1.
3229 // DCUTE Cut for electron delta-rays D=-1.
3230 // DCUTM Cut for muon delta-rays D=-1.
3231 // PPCUTM Cut for e+e- pairs by muons D=0.01
3232 // TOFMAX Time of flight cut D=1.E+10
3234 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
3235 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
3237 // If one of the parameters from CUTGAM to PPCUTM included
3238 // is modified, cross-sections and energy loss tables must be
3239 // recomputed via the function Gphysi.
3241 fGccuts->cutgam = cutgam;
3242 fGccuts->cutele = cutele;
3243 fGccuts->cutneu = cutneu;
3244 fGccuts->cuthad = cuthad;
3245 fGccuts->cutmuo = cutmuo;
3246 fGccuts->bcute = bcute;
3247 fGccuts->bcutm = bcutm;
3248 fGccuts->dcute = dcute;
3249 fGccuts->dcutm = dcutm;
3250 fGccuts->ppcutm = ppcutm;
3251 fGccuts->tofmax = tofmax;
3254 //_____________________________________________________________________________
3255 void TGeant3::SetDCAY(Int_t par)
3258 // To control Decay mechanism.
3259 // par =0 no decays.
3260 // =1 Decays. secondaries processed.
3261 // =2 Decays. No secondaries stored.
3263 fGcphys->idcay = par;
3267 //_____________________________________________________________________________
3268 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
3271 // Set the debug flag and frequency
3272 // Selected debug output will be printed from
3273 // event emin to even emax each emod event
3275 fGcflag->idemin = emin;
3276 fGcflag->idemax = emax;
3277 fGcflag->itest = emod;
3281 //_____________________________________________________________________________
3282 void TGeant3::SetDRAY(Int_t par)
3285 // To control delta rays mechanism.
3286 // par =0 no delta rays.
3287 // =1 Delta rays. secondaries processed.
3288 // =2 Delta rays. No secondaries stored.
3290 fGcphys->idray = par;
3293 //_____________________________________________________________________________
3294 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
3297 // To control cross section tabulations
3298 // ekmin = minimum kinetic energy in GeV
3299 // ekmax = maximum kinetic energy in GeV
3300 // nekbin = number of logatithmic bins (<200)
3302 fGcmulo->ekmin = ekmin;
3303 fGcmulo->ekmax = ekmax;
3304 fGcmulo->nekbin = nekbin;
3307 //_____________________________________________________________________________
3308 void TGeant3::SetHADR(Int_t par)
3311 // To control hadronic interactions.
3312 // par =0 no hadronic interactions.
3313 // =1 Hadronic interactions. secondaries processed.
3314 // =2 Hadronic interactions. No secondaries stored.
3316 fGcphys->ihadr = par;
3319 //_____________________________________________________________________________
3320 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
3321 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
3322 Float_t xk8, Float_t xk9, Float_t xk10)
3325 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
3326 // Their meaning is user defined
3328 fGckine->ikine = kine;
3329 fGckine->pkine[0] = xk1;
3330 fGckine->pkine[1] = xk2;
3331 fGckine->pkine[2] = xk3;
3332 fGckine->pkine[3] = xk4;
3333 fGckine->pkine[4] = xk5;
3334 fGckine->pkine[5] = xk6;
3335 fGckine->pkine[6] = xk7;
3336 fGckine->pkine[7] = xk8;
3337 fGckine->pkine[8] = xk9;
3338 fGckine->pkine[9] = xk10;
3341 //_____________________________________________________________________________
3342 void TGeant3::SetLOSS(Int_t par)
3345 // To control energy loss.
3346 // par =0 no energy loss;
3347 // =1 restricted energy loss fluctuations;
3348 // =2 complete energy loss fluctuations;
3350 // =4 no energy loss fluctuations.
3351 // If the value ILOSS is changed, then cross-sections and energy loss
3352 // tables must be recomputed via the command 'PHYSI'.
3354 fGcphys->iloss = par;
3358 //_____________________________________________________________________________
3359 void TGeant3::SetMULS(Int_t par)
3362 // To control multiple scattering.
3363 // par =0 no multiple scattering.
3364 // =1 Moliere or Coulomb scattering.
3365 // =2 Moliere or Coulomb scattering.
3366 // =3 Gaussian scattering.
3368 fGcphys->imuls = par;
3372 //_____________________________________________________________________________
3373 void TGeant3::SetMUNU(Int_t par)
3376 // To control muon nuclear interactions.
3377 // par =0 no muon-nuclear interactions.
3378 // =1 Nuclear interactions. Secondaries processed.
3379 // =2 Nuclear interactions. Secondaries not processed.
3381 fGcphys->imunu = par;
3384 //_____________________________________________________________________________
3385 void TGeant3::SetOPTI(Int_t par)
3388 // This flag controls the tracking optimisation performed via the
3390 // 1 no optimisation at all; GSORD calls disabled;
3391 // 0 no optimisation; only user calls to GSORD kept;
3392 // 1 all non-GSORDered volumes are ordered along the best axis;
3393 // 2 all volumes are ordered along the best axis.
3395 fGcopti->ioptim = par;
3398 //_____________________________________________________________________________
3399 void TGeant3::SetPAIR(Int_t par)
3402 // To control pair production mechanism.
3403 // par =0 no pair production.
3404 // =1 Pair production. secondaries processed.
3405 // =2 Pair production. No secondaries stored.
3407 fGcphys->ipair = par;
3411 //_____________________________________________________________________________
3412 void TGeant3::SetPFIS(Int_t par)
3415 // To control photo fission mechanism.
3416 // par =0 no photo fission.
3417 // =1 Photo fission. secondaries processed.
3418 // =2 Photo fission. No secondaries stored.
3420 fGcphys->ipfis = par;
3423 //_____________________________________________________________________________
3424 void TGeant3::SetPHOT(Int_t par)
3427 // To control Photo effect.
3428 // par =0 no photo electric effect.
3429 // =1 Photo effect. Electron processed.
3430 // =2 Photo effect. No electron stored.
3432 fGcphys->iphot = par;
3435 //_____________________________________________________________________________
3436 void TGeant3::SetRAYL(Int_t par)
3439 // To control Rayleigh scattering.
3440 // par =0 no Rayleigh scattering.
3443 fGcphys->irayl = par;
3446 //_____________________________________________________________________________
3447 void TGeant3::SetSWIT(Int_t sw, Int_t val)
3451 // val New switch value
3453 // Change one element of array ISWIT(10) in /GCFLAG/
3455 if (sw <= 0 || sw > 10) return;
3456 fGcflag->iswit[sw-1] = val;
3460 //_____________________________________________________________________________
3461 void TGeant3::SetTRIG(Int_t nevents)
3464 // Set number of events to be run
3466 fGcflag->nevent = nevents;
3469 //_____________________________________________________________________________
3470 void TGeant3::SetUserDecay(Int_t pdg)
3473 // Force the decays of particles to be done with Pythia
3474 // and not with the Geant routines.
3475 // just kill pointers doing mzdrop
3477 Int_t ipart = IdFromPDG(pdg);
3479 printf("Particle %d not in geant\n",pdg);
3482 Int_t jpart=fGclink->jpart;
3483 Int_t jpa=fZlq[jpart-ipart];
3486 Int_t jpa1=fZlq[jpa-1];
3488 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
3489 Int_t jpa2=fZlq[jpa-2];
3491 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
3495 //______________________________________________________________________________
3496 void TGeant3::Vname(const char *name, char *vname)
3499 // convert name to upper case. Make vname at least 4 chars
3501 Int_t l = strlen(name);
3504 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
3505 for (i=l;i<4;i++) vname[i] = ' ';
3509 //______________________________________________________________________________
3510 void TGeant3::Ertrgo()
3515 //______________________________________________________________________________
3516 void TGeant3::Ertrak(const Float_t *const x1, const Float_t *const p1,
3517 const Float_t *x2, const Float_t *p2,
3518 Int_t ipa, Option_t *chopt)
3520 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
3523 //_____________________________________________________________________________
3524 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
3525 Int_t number, Int_t nlevel)
3529 // ******************************************************************
3531 // * Write out the geometry of the detector in EUCLID file format *
3533 // * filnam : will be with the extension .euc *
3534 // * topvol : volume name of the starting node *
3535 // * number : copy number of topvol (relevant for gsposp) *
3536 // * nlevel : number of levels in the tree structure *
3537 // * to be written out, starting from topvol *
3539 // * Author : M. Maire *
3541 // ******************************************************************
3543 // File filnam.tme is written out with the definitions of tracking
3544 // medias and materials.
3545 // As to restore original numbers for materials and medias, program
3546 // searches in the file euc_medi.dat and comparing main parameters of
3547 // the mat. defined inside geant and the one in file recognizes them
3548 // and is able to take number from file. If for any material or medium,
3549 // this procedure fails, ordering starts from 1.
3550 // Arrays IOTMED and IOMATE are used for this procedure
3552 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3553 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3555 Int_t i, end, itm, irm, jrm, k, nmed;
3559 char *filext, *filetme;
3560 char natmed[21], namate[21];
3561 char natmedc[21], namatec[21];
3562 char key[5], name[5], mother[5], konly[5];
3564 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3565 Int_t mlevel, numbr, natt, numed, nin, ndata;
3566 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3567 Int_t jdiv, ivin, in, jin, jvin, irot;
3568 Int_t jtm, imat, jma, flag=0, imatc;
3569 Float_t az, dens, radl, absl, a, step, x, y, z;
3570 Int_t npar, ndvmx, left;
3571 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3573 Int_t iomate[100], iotmed[100];
3574 Float_t par[50], att[20], ubuf[50];
3577 Int_t level, ndiv, iaxe;
3578 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3579 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3580 Float_t tmaxf, stemax, deemax, epsil, stmin;
3581 const char *f10000="!\n%s\n!\n";
3582 //Open the input file
3584 for(i=0;i<end;i++) if(filnam[i]=='.') {
3588 filext=new char[end+5];
3589 filetme=new char[end+5];
3590 strncpy(filext,filnam,end);
3591 strncpy(filetme,filnam,end);
3593 // *** The output filnam name will be with extension '.euc'
3594 strcpy(&filext[end],".euc");
3595 strcpy(&filetme[end],".tme");
3596 lun=fopen(filext,"w");
3598 // *** Initialisation of the working space
3599 iadvol=fGcnum->nvolum;
3600 iadtmd=iadvol+fGcnum->nvolum;
3601 iadrot=iadtmd+fGcnum->ntmed;
3602 if(fGclink->jrotm) {
3603 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3607 nwtot=iadrot+fGcnum->nrotm;
3608 qws = new float[nwtot+1];
3609 for (i=0;i<nwtot+1;i++) qws[i]=0;
3612 if(nlevel==0) mlevel=20;
3614 // *** find the top volume and put it in the stak
3615 numbr = number>0 ? number : 1;
3616 Gfpara(topvol,numbr,1,npar,natt,par,att);
3618 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3623 // *** authorized shape ?
3624 strncpy((char *)&iname, topvol, 4);
3626 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3630 jvo = fZlq[fGclink->jvolum-ivo];
3631 ish = Int_t (fZq[jvo+2]);
3633 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3640 iws[iadvol+ivo] = level;
3643 //*** flag all volumes and fill the stak
3647 // pick the next volume in stak
3649 ivo = TMath::Abs(iws[ivstak]);
3650 jvo = fZlq[fGclink->jvolum - ivo];
3652 // flag the tracking medium
3653 numed = Int_t (fZq[jvo + 4]);
3654 iws[iadtmd + numed] = 1;
3656 // get the daughters ...
3657 level = iws[iadvol+ivo];
3658 if (level < mlevel) {
3660 nin = Int_t (fZq[jvo + 3]);
3662 // from division ...
3664 jdiv = fZlq[jvo - 1];
3665 ivin = Int_t (fZq[jdiv + 2]);
3667 iws[nvstak] = -ivin;
3668 iws[iadvol+ivin] = level;
3670 // from position ...
3671 } else if (nin > 0) {
3672 for(in=1; in<=nin; in++) {
3673 jin = fZlq[jvo - in];
3674 ivin = Int_t (fZq[jin + 2 ]);
3675 jvin = fZlq[fGclink->jvolum - ivin];
3676 ish = Int_t (fZq[jvin + 2]);
3677 // authorized shape ?
3679 // not yet flagged ?
3680 if (iws[iadvol+ivin]==0) {
3683 iws[iadvol+ivin] = level;
3685 // flag the rotation matrix
3686 irot = Int_t ( fZq[jin + 4 ]);
3687 if (irot > 0) iws[iadrot+irot] = 1;
3693 // next volume in stak ?
3694 if (ivstak < nvstak) goto L10;
3696 // *** restore original material and media numbers
3697 // file euc_medi.dat is needed to compare materials and medias
3699 FILE* luncor=fopen("euc_medi.dat","r");
3702 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3703 if (iws[iadtmd+itm] > 0) {
3704 jtm = fZlq[fGclink->jtmed-itm];
3705 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3706 imat = Int_t (fZq[jtm+6]);
3707 jma = fZlq[fGclink->jmate-imat];
3709 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3712 strncpy(namate,(char *)&fZiq[jma+1],20);
3715 //** find the material original number
3718 iret=fscanf(luncor,"%4s,%130s",key,card);
3719 if(iret<=0) goto L26;
3721 if(!strcmp(key,"MATE")) {
3722 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3723 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3724 if(!strcmp(namatec,namate)) {
3725 if(az==a && zc==z && densc==dens && radlc==radl
3726 && abslc==absl && nparc==nparc) {
3729 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3731 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3735 if(strcmp(key,"END") && !flag) goto L23;
3737 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3741 //*** restore original tracking medium number
3744 iret=fscanf(luncor,"%4s,%130s",key,card);
3745 if(iret<=0) goto L26;
3747 if (!strcmp(key,"TMED")) {
3748 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3749 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3750 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3751 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3752 epsil,stmin,ubuf,&nwbuf);
3753 if(!strcmp(natmedc,natmed)) {
3754 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3757 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3760 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3764 if(strcmp(key,"END") && !flag) goto L24;
3766 printf("cannot restore original number for medium : %s\n",natmed);
3774 L26: printf("*** GWEUCL *** cannot read the data file\n");
3776 L29: if(luncor) fclose (luncor);
3779 // *** write down the tracking medium definition
3781 strcpy(card,"! Tracking medium");
3782 fprintf(lun,f10000,card);
3784 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3785 if (iws[iadtmd+itm]>0) {
3786 jtm = fZlq[fGclink->jtmed-itm];
3787 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3789 imat = Int_t (fZq[jtm+6]);
3790 jma = fZlq[fGclink->jmate-imat];
3791 //* order media from one, if comparing with database failed
3793 iotmed[itm]=++imxtmed;
3794 iomate[imat]=++imxmate;
3799 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3802 strncpy(namate,(char *)&fZiq[jma+1],20);
3805 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3809 //* *** write down the rotation matrix
3811 strcpy(card,"! Reperes");
3812 fprintf(lun,f10000,card);
3814 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3815 if (iws[iadrot+irm]>0) {
3816 jrm = fZlq[fGclink->jrotm-irm];
3817 fprintf(lun,"ROTM %3d",irm);
3818 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3823 //* *** write down the volume definition
3825 strcpy(card,"! Volumes");
3826 fprintf(lun,f10000,card);
3828 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3831 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3833 jvo = fZlq[fGclink->jvolum-ivo];
3834 ish = Int_t (fZq[jvo+2]);
3835 nmed = Int_t (fZq[jvo+4]);
3836 npar = Int_t (fZq[jvo+5]);
3838 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3839 Gckpar (ish,npar,par);
3840 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3841 for(i=0;i<(npar-1)/6+1;i++) {
3844 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3848 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3853 //* *** write down the division of volumes
3855 fprintf(lun,f10000,"! Divisions");
3856 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3857 ivo = TMath::Abs(iws[ivstak]);
3858 jvo = fZlq[fGclink->jvolum-ivo];
3859 ish = Int_t (fZq[jvo+2]);
3860 nin = Int_t (fZq[jvo+3]);
3861 //* this volume is divided ...
3864 iaxe = Int_t ( fZq[jdiv+1]);
3865 ivin = Int_t ( fZq[jdiv+2]);
3866 ndiv = Int_t ( fZq[jdiv+3]);
3869 jvin = fZlq[fGclink->jvolum-ivin];
3870 nmed = Int_t ( fZq[jvin+4]);
3871 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3873 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3875 if ((step<=0.)||(ish>=11)) {
3876 //* volume with negative parameter or gsposp or pgon ...
3877 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3878 } else if ((ndiv<=0)||(ish==10)) {
3879 //* volume with negative parameter or gsposp or para ...
3880 ndvmx = TMath::Abs(ndiv);
3881 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3882 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3884 //* normal volume : all kind of division are equivalent
3885 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3886 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3891 //* *** write down the the positionnement of volumes
3893 fprintf(lun,f10000,"! Positionnements\n");
3895 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3896 ivo = TMath::Abs(iws[ivstak]);
3897 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3899 jvo = fZlq[fGclink->jvolum-ivo];
3900 nin = Int_t( fZq[jvo+3]);
3901 //* this volume has daughters ...
3903 for (in=1;in<=nin;in++) {
3905 ivin = Int_t (fZq[jin +2]);
3906 numb = Int_t (fZq[jin +3]);
3907 irot = Int_t (fZq[jin +4]);
3911 strcpy(konly,"ONLY");
3912 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
3913 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
3915 jvin = fZlq[fGclink->jvolum-ivin];
3916 ish = Int_t (fZq[jvin+2]);
3917 //* gspos or gsposp ?
3918 ndata = fZiq[jin-1];
3920 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
3921 name,numb,mother,x,y,z,irot,konly);
3923 npar = Int_t (fZq[jin+9]);
3924 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
3925 Gckpar (ish,npar,par);
3926 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
3927 name,numb,mother,x,y,z,irot,konly,npar);
3929 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3936 fprintf(lun,"END\n");
3939 //****** write down the materials and medias *****
3941 lun=fopen(filetme,"w");
3943 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3944 if (iws[iadtmd+itm]>0) {
3945 jtm = fZlq[fGclink->jtmed-itm];
3946 strncpy(natmed,(char*)&fZiq[jtm+1],4);
3947 imat = Int_t (fZq[jtm+6]);
3948 jma = Int_t (fZlq[fGclink->jmate-imat]);
3950 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
3951 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
3952 iomate[imat],namate,a,z,dens,radl,absl,npar);
3956 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3960 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
3961 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
3962 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
3963 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
3967 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3973 fprintf(lun,"END\n");
3975 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
3976 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
3985 //_____________________________________________________________________________
3986 void TGeant3::Streamer(TBuffer &R__b)
3989 // Stream an object of class TGeant3.
3991 if (R__b.IsReading()) {
3992 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
3993 AliMC::Streamer(R__b);
3996 R__b.ReadStaticArray(fPDGCode);
3998 R__b.WriteVersion(TGeant3::IsA());
3999 AliMC::Streamer(R__b);
4002 R__b.WriteArray(fPDGCode, fNPDGCodes);