All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TGeant3.cxx
Go to the documentation of this file.
1 
2 /**************************************************************************
3  * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4  * *
5  * Author: The ALICE Off-line Project. *
6  * Contributors are mentioned in the code where appropriate. *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
17 
18 /*
19 $Log: TGeant3.cxx,v $
20 Revision 1.59 2007/07/25 20:06:49 brun
21 From Ivana:
22 Changed the fPDGCode type to TArrayI to allow
23 its dynamic size (thanks to Susan Kasahara).
24 
25 Revision 1.58 2007/07/24 19:43:24 brun
26 From Ivana:
27 Do not add particles in TDatabasePDG if they
28 are were already aded;
29 (thanks to Susan Kasahara for this suggestion)
30 
31 Revision 1.57 2007/07/23 20:04:03 brun
32 From Ivana:
33 Implemented the new pdg "standard" codes for ions
34 defined in pdg-2006, thanks to Susan Kasahara
35 for this suggestion.
36 
37 Revision 1.56 2007/05/18 08:44:15 brun
38 A major update of GEANTE by Andrea Fontana and Alberto Rotondi
39 
40 
41 1) update of the Coulomb multiple scattering parametrization;
42 2) update of the straggling of energy loss for thin materials;
43 3) new options to extrapolate the track parameters to the point
44  of closest approach to a point or to a wire (straight line).
45 
46 Details on the physical motivation behind this work can be found
47 in our report for the Panda Collaboration, available at:
48 
49 http://www.pv.infn.it/~fontana/tracking.pdf
50 
51 Feel free to contact us for questions and discussions about these
52 topics by using the following email addresses:
53 
54 alberto.rotondi@pv.infn.it
55 andrea.fontana@pv.infn.it
56 
57 ---
58 
59 List of changes in the fortran and C++ routines of the geant3
60 VMC directory:
61 
62 - gcmore.inc
63  gtmore.inc
64  geant3LinkDef.h
65  gcomad.F
66 
67  Added a new common that contains all the new variables:
68  COMMON/GCMORE/GCALPHA,ICLOSE,PFINAL(3),DSTRT,WIRE1(3),WIRE2(3),
69  + P1(3),P2(3),P3(3),CLENG(3)
70 
71  input to ERLAND:
72  GCALPHA: energy cut parameter for energy loss fluctuations
73 
74  input to EUSTEP:
75  ICLOSE: = 1 the use of the common is enabled for the closest
76  approach to a point PFINAL(3)
77  = 2 the use of the common is enabled for the closest
78  approach to a wire of extremes WIRE1(3) and WIRE2(3)
79  = 0 the common is empty and disabled
80  PFINAL(3): assigned point
81  DSTRT: assigned distance between initial point in ERTRAK
82  and PFINAL along straight line (currently noy used)
83  WIRE1(3): first point of a wire
84  WIRE2(3): second point of a wire
85 
86  output from EUSTEP:
87  P1(3): point previous to the point of closest approach to
88  PFINAL() or wire
89  P2(3): point of closest approach to PFINAL() or wire
90  P3(3): point next to the point of closest approach to
91  PFINAL() or wire
92  CLENG(3): track length to the previous 3 points
93 
94  Important note: the calculated points of closest approach are
95  depending on the GEANE steps. For calculating the true point
96  of closest approach the last 3 points of the extrapolation, i.e.
97  the previous to closest, the closest and the next to closest are
98  returned to the user. Different algorithms can be implemented, but
99  we decided to leave this to the users in the C++ interface to GEANE.
100 
101 - ermcsc.F
102  new expression for the variance of the Coulomb multiple scattering
103  according to Fruhwirth and Regler, NIM A 456 (2001) 369
104 
105 - ertrch.F
106  added DESTEP in the calling string of ERLAND for calculation with
107  Urban model. Added and saved previous step PRSTEP.
108 
109 - erland.F
110  added new calculation for sigma of straggling in energy loss
111  to include in Geane the Urban/Landau approximation, as explained
112  in the Geant manual and related papers.
113  The model parametrization can be controlled with a user variable (GCALPHA)
114  in the new GCMORE common block: 1 is for old gaussian model valid
115  for dense materials, other values (see the report) are for gaseous
116  materials.
117 
118 - eustep.F
119  added the calculation to the distance of closest approach to a point
120  or to a wire.
121 
122 - TGeant3.h
123 - TGeant3.cxx
124  added the possibility to define user cuts (already present in the gccuts
125  struct but not in the TGeant3::SetCUTS method) and to define the new
126  variables of the GCMORE common with two new methods SetECut() and
127  SetClose().
128  Added new method InitGEANE() to initialize GEANE to the old behaviour
129  (default) for backward compatibility. Only the multiple scattering has
130  been updated to a more correct formula.
131  Corrected a typo in the call to the routine Trscsd().
132 
133 Revision 1.55 2007/03/26 10:15:04 brun
134 Fix a problem when adding a new tracking medium to the TObjArray.
135 
136 Revision 1.54 2007/03/23 21:11:44 brun
137 From Ivana Hrivnacova and Andrea Fontana:
138 Reintroduce functionality in TGeant3::SetCuts that was removed in a previous patch.
139 
140 Revision 1.53 2007/03/22 08:58:41 brun
141 From Ivana:
142 Restore the function TGeant3::MediumId
143 
144 Revision 1.52 2007/02/28 16:25:14 brun
145 From Federico:
146 Suppress compiler warnings coming from unused arguments
147 
148 Revision 1.51 2006/12/19 13:16:19 brun
149 from Mohammad Al-Turany & Denis Bertini
150 
151 Changes in TGeant3/TGeant3.cxx and TGeant3.h
152 ------------------------------------
153 1. Geane interface functions are added:
154  void eufill(Int_t n, Float_t *ein, Float_t *xlf);
155  void eufilp(const int n,Float_t *ein,Float_t *pli,Float_t *plf);
156  void eufilv(Int_t n, Float_t *ein, Char_t *namv, Int_t *numv,Int_t *iovl);
157  void trscsd(Float_t *pc,Float_t *rc,Float_t *pd,Float_t *rd,
158  Float_t *h,Float_t ch,Int_t ierr,Float_t spu,Float_t *dj,Float_t *dk);
159  void trsdsc(Float_t *pd,Float_t *rd,Float_t *pc,Float_t *rc,
160  Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk);
161  void trscsp(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
162  Float_t *ch,Int_t *ierr,Float_t *spx);
163  void trspsc(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
164  Float_t *ch,Int_t *ierr,Float_t *spx);
165 
166 2. The Gfang function wrapper is added
167  void g3fang( Float_t *, Float_t &,Float_t &, Float_t &, Float_t &,Int_t & );
168 
169 
170 
171 
172 changes in TGeant3/TGeant3gu.cxx
173 --------------------------
174 Adding GCalor interface
175  1. function calsig() and gcalor() are added
176  2. setting ihadr=5 will call the GCalor routine
177 
178 
179 
180 
181 changes in TGeant3/TGeant3.h
182 -----------------------
183 1. Structures for Geane output are setted as public so that the user can access them
184 
185  Ertrio_t *fErtrio
186  Ertrio1_t *fErtrio1
187  Eropts_t *fEropts
188  Eroptc_t *fEroptc
189  Erwork_t *fErwork
190  Trcom3_t *fTrcom3
191 
192 2. The size of the error matrix errin is corrected to 15
193 
194 Revision 1.49 2006/04/20 10:14:55 brun
195 From Peter Hristov:
196 small change in TGeant3.cxx:
197 to avoid some rare problems in glandz.F and probably in other places where the random number should not
198 be equal to 0 and 1.
199 
200 Revision 1.48 2006/03/15 08:12:11 brun
201 -New Makefile.macosx
202 
203 -delete all TGeant3 GUI and graphics classes
204 
205 -Remove all references to GUI/Graphics classes from G3Volume.cxx and TGeant3.cxx
206 
207 -Remove TGeant3/galicef.F and rdummies.F
208 
209 -Remove references to GUI/Graphics classes from geant3LinkDef.h
210 
211 -delete added/dummies2.F
212 
213 -change added/dummies.c, keeping only __attribute__ and MAIN__
214 
215 -Change Makefile accordingly
216 
217 Revision 1.47 2005/11/18 21:25:22 brun
218 From Bjorn, Andrei:
219 Implemented new VMC functions for access to geometry;
220 added -Woverloaded-virtual to Makefile.linux
221 
222 Revision 1.46 2005/07/21 17:54:37 brun
223 Implement same code in the float* versions that were already implemented
224 in the Double* versions.
225 
226 Revision 1.45 2005/07/20 09:22:50 brun
227 From Federico:
228 Fixes to compile with gcc4CVS: ----------------------------------------------------------------------
229 
230 Revision 1.44 2005/05/21 05:48:33 brun
231 In TGeant3::Init put the code calling ConstructGeometry conditional
232 on ROOT versions >-5.01/01
233 
234 Revision 1.43 2005/05/17 12:47:00 brun
235 From Ivana:
236 - Added call to new TVirtualMCApplication::ConstructOpGeometry() function
237 - Bug fix in G3Mixture (do not update wmat values twice)
238 - In CreateFloatArray: added check for values > FLT_MAX
239 
240 Revision 1.42 2005/02/16 08:01:51 brun
241 Implement function grndmq. It returns gRandom->GetSeed().
242 The result makes sense only when Trandom is the generator.
243 
244 Revision 1.41 2005/02/08 11:22:03 brun
245 From Ivana:
246 For TGeant3.h:
247 Added IsRootGeometrySupported() function
248 (now required by TVirtualMC)
249 
250 For TGeant3.cxx:
251 Updated text in Fatal in SetRootGeometry.
252 
253 Revision 1.40 2005/01/07 11:34:43 brun
254 Change the J/Psi lifetime from 0 to 7.6e-21
255 (thanks Yuri Kharlov)
256 
257 Revision 1.39 2004/12/21 15:34:48 brun
258 Implement TGeant3TGeo::isRootGeometry returning kTRUE
259 
260 Revision 1.38 2004/12/17 11:55:47 brun
261 A new class TGeant3TGeo (deriving from TGeant3) is introduced.
262 TGeant3 uses by default the geant3 geometry. TGeant3TGeo uses the TGeo classes.
263 The two classes are built in the same library. The choice of which version to use
264 can now be made dynamically at run time (eg based on an environment variable)
265 or a job control option.
266 For example the examples like gexam1, gexam4 have been modified to run
267 with either geant3 geometry or TGeo. To run gexam1 with geant3 geometry do
268  gexam1 TGeant3
269 to run with TGeo (default) do
270  gexam1
271 The examples E01.C, E02 and E03 have also been modified to select the option
272 at run time based on the environment variable TVirtualMC (set in .rootrc)
273 If TVirtualMC is set to TGeant3TGeo TGeo geometry will be used.
274 The Makefile has been modified to build the two classes in the same library.
275 
276 Revision 1.37 2004/11/23 14:52:52 brun
277 From Andreas Morsch:
278 on request of ALICE/TPC I added a new method to TVirtualMC.h
279 
280 void TVirtualMC::ForceDecayTime(Float_t);
281 
282 
283 This allows to force the decay time of the current particle.
284 The use-case implemented in AliRoot is the decay of primary particles
285 within a user defined radius range.
286 
287 Revision 1.36 2004/10/13 10:38:32 brun
288 From Andrei Gheata:
289 some modifications in the current TGeant3.cxx :
290 
291 from Mihaela:
292 - modifications in STATISTICS option: added branches to statistics tree
293 (statsame + statpath)
294 - global gckine added. gckine->itrtyp == 7 used in gtnext to optimize
295 speed - 1% gain (computation of global matrix only when called from gtckov)
296 - bias of 1E-7 (used previously for making sure a boundary is crossed)
297 eliminated
298 
299 I removed the option WITHBOTH and fixed a problem in VolId() - in the
300 last version of AliRoot some detector was calling gMC->VolId(name) with
301 a name containing a blank at the end and now all volumes have the blanks
302 supressed. Fixing this I noticed that there are 4 detectors that in
303 their StepManager() they call at each step things like:
304  if (gMC->CurrentVolId(copy) == gMC->VolId("RICH")) ...
305 Incredible !!! In G3 native this search by name does not penalize so
306 much since names are converted to Int_t and the volume bank is looked
307 for this Int_t. In TGeo we cannot do this since we support long names so
308 we have to go to gGeoManager->GetVolume("name") which scans a list of
309 2000 objects at each step several times... I fixed this by hand by
310 puting static variables in these methods and Peter will commit the
311 changes. The gain in speed for TGeo case is considerable with full AliRoot.
312 
313 Revision 1.35 2004/10/12 07:46:23 brun
314 >From Ivana:
315 Implemented new functions from TVirtualMC:
316  Int_t NofVolDaughters(const char* volName) const;
317  const char* VolDaughterName(const char* volName, Int_t i) const;
318  Int_t VolDaughterCopyNo(const char* volName, Int_t i) const;
319  const char* CurrentVolPath();
320 
321 Revision 1.34 2004/09/17 08:51:55 brun
322 >From Ivana
323  SetRootGeometry() allowed only with WITHROOT option;
324  added Fatal() for other modes.
325 
326 Revision 1.33 2004/08/25 07:28:54 brun
327 >From Ivana and Lionel Chaussard
328  In method DefineParticles(), we had:
329 
330  pdgcode(Tau+)=15
331  pdgcode(Tau-)=-15
332 
333  This is in contradiction with the other leptons (pdgcode>0 for
334  negative leptons, pdgcode<0 for positive leptons). I also checked
335  in the PDG WEB pages that Tau- should have a code +15.
336 
337  changed to:
338  pdgcode(tau+)=-15
339  pdgcode(tau-)=+15 ?
340 
341 Revision 1.32 2004/08/05 12:20:39 brun
342 >From Andrei Gheata:
343 I have found/fixed a bug in TGeoManager::IsSameLocation(x,y,z). Also I
344 have eliminated the penalizing check of IsSameLocation() in gtnext().
345 
346 Revision 1.31 2004/07/09 12:15:12 brun
347 >From Ivana:
348 in case a user defines geometry via TGeo and associates more tracking
349  media with the same material, TGeant3 duplicates this material
350  for each tracking medium.
351  I haven't found a function for getting the number of
352  materials/media (TList) so I count them by a loop
353  - maybe it can be done more intelligently...
354 
355 Revision 1.30 2004/07/09 08:11:29 brun
356 Fix by Ivana/Andrei to call TGeoMedium::setId and not TGeoMedium::SetUniqueID
357 
358 Revision 1.29 2004/06/17 13:56:53 rdm
359 changed several "const int" arguments to "int". Was causing warnings of
360 type "qualifier is meaningless".
361 
362 Revision 1.28 2004/06/08 10:27:19 brun
363 >From Ivana:
364 - Added Bool_t return value to methods
365  SetCut(), SetProcess(), DefineParticle(), DefineIon()
366 - Removed DefineParticles()
367 
368 Revision 1.27 2004/05/28 13:45:00 brun
369 >From Ivana
370 Implementation of StopRun (new function in TVirtualMC)
371 
372 Revision 1.26 2004/05/14 08:32:01 brun
373 In function gtnext, call GetNextBoundary(-step) instead of (step).
374 This fixes a problem when tracking Cherenkov photons.
375 (Thanks to Yuri Kharlov for reporting the problem and Andrei for fixing it)
376 
377 Revision 1.25 2004/03/23 11:16:44 brun
378 >From Ivana
379 With the previous changes by Andrei, all fixes by Ivana were lost.
380 This patch merges Ivana and Andrei versions.
381 
382 Revision 1.23 2004/03/15 12:18:45 brun
383 >From Andrei Gheata:
384  - minor modifications to cope with geometry retreival from file:
385  - ConstructGeometry does not need to be called
386  - CloseGeometry not needed
387 
388 Revision 1.22 2004/02/03 12:47:34 brun
389 >From Andrei Gheata:
390 TGeant3:
391 
392 - calls to gtonly return now always a true value (G3 is seeing an ONLY
393 geometry with TGeo)
394 - IsSameLocation inside gtnext not yet eliminated, but I am getting only
395 1 exception instead of 400 now (when the location really changes)
396 
397 Revision 1.21 2004/01/28 18:05:24 brun
398 New version from Peter Hristov adding the graphics interface
399 
400 Revision 1.20 2004/01/28 08:30:54 brun
401 Change the call to TRandom::RndmArray in function grndm
402 
403 Revision 1.19 2004/01/28 08:14:48 brun
404 Add a CPP option STATISTICS to monitor the fequency of calls to the geometry functions.
405 
406 Revision 1.18 2003/12/10 15:39:37 brun
407 iFollowing recent improvements by Andrei, replace in ggperp
408 the computation of normals:
409  Double_t *dblnorm = gGeoManager->FindNormal(kFALSE);
410 with :
411  Double_t *dblnorm = gGeoManager->FindNormalFast();
412 
413 Revision 1.17 2003/12/10 10:32:09 brun
414 Add a protection in TGeant3::Gsmate in case the material density is null
415 
416 Revision 1.16 2003/12/01 23:51:22 brun
417 >From Andrei and Peter:
418 add a few missing cases when compiling with the WITHROOT option.
419 
420 Revision 1.15 2003/11/28 09:44:15 brun
421 New version of TGeant3 supporting the options WITHG3 and WITHROOT
422 
423 Revision 1.14 2003/10/09 06:28:45 brun
424 In TGeant3::ParticleName, increase size of local array name[20] to name[21]
425 
426 Revision 1.13 2003/09/26 15:01:08 brun
427 >From Ivana;
428 - implemented new functions from TVirtualMC
429  enabling user to define own particles and ions
430  + getter functions::
431  DefineParticle(..)
432  DefineIon(..)
433  ParticleName(..) const
434  ParticleMass(..) const
435  Double_t ParticleCharge(..) const
436  Double_t ParticleLifeTime(..) const
437  TMCParticleType ParticleMCType(..) const
438 - corrected charge in AddParticlesToPdgDataBase
439 
440 Revision 1.12 2003/07/22 06:53:28 brun
441 This version does not yet support TGeo geometry.
442 TVirtualMC must be initialized with the 3rd argument set to kFALSE
443 
444 Revision 1.11 2003/07/18 10:22:50 brun
445 Changes to reflect the equivalent changes in the abstract classes in vmc
446 (thanks Peter Hristov)
447 
448 Revision 1.10 2003/07/16 07:40:09 brun
449 >From Andreas Morsch
450 
451 - default g3 specific initialisation moved to TGeant3::Init()
452  (This avoids the cast to TGeant3* in the Config.C)
453 - "CKOV" added to SetProcess
454 
455 Revision 1.9 2003/06/03 21:26:46 brun
456 New version of gustep by Andreas Morsch
457 
458 Revision 1.8 2003/02/28 10:41:49 brun
459 >From Andreas
460  In DefineParticles(): rho0 decay channel corrected
461 
462 Revision 1.7 2003/02/04 17:50:34 brun
463 >From Ivana
464  In Mixture(): pass abs(nlmat) to CreateFloatArray calls
465  as nlmat can be negative.
466 
467 Revision 1.6 2003/01/31 18:23:06 brun
468 Ivana suggested corrections.
469 - corrected tau pdg code
470 - Warning if external decayer needed but not defined.
471 
472 Revision 1.5 2003/01/23 11:34:04 brun
473 In gustep, replace
474  gMC->TrackPosition(x,y,z);
475 by
476  geant3->TrackPosition(x,y,z);
477 
478 Revision 1.4 2003/01/06 17:20:52 brun
479 Add new functions TrackPosition and TrackMomentum as alternative to the original
480 functions filling a TLorentzVector object.
481 Use these new functions in gustep and gudcay.
482 This makes a 25 per cent speed improvement in case of Alice.
483 
484 Revision 1.3 2002/12/10 07:58:36 brun
485 Update by Federico for the calls to Grndm
486 
487 Revision 1.2 2002/12/06 16:50:30 brun
488 >From Federico:
489 the following modifications provide an >6% improvement in speed for
490 AliRoot.
491 
492 Revision 1.1.1.1 2002/07/24 15:56:26 rdm
493 initial import into CVS
494 
495 Revision 1.5 2002/07/10 09:33:19 hristov
496 Array with variable size created by new
497 
498 Revision 1.4 2002/07/10 08:38:54 alibrary
499 Cleanup of code
500 
501 */
502 
503 ////////////////////////////////////////////////////////////////////////
504 // //
505 // Interface Class to the Geant3.21 Monte Carlo //
506 // //
507 // //
508 // //
509 ////////////////////////////////////////////////////////////////////////
510 
511 #include <ctype.h>
512 #include <stdlib.h>
513 
514 #include "TROOT.h"
515 #include "TParticle.h"
516 #include "TDatabasePDG.h"
517 #include "TLorentzVector.h"
518 #include "TArrayI.h"
519 #include "TArrayD.h"
520 #include "TString.h"
521 #include "TParameter.h"
522 #include "TGeoMatrix.h"
523 #include "TObjString.h"
524 
526 
528 #include "TVirtualMCDecayer.h"
529 #include "TPDGCode.h"
530 
531 #ifndef WIN32
532 # define g3zebra g3zebra_
533 # define grfile grfile_
534 # define g3pcxyz g3pcxyz_
535 # define g3gclos g3gclos_
536 # define g3last g3last_
537 # define g3init g3init_
538 # define g3cinit g3cinit_
539 # define g3run g3run_
540 # define g3trig g3trig_
541 # define g3trigc g3trigc_
542 # define g3trigi g3trigi_
543 # define g3work g3work_
544 # define g3zinit g3zinit_
545 # define g3fmate g3fmate_
546 # define g3fpart g3fpart_
547 # define g3ftmed g3ftmed_
548 # define g3ftmat g3ftmat_
549 # define g3mate g3mate_
550 # define g3part g3part_
551 # define g3sdk g3sdk_
552 # define g3smate g3smate_
553 # define g3fang g3fang_
554 # define g3smixt g3smixt_
555 # define g3spart g3spart_
556 # define g3stmed g3stmed_
557 # define g3sckov g3sckov_
558 # define g3stpar g3stpar_
559 # define g3fkine g3fkine_
560 # define g3fvert g3fvert_
561 # define g3skine g3skine_
562 # define g3svert g3svert_
563 # define g3physi g3physi_
564 # define g3debug g3debug_
565 # define g3ekbin g3ekbin_
566 # define g3finds g3finds_
567 # define g3sking g3sking_
568 # define g3skpho g3skpho_
569 # define g3sstak g3sstak_
570 # define g3sxyz g3sxyz_
571 # define g3many g3many_
572 # define g3track g3track_
573 # define g3treve g3treve_
574 # define gtreveroot gtreveroot_
575 # define grndm grndm_
576 # define grndmq grndmq_
577 # define g3dtom g3dtom_
578 # define g3lmoth g3lmoth_
579 # define g3media g3media_
580 # define g3mtod g3mtod_
581 # define g3sdvn g3sdvn_
582 # define g3sdvn2 g3sdvn2_
583 # define g3sdvs g3sdvs_
584 # define g3sdvs2 g3sdvs2_
585 # define g3sdvt g3sdvt_
586 # define g3sdvt2 g3sdvt2_
587 # define g3sord g3sord_
588 # define g3spos g3spos_
589 # define g3sposp g3sposp_
590 # define g3srotm g3srotm_
591 # define g3protm g3protm_
592 # define g3svolu g3svolu_
593 # define g3print g3print_
594 # define dzshow dzshow_
595 # define g3satt g3satt_
596 # define g3fpara g3fpara_
597 # define gckpar gckpar_
598 # define g3ckmat g3ckmat_
599 # define g3lvolu g3lvolu_
600 # define geditv geditv_
601 # define mzdrop mzdrop_
602 
603 # define ertrak ertrak_
604 # define ertrgo ertrgo_
605 # define eufill eufill_
606 # define eufilp eufilp_
607 # define eufilv eufilv_
608 # define trscsp trscsp_
609 # define trspsc trspsc_
610 # define trscsd trscsd_
611 # define trsdsc trsdsc_
612 # define erxyzc erxyzc_
613 
614 # define gcomad gcomad_
615 
616 # define g3brelm g3brelm_
617 # define g3prelm g3prelm_
618 
619 # define rxgtrak rxgtrak_
620 # define rxouth rxouth_
621 # define rxinh rxinh_
622 
623 
624 #else
625 
626 # define gzebra GZEBRA
627 # define grfile GRFILE
628 # define gpcxyz GPCXYZ
629 # define ggclos GGCLOS
630 # define glast GLAST
631 # define ginit GINIT
632 # define g3cinit G3CINIT
633 # define grun GRUN
634 # define gtrig GTRIG
635 # define gtrigc GTRIGC
636 # define gtrigi GTRIGI
637 # define gwork GWORK
638 # define g3zinit G3ZINIT
639 # define gfmate GFMATE
640 # define gfpart GFPART
641 # define gftmed GFTMED
642 # define gftmat GFTMAT
643 # define gmate GMATE
644 # define gpart GPART
645 # define gsdk GSDK
646 # define gsmate GSMATE
647 # define gsmixt GSMIXT
648 # define gspart GSPART
649 # define gstmed GSTMED
650 # define gsckov GSCKOV
651 # define gstpar GSTPAR
652 # define gfkine GFKINE
653 # define gfvert GFVERT
654 # define gskine GSKINE
655 # define gsvert GSVERT
656 # define gphysi GPHYSI
657 # define gdebug GDEBUG
658 # define gekbin GEKBIN
659 # define gfinds GFINDS
660 # define gsking GSKING
661 # define gskpho GSKPHO
662 # define gsstak GSSTAK
663 # define gsxyz GSXYZ
664 # define gtrack GTRACK
665 # define gtreve GTREVE
666 # define gtreveroot GTREVEROOT
667 # define grndm GRNDM
668 # define grndmq GRNDMQ
669 # define gdtom GDTOM
670 # define glmoth GLMOTH
671 # define gmedia GMEDIA
672 # define gmtod GMTOD
673 # define gsdvn GSDVN
674 # define gsdvn2 GSDVN2
675 # define gsdvs GSDVS
676 # define gsdvs2 GSDVS2
677 # define gsdvt GSDVT
678 # define gsdvt2 GSDVT2
679 # define gsord GSORD
680 # define gspos GSPOS
681 # define gsposp GSPOSP
682 # define gsrotm GSROTM
683 # define gprotm GPROTM
684 # define gsvolu GSVOLU
685 # define gprint GPRINT
686 # define dzshow DZSHOW
687 # define gsatt GSATT
688 # define gfpara GFPARA
689 # define gckpar GCKPAR
690 # define gckmat GCKMAT
691 # define glvolu GLVOLU
692 # define geditv GEDITV
693 # define mzdrop MZDROP
694 
695 # define ertrak ERTRAK
696 # define ertrgo ERTRGO
697 # define eufill EUFILL
698 # define eufilp EUFILP
699 # define eufilv EUFILV
700 # define trscsp TRSCSP
701 # define trspsc TRSPSC
702 # define trscsd TRSCSD
703 # define trsdsc TRSDSC
704 # define erxyzc ERXYZC
705 
706 # define gcomad GCOMAD
707 
708 # define gbrelm GBRELM
709 # define gprelm GPRELM
710 
711 # define rxgtrak RXGTRAK
712 # define rxouth RXOUTH
713 # define rxinh RXINH
714 # define gfang GFANG
715 
716 #endif
717 
718 //______________________________________________________________________
719 extern "C"
720 {
721  //
722  // Prototypes for GEANT functions
723  //
724  void type_of_call g3zebra(const int&);
725 
726  void type_of_call g3pcxyz();
727 
728  void type_of_call g3gclos();
729 
730  void type_of_call g3last();
731 
732  void type_of_call g3init();
733 
734  void type_of_call g3cinit();
735 
736  void type_of_call g3run();
737 
738  void type_of_call g3trig();
739 
740  void type_of_call g3trigc();
741 
742  void type_of_call g3trigi();
743 
744  void type_of_call g3work(const int&);
745 
746  void type_of_call g3zinit();
747 
748  void type_of_call g3mate();
749 
750  void type_of_call g3part();
751 
752  void type_of_call g3sdk(Int_t &, Float_t *, Int_t *);
753 
754  void type_of_call g3fkine(Int_t &, Float_t *, Float_t *, Int_t &,
755  Int_t &, Float_t *, Int_t &);
756 
757  void type_of_call g3fvert(Int_t &, Float_t *, Int_t &, Int_t &,
758  Float_t &, Float_t *, Int_t &);
759 
760  void type_of_call g3skine(Float_t *,Int_t &, Int_t &, Float_t *,
761  Int_t &, Int_t &);
762 
763  void type_of_call g3svert(Float_t *,Int_t &, Int_t &, Float_t *,
764  Int_t &, Int_t &);
765 
766  void type_of_call g3physi();
767 
768  void type_of_call g3debug();
769 
770  void type_of_call g3ekbin();
771 
772  void type_of_call g3finds();
773 
774  void type_of_call g3sking(Int_t &);
775 
776  void type_of_call g3skpho(Int_t &);
777 
778  void type_of_call g3sstak(Int_t &);
779 
780  void type_of_call g3sxyz();
781 
782  void type_of_call g3many();
783 
784  void type_of_call g3track();
785 
786  void type_of_call g3treve();
787 
788  void type_of_call gtreveroot();
789 
790  void type_of_call grndm(Float_t *r, const Int_t &n)
791  {
792  //gRandom->RndmArray(n,r);
793  for(Int_t i=0; i<n; i++)
794  do r[i]=gRandom->Rndm(); while(0>=r[i] || r[i]>=1);
795  }
796 
797  void type_of_call grndmq(Int_t &is1, Int_t &is2, const Int_t &,
799  {is1=gRandom->GetSeed(); is2=0; /*only valid with TRandom;*/}
800 
801  void type_of_call g3dtom(Float_t *, Float_t *, Int_t &);
802 
803  void type_of_call g3lmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
804  Int_t *, Int_t * DEFCHARL);
805 
806  void type_of_call g3media(Float_t *, Int_t &, Int_t&);
807 
808  void type_of_call g3mtod(Float_t *, Float_t *, Int_t &);
809 
810  void type_of_call g3srotm(const Int_t &, const Float_t &, const Float_t &,
811  const Float_t &, const Float_t &, const Float_t &,
812  const Float_t &);
813 
814  void type_of_call g3protm(const Int_t &);
815 
816  void type_of_call g3rfile(const Int_t&, DEFCHARD,
817  DEFCHARD DEFCHARL DEFCHARL);
818 
819  void type_of_call g3fmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
820  Float_t &, Float_t &, Float_t &, Float_t *,
821  Int_t& DEFCHARL);
822 
823  void type_of_call g3fang( Float_t *, Float_t &,
824  Float_t &, Float_t &, Float_t &,
825  Int_t & );
826 
827  void type_of_call g3fpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
828  Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
829 
830  void type_of_call g3ftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
831  Float_t &, Float_t &, Float_t &, Float_t &,
832  Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
833 
834  void type_of_call g3ftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
835  Float_t*, Float_t*
836  ,Float_t *, Int_t & DEFCHARL);
837 
838  void type_of_call g3smate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
839  Float_t &, Float_t &, Float_t &, Float_t *,
840  Int_t & DEFCHARL);
841 
842  void type_of_call g3smixt(const Int_t&, DEFCHARD, const Float_t *,
843  const Float_t *, const Float_t &, const Int_t &,
844  Float_t * DEFCHARL);
845 
846  void type_of_call g3spart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
847  Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
848 
849 
850  void type_of_call g3stmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
851  Float_t &, Float_t &, Float_t &, Float_t &,
852  Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
853 
854  void type_of_call g3sckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
855  Float_t *absco, Float_t *effic, Float_t *rindex);
856  void type_of_call g3stpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
857 
858  void type_of_call g3sdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
859  DEFCHARL DEFCHARL);
860 
861  void type_of_call g3sdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
862  Int_t & DEFCHARL DEFCHARL);
863 
864  void type_of_call g3sdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
865  DEFCHARL DEFCHARL);
866 
867  void type_of_call g3sdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
868  Int_t & DEFCHARL DEFCHARL);
869 
870  void type_of_call g3sdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
871  Int_t & DEFCHARL DEFCHARL);
872 
873  void type_of_call g3sdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
874  Int_t &, Int_t & DEFCHARL DEFCHARL);
875 
876  void type_of_call g3sord(DEFCHARD, Int_t & DEFCHARL);
877 
878  void type_of_call g3spos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
879  Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
880  DEFCHARL);
881 
882  void type_of_call g3sposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
883  Float_t &, Int_t &, DEFCHARD,
884  Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
885 
886  void type_of_call g3svolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
887  Int_t & DEFCHARL DEFCHARL);
888 
889  void type_of_call g3satt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
890 
891  void type_of_call g3fpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&,
892  Float_t*, Float_t* DEFCHARL);
893 
894  void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
895 
896  void type_of_call g3ckmat(Int_t&, DEFCHARD DEFCHARL);
897 
898  void type_of_call g3lvolu(Int_t&, Int_t*, Int_t*, Int_t&);
899 
900  void type_of_call g3print(DEFCHARD,const int& DEFCHARL);
901 
902  void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
903  const int&, const int&, const int& DEFCHARL
904  DEFCHARL);
905  void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
906 
907  void type_of_call setbomb(Float_t &);
908 
909  void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
910  Float_t &, Float_t & DEFCHARL);
911 
912  void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
913 
914  void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
915  const Float_t *x2, const Float_t *p2,
916  const Int_t &ipa, DEFCHARD DEFCHARL);
917  void type_of_call eufill(Int_t n, Float_t *ein,
918  Float_t *xlf);
919  void type_of_call eufilp(const int n,Float_t *ein,
920  Float_t *pli,Float_t *plf);
921  void type_of_call eufilv(Int_t n, Float_t *ein,
922  Char_t *namv, Int_t *numv,Int_t *iovl);
923  void type_of_call trscsd(Float_t *pc,Float_t *rc,Float_t *pd,Float_t *rd,
924  Float_t *h,Float_t ch,Int_t ierr,Float_t spu,Float_t *dj,Float_t *dk);
925  void type_of_call trsdsc(Float_t *pd,Float_t *rd,Float_t *pc,Float_t *rc,
926  Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk);
927  void type_of_call trscsp(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
928  Float_t *ch,Int_t *ierr,Float_t *spx);
929  void type_of_call trspsc(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
930  Float_t *ch,Int_t *ierr,Float_t *spx);
931 
932  void type_of_call ertrgo();
933 
934  void type_of_call erxyzc();
935 
936  float type_of_call g3brelm(const Float_t &z, const Float_t& t,
937  const Float_t& cut);
938  float type_of_call g3prelm(const Float_t &z, const Float_t& t,
939  const Float_t& cut);
940 }
941 
942 #ifndef WIN32
943 # define gudigi gudigi_
944 # define guhadr guhadr_
945 # define guout guout_
946 # define guphad guphad_
947 # define gudcay gudcay_
948 # define guiget guiget_
949 # define guinme guinme_
950 # define guinti guinti_
951 # define gunear gunear_
952 # define guskip guskip_
953 # define guview guview_
954 # define gupara gupara_
955 # define gudtim gudtim_
956 # define guplsh guplsh_
957 # define gutrev gutrev_
958 # define gutrak gutrak_
959 # define guswim guswim_
960 # define gufld gufld_
961 # define gustep gustep_
962 # define gukine gukine_
963 
964 # define gheish gheish_
965 # define flufin flufin_
966 # define gfmfin gfmfin_
967 # define gpghei gpghei_
968 # define fldist fldist_
969 # define gfmdis gfmdis_
970 # define g3helx3 g3helx3_
971 # define g3helix g3helix_
972 # define g3rkuta g3rkuta_
973 # define g3track g3track_
974 # define gtreveroot gtreveroot_
975 # define g3last g3last_
976 # define g3invol g3invol_
977 # define g3tmedi g3tmedi_
978 # define g3media g3media_
979 # define g3tmany g3tmany_
980 # define g3tnext g3tnext_
981 # define g3gperp g3gperp_
982 # define ginvol ginvol_
983 # define gtmedi gtmedi_
984 # define gtmany gtmany_
985 # define gtonly gtonly_
986 # define gmedia gmedia_
987 # define glvolu glvolu_
988 # define gtnext gtnext_
989 # define ggperp ggperp_
990 
991 #else
992 # define gudigi GUDIGI
993 # define guhadr GUHADR
994 # define guout GUOUT
995 # define guphad GUPHAD
996 # define gudcay GUDCAY
997 # define guiget GUIGET
998 # define guinme GUINME
999 # define guinti GUINTI
1000 # define gunear GUNEAR
1001 # define guskip GUSKIP
1002 # define guview GUVIEW
1003 # define gupara GUPARA
1004 # define gudtim GUDTIM
1005 # define guplsh GUPLSH
1006 # define gutrev GUTREV
1007 # define gutrak GUTRAK
1008 # define guswim GUSWIM
1009 # define gufld GUFLD
1010 # define gustep GUSTEP
1011 # define gukine GUKINE
1012 
1013 # define eustep EUSTEP
1014 
1015 # define gheish GHEISH
1016 # define flufin FLUFIN
1017 # define gfmfin GFMFIN
1018 # define gpghei GPGHEI
1019 # define fldist FLDIST
1020 # define gfmdis GFMDIS
1021 # define g3helx3 G3HELX3
1022 # define g3helix G3HELIX
1023 # define g3gperp G3GPERP
1024 # define g3rkuta G3RKUTA
1025 # define gtrack GTRACK
1026 # define gtreveroot GTREVEROOT
1027 # define glast GLAST
1028 # define ginvol GINVOL
1029 # define gtmedi GTMEDI
1030 # define gtmany GTMANY
1031 # define gmedia GMEDIA
1032 # define glvolu GLVOLU
1033 # define gtnext GTNEXT
1034 # define ggperp GGPERP
1035 
1036 #endif
1037 
1038 extern "C" type_of_call void gheish();
1039 extern "C" type_of_call void flufin();
1040 extern "C" type_of_call void gfmfin();
1041 extern "C" type_of_call void gpghei();
1042 extern "C" type_of_call void fldist();
1043 extern "C" type_of_call void gfmdis();
1044 extern "C" type_of_call void g3helx3(Float_t&, Float_t&, Float_t*, Float_t*);
1045 extern "C" type_of_call void g3helix(Float_t&, Float_t&, Float_t*, Float_t*);
1046 extern "C" type_of_call void g3rkuta(Float_t&, Float_t&, Float_t*, Float_t*);
1047 extern "C" type_of_call void g3gperp(Float_t*, Float_t*, Int_t&);
1048 extern "C" type_of_call void g3track();
1049 extern "C" type_of_call void gtreveroot();
1050 extern "C" type_of_call void g3last();
1051 extern "C" type_of_call void g3invol(Float_t*, Int_t&);
1052 extern "C" type_of_call void g3tmedi(Float_t*, Int_t&);
1053 extern "C" type_of_call void g3tmany(Int_t&);
1054 extern "C" type_of_call void g3media(Float_t*, Int_t&, Int_t&);
1055 extern "C" type_of_call void g3tnext();
1056 extern "C" type_of_call void ginvol(Float_t*, Int_t&);
1057 extern "C" type_of_call void gtmedi(Float_t*, Int_t&);
1058 extern "C" type_of_call void gtmany(Int_t&);
1059 extern "C" type_of_call void gtonly(Int_t&);
1060 extern "C" type_of_call void gmedia(Float_t*, Int_t&, Int_t&);
1061 extern "C" type_of_call void glvolu(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier);
1062 extern "C" type_of_call void gtnext();
1063 extern "C" type_of_call void ggperp(Float_t*, Float_t*, Int_t&);
1064 
1065 
1066 //
1067 // Geant3 global pointer
1068 //
1073 static const Int_t kDefSize = 600;
1074 Int_t count_ginvol = 0;
1075 Int_t count_gmedia = 0;
1076 Int_t count_gtmedi = 0;
1077 Int_t count_gtnext = 0;
1079 
1080 Gconst_t *gconst=0; //! GCONST common structure
1081 Gconsx_t *cconsx=0; //! GCONSX common structure
1082 Gcjump_t *gcjump=0; //! GCJUMP common structure
1083 
1084 
1085 
1086 
1087 extern "C" type_of_call void gtonlyg3(Int_t&);
1088 void (*fginvol)(Float_t*, Int_t&) = 0;
1089 void (*fgtmedi)(Float_t*, Int_t&) = 0;
1090 void (*fgtmany)(Int_t&) = 0;
1091 void (*fgtonly)(Int_t&) = 0;
1092 void (*fgmedia)(Float_t*, Int_t&, Int_t&) = 0;
1093 void (*fglvolu)(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier) = 0;
1094 void (*fgtnext)() = 0;
1095 void (*fggperp)(Float_t*, Float_t*, Int_t&) = 0;
1096 
1097 //#define STATISTICS
1098 #ifdef STATISTICS
1099 #include "TTree.h"
1100 #include "TFile.h"
1101 Double_t oldvect[6], oldstep, oldsafety;
1102 Int_t statcode, statsame;
1103 Char_t statpath[120];
1104 Double_t statsafety, statsnext;
1105 TTree *stattree =0;
1106 TFile *statfile=0;
1107 #endif
1108 
1109 //______________________________________________________________________
1111  : TVirtualMC(),
1112  fNG3Particles(0),
1113  fNPDGCodes(0),
1114  fPDGCode(),
1115  fMCGeo(0),
1116  fImportRootGeometry(kFALSE),
1117  fStopRun(kFALSE)
1118 {
1119  //
1120  // Default constructor
1121  //
1122  geant3 = this;
1123 }
1124 
1125 //______________________________________________________________________
1126 TGeant3::TGeant3(const char *title, Int_t nwgeant)
1127  : TVirtualMC("TGeant3",title, kFALSE),
1128  fNG3Particles(0),
1129  fNPDGCodes(0),
1130  fPDGCode(),
1131  fMCGeo(0),
1132  fImportRootGeometry(kFALSE),
1133  fStopRun(kFALSE),
1134  fSkipNeutrinos(kTRUE)
1135 {
1136  //
1137  // Standard constructor for TGeant3 with ZEBRA initialization
1138  //
1139 
1140 #ifdef STATISTICS
1141  statfile = new TFile("stat.root","recreate");
1142  stattree = new TTree("stat","stat tree");
1143  stattree->Branch("statcode",&statcode,"statcode/I");
1144  stattree->Branch("statsame",&statsame,"statsame/I");
1145  stattree->Branch("statpath",statpath,"statpath/C");
1146  stattree->Branch("oldvect",oldvect,"oldvect[6]/D");
1147  stattree->Branch("oldsafety",&oldsafety,"oldsafety/D");
1148  stattree->Branch("oldstep",&oldstep,"oldstep/D");
1149  stattree->Branch("snext",&statsnext,"statsnext/D");
1150  stattree->Branch("safety",&statsafety,"statsafety/D");
1151 #endif
1152 
1153  geant3 = this;
1154 
1155  if(nwgeant) {
1156  g3zebra(nwgeant);
1157  g3init();
1158  g3zinit();
1159  } else {
1160  g3cinit();
1161  }
1162  //
1163  // Load Address of Geant3 commons
1164  LoadAddress();
1165  //
1166  // Zero number of particles
1167  fNG3Particles = 0;
1168  fNPDGCodes=0;
1169 
1170  // Set initial size to fPDGCode table
1171  fPDGCode.Set(100);
1172 
1173  //set pointers to tracker functions
1174  fginvol = g3invol;
1175  fgtmedi = g3tmedi;
1176  fgtmany = g3tmany;
1177  fgtonly = gtonlyg3;
1178  fgmedia = g3media;
1179  fglvolu = g3lvolu;
1180  fgtnext = g3tnext;
1181  fggperp = g3gperp;
1182 
1183  InitGEANE();
1184 }
1185 
1186 //______________________________________________________________________
1188 {
1189  if(fVolNames) {
1190  delete [] fVolNames;
1191  fVolNames=0;
1192  }
1193 }
1194 
1195 //______________________________________________________________________
1196 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
1197  Float_t &radl, Float_t &absl) const
1198 {
1199  //
1200  // Return the parameters of the current material during transport
1201  //
1202  z = fGcmate->z;
1203  a = fGcmate->a;
1204  dens = fGcmate->dens;
1205  radl = fGcmate->radl;
1206  absl = fGcmate->absl;
1207  return 1; //this could be the number of elements in mixture
1208 }
1209 
1210 //______________________________________________________________________
1212 {
1213  //
1214  // Set range of current drawing pad to 20x20 cm
1215  //
1216 }
1217 
1218 //______________________________________________________________________
1220 {
1221  //
1222  // Initialize HIGZ
1223  //
1224 }
1225 
1226 //______________________________________________________________________
1228 {
1229  //
1230  // Initialize GEANE for default use
1231  //
1232  Float_t pf[3]={0.,0.,0.};
1233  Float_t w1[3]={0.,0.,0.};
1234  Float_t w2[3]={0.,0.,0.};
1235  Float_t p1[3]={0.,0.,0.};
1236  Float_t p2[3]={0.,0.,0.};
1237  Float_t p3[3]={0.,0.,0.};
1238  Float_t cl[3]={0.,0.,0.};
1239  geant3 = this;
1240  geant3->SetECut(1.);
1241  geant3->SetClose(0,pf,999.,w1,w2,p1,p2,p3,cl);
1242 }
1243 
1244 //______________________________________________________________________
1246 {
1247  //
1248  // Assigns the address of the GEANT common blocks to the structures
1249  // that allow their access from C++
1250  //
1251  Int_t *addr;
1252  gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
1253  gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
1254  gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
1255  gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
1256  gcomad(PASSCHARD("GCMORE"),(int*&) fGcmore PASSCHARL("GCMORE"));
1257  gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
1258  gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
1259  gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
1260  gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
1261  gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
1262  gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
1263  gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
1264  gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
1265  gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
1266  gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
1267  gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
1268  gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
1269  gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
1270  gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
1271  gcomad(PASSCHARD("GCPHLT"),(int*&) fGcphlt PASSCHARL("GCPHLT"));
1272  gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
1273  gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
1274  gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
1275  gcomad(PASSCHARD("GCCHAN"),(int*&) gcchan PASSCHARL("GCCHAN"));
1276 
1277  // Commons for GEANE
1278  gcomad(PASSCHARD("ERTRIO"), (int*&) fErtrio PASSCHARL("ERTRIO"));
1279  gcomad(PASSCHARD("ERTRIO1"),(int*&) fErtrio1 PASSCHARL("ERTRIO1"));
1280  gcomad(PASSCHARD("EROPTS"), (int*&) fEropts PASSCHARL("EROPTS"));
1281  gcomad(PASSCHARD("EROPTC"), (int*&) fEroptc PASSCHARL("EROPTC"));
1282  gcomad(PASSCHARD("ERWORK"), (int*&) fErwork PASSCHARL("ERWORK"));
1283  gcomad(PASSCHARD("GCONST"),(int*&) fGconst PASSCHARL("GCONST"));
1284  gcomad(PASSCHARD("GCONSX"),(int*&) fGconsx PASSCHARL("GCONSX"));
1285  gcomad(PASSCHARD("GCJUMP"),(int*&) fGcjump PASSCHARL("GCJUMP"));
1286 
1287  // Variables for ZEBRA store
1288  gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
1289  fZiq = addr;
1290  gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
1291  fZlq = addr;
1292  fZq = (float*)fZiq;
1293  gctrak = fGctrak;
1294  gcvolu = fGcvolu;
1295  gckine = fGckine;
1296 }
1297 
1298 //______________________________________________________________________
1300 {
1301  //
1302  // Geometry iterator for moving upward in the geometry tree
1303  // Initialize the iterator
1304  //
1306 }
1307 
1308 //______________________________________________________________________
1309 Int_t TGeant3::NextVolUp(Text_t *name, Int_t &copy)
1310 {
1311  //
1312  // Geometry iterator for moving upward in the geometry tree
1313  // Return next volume up
1314  //
1315  fNextVol--;
1316  Int_t i, gname;
1317  if(fNextVol>=0) {
1318  gname=fGcvolu->names[fNextVol];
1319  copy=fGcvolu->number[fNextVol];
1320  i=fGcvolu->lvolum[fNextVol];
1321  name = fVolNames[i-1];
1322  if(gname == fZiq[fGclink->jvolum+i]) return i;
1323  else printf("GeomTree: Volume %s not found in bank\n",name);
1324  }
1325  return 0;
1326 }
1327 
1328 //______________________________________________________________________
1330 {
1331  Gphysi();
1332 }
1333 
1334 //______________________________________________________________________
1336 {
1337 
1338 //
1339 // Add particles to the PDG data base
1340 
1341  TDatabasePDG *pdgDB = TDatabasePDG::Instance();
1342 
1343  const Double_t kAu2Gev=0.9314943228;
1344  const Double_t khSlash = 1.0545726663e-27;
1345  const Double_t kErg2Gev = 1/1.6021773349e-3;
1346  const Double_t khShGev = khSlash*kErg2Gev;
1347  const Double_t kYear2Sec = 3600*24*365.25;
1348 //
1349 // Bottom mesons
1350 // mass and life-time from PDG
1351 //
1352 // Done by default now from Pythia6 table!
1353 //
1354 //
1355 // Ions
1356 //
1357 
1358  if ( !pdgDB->GetParticle(GetIonPdg(1,2)) )
1359  pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
1360  0,3,"Ion",GetIonPdg(1,2));
1361 
1362  if ( !pdgDB->GetParticle(GetIonPdg(1,3)) )
1363  pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
1364  khShGev/(12.33*kYear2Sec),3,"Ion",GetIonPdg(1,3));
1365 
1366  if ( !pdgDB->GetParticle(GetIonPdg(2,4)) )
1367  pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
1368  khShGev/(12.33*kYear2Sec),6,"Ion",GetIonPdg(2,4));
1369 
1370  if ( !pdgDB->GetParticle(GetIonPdg(2,3)) )
1371  pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
1372  0,6,"Ion",GetIonPdg(2,3));
1373 
1374 // Special particles
1375 //
1376  if ( !pdgDB->GetParticle(GetSpecialPdg(50)) )
1377  pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
1378  0,0,"Special",GetSpecialPdg(50));
1379 
1380  if ( !pdgDB->GetParticle(GetSpecialPdg(51)) )
1381  pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
1382  0,0,"Special",GetSpecialPdg(51));
1383 
1384 }
1385 
1386 
1387 //______________________________________________________________________
1388 Int_t TGeant3::CurrentVolID(Int_t &copy) const
1389 {
1390  //
1391  // Returns the current volume ID and copy number
1392  //
1393  Int_t i, gname;
1394  if( (i=fGcvolu->nlevel-1) < 0 ) {
1395  Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
1396  } else {
1397  gname=fGcvolu->names[i];
1398  copy=fGcvolu->number[i];
1399  i=fGcvolu->lvolum[i];
1400  if(gname == fZiq[fGclink->jvolum+i]) return i;
1401  else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
1402  }
1403  return 0;
1404 }
1405 
1406 //______________________________________________________________________
1407 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t &copy) const
1408 {
1409  //
1410  // Return the current volume "off" upward in the geometrical tree
1411  // ID and copy number
1412  //
1413  Int_t i, gname;
1414  if( (i=fGcvolu->nlevel-off-1) < 0 ) {
1415  Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
1416  off,fGcvolu->nlevel);
1417  } else {
1418  gname=fGcvolu->names[i];
1419  copy=fGcvolu->number[i];
1420  i=fGcvolu->lvolum[i];
1421  if(gname == fZiq[fGclink->jvolum+i]) return i;
1422  else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
1423  }
1424  return 0;
1425 }
1426 
1427 //______________________________________________________________________
1428 const char* TGeant3::CurrentVolName() const
1429 {
1430  //
1431  // Returns the current volume name
1432  //
1433  Int_t i;
1434  if( (i=fGcvolu->nlevel-1) < 0 ) {
1435  Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
1436  return 0;
1437  }
1438  Int_t gname=fGcvolu->names[i];
1439  i=fGcvolu->lvolum[i];
1440  if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
1441  else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
1442  return 0;
1443 }
1444 
1445 //______________________________________________________________________
1446 const char* TGeant3::CurrentVolOffName(Int_t off) const
1447 {
1448  //
1449  // Return the current volume "off" upward in the geometrical tree
1450  // ID, name and copy number
1451  // if name=0 no name is returned
1452  //
1453  Int_t i;
1454  if( (i=fGcvolu->nlevel-off-1) < 0 ) {
1455  Warning("CurrentVolOffName",
1456  "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
1457  return 0;
1458  }
1459  Int_t gname=fGcvolu->names[i];
1460  i=fGcvolu->lvolum[i];
1461  if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
1462  else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
1463  return 0;
1464 }
1465 
1466 //______________________________________________________________________
1468 {
1469 // Return the path in geometry tree for the current volume
1470 // ---
1471 
1472  return GetPath();
1473 }
1474 
1475 //______________________________________________________________________
1476 Int_t TGeant3::IdFromPDG(Int_t pdg) const
1477 {
1478  //
1479  // Return Geant3 code from PDG and pseudo ENDF code
1480  //
1481  for(Int_t i=0;i<fNPDGCodes;++i)
1482  if(pdg==fPDGCode[i]) return i;
1483  return -1;
1484 }
1485 
1486 //______________________________________________________________________
1487 Int_t TGeant3::PDGFromId(Int_t id) const
1488 {
1489  //
1490  // Return PDG code and pseudo ENDF code from Geant3 code
1491  //
1492  if(id>0 && id<fNPDGCodes) return fPDGCode[id];
1493  else return -1;
1494 }
1495 
1496 //______________________________________________________________________
1498 {
1499  //
1500  // Define standard Geant 3 particles
1501  Gpart();
1502  //
1503  // Load standard numbers for GEANT particles and PDG conversion
1504  fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
1505  fPDGCode[fNPDGCodes++]=22; // 1 = photon
1506  fPDGCode[fNPDGCodes++]=-11; // 2 = positron
1507  fPDGCode[fNPDGCodes++]=11; // 3 = electron
1508  fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
1509  fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
1510  fPDGCode[fNPDGCodes++]=13; // 6 = muon -
1511  fPDGCode[fNPDGCodes++]=111; // 7 = pi0
1512  fPDGCode[fNPDGCodes++]=211; // 8 = pi+
1513  fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
1514  fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
1515  fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
1516  fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
1517  fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
1518  fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
1519  fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
1520  fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
1521  fPDGCode[fNPDGCodes++]=221; // 17 = Eta
1522  fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
1523  fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
1524  fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
1525  fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
1526  fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
1527  fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
1528  fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
1529  fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Neutron
1530  fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Lambda
1531  fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
1532  fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
1533  fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma +
1534  fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
1535  fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
1536  fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
1537 
1538 
1539  Int_t mode[6];
1540  Int_t kz, ipa;
1541  Float_t bratio[6];
1542 
1543  fNG3Particles = 33;
1544 
1545  /* --- Define additional particles */
1546  Gspart(fNG3Particles++,"OMEGA(782)",3,0.782,0.,7.836e-23);// 33 = OMEGA(782)
1547  fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782)
1548 
1549  Gspart(fNG3Particles++,"PHI(1020)",3,1.019,0.,1.486e-22);// 34 = PHI(1020)
1550  fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020)
1551 
1552  Gspart(fNG3Particles++, "D +", 4, 1.8693, 1., 1.040e-12); // 35 = D+ // G4DMesonPlus
1553  fPDGCode[fNPDGCodes++]=411; // 35 = D+
1554 
1555  Gspart(fNG3Particles++, "D -", 4, 1.8693, -1., 1.040e-12); // 36 = D- // G4DMesonMinus
1556  fPDGCode[fNPDGCodes++]=-411; // 36 = D-
1557 
1558  Gspart(fNG3Particles++, "D 0", 3, 1.8645, 0., 0.415e-12); // 37 = D0 // G4DMesonZero
1559  fPDGCode[fNPDGCodes++]=421; // 37 = D0
1560 
1561  Gspart(fNG3Particles++,"ANTI D 0",3,1.8645,0.,0.415e-12); // 38 = Anti D0 // G4AntiDMesonZero
1562  fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar
1563 
1564 
1565  fNG3Particles++;
1566  fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned
1567 
1568  fNG3Particles++;
1569  fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned
1570 
1571  fNG3Particles++;
1572  fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned
1573 
1574  Gspart(fNG3Particles++, "RHO +", 4, 0.768, 1., 4.353e-24); // 42 = Rho+
1575  fPDGCode[fNPDGCodes++]=213; // 42 = RHO+
1576 
1577  Gspart(fNG3Particles++, "RHO -", 4, 0.768, -1., 4.353e-24); // 43 = Rho-
1578  fPDGCode[fNPDGCodes++]=-213; // 43 = RHO-
1579 
1580  Gspart(fNG3Particles++, "RHO 0", 3, 0.768, 0., 4.353e-24); // 44 = Rho0
1581  fPDGCode[fNPDGCodes++]=113; // 44 = RHO0
1582 
1583 //
1584 // Ions
1585 
1586  fNG3Particles++;
1587  fPDGCode[fNPDGCodes++]=GetIonPdg(1, 2); // 45 = Deuteron
1588 
1589  fNG3Particles++;
1590  fPDGCode[fNPDGCodes++]=GetIonPdg(1, 3); // 46 = Triton
1591 
1592  fNG3Particles++;
1593  fPDGCode[fNPDGCodes++]=GetIonPdg(2, 4); // 47 = Alpha
1594 
1595  fNG3Particles++;
1596  fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino
1597 
1598  fNG3Particles++;
1599  fPDGCode[fNPDGCodes++]=GetIonPdg(2, 3); // 49 = HE3
1600 
1601  fNG3Particles++;
1602  fPDGCode[fNPDGCodes++]=GetSpecialPdg(50); // 50 = Cherenkov
1603 // special
1604  Gspart(fNG3Particles++, "FeedbackPhoton", 7, 0., 0.,1.e20 );
1605  fPDGCode[fNPDGCodes++]=GetSpecialPdg(51); // 51 = FeedbackPhoton
1606 //
1607 
1608  Gspart(fNG3Particles++, "Lambda_c-", 4, 2.28646, +1., 2.06e-13);
1609  // Gspart(fNG3Particles++, "Lambda_c+", 4, 2.28646, +1., 0.200e-12); // G4LambdacPlus
1610  fPDGCode[fNPDGCodes++]=4122; //52 = Lambda_c+
1611 
1612  Gspart(fNG3Particles++, "Lambda_c-", 4, 2.28646, -1., 2.06e-13);
1613  // Gspart(fNG3Particles++, "Lambda_c-", 4, 2.2849, -1., 0.200e-12); // G4AntiLamdacPlus
1614  fPDGCode[fNPDGCodes++]=-4122; //53 = Lambda_c-
1615 
1616  Gspart(fNG3Particles++, "D_s+", 4, 1.9682, +1., 0.490e-12); // G4DsMesonPlus * booklet (July 2006): lifetime=0.500e-12
1617  fPDGCode[fNPDGCodes++]=431; //54 = D_s+
1618 
1619  Gspart(fNG3Particles++, "D_s-", 4, 1.9682, -1., 0.490e-12); // G4DsMesonMinus * booklet: lifetime=0.500e-12
1620  fPDGCode[fNPDGCodes++]=-431; //55 = D_s-
1621 
1622  Gspart(fNG3Particles++, "Tau+", 5, 1.77699, +1., 290.6e-15); // G4TauPlus *
1623  fPDGCode[fNPDGCodes++]=-15; //56 = Tau+
1624 
1625  Gspart(fNG3Particles++, "Tau-", 5, 1.77699, -1., 290.6e-15); // G4TauMinus *
1626  fPDGCode[fNPDGCodes++]= 15; //57 = Tau-
1627 
1628  Gspart(fNG3Particles++, "B0", 3, 5.2794, +0., 1.532e-12); // G4BMesonZero
1629  fPDGCode[fNPDGCodes++]=511; //58 = B0
1630 
1631  Gspart(fNG3Particles++, "B0 bar", 3, 5.2794, -0., 1.532e-12); // G4AntiBMesonZero
1632  fPDGCode[fNPDGCodes++]=-511; //58 = B0bar
1633 
1634  Gspart(fNG3Particles++, "B+", 4, 5.2790, +1., 1.638e-12); // G4BMesonPlus *
1635  fPDGCode[fNPDGCodes++]=521; //60 = B+
1636 
1637  Gspart(fNG3Particles++, "B-", 4, 5.2790, -1., 1.638e-12); // G4BMesonMinus *
1638  fPDGCode[fNPDGCodes++]=-521; //61 = B-
1639 
1640  Gspart(fNG3Particles++, "Bs", 3, 5.3675, +0., 1.466e-12); // G4BsMesonZero
1641  fPDGCode[fNPDGCodes++]=531; //62 = B_s
1642 
1643  Gspart(fNG3Particles++, "Bs bar", 3, 5.3675, -0., 1.466e-12); // G4AntiBsMesonZero
1644  fPDGCode[fNPDGCodes++]=-531; //63 = B_s bar
1645 
1646  Gspart(fNG3Particles++, "Lambda_b", 3, 5.624, +0., 1.24e-12);
1647  fPDGCode[fNPDGCodes++]=5122; //64 = Lambda_b
1648 
1649  Gspart(fNG3Particles++, "Lambda_b bar", 3, 5.624, -0., 1.24e-12);
1650  fPDGCode[fNPDGCodes++]=-5122; //65 = Lambda_b bar
1651 
1652  Gspart(fNG3Particles++, "J/Psi", 3, 3.096916, 0., 7.6e-21); // G4JPsi
1653  fPDGCode[fNPDGCodes++]=443; // 66 = J/Psi
1654 
1655  Gspart(fNG3Particles++, "Psi Prime", 3, 3.686, 0., 0.);
1656  fPDGCode[fNPDGCodes++]=20443; // 67 = Psi prime
1657 
1658  Gspart(fNG3Particles++, "Upsilon(1S)", 3, 9.46037, 0., 0.);
1659  fPDGCode[fNPDGCodes++]=553; // 68 = Upsilon(1S)
1660 
1661  Gspart(fNG3Particles++, "Upsilon(2S)", 3, 10.0233, 0., 0.);
1662  fPDGCode[fNPDGCodes++]=20553; // 69 = Upsilon(2S)
1663 
1664  Gspart(fNG3Particles++, "Upsilon(3S)", 3, 10.3553, 0., 0.);
1665  fPDGCode[fNPDGCodes++]=30553; // 70 = Upsilon(3S)
1666 
1667  Gspart(fNG3Particles++, "Anti Neutrino (e)", 3, 0., 0., 1.e20);
1668  fPDGCode[fNPDGCodes++]=-12; // 71 = anti electron neutrino
1669 
1670  Gspart(fNG3Particles++, "Neutrino (mu)", 3, 0., 0., 1.e20);
1671  fPDGCode[fNPDGCodes++]=14; // 72 = muon neutrino
1672 
1673  Gspart(fNG3Particles++, "Anti Neutrino (mu)", 3, 0., 0., 1.e20);
1674  fPDGCode[fNPDGCodes++]=-14; // 73 = anti muon neutrino
1675 
1676  Gspart(fNG3Particles++, "Neutrino (tau)", 3, 0., 0., 1.e20);
1677  fPDGCode[fNPDGCodes++]=16; // 74 = tau neutrino
1678 
1679  Gspart(fNG3Particles++, "Anti Neutrino (tau)",3, 0., 0., 1.e20);
1680  fPDGCode[fNPDGCodes++]=-16; // 75 = anti tau neutrino
1681 
1682 /* --- Define additional decay modes --- */
1683 /* --- omega(783) --- */
1684  for (kz = 0; kz < 6; ++kz) {
1685  bratio[kz] = 0.;
1686  mode[kz] = 0;
1687  }
1688  ipa = 33;
1689  bratio[0] = 89.;
1690  bratio[1] = 8.5;
1691  bratio[2] = 2.5;
1692  mode[0] = 70809;
1693  mode[1] = 107;
1694  mode[2] = 908;
1695  Gsdk(ipa, bratio, mode);
1696 /* --- phi(1020) --- */
1697  for (kz = 0; kz < 6; ++kz) {
1698  bratio[kz] = 0.;
1699  mode[kz] = 0;
1700  }
1701  ipa = 34;
1702  bratio[0] = 49.;
1703  bratio[1] = 34.4;
1704  bratio[2] = 12.9;
1705  bratio[3] = 2.4;
1706  bratio[4] = 1.3;
1707  mode[0] = 1112;
1708  mode[1] = 1610;
1709  mode[2] = 4407;
1710  mode[3] = 90807;
1711  mode[4] = 1701;
1712  Gsdk(ipa, bratio, mode);
1713 /* --- D+ --- */
1714  /*
1715  for (kz = 0; kz < 6; ++kz) {
1716  bratio[kz] = 0.;
1717  mode[kz] = 0;
1718  }
1719  ipa = 35;
1720  bratio[0] = 25.;
1721  bratio[1] = 25.;
1722  bratio[2] = 25.;
1723  bratio[3] = 25.;
1724  mode[0] = 80809;
1725  mode[1] = 120808;
1726  mode[2] = 111208;
1727  mode[3] = 110809;
1728  Gsdk(ipa, bratio, mode);
1729  */
1730 /* --- D- --- */
1731  /*
1732  for (kz = 0; kz < 6; ++kz) {
1733  bratio[kz] = 0.;
1734  mode[kz] = 0;
1735  }
1736  ipa = 36;
1737  bratio[0] = 25.;
1738  bratio[1] = 25.;
1739  bratio[2] = 25.;
1740  bratio[3] = 25.;
1741  mode[0] = 90908;
1742  mode[1] = 110909;
1743  mode[2] = 121109;
1744  mode[3] = 120908;
1745  Gsdk(ipa, bratio, mode);
1746  */
1747 /* --- D0 --- */
1748  /*
1749  for (kz = 0; kz < 6; ++kz) {
1750  bratio[kz] = 0.;
1751  mode[kz] = 0;
1752  }
1753  ipa = 37;
1754  bratio[0] = 33.;
1755  bratio[1] = 33.;
1756  bratio[2] = 33.;
1757  mode[0] = 809;
1758  mode[1] = 1208;
1759  mode[2] = 1112;
1760  Gsdk(ipa, bratio, mode);
1761  */
1762 /* --- Anti D0 --- */
1763  /*
1764  for (kz = 0; kz < 6; ++kz) {
1765  bratio[kz] = 0.;
1766  mode[kz] = 0;
1767  }
1768  ipa = 38;
1769  bratio[0] = 33.;
1770  bratio[1] = 33.;
1771  bratio[2] = 33.;
1772  mode[0] = 809;
1773  mode[1] = 1109;
1774  mode[2] = 1112;
1775  Gsdk(ipa, bratio, mode);
1776  */
1777 /* --- rho+ --- */
1778  for (kz = 0; kz < 6; ++kz) {
1779  bratio[kz] = 0.;
1780  mode[kz] = 0;
1781  }
1782  ipa = 42;
1783  bratio[0] = 100.;
1784  mode[0] = 807;
1785  Gsdk(ipa, bratio, mode);
1786 /* --- rho- --- */
1787  for (kz = 0; kz < 6; ++kz) {
1788  bratio[kz] = 0.;
1789  mode[kz] = 0;
1790  }
1791  ipa = 43;
1792  bratio[0] = 100.;
1793  mode[0] = 907;
1794  Gsdk(ipa, bratio, mode);
1795 /* --- rho0 --- */
1796  for (kz = 0; kz < 6; ++kz) {
1797  bratio[kz] = 0.;
1798  mode[kz] = 0;
1799  }
1800  ipa = 44;
1801  bratio[0] = 100.;
1802  mode[0] = 809;
1803  Gsdk(ipa, bratio, mode);
1804  /*
1805 // --- jpsi ---
1806  for (kz = 0; kz < 6; ++kz) {
1807  bratio[kz] = 0.;
1808  mode[kz] = 0;
1809  }
1810  ipa = 113;
1811  bratio[0] = 50.;
1812  bratio[1] = 50.;
1813  mode[0] = 506;
1814  mode[1] = 605;
1815  Gsdk(ipa, bratio, mode);
1816 // --- upsilon ---
1817  ipa = 114;
1818  Gsdk(ipa, bratio, mode);
1819 // --- phi ---
1820  ipa = 115;
1821  Gsdk(ipa, bratio, mode);
1822  */
1823 //
1825 }
1826 
1827 //______________________________________________________________________
1828 Int_t TGeant3::VolId(const Text_t *name) const
1829 {
1830  //
1831  // Return the unique numeric identifier for volume name
1832  //
1833  Int_t gname,i;
1834  strncpy((char *) &gname, name, 4);
1835  for(i=1; i<=fGcnum->nvolum; i++)
1836  if(gname == fZiq[fGclink->jvolum+i]) return i;
1837  printf("VolId: Volume %s not found\n",name);
1838  return 0;
1839 }
1840 
1841 //______________________________________________________________________
1842 Int_t TGeant3::MediumId(const Text_t *medName) const
1843 {
1844  // Return the unique numeric identifier for medium name
1845 
1846  Int_t nmed = fMedNames.GetEntriesFast();
1847  for ( Int_t imed = 1; imed < nmed; imed++ ) {
1848 
1849  TString name = ((TObjString*)fMedNames.At(imed))->GetString();
1850  if ( name == TString(medName) ) return imed;
1851  }
1852  printf("MediumId: Medium %s not found\n", medName);
1853  return 0;
1854 }
1855 
1856 //______________________________________________________________________
1857 Int_t TGeant3::NofVolumes() const
1858 {
1859  //
1860  // Return total number of volumes in the geometry
1861  //
1862  return fGcnum->nvolum;
1863 }
1864 
1865 //______________________________________________________________________
1866 Int_t TGeant3::NofVolDaughters(const char* volName) const
1867 {
1868 // Return number of daughters of the volume specified by volName
1869 // According to A. Morsch' G3toRoot class
1870 // ---
1871 
1872  Int_t idvol = VolId(volName);
1873 
1874  Int_t jvo = fZlq[fGclink->jvolum-idvol];
1875  Int_t nin = Int_t(fZq[jvo+3]);
1876  return nin;
1877 }
1878 
1879 //______________________________________________________________________
1880 const char* TGeant3::VolDaughterName(const char* volName, Int_t i) const
1881 {
1882 // Return the name of i-th daughters of the volume specified by volName
1883 // According to A. Morsch' G3toRoot class
1884 // ---
1885 
1886  Int_t idvol = VolId(volName);
1887 
1888  Int_t jvo = fZlq[fGclink->jvolum-idvol];
1889  Int_t nin=i+1;
1890  Int_t jin = fZlq[jvo-nin];
1891  Int_t idvold = Int_t(fZq[jin+2]);;
1892 
1893  return VolName(idvold);
1894 }
1895 
1896 
1897 //______________________________________________________________________
1898 Int_t TGeant3::VolDaughterCopyNo(const char* volName, Int_t i) const
1899 {
1900 // Return the copyNo of i-th daughters of the volume specified by volName
1901 // According to A. Morsch' G3toRoot class
1902 // ---
1903 
1904  Int_t idvol = VolId(volName);
1905 
1906  Int_t jvo = fZlq[fGclink->jvolum-idvol];
1907  Int_t nin=i+1;
1908  Int_t jin = fZlq[jvo-nin];
1909 
1910  return Int_t(fZq[jin +3]);
1911 }
1912 
1913 //______________________________________________________________________
1914 Int_t TGeant3::VolId2Mate(Int_t id) const
1915 {
1916  //
1917  // Return material number for a given volume id
1918  //
1919  if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1920  return 0;
1921  else {
1922  Int_t jvo = fZlq[fGclink->jvolum-id];
1923  return Int_t(fZq[jvo+4]);
1924  }
1925 }
1926 
1927 //______________________________________________________________________
1928 const char* TGeant3::VolName(Int_t id) const
1929 {
1930  //
1931  // Return the volume name given the volume identifier
1932  //
1933  if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
1934  return fVolNames[fGcnum->nvolum];
1935  else
1936  return fVolNames[id-1];
1937 }
1938 
1939 //______________________________________________________________________
1940 Bool_t TGeant3::SetCut(const char* cutName, Double_t cutValue)
1941 {
1942  //
1943  // Set transport cuts for particles
1944  //
1945  Bool_t success = kTRUE;
1946 
1947  if(!strcmp(cutName,"CUTGAM"))
1948  fGccuts->cutgam=cutValue;
1949  else if(!strcmp(cutName,"CUTELE"))
1950  fGccuts->cutele=cutValue;
1951  else if(!strcmp(cutName,"CUTNEU"))
1952  fGccuts->cutneu=cutValue;
1953  else if(!strcmp(cutName,"CUTHAD"))
1954  fGccuts->cuthad=cutValue;
1955  else if(!strcmp(cutName,"CUTMUO"))
1956  fGccuts->cutmuo=cutValue;
1957  else if(!strcmp(cutName,"BCUTE"))
1958  fGccuts->bcute=cutValue;
1959  else if(!strcmp(cutName,"BCUTM"))
1960  fGccuts->bcutm=cutValue;
1961  else if(!strcmp(cutName,"DCUTE"))
1962  fGccuts->dcute=cutValue;
1963  else if(!strcmp(cutName,"DCUTM"))
1964  fGccuts->dcutm=cutValue;
1965  else if(!strcmp(cutName,"PPCUTM"))
1966  fGccuts->ppcutm=cutValue;
1967  else if(!strcmp(cutName,"TOFMAX"))
1968  fGccuts->tofmax=cutValue;
1969  else {
1970  Warning("SetCut","Cut %s not implemented\n",cutName);
1971  success = kFALSE;
1972  }
1973 
1974  return success;
1975 }
1976 
1977 //______________________________________________________________________
1978 Bool_t TGeant3::SetProcess(const char* flagName, Int_t flagValue)
1979 {
1980  //
1981  // Set thresholds for different processes
1982  //
1983  Bool_t success = kTRUE;
1984 
1985  if(!strcmp(flagName,"PAIR"))
1986  fGcphys->ipair=flagValue;
1987  else if(!strcmp(flagName,"COMP"))
1988  fGcphys->icomp=flagValue;
1989  else if(!strcmp(flagName,"PHOT"))
1990  fGcphys->iphot=flagValue;
1991  else if(!strcmp(flagName,"PFIS"))
1992  fGcphys->ipfis=flagValue;
1993  else if(!strcmp(flagName,"DRAY"))
1994  fGcphys->idray=flagValue;
1995  else if(!strcmp(flagName,"ANNI"))
1996  fGcphys->ianni=flagValue;
1997  else if(!strcmp(flagName,"BREM"))
1998  fGcphys->ibrem=flagValue;
1999  else if(!strcmp(flagName,"HADR"))
2000  fGcphys->ihadr=flagValue;
2001  else if(!strcmp(flagName,"MUNU"))
2002  fGcphys->imunu=flagValue;
2003  else if(!strcmp(flagName,"DCAY"))
2004  fGcphys->idcay=flagValue;
2005  else if(!strcmp(flagName,"LOSS"))
2006  fGcphys->iloss=flagValue;
2007  else if(!strcmp(flagName,"MULS"))
2008  fGcphys->imuls=flagValue;
2009  else if(!strcmp(flagName,"RAYL"))
2010  fGcphys->irayl=flagValue;
2011  else if(!strcmp(flagName,"STRA"))
2012  fGcphlt->istra=flagValue;
2013  else if(!strcmp(flagName,"SYNC"))
2014  fGcphlt->isync=flagValue;
2015  else if(!strcmp(flagName,"CKOV"))
2016  fGctlit->itckov = flagValue;
2017  else {
2018  Warning("SetFlag","Flag %s not implemented\n",flagName);
2019  success = kFALSE;
2020  }
2021 
2022  return success;
2023 }
2024 
2025  //______________________________________________________________________
2026 Bool_t TGeant3::DefineParticle(Int_t pdg,const char* name,TMCParticleType type,
2027  Double_t mass, Double_t charge, Double_t lifetime)
2028 {
2029 // Old function definition, now replaced with more arguments
2030 
2031  TVirtualMC::DefineParticle(pdg, name, type, mass, charge, lifetime);
2032 
2033  return false;
2034 }
2035 
2036 
2037 //______________________________________________________________________
2038 Bool_t TGeant3::DefineParticle(Int_t pdg,const char* name, TMCParticleType mcType,
2039  Double_t mass, Double_t charge, Double_t lifetime,
2040  const TString& /*pType*/, Double_t /*width*/,
2041  Int_t /*iSpin*/, Int_t /*iParity*/, Int_t /*iConjugation*/,
2042  Int_t /*iIsospin*/, Int_t /*iIsospinZ*/, Int_t /*gParity*/,
2043  Int_t /*lepton*/, Int_t /*baryon*/,
2044  Bool_t /*stable*/, Bool_t /*shortlived*/,
2045  const TString& /*subType*/,
2046  Int_t /*antiEncoding*/, Double_t /*magMoment*/,
2047  Double_t /*excitation*/)
2048 {
2049 //
2050 // Set a user defined particle
2051 // Function is ignored if particle with specified pdg
2052 // already exists and error report is printed.
2053 // ---
2054 
2055  // Check if particle with specified pdg already exists
2056  // in TGeant3
2057  if (IdFromPDG(pdg) > 0) {
2058  Error("SetParticle", "Particle already exists.");
2059  return kFALSE;
2060  }
2061 
2062  // Check if particle type is known to Geant3
2063  Int_t itrtyp = TransportMethod(mcType);
2064  if (itrtyp < 0) {
2065  Error("SetParticle", "Unknown particle transport.");
2066  return kFALSE;
2067  }
2068 
2069  // Add particle to Geant3
2070  Gspart(fNG3Particles++, name, itrtyp, mass, charge, lifetime);
2071 
2072  // Add particle to TDatabasePDG
2073  // (if it does not yet exist here)
2074  if (!TDatabasePDG::Instance()->GetParticle(pdg))
2075  TDatabasePDG::Instance()
2076  ->AddParticle(name, name, mass, kTRUE, 0, charge*3,
2077  ParticleClass(mcType).Data(), pdg);
2078 
2079  // Resize fPDGCode table if needed
2080  if ( fNPDGCodes >= fPDGCode.GetSize() )
2081  fPDGCode.Set( fPDGCode.GetSize() + 100);
2082 
2083  fPDGCode[fNPDGCodes++] = pdg;
2084 
2085  return kTRUE;
2086 }
2087 
2088 //______________________________________________________________________
2089 Bool_t TGeant3::DefineIon(const char* name, Int_t Z, Int_t A, Int_t Q,
2090  Double_t /* excEnergy */, Double_t mass)
2091 {
2092 //
2093 // Set a user defined ion.
2094 // ---
2095 
2096  // Define pdgEncoding
2097  //
2098  Int_t pdg = GetIonPdg(Z, A);
2099  Int_t pdgMax = pdg + 9;
2100 
2101  // Find isomer number which is not yet used
2102  while (TDatabasePDG::Instance()->GetParticle(pdg) &&
2103  pdg < pdgMax)
2104  pdg++;
2105  if (TDatabasePDG::Instance()->GetParticle(pdg)) {
2106  Fatal("SetIon", "All isomer numbers are already used");
2107  return kFALSE;
2108  }
2109 
2110  // Particle properties
2111  // excitation energy not used by G3
2112  if (mass < 1e-09) mass = 0.9382723 * A;
2113  // approximative mass if not specified by user
2114  Double_t charge = Q;
2115  TMCParticleType partType = kPTIon;
2116  Double_t lifetime = 1.e20;
2117 
2118  // Call DefineParticle now
2119  return DefineParticle(
2120  pdg, name, partType, mass, charge, lifetime,
2121  "nucleus", 0.0, 1, 1, 0, 1, 1, 0, 0, 1, kTRUE);
2122 }
2123 
2124 //______________________________________________________________________
2125 TString TGeant3::ParticleName(Int_t pdg) const
2126 {
2127 // Return G3 particle name
2128 // ---
2129 
2130  char name[21];
2131  Int_t itrtyp;
2132  Float_t amass, charge, tlife;
2133  Gfpart(pdg, name, itrtyp,amass, charge, tlife);
2134  name[20] = '\0';
2135 
2136  return TString(name);
2137 }
2138 
2139 //______________________________________________________________________
2140 Double_t TGeant3::ParticleMass(Int_t pdg) const
2141 {
2142 // Return G3 particle mass
2143 // ---
2144 
2145  char name[20];
2146  Int_t itrtyp;
2147  Float_t mass, charge, tlife;
2148  Gfpart(pdg,name, itrtyp, mass, charge, tlife);
2149 
2150  return mass;
2151 }
2152 
2153 //______________________________________________________________________
2154 Double_t TGeant3::ParticleCharge(Int_t pdg) const
2155 {
2156 // Return G3 particle charge (in e)
2157 // ---
2158 
2159  char name[20];
2160  Int_t itrtyp;
2161  Float_t mass, charge, tlife;
2162  Gfpart(pdg,name, itrtyp, mass, charge, tlife);
2163 
2164  return charge;
2165 }
2166 
2167 //______________________________________________________________________
2168 Double_t TGeant3::ParticleLifeTime(Int_t pdg) const
2169 {
2170 // Return G3 particle life time
2171 // ---
2172 
2173  char name[20];
2174  Int_t itrtyp;
2175  Float_t mass, charge, tlife;
2176  Gfpart(pdg, name, itrtyp, mass, charge, tlife);
2177 
2178  return tlife;
2179 }
2180 
2181 //______________________________________________________________________
2182 TMCParticleType TGeant3::ParticleMCType(Int_t pdg) const
2183 {
2184 // Return MC particle type
2185 // ---
2186 
2187  char name[20];
2188  Int_t itrtyp;
2189  Float_t mass, charge, tlife;
2190  Gfpart(pdg,name, itrtyp, mass, charge, tlife);
2191 
2192  return ParticleType(itrtyp);
2193 }
2194 
2195 
2196 //______________________________________________________________________
2197 Double_t TGeant3::Xsec(char* reac, Double_t /* energy */,
2198  Int_t part, Int_t /* mate */)
2199 {
2200  //
2201  // Calculate X-sections -- dummy for the moment
2202  //
2203  if(!strcmp(reac,"PHOT"))
2204  {
2205  if(part!=22) {
2206  Error("Xsec","Can calculate photoelectric only for photons\n");
2207  }
2208  }
2209  return 0;
2210 }
2211 
2212 //______________________________________________________________________
2213 void TGeant3::TrackPosition(TLorentzVector &xyz) const
2214 {
2215  //
2216  // Return the current position in the master reference frame of the
2217  // track being transported
2218  //
2219  xyz[0]=fGctrak->vect[0];
2220  xyz[1]=fGctrak->vect[1];
2221  xyz[2]=fGctrak->vect[2];
2222  xyz[3]=fGctrak->tofg;
2223 }
2224 
2225 //______________________________________________________________________
2226 void TGeant3::TrackPosition(Double_t &x, Double_t &y, Double_t &z) const
2227 {
2228  //
2229  // Return the current position in the master reference frame of the
2230  // track being transported
2231  //
2232  x=fGctrak->vect[0];
2233  y=fGctrak->vect[1];
2234  z=fGctrak->vect[2];
2235 }
2236 
2237 //______________________________________________________________________
2238 Double_t TGeant3::TrackTime() const
2239 {
2240  //
2241  // Return the current time of flight of the track being transported
2242  //
2243  return fGctrak->tofg;
2244 }
2245 
2246 //______________________________________________________________________
2247 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
2248 {
2249  //
2250  // Return the direction and the momentum (GeV/c) of the track
2251  // currently being transported
2252  //
2253  Double_t ptot=fGctrak->vect[6];
2254  xyz[0]=fGctrak->vect[3]*ptot;
2255  xyz[1]=fGctrak->vect[4]*ptot;
2256  xyz[2]=fGctrak->vect[5]*ptot;
2257  xyz[3]=fGctrak->getot;
2258 }
2259 
2260 //______________________________________________________________________
2261 void TGeant3::TrackMomentum(Double_t &px, Double_t &py, Double_t &pz,
2262  Double_t &etot) const
2263 {
2264  //
2265  // Return the direction and the momentum (GeV/c) of the track
2266  // currently being transported
2267  //
2268  Double_t ptot=fGctrak->vect[6];
2269  px =fGctrak->vect[3]*ptot;
2270  py =fGctrak->vect[4]*ptot;
2271  pz =fGctrak->vect[5]*ptot;
2272  etot=fGctrak->getot;
2273 }
2274 
2275 //______________________________________________________________________
2276 Double_t TGeant3::TrackCharge() const
2277 {
2278  //
2279  // Return charge of the track currently transported
2280  //
2281  return fGckine->charge;
2282 }
2283 
2284 //______________________________________________________________________
2285 Double_t TGeant3::TrackMass() const
2286 {
2287  //
2288  // Return the mass of the track currently transported
2289  //
2290  return fGckine->amass;
2291 }
2292 
2293 //______________________________________________________________________
2294 Int_t TGeant3::TrackPid() const
2295 {
2296  //
2297  // Return the id of the particle transported
2298  //
2299  return PDGFromId(fGckine->ipart);
2300 }
2301 
2302 //______________________________________________________________________
2303 Double_t TGeant3::TrackStep() const
2304 {
2305  //
2306  // Return the length in centimeters of the current step
2307  //
2308  return fGctrak->step;
2309 }
2310 
2311 //______________________________________________________________________
2312 Double_t TGeant3::TrackLength() const
2313 {
2314  //
2315  // Return the length of the current track from its origin
2316  //
2317  return fGctrak->sleng;
2318 }
2319 
2320 //______________________________________________________________________
2321 Bool_t TGeant3::IsNewTrack() const
2322 {
2323  //
2324  // True if the track is not at the boundary of the current volume
2325  //
2326  return (fGctrak->sleng==0);
2327 }
2328 
2329 //______________________________________________________________________
2331 {
2332  //
2333  // True if the track is not at the boundary of the current volume
2334  //
2335  return (fGctrak->inwvol==0);
2336 }
2337 
2338 //______________________________________________________________________
2340 {
2341  //
2342  // True if this is the first step of the track in the current volume
2343  //
2344  return (fGctrak->inwvol==1);
2345 }
2346 
2347 //______________________________________________________________________
2349 {
2350  //
2351  // True if this is the last step of the track in the current volume
2352  //
2353  return (fGctrak->inwvol==2);
2354 }
2355 
2356 //______________________________________________________________________
2357 Bool_t TGeant3::IsTrackOut() const
2358 {
2359  //
2360  // True if the track is out of the setup
2361  //
2362  return (fGctrak->inwvol==3);
2363 }
2364 
2365 //______________________________________________________________________
2366 Bool_t TGeant3::IsTrackStop() const
2367 {
2368  //
2369  // True if the track energy has fallen below the threshold
2370  //
2371  return (fGctrak->istop==2);
2372 }
2373 
2374 //______________________________________________________________________
2376 {
2377  //
2378  // Number of secondary particles generated in the current step
2379  //
2380  return fGcking->ngkine;
2381 }
2382 
2383 //______________________________________________________________________
2385 {
2386  //
2387  // Number of the current event
2388  //
2389  return fGcflag->idevt;
2390 }
2391 
2392 //______________________________________________________________________
2393 TMCProcess TGeant3::ProdProcess(Int_t ) const
2394 {
2395  //
2396  // Name of the process that has produced the secondary particles
2397  // in the current step
2398 
2399  // Modified: to make use of GCKING/KCASE variable for determining the production
2400  // mechanism of the secondaries. The old method was to pick the first
2401  // active process from the current step's list of active processes
2402  // that had the capability of generating secondaries. This occasionally
2403  // picked the wrong secondary production mechanism.
2404 
2405  Int_t imech=0;
2406 
2407  if ( fGcking->ngkine <= 0 ) return kPNoProcess;
2408 
2409  // Secondaries generated, determine production mechanism hollerith
2410  for (Int_t km = 0; km < MAXMEC; ++km) {
2411  if ( fGcking->kcase == fGctrak->namec[km] ) {
2412  imech = km;
2413  break;
2414  }
2415  }
2416 
2417  TMCProcess vmcmech = G3toVMC(imech+1);
2418  if ( vmcmech == kPNoProcess ) {
2419  // failure to find matching process
2420  printf(
2421  "* TGeant3::ProdProcess secondaries present,but no matching process!* \n");
2422  }
2423 
2424  return vmcmech;
2425 }
2426 
2427 //______________________________________________________________________
2428 Int_t TGeant3::StepProcesses(TArrayI &proc) const
2429 {
2430  //
2431  // Return processes active in the current step
2432  //
2433  Int_t i;
2434  Int_t nproc=Gctrak()->nmec;
2435 
2436  // Set no active process if there are no processes
2437  if (nproc==0) {
2438  proc.Set(1);
2439  proc[0] = kPNull;
2440  return 1;
2441  }
2442 
2443  //
2444  proc.Set(nproc);
2445  Int_t nvproc=0;
2446  //
2447  for (i=0; i<nproc; ++i)
2448  if((proc[nvproc]=G3toVMC(Gctrak()->lmec[i]))!=kPNoProcess) nvproc++;
2449  //
2450  proc.Set(nvproc);
2451  //
2452  return nvproc;
2453 }
2454 
2455 //______________________________________________________________________
2456 TMCProcess TGeant3::G3toVMC(Int_t iproc) const
2457 {
2458  //
2459  // Conversion between GEANT and TMC processes
2460  //
2461 
2462  const TMCProcess kPG2MC1[30] = {
2463  kPTransportation, kPMultipleScattering, kPEnergyLoss, kPMagneticFieldL, kPDecay,
2464  kPPair, kPCompton, kPPhotoelectric, kPBrem, kPDeltaRay,
2465  kPAnnihilation, kPHadronic, kPHCElastic, kPEvaporation, kPNuclearFission,
2466  kPNuclearAbsorption, kPPbarAnnihilation, kPNCapture, kPHIElastic,
2467  kPHInhelastic, kPMuonNuclear, kPTOFlimit, kPPhotoFission, kPNoProcess,
2468  kPRayleigh, kPNoProcess, kPNoProcess, kPNoProcess, kPNull, kPStop};
2469 
2470  const TMCProcess kPG2MC2[9] = {
2471  kPLightAbsorption, kPLightScattering, kStepMax, kPNoProcess, kPCerenkov,
2472  kPLightReflection, kPLightRefraction, kPSynchrotron, kPNoProcess};
2473 
2474  TMCProcess proc=kPNoProcess;
2475  if(0<iproc && iproc<=30) proc= kPG2MC1[iproc-1];
2476  else if(101<=iproc && iproc<=109) proc= kPG2MC2[iproc-100-1];
2477  return proc;
2478 }
2479 
2480 
2481 //______________________________________________________________________
2482 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
2483  TLorentzVector &x, TLorentzVector &p)
2484 {
2485  //
2486  // Get the parameters of the secondary track number isec produced
2487  // in the current step
2488  //
2489  Int_t i;
2490  if(-1<isec && isec<fGcking->ngkine) {
2491  ipart=Int_t (fGcking->gkin[isec][4] +0.5);
2492  for(i=0;i<3;i++) {
2493  x[i]=fGckin3->gpos[isec][i];
2494  p[i]=fGcking->gkin[isec][i];
2495  }
2496  x[3]=fGcking->tofd[isec];
2497  p[3]=fGcking->gkin[isec][3];
2498  } else {
2499  printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
2500  x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
2501  ipart=0;
2502  }
2503 }
2504 
2505 //______________________________________________________________________
2507 {
2508  //
2509  // Set switches for lego transport
2510  //
2511  SetSWIT(4,0);
2512  SetDEBU(0,0,0); //do not print a message
2513 }
2514 
2515 //______________________________________________________________________
2517 {
2518  //
2519  // True if the current particle has disappeared
2520  // either because it decayed or because it underwent
2521  // an inelastic collision
2522  //
2523  return (fGctrak->istop==1);
2524 }
2525 
2526 //______________________________________________________________________
2528 {
2529  //
2530  // True if the current particle is alive and will continue to be
2531  // transported
2532  //
2533  return (fGctrak->istop==0);
2534 }
2535 
2536 //______________________________________________________________________
2538 {
2539  //
2540  // Stop the transport of the current particle and skip to the next
2541  //
2542  fGctrak->istop=1;
2543 }
2544 
2545 //______________________________________________________________________
2547 {
2548  //
2549  // Stop simulation of the current event and skip to the next
2550  //
2551  fGcflag->ieotri=1;
2552 }
2553 
2554 //______________________________________________________________________
2556 {
2557  //
2558  // Stop simulation of the current event and set the abort run flag to true
2559  //
2560 
2561  StopTrack();
2562  StopEvent();
2563  fStopRun = kTRUE;
2564 }
2565 
2566 //______________________________________________________________________
2567 Double_t TGeant3::MaxStep() const
2568 {
2569  //
2570  // Return the maximum step length in the current medium
2571  //
2572  return fGctmed->stemax;
2573 }
2574 
2575 //______________________________________________________________________
2576 void TGeant3::SetMaxStep(Double_t maxstep)
2577 {
2578  //
2579  // Set the maximum step allowed till the particle is in the current medium
2580  //
2581  fGctmed->stemax=maxstep;
2582 }
2583 
2584 //______________________________________________________________________
2585 void TGeant3::SetMaxNStep(Int_t maxnstp)
2586 {
2587  //
2588  // Set the maximum number of steps till the particle is in the current medium
2589  //
2590  fGctrak->maxnst=maxnstp;
2591 }
2592 
2594 {
2595  //
2596  // Force the decay time of the current particle
2597  //
2598  TLorentzVector p;
2599  TrackMomentum(p);
2600  Gcphys()->sumlif = time / p.Beta() / p.Gamma() * 2.99792458e10;
2601 }
2602 
2603 //______________________________________________________________________
2605 {
2606  //
2607  // Maximum number of steps allowed in current medium
2608  //
2609  return fGctrak->maxnst;
2610 }
2611 
2612 //_______________________________________________________________________
2613 void TGeant3::G3Material(Int_t& kmat, const char* name, Double_t a,
2614  Double_t z, Double_t dens, Double_t radl,
2615  Double_t absl, Float_t* buf, Int_t nwbuf)
2616 {
2617  //
2618  // Defines a Material
2619  //
2620  // kmat number assigned to the material
2621  // name material name
2622  // a atomic mass in au
2623  // z atomic number
2624  // dens density in g/cm3
2625  // absl absorption length in cm
2626  // if >=0 it is ignored and the program
2627  // calculates it, if <0. -absl is taken
2628  // radl radiation length in cm
2629  // if >=0 it is ignored and the program
2630  // calculates it, if <0. -radl is taken
2631  // buf pointer to an array of user words
2632  // nbuf number of user words
2633  //
2634  Int_t jmate=fGclink->jmate;
2635  kmat=1;
2636  Int_t ns, i;
2637  if(jmate>0) {
2638  ns=fZiq[jmate-2];
2639  kmat=ns+1;
2640  for(i=1; i<=ns; i++) {
2641  if(fZlq[jmate-i]==0) {
2642  kmat=i;
2643  break;
2644  }
2645  }
2646  }
2647  Float_t fa = a;
2648  Float_t fz = z;
2649  Float_t fdens = dens;
2650  Float_t fradl = radl;
2651  Float_t fabsl = absl;
2652 
2653  g3smate(kmat,PASSCHARD(name), fa, fz, fdens, fradl, fabsl, buf,
2654  nwbuf PASSCHARL(name));
2655 }
2656 
2657 //______________________________________________________________________
2658 void TGeant3::Material(Int_t& kmat, const char* name, Double_t a, Double_t z,
2659  Double_t dens, Double_t radl, Double_t absl, Float_t* buf,
2660  Int_t nwbuf)
2661 {
2662  //
2663  // Defines a Material
2664  //
2665  // kmat number assigned to the material
2666  // name material name
2667  // a atomic mass in au
2668  // z atomic number
2669  // dens density in g/cm3
2670  // absl absorption length in cm
2671  // if >=0 it is ignored and the program
2672  // calculates it, if <0. -absl is taken
2673  // radl radiation length in cm
2674  // if >=0 it is ignored and the program
2675  // calculates it, if <0. -radl is taken
2676  // buf pointer to an array of user words
2677  // nbuf number of user words
2678  //
2679 
2680  G3Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
2681 }
2682 
2683 //______________________________________________________________________
2684 void TGeant3::Material(Int_t& kmat, const char* name, Double_t a, Double_t z,
2685  Double_t dens, Double_t radl, Double_t absl, Double_t* buf,
2686  Int_t nwbuf)
2687 {
2688  //
2689  // Defines a Material
2690  //
2691  // kmat number assigned to the material
2692  // name material name
2693  // a atomic mass in au
2694  // z atomic number
2695  // dens density in g/cm3
2696  // absl absorption length in cm
2697  // if >=0 it is ignored and the program
2698  // calculates it, if <0. -absl is taken
2699  // radl radiation length in cm
2700  // if >=0 it is ignored and the program
2701  // calculates it, if <0. -radl is taken
2702  // buf pointer to an array of user words
2703  // nbuf number of user words
2704  //
2705 
2706 
2707  Float_t* fbuf = CreateFloatArray(buf, nwbuf);
2708  G3Material(kmat, name, a, z, dens, radl, absl, fbuf, nwbuf);
2709  delete [] fbuf;
2710 }
2711 
2712 //______________________________________________________________________
2713 void TGeant3::G3Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
2714  Double_t dens, Int_t nlmat, Float_t* wmat)
2715 {
2716  //
2717  // Defines mixture OR COMPOUND IMAT as composed by
2718  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
2719  //
2720  // If NLMAT > 0 then wmat contains the proportion by
2721  // weights of each basic material in the mixture.
2722  //
2723  // If nlmat < 0 then WMAT contains the number of atoms
2724  // of a given kind into the molecule of the COMPOUND
2725  // In this case, WMAT in output is changed to relative
2726  // weights.
2727  //
2728 
2729  Int_t jmate=fGclink->jmate;
2730  kmat=1;
2731  Int_t ns, i;
2732  if(jmate>0) {
2733  ns=fZiq[jmate-2];
2734  kmat=ns+1;
2735  for(i=1; i<=ns; i++) {
2736  if(fZlq[jmate-i]==0) {
2737  kmat=i;
2738  break;
2739  }
2740  }
2741  }
2742  g3smixt(kmat,PASSCHARD(name),a,z,Float_t(dens),nlmat,wmat PASSCHARL(name));
2743 }
2744 
2745 //______________________________________________________________________
2746 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
2747  Double_t dens, Int_t nlmat, Float_t* wmat)
2748 {
2749  //
2750  // Defines mixture OR COMPOUND IMAT as composed by
2751  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
2752  //
2753  // If NLMAT > 0 then wmat contains the proportion by
2754  // weights of each basic material in the mixture.
2755  //
2756  // If nlmat < 0 then WMAT contains the number of atoms
2757  // of a given kind into the molecule of the COMPOUND
2758  // In this case, WMAT in output is changed to relative
2759  // weights.
2760  //
2761 
2762  Float_t* fa = CreateFloatArray(a, TMath::Abs(nlmat));
2763  Float_t* fz = CreateFloatArray(z, TMath::Abs(nlmat));
2764  Float_t* fwmat = CreateFloatArray(wmat, TMath::Abs(nlmat));
2765 
2766  G3Mixture(kmat, name, fa, fz, dens, nlmat, fwmat);
2767  Int_t i;
2768  for (i=0; i<TMath::Abs(nlmat); i++) {
2769  a[i] = fa[i]; z[i] = fz[i]; wmat[i] = fwmat[i];
2770  }
2771 
2772  delete [] fa;
2773  delete [] fz;
2774  delete [] fwmat;
2775 }
2776 
2777 //______________________________________________________________________
2778 void TGeant3::Mixture(Int_t& kmat, const char* name, Double_t* a, Double_t* z,
2779  Double_t dens, Int_t nlmat, Double_t* wmat)
2780 {
2781  //
2782  // Defines mixture OR COMPOUND IMAT as composed by
2783  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
2784  //
2785  // If NLMAT > 0 then wmat contains the proportion by
2786  // weights of each basic material in the mixture.
2787  //
2788  // If nlmat < 0 then WMAT contains the number of atoms
2789  // of a given kind into the molecule of the COMPOUND
2790  // In this case, WMAT in output is changed to relative
2791  // weights.
2792  //
2793 
2794  Float_t* fa = CreateFloatArray(a, TMath::Abs(nlmat));
2795  Float_t* fz = CreateFloatArray(z, TMath::Abs(nlmat));
2796  Float_t* fwmat = CreateFloatArray(wmat, TMath::Abs(nlmat));
2797 
2798  G3Mixture(kmat, name, fa, fz, dens, nlmat, fwmat);
2799  Int_t i;
2800  for (i=0; i<TMath::Abs(nlmat); i++) {
2801  a[i] = fa[i]; z[i] = fz[i]; wmat[i] = fwmat[i];
2802  }
2803 
2804  delete [] fa;
2805  delete [] fz;
2806  delete [] fwmat;
2807 }
2808 
2809 //______________________________________________________________________
2810 void TGeant3::G3Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
2811  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
2812  Double_t stemax, Double_t deemax, Double_t epsil,
2813  Double_t stmin, Float_t* ubuf, Int_t nbuf)
2814 {
2815  //
2816  // kmed tracking medium number assigned
2817  // name tracking medium name
2818  // nmat material number
2819  // isvol sensitive volume flag
2820  // ifield magnetic field
2821  // fieldm max. field value (kilogauss)
2822  // tmaxfd max. angle due to field (deg/step)
2823  // stemax max. step allowed
2824  // deemax max. fraction of energy lost in a step
2825  // epsil tracking precision (cm)
2826  // stmin min. step due to continuous processes (cm)
2827  //
2828  // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
2829  // ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
2830  // performed with g3helix; ifield = 3 if tracking performed with g3helx3.
2831  //
2832  Int_t jtmed=fGclink->jtmed;
2833  kmed=1;
2834  Int_t ns, i;
2835  if(jtmed>0) {
2836  ns=fZiq[jtmed-2];
2837  kmed=ns+1;
2838  for(i=1; i<=ns; i++) {
2839  if(fZlq[jtmed-i]==0) {
2840  kmed=i;
2841  break;
2842  }
2843  }
2844  }
2845  Float_t ffieldm = fieldm;
2846  Float_t ftmaxfd = tmaxfd;
2847  Float_t fstemax = stemax;
2848  Float_t fdeemax = deemax;
2849  Float_t fepsil = epsil;
2850  Float_t fstmin = stmin;
2851  g3stmed(kmed, PASSCHARD(name),nmat,isvol,ifield,ffieldm,ftmaxfd,fstemax,
2852  fdeemax, fepsil, fstmin, ubuf, nbuf PASSCHARL(name));
2853 
2854  fMedNames.AddAtAndExpand(new TObjString(name), kmed);
2855 }
2856 
2857 //______________________________________________________________________
2858 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
2859  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
2860  Double_t stemax, Double_t deemax, Double_t epsil,
2861  Double_t stmin, Float_t* ubuf, Int_t nbuf)
2862 {
2863  //
2864  // kmed tracking medium number assigned
2865  // name tracking medium name
2866  // nmat material number
2867  // isvol sensitive volume flag
2868  // ifield magnetic field
2869  // fieldm max. field value (kilogauss)
2870  // tmaxfd max. angle due to field (deg/step)
2871  // stemax max. step allowed
2872  // deemax max. fraction of energy lost in a step
2873  // epsil tracking precision (cm)
2874  // stmin min. step due to continuous processes (cm)
2875  //
2876  // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
2877  // ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
2878  // performed with g3helix; ifield = 3 if tracking performed with g3helx3.
2879  //
2880 
2881  G3Medium(kmed,name,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,
2882  stmin, ubuf, nbuf);
2883 
2884 }
2885 
2886 //______________________________________________________________________
2887 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
2888  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
2889  Double_t stemax, Double_t deemax, Double_t epsil,
2890  Double_t stmin, Double_t* ubuf, Int_t nbuf)
2891 {
2892  //
2893  // kmed tracking medium number assigned
2894  // name tracking medium name
2895  // nmat material number
2896  // isvol sensitive volume flag
2897  // ifield magnetic field
2898  // fieldm max. field value (kilogauss)
2899  // tmaxfd max. angle due to field (deg/step)
2900  // stemax max. step allowed
2901  // deemax max. fraction of energy lost in a step
2902  // epsil tracking precision (cm)
2903  // stmin min. step due to continuous processes (cm)
2904  //
2905  // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
2906  // ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
2907  // performed with g3helix; ifield = 3 if tracking performed with g3helx3.
2908  //
2909 
2910  Float_t* fubuf = CreateFloatArray(ubuf, nbuf);
2911  G3Medium(kmed,name,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,
2912  stmin, fubuf, nbuf);
2913  delete [] fubuf;
2914 
2915 }
2916 
2917 //______________________________________________________________________
2918 void TGeant3::Matrix(Int_t& krot, Double_t thex, Double_t phix, Double_t they,
2919  Double_t phiy, Double_t thez, Double_t phiz)
2920 {
2921  //
2922  // krot rotation matrix number assigned
2923  // theta1 polar angle for axis i
2924  // phi1 azimuthal angle for axis i
2925  // theta2 polar angle for axis ii
2926  // phi2 azimuthal angle for axis ii
2927  // theta3 polar angle for axis iii
2928  // phi3 azimuthal angle for axis iii
2929  //
2930  // it defines the rotation matrix number irot.
2931  //
2932  krot = -1;
2933  Int_t jrotm=fGclink->jrotm;
2934  krot=1;
2935  Int_t ns, i;
2936  if(jrotm>0) {
2937  ns=fZiq[jrotm-2];
2938  krot=ns+1;
2939  for(i=1; i<=ns; i++) {
2940  if(fZlq[jrotm-i]==0) {
2941  krot=i;
2942  break;
2943  }
2944  }
2945  }
2946  g3srotm(krot, thex, phix, they, phiy, thez, phiz);
2947 }
2948 
2949 //______________________________________________________________________
2951 {
2952  //
2953  // Return the number of the current medium
2954  //
2955 //#ifdef WITHROOT
2956 // Int_t imed = 0;
2957 // TGeoNode *node = gGeoManager->GetCurrentNode();
2958 // if (!node) imed = gGeoManager->GetTopNode()->GetVolume()->
2959 // GetMedium()->GetId();
2960 // else imed = node->GetVolume()->GetMedium()->GetId();
2961  //printf("==GetMedium: ROOT id=%i numed=%i\n", imed,fGctmed->numed);
2962 //#endif
2963  return fGctmed->numed;
2964 }
2965 
2966 //______________________________________________________________________
2967 Int_t TGeant3::GetMedium() const
2968 {
2969  //
2970  // Return the number of the current medium
2971  // Deprecated function - replaced with CurrentMedium()
2972  //
2973 
2974  Warning("GetMedium",
2975  "Deprecated function - use CurrentMedium() instead");
2976 
2977  return CurrentMedium();
2978 }
2979 
2980 //______________________________________________________________________
2982 {
2983 // Notify Geant3 about use of TGeo geometry.
2984 // The materials and tracking medias will be imported from
2985 // TGeo at FinishGeometry().
2986 
2987  Fatal("SetRootGeometry",
2988  "TGeant3 does not support Root geometry");
2989 
2990  fImportRootGeometry = kTRUE;
2991 }
2992 
2993 //______________________________________________________________________
2994 void TGeant3::SetUserParameters(Bool_t isUserParameters)
2995 {
2996 // Activate the parameters defined in tracking media
2997 // (DEEMAX, STMIN, STEMAX), which are, be default, ignored.
2998 
2999  SetAUTO(!isUserParameters);
3000 }
3001 
3002 //______________________________________________________________________
3003 const char *TGeant3::GetPath()
3004 {
3005 // Get current path inside G3 geometry
3006  Int_t i,j;
3007  if ((i=fGcvolu->nlevel-1)<0) {
3008  Warning("GetPath", "level null");
3009  return fPath;
3010  }
3011  fPath[0] = '/';
3012  char name[10];
3013  char *namcur = fPath+1;
3014  Int_t gname, copy;
3015  Int_t nch=0;
3016  for (j=0; j<i+1; j++) {
3017  gname = fGcvolu->names[j];
3018  copy = fGcvolu->number[j];
3019  memcpy(name, &gname, 4);
3020  name[4]=0;
3021  sprintf(namcur, "%s_%d/", name, copy);
3022  nch = strlen(fPath);
3023  namcur = fPath+nch;
3024  }
3025  fPath[nch-1]=0;
3026  return fPath;
3027 }
3028 
3029 //______________________________________________________________________
3031 {
3032 // Get name of current G3 node
3033  Int_t i=fGcvolu->nlevel-1;
3034  if (i<0) return "";
3035  Int_t gname = fGcvolu->names[i];
3036  Int_t copy = fGcvolu->number[i];
3037  char name[10];
3038  memcpy(name, &gname, 4);
3039  name[4] = 0;
3040  sprintf(fPath, "%s_%d", name, copy);
3041  return fPath;
3042 }
3043 
3044 //______________________________________________________________________
3045 Double_t TGeant3::Edep() const
3046 {
3047  //
3048  // Return the energy lost in the current step
3049  //
3050  return fGctrak->destep;
3051 }
3052 
3053 //______________________________________________________________________
3054 Double_t TGeant3::Etot() const
3055 {
3056  //
3057  // Return the total energy of the current track
3058  //
3059  return fGctrak->getot;
3060 }
3061 
3062 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3063 //
3064 // Functions from GBASE
3065 //
3066 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3067 
3068 //______________________________________________________________________
3069 void TGeant3::Gfile(const char * /*filename*/, const char * /*option*/)
3070 {
3071  //
3072  // Routine to open a GEANT/RZ data base.
3073  //
3074  // LUN logical unit number associated to the file
3075  //
3076  // CHFILE RZ file name
3077  //
3078  // CHOPT is a character string which may be
3079  // N To create a new file
3080  // U to open an existing file for update
3081  // " " to open an existing file for read only
3082  // Q The initial allocation (default 1000 records)
3083  // is given in IQUEST(10)
3084  // X Open the file in exchange format
3085  // I Read all data structures from file to memory
3086  // O Write all data structures from memory to file
3087  //
3088  // Note:
3089  // If options "I" or "O" all data structures are read or
3090  // written from/to file and the file is closed.
3091  // See routine GRMDIR to create subdirectories
3092  // See routines GROUT,GRIN to write,read objects
3093  //
3094  //g3rfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
3095 // PASSCHARL(option));
3096 }
3097 
3098 //______________________________________________________________________
3100 {
3101  //
3102  // Print track and volume parameters at current point
3103  //
3104 
3105  g3pcxyz();
3106 }
3107 //______________________________________________________________________
3109 {
3110  //
3111  // Closes off the geometry setting.
3112  // Initializes the search list for the contents of each
3113  // volume following the order they have been positioned, and
3114  // inserting the content '0' when a call to GSNEXT (-1) has
3115  // been required by the user.
3116  // Performs the development of the JVOLUM structure for all
3117  // volumes with variable parameters, by calling GGDVLP.
3118  // Interprets the user calls to GSORD, through GGORD.
3119  // Computes and stores in a bank (next to JVOLUM mother bank)
3120  // the number of levels in the geometrical tree and the
3121  // maximum number of contents per level, by calling GGNLEV.
3122  // Sets status bit for CONCAVE volumes, through GGCAVE.
3123  // Completes the JSET structure with the list of volume names
3124  // which identify uniquely a given physical detector, the
3125  // list of bit numbers to pack the corresponding volume copy
3126  // numbers, and the generic path(s) in the JVOLUM tree,
3127  // through the routine GHCLOS.
3128  //
3129  g3gclos();
3130  // Create internal list of volumes
3131  fVolNames = new char[fGcnum->nvolum+1][5];
3132  Int_t i;
3133  for(i=0; i<fGcnum->nvolum; ++i) {
3134  strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
3135  fVolNames[i][4]='\0';
3136  }
3137  strcpy(fVolNames[fGcnum->nvolum],"NULL");
3138 }
3139 
3140 //______________________________________________________________________
3142 {
3143  //
3144  // Finish a Geant run
3145  //
3146  g3last();
3147 }
3148 
3149 //______________________________________________________________________
3150 void TGeant3::Gprint(const char *name)
3151 {
3152  //
3153  // Routine to print data structures
3154  // CHNAME name of a data structure
3155  //
3156  char vname[5];
3157  Vname(name,vname);
3158  g3print(PASSCHARD(vname),0 PASSCHARL(vname));
3159 }
3160 
3161 //______________________________________________________________________
3163 {
3164  //
3165  // Steering function to process one run
3166  //
3167  g3run();
3168 }
3169 
3170 //______________________________________________________________________
3172 {
3173  //
3174  // Steering function to process one event
3175  //
3176  g3trig();
3177 
3178  //printf("count_gmedia= %8d\n",count_gmedia);
3179  //printf("count_gtmedi= %8d\n",count_gtmedi);
3180  //printf("count_ginvol= %8d\n",count_ginvol);
3181  //printf("count_gtnext= %8d\n",count_gtnext);
3182 }
3183 
3184 //______________________________________________________________________
3186 {
3187  //
3188  // Clear event partition
3189  //
3190  g3trigc();
3191 }
3192 
3193 //______________________________________________________________________
3195 {
3196  //
3197  // Initializes event partition
3198  //
3199  g3trigi();
3200 }
3201 
3202 //______________________________________________________________________
3203 void TGeant3::Gwork(Int_t nwork)
3204 {
3205  //
3206  // Allocates workspace in ZEBRA memory
3207  //
3208  g3work(nwork);
3209 }
3210 
3211 //______________________________________________________________________
3213 {
3214  //
3215  // To initialize GEANT/ZEBRA data structures
3216  //
3217  g3zinit();
3218 }
3219 
3220 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3221 //
3222 // Functions from GCONS
3223 //
3224 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3225 
3226 //______________________________________________________________________
3227 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
3228  Float_t &dens, Float_t &radl, Float_t &absl,
3229  Float_t* ubuf, Int_t& nbuf)
3230 {
3231  //
3232  // Return parameters for material IMAT
3233  //
3234  g3fmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
3235  PASSCHARL(name));
3236 }
3237 
3238 //______________________________________________________________________
3239 void TGeant3::Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,
3240  Double_t &dens, Double_t &radl, Double_t &absl,
3241  Double_t* ubuf, Int_t& nbuf)
3242 {
3243  //
3244  // Return parameters for material IMAT
3245  //
3246  Float_t fa = a;
3247  Float_t fz = z;
3248  Float_t fdens = dens;
3249  Float_t fradl = radl;
3250  Float_t fabsl = absl;
3251  Float_t* fubuf = CreateFloatArray(ubuf, nbuf);
3252 
3253  Gfmate(imat, name, fa, fz, fdens, fradl, fabsl, fubuf, nbuf);
3254 
3255  a = fa;
3256  z = fz;
3257  dens = fdens;
3258  radl = fradl;
3259  absl = fabsl;
3260  for (Int_t i=0; i<nbuf; i++) ubuf[i] = fubuf[i];
3261 
3262  delete [] fubuf;
3263 }
3264 
3265 //______________________________________________________________________
3266 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
3267  Float_t &amass, Float_t &charge, Float_t &tlife) const
3268 {
3269  //
3270  // Return parameters for particle of type IPART
3271  //
3272  //Float_t *ubuf=0;
3273  Float_t ubuf[100];
3274  Int_t nbuf;
3275  Int_t igpart = IdFromPDG(ipart);
3276  g3fpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
3277  PASSCHARL(name));
3278 }
3279 
3280 //______________________________________________________________________
3281 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
3282  Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
3283  Float_t &stemax, Float_t &deemax, Float_t &epsil,
3284  Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
3285 {
3286  //
3287  // Return parameters for tracking medium NUMED
3288  //
3289  g3ftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
3290  deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
3291 }
3292 
3293 
3294 //______________________________________________________________________
3295  void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
3296  Float_t* tkin, Float_t* value, Float_t* pcut,
3297  Int_t &ixst)
3298 {
3299  //
3300  // Return parameters for material imate
3301  //
3302  g3ftmat(imate, ipart, PASSCHARD(chmeca), kdim,
3303  tkin, value, pcut, ixst PASSCHARL(chmeca));
3304 
3305 }
3306 
3307 //______________________________________________________________________
3308 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
3309 {
3310  //
3311  // To calculate energy loss due to soft muon BREMSSTRAHLUNG
3312  //
3313  return g3brelm(z,t,bcut);
3314 }
3315 
3316 //______________________________________________________________________
3317 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
3318 {
3319  //
3320  // To calculate DE/DX in GeV*barn/atom for direct pair production by muons
3321  //
3322  return g3prelm(z,t,bcut);
3323 }
3324 
3325 //______________________________________________________________________
3327 {
3328  //
3329  // Define standard GEANT materials
3330  //
3331  g3mate();
3332 }
3333 
3334 //______________________________________________________________________
3336 {
3337  //
3338  // Define standard GEANT particles plus selected decay modes
3339  // and branching ratios.
3340  //
3341  g3part();
3342 }
3343 
3344 //______________________________________________________________________
3345 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
3346 {
3347 // Defines branching ratios and decay modes for standard
3348 // GEANT particles.
3349  g3sdk(ipart,bratio,mode);
3350 }
3351 
3352 //______________________________________________________________________
3353 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
3354  Float_t dens, Float_t radl, Float_t absl)
3355 {
3356  //
3357  // Defines a Material
3358  //
3359  // kmat number assigned to the material
3360  // name material name
3361  // a atomic mass in au
3362  // z atomic number
3363  // dens density in g/cm3
3364  // absl absorption length in cm
3365  // if >=0 it is ignored and the program
3366  // calculates it, if <0. -absl is taken
3367  // radl radiation length in cm
3368  // if >=0 it is ignored and the program
3369  // calculates it, if <0. -radl is taken
3370  // buf pointer to an array of user words
3371  // nbuf number of user words
3372  //
3373  Float_t *ubuf=0;
3374  Int_t nbuf=0;
3375  if (dens <= 0 && a != 0 && z != 0) {
3376  Warning("Gsmate","Density was o, set to 0.01 for imat=%d, name=%s",
3377  imat,name);
3378  dens = 0.01;
3379  }
3380  g3smate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
3381  PASSCHARL(name));
3382 }
3383 
3384 //______________________________________________________________________
3385 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
3386  Float_t dens, Int_t nlmat, Float_t *wmat)
3387 {
3388  //
3389  // Defines mixture OR COMPOUND IMAT as composed by
3390  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
3391  //
3392  // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
3393  // WEIGHTS OF EACH BASIC MATERIAL IN THE MIXTURE.
3394  //
3395  // If NLMAT.LT.0 then WMAT contains the number of atoms
3396  // of a given kind into the molecule of the COMPOUND
3397  // In this case, WMAT in output is changed to relative
3398  // weights.
3399  //
3400  g3smixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
3401 }
3402 
3403 //______________________________________________________________________
3404 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
3405  Double_t amass, Double_t charge, Double_t tlife)
3406 {
3407  //
3408  // Store particle parameters
3409  //
3410  // ipart particle code
3411  // name particle name
3412  // itrtyp transport method (see GEANT manual)
3413  // amass mass in GeV/c2
3414  // charge charge in electron units
3415  // tlife lifetime in seconds
3416  //
3417  Float_t *ubuf=0;
3418  Int_t nbuf=0;
3419  Float_t fmass = amass;
3420  Float_t fcharge = charge;
3421  Float_t flife = tlife;
3422 
3423  g3spart(ipart,PASSCHARD(name), itrtyp, fmass, fcharge, flife, ubuf, nbuf
3424  PASSCHARL(name));
3425 }
3426 
3427 //______________________________________________________________________
3428 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
3429  Int_t ifield, Float_t fieldm, Float_t tmaxfd,
3430  Float_t stemax, Float_t deemax, Float_t epsil,
3431  Float_t stmin)
3432 {
3433  //
3434  // NTMED Tracking medium number
3435  // NAME Tracking medium name
3436  // NMAT Material number
3437  // ISVOL Sensitive volume flag
3438  // IFIELD Magnetic field
3439  // FIELDM Max. field value (Kilogauss)
3440  // TMAXFD Max. angle due to field (deg/step)
3441  // STEMAX Max. step allowed
3442  // DEEMAX Max. fraction of energy lost in a step
3443  // EPSIL Tracking precision (cm)
3444  // STMIN Min. step due to continuous processes (cm)
3445  //
3446  // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
3447  // IFIELD = 1 if tracking performed with G3RKUTA; IFIELD = 2 if tracking
3448  // performed with G3HELIX; IFIELD = 3 if tracking performed with G3HELX3.
3449  //
3450  Float_t *ubuf=0;
3451  Int_t nbuf=0;
3452  g3stmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
3453  deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
3454 }
3455 
3456 //______________________________________________________________________
3457 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
3458  Float_t *absco, Float_t *effic, Float_t *rindex)
3459 {
3460  //
3461  // Stores the tables for UV photon tracking in medium ITMED
3462  // Please note that it is the user's responsibility to
3463  // provide all the coefficients:
3464  //
3465  //
3466  // ITMED Tracking medium number
3467  // NPCKOV Number of bins of each table
3468  // PPCKOV Value of photon momentum (in GeV)
3469  // ABSCO Absorption coefficients
3470  // dielectric: absorption length in cm
3471  // metals : absorption fraction (0<=x<=1)
3472  // EFFIC Detection efficiency for UV photons
3473  // RINDEX Refraction index (if=0 metal)
3474  //
3475  g3sckov(itmed,npckov,ppckov,absco,effic,rindex);
3476 }
3477 
3478 //______________________________________________________________________
3479 void TGeant3::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
3480  Float_t *absco, Float_t *effic, Float_t *rindex)
3481 {
3482  //
3483  // Stores the tables for UV photon tracking in medium ITMED
3484  // Please note that it is the user's responsibility to
3485  // provide all the coefficients:
3486  //
3487  //
3488  // ITMED Tracking medium number
3489  // NPCKOV Number of bins of each table
3490  // PPCKOV Value of photon momentum (in GeV)
3491  // ABSCO Absorption coefficients
3492  // dielectric: absorption length in cm
3493  // metals : absorption fraction (0<=x<=1)
3494  // EFFIC Detection efficiency for UV photons
3495  // RINDEX Refraction index (if=0 metal)
3496  //
3497  g3sckov(itmed,npckov,ppckov,absco,effic,rindex);
3498 }
3499 
3500 //______________________________________________________________________
3501 void TGeant3::SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
3502  Double_t *absco, Double_t *effic, Double_t *rindex)
3503 {
3504  //
3505  // Stores the tables for UV photon tracking in medium ITMED
3506  // Please note that it is the user's responsibility to
3507  // provide all the coefficients:
3508  //
3509  //
3510  // ITMED Tracking medium number
3511  // NPCKOV Number of bins of each table
3512  // PPCKOV Value of photon momentum (in GeV)
3513  // ABSCO Absorption coefficients
3514  // dielectric: absorption length in cm
3515  // metals : absorption fraction (0<=x<=1)
3516  // EFFIC Detection efficiency for UV photons
3517  // RINDEX Refraction index (if=0 metal)
3518  //
3519 
3520  Float_t* fppckov = CreateFloatArray(ppckov, npckov);
3521  Float_t* fabsco = CreateFloatArray(absco, npckov);
3522  Float_t* feffic = CreateFloatArray(effic, npckov);
3523  Float_t* frindex = CreateFloatArray(rindex, npckov);
3524 
3525  SetCerenkov(itmed, npckov, fppckov, fabsco, feffic, frindex);
3526 
3527  delete [] fppckov;
3528  delete [] fabsco;
3529  delete [] feffic;
3530  delete [] frindex;
3531 }
3532 
3533 //______________________________________________________________________
3535  EMCOpSurfaceModel /*model*/, EMCOpSurfaceType /*surfaceType*/,
3536  EMCOpSurfaceFinish /*surfaceFinish*/, Double_t /*sigmaAlpha*/)
3537 {
3538 
3539  Warning("DefineOpSurface",
3540  Form("Called for surface %s. Not applicable in Geant3 - setting is ignored.", name));
3541 }
3542 
3543 //______________________________________________________________________
3545  const char* /*vol1Name*/, int /*vol1CopyNo*/,
3546  const char* /*vol2Name*/, int /*vol2CopyNo*/,
3547  const char* /*opSurfaceName*/)
3548 {
3549  Warning("SetBorderSurface",
3550  Form("Called for border surface %s. Not applicable in Geant3 - setting is ignored.", name));
3551 }
3552 
3553 //______________________________________________________________________
3555  const char* /*volName*/,
3556  const char* /*opSurfaceName*/)
3557 {
3558  Warning("SetSkinSurface",
3559  Form("Called for skin surface %s. Not applicable in Geant3 - setting is ignored.", name));
3560 }
3561 
3562 //______________________________________________________________________
3564  Int_t itmed, const char* /*propertyName*/,
3565  Int_t /*np*/, Double_t* /*pp*/, Double_t* /*values*/)
3566 {
3567  Warning("SetMaterialProperty",
3568  Form("Called for material ID %5d. Not applicable in Geant3 - setting is ignored.", itmed));
3569 }
3570 
3571 //______________________________________________________________________
3573  Int_t itmed, const char* /*propertyName*/,
3574  Double_t /*value*/)
3575 {
3576  Warning("SetMaterialProperty",
3577  Form("Called for material ID %5d. Not applicable in Geant3 - setting is ignored.", itmed));
3578 }
3579 
3580 //______________________________________________________________________
3582  const char* surfaceName, const char* /*propertyName*/,
3583  Int_t /*np*/, Double_t* /*pp*/, Double_t* /*values*/)
3584  {
3585  Warning("SetMaterialProperty",
3586  Form("Called for material surface %s. Not applicable in Geant3 - setting is ignored.", surfaceName));
3587 }
3588 
3589 //______________________________________________________________________
3590 void TGeant3::Gstpar(Int_t itmed, const char *param, Double_t parval)
3591 {
3592  //
3593  // To change the value of cut or mechanism "CHPAR"
3594  // to a new value PARVAL for tracking medium ITMED
3595  // The data structure JTMED contains the standard tracking
3596  // parameters (CUTS and flags to control the physics processes) which
3597  // are used by default for all tracking media. It is possible to
3598  // redefine individually with GSTPAR any of these parameters for a
3599  // given tracking medium.
3600  // ITMED tracking medium number
3601  // CHPAR is a character string (variable name)
3602  // PARVAL must be given as a floating point.
3603  //
3604 
3605  Float_t fparval = parval;
3606  g3stpar(itmed,PASSCHARD(param), fparval PASSCHARL(param));
3607 }
3608 
3609 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3610 //
3611 // Functions from GCONS
3612 //
3613 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3614 
3615 //______________________________________________________________________
3616 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert,
3617  Int_t &ipart, Int_t &nvert)
3618 {
3619  // Storing/Retrieving Vertex and Track parameters
3620  // ----------------------------------------------
3621  //
3622  // Stores vertex parameters.
3623  // VERT array of (x,y,z) position of the vertex
3624  // NTBEAM beam track number origin of the vertex
3625  // =0 if none exists
3626  // NTTARG target track number origin of the vertex
3627  // UBUF user array of NUBUF floating point numbers
3628  // NUBUF
3629  // NVTX new vertex number (=0 in case of error).
3630  // Prints vertex parameters.
3631  // IVTX for vertex IVTX.
3632  // (For all vertices if IVTX=0)
3633  // Stores long life track parameters.
3634  // PLAB components of momentum
3635  // IPART type of particle (see GSPART)
3636  // NV vertex number origin of track
3637  // UBUF array of NUBUF floating point user parameters
3638  // NUBUF
3639  // NT track number (if=0 error).
3640  // Retrieves long life track parameters.
3641  // ITRA track number for which parameters are requested
3642  // VERT vector origin of the track
3643  // PVERT 4 momentum components at the track origin
3644  // IPART particle type (=0 if track ITRA does not exist)
3645  // NVERT vertex number origin of the track
3646  // UBUF user words stored in GSKINE.
3647  // Prints initial track parameters.
3648  // ITRA for track ITRA
3649  // (For all tracks if ITRA=0)
3650  //
3651  Float_t *ubuf=0;
3652  Int_t nbuf;
3653  g3fkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
3654 }
3655 
3656 //______________________________________________________________________
3657 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
3658  Float_t &tofg)
3659 {
3660  //
3661  // Retrieves the parameter of a vertex bank
3662  // Vertex is generated from tracks NTBEAM NTTARG
3663  // NVTX is the new vertex number
3664  //
3665  Float_t *ubuf=0;
3666  Int_t nbuf;
3667  g3fvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
3668 }
3669 
3670 //______________________________________________________________________
3671 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
3672  Int_t nwbuf)
3673 {
3674  //
3675  // Store kinematics of track NT into data structure
3676  // Track is coming from vertex NV
3677  //
3678  Int_t nt = 0;
3679  g3skine(plab, ipart, nv, buf, nwbuf, nt);
3680  return nt;
3681 }
3682 
3683 //______________________________________________________________________
3684 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
3685  Int_t nwbuf)
3686 {
3687  //
3688  // Creates a new vertex bank
3689  // Vertex is generated from tracks NTBEAM NTTARG
3690  // NVTX is the new vertex number
3691  //
3692  Int_t nwtx = 0;
3693  g3svert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
3694  return nwtx;
3695 }
3696 
3697 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3698 //
3699 // Functions from GPHYS
3700 //
3701 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3702 
3703 //______________________________________________________________________
3705 {
3706  //
3707  // Initialize material constants for all the physics
3708  // mechanisms used by GEANT
3709  //
3710  g3physi();
3711 }
3712 
3713 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3714 //
3715 // Functions from GTRAK
3716 //
3717 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3718 
3719 //______________________________________________________________________
3721 {
3722  //
3723  // Debug the current step
3724  //
3725  g3debug();
3726 }
3727 
3728 //______________________________________________________________________
3730 {
3731  //
3732  // To find bin number in kinetic energy table
3733  // stored in ELOW(NEKBIN)
3734  //
3735  g3ekbin();
3736 }
3737 
3738 //______________________________________________________________________
3740 {
3741  //
3742  // Returns the set/volume parameters corresponding to
3743  // the current space point in /GCTRAK/
3744  // and fill common /GCSETS/
3745  //
3746  // IHSET user set identifier
3747  // IHDET user detector identifier
3748  // ISET set number in JSET
3749  // IDET detector number in JS=LQ(JSET-ISET)
3750  // IDTYPE detector type (1,2)
3751  // NUMBV detector volume numbers (array of length NVNAME)
3752  // NVNAME number of volume levels
3753  //
3754  g3finds();
3755 }
3756 
3757 //______________________________________________________________________
3758 void TGeant3::Gsking(Int_t igk)
3759 {
3760  //
3761  // Stores in stack JSTAK either the IGKth track of /GCKING/,
3762  // or the NGKINE tracks when IGK is 0.
3763  //
3764  g3sking(igk);
3765 }
3766 
3767 //______________________________________________________________________
3768 void TGeant3::Gskpho(Int_t igk)
3769 {
3770  //
3771  // Stores in stack JSTAK either the IGKth Cherenkov photon of
3772  // /GCKIN2/, or the NPHOT tracks when IGK is 0.
3773  //
3774  g3skpho(igk);
3775 }
3776 
3777 //______________________________________________________________________
3778 void TGeant3::Gsstak(Int_t iflag)
3779 {
3780  //
3781  // Stores in auxiliary stack JSTAK the particle currently
3782  // described in common /GCKINE/.
3783  //
3784  // On request, creates also an entry in structure JKINE :
3785  // IFLAG =
3786  // 0 : No entry in JKINE structure required (user)
3787  // 1 : New entry in JVERTX / JKINE structures required (user)
3788  // <0 : New entry in JKINE structure at vertex -IFLAG (user)
3789  // 2 : Entry in JKINE structure exists already (from GTREVE)
3790  //
3791  g3sstak(iflag);
3792 }
3793 
3794 //______________________________________________________________________
3796 {
3797  //
3798  // Store space point VECT in banks JXYZ
3799  //
3800  g3sxyz();
3801 }
3802 
3803 //______________________________________________________________________
3805 {
3806  //
3807  // Controls tracking of current particle
3808  //
3809  g3track();
3810 }
3811 
3812 //______________________________________________________________________
3814 {
3815  //
3816  // Controls tracking of all particles belonging to the current event
3817  //
3818  g3treve();
3819 }
3820 
3821 //______________________________________________________________________
3823 {
3824  //
3825  // Controls tracking of all particles belonging to the current event
3826  //
3827  gtreveroot();
3828 }
3829 
3830 //______________________________________________________________________
3831 void TGeant3::Grndm(Float_t *rvec, Int_t len) const
3832 {
3833  //
3834  // To set/retrieve the seed of the random number generator
3835  //
3836  TRandom* r=gMC->GetRandom();
3837  for(Int_t i=0; i<len; rvec[i++]=r->Rndm()) {};
3838 }
3839 
3840 //______________________________________________________________________
3841 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, Int_t /*iseq*/,
3842  const Text_t */*chopt*/)
3843 {
3844  //
3845  // To set/retrieve the seed of the random number generator
3846  //
3847  /*printf("Dummy grndmq called\n");*/
3848  is1 = gRandom->GetSeed();
3849  is2 = 0;
3850 }
3851 
3852 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3853 //
3854 // Functions from GDRAW
3855 //
3856 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3857 
3858 //______________________________________________________________________
3859 void TGeant3::Gdxyz(Int_t /* it */)
3860 {
3861  //
3862  // Draw the points stored with Gsxyz relative to track it
3863  //
3864 }
3865 
3866 //______________________________________________________________________
3868 {
3869  //
3870  // Draw the position of the current track
3871  //
3872 }
3873 
3874 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3875 //
3876 // Functions from GGEOM
3877 //
3878 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
3879 
3880 //______________________________________________________________________
3881 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
3882 {
3883  //
3884  // Computes coordinates XM (Master Reference System
3885  // knowing the coordinates XD (Detector Ref System)
3886  // The local reference system can be initialized by
3887  // - the tracking routines and GDTOM used in GUSTEP
3888  // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
3889  // (inverse routine is GMTOD)
3890  //
3891  // If IFLAG=1 convert coordinates
3892  // IFLAG=2 convert direction cosines
3893  //
3894  g3dtom(xd, xm, iflag);
3895 }
3896 
3897 //______________________________________________________________________
3898 void TGeant3::Gdtom(Double_t *xd, Double_t *xm, Int_t iflag)
3899 {
3900  //
3901  // Computes coordinates XM (Master Reference System
3902  // knowing the coordinates XD (Detector Ref System)
3903  // The local reference system can be initialized by
3904  // - the tracking routines and GDTOM used in GUSTEP
3905  // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
3906  // (inverse routine is GMTOD)
3907  //
3908  // If IFLAG=1 convert coordinates
3909  // IFLAG=2 convert direction cosines
3910  //
3911 
3912  Float_t* fxd = CreateFloatArray(xd, 3);
3913  Float_t* fxm = CreateFloatArray(xm, 3);
3914 
3915  Gdtom(fxd, fxm, iflag) ;
3916 
3917  for (Int_t i=0; i<3; i++) {
3918  xd[i] = fxd[i]; xm[i] = fxm[i];
3919  }
3920 
3921  delete [] fxd;
3922  delete [] fxm;
3923 }
3924 
3925 //______________________________________________________________________
3926 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev,
3927  Int_t *lvols, Int_t *lindx)
3928 {
3929  //
3930  // Loads the top part of the Volume tree in LVOLS (IVO's),
3931  // LINDX (IN indices) for a given volume defined through
3932  // its name IUDET and number IUNUM.
3933  //
3934  // The routine stores only up to the last level where JVOLUM
3935  // data structure is developed. If there is no development
3936  // above the current level, it returns NLEV zero.
3937  Int_t *idum=0;
3938  g3lmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
3939 }
3940 
3941 //______________________________________________________________________
3942 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
3943 {
3944  //
3945  // Finds in which volume/medium the point X is, and updates the
3946  // common /GCVOLU/ and the structure JGPAR accordingly.
3947  //
3948  // NUMED returns the tracking medium number, or 0 if point is
3949  // outside the experimental setup.
3950  //
3951 
3952  static Int_t check = 0;
3953  g3media(x,numed,check);
3954 }
3955 
3956 //______________________________________________________________________
3957 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
3958 {
3959  //
3960  // Computes coordinates XD (in DRS)
3961  // from known coordinates XM in MRS
3962  // The local reference system can be initialized by
3963  // - the tracking routines and GMTOD used in GUSTEP
3964  // - a call to GMEDIA(XM,NUMED,CHECK)
3965  // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
3966  // (inverse routine is GDTOM)
3967  //
3968  // If IFLAG=1 convert coordinates
3969  // IFLAG=2 convert direction cosines
3970  //
3971  g3mtod(xm, xd, iflag);
3972 }
3973 
3974 //______________________________________________________________________
3975 void TGeant3::Gmtod(Double_t *xm, Double_t *xd, Int_t iflag)
3976 {
3977  //
3978  // Computes coordinates XD (in DRS)
3979  // from known coordinates XM in MRS
3980  // The local reference system can be initialized by
3981  // - the tracking routines and GMTOD used in GUSTEP
3982  // - a call to GMEDIA(XM,NUMED,CHECK)
3983  // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
3984  // (inverse routine is GDTOM)
3985  //
3986  // If IFLAG=1 convert coordinates
3987  // IFLAG=2 convert direction cosines
3988  //
3989 
3990 
3991  Float_t* fxm = CreateFloatArray(xm, 3);
3992  Float_t* fxd = CreateFloatArray(xd, 3);
3993 
3994  Gmtod(fxm, fxd, iflag) ;
3995 
3996  for (Int_t i=0; i<3; i++) {
3997  xm[i] = fxm[i]; xd[i] = fxd[i];
3998  }
3999 
4000  delete [] fxm;
4001  delete [] fxd;
4002 }
4003 
4004 //______________________________________________________________________
4005 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
4006  Int_t iaxis)
4007 {
4008  //
4009  // Create a new volume by dividing an existing one
4010  //
4011  // NAME Volume name
4012  // MOTHER Mother volume name
4013  // NDIV Number of divisions
4014  // IAXIS Axis value
4015  //
4016  // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
4017  // It divides a previously defined volume.
4018  //
4019  char vname[5];
4020  Vname(name,vname);
4021  char vmother[5];
4022  Vname(mother,vmother);
4023 
4024  g3sdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
4025  PASSCHARL(vmother));
4026 }
4027 
4028 //______________________________________________________________________
4029 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
4030  Int_t iaxis, Double_t c0i, Int_t numed)
4031 {
4032  //
4033  // Create a new volume by dividing an existing one
4034  //
4035  // Divides mother into ndiv divisions called name
4036  // along axis iaxis starting at coordinate value c0.
4037  // the new volume created will be medium number numed.
4038  //
4039  char vname[5];
4040  Vname(name,vname);
4041  char vmother[5];
4042  Vname(mother,vmother);
4043 
4044  Float_t fc0i = c0i;
4045  g3sdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, fc0i, numed
4046  PASSCHARL(vname) PASSCHARL(vmother));
4047 }
4048 
4049 //______________________________________________________________________
4050 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
4051  Int_t iaxis, Int_t numed)
4052 {
4053  //
4054  // Create a new volume by dividing an existing one
4055  //
4056  char vname[5];
4057  Vname(name,vname);
4058  char vmother[5];
4059  Vname(mother,vmother);
4060 
4061  g3sdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
4062  PASSCHARL(vname) PASSCHARL(vmother));
4063 }
4064 
4065 //______________________________________________________________________
4066 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
4067  Int_t iaxis, Float_t c0, Int_t numed)
4068 {
4069  //
4070  // Create a new volume by dividing an existing one
4071  //
4072  char vname[5];
4073  Vname(name,vname);
4074  char vmother[5];
4075  Vname(mother,vmother);
4076 
4077  g3sdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
4078  PASSCHARL(vname) PASSCHARL(vmother));
4079 }
4080 
4081 //______________________________________________________________________
4082 void TGeant3::Gsdvt(const char *name, const char *mother, Double_t step,
4083  Int_t iaxis, Int_t numed, Int_t ndvmx)
4084 {
4085  //
4086  // Create a new volume by dividing an existing one
4087  //
4088  // Divides MOTHER into divisions called NAME along
4089  // axis IAXIS in steps of STEP. If not exactly divisible
4090  // will make as many as possible and will center them
4091  // with respect to the mother. Divisions will have medium
4092  // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
4093  // NDVMX is the expected maximum number of divisions
4094  // (If 0, no protection tests are performed)
4095  //
4096  char vname[5];
4097  Vname(name,vname);
4098  char vmother[5];
4099  Vname(mother,vmother);
4100 
4101  Float_t fstep = step;
4102  g3sdvt(PASSCHARD(vname), PASSCHARD(vmother), fstep, iaxis, numed, ndvmx
4103  PASSCHARL(vname) PASSCHARL(vmother));
4104 }
4105 
4106 //______________________________________________________________________
4107 void TGeant3::Gsdvt2(const char *name, const char *mother, Double_t step,
4108  Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
4109 {
4110  //
4111  // Create a new volume by dividing an existing one
4112  //
4113  // Divides MOTHER into divisions called NAME along
4114  // axis IAXIS starting at coordinate value C0 with step
4115  // size STEP.
4116  // The new volume created will have medium number NUMED.
4117  // If NUMED is 0, NUMED of mother is taken.
4118  // NDVMX is the expected maximum number of divisions
4119  // (If 0, no protection tests are performed)
4120  //
4121  char vname[5];
4122  Vname(name,vname);
4123  char vmother[5];
4124  Vname(mother,vmother);
4125 
4126  Float_t fstep = step;
4127  Float_t fc0 = c0;
4128  g3sdvt2(PASSCHARD(vname), PASSCHARD(vmother), fstep, iaxis, fc0,
4129  numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
4130 }
4131 
4132 //______________________________________________________________________
4133 void TGeant3::Gsord(const char *name, Int_t iax)
4134 {
4135  //
4136  // Flags volume CHNAME whose contents will have to be ordered
4137  // along axis IAX, by setting the search flag to -IAX
4138  // IAX = 1 X axis
4139  // IAX = 2 Y axis
4140  // IAX = 3 Z axis
4141  // IAX = 4 Rxy (static ordering only -> GTMEDI)
4142  // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
4143  // IAX = 5 Rxyz (static ordering only -> GTMEDI)
4144  // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
4145  // IAX = 6 PHI (PHI=0 => X axis)
4146  // IAX = 7 THETA (THETA=0 => Z axis)
4147  //
4148 
4149  char vname[5];
4150  Vname(name,vname);
4151  g3sord(PASSCHARD(vname), iax PASSCHARL(vname));
4152 }
4153 
4154 //______________________________________________________________________
4155 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother,
4156  Double_t x, Double_t y, Double_t z, Int_t irot,
4157  const char *konly)
4158 {
4159  //
4160  // Position a volume into an existing one
4161  //
4162  // NAME Volume name
4163  // NUMBER Copy number of the volume
4164  // MOTHER Mother volume name
4165  // X X coord. of the volume in mother ref. sys.
4166  // Y Y coord. of the volume in mother ref. sys.
4167  // Z Z coord. of the volume in mother ref. sys.
4168  // IROT Rotation matrix number w.r.t. mother ref. sys.
4169  // ONLY ONLY/MANY flag
4170  //
4171  // It positions a previously defined volume in the mother.
4172  //
4173 
4174  TString only = konly;
4175  only.ToLower();
4176  Bool_t isOnly = kFALSE;
4177  if (only.Contains("only")) isOnly = kTRUE;
4178  char vname[5];
4179  Vname(name,vname);
4180  char vmother[5];
4181  Vname(mother,vmother);
4182 
4183  Float_t fx = x;
4184  Float_t fy = y;
4185  Float_t fz = z;
4186  g3spos(PASSCHARD(vname), nr, PASSCHARD(vmother), fx, fy, fz, irot,
4187  PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
4188  PASSCHARL(konly));
4189 }
4190 
4191 //______________________________________________________________________
4192 void TGeant3::G3Gsposp(const char *name, Int_t nr, const char *mother,
4193  Double_t x, Double_t y, Double_t z, Int_t irot,
4194  const char *konly, Float_t *upar, Int_t np )
4195 {
4196  //
4197  // Place a copy of generic volume NAME with user number
4198  // NR inside MOTHER, with its parameters UPAR(1..NP)
4199  //
4200  TString only = konly;
4201  only.ToLower();
4202  Bool_t isOnly = kFALSE;
4203  if (only.Contains("only")) isOnly = kTRUE;
4204  char vname[5];
4205  Vname(name,vname);
4206  char vmother[5];
4207  Vname(mother,vmother);
4208 
4209  Float_t fx = x;
4210  Float_t fy = y;
4211  Float_t fz = z;
4212  g3sposp(PASSCHARD(vname), nr, PASSCHARD(vmother), fx, fy, fz, irot,
4213  PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
4214  PASSCHARL(konly));
4215 }
4216 
4217 //______________________________________________________________________
4218 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
4219  Double_t x, Double_t y, Double_t z, Int_t irot,
4220  const char *konly, Float_t *upar, Int_t np )
4221 {
4222  //
4223  // Place a copy of generic volume NAME with user number
4224  // NR inside MOTHER, with its parameters UPAR(1..NP)
4225  //
4226 
4227  G3Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
4228 }
4229 
4230 //______________________________________________________________________
4231 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
4232  Double_t x, Double_t y, Double_t z, Int_t irot,
4233  const char *konly, Double_t *upar, Int_t np )
4234 {
4235  //
4236  // Place a copy of generic volume NAME with user number
4237  // NR inside MOTHER, with its parameters UPAR(1..NP)
4238  //
4239 
4240  Float_t* fupar = CreateFloatArray(upar, np);
4241  G3Gsposp(name, nr, mother, x, y, z, irot, konly, fupar, np);
4242  delete [] fupar;
4243 }
4244 
4245 //______________________________________________________________________
4246 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
4247  Float_t phi2, Float_t theta3, Float_t phi3)
4248 {
4249  //
4250  // nmat Rotation matrix number
4251  // THETA1 Polar angle for axis I
4252  // PHI1 Azimuthal angle for axis I
4253  // THETA2 Polar angle for axis II
4254  // PHI2 Azimuthal angle for axis II
4255  // THETA3 Polar angle for axis III
4256  // PHI3 Azimuthal angle for axis III
4257  //
4258  // It defines the rotation matrix number IROT.
4259  //
4260 
4261  g3srotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
4262 }
4263 
4264 //______________________________________________________________________
4265 void TGeant3::Gprotm(Int_t nmat)
4266 {
4267  //
4268  // To print rotation matrices structure JROTM
4269  // nmat Rotation matrix number
4270  //
4271  g3protm(nmat);
4272  }
4273 
4274 //______________________________________________________________________
4275 Int_t TGeant3::G3Gsvolu(const char *name, const char *shape, Int_t nmed,
4276  Float_t *upar, Int_t npar)
4277 {
4278  //
4279  // NAME Volume name
4280  // SHAPE Volume type
4281  // NUMED Tracking medium number
4282  // NPAR Number of shape parameters
4283  // UPAR Vector containing shape parameters
4284  //
4285  // It creates a new volume in the JVOLUM data structure.
4286  //
4287  Int_t ivolu = 0;
4288  char vname[5];
4289  Vname(name,vname);
4290  char vshape[5];
4291  Vname(shape,vshape);
4292 
4293  g3svolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
4294  PASSCHARL(vname) PASSCHARL(vshape));
4295 
4296  return ivolu;
4297 }
4298 //______________________________________________________________________
4299 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
4300  Float_t *upar, Int_t npar)
4301 {
4302  //
4303  // NAME Volume name
4304  // SHAPE Volume type
4305  // NUMED Tracking medium number
4306  // NPAR Number of shape parameters
4307  // UPAR Vector containing shape parameters
4308  //
4309  // It creates a new volume in the JVOLUM data structure.
4310  //
4311 
4312  Int_t ivolu = 0;
4313  ivolu = G3Gsvolu(name, shape, nmed, upar, npar);
4314  return ivolu;
4315 
4316 }
4317 
4318 //______________________________________________________________________
4319 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
4320  Double_t *upar, Int_t npar)
4321 {
4322  //
4323  // NAME Volume name
4324  // SHAPE Volume type
4325  // NUMED Tracking medium number
4326  // NPAR Number of shape parameters
4327  // UPAR Vector containing shape parameters
4328  //
4329  // It creates a new volume in the JVOLUM data structure.
4330  //
4331 
4332 
4333  Int_t ivolu = 0;
4334  Float_t* fupar = CreateFloatArray(upar, npar);
4335  ivolu = G3Gsvolu(name, shape, nmed, fupar, npar);
4336  delete [] fupar;
4337  return ivolu;
4338 }
4339 
4340 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
4341 //
4342 // T H E D R A W I N G P A C K A G E
4343 // ======================================
4344 // Drawing functions. These functions allow the visualization in several
4345 // ways of the volumes defined in the geometrical data structure. It is
4346 // possible to draw the logical tree of volumes belonging to the detector
4347 // (DTREE), to show their geometrical specification (DSPEC,DFSPC), to
4348 // draw them and their cut views (DRAW, DCUT). Moreover, it is possible
4349 // to execute these commands when the hidden line removal option is
4350 // activated; in this case, the volumes can be also either translated
4351 // in the space (SHIFT), or clipped by boolean operation (CVOL). In
4352 // addition, it is possible to fill the surfaces of the volumes
4353 // with solid colors when the shading option (SHAD) is activated.
4354 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
4355 // of the detectors or to scan physical events as well.
4356 // Finally, the command MOVE will allow the rotation, translation and
4357 // zooming on real time parts of the detectors or tracks and hits of a
4358 // simulated event. Ray-tracing commands. In case the command (DOPT RAYT
4359 // ON) is executed, the drawing is performed by the Geant ray-tracing;
4360 // automatically, the color is assigned according to the tracking medium
4361 // of each volume and the volumes with a density lower/equal than the
4362 // air are considered transparent; if the option (USER) is set (ON)
4363 // (again via the command (DOPT)), the user can set color and visibility
4364 // for the desired volumes via the command (SATT), as usual, relatively
4365 // to the attributes (COLO) and (SEEN). The resolution can be set via
4366 // the command (SATT * FILL VALUE), where (VALUE) is the ratio between
4367 // the number of pixels drawn and 20 (user coordinates). Parallel view
4368 // and perspective view are possible (DOPT PROJ PARA/PERS); in the first
4369 // case, we assume that the first mother volume of the tree is a box with
4370 // dimensions 10000 X 10000 X 10000 cm and the view point (infinitely far)
4371 // is 5000 cm far from the origin along the Z axis of the user coordinates;
4372 // in the second case, the distance between the observer and the origin
4373 // of the world reference system is set in cm by the command (PERSP NAME
4374 // VALUE); grand-angle or telescopic effects can be achieved changing the
4375 // scale factors in the command (DRAW). When the final picture does not
4376 // occupy the full window, mapping the space before tracing can speed up
4377 // the drawing, but can also produce less precise results; values from 1
4378 // to 4 are allowed in the command (DOPT MAPP VALUE), the mapping being
4379 // more precise for increasing (VALUE); for (VALUE = 0) no mapping is
4380 // performed (therefore max precision and lowest speed). The command
4381 // (VALCUT) allows the cutting of the detector by three planes orthogonal
4382 // to the x,y,z axis. The attribute (LSTY) can be set by the command
4383 // SATT for any desired volume and can assume values from 0 to 7; it
4384 // determines the different light processing to be performed for different
4385 // materials:
4386 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
4387 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to
4388 // be in the dark, the ambient light luminosity is 0.2 for each basic
4389 // hue (the saturation is 0.9) and the observer is assumed to have a
4390 // light source (therefore he will produce parallel light in the case
4391 // of parallel view and point-like-source light in the case of perspective
4392 // view).
4393 //
4394 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
4395 
4396 //______________________________________________________________________
4397 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
4398 {
4399  //
4400  // NAME Volume name
4401  // IOPT Name of the attribute to be set
4402  // IVAL Value to which the attribute is to be set
4403  //
4404  // name= "*" stands for all the volumes.
4405  // iopt can be chosen among the following :
4406  //
4407  // WORK 0=volume name is inactive for the tracking
4408  // 1=volume name is active for the tracking (default)
4409  //
4410  // SEEN 0=volume name is invisible
4411  // 1=volume name is visible (default)
4412  // -1=volume invisible with all its descendants in the tree
4413  // -2=volume visible but not its descendants in the tree
4414  //
4415  // LSTY line style 1,2,3,... (default=1)
4416  // LSTY=7 will produce a very precise approximation for
4417  // revolution bodies.
4418  //
4419  // LWID line width -7,...,1,2,3,..7 (default=1)
4420  // LWID<0 will act as abs(LWID) was set for the volume
4421  // and for all the levels below it. When SHAD is 'ON', LWID
4422  // represent the line width of the scan lines filling the surfaces
4423  // (whereas the FILL value represent their number). Therefore
4424  // tuning this parameter will help to obtain the desired
4425  // quality/performance ratio.
4426  //
4427  // COLO color code -166,...,1,2,..166 (default=1)
4428  // n=1=black
4429  // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
4430  // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
4431  // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
4432  // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
4433  // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
4434  // n=7=light-blue; n=92+m, m=0,25, increasing luminosity according to 'm';
4435  // color=n*10+m, m=1,2,...9, will produce the same color
4436  // as 'n', but with increasing luminosity according to 'm';
4437  // COLO<0 will act as if abs(COLO) was set for the volume
4438  // and for all the levels below it.
4439  // When for a volume the attribute FILL is > 1 (and the
4440  // option SHAD is on), the ABS of its color code must be < 8
4441  // because an automatic shading of its faces will be
4442  // performed.
4443  //
4444  // FILL (1992) fill area -7,...,0,1,...7 (default=0)
4445  // when option SHAD is "on" the FILL attribute of any
4446  // volume can be set different from 0 (normal drawing);
4447  // if it is set to 1, the faces of such volume will be filled
4448  // with solid colors; if ABS(FILL) is > 1, then a light
4449  // source is placed along the observer line, and the faces of
4450  // such volumes will be painted by colors whose luminosity
4451  // will depend on the amount of light reflected;
4452  // if ABS(FILL) = 1, then it is possible to use all the 166
4453  // colors of the color table, because the automatic shading
4454  // is not performed;
4455  // for increasing values of FILL the drawing will be performed
4456  // with higher and higher resolution improving the quality (the
4457  // number of scan lines used to fill the faces increases with
4458  // FILL); it is possible to set different values of FILL
4459  // for different volumes, in order to optimize at the same time
4460  // the performance and the quality of the picture;
4461  // FILL<0 will act as if abs(FILL) was set for the volume
4462  // and for all the levels below it.
4463  // This kind of drawing can be saved in 'picture files'
4464  // or in view banks.
4465  // 0=drawing without fill area
4466  // 1=faces filled with solid colors and resolution = 6
4467  // 2=lowest resolution (very fast)
4468  // 3=default resolution
4469  // 4=.................
4470  // 5=.................
4471  // 6=.................
4472  // 7=max resolution
4473  // Finally, if a colored background is desired, the FILL
4474  // attribute for the first volume of the tree must be set
4475  // equal to -abs(colo), colo being >0 and <166.
4476  //
4477  // SET set number associated to volume name
4478  // DET detector number associated to volume name
4479  // DTYP detector type (1,2)
4480  //
4481 
4482  char vname[5];
4483  Vname(name,vname);
4484  char vatt[5];
4485  Vname(att,vatt);
4486  g3satt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
4487  PASSCHARL(vatt));
4488 }
4489 
4490 //______________________________________________________________________
4491 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
4492  Int_t& natt, Float_t* par, Float_t* att)
4493 {
4494  //
4495  // Find the parameters of a volume
4496  //
4497  g3fpara(PASSCHARD(name), number, intext, npar, natt, par, att
4498  PASSCHARL(name));
4499 }
4500 
4501 //______________________________________________________________________
4502 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
4503 {
4504  //
4505  // Check the parameters of a shape
4506  //
4507  gckpar(ish,npar,par);
4508 }
4509 
4510 //______________________________________________________________________
4511 void TGeant3::Gckmat(Int_t itmed, char* natmed)
4512 {
4513  //
4514  // Check the parameters of a tracking medium
4515  //
4516  g3ckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
4517 }
4518 
4519 //______________________________________________________________________
4520 Int_t TGeant3::Glvolu(Int_t nlev, Int_t *lnam,Int_t *lnum)
4521 {
4522  //
4523  // nlev number of levels deep into the volume tree
4524  // size of the arrays lnam and lnum
4525  // lnam an integer array who's 4 bytes contain the ASCII code for the
4526  // volume names
4527  // lnum an integer array containing the copy numbers for that specific
4528  // volume
4529  //
4530  // This routine fills the volume parameters in common /gcvolu/ for a
4531  // physical tree, specified by the list lnam and lnum of volume names
4532  // and numbers, and for all its ascendants up to level 1. This routine
4533  // is optimized and does not re-compute the part of the history already
4534  // available in GCVOLU. This means that if it is used in user programs
4535  // outside the usual framework of the tracking, the user has to initialize
4536  // to zero NLEVEL in the common GCVOLU. It return 0 if there were no
4537  // problems in make the call.
4538  //
4539  Int_t ier;
4540  g3lvolu(nlev, lnam, lnum, ier);
4541  return ier;
4542 }
4543 
4544 //______________________________________________________________________
4545 void TGeant3::Gdelete(Int_t /* iview */)
4546 {
4547  //
4548  // IVIEW View number
4549  //
4550  // It deletes a view bank from memory.
4551  //
4552 }
4553 
4554 //______________________________________________________________________
4555 void TGeant3::Gdopen(Int_t /* iview */)
4556 {
4557  //
4558  // IVIEW View number
4559  //
4560  // When a drawing is very complex and requires a long time to be
4561  // executed, it can be useful to store it in a view bank: after a
4562  // call to DOPEN and the execution of the drawing (nothing will
4563  // appear on the screen), and after a necessary call to DCLOSE,
4564  // the contents of the bank can be displayed in a very fast way
4565  // through a call to DSHOW; therefore, the detector can be easily
4566  // zoomed many times in different ways. Please note that the pictures
4567  // with solid colors can now be stored in a view bank or in 'PICTURE FILES'
4568  //
4569 }
4570 
4571 //______________________________________________________________________
4573 {
4574  //
4575  // It closes the currently open view bank; it must be called after the
4576  // end of the drawing to be stored.
4577  //
4578 }
4579 
4580 //______________________________________________________________________
4581 void TGeant3::Gdshow(Int_t /* iview */)
4582 {
4583  //
4584  // IVIEW View number
4585  //
4586  // It shows on the screen the contents of a view bank. It
4587  // can be called after a view bank has been closed.
4588  //
4589 }
4590 
4591 //______________________________________________________________________
4592 void TGeant3::Gdopt(const char *name,const char *value)
4593 {
4594  //
4595  // NAME Option name
4596  // VALUE Option value
4597  //
4598  // To set/modify the drawing options.
4599  // IOPT IVAL Action
4600  //
4601  // THRZ ON Draw tracks in R vs Z
4602  // OFF (D) Draw tracks in X,Y,Z
4603  // 180
4604  // 360
4605  // PROJ PARA (D) Parallel projection
4606  // PERS Perspective
4607  // TRAK LINE (D) Trajectory drawn with lines
4608  // POIN " " with markers
4609  // HIDE ON Hidden line removal using the CG package
4610  // OFF (D) No hidden line removal
4611  // SHAD ON Fill area and shading of surfaces.
4612  // OFF (D) Normal hidden line removal.
4613  // RAYT ON Ray-tracing on.
4614  // OFF (D) Ray-tracing off.
4615  // EDGE OFF Does not draw contours when shad is on.
4616  // ON (D) Normal shading.
4617  // MAPP 1,2,3,4 Mapping before ray-tracing.
4618  // 0 (D) No mapping.
4619  // USER ON User graphics options in the ray tracing.
4620  // OFF (D) Automatic graphics options.
4621  //
4622 
4623  char vname[5];
4624  Vname(name,vname);
4625  char vvalue[5];
4626  Vname(value,vvalue);
4627  //g3dopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
4628  // PASSCHARL(vvalue));
4629 }
4630 
4631 //______________________________________________________________________
4632 void TGeant3::Gdraw(const char* /*name*/,Double_t /*theta*/, Double_t /*phi*/,
4633  Double_t /*psi*/, Double_t /*u0*/, Double_t /*v0*/, Double_t /*ul*/,
4634  Double_t /*vl*/)
4635 {
4636  //
4637  // NAME Volume name
4638  // +
4639  // THETA Viewing angle theta (for 3D projection)
4640  // PHI Viewing angle phi (for 3D projection)
4641  // PSI Viewing angle psi (for 2D rotation)
4642  // U0 U-coord. (horizontal) of volume origin
4643  // V0 V-coord. (vertical) of volume origin
4644  // SU Scale factor for U-coord.
4645  // SV Scale factor for V-coord.
4646  //
4647  // This function will draw the volumes,
4648  // selected with their graphical attributes, set by the Gsatt
4649  // facility. The drawing may be performed with hidden line removal
4650  // and with shading effects according to the value of the options HIDE
4651  // and SHAD; if the option SHAD is ON, the contour's edges can be
4652  // drawn or not. If the option HIDE is ON, the detector can be
4653  // exploded (BOMB), clipped with different shapes (CVOL), and some
4654  // of its parts can be shifted from their original
4655  // position (SHIFT). When HIDE is ON, if
4656  // the drawing requires more than the available memory, the program
4657  // will evaluate and display the number of missing words
4658  // (so that the user can increase the
4659  // size of its ZEBRA store). Finally, at the end of each drawing (with
4660  // HIDE on), the program will print messages about the memory used and
4661  // statistics on the volumes' visibility.
4662  // The following commands will produce the drawing of a green
4663  // volume, specified by NAME, without using the hidden line removal
4664  // technique, using the hidden line removal technique,
4665  // with different line width and color (red), with
4666  // solid color, with shading of surfaces, and without edges.
4667  // Finally, some examples are given for the ray-tracing. (A possible
4668  // string for the NAME of the volume can be found using the command DTREE).
4669  //
4670 }
4671 
4672 //______________________________________________________________________
4673 void TGeant3::Gdrawc(const char* /*name*/,Int_t /*axis*/, Float_t /*cut*/, Float_t /*u0*/,
4674  Float_t /*v0*/, Float_t /*ul*/, Float_t /*vl*/)
4675 {
4676  //
4677  // NAME Volume name
4678  // CAXIS Axis value
4679  // CUTVAL Cut plane distance from the origin along the axis
4680  // +
4681  // U0 U-coord. (horizontal) of volume origin
4682  // V0 V-coord. (vertical) of volume origin
4683  // SU Scale factor for U-coord.
4684  // SV Scale factor for V-coord.
4685  //
4686  // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
4687  // and placed at the distance cutval from the origin.
4688  // The resulting picture is seen from the the same axis.
4689  // When HIDE Mode is ON, it is possible to get the same effect with
4690  // the CVOL/BOX function.
4691  //
4692 }
4693 
4694 //______________________________________________________________________
4695 void TGeant3::Gdrawx(const char* /*name*/, Float_t /*cutthe*/, Float_t /*cutphi*/,
4696  Float_t /*cutval*/, Float_t /*theta*/, Float_t /*phi*/, Float_t /*u0*/,
4697  Float_t /*v0*/,Float_t /*ul*/, Float_t /*vl*/)
4698 {
4699  //
4700  // NAME Volume name
4701  // CUTTHE Theta angle of the line normal to cut plane
4702  // CUTPHI Phi angle of the line normal to cut plane
4703  // CUTVAL Cut plane distance from the origin along the axis
4704  // +
4705  // THETA Viewing angle theta (for 3D projection)
4706  // PHI Viewing angle phi (for 3D projection)
4707  // U0 U-coord. (horizontal) of volume origin
4708  // V0 V-coord. (vertical) of volume origin
4709  // SU Scale factor for U-coord.
4710  // SV Scale factor for V-coord.
4711  //
4712  // The cut plane is normal to the line given by the cut angles
4713  // cutthe and cutphi and placed at the distance cutval from the origin.
4714  // The resulting picture is seen from the viewing angles theta,phi.
4715  //
4716 }
4717 
4718 //______________________________________________________________________
4719 void TGeant3::Gdhead(Int_t /*isel*/, const char* /*name*/, Double_t /*chrsiz*/)
4720 {
4721  //
4722  // Parameters
4723  // +
4724  // ISEL Option flag D=111110
4725  // NAME Title
4726  // CHRSIZ Character size (cm) of title NAME D=0.6
4727  //
4728  // ISEL =
4729  // 0 to have only the header lines
4730  // xxxxx1 to add the text name centered on top of header
4731  // xxxx1x to add global detector name (first volume) on left
4732  // xxx1xx to add date on right
4733  // xx1xxx to select thick characters for text on top of header
4734  // x1xxxx to add the text 'EVENT NR x' on top of header
4735  // 1xxxxx to add the text 'RUN NR x' on top of header
4736  // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
4737  // i.e. they generate overwritten text.
4738  //
4739 }
4740 
4741 //______________________________________________________________________
4742 void TGeant3::Gdman(Double_t /*u*/, Double_t /*v*/, const char* /*type*/)
4743 {
4744  //
4745  // Draw a 2D-man at position (U0,V0)
4746  // Parameters
4747  // U U-coord. (horizontal) of the center of man' R
4748  // V V-coord. (vertical) of the center of man' R
4749  // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
4750  //
4751  // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
4752  // It superimposes the picture of a man or of a woman, chosen among
4753  // three different ones, with the same scale factors as the detector
4754  // in the current drawing.
4755  //
4756 }
4757 
4758 //______________________________________________________________________
4759 void TGeant3::Gdspec(const char* /*name*/)
4760 {
4761  //
4762  // NAME Volume name
4763  //
4764  // Shows 3 views of the volume (two cut-views and a 3D view), together with
4765  // its geometrical specifications. The 3D drawing will
4766  // be performed according the current values of the options HIDE and
4767  // SHAD and according the current SetClipBox clipping parameters for that
4768  // volume.
4769  //
4770 }
4771 
4772 //______________________________________________________________________
4773 void TGeant3::DrawOneSpec(const char* /*name*/)
4774 {
4775  //
4776  // Function called when one double-clicks on a volume name
4777  // in a TPavelabel drawn by Gdtree.
4778  //
4779 }
4780 
4781 //______________________________________________________________________
4782 void TGeant3::Gdtree(const char* /*name*/, Int_t /*levmax*/, Int_t /*isel*/)
4783 {
4784  //
4785  // NAME Volume name
4786  // LEVMAX Depth level
4787  // ISELT Options
4788  //
4789  // This function draws the logical tree,
4790  // Each volume in the tree is represented by a TPaveTree object.
4791  // Double-clicking on a TPaveTree draws the specs of the corresponding
4792  // volume.
4793  // Use TPaveTree pop-up menu to select:
4794  // - drawing specs
4795  // - drawing tree
4796  // - drawing tree of parent
4797  //
4798 }
4799 
4800 //______________________________________________________________________
4801 void TGeant3::GdtreeParent(const char* /*name*/, Int_t /*levmax*/, Int_t /*isel*/)
4802 {
4803  //
4804  // NAME Volume name
4805  // LEVMAX Depth level
4806  // ISELT Options
4807  //
4808  // This function draws the logical tree of the parent of name.
4809  //
4810 }
4811 
4812 //______________________________________________________________________
4813 void TGeant3::SetABAN(Int_t par)
4814 {
4815  //
4816  // par = 1 particles will be stopped according to their residual
4817  // range if they are not in a sensitive material and are
4818  // far enough from the boundary
4819  // 0 particles are transported normally
4820  //
4821  fGcphys->dphys1 = par;
4822  SetBit(kABAN);
4823 }
4824 
4825 
4826 //______________________________________________________________________
4827 void TGeant3::SetANNI(Int_t par)
4828 {
4829  //
4830  // To control positron annihilation.
4831  // par =0 no annihilation
4832  // =1 annihilation. Decays processed.
4833  // =2 annihilation. No decay products stored.
4834  //
4835  fGcphys->ianni = par;
4836 }
4837 
4838 
4839 //______________________________________________________________________
4840 void TGeant3::SetAUTO(Int_t par)
4841 {
4842  //
4843  // To control automatic calculation of tracking medium parameters:
4844  // par =0 no automatic calculation;
4845  // =1 automatic calculation.
4846  //
4847  fGctrak->igauto = par;
4848  SetBit(kAUTO);
4849 }
4850 
4851 
4852 //______________________________________________________________________
4853 void TGeant3::SetBOMB(Float_t /*boom*/)
4854 {
4855  //
4856  // BOOM : Exploding factor for volumes position
4857  //
4858  // To 'explode' the detector. If BOOM is positive (values smaller
4859  // than 1. are suggested, but any value is possible)
4860  // all the volumes are shifted by a distance
4861  // proportional to BOOM along the direction between their center
4862  // and the origin of the MARS; the volumes which are symmetric
4863  // with respect to this origin are simply not shown.
4864  // BOOM equal to 0 resets the normal mode.
4865  // A negative (greater than -1.) value of
4866  // BOOM will cause an 'implosion'; for even lower values of BOOM
4867  // the volumes' positions will be reflected respect to the origin.
4868  // This command can be useful to improve the 3D effect for very
4869  // complex detectors. The following commands will make explode the
4870  // detector:
4871  //
4872 }
4873 
4874 //______________________________________________________________________
4875 void TGeant3::SetBREM(Int_t par)
4876 {
4877  //
4878  // To control bremsstrahlung.
4879  // par =0 no bremsstrahlung
4880  // =1 bremsstrahlung. Photon processed.
4881  // =2 bremsstrahlung. No photon stored.
4882  //
4883  fGcphys->ibrem = par;
4884 }
4885 
4886 
4887 //______________________________________________________________________
4888 void TGeant3::SetCKOV(Int_t par)
4889 {
4890  //
4891  // To control Cerenkov production
4892  // par =0 no Cerenkov;
4893  // =1 Cerenkov;
4894  // =2 Cerenkov with primary stopped at each step.
4895  //
4896  fGctlit->itckov = par;
4897 }
4898 
4899 
4900 //______________________________________________________________________
4901 void TGeant3::SetClipBox(const char* /*name*/, Double_t /*xmin*/, Double_t /*xmax*/,
4902  Double_t /*ymin*/, Double_t /*ymax*/, Double_t /*zmin*/, Double_t /*zmax*/)
4903 {
4904  //
4905  // The hidden line removal technique is necessary to visualize properly
4906  // very complex detectors. At the same time, it can be useful to visualize
4907  // the inner elements of a detector in detail. This function allows
4908  // subtractions (via boolean operation) of BOX shape from any part of
4909  // the detector, therefore showing its inner contents.
4910  // If "*" is given as the name of the
4911  // volume to be clipped, all volumes are clipped by the given box.
4912  // A volume can be clipped at most twice.
4913  // if a volume is explicitly clipped twice,
4914  // the "*" will not act on it anymore. Giving "." as the name
4915  // of the volume to be clipped will reset the clipping.
4916  // Parameters
4917  // NAME Name of volume to be clipped
4918  // +
4919  // XMIN Lower limit of the Shape X coordinate
4920  // XMAX Upper limit of the Shape X coordinate
4921  // YMIN Lower limit of the Shape Y coordinate
4922  // YMAX Upper limit of the Shape Y coordinate
4923  // ZMIN Lower limit of the Shape Z coordinate
4924  // ZMAX Upper limit of the Shape Z coordinate
4925  //
4926  // This function performs a boolean subtraction between the volume
4927  // NAME and a box placed in the MARS according the values of the given
4928  // coordinates.
4929 
4930 }
4931 
4932 //______________________________________________________________________
4933 void TGeant3::SetCOMP(Int_t par)
4934 {
4935  //
4936  // To control Compton scattering
4937  // par =0 no Compton
4938  // =1 Compton. Electron processed.
4939  // =2 Compton. No electron stored.
4940  //
4941  //
4942  fGcphys->icomp = par;
4943 }
4944 
4945 //modified by Andrea Fontana and Alberto Rotondi - march 2007
4946 //added array of 5 user definable cuts (like in old Geant)
4947 //______________________________________________________________________
4948 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
4949  Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
4950  Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
4951  Float_t ppcutm, Float_t tofmax, Float_t *gcuts)
4952 {
4953  //
4954  // CUTGAM Cut for gammas D=0.001
4955  // CUTELE Cut for electrons D=0.001
4956  // CUTHAD Cut for charged hadrons D=0.01
4957  // CUTNEU Cut for neutral hadrons D=0.01
4958  // CUTMUO Cut for muons D=0.01
4959  // BCUTE Cut for electron brems. D=-1.
4960  // BCUTM Cut for muon brems. D=-1.
4961  // DCUTE Cut for electron delta-rays D=-1.
4962  // DCUTM Cut for muon delta-rays D=-1.
4963  // PPCUTM Cut for e+e- pairs by muons D=0.01
4964  // TOFMAX Time of flight cut D=1.E+10
4965  //
4966  // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
4967  // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
4968  // respectively.
4969  // If one of the parameters from CUTGAM to PPCUTM included
4970  // is modified, cross-sections and energy loss tables must be
4971  // recomputed via the function Gphysi.
4972  //
4973  fGccuts->cutgam = cutgam;
4974  fGccuts->cutele = cutele;
4975  fGccuts->cutneu = cutneu;
4976  fGccuts->cuthad = cuthad;
4977  fGccuts->cutmuo = cutmuo;
4978  fGccuts->bcute = bcute;
4979  fGccuts->bcutm = bcutm;
4980  fGccuts->dcute = dcute;
4981  fGccuts->dcutm = dcutm;
4982  fGccuts->ppcutm = ppcutm;
4983  fGccuts->tofmax = tofmax;
4984  fGccuts->gcuts[0] = gcuts[0];
4985  fGccuts->gcuts[1] = gcuts[1];
4986  fGccuts->gcuts[2] = gcuts[2];
4987  fGccuts->gcuts[3] = gcuts[3];
4988  fGccuts->gcuts[4] = gcuts[4];
4989 }
4990 
4991 //added by Andrea Fontana and Alberto Rotondi - april 2007
4992 //______________________________________________________________________
4993 void TGeant3::SetECut(Float_t gcalpha)
4994 {
4995  fGcmore->gcalpha = gcalpha;
4996 }
4997 
4998 void TGeant3::SetClose(Int_t iclose,Float_t *pf,Float_t dstrt,
4999  Float_t *w1, Float_t *w2,
5000  Float_t *p1,Float_t *p2,Float_t *p3,Float_t *clen)
5001 {
5002  fGcmore->iclose = iclose;
5003  fGcmore->pfinal[0] = pf[0];
5004  fGcmore->pfinal[1] = pf[1];
5005  fGcmore->pfinal[2] = pf[2];
5006  fGcmore->dstrt = dstrt;
5007  fGcmore->wire1[0] = w1[0];
5008  fGcmore->wire1[1] = w1[1];
5009  fGcmore->wire1[2] = w1[2];
5010  fGcmore->wire2[0] = w2[0];
5011  fGcmore->wire2[1] = w2[1];
5012  fGcmore->wire2[2] = w2[2];
5013  fGcmore->p1[0] = p1[0];
5014  fGcmore->p1[1] = p1[1];
5015  fGcmore->p1[2] = p1[2];
5016  fGcmore->p2[0] = p2[0];
5017  fGcmore->p2[1] = p2[1];
5018  fGcmore->p2[2] = p2[2];
5019  fGcmore->p3[0] = p3[0];
5020  fGcmore->p3[1] = p3[1];
5021  fGcmore->p3[2] = p3[2];
5022  fGcmore->cleng[0] = clen[0];
5023  fGcmore->cleng[1] = clen[1];
5024  fGcmore->cleng[2] = clen[2];
5025 }
5026 
5027 void TGeant3::GetClose(Float_t *p1,Float_t *p2,Float_t *p3,Float_t *len)
5028 {
5029  p1[0] = fGcmore->p1[0];
5030  p1[1] = fGcmore->p1[1];
5031  p1[2] = fGcmore->p1[2];
5032  p2[0] = fGcmore->p2[0];
5033  p2[1] = fGcmore->p2[1];
5034  p2[2] = fGcmore->p2[2];
5035  p3[0] = fGcmore->p3[0];
5036  p3[1] = fGcmore->p3[1];
5037  p3[2] = fGcmore->p3[2];
5038  len[0] = fGcmore->cleng[0];
5039  len[1] = fGcmore->cleng[1];
5040  len[2] = fGcmore->cleng[2];
5041 }
5042 
5043 //______________________________________________________________________
5044 void TGeant3::SetDCAY(Int_t par)
5045 {
5046  //
5047  // To control Decay mechanism.
5048  // par =0 no decays.
5049  // =1 Decays. secondaries processed.
5050  // =2 Decays. No secondaries stored.
5051  //
5052  fGcphys->idcay = par;
5053 }
5054 
5055 
5056 //______________________________________________________________________
5057 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
5058 {
5059  //
5060  // Set the debug flag and frequency
5061  // Selected debug output will be printed from
5062  // event emin to even emax each emod event
5063  //
5064  fGcflag->idemin = emin;
5065  fGcflag->idemax = emax;
5066  fGcflag->itest = emod;
5067  SetBit(kDEBU);
5068 }
5069 
5070 
5071 //______________________________________________________________________
5072 void TGeant3::SetDRAY(Int_t par)
5073 {
5074  //
5075  // To control delta rays mechanism.
5076  // par =0 no delta rays.
5077  // =1 Delta rays. secondaries processed.
5078  // =2 Delta rays. No secondaries stored.
5079  //
5080  fGcphys->idray = par;
5081 }
5082 
5083 //______________________________________________________________________
5084 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
5085 {
5086  //
5087  // To control cross section tabulations
5088  // ekmin = minimum kinetic energy in GeV
5089  // ekmax = maximum kinetic energy in GeV
5090  // nekbin = number of logarithmic bins (<200)
5091  //
5092  fGcmulo->ekmin = ekmin;
5093  fGcmulo->ekmax = ekmax;
5094  fGcmulo->nekbin = nekbin;
5095  SetBit(kERAN);
5096 }
5097 
5098 //______________________________________________________________________
5099 void TGeant3::SetHADR(Int_t par)
5100 {
5101  //
5102  // To control hadronic interactions.
5103  // par =0 no hadronic interactions.
5104  // =1 Hadronic interactions. secondaries processed.
5105  // =2 Hadronic interactions. No secondaries stored.
5106  //
5107  fGcphys->ihadr = par;
5108 }
5109 
5110 //______________________________________________________________________
5111 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
5112  Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
5113  Float_t xk8, Float_t xk9, Float_t xk10)
5114 {
5115  //
5116  // Set the variables in /GCFLAG/ IKINE, PKINE(10)
5117  // Their meaning is user defined
5118  //
5119  fGckine->ikine = kine;
5120  fGckine->pkine[0] = xk1;
5121  fGckine->pkine[1] = xk2;
5122  fGckine->pkine[2] = xk3;
5123  fGckine->pkine[3] = xk4;
5124  fGckine->pkine[4] = xk5;
5125  fGckine->pkine[5] = xk6;
5126  fGckine->pkine[6] = xk7;
5127  fGckine->pkine[7] = xk8;
5128  fGckine->pkine[8] = xk9;
5129  fGckine->pkine[9] = xk10;
5130 }
5131 
5132 //______________________________________________________________________
5133 void TGeant3::SetLOSS(Int_t par)
5134 {
5135  //
5136  // To control energy loss.
5137  // par =0 no energy loss;
5138  // =1 restricted energy loss fluctuations;
5139  // =2 complete energy loss fluctuations;
5140  // =3 same as 1;
5141  // =4 no energy loss fluctuations.
5142  // If the value ILOSS is changed, then cross-sections and energy loss
5143  // tables must be recomputed via the command 'PHYSI'.
5144  //
5145  fGcphys->iloss = par;
5146 }
5147 
5148 
5149 //______________________________________________________________________
5150 void TGeant3::SetMULS(Int_t par)
5151 {
5152  //
5153  // To control multiple scattering.
5154  // par =0 no multiple scattering.
5155  // =1 Moliere or Coulomb scattering.
5156  // =2 Moliere or Coulomb scattering.
5157  // =3 Gaussian scattering.
5158  //
5159  fGcphys->imuls = par;
5160 }
5161 
5162 
5163 //______________________________________________________________________
5164 void TGeant3::SetMUNU(Int_t par)
5165 {
5166  //
5167  // To control muon nuclear interactions.
5168  // par =0 no muon-nuclear interactions.
5169  // =1 Nuclear interactions. Secondaries processed.
5170  // =2 Nuclear interactions. Secondaries not processed.
5171  //
5172  fGcphys->imunu = par;
5173 }
5174 
5175 //______________________________________________________________________
5176 void TGeant3::SetOPTI(Int_t par)
5177 {
5178  //
5179  // This flag controls the tracking optimization performed via the
5180  // GSORD routine:
5181  // 1 no optimization at all; GSORD calls disabled;
5182  // 0 no optimization; only user calls to GSORD kept;
5183  // 1 all non-GSORDered volumes are ordered along the best axis;
5184  // 2 all volumes are ordered along the best axis.
5185  //
5186  fGcopti->ioptim = par;
5187  SetBit(kOPTI);
5188 }
5189 
5190 //______________________________________________________________________
5191 void TGeant3::SetPAIR(Int_t par)
5192 {
5193  //
5194  // To control pair production mechanism.
5195  // par =0 no pair production.
5196  // =1 Pair production. secondaries processed.
5197  // =2 Pair production. No secondaries stored.
5198  //
5199  fGcphys->ipair = par;
5200 }
5201 
5202 
5203 //______________________________________________________________________
5204 void TGeant3::SetPFIS(Int_t par)
5205 {
5206  //
5207  // To control photo fission mechanism.
5208  // par =0 no photo fission.
5209  // =1 Photo fission. secondaries processed.
5210  // =2 Photo fission. No secondaries stored.
5211  //
5212  fGcphys->ipfis = par;
5213 }
5214 
5215 //______________________________________________________________________
5216 void TGeant3::SetPHOT(Int_t par)
5217 {
5218  //
5219  // To control Photo effect.
5220  // par =0 no photo electric effect.
5221  // =1 Photo effect. Electron processed.
5222  // =2 Photo effect. No electron stored.
5223  //
5224  fGcphys->iphot = par;
5225 }
5226 
5227 //______________________________________________________________________
5228 void TGeant3::SetRAYL(Int_t par)
5229 {
5230  //
5231  // To control Rayleigh scattering.
5232  // par =0 no Rayleigh scattering.
5233  // =1 Rayleigh.
5234  //
5235  fGcphys->irayl = par;
5236 }
5237 
5238 //______________________________________________________________________
5239 void TGeant3::SetSTRA(Int_t par)
5240 {
5241  //
5242  // To control energy loss fluctuations
5243  // with the Photo-Absorption Ionization model.
5244  // par =0 no Straggling.
5245  // =1 Straggling yes => no Delta rays.
5246  //
5247  fGcphlt->istra = par;
5248 }
5249 
5250 //______________________________________________________________________
5251 void TGeant3::SetSWIT(Int_t sw, Int_t val)
5252 {
5253  //
5254  // sw Switch number
5255  // val New switch value
5256  //
5257  // Change one element of array ISWIT(10) in /GCFLAG/
5258  //
5259  if (sw <= 0 || sw > 10) return;
5260  fGcflag->iswit[sw-1] = val;
5261  SetBit(kSWIT);
5262 }
5263 
5264 
5265 //______________________________________________________________________
5266 void TGeant3::SetTRIG(Int_t nevents)
5267 {
5268  //
5269  // Set number of events to be run
5270  //
5271  fGcflag->nevent = nevents;
5272  SetBit(kTRIG);
5273 }
5274 
5275 //______________________________________________________________________
5277 {
5278  //
5279  // Force the decays of particles to be done with Pythia
5280  // and not with the Geant routines.
5281  // just kill pointers doing mzdrop
5282  //
5283  Int_t ipart = IdFromPDG(pdg);
5284  if(ipart<0) {
5285  printf("Particle %d not in geant\n",pdg);
5286  return;
5287  }
5288  Int_t jpart=fGclink->jpart;
5289  Int_t jpa=fZlq[jpart-ipart];
5290  //
5291  if(jpart && jpa) {
5292  Int_t jpa1=fZlq[jpa-1];
5293  if(jpa1)
5294  mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
5295  Int_t jpa2=fZlq[jpa-2];
5296  if(jpa2)
5297  mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
5298  }
5299 }
5300 //______________________________________________________________________
5301 Bool_t TGeant3::SetDecayMode(Int_t pdg, Float_t bratio[6], Int_t mode[6][3])
5302 {
5303  //
5304  // Set user decay modes by calling Gsdk
5305  //
5306  if ( pdg == 0 ) {
5307  printf("Cannot define decay mode for particle with PDG=0");
5308  return false;
5309  }
5310 
5311  if ( IdFromPDG(pdg) < 0 ) {
5312  printf("Particle %d not in geant\n",pdg);
5313  return false;
5314  }
5315 
5316  SetUserDecay(pdg);
5317 
5318  Int_t g3mode[6];
5319  Int_t id1,id2,id3;
5320  for (Int_t k1=0; k1<6; k1++) g3mode[k1]=0;
5321  for (Int_t k=0; k<6; k++) {
5322 
5323  if(mode[k][0]!=0) {
5324  id1= IdFromPDG(mode[k][0]);
5325  if ( id1 < 0 ) {
5326  printf("Particle %d not in geant\n",mode[k][0]);
5327  return false;
5328  }
5329  }
5330  else id1=0;
5331 
5332  if(mode[k][1]!=0) {
5333  id2= IdFromPDG(mode[k][1]);
5334  if ( id2 < 0 ) {
5335  printf("Particle %d not in geant\n",mode[k][1]);
5336  return false;
5337  }
5338  }
5339  else id2=0;
5340 
5341  if(mode[k][2]!=0) {
5342  id3= IdFromPDG(mode[k][2]);
5343  if ( id3 < 0 ) {
5344  printf("Particle %d not in geant\n",mode[k][1]);
5345  return false;
5346  }
5347  }
5348  else id3=0;
5349  g3mode[k]=id1 + id2* 100+ id3 * 10000 ;
5350 
5351  }
5352  Gsdk(IdFromPDG(pdg), bratio, g3mode);
5353  return kTRUE;
5354 }
5355 
5356 //______________________________________________________________________
5357 void TGeant3::Vname(const char *name, char *vname)
5358 {
5359  //
5360  // convert name to upper case. Make vname at least 4 chars
5361  //
5362  Int_t l = strlen(name);
5363  Int_t i;
5364  l = l < 4 ? l : 4;
5365  for (i=0;i<l;i++) vname[i] = toupper(name[i]);
5366  for (i=l;i<4;i++) vname[i] = ' ';
5367  vname[4] = 0;
5368 }
5369 
5370 //______________________________________________________________________
5372 {
5373  //
5374  // Perform the tracking of the track Track parameters are in VECT
5375  //
5376  ertrgo();
5377 }
5378 
5379 //______________________________________________________________________
5380 void TGeant3::Ertrak(const Float_t *x1, const Float_t *p1,
5381  const Float_t *x2, const Float_t *p2,
5382  Int_t ipa, Option_t *chopt)
5383 {
5384  //************************************************************************
5385  //* *
5386  //* Perform the tracking of the track from point X1 to *
5387  //* point X2 *
5388  //* (Before calling this routine the user should also provide *
5389  //* the input informations in /EROPTS/ and /ERTRIO/ *
5390  //* using subroutine EUFIL(L/P/V) *
5391  //* X1 - Starting coordinates (Cartesian) *
5392  //* P1 - Starting 3-momentum (Cartesian) *
5393  //* X2 - Final coordinates (Cartesian) *
5394  //* P2 - Final 3-momentum (Cartesian) *
5395  //* IPA - Particle code (a la GEANT) of the track *
5396  //* *
5397  //* CHOPT *
5398  //* 'B' 'Backward tracking' - i.e. energy loss *
5399  //* added to the current energy *
5400  //* 'E' 'Exact' calculation of errors assuming *
5401  //* helix (i.e. path-length not *
5402  //* assumed as infinitesimal) *
5403  //* 'L' Tracking up to prescribed Lengths reached *
5404  //* 'M' 'Mixed' prediction (not yet coded) *
5405  //* 'O' Tracking 'Only' without calculating errors *
5406  //* 'P' Tracking up to prescribed Planes reached *
5407  //* 'V' Tracking up to prescribed Volumes reached *
5408  //* 'X' Tracking up to prescribed Point approached *
5409  //* *
5410  //* Interface with GEANT : *
5411  //* Track parameters are in /CGKINE/ and /GCTRAK/ *
5412  //* *
5413  //* ==>Called by : USER *
5414  //* Authors M.Maire, E.Nagy ********//* *
5415  //* *
5416  //************************************************************************
5417  ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
5418 }
5419 
5421 //
5422 // ******************************************************************
5423 // * *
5424 // * Print track and volume parameters at current point *
5425 // * *
5426 // * ==>Called by : <USER,EUSTEP> *
5427 // * Author R.Brun ********* *
5428 // * *
5429 // ******************************************************************
5430 //
5431 
5432 
5433  erxyzc();
5434 }
5435 
5436 
5437 
5438 void TGeant3::Eufill(Int_t n,Float_t *ein,Float_t *xlf){
5439 
5440 // C. ******************************************************************
5441 // C. * *
5442 // C. * User routine to fill the input values of the commons : *
5443 // C. * /EROPTS/, /EROPTC/ and /ERTRIO/ for CHOPT = 'L' *
5444 // C. * N Number of predictions where to store results *
5445 // C. * EIN Input error matrix *
5446 // C. * XLF Defines the tracklengths which if passed the *
5447 // C. * result should be stored *
5448 // C. * *
5449 // C. * *
5450 // C. * ==>Called by : USER (before calling ERTRAK) *
5451 // C. * Author M.Maire, E.Nagy ********* *
5452 // C. * *
5453 // C. ******************************************************************
5454  for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
5455  const Int_t mxpred=10;
5456  if (n<mxpred) {
5457  fErtrio->nepred=n;
5458  } else {
5459  fErtrio->nepred=mxpred;
5460  }
5461  for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
5462  for(Int_t i=0;i<fErtrio->nepred;i++) fEropts->erleng[i]=xlf[i];
5463 // eufill(n,ein,xlf);
5464 }
5465 
5466 void TGeant3::Eufilp(const Int_t n, Float_t *ein,
5467  Float_t *pli, Float_t *plf)
5468 {
5469  // ******************************************************************
5470  // * *
5471  // * User routine to fill the input values of the commons : *
5472  // * /EROPTS/, /EROPTC/ and /ERTRIO/ for CHOPT = 'P' *
5473  // * N Number of predictions where to store results *
5474  // * EIN Input error matrix (in the 'Plane' system ) *
5475  // * PLI Defines the start plane *
5476  // * PLI(3,1) - and *
5477  // * PLI(3,2) - 2 unit vectors in the plane *
5478  // * PLF Defines the end plane *
5479  // * PLF(3,1,I) - and *
5480  // * PLF(3,2,I) - 2 unit vectors in the plane *
5481  // * PLF(3,3,I) - point on the plane *
5482  // * at intermediate point I *
5483  // * *
5484  // * ==>Called by : USER (before calling ERTRAK) *
5485  // * Author M.Maire, E.Nagy ********* *
5486  // * *
5487  // ******************************************************************
5488  for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
5489  const Int_t mxpred=10;
5490  if (n<mxpred) {
5491  fErtrio->nepred=n;
5492  } else {
5493  fErtrio->nepred=mxpred;
5494  }
5495  for(Int_t i=0;i<6;i++) fEropts->erpli[i]=pli[i];
5496 
5497  for (Int_t j=0;j<n;j++) {
5498  for(Int_t i=0;i<9;i++) {
5499  fEropts->erplo[i+12*j]=plf[i+12*j];
5500  }
5501  TVector3 v1(fEropts->erplo[0+12*j],fEropts->erplo[1+12*j],fEropts->erplo[2+12*j]);
5502  TVector3 v2(fEropts->erplo[3+12*j],fEropts->erplo[4+12*j],fEropts->erplo[5+12*j]);
5503  TVector3 v3=v1.Cross(v2);
5504  fEropts->erplo[9]=v3(0);
5505  fEropts->erplo[10]=v3(1);
5506  fEropts->erplo[11]=v3(2);
5507  }
5508 
5509 
5510 }
5511 void TGeant3::Eufilv(Int_t n, Float_t *ein,
5512  Char_t *namv, Int_t *numv,Int_t *iovl)
5513 {
5514 
5515  // ******************************************************************
5516  // * *
5517  // * User routine to fill the input values of the commons : *
5518  // * /EROPTS/, /EROPTC/ and /ERTRIO/ for CHOPT = 'V' *
5519  // * N Number of predictions where to store results *
5520  // * EIN Input error matrix *
5521  // * CNAMV Volume name of the prediction *
5522  // * NUMV Volume number (if 0 = all volumes) *
5523  // * IOVL = 1 prediction when entering in the volume *
5524  // * = 2 prediction when leaving the volume *
5525  // * *
5526  // * ==>Called by : USER (before calling ERTRAK) *
5527  // * Author M.Maire, E.Nagy ********* *
5528  // * *
5529  // ******************************************************************
5530 
5531  for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
5532  const Int_t mxpred=15;
5533  if (n<mxpred) {
5534  fErtrio->nepred=n;
5535  } else {
5536  fErtrio->nepred=mxpred;
5537  }
5538 
5539  for(Int_t i=0;i<fErtrio->nepred;i++) {
5540  fEropts->nameer[i]=*((int*)namv);
5541  fEropts->iovler[i]=iovl[i];
5542  fEropts->numver[i]=numv[i];
5543  }
5544 }
5545 //______________________________________________________________________
5546 void TGeant3::Trscsd(Float_t *pc,Float_t *rc,Float_t *pd,Float_t *rd,Float_t *h,Float_t ch,Int_t ierr,Float_t spu,Float_t *dj,Float_t *dk){
5547 
5548 // SUBROUTINE TRSCSD(PC,RC,PD,RD,H,CH,IERR,SPU,DJ,DK)
5549 // ******************************************************************
5550 // *** TRANSFORMS ERROR MATRIX
5551 // FROM SC VARIABLES (1/P,LAMBDA,PHI,YT,ZT)
5552 // TO VARIABLES (1/P,V',W',V,W)
5553 //
5554 // Authors: A. Haas and W. Wittek
5555 // *** PC(3) 1/P,LAMBDA,PHI INPUT
5556 // PD(3) 1/P,V',W' OUTPUT
5557 // H(3) MAGNETIC FIELD INPUT
5558 // RC(15) ERROR MATRIX IN SC VARIABLES INPUT (TRIANGLE)
5559 // RD(15) ERROR MATRIX IN 1/P,V',W',V,W OUTPUT (TRIANGLE)
5560 // CH CHARGE OF PARTICLE INPUT
5561 // CHARGE AND MAGNETIC FIELD ARE NEEDED
5562 // FOR CORRELATION TERMS (V',YT),(V',ZT),(W',YT),(W',ZT)
5563 // THESE CORRELATION TERMS APPEAR BECAUSE RC IS ASSUMED
5564 // TO BE THE ERROR MATRIX FOR FIXED S (PATH LENGTH)
5565 // AND RD FOR FIXED U
5566 // DJ(3) UNIT VECTOR IN V-DIRECTION
5567 // DK(3) UNIT VECTOR IN W-DIRECTION OF DETECTOR SYSTEM
5568 //
5569 // IERR = 1 PARTICLE MOVES PERPENDICULAR TO U-AXIS
5570 // ( V',W' ARE NOT DEFINED )
5571 // SPU SIGN OF U-COMPONENT OF PARTICLE MOMENTUM OUTPUT
5572 // ******************************************************************
5573  printf("%d\n",ierr);
5574  trscsd(pc,rc,pd,rd,h,ch,ierr,spu,dj,dk);
5575 }
5576 //______________________________________________________________________
5577 void TGeant3::Trsdsc(Float_t *pd,Float_t *rd,Float_t *pc,Float_t *rc,Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk) {
5578 // ******************************************************************
5579 // SUBROUTINE TRSDSC(PD,RD,PC,RC,H,CH,IERR,SPU,DJ,DK)
5580 //
5581 // *** TRANSFORMS ERROR MATRIX
5582 // FROM VARIABLES (1/P,V',W',V,W)
5583 // TO SC VARIABLES (1/P,LAMBDA,PHI,YT,ZT)
5584 // Authors: A. Haas and W. Wittek
5585 // *** PD(3) 1/P,V',W' INPUT
5586 // PC(3) 1/P,LAMBDA,PHI OUTPUT
5587 // H(3) MAGNETIC FIELD INPUT
5588 // RD(15) ERROR MATRIX IN 1/P,V',W',V,W INPUT (TRIANGLE)
5589 // RC(15) ERROR MATRIX IN SC VARIABLES OUTPUT (TRIANGLE)
5590 // CH CHARGE OF PARTICLE INPUT
5591 // CHARGE AND MAGNETIC FIELD ARE NEEDED
5592 // FOR CORRELATION TERMS (LAMBDA,V),(LAMBDA,W),(PHI,V),(PHI,W)
5593 // THESE CORRELATION TERMS APPEAR BECAUSE RC IS ASSUMED
5594 // TO BE THE ERROR MATRIX FOR FIXED S (PATH LENGTH)
5595 // AND RD FOR FIXED U
5596 // DJ(3) UNIT VECTOR IN V-DIRECTION
5597 // DK(3) UNIT VECTOR IN W-DIRECTION OF DETECTOR SYSTEM
5598 //
5599 // IERR NOT USED
5600 // SPU SIGN OF U-COMPONENT OF PARTICLE MOMENTUM INPUT
5601 // ******************************************************************
5602  trsdsc(pd,rd,pc,rc,h,ch,ierr,spu,dj,dk);
5603 }
5604 //______________________________________________________________________
5605 void TGeant3::Trscsp(Float_t *pc,Float_t *rc,Float_t *ps,Float_t *rs,Float_t *h,Float_t *ch,Int_t *ierr, Float_t *spx){
5606 // ******************************************************************
5607 // SUBROUTINE TRSCSP(PC,RC,PS,RS,H,CH,IERR,SPX)
5608 //
5609 // *** TRANSFORMS ERROR MATRIX
5610 // FROM SC VARIABLES (1/P,LAMBDA,PHI,YT,ZT)
5611 // TO SPLINE VARIABLES (1/P,Y',Z',Y,Z)
5612 //
5613 // Authors: A. Haas and W. Wittek
5614 //
5615 //
5616 // *** PC(3) 1/P,LAMBDA,PHI INPUT
5617 // PS(3) 1/P,Y',Z' OUTPUT
5618 // H(3) MAGNETIC FIELD INPUT
5619 // RC(15) ERROR MATRIX IN SC VARIABLES INPUT (TRIANGLE)
5620 // RS(15) ERROR MATRIX IN SPLINE VARIABLES OUTPUT (TRIANGLE)
5621 // CH CHARGE OF PARTICLE INPUT
5622 // CHARGE AND MAGNETIC FIELD ARE NEEDED
5623 // FOR CORRELATION TERMS (Y',YT),(Y',ZT),(Z',YT),(Z',ZT)
5624 // THESE CORRELATION TERMS APPEAR BECAUSE RC IS ASSUMED
5625 // TO BE THE ERROR MATRIX FOR FIXED S (PATH LENGTH)
5626 // AND RS FOR FIXED X
5627 //
5628 // IERR = 1 PARTICLE MOVES PERPENDICULAR TO X-AXIS
5629 // ( Y',Z' ARE NOT DEFINED )
5630 // SPX SIGN OF X-COMPONENT OF PARTICLE MOMENTUM OUTPUT
5631 // ******************************************************************
5632  trscsp(pc,rc,ps,rs,h,ch,ierr,spx);
5633 }
5634 //______________________________________________________________________
5635 void TGeant3::Trspsc(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spx) {
5636 
5637 // ******************************************************************
5638 // SUBROUTINE TRSPSC(PS,RS,PC,RC,H,CH,IERR,SPX)
5639 //
5640 // *** TRANSFORMS ERROR MATRIX
5641 // FROM SPLINE VARIABLES (1/P,Y',Z',Y,Z)
5642 // TO SC VARIABLES (1/P,LAMBDA,PHI,YT,ZT)
5643 //
5644 // Authors: A. Haas and W. Wittek
5645 //
5646 //
5647 // *** PS(3) 1/P,Y',Z' INPUT
5648 // PC(3) 1/P,LAMBDA,PHI OUTPUT
5649 // H(3) MAGNETIC FIELD INPUT
5650 // RS(15) ERROR MATRIX IN SPLINE VARIABLES INPUT (TRIANGLE)
5651 // RC(15) ERROR MATRIX IN SC VARIABLES OUTPUT (TRIANGLE)
5652 // CH CHARGE OF PARTICLE INPUT
5653 // CHARGE AND MAGNETIC FIELD ARE NEEDED
5654 // FOR CORRELATION TERMS (LAMBDA,Y),(LAMBDA,Z),(PHI,Y),(PHI,Z)
5655 // THESE CORRELATION TERMS APPEAR BECAUSE RC IS ASSUMED
5656 // TO BE THE ERROR MATRIX FOR FIXED S (PATH LENGTH)
5657 // AND RS FOR FIXED X
5658 //
5659 // IERR NOT USED
5660 // SPX SIGN OF X-COMPONENT OF PARTICLE MOMENTUM INPUT
5661 //
5662 // ******************************************************************
5663 
5664  trspsc(ps,rs,pc,rc,h,ch,ierr,spx);
5665 
5666 }
5667 
5668 
5669 //______________________________________________________________________
5670 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
5671  Int_t number, Int_t nlevel)
5672 {
5673  //
5674  //
5675  // ******************************************************************
5676  // * *
5677  // * Write out the geometry of the detector in EUCLID file format *
5678  // * *
5679  // * filnam : will be with the extension .euc *
5680  // * topvol : volume name of the starting node *
5681  // * number : copy number of topvol (relevant for gsposp) *
5682  // * nlevel : number of levels in the tree structure *
5683  // * to be written out, starting from topvol *
5684  // * *
5685  // * Author : M. Maire *
5686  // * *
5687  // ******************************************************************
5688  //
5689  // File filnam.tme is written out with the definitions of tracking
5690  // medias and materials.
5691  // As to restore original numbers for materials and medias, program
5692  // searches in the file euc_medi.dat and comparing main parameters of
5693  // the mat. defined inside geant and the one in file recognizes them
5694  // and is able to take number from file. If for any material or medium,
5695  // this procedure fails, ordering starts from 1.
5696  // Arrays IOTMED and IOMATE are used for this procedure
5697  //
5698  const char kShape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
5699  "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
5700  "GTRA","CTUB"};
5701  Int_t i, end, itm, irm, jrm, k, nmed;
5702  Int_t imxtmed=0;
5703  Int_t imxmate=0;
5704  FILE *lun;
5705  char *filext, *filetme;
5706  char natmed[21], namate[21];
5707  char natmedc[21], namatec[21];
5708  char key[5], name[5], mother[5], konly[5];
5709  char card[133];
5710  Int_t iadvol, iadtmd, iadrot, nwtot, iret;
5711  Int_t mlevel, numbr, natt, numed, nin, ndata;
5712  Int_t iname, ivo, ish, jvo, nvstak, ivstak;
5713  Int_t jdiv, ivin, in, jin, jvin, irot;
5714  Int_t jtm, imat, jma, flag=0, imatc;
5715  Float_t az, dens, radl, absl, a, step, x, y, z;
5716  Int_t npar, ndvmx, left;
5717  Float_t zc, densc, radlc, abslc, c0, tmaxfd;
5718  Int_t nparc, numb;
5719  Int_t iomate[100], iotmed[100];
5720  Float_t par[100], att[20], ubuf[50];
5721  Float_t *qws;
5722  Int_t *iws;
5723  Int_t level, ndiv, iaxe;
5724  Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
5725  Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
5726  Float_t tmaxf, stemax, deemax, epsil, stmin;
5727  const char *k10000="!\n%s\n!\n";
5728  //Open the input file
5729  end=strlen(filnam);
5730  for(i=0;i<end;i++) if(filnam[i]=='.') {
5731  end=i;
5732  break;
5733  }
5734  filext=new char[end+5];
5735  filetme=new char[end+5];
5736  strncpy(filext,filnam,end);
5737  strncpy(filetme,filnam,end);
5738  //
5739  // *** The output filnam name will be with extension '.euc'
5740  strcpy(&filext[end],".euc");
5741  strcpy(&filetme[end],".tme");
5742  lun=fopen(filext,"w");
5743  //
5744  // *** Initialization of the working space
5745  iadvol=fGcnum->nvolum;
5746  iadtmd=iadvol+fGcnum->nvolum;
5747  iadrot=iadtmd+fGcnum->ntmed;
5748  if(fGclink->jrotm) {
5749  fGcnum->nrotm=fZiq[fGclink->jrotm-2];
5750  } else {
5751  fGcnum->nrotm=0;
5752  }
5753  nwtot=iadrot+fGcnum->nrotm;
5754  qws = new float[nwtot+1];
5755  for (i=0;i<nwtot+1;i++) qws[i]=0;
5756  iws = (Int_t*) qws;
5757  mlevel=nlevel;
5758  if(nlevel==0) mlevel=20;
5759  //
5760  // *** find the top volume and put it in the stack
5761  numbr = number>0 ? number : 1;
5762  Gfpara(topvol,numbr,1,npar,natt,par,att);
5763  if(npar <= 0) {
5764  printf(" *** GWEUCL *** top volume : %s number : %3d can not be "
5765  "a valid root\n", topvol, numbr);
5766  return;
5767  }
5768  //
5769  // *** authorized shape ?
5770  strncpy((char *)&iname, topvol, 4);
5771  ivo=0;
5772  for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
5773  ivo=i;
5774  break;
5775  }
5776  jvo = fZlq[fGclink->jvolum-ivo];
5777  ish = Int_t (fZq[jvo+2]);
5778  if(ish > 12) {
5779  printf(" *** GWEUCL *** top volume : %s number : %3d can not be "
5780  "a valid root\n",topvol, numbr);
5781  }
5782  //
5783  level = 1;
5784  nvstak = 1;
5785  iws[nvstak] = ivo;
5786  iws[iadvol+ivo] = level;
5787  ivstak = 0;
5788  //
5789  //*** flag all volumes and fill the stack
5790  //
5791  L10:
5792  //
5793  // pick the next volume in stack
5794  ivstak += 1;
5795  ivo = TMath::Abs(iws[ivstak]);
5796  jvo = fZlq[fGclink->jvolum - ivo];
5797  //
5798  // flag the tracking medium
5799  numed = Int_t (fZq[jvo + 4]);
5800  iws[iadtmd + numed] = 1;
5801  //
5802  // get the daughters ...
5803  level = iws[iadvol+ivo];
5804  if (level < mlevel) {
5805  level += 1;
5806  nin = Int_t (fZq[jvo + 3]);
5807  //
5808  // from division ...
5809  if (nin < 0) {
5810  jdiv = fZlq[jvo - 1];
5811  ivin = Int_t (fZq[jdiv + 2]);
5812  nvstak += 1;
5813  iws[nvstak] = -ivin;
5814  iws[iadvol+ivin] = level;
5815  //
5816  // from position ...
5817  } else if (nin > 0) {
5818  for(in=1; in<=nin; in++) {
5819  jin = fZlq[jvo - in];
5820  ivin = Int_t (fZq[jin + 2 ]);
5821  jvin = fZlq[fGclink->jvolum - ivin];
5822  ish = Int_t (fZq[jvin + 2]);
5823  // authorized shape ?
5824  if (ish <= 12) {
5825  // not yet flagged ?
5826  if (iws[iadvol+ivin]==0) {
5827  nvstak += 1;
5828  iws[nvstak] = ivin;
5829  iws[iadvol+ivin] = level;
5830  }
5831  // flag the rotation matrix
5832  irot = Int_t ( fZq[jin + 4 ]);
5833  if (irot > 0) iws[iadrot+irot] = 1;
5834  }
5835  }
5836  }
5837  }
5838  //
5839  // next volume in stack ?
5840  if (ivstak < nvstak) goto L10;
5841  //
5842  // *** restore original material and media numbers
5843  // file euc_medi.dat is needed to compare materials and medias
5844  //
5845  FILE* luncor=fopen("euc_medi.dat","r");
5846  //
5847  if(luncor) {
5848  for(itm=1; itm<=fGcnum->ntmed; itm++) {
5849  if (iws[iadtmd+itm] > 0) {
5850  jtm = fZlq[fGclink->jtmed-itm];
5851  strncpy(natmed,(char *)&fZiq[jtm+1],20);
5852  imat = Int_t (fZq[jtm+6]);
5853  jma = fZlq[fGclink->jmate-imat];
5854  if (jma <= 0) {
5855  printf(" *** GWEUCL *** material not defined for tracking medium "
5856  "%5i %s\n",itm,natmed);
5857  flag=1;
5858  } else {
5859  strncpy(namate,(char *)&fZiq[jma+1],20);
5860  }
5861  //*
5862  //** find the material original number
5863  rewind(luncor);
5864  L23:
5865  iret=fscanf(luncor,"%4s,%130s",key,card);
5866  if(iret<=0) goto L26;
5867  flag=0;
5868  if(!strcmp(key,"MATE")) {
5869  sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,
5870  &densc,&radlc,&abslc,&nparc);
5871  Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
5872  if(!strcmp(namatec,namate)) {
5873  if(az==a && zc==z && densc==dens && radlc==radl
5874  && abslc==absl && nparc==nparc) {
5875  iomate[imat]=imatc;
5876  flag=1;
5877  printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",
5878  imat,namate,imatc);
5879  } else {
5880  printf("*** GWEUCL *** different definitions for material: %s\n",
5881  namate);
5882  }
5883  }
5884  }
5885  if(strcmp(key,"END") && !flag) goto L23;
5886  if (!flag) {
5887  printf("*** GWEUCL *** cannot restore original number for "
5888  "material: %s\n",namate);
5889  }
5890  //*
5891  //*
5892  //*** restore original tracking medium number
5893  rewind(luncor);
5894  L24:
5895  iret=fscanf(luncor,"%4s,%130s",key,card);
5896  if(iret<=0) goto L26;
5897  flag=0;
5898  if (!strcmp(key,"TMED")) {
5899  sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
5900  &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
5901  &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
5902  Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
5903  epsil,stmin,ubuf,&nwbuf);
5904  if(!strcmp(natmedc,natmed)) {
5905  if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
5906  iotmed[itm]=itmedc;
5907  flag=1;
5908  printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
5909  itm,natmed,itmedc);
5910  } else {
5911  printf("*** GWEUCL *** different definitions for tracking "
5912  "medium: %s\n",natmed);
5913  }
5914  }
5915  }
5916  if(strcmp(key,"END") && !flag) goto L24;
5917  if(!flag) {
5918  printf("cannot restore original number for medium : %s\n",natmed);
5919  goto L27;
5920  }
5921  }
5922  }
5923  goto L29;
5924  //*
5925  }
5926  L26: printf("*** GWEUCL *** cannot read the data file\n");
5927  L27: flag=2;
5928  L29: if(luncor) fclose (luncor);
5929  //
5930  //
5931  // *** write down the tracking medium definition
5932  //
5933  strcpy(card,"! Tracking medium");
5934  fprintf(lun,k10000,card);
5935  //
5936  for(itm=1;itm<=fGcnum->ntmed;itm++) {
5937  if (iws[iadtmd+itm]>0) {
5938  jtm = fZlq[fGclink->jtmed-itm];
5939  strncpy(natmed,(char *)&fZiq[jtm+1],20);
5940  natmed[20]='\0';
5941  imat = Int_t (fZq[jtm+6]);
5942  jma = fZlq[fGclink->jmate-imat];
5943  //* order media from one, if comparing with database failed
5944  if (flag==2) {
5945  iotmed[itm]=++imxtmed;
5946  iomate[imat]=++imxmate;
5947  }
5948  //*
5949  if(jma<=0) {
5950  strcpy(namate," ");
5951  printf(" *** GWEUCL *** material not defined for tracking "
5952  "medium %5d %s\n", itm,natmed);
5953  } else {
5954  strncpy(namate,(char *)&fZiq[jma+1],20);
5955  namate[20]='\0';
5956  }
5957  fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,
5958  iomate[imat],namate);
5959  }
5960  }
5961  //*
5962  //* *** write down the rotation matrix
5963  //*
5964  strcpy(card,"! Reperes");
5965  fprintf(lun,k10000,card);
5966  //
5967  for(irm=1;irm<=fGcnum->nrotm;irm++) {
5968  if (iws[iadrot+irm]>0) {
5969  jrm = fZlq[fGclink->jrotm-irm];
5970  fprintf(lun,"ROTM %3d",irm);
5971  for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
5972  fprintf(lun,"\n");
5973  }
5974  }
5975  //*
5976  //* *** write down the volume definition
5977  //*
5978  strcpy(card,"! Volumes");
5979  fprintf(lun,k10000,card);
5980  //*
5981  for(ivstak=1;ivstak<=nvstak;ivstak++) {
5982  ivo = iws[ivstak];
5983  if (ivo>0) {
5984  strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
5985  name[4]='\0';
5986  jvo = fZlq[fGclink->jvolum-ivo];
5987  ish = Int_t (fZq[jvo+2]);
5988  nmed = Int_t (fZq[jvo+4]);
5989  npar = Int_t (fZq[jvo+5]);
5990  if (npar>0) {
5991  if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
5992  Gckpar (ish,npar,par);
5993  fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],
5994  iotmed[nmed],npar);
5995  for(i=0;i<(npar-1)/6+1;i++) {
5996  fprintf(lun," ");
5997  left=npar-i*6;
5998  for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
5999  fprintf(lun,"\n");
6000  }
6001  } else {
6002  fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],
6003  iotmed[nmed],npar);
6004  }
6005  }
6006  }
6007  //*
6008  //* *** write down the division of volumes
6009  //*
6010  fprintf(lun,k10000,"! Divisions");
6011  for(ivstak=1;ivstak<=nvstak;ivstak++) {
6012  ivo = TMath::Abs(iws[ivstak]);
6013  jvo = fZlq[fGclink->jvolum-ivo];
6014  ish = Int_t (fZq[jvo+2]);
6015  nin = Int_t (fZq[jvo+3]);
6016  //* this volume is divided ...
6017  if (nin<0) {
6018  jdiv = fZlq[jvo-1];
6019  iaxe = Int_t ( fZq[jdiv+1]);
6020  ivin = Int_t ( fZq[jdiv+2]);
6021  ndiv = Int_t ( fZq[jdiv+3]);
6022  c0 = fZq[jdiv+4];
6023  step = fZq[jdiv+5];
6024  jvin = fZlq[fGclink->jvolum-ivin];
6025  nmed = Int_t ( fZq[jvin+4]);
6026  strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
6027  mother[4]='\0';
6028  strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
6029  name[4]='\0';
6030  if ((step<=0.)||(ish>=11)) {
6031  //* volume with negative parameter or gsposp or pgon ...
6032  fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
6033  } else if ((ndiv<=0)||(ish==10)) {
6034  //* volume with negative parameter or gsposp or para ...
6035  ndvmx = TMath::Abs(ndiv);
6036  fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
6037  name,mother,step,iaxe,iotmed[nmed],ndvmx);
6038  } else {
6039  //* normal volume : all kind of division are equivalent
6040  fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
6041  name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
6042  }
6043  }
6044  }
6045  //*
6046  //* *** write down the the positionnement of volumes
6047  //*
6048  fprintf(lun,k10000,"! Positionnements\n");
6049  //
6050  for(ivstak = 1;ivstak<=nvstak;ivstak++) {
6051  ivo = TMath::Abs(iws[ivstak]);
6052  strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
6053  mother[4]='\0';
6054  jvo = fZlq[fGclink->jvolum-ivo];
6055  nin = Int_t( fZq[jvo+3]);
6056  //* this volume has daughters ...
6057  if (nin>0) {
6058  for (in=1;in<=nin;in++) {
6059  jin = fZlq[jvo-in];
6060  ivin = Int_t (fZq[jin +2]);
6061  numb = Int_t (fZq[jin +3]);
6062  irot = Int_t (fZq[jin +4]);
6063  x = fZq[jin +5];
6064  y = fZq[jin +6];
6065  z = fZq[jin +7];
6066  strcpy(konly,"ONLY");
6067  if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
6068  strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
6069  name[4]='\0';
6070  jvin = fZlq[fGclink->jvolum-ivin];
6071  ish = Int_t (fZq[jvin+2]);
6072  //* gspos or gsposp ?
6073  ndata = fZiq[jin-1];
6074  if (ndata==8) {
6075  fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
6076  name,numb,mother,x,y,z,irot,konly);
6077  } else {
6078  npar = Int_t (fZq[jin+9]);
6079  for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
6080  Gckpar (ish,npar,par);
6081  fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
6082  name,numb,mother,x,y,z,irot,konly,npar);
6083  fprintf(lun," ");
6084  for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
6085  fprintf(lun,"\n");
6086  }
6087  }
6088  }
6089  }
6090  //*
6091  fprintf(lun,"END\n");
6092  fclose(lun);
6093  //*
6094  //****** write down the materials and medias *****
6095  //*
6096  lun=fopen(filetme,"w");
6097  //*
6098  for(itm=1;itm<=fGcnum->ntmed;itm++) {
6099  if (iws[iadtmd+itm]>0) {
6100  jtm = fZlq[fGclink->jtmed-itm];
6101  strncpy(natmed,(char*)&fZiq[jtm+1],4);
6102  imat = Int_t (fZq[jtm+6]);
6103  jma = Int_t (fZlq[fGclink->jmate-imat]);
6104  //* material
6105  Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
6106  fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
6107  iomate[imat],namate,a,z,dens,radl,absl,npar);
6108  //*
6109  if (npar>0) {
6110  fprintf(lun," ");
6111  for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
6112  fprintf(lun,"\n");
6113  }
6114  //* medium
6115  Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,
6116  epsil,stmin,par,&npar);
6117  fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f "
6118  "%11.5f %11.5f %11.5f %3d\n",
6119  iotmed[itm],natmed,iomate[nmat],isvol,ifield,
6120  fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
6121  //*
6122  if (npar>0) {
6123  fprintf(lun," ");
6124  for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
6125  fprintf(lun,"\n");
6126  }
6127 
6128  }
6129  }
6130  fprintf(lun,"END\n");
6131  fclose(lun);
6132  printf(" *** GWEUCL *** file: %s is now written out\n",filext);
6133  printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
6134  // Clean up
6135  delete [] filext;
6136  delete [] filetme;
6137  delete [] qws;
6138  iws=0;
6139  return;
6140 }
6141 
6142 //______________________________________________________________________
6143 Int_t TGeant3::TransportMethod(TMCParticleType particleType) const
6144 {
6145 //
6146 // Returns G3 transport method code for the specified MCParticleType
6147 // ---
6148 
6149  switch (particleType) {
6150  case kPTGamma: return 1;
6151  case kPTElectron: return 2;
6152  case kPTNeutron: return 3;
6153  case kPTHadron: return 4;
6154  case kPTMuon: return 5;
6155  case kPTGeantino: return 6;
6156  case kPTOpticalPhoton: return 7;
6157  case kPTIon: return 8;
6158  default: return -1;
6159  }
6160 }
6161 
6162 //______________________________________________________________________
6163 TMCParticleType TGeant3::ParticleType(Int_t itrtyp) const
6164 {
6165 //
6166 // Returns MCParticleType for the specified G3 transport method code
6167 // ---
6168 
6169  switch (itrtyp) {
6170  case 1: return kPTGamma;
6171  case 2: return kPTElectron;
6172  case 3: return kPTNeutron;
6173  case 4: return kPTHadron;
6174  case 5: return kPTMuon;
6175  case 6: return kPTGeantino;
6176  case 7: return kPTOpticalPhoton;
6177  case 8: return kPTIon;
6178  default: return kPTUndefined;
6179  }
6180 }
6181 
6182 //______________________________________________________________________
6183 TString TGeant3::ParticleClass(TMCParticleType particleType) const
6184 {
6185 //
6186 // Returns particle class name (used in TDatabasePDG) for
6187 // the specified MCParticleType
6188 // ---
6189 
6190  // CHECK
6191  switch (particleType) {
6192  case kPTGamma: return TString("Photon");
6193  case kPTElectron: return TString("Lepton");
6194  case kPTNeutron: return TString("Hadron");
6195  case kPTHadron: return TString("Hadron");
6196  case kPTMuon: return TString("Lepton");
6197  case kPTGeantino: return TString("Special");
6198  case kPTIon: return TString("Ion");
6199  case kPTOpticalPhoton: return TString("Photon");
6200  default: return TString("Unknown");
6201  }
6202 }
6203 
6204 //______________________________________________________________________
6206 {
6207  //
6208  // Finalize geometry construction
6209  //
6210 
6211  //Close the geometry structure
6212  if (gDebug > 0) printf("FinishGeometry, calling ggclos\n");
6213  Ggclos();
6214 
6215 
6216  // gROOT->GetListOfBrowsables()->Add(gGeoManager);
6217  if (gDebug > 0) printf("FinishGeometry, calling SetColors\n");
6218 
6219  //Create the color table
6220  SetColors();
6221  if (gDebug > 0) printf("FinishGeometry, returning\n");
6222 }
6223 
6224 //______________________________________________________________________
6226 {
6227  //
6228  //=================Create Materials and geometry
6229  //
6230 
6231  // Some default settings, if not changed by user
6232  if (!TestBit(kTRIG)) SetTRIG(1); // Number of events to be processed
6233  if (!TestBit(kSWIT)) SetSWIT(4, 10); //
6234  if (!TestBit(kDEBU)) SetDEBU(0, 0, 1); //
6235  if (!TestBit(kAUTO)) SetAUTO(1); // Select automatic STMIN etc...
6236  // calc. (AUTO 1) or manual (AUTO 0)
6237  if (!TestBit(kABAN)) SetABAN(0); // Restore 3.16 behaviour for
6238  // abandoned tracks
6239  if (!TestBit(kOPTI)) SetOPTI(2); // Select optimisation level for
6240  // GEANT geometry searches (0,1,2)
6241  if (!TestBit(kERAN)) SetERAN(5.e-7); //
6242 
6243  DefineParticles();
6244  fApplication->AddParticles();
6245  fApplication->AddIons();
6246  fApplication->ConstructGeometry();
6247  FinishGeometry();
6248 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,01,1)
6249  fApplication->ConstructOpGeometry();
6250 #endif
6251  fApplication->InitGeometry();
6252 }
6253 
6254 //____________________________________________________________________________
6255 Bool_t TGeant3::ProcessRun(Int_t nevent)
6256 {
6257  //
6258  // Process the run and return true if run has finished successfully,
6259  // return false in other cases (run aborted by user)
6260 
6261  Int_t todo = TMath::Abs(nevent);
6262  for (Int_t i=0; i<todo; i++) {
6263  // Process one run (one run = one event)
6264  fGcflag->idevt = i;
6265  fGcflag->ievent = i+1;
6266  if (fStopRun) break;
6267  fApplication->BeginEvent();
6268  if (fStopRun) break;
6269  ProcessEvent();
6270  if (fStopRun) break;
6271  fApplication->FinishEvent();
6272  if (fStopRun) break;
6273  }
6274 
6275  if (fStopRun) printf(" **** Run stopped ***\n");
6276 
6277  Bool_t returnValue = !fStopRun;
6278  fStopRun = kFALSE;
6279 #ifdef STATISTICS
6280  printf("count_gmedia= %8d\n",count_gmedia);
6281  printf("count_gtmedi= %8d\n",count_gtmedi);
6282  printf("count_ginvol= %8d\n",count_ginvol);
6283  printf("count_gtnext= %8d\n",count_gtnext);
6284  stattree->AutoSave();
6285  statfile->Close();
6286  printf("Statistics tree saved.\n");
6287 #endif
6288  return returnValue;
6289 }
6290 
6291 //______________________________________________________________________
6293 {
6294  //
6295  // Process one event
6296  //
6297  Gtrigi();
6298  Gtrigc();
6299  Gtrig();
6300 }
6301 
6302 //______________________________________________________________________
6304 {
6305  //
6306  // Set the colors for all the volumes
6307  // this is done sequentially for all volumes
6308  // based on the number of their medium
6309  //
6310 
6311  Int_t kv, icol;
6312  Int_t jvolum=fGclink->jvolum;
6313  //Int_t jtmed=fGclink->jtmed;
6314  //Int_t jmate=fGclink->jmate;
6315  Int_t nvolum=fGcnum->nvolum;
6316  char name[5];
6317  //
6318  // Now for all the volumes
6319  for(kv=1;kv<=nvolum;kv++) {
6320  // Get the tracking medium
6321  Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
6322  // Get the material
6323  //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
6324  // Get z
6325  //Float_t z=fZq[fZlq[jmate-ima]+7];
6326  // Find color number
6327  //icol = Int_t(z)%6+2;
6328  //icol = 17+Int_t(z*150./92.);
6329  //icol = kv%6+2;
6330  icol = itm%6+2;
6331  strncpy(name,(char*)&fZiq[jvolum+kv],4);
6332  name[4]='\0';
6333  Gsatt(name,"COLO",icol);
6334  }
6335 }
6336 
6337 //______________________________________________________________________
6338 void TGeant3::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom,
6339  Float_t *vpos, Float_t *polar, Float_t tof,
6340  TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
6341 {
6342  //
6343  // Load a track on the stack
6344  //
6345  // done 0 if the track has to be transported
6346  // 1 if not
6347  // parent identifier of the parent track. -1 for a primary
6348  // pdg particle code
6349  // pmom momentum GeV/c
6350  // vpos position
6351  // polar polarization
6352  // tof time of flight in seconds
6353  // mecha production mechanism
6354  // ntr on output the number of the track stored
6355  //
6356 
6357  // const Float_t tlife=0;
6358 
6359  //
6360  // Here we get the static mass
6361  // For MC is ok, but a more sophisticated method could be necessary
6362  // if the calculated mass is required
6363  // also, this method is potentially dangerous if the mass
6364  // used in the MC is not the same of the PDG database
6365  //
6366  Float_t mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass();
6367  Float_t e=TMath::Sqrt(mass*mass+pmom[0]*pmom[0]+
6368  pmom[1]*pmom[1]+pmom[2]*pmom[2]);
6369 
6370 // printf("Loading mass %f ene %f No %d ip %d parent %d done %d "
6371 // "pos %f %f %f mom %f %f %f kS %d m \n",
6372 // mass,e,fNtrack,pdg,parent,done,vpos[0],vpos[1],vpos[2],
6373 // pmom[0],pmom[1],pmom[2],kS);
6374 
6375 
6376  GetStack()->PushTrack(done, parent, pdg, pmom[0], pmom[1], pmom[2], e,
6377  vpos[0],vpos[1],vpos[2],tof,polar[0],polar[1],polar[2],
6378  mech, ntr, weight, is);
6379 }
6380 
6381 
6382 //______________________________________________________________________
6383 Float_t* TGeant3::CreateFloatArray(Float_t* array, Int_t size) const
6384 {
6385 // Converts Double_t* array to Float_t*,
6386 // !! The new array has to be deleted by user.
6387 // ---
6388 
6389  Float_t* floatArray;
6390  if (size>0) {
6391  floatArray = new Float_t[size];
6392  for (Int_t i=0; i<size; i++)
6393  if (array[i] >= FLT_MAX )
6394  floatArray[i] = FLT_MAX/100.;
6395  else
6396  floatArray[i] = array[i];
6397  }
6398  else {
6399  //floatArray = 0;
6400  floatArray = new Float_t[1];
6401  }
6402  return floatArray;
6403 }
6404 
6405 
6406 //______________________________________________________________________
6407 Float_t* TGeant3::CreateFloatArray(Double_t* array, Int_t size) const
6408 {
6409 // Converts Double_t* array to Float_t*,
6410 // !! The new array has to be deleted by user.
6411 // ---
6412 
6413  Float_t* floatArray;
6414  if (size>0) {
6415  floatArray = new Float_t[size];
6416  for (Int_t i=0; i<size; i++)
6417  if (array[i] >= FLT_MAX )
6418  floatArray[i] = FLT_MAX/100.;
6419  else
6420  floatArray[i] = array[i];
6421  }
6422  else {
6423  //floatArray = 0;
6424  floatArray = new Float_t[1];
6425  }
6426  return floatArray;
6427 }
6428 
6429 
6430 //______________________________________________________________________
6431 void TGeant3::Streamer(TBuffer &R__b)
6432 {
6433  //
6434  // Stream an object of class TGeant3.
6435  //
6436  if (R__b.IsReading()) {
6437  Version_t R__v = R__b.ReadVersion(); if (R__v) { }
6438  TVirtualMC::Streamer(R__b);
6439  R__b >> fNextVol;
6440  R__b >> fNPDGCodes;
6441  //R__b.ReadStaticArray(fPDGCode);
6442  fPDGCode.Streamer(R__b);
6443  } else {
6444  R__b.WriteVersion(TGeant3::IsA());
6445  TVirtualMC::Streamer(R__b);
6446  R__b << fNextVol;
6447  R__b << fNPDGCodes;
6448  //R__b.WriteArray(fPDGCode, fNPDGCodes);
6449  fPDGCode.Streamer(R__b);
6450  }
6451 }
6452 
6453 //______________________________________________________________________
6454 //
6455 // Interfaces to Fortran
6456 //
6457 //______________________________________________________________________
6458 
6459 
6460 //______________________________________________________________________
6461 extern "C" void type_of_call rxgtrak(Int_t &mtrack,Int_t &ipart,Float_t *pmom,
6462  Float_t &e,Float_t *vpos,Float_t *polar,
6463  Float_t &tof)
6464 {
6465  //
6466  // Fetches next track from the ROOT stack for transport. Called by the
6467  // modified version of GTREVE.
6468  //
6469  // Track number in the ROOT stack. If MTRACK=0 no
6470  // mtrack more tracks are left in the stack to be
6471  // transported.
6472  // ipart Particle code in the GEANT conventions.
6473  // pmom[3] Particle momentum in GeV/c
6474  // e Particle energy in GeV
6475  // vpos[3] Particle position
6476  // tof Particle time of flight in seconds
6477  //
6478 
6479  TParticle* track = gMC->GetStack()->PopNextTrack(mtrack);
6480 
6481  if (track) {
6482  // fill G3 arrays
6483  pmom[0] = track->Px();
6484  pmom[1] = track->Py();
6485  pmom[2] = track->Pz();
6486  e = track->Energy();
6487  vpos[0] = track->Vx();;
6488  vpos[1] = track->Vy();
6489  vpos[2] = track->Vz();
6490  tof = track->T();
6491  TVector3 pol;
6492  track->GetPolarisation(pol);
6493  polar[0] = pol.X();
6494  polar[1] = pol.Y();
6495  polar[2] = pol.Z();
6496  ipart = gMC->IdFromPDG(track->GetPdgCode());
6497  }
6498 
6499  mtrack++;
6500 }
6501 
6502 
6503 //______________________________________________________________________
6504 extern "C" void type_of_call rxouth ()
6505 {
6506  //
6507  // Called by Gtreve at the end of each primary track
6508  //
6509  TVirtualMCApplication::Instance()->FinishPrimary();
6510 }
6511 
6512 //______________________________________________________________________
6513 extern "C" void type_of_call rxinh ()
6514 {
6515  //
6516  // Called by Gtreve at the beginning of each primary track
6517  //
6518  TVirtualMCApplication::Instance()->BeginPrimary();
6519 }
6520 
6521 //______________________________________________________________________
6522 void ginvol(Float_t *x, Int_t &isame)
6523 {
6524  fginvol(x,isame);
6525 }
6526 
6527 
6528 //______________________________________________________________________
6529 void gtmedi(Float_t *x, Int_t &numed)
6530 {
6531  fgtmedi(x,numed);
6532 #ifdef STATISTICS
6533  statcode = 2;
6534  statsame = gcchan->lsamvl;
6535  for (int j=0;j<6;j++) if (j <3) oldvect[j] = x[j]; else oldvect[j]=0;
6536  oldsafety = gctrak->safety;
6537  oldstep = gctrak->step;
6538  sprintf(statpath,"%s",geant3->GetPath());
6539  statsnext=gctrak->snext;
6540  statsafety=gctrak->safety;
6541  stattree->Fill();
6542  count_gtmedi++;
6543 #endif
6544 }
6545 
6546 
6547 //______________________________________________________________________
6548 void gmedia(Float_t *x, Int_t &numed, Int_t &check)
6549 {
6550  fgmedia(x,numed,check);
6551 #ifdef STATISTICS
6552  statcode = 1;
6553  statsame = 0;
6554  for (int j=0;j<6;j++) if (j <3) oldvect[j] = x[j]; else oldvect[j]=0;
6555  oldsafety = gctrak->safety;
6556  oldstep = gctrak->step;
6557  sprintf(statpath,"%s",geant3->GetPath());
6558  statsnext=gctrak->snext;
6559  statsafety=gctrak->safety;
6560  stattree->Fill();
6561  count_gmedia++;
6562 #endif
6563 }
6564 
6565 //______________________________________________________________________
6566 void gtmany(Int_t &level1)
6567 {
6568  fgtmany(level1);
6569 }
6570 
6571 //______________________________________________________________________
6572 void gtonlyg3(Int_t &isOnly)
6573 {
6574  //with Geant3, return gonly(nlevel);
6575  isOnly = (Int_t)gcvolu->gonly[gcvolu->nlevel-1];
6576 }
6577 
6578 //______________________________________________________________________
6579 void gtonly(Int_t &isOnly)
6580 {
6581  //with Geant3, return gonly(nlevel);
6582  fgtonly(isOnly);
6583 }
6584 
6585 //______________________________________________________________________
6586 void glvolu(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier)
6587 {
6588  //
6589  // nlev number of levels deep into the volume tree
6590  // size of the arrays lnam and lnum
6591  // lnam an integer array who's 4 bytes contain the ASCII code for the
6592  // volume names
6593  // lnum an integer array containing the copy numbers for that specific
6594  // volume
6595  //
6596  // This routine fills the volume parameters in common /gcvolu/ for a
6597  // physical tree, specified by the list lnam and lnum of volume names
6598  // and numbers, and for all its ascendants up to level 1. This routine
6599  // is optimized and does not re-compute the part of the history already
6600  // available in GCVOLU. This means that if it is used in user programs
6601  // outside the usual framework of the tracking, the user has to initialize
6602  // to zero NLEVEL in the common GCVOLU. It return 0 if there were no
6603  // problems in make the call.
6604  //
6605 // printf("glvolu called\n");
6606 
6607  fglvolu(nlev, lnam, lnum, ier);
6608 }
6609 
6610 
6611 //______________________________________________________________________
6612 void gtnext()
6613 {
6614 #ifdef STATISTICS
6615  count_gtnext++;
6616  statcode = 3;
6617  statsame = 1;
6618  for (int j=0;j<6;j++) oldvect[j] = gctrak->vect[j];
6619  oldsafety = gctrak->safety;
6620  oldstep = gctrak->step;
6621  sprintf(statpath,"%s",geant3->GetPath());
6622 #endif
6623 
6624  fgtnext();
6625 
6626 #ifdef STATISTICS
6627  statsnext=gctrak->snext;
6628  statsafety=gctrak->safety;
6629  stattree->Fill();
6630 #endif
6631 }
6632 //______________________________________________________________________
6633 void ggperp(Float_t *x, Float_t *norm, Int_t &ierr){
6634 // Computes the normal to the next crossed surface, assuming that
6635 // FindNextBoundary() was already called.
6636 
6637  fggperp(x,norm,ierr);
6638 }
6639 //______________________________________________________________________
6640 Bool_t TGeant3::GetTransformation(const TString &volumePath,TGeoHMatrix &mat){
6641  // Returns the Transformation matrix between the volume specified
6642  // by the path volumePath and the Top or mater volume. The format
6643  // of the path volumePath is as follows (assuming ALIC is the Top volume)
6644  // "/ALIC_1/DDIP_1/S05I_2/S05H_1/S05G_3". Here ALIC is the top most
6645  // or master volume which has only 1 instance of. Of all of the daughter
6646  // volumes of ALICE, DDIP volume copy #1 is indicated. Similarly for
6647  // the daughter volume of DDIP is S05I copy #2 and so on.
6648  // Inputs:
6649  // TString& volumePath The volume path to the specific volume
6650  // for which you want the matrix. Volume name
6651  // hierarchy is separated by "/" while the
6652  // copy number is appended using a "_".
6653  // Outputs:
6654  // TGeoHMatrix &mat A matrix with its values set to those
6655  // appropriate to the Local to Master transformation
6656  // Return:
6657  // A logical value if kFALSE then an error occurred and no change to
6658  // mat was made.
6659  Int_t i,n,k,*lnam=0,*lnum=0;
6660  // Default rotation matrix, Unit
6661  Double_t m[9] = {1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0};
6662  Double_t s[3] = {1.0,1.0,1.0}; // Default scale, Unit
6663  Double_t t[3] = {0.0,0.0,0.0}; // Default translation, none.
6664 
6665  k =ConvertVolumePathString(volumePath,&lnam,&lnum);//Creates lnam, and lnum
6666  if(k<=0) { // Error from Convert volumePathString.
6667  delete[] lnam;
6668  delete[] lnum;
6669  return kFALSE;
6670  } // end if k<=0
6671  if(k==1){// only one volume listed, must be top most, return unit..
6672  delete[] lnam;
6673  delete[] lnum;
6674  mat.SetRotation(m);
6675  mat.SetTranslation(t);
6676  mat.SetScale(s);
6677  return kTRUE;
6678  } // end if k==1
6679  this->Gcvolu()->nlevel = 0;
6680  i = this->Glvolu(k,lnam,lnum);
6681  n = this->Gcvolu()->nlevel -1;
6682  delete[] lnam; // created in ConvertVolumePathString.
6683  delete[] lnum; // created in ConvertVolumePathString.
6684  if(i!=0) return kFALSE; // Error
6685  mat.SetScale(s); // Geant scale always 1.
6686  if(!((this->Gcvolu()->grmat[n][9])==0.0)) { // not Unit matrix
6687  for(i=0;i<9;i++) m[i] = (Double_t) this->Gcvolu()->grmat[n][i];
6688  } // end if
6689  mat.SetRotation(m);
6690  for(i=0;i<3;i++) t[i] = (Double_t) (this->Gcvolu()->gtran[n][i]);
6691  mat.SetTranslation(t);
6692  return kTRUE;
6693 }/*
6694 //______________________________________________________________________
6695 Bool_t TGeant3::GetShape(const TString &volumeName,TString &shapeType,
6696  TArrayD &par){
6697  // Returns the shape and its parameters for the volume specified
6698  // by volumeName.
6699  // Inputs:
6700  // TString& volumeName The volume name
6701  // Outputs:
6702  // TString &shapeType Shape type
6703  // TArrayD &par A TArrayD of parameters with all of the
6704  // parameters of the specified shape.
6705  // Return:
6706  // A logical indicating whether there was an error in getting this
6707  // information
6708  const Int_t nshapes = 16;
6709  const Char_t *vname[nshapes] = {"BOX","TRD1","TRD2","TRAP","TUBE","TUBS",
6710  "CONE","CONS","SPHE","PARA","PGON","PCON",
6711  "ELTU","HYPE","GTRA","CTUB"};
6712  Int_t volid,i,jv0,ishape,npar;
6713  Float_t *qpar;
6714 
6715  volid = VolId(volumeName.Data());
6716  if(volid==0) return kFALSE; // Error.
6717  jv0 = this->Lq()[this->Gclink()->jvolum-volid];
6718  ishape = (Int_t)(this->Q()[jv0+2]);
6719  if(ishape<1||ishape>nshapes) return kFALSE; // error unknown shape
6720  npar = (Int_t)(this->Q()[jv0+5]);
6721  qpar = (this->Q())+jv0+7;
6722  par.Set(npar); // Resize TArrayD
6723  for(i=0;i<npar;i++) par.AddAt(((Double_t)qpar[i]),i);
6724  shapeType = vname[ishape-1];
6725  return kTRUE;
6726 }*/
6727 
6728 //______________________________________________________________________
6729 Bool_t TGeant3::GetShape(const TString &volumePath,TString &shapeType,
6730  TArrayD &par){
6731  // Returns the shape and its parameters for the volume specified
6732  // by the path volumePath. The format of the path volumePath is as
6733  // follows (assuming ALIC is the Top volume)
6734  // "/ALIC_1/DDIP_1/S05I_2/S05H_1/S05G_3". Here ALIC is the top most
6735  // or master volume which has only 1 instance of. Of all of the daughter
6736  // volumes of ALICE, DDIP volume copy #1 is indicated. Similarly for
6737  // the daughter volume of DDIP is S05I copy #2 and so on.
6738  // Inputs:
6739  // TString& volumePath The volume path to the specific volume
6740  // for which you want the matrix. Volume name
6741  // hierarchy is separated by "/" while the
6742  // copy number is appended using a "_".
6743  // Outputs:
6744  // TString &shapeType Shape type
6745  // TArrayD &par A TArrayD of parameters with all of the
6746  // parameters of the specified shape.
6747  // Return:
6748  // A logical indicating whether there was an error in getting this
6749  // information
6750  const Int_t nshapes = 16;
6751  const Char_t *vname[nshapes] = {"BOX","TRD1","TRD2","TRAP","TUBE","TUBS",
6752  "CONE","CONS","SPHE","PARA","PGON","PCON",
6753  "ELTU","HYPE","GTRA","CTUB"};
6754  Int_t volid,i,k,jv0,ishape,npar,*lnam=0,*lnum=0;
6755  Float_t *qpar;
6756 
6757  k=ConvertVolumePathString(volumePath,&lnam,&lnum);//Creates lnam, and lnum
6758  if(k<=0) { // Error from Convert volumePathString.
6759  delete[] lnam;
6760  delete[] lnum;
6761  return kFALSE;
6762  } // end if k<=0
6763  this->Gcvolu()->nlevel = 0;
6764  i = this->Glvolu(k,lnam,lnum);
6765  delete[] lnam;
6766  delete[] lnum;
6767  if(i!=0) {// error
6768  par.Set(0);
6769  return kFALSE;
6770  } // end if i!=1
6771  volid = this->Gcvolu()->lvolum[this->Gcvolu()->nlevel-1];
6772  jv0 = this->Lq()[this->Gclink()->jvolum-volid];
6773  ishape = (Int_t)(this->Q()[jv0+2]);
6774  if(ishape<1||ishape>nshapes) return kFALSE; // error unknown shape
6775  npar = (Int_t)(this->Q()[jv0+5]);
6776  qpar = (this->Q())+jv0+7;
6777  par.Set(npar); // Resize TArrayD
6778  for(i=0;i<npar;i++) par.AddAt((Double_t)qpar[i],i);
6779  shapeType = vname[ishape-1];
6780  shapeType = shapeType.Strip();
6781  return kTRUE;
6782 }
6783 //______________________________________________________________________
6784 Bool_t TGeant3::GetMaterial(const TString &volumeName,
6785  TString &name,Int_t &imat,
6786  Double_t &a,Double_t &z,Double_t &dens,
6787  Double_t &radl,Double_t &inter,TArrayD &par){
6788  // Returns the Material and its parameters for the volume specified
6789  // by volumeName.
6790  // Note, Geant3 stores and uses mixtures as an element with an effective
6791  // Z and A. Consequently, if the parameter Z is not integer, then
6792  // this material represents some sort of mixture.
6793  // Inputs:
6794  // TString& volumeName The volume name
6795  // Outputs:
6796  // TSrting &name Material name
6797  // Int_t &imat Material index number
6798  // Double_t &a Average Atomic mass of material
6799  // Double_t &z Average Atomic number of material
6800  // Double_t &dens Density of material [g/cm^3]
6801  // Double_t &radl Average radiation length of material [cm]
6802  // Double_t &inter Average interaction length of material [cm]
6803  // TArrayD &par A TArrayD of user defined parameters.
6804  // Return:
6805  // kTRUE if no errors
6806  Int_t i,volid,jma,nbuf;
6807  Float_t af,zf,densf,radlf,interf;
6808  Float_t *ubuf;
6809  Char_t *ch,namec[20] = {20*'\0'};
6810 
6811  volid = VolId(volumeName.Data());
6812  if(volid==0) return kFALSE; // Error
6813  if(volid>0){ // Get Material number, imat.
6814  Int_t imed = (Int_t) (this->Q()[this->Lq()[
6815  this->Gclink()->jvolum-volid]+4]);
6816  Int_t jtm = this->Lq()[this->Gclink()->jtmed-imed];
6817  imat = (Int_t)(this->Q()[jtm+6]);
6818  } else {
6819  i = this->Gclink()->jvolum + volid;
6820  Int_t jdiv = this->Lq()[i];
6821  Int_t ivin = (Int_t) (this->Q()[jdiv+2]);
6822  i = this->Gclink()->jvolum - ivin;
6823  Int_t jvin = this->Lq()[i];
6824  Int_t idmed = (Int_t)(this->Q()[jvin+4]);
6825  i = this->Gclink()->jtmed-idmed;
6826  Int_t jtm = this->Lq()[i];
6827  imat = (Int_t)(this->Q()[jtm+6]);
6828  } // end if-else
6829  nbuf = jma = this->Lq()[this->Gclink()->jmate-imat];
6830  ubuf = new Float_t[nbuf];
6831  Gfmate(imat,namec,af,zf,densf,radlf,interf,ubuf,nbuf);
6832  // Problem with getting namec back from Gfmate, get it from
6833  // the Zebra bank directly.
6834  ch = (char *)(this->Iq()+jma+1);
6835  for(i=0;i<20;i++) if(ch[i]!=' ') namec[i] = ch[i];
6836  name = namec;
6837  name = name.Strip();
6838  //
6839  par.Set(nbuf);
6840  for(i=0;i<nbuf;i++) par.AddAt(((Double_t)ubuf[i]),i);
6841  delete[] ubuf;
6842  a = (Double_t) af;
6843  z = (Double_t) zf;
6844  dens = (Double_t) densf;
6845  radl = (Double_t) radlf;
6846  inter = (Double_t) interf;
6847  return kTRUE;
6848 }
6849 //______________________________________________________________________
6850 Bool_t TGeant3::GetMedium(const TString &volumeName,TString &name,
6851  Int_t &imed,Int_t &nmat,Int_t &isvol,Int_t &ifield,
6852  Double_t &fieldm,Double_t &tmaxfd,Double_t &stemax,
6853  Double_t &deemax,Double_t &epsil, Double_t &stmin,
6854  TArrayD &par){
6855  // Returns the Medium and its parameters for the volume specified
6856  // by volumeName.
6857  // Inputs:
6858  // TString& volumeName The volume name.
6859  // Outputs:
6860  // TString &name Medium name
6861  // Int_t &nmat Material number defined for this medium
6862  // Int_t &imed The medium index number
6863  // Int_t &isvol volume number defined for this medium
6864  // Int_t &iflield Magnetic field flag
6865  // Double_t &fieldm Magnetic field strength
6866  // Double_t &tmaxfd Maximum angle of deflection per step
6867  // Double_t &stemax Maximum step size
6868  // Double_t &deemax Maximum fraction of energy allowed to be lost
6869  // to continuous process.
6870  // Double_t &epsil Boundary crossing precision
6871  // Double_t &stmin Minimum step size allowed
6872  // TArrayD &par A TArrayD of user parameters with all of the
6873  // parameters of the specified medium.
6874  // Return:
6875  // kTRUE if there where no errors
6876  Int_t i,volid,nbuf;
6877  Float_t fieldmf,tmaxfdf,stemaxf,deemaxf,epsilf,stminf;
6878  Float_t *buf;
6879  Char_t namec[25] = {25*'\0'};
6880 
6881  volid = VolId(volumeName.Data());
6882  if(volid==0) return kFALSE; // Error
6883  if(volid>0){ // Get Material number, imat.
6884  imed = (Int_t)(this->Q()[this->Lq()[this->Gclink()->jvolum-volid]+4]);
6885  } else {
6886  Int_t jdiv = this->Lq()[this->Gclink()->jvolum + volid];
6887  Int_t ivin = (Int_t) (this->Q()[jdiv+2]);
6888  Int_t jvin = this->Lq()[this->Gclink()->jvolum - ivin];
6889  imed = (Int_t)(this->Q()[jvin+4]);
6890  } // end if-else
6891  nbuf = this->Lq()[this->Gclink()->jtmed-imed];
6892  buf = new Float_t[nbuf];
6893  Gftmed(imed,namec,nmat,isvol,ifield,fieldmf,tmaxfdf,stemaxf,deemaxf,
6894  epsilf,stminf,buf,&nbuf);
6895  name = namec;
6896  name = name.Strip();
6897  par.Set(nbuf);
6898  for(i=0;i<nbuf;i++) par.AddAt(((Double_t)buf[i]),i);
6899  delete[] buf;
6900  fieldm = (Double_t) fieldmf;
6901  tmaxfd = (Double_t) tmaxfdf;
6902  stemax = (Double_t) stemaxf;
6903  deemax = (Double_t) deemaxf;
6904  epsil = (Double_t) epsilf;
6905  stmin = (Double_t) stminf;
6906  return kTRUE;
6907 }
6908 //____________________________private method____________________________
6909 Int_t TGeant3::ConvertVolumePathString(const TString &volumePath,
6910  Int_t **lnam,Int_t **lnum){
6911  // Parses the TString volumePath into an array of volume names
6912  // (4 character long limit) and copy numbers in a form used
6913  // by Geant3.
6914  // Inputs:
6915  // TString& volumePath The volume path to the specific volume
6916  // for which you want the matrix. Volume name
6917  // hierarchy is separated by "/" while the
6918  // copy number is appended using a "_".
6919  // Outputs:
6920  // Int_t lnam An integer array, created by this routine,
6921  // containing the 4 character long volume names.
6922  // Int_t lnum An integer array, created by this routine,
6923  // containing the copy numbers.
6924  // Return:
6925  // The size of the arrays lnam an lnum, the number of volumes down
6926  // the geometry tree. Note, These arrays are allocated within this
6927  // routine, but must be deleted outside of this routine.
6928  Int_t i,j=0,k=0,ireturn,ichar,*inam;
6929  Char_t *buf,**levels,**copies,nam[4];
6930 
6931  inam = (Int_t*)nam; // Setup to convert character string to integer.
6932  buf = new Char_t[volumePath.Length()+1];
6933  for(i=0;i<volumePath.Length();i++) {
6934  if(volumePath[i]!=' ')buf[j++] = volumePath[i]; // remove blanks
6935  if(volumePath[i]=='/') k++;
6936  } // end for i
6937  buf[j] = '\0';
6938  if(buf[j-1]=='/') {k--; buf[j-1]='\0';}// if path ends with '/' ignore
6939  // it, remove it.
6940  levels = new Char_t*[k];
6941  copies = new Char_t*[k];
6942  (*lnam) = new Int_t[k]; // Allocate Geant3 volume name array
6943  (*lnum) = new Int_t[k]; // Allocate Geant3 copy number array
6944  ireturn = k;
6945  ichar = j;
6946  k = 0;
6947  j = 0;
6948  for(i=0;i<ichar;i++) {
6949  if(buf[i]=='/'){
6950  levels[k++] = &(buf[i+1]);
6951  buf[i] = '\0'; // Terminate this sub string.
6952  } // end if == '/'
6953  if(buf[i]=='_'){
6954  copies[j++] = &(buf[i+1]);
6955  buf[i] = '\0'; // Terminate this sub string.
6956  } // end if =='_'
6957  } // end for i
6958  if(k!=j){ // Error, different number of copy numbers and volume names.
6959  // clean up everything.
6960  delete[] buf;
6961  delete[] levels;
6962  delete[] copies;
6963  delete[] (*lnam);
6964  delete[] (*lnum);
6965  (*lnam) = 0;
6966  (*lnum) = 0;
6967  Error("ConvertVolumePathString","Different number of volume names %d"
6968  " and copy numbers %d in volumePath:%s",k,j,volumePath.Data());
6969  return 0;
6970  } // end if k!=j
6971  for(i=0;i<k;i++){
6972  *inam = 0;
6973  (*lnum)[i] = atoi(copies[i]);
6974  for(j=0;j<4;j++) {
6975  if(levels[i][j] == 0) break; // If at end of string exit loop
6976  nam[j] = levels[i][j];
6977  } // end for j
6978  (*lnam)[i] = *inam;
6979  } // end for i
6980  // clean up all but lnam and lnum
6981  delete[] buf;
6982  delete[] levels;
6983  delete[] copies;
6984  return ireturn; // return the size of lnam and lnum.
6985 }
6986 
6987 //__________________________________________________________________
6988 void TGeant3::Gfang( Float_t* p, Float_t& costh, Float_t& sinth,
6989  Float_t& cosph, Float_t& sinph, Int_t& rotate)
6990 {
6991 
6992  g3fang(p, costh, sinth, cosph, sinph, rotate );
6993 }
6994 
6995 //__________________________________________________________________
6996 Int_t TGeant3::GetIonPdg(Int_t z, Int_t a, Int_t i) const
6997 {
6998 // Acording to
6999 // http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
7000 
7001  return 1000000000 + 10*1000*z + 10*a + i;
7002 }
7003 
7004 //__________________________________________________________________
7005 Int_t TGeant3::GetSpecialPdg(Int_t number) const
7006 {
7007 // Numbering for special particles
7008 
7009  return 50000000 + number;
7010 }
#define g3sxyz
Definition: TGeant3.cxx:570
virtual void Vname(const char *name, char *vname)
Definition: TGeant3.cxx:5357
void StopTrack()
Definition: TGeant3.cxx:2537
virtual void SetUserParameters(Bool_t isUserParameters)
Definition: TGeant3.cxx:2994
Int_t istop
Definition: TGeant3.h:268
Int_t iclose
Definition: TGeant3.h:352
virtual TString ParticleName(Int_t pdg) const
Definition: TGeant3.cxx:2125
#define PASSCHARL(string)
Definition: TCallf77.h:12
void TrackPosition(TLorentzVector &xyz) const
Definition: TGeant3.cxx:2213
Int_t NSecondaries() const
Definition: TGeant3.cxx:2375
virtual void Trscsd(Float_t *pc, Float_t *rc, Float_t *pd, Float_t *rd, Float_t *h, Float_t ch, Int_t ierr, Float_t spu, Float_t *dj, Float_t *dk)
Definition: TGeant3.cxx:5546
Int_t count_gtnext
Definition: TGeant3.cxx:1077
#define g3cinit
Definition: TGeant3.cxx:538
#define g3svolu
Definition: TGeant3.cxx:592
Gcflag_t * fGcflag
GCKINE common structure.
Definition: TGeant3.h:1159
Float_t pfinal[3]
Definition: TGeant3.h:353
Int_t nepred
Definition: TGeant3.h:544
#define gmedia
Definition: TGeant3.cxx:986
static const double m
Definition: Units.h:79
virtual void Gphysi()
Definition: TGeant3.cxx:3704
#define g3ftmed
Definition: TGeant3.cxx:547
virtual void SetABAN(Int_t par=1)
Definition: TGeant3.cxx:4813
#define DEFCHARD
Definition: TCallf77.h:9
virtual void Gckmat(Int_t itmed, char *natmed)
Definition: TGeant3.cxx:4511
Int_t idcay
Definition: TGeant3.h:443
#define g3prelm
Definition: TGeant3.cxx:617
virtual void InitGEANE()
Definition: TGeant3.cxx:1227
Bool_t IsTrackExiting() const
Definition: TGeant3.cxx:2348
virtual void Gdspec(const char *name)
Definition: TGeant3.cxx:4759
Int_t GetMaxNStep() const
Definition: TGeant3.cxx:2604
#define g3srotm
Definition: TGeant3.cxx:590
Gcphlt_t * fGcphlt
GCPHYS common structure.
Definition: TGeant3.h:1162
virtual void BuildPhysics()
Definition: TGeant3.cxx:1329
virtual void SetCKOV(Int_t par=1)
Definition: TGeant3.cxx:4888
virtual void SetBorderSurface(const char *name, const char *vol1Name, int vol1CopyNo, const char *vol2Name, int vol2CopyNo, const char *opSurfaceName)
Definition: TGeant3.cxx:3544
Bool_t IsTrackStop() const
Definition: TGeant3.cxx:2366
void ForceDecayTime(Float_t time)
Definition: TGeant3.cxx:2593
virtual void SetANNI(Int_t par=1)
Definition: TGeant3.cxx:4827
void(* fgtmany)(Int_t &)=0
Definition: TGeant3.cxx:1090
virtual void SetSWIT(Int_t sw, Int_t val=1)
Definition: TGeant3.cxx:5251
void(* fglvolu)(Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)=0
Definition: TGeant3.cxx:1093
#define g3protm
Definition: TGeant3.cxx:591
virtual void SetCUTS(Float_t cutgam, Float_t cutele, Float_t cutneu, Float_t cuthad, Float_t cutmuo, Float_t bcute, Float_t bcutm, Float_t dcute, Float_t dcutm, Float_t ppcutm, Float_t tofmax, Float_t *gcuts)
Definition: TGeant3.cxx:4948
Bool_t DefineParticle(Int_t pdg, const char *name, TMCParticleType mcType, Double_t mass, Double_t charge, Double_t lifetime)
Definition: TGeant3.cxx:2026
virtual Int_t Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf=0, Int_t nwbuf=0)
Definition: TGeant3.cxx:3684
Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const
Definition: TGeant3.cxx:1196
Float_t gpos[MXGKIN][3]
Definition: TGeant3.h:202
Eropts_t * fEropts
ERTRIO1 common structure.
Definition: TGeant3.h:1124
virtual void SetPFIS(Int_t par=1)
Definition: TGeant3.cxx:5204
#define gtmedi
Definition: TGeant3.cxx:983
Bool_t IsTrackEntering() const
Definition: TGeant3.cxx:2339
virtual Double_t Edep() const
Definition: TGeant3.cxx:3045
Float_t pkine[10]
Definition: TGeant3.h:164
Gcjump_t * fGcjump
GCONSX common structure.
Definition: TGeant3.h:1173
#define grndmq
Definition: TGeant3.cxx:576
Quest_t * fQuest
Good Old Q of Zebra.
Definition: TGeant3.h:1144
virtual void LoadAddress()
Definition: TGeant3.cxx:1245
#define g3many
Definition: TGeant3.cxx:571
virtual void ProcessEvent()
Definition: TGeant3.cxx:6292
virtual void SetBREM(Int_t par=1)
Definition: TGeant3.cxx:4875
virtual void Gdhead(Int_t isel, const char *name, Double_t chrsiz=0.6)
Definition: TGeant3.cxx:4719
static const double ps
Definition: Units.h:103
#define g3sking
Definition: TGeant3.cxx:567
virtual void Ggclos()
Definition: TGeant3.cxx:3108
Gctlit_t * fGctlit
GCOPTI common structure.
Definition: TGeant3.h:1155
#define gtnext
Definition: TGeant3.cxx:988
#define g3fang
Definition: TGeant3.cxx:553
const char * VolDaughterName(const char *volName, Int_t i) const
Definition: TGeant3.cxx:1880
Gcvolu_t * fGcvolu
GCVDMA common structure.
Definition: TGeant3.h:1157
Float_t safety
Definition: TGeant3.h:258
virtual void Gsatt(const char *name, const char *att, Int_t val)
Definition: TGeant3.cxx:4397
Double_t TrackLength() const
Definition: TGeant3.cxx:2312
virtual void Gprint(const char *name)
Definition: TGeant3.cxx:3150
Float_t * CreateFloatArray(Float_t *array, Int_t size) const
Definition: TGeant3.cxx:6383
#define g3helix
Definition: TGeant3.cxx:971
virtual void GdtreeParent(const char *name, Int_t levmax=15, Int_t ispec=0)
Definition: TGeant3.cxx:4801
static const double ns
Definition: Units.h:102
const char * GetNodeName()
Definition: TGeant3.cxx:3030
#define g3rkuta
Definition: TGeant3.cxx:972
virtual void Init()
Definition: TGeant3.cxx:6225
Float_t p2[3]
Definition: TGeant3.h:358
Int_t fNG3Particles
Names of geant medias as TObjString.
Definition: TGeant3.h:1183
#define g3track
Definition: TGeant3.cxx:973
virtual void Gfile(const char *filename, const char *option="I")
Definition: TGeant3.cxx:3069
#define g3invol
Definition: TGeant3.cxx:976
Int_t iloss
Definition: TGeant3.h:448
virtual void Gskpho(Int_t igk)
Definition: TGeant3.cxx:3768
Float_t p3[3]
Definition: TGeant3.h:359
virtual void Ertrak(const Float_t *x1, const Float_t *p1, const Float_t *x2, const Float_t *p2, Int_t ipa, Option_t *chopt)
Definition: TGeant3.cxx:5380
virtual ~TGeant3()
Definition: TGeant3.cxx:1187
Int_t ievent
Definition: TGeant3.h:152
virtual void Gzinit()
Definition: TGeant3.cxx:3212
Gcnum_t * fGcnum
GCTPOL common structure.
Definition: TGeant3.h:1152
TArrayI fPDGCode
Definition: TGeant3.h:1186
virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Double_t c0i, Int_t numed)
Definition: TGeant3.cxx:4029
char fPath[512]
Definition: TGeant3.h:1138
#define g3dtom
Definition: TGeant3.cxx:577
Int_t ioptim
Definition: TGeant3.h:482
#define g3zinit
Definition: TGeant3.cxx:544
Float_t z
Definition: TGeant3.h:211
#define g3fpara
Definition: TGeant3.cxx:596
Float_t p1[3]
Definition: TGeant3.h:357
virtual void Gsdvt(const char *name, const char *mother, Double_t step, Int_t iaxis, Int_t numed, Int_t ndvmx)
Definition: TGeant3.cxx:4082
virtual void SetDCAY(Int_t par=1)
Definition: TGeant3.cxx:5044
static const Int_t kDefSize
Definition: TGeant3.cxx:1073
Float_t * fZq
Good Old LQ of Zebra.
Definition: TGeant3.h:1142
Int_t count_gmedia
Definition: TGeant3.cxx:1075
#define g3gclos
Definition: TGeant3.cxx:535
Gccuts_t * fGccuts
GCLINK common structure.
Definition: TGeant3.h:1147
#define glvolu
Definition: TGeant3.cxx:987
TMCParticleType ParticleType(Int_t itrtyp) const
Definition: TGeant3.cxx:6163
Int_t imuls
Definition: TGeant3.h:453
#define g3smate
Definition: TGeant3.cxx:552
Float_t errin[15]
Definition: TGeant3.h:537
#define MAXMEC
Definition: TGeant3.h:239
#define g3skine
Definition: TGeant3.cxx:561
virtual Gcvolu_t * Gcvolu() const
Definition: TGeant3.h:820
virtual void SetRootGeometry()
Definition: TGeant3.cxx:2981
Gcbank_t * fGcbank
QUEST common structure.
Definition: TGeant3.h:1145
Bool_t IsTrackOut() const
Definition: TGeant3.cxx:2357
#define gtonly
Definition: TGeant3.cxx:985
Eroptc_t * fEroptc
EROPTS common structure.
Definition: TGeant3.h:1125
Int_t TrackPid() const
Definition: TGeant3.cxx:2294
Gcphys_t * fGcphys
GCTMED common structure.
Definition: TGeant3.h:1161
virtual Bool_t ProcessRun(Int_t nevent)
Definition: TGeant3.cxx:6255
#define g3part
Definition: TGeant3.cxx:550
#define g3sckov
Definition: TGeant3.cxx:557
void TrackMomentum(TLorentzVector &xyz) const
Definition: TGeant3.cxx:2247
virtual void Trscsp(Float_t *ps, Float_t *rs, Float_t *pc, Float_t *rc, Float_t *h, Float_t *ch, Int_t *ierr, Float_t *spx)
Definition: TGeant3.cxx:5605
void type_of_call g3rfile(const Int_t &, DEFCHARD, DEFCHARD DEFCHARL DEFCHARL)
Int_t maxnst
Definition: TGeant3.h:255
virtual void Gsmate(Int_t imat, const char *name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl)
Definition: TGeant3.cxx:3353
Erwork_t * fErwork
EROPTC common structure.
Definition: TGeant3.h:1126
Float_t cutneu
Definition: TGeant3.h:335
virtual void Gtrigi()
Definition: TGeant3.cxx:3194
#define g3sord
Definition: TGeant3.cxx:587
virtual void Gdopt(const char *name, const char *value)
Definition: TGeant3.cxx:4592
Float_t erleng[MXPRED]
Definition: TGeant3.h:569
Int_t number[15]
Definition: TGeant3.h:287
#define g3media
Definition: TGeant3.cxx:978
virtual void Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim, Float_t *tkin, Float_t *value, Float_t *pcut, Int_t &ixst)
Definition: TGeant3.cxx:3295
#define trspsc
Definition: TGeant3.cxx:609
#define g3sdvs2
Definition: TGeant3.cxx:584
Int_t iovler[MXPRED]
Definition: TGeant3.h:572
#define g3sdk
Definition: TGeant3.cxx:551
#define g3gperp
Definition: TGeant3.cxx:981
virtual void DefineOpSurface(const char *name, EMCOpSurfaceModel model, EMCOpSurfaceType surfaceType, EMCOpSurfaceFinish surfaceFinish, Double_t sigmaAlpha)
Definition: TGeant3.cxx:3534
virtual void SetDEBU(Int_t emin=1, Int_t emax=999, Int_t emod=1)
Definition: TGeant3.cxx:5057
virtual void Gsdvt2(const char *name, const char *mother, Double_t step, Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
Definition: TGeant3.cxx:4107
const char * VolName(Int_t id) const
Definition: TGeant3.cxx:1928
virtual void Eufilp(const Int_t n, Float_t *ein, Float_t *pli, Float_t *plf)
Definition: TGeant3.cxx:5466
Int_t icomp
Definition: TGeant3.h:403
void(* fgtnext)()=0
Definition: TGeant3.cxx:1094
Int_t iphot
Definition: TGeant3.h:408
#define g3spart
Definition: TGeant3.cxx:555
virtual void SetPAIR(Int_t par=1)
Definition: TGeant3.cxx:5191
Int_t ikine
Definition: TGeant3.h:163
#define g3fvert
Definition: TGeant3.cxx:560
Float_t wire2[3]
Definition: TGeant3.h:356
Int_t itckov
Definition: TGeant3.h:493
virtual void Gdshow(Int_t view)
Definition: TGeant3.cxx:4581
Int_t ianni
Definition: TGeant3.h:423
virtual void Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart, Int_t &nvert)
Definition: TGeant3.cxx:3616
Float_t ekmin
Definition: TGeant3.h:372
virtual void Mixture(Int_t &kmat, const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)
Definition: TGeant3.cxx:2746
Int_t PDGFromId(Int_t pdg) const
Definition: TGeant3.cxx:1487
virtual void Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
Definition: TGeant3.cxx:3957
#define gcomad
Definition: TGeant3.cxx:614
#define g3finds
Definition: TGeant3.cxx:566
char(* fVolNames)[5]
GCJUMP common structure.
Definition: TGeant3.h:1180
#define g3treve
Definition: TGeant3.cxx:573
Int_t count_gtmedi
Definition: TGeant3.cxx:1076
virtual void Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat)
Definition: TGeant3.cxx:3385
Int_t istra
Definition: TGeant3.h:476
#define g3sposp
Definition: TGeant3.cxx:589
Int_t ihadr
Definition: TGeant3.h:433
virtual void DrawOneSpec(const char *name)
Definition: TGeant3.cxx:4773
Float_t stemax
Definition: TGeant3.h:227
bool check(const std::vector< std::vector< float > > &outputs)
Int_t ibrem
Definition: TGeant3.h:428
virtual void Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex)
Definition: TGeant3.cxx:3457
Float_t cleng[3]
Definition: TGeant3.h:360
virtual void SetCOMP(Int_t par=1)
Definition: TGeant3.cxx:4933
Bool_t IsTrackDisappeared() const
Definition: TGeant3.cxx:2516
virtual void Gtrig()
Definition: TGeant3.cxx:3171
virtual void Gpart()
Definition: TGeant3.cxx:3335
Float_t a
Definition: TGeant3.h:210
#define eufilv
Definition: TGeant3.cxx:607
#define g3trig
Definition: TGeant3.cxx:540
virtual Float_t Gbrelm(Float_t z, Float_t t, Float_t cut)
Definition: TGeant3.cxx:3308
virtual TMCParticleType ParticleMCType(Int_t pdg) const
Definition: TGeant3.cxx:2182
#define g3smixt
Definition: TGeant3.cxx:554
void type_of_call setbomb(Float_t &)
Int_t count_ginvol
Definition: TGeant3.cxx:1074
Int_t VolId2Mate(Int_t id) const
Definition: TGeant3.cxx:1914
Int_t G3Gsvolu(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t np)
Definition: TGeant3.cxx:4275
#define g3stpar
Definition: TGeant3.cxx:558
virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis)
Definition: TGeant3.cxx:4005
Gcking_t * fGcking
GCPHLT common structure.
Definition: TGeant3.h:1163
static const double km
Definition: Units.h:72
Float_t destep
Definition: TGeant3.h:256
#define gfmfin
Definition: TGeant3.cxx:966
Float_t gcuts[5]
Definition: TGeant3.h:344
virtual void Grun()
Definition: TGeant3.cxx:3162
virtual Double_t Etot() const
Definition: TGeant3.cxx:3054
#define mzdrop
Definition: TGeant3.cxx:601
virtual void SetRAYL(Int_t par=1)
Definition: TGeant3.cxx:5228
double y
virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl, Float_t *ubuf, Int_t &nbuf)
Definition: TGeant3.cxx:3227
#define g3fkine
Definition: TGeant3.cxx:559
virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex)
Definition: TGeant3.cxx:3479
Float_t erpli[3 *2]
Definition: TGeant3.h:567
Float_t cuthad
Definition: TGeant3.h:336
virtual void Gdopen(Int_t view)
Definition: TGeant3.cxx:4555
Gclink_t * fGclink
GCBANK common structure.
Definition: TGeant3.h:1146
Int_t NofVolDaughters(const char *volName) const
Definition: TGeant3.cxx:1866
#define ginvol
Definition: TGeant3.cxx:982
void G3Mixture(Int_t &kmat, const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)
Definition: TGeant3.cxx:2713
#define g3tmany
Definition: TGeant3.cxx:979
void(* fgtmedi)(Float_t *, Int_t &)=0
Definition: TGeant3.cxx:1089
virtual Double_t ParticleCharge(Int_t pdg) const
Definition: TGeant3.cxx:2154
#define g3debug
Definition: TGeant3.cxx:564
virtual void Eufilv(Int_t n, Float_t *ein, Char_t *namv, Int_t *numv, Int_t *iovl)
Definition: TGeant3.cxx:5511
virtual void Gsdvs2(const char *name, const char *mother, Float_t step, Int_t iaxis, Float_t c0, Int_t numed)
Definition: TGeant3.cxx:4066
virtual void InitLego()
Definition: TGeant3.cxx:2506
virtual void InitHIGZ()
Definition: TGeant3.cxx:1219
virtual void GetClose(Float_t *p1, Float_t *p2, Float_t *p3, Float_t *len)
Definition: TGeant3.cxx:5027
Int_t GetSpecialPdg(Int_t number) const
Definition: TGeant3.cxx:7005
Int_t * fZlq
Good Old IQ of Zebra.
Definition: TGeant3.h:1141
Gconst_t * gconst
Definition: TGeant3.cxx:1080
const double e
Int_t IdFromPDG(Int_t pdg) const
Definition: TGeant3.cxx:1476
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:228
virtual void Gdclose()
Definition: TGeant3.cxx:4572
Gcmore_t * fGcmore
GCCUTS common structure.
Definition: TGeant3.h:1148
virtual Int_t CurrentMedium() const
Definition: TGeant3.cxx:2950
#define trscsp
Definition: TGeant3.cxx:608
Float_t sleng
Definition: TGeant3.h:259
Float_t vect[7]
Definition: TGeant3.h:247
virtual void Gpcxyz()
Definition: TGeant3.cxx:3099
void(* fginvol)(Float_t *, Int_t &)=0
Definition: TGeant3.cxx:1088
#define gtreveroot
Definition: TGeant3.cxx:974
virtual void Gmate()
Definition: TGeant3.cxx:3326
Int_t CurrentVolOffID(Int_t off, Int_t &copy) const
Definition: TGeant3.cxx:1407
Int_t idray
Definition: TGeant3.h:418
void(* fgmedia)(Float_t *, Int_t &, Int_t &)=0
Definition: TGeant3.cxx:1092
Int_t CurrentVolID(Int_t &copy) const
Definition: TGeant3.cxx:1388
virtual void Gsdvs(const char *name, const char *mother, Float_t step, Int_t iaxis, Int_t numed)
Definition: TGeant3.cxx:4050
#define g3ckmat
Definition: TGeant3.cxx:598
Float_t gonly[15]
Definition: TGeant3.h:296
#define g3stmed
Definition: TGeant3.cxx:556
Int_t StepProcesses(TArrayI &proc) const
Definition: TGeant3.cxx:2428
#define dzshow
Definition: TGeant3.cxx:594
#define DEFCHARL
Definition: TCallf77.h:10
#define g3spos
Definition: TGeant3.cxx:588
void G3Material(Int_t &kmat, const char *name, Double_t a, Double_t z, Double_t dens, Double_t radl, Double_t absl, Float_t *buf=0, Int_t nwbuf=0)
Definition: TGeant3.cxx:2613
#define g3work
Definition: TGeant3.cxx:543
virtual void Trsdsc(Float_t *pd, Float_t *rd, Float_t *pc, Float_t *rc, Float_t *h, Float_t *ch, Int_t *ierr, Float_t *spu, Float_t *dj, Float_t *dk)
Definition: TGeant3.cxx:5577
Bool_t GetTransformation(const TString &volumePath, TGeoHMatrix &mat)
Definition: TGeant3.cxx:6640
Int_t GetIonPdg(Int_t z, Int_t a, Int_t i=0) const
Definition: TGeant3.cxx:6996
virtual Int_t Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *ubuf=0, Int_t nwbuf=0)
Definition: TGeant3.cxx:3671
#define g3tnext
Definition: TGeant3.cxx:980
const char * CurrentVolPath()
Definition: TGeant3.cxx:1467
Int_t ipair
Definition: TGeant3.h:398
virtual void GtreveRoot()
Definition: TGeant3.cxx:3822
Int_t idemax
Definition: TGeant3.h:146
Int_t ipart
Definition: TGeant3.h:168
Int_t itest
Definition: TGeant3.h:147
Int_t names[15]
Definition: TGeant3.h:286
double z
Float_t radl
Definition: TGeant3.h:213
Float_t tofg
Definition: TGeant3.h:263
void DefineParticles()
Definition: TGeant3.cxx:1497
Float_t cutmuo
Definition: TGeant3.h:337
#define g3sdvs
Definition: TGeant3.cxx:583
virtual Gctrak_t * Gctrak() const
Definition: TGeant3.h:829
virtual void SetColors()
Definition: TGeant3.cxx:6303
virtual void Glast()
Definition: TGeant3.cxx:3141
Int_t NofVolumes() const
Definition: TGeant3.cxx:1857
Float_t tofmax
Definition: TGeant3.h:343
virtual void SetSkinSurface(const char *name, const char *volName, const char *opSurfaceName)
Definition: TGeant3.cxx:3554
#define gheish
Definition: TGeant3.cxx:964
Bool_t fStopRun
Definition: TGeant3.h:1191
Gconsx_t * cconsx
GCONST common structure.
Definition: TGeant3.cxx:1081
Int_t kcase
Definition: TGeant3.h:184
Int_t numver[MXPRED]
Definition: TGeant3.h:571
#define erxyzc
Definition: TGeant3.cxx:612
Double_t Xsec(char *reac, Double_t energy, Int_t part, Int_t mate)
Definition: TGeant3.cxx:2197
Int_t ConvertVolumePathString(const TString &volumeName, Int_t **lnam, Int_t **lnum)
TRCOM3 common structure.
Definition: TGeant3.cxx:6909
Int_t NextVolUp(Text_t *name, Int_t &copy)
Definition: TGeant3.cxx:1309
Float_t cutgam
Definition: TGeant3.h:333
#define gfmdis
Definition: TGeant3.cxx:969
#define rxinh
Definition: TGeant3.cxx:621
Int_t TransportMethod(TMCParticleType particleType) const
Definition: TGeant3.cxx:6143
virtual void SetMUNU(Int_t par=1)
Definition: TGeant3.cxx:5164
Int_t idemin
Definition: TGeant3.h:145
const char * GetPath()
Definition: TGeant3.cxx:3003
Gckin2_t * fGckin2
GCKING common structure.
Definition: TGeant3.h:1164
Float_t charge
Definition: TGeant3.h:172
virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t np)
Definition: TGeant3.cxx:4299
Int_t iswit[10]
Definition: TGeant3.h:153
void G3Gsposp(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, const char *konly, Float_t *upar, Int_t np)
Definition: TGeant3.cxx:4192
Double_t TrackCharge() const
Definition: TGeant3.cxx:2276
virtual void Grndmq(Int_t &is1, Int_t &is2, Int_t iseq, const Text_t *chopt)
Definition: TGeant3.cxx:3841
Gckin3_t * fGckin3
GCKIN2 common structure.
Definition: TGeant3.h:1165
virtual void Gsking(Int_t igk)
Definition: TGeant3.cxx:3758
Int_t VolDaughterCopyNo(const char *volName, Int_t i) const
Definition: TGeant3.cxx:1898
Float_t dens
Definition: TGeant3.h:212
virtual void SetClipBox(const char *name, Double_t xmin=-9999, Double_t xmax=0, Double_t ymin=-9999, Double_t ymax=0, Double_t zmin=-9999, Double_t zmax=0)
Definition: TGeant3.cxx:4901
virtual void Gtrack()
Definition: TGeant3.cxx:3804
Int_t nvolum
Definition: TGeant3.h:317
virtual void Gdelete(Int_t view)
Definition: TGeant3.cxx:4545
virtual void SetDRAY(Int_t par=1)
Definition: TGeant3.cxx:5072
Float_t dphys1
Definition: TGeant3.h:447
#define g3last
Definition: TGeant3.cxx:975
virtual void SetPHOT(Int_t par=1)
Definition: TGeant3.cxx:5216
Float_t step
Definition: TGeant3.h:260
Int_t imunu
Definition: TGeant3.h:438
virtual Int_t GetMedium() const
Definition: TGeant3.cxx:2967
#define grndm
Definition: TGeant3.cxx:575
Double_t MaxStep() const
Definition: TGeant3.cxx:2567
Double_t TrackStep() const
Definition: TGeant3.cxx:2303
virtual void SetHADR(Int_t par=1)
Definition: TGeant3.cxx:5099
Gconsx_t * fGconsx
GCONST common structure.
Definition: TGeant3.h:1172
Int_t nrotm
Definition: TGeant3.h:318
virtual void Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol, Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd, Float_t &stemax, Float_t &deemax, Float_t &epsil, Float_t &stmin, Float_t *buf=0, Int_t *nbuf=0)
Definition: TGeant3.cxx:3281
Int_t lsamvl
Definition: TGeant3.h:632
auto norm(Vector const &v)
Return norm of the specified vector.
virtual void SetERAN(Float_t ekmin=1.e-5, Float_t ekmax=1.e4, Int_t nekbin=90)
Definition: TGeant3.cxx:5084
#define g3sdvn
Definition: TGeant3.cxx:581
virtual void Gdtree(const char *name, Int_t levmax=15, Int_t ispec=0)
Definition: TGeant3.cxx:4782
virtual void WriteEuclid(const char *filnam, const char *topvol, Int_t number, Int_t nlevel)
Definition: TGeant3.cxx:5670
virtual void SetClose(Int_t iclose, Float_t *pf, Float_t dstrt, Float_t *w1, Float_t *w2, Float_t *p1, Float_t *p2, Float_t *p3, Float_t *cl)
Definition: TGeant3.cxx:4998
void SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, Float_t *vpos, Float_t *polar, Float_t tof, TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
Definition: TGeant3.cxx:6338
#define g3ekbin
Definition: TGeant3.cxx:565
virtual void Erxyzc()
Definition: TGeant3.cxx:5420
Int_t nmec
Definition: TGeant3.h:251
virtual Gcphys_t * Gcphys() const
Definition: TGeant3.h:824
Int_t lvolum[15]
Definition: TGeant3.h:288
virtual void SetOPTI(Int_t par=2)
Definition: TGeant3.cxx:5176
const char * CurrentVolName() const
Definition: TGeant3.cxx:1428
virtual void Gsxyz()
Definition: TGeant3.cxx:3795
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
virtual Double_t ParticleLifeTime(Int_t pdg) const
Definition: TGeant3.cxx:2168
Float_t bcutm
Definition: TGeant3.h:339
virtual void AddParticlesToPdgDataBase() const
Definition: TGeant3.cxx:1335
virtual void Grndm(Float_t *rvec, Int_t len) const
Definition: TGeant3.cxx:3831
Gcopti_t * fGcopti
GCSETS common structure.
Definition: TGeant3.h:1154
#define g3print
Definition: TGeant3.cxx:593
Bool_t SetProcess(const char *flagName, Int_t flagValue)
Definition: TGeant3.cxx:1978
#define g3satt
Definition: TGeant3.cxx:595
#define g3sdvt
Definition: TGeant3.cxx:585
p
Definition: test.py:223
#define g3fmate
Definition: TGeant3.cxx:545
Int_t nevent
Definition: TGeant3.h:155
void(* fggperp)(Float_t *, Float_t *, Int_t &)=0
Definition: TGeant3.cxx:1095
Bool_t fSkipNeutrinos
Definition: TGeant3.h:1192
virtual void Gprotm(Int_t nmat=0)
Definition: TGeant3.cxx:4265
virtual Double_t ParticleMass(Int_t pdg) const
Definition: TGeant3.cxx:2140
Int_t ixcons
Definition: TGeant3.h:106
#define rxgtrak
Definition: TGeant3.cxx:619
virtual void Gdraw(const char *name, Double_t theta=30, Double_t phi=30, Double_t psi=0, Double_t u0=10, Double_t v0=10, Double_t ul=0.01, Double_t vl=0.01)
Definition: TGeant3.cxx:4632
void GeomIter()
Definition: TGeant3.cxx:1299
void G3Medium(Int_t &kmed, const char *name, Int_t nmat, Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, Double_t stemax, Double_t deemax, Double_t epsil, Double_t stmin, Float_t *ubuf=0, Int_t nbuf=0)
Definition: TGeant3.cxx:2810
Int_t nekbin
Definition: TGeant3.h:374
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:96
virtual void Glmoth(const char *iudet, Int_t iunum, Int_t &nlev, Int_t *lvols, Int_t *lindx)
Definition: TGeant3.cxx:3926
Gctrak_t * gctrak
Definition: TGeant3.cxx:1069
Float_t amass
Definition: TGeant3.h:171
#define flufin
Definition: TGeant3.cxx:965
Float_t gcalpha
Definition: TGeant3.h:351
#define g3helx3
Definition: TGeant3.cxx:970
#define g3lmoth
Definition: TGeant3.cxx:578
Float_t ekmax
Definition: TGeant3.h:373
static const double A
Definition: Units.h:82
virtual Float_t Gprelm(Float_t z, Float_t t, Float_t cut)
Definition: TGeant3.cxx:3317
#define trsdsc
Definition: TGeant3.cxx:611
Bool_t DefineIon(const char *name, Int_t Z, Int_t A, Int_t Q, Double_t excEnergy, Double_t mass)
Definition: TGeant3.cxx:2089
void SetMaxStep(Double_t maxstep)
Definition: TGeant3.cxx:2576
virtual void SetBOMB(Float_t bomb=1)
Definition: TGeant3.cxx:4853
#define g3sdvn2
Definition: TGeant3.cxx:582
#define g3lvolu
Definition: TGeant3.cxx:599
virtual void Gfpart(Int_t ipart, char *name, Int_t &itrtyp, Float_t &amass, Float_t &charge, Float_t &tlife) const
Definition: TGeant3.cxx:3266
Gcmulo_t * fGcmulo
GCMORE common structure.
Definition: TGeant3.h:1149
virtual Float_t * Q() const
Definition: TGeant3.h:832
Int_t numed
Definition: TGeant3.h:221
virtual void Gmedia(Float_t *x, Int_t &numed)
Definition: TGeant3.cxx:3942
Gcmate_t * fGcmate
GCMULO common structure.
Definition: TGeant3.h:1150
#define ertrak
Definition: TGeant3.cxx:603
virtual void Gekbin()
Definition: TGeant3.cxx:3729
virtual void Gdebug()
Definition: TGeant3.cxx:3720
string GetString(xmlDocPtr xml_doc, string node_path)
void SetMaxNStep(Int_t maxnstp)
Definition: TGeant3.cxx:2585
virtual void Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, Float_t stemax, Float_t deemax, Float_t epsil, Float_t stmin)
Definition: TGeant3.cxx:3428
Gckine_t * fGckine
GCVOLU common structure.
Definition: TGeant3.h:1158
Int_t idevt
Definition: TGeant3.h:149
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
#define g3trigc
Definition: TGeant3.cxx:541
Float_t grmat[15][10]
Definition: TGeant3.h:295
virtual void Gdrawx(const char *name, Float_t cutthe, Float_t cutphi, Float_t cutval, Float_t theta=30, Float_t phi=30, Float_t u0=10, Float_t v0=10, Float_t ul=0.01, Float_t vl=0.01)
Definition: TGeant3.cxx:4695
virtual void SetUserDecay(Int_t ipart)
Definition: TGeant3.cxx:5276
void StopEvent()
Definition: TGeant3.cxx:2546
#define g3run
Definition: TGeant3.cxx:539
for(std::string line;std::getline(inFile, line);)
Definition: regex_t.cc:35
Int_t fNextVol
Definition: TGeant3.h:1137
Gctpol_t * fGctpol
GCMATE common structure.
Definition: TGeant3.h:1151
Int_t nlevel
Definition: TGeant3.h:285
Gctmed_t * fGctmed
GCFLAG common structure.
Definition: TGeant3.h:1160
virtual Bool_t SetDecayMode(Int_t pdg, Float_t bratio[6], Int_t mode[6][3])
Definition: TGeant3.cxx:5301
TObjArray fMedNames
Names of geant volumes as C++ chars.
Definition: TGeant3.h:1181
virtual void Eufill(Int_t n, Float_t *ein, Float_t *xlf)
Definition: TGeant3.cxx:5438
Float_t dcutm
Definition: TGeant3.h:341
virtual void Gspos(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, const char *konly="ONLY")
Definition: TGeant3.cxx:4155
Float_t dcute
Definition: TGeant3.h:340
void(* fgtonly)(Int_t &)=0
Definition: TGeant3.cxx:1091
#define type_of_call
Definition: TCallf77.h:8
Int_t ntmed
Definition: TGeant3.h:319
#define g3pcxyz
Definition: TGeant3.cxx:534
Double_t TrackTime() const
Definition: TGeant3.cxx:2238
virtual void SetLOSS(Int_t par=2)
Definition: TGeant3.cxx:5133
virtual void Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg, Float_t &tofg)
Definition: TGeant3.cxx:3657
virtual Int_t * Lq() const
Definition: TGeant3.h:831
Float_t snext
Definition: TGeant3.h:261
Bool_t IsTrackInside() const
Definition: TGeant3.cxx:2330
Bool_t IsTrackAlive() const
Definition: TGeant3.cxx:2527
Float_t getot
Definition: TGeant3.h:248
Bool_t SetCut(const char *cutName, Double_t cutValue)
Definition: TGeant3.cxx:1940
virtual void Gwork(Int_t nwork)
Definition: TGeant3.cxx:3203
Int_t irayl
Definition: TGeant3.h:458
#define g3brelm
Definition: TGeant3.cxx:616
virtual Int_t Glvolu(Int_t nlev, Int_t *lnam, Int_t *lnum)
Definition: TGeant3.cxx:4520
T copy(T const &v)
void StopRun()
Definition: TGeant3.cxx:2555
#define g3init
Definition: TGeant3.cxx:537
Gcvolu_t * gcvolu
Definition: TGeant3.cxx:1070
Int_t fNPDGCodes
Definition: TGeant3.h:1184
Int_t nameer[MXPRED]
Definition: TGeant3.h:570
#define g3skpho
Definition: TGeant3.cxx:568
Ertrio1_t * fErtrio1
ERTRIO common structure.
Definition: TGeant3.h:1123
void type_of_call setclip(DEFCHARD, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &DEFCHARL)
Gcvdma_t * fGcvdma
GCTLIT common structure.
Definition: TGeant3.h:1156
Int_t inwvol
Definition: TGeant3.h:267
list x
Definition: train.py:276
virtual void Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
Definition: TGeant3.cxx:3345
TMCProcess ProdProcess(Int_t isec) const
Definition: TGeant3.cxx:2393
virtual void Gtreve()
Definition: TGeant3.cxx:3813
Int_t ieotri
Definition: TGeant3.h:151
end
Definition: test.py:8
Double_t TrackMass() const
Definition: TGeant3.cxx:2285
#define g3physi
Definition: TGeant3.cxx:563
Float_t gkin[MXGKIN][5]
Definition: TGeant3.h:186
#define g3tmedi
Definition: TGeant3.cxx:977
Int_t ipfis
Definition: TGeant3.h:413
#define g3sstak
Definition: TGeant3.cxx:569
weight
Definition: test.py:257
Gcjump_t * gcjump
GCONSX common structure.
Definition: TGeant3.cxx:1082
virtual void Material(Int_t &kmat, const char *name, Double_t a, Double_t z, Double_t dens, Double_t radl, Double_t absl, Float_t *buf=0, Int_t nwbuf=0)
Definition: TGeant3.cxx:2658
Bool_t fImportRootGeometry
Definition: TGeant3.h:1188
#define g3sdvt2
Definition: TGeant3.cxx:586
static const double s
Definition: Units.h:99
virtual void Gsstak(Int_t iflag)
Definition: TGeant3.cxx:3778
virtual void SetTRIG(Int_t nevents=1)
Definition: TGeant3.cxx:5266
TGeant3 * geant3
Definition: TGeant3.cxx:1072
Int_t MediumId(const Text_t *name) const
Definition: TGeant3.cxx:1842
virtual void Gckpar(Int_t ish, Int_t npar, Float_t *par)
Definition: TGeant3.cxx:4502
virtual void Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, Float_t theta3, Float_t phi3)
Definition: TGeant3.cxx:4246
virtual void Gfpara(const char *name, Int_t number, Int_t intext, Int_t &npar, Int_t &natt, Float_t *par, Float_t *att)
Definition: TGeant3.cxx:4491
#define gckpar
Definition: TGeant3.cxx:597
#define g3zebra
Definition: TGeant3.cxx:532
Float_t wire1[3]
Definition: TGeant3.h:355
virtual void SetMULS(Int_t par=1)
Definition: TGeant3.cxx:5150
Int_t CurrentEvent() const
Definition: TGeant3.cxx:2384
Bool_t GetShape(const TString &volumePath, TString &shapeType, TArrayD &par)
Definition: TGeant3.cxx:6729
#define gtmany
Definition: TGeant3.cxx:984
virtual void FinishGeometry()
Definition: TGeant3.cxx:6205
virtual void SetKINE(Int_t kine, Float_t xk1=0, Float_t xk2=0, Float_t xk3=0, Float_t xk4=0, Float_t xk5=0, Float_t xk6=0, Float_t xk7=0, Float_t xk8=0, Float_t xk9=0, Float_t xk10=0)
Definition: TGeant3.cxx:5111
virtual void SetMaterialProperty(Int_t itmed, const char *propertyName, Int_t np, Double_t *pp, Double_t *values)
Definition: TGeant3.cxx:3563
virtual void Gspart(Int_t ipart, const char *name, Int_t itrtyp, Double_t amass, Double_t charge, Double_t tlife)
Definition: TGeant3.cxx:3404
Bool_t IsNewTrack() const
Definition: TGeant3.cxx:2321
#define g3mate
Definition: TGeant3.cxx:549
virtual void Ertrgo()
Definition: TGeant3.cxx:5371
void GetSecondary(Int_t isec, Int_t &ipart, TLorentzVector &x, TLorentzVector &p)
Definition: TGeant3.cxx:2482
virtual void Gdxyz(Int_t it)
Definition: TGeant3.cxx:3859
TMCProcess G3toVMC(Int_t iproc) const
Definition: TGeant3.cxx:2456
#define ertrgo
Definition: TGeant3.cxx:604
virtual void SetSTRA(Int_t par=0)
Definition: TGeant3.cxx:5239
Int_t VolId(const Text_t *name) const
Definition: TGeant3.cxx:1828
virtual void SetECut(Float_t gcalpha)
Definition: TGeant3.cxx:4993
Float_t tofd[MXGKIN]
Definition: TGeant3.h:187
Gckine_t * gckine
Definition: TGeant3.cxx:1071
Float_t dstrt
Definition: TGeant3.h:354
#define fldist
Definition: TGeant3.cxx:968
virtual void Gfang(Float_t *p, Float_t &costh, Float_t &sinth, Float_t &cosph, Float_t &sinph, Int_t &rotate)
Definition: TGeant3.cxx:6988
virtual void Medium(Int_t &kmed, const char *name, Int_t nmat, Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, Double_t stemax, Double_t deemax, Double_t epsil, Double_t stmin, Float_t *ubuf=0, Int_t nbuf=0)
Definition: TGeant3.cxx:2858
#define g3ftmat
Definition: TGeant3.cxx:548
#define rxouth
Definition: TGeant3.cxx:620
virtual void DefaultRange()
Definition: TGeant3.cxx:1211
Float_t bcute
Definition: TGeant3.h:338
TGeoMCGeometry * fMCGeo
Definition: TGeant3.h:1187
type_of_call void gtonlyg3(Int_t &)
GCJUMP common structure.
Definition: TGeant3.cxx:6572
constexpr std::enable_if_t< are_cv_compatible< TO, FROM >::value, std::add_pointer_t< std::remove_pointer_t< TO > > > addr(FROM &from)
Definition: ensurePointer.h:35
Float_t ppcutm
Definition: TGeant3.h:342
Int_t ngkine
Definition: TGeant3.h:185
virtual void Gdcxyz()
Definition: TGeant3.cxx:3867
virtual Gclink_t * Gclink() const
Definition: TGeant3.h:809
virtual void SetAUTO(Int_t par=1)
Definition: TGeant3.cxx:4840
virtual void Gstpar(Int_t itmed, const char *param, Double_t parval)
Definition: TGeant3.cxx:3590
Gconst_t * fGconst
GCCHAN common structure.
Definition: TGeant3.h:1171
#define trscsd
Definition: TGeant3.cxx:610
Float_t erplo[MXPRED *3 *4]
Definition: TGeant3.h:568
Int_t isync
Definition: TGeant3.h:475
#define PASSCHARD(string)
Definition: TCallf77.h:11
Int_t igauto
Definition: TGeant3.h:269
#define g3trigi
Definition: TGeant3.cxx:542
Int_t namec[MAXMEC]
Definition: TGeant3.h:253
#define gpghei
Definition: TGeant3.cxx:967
Float_t gtran[15][3]
Definition: TGeant3.h:294
const char * CurrentVolOffName(Int_t off) const
Definition: TGeant3.cxx:1446
virtual void Gdman(Double_t u0, Double_t v0, const char *type="MAN")
Definition: TGeant3.cxx:4742
Float_t sumlif
Definition: TGeant3.h:446
Gctrak_t * fGctrak
GCKIN3 common structure.
Definition: TGeant3.h:1166
virtual void Matrix(Int_t &krot, Double_t thex, Double_t phix, Double_t they, Double_t phiy, Double_t thez, Double_t phiz)
Definition: TGeant3.cxx:2918
virtual void Gdrawc(const char *name, Int_t axis=1, Float_t cut=0, Float_t u0=10, Float_t v0=10, Float_t ul=0.01, Float_t vl=0.01)
Definition: TGeant3.cxx:4673
#define g3mtod
Definition: TGeant3.cxx:580
Gcsets_t * fGcsets
GCNUM common structure.
Definition: TGeant3.h:1153
virtual void Gtrigc()
Definition: TGeant3.cxx:3185
Float_t cutele
Definition: TGeant3.h:334
#define eufill
Definition: TGeant3.cxx:605
Int_t * fZiq
Definition: TGeant3.h:1140
#define g3svert
Definition: TGeant3.cxx:562
TString ParticleClass(TMCParticleType particleType) const
Definition: TGeant3.cxx:6183
h
training ###############################
Definition: train_cnn.py:186
Bool_t GetMaterial(const TString &volumeName, TString &name, Int_t &imat, Double_t &a, Double_t &z, Double_t &den, Double_t &radl, Double_t &inter, TArrayD &par)
Definition: TGeant3.cxx:6784
#define ggperp
Definition: TGeant3.cxx:989
virtual Int_t * Iq() const
Definition: TGeant3.h:830
virtual void Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
Definition: TGeant3.cxx:3881
Gcchan_t * gcchan
Definition: TGeant3.cxx:1078
Ertrio_t * fErtrio
Definition: TGeant3.h:1122
#define eufilp
Definition: TGeant3.cxx:606
virtual void Gfinds()
Definition: TGeant3.cxx:3739
virtual void Gsposp(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, const char *konly, Float_t *upar, Int_t np)
Definition: TGeant3.cxx:4218
#define g3fpart
Definition: TGeant3.cxx:546
virtual void Gsord(const char *name, Int_t iax)
Definition: TGeant3.cxx:4133
Float_t absl
Definition: TGeant3.h:214
virtual void Trspsc(Float_t *ps, Float_t *rs, Float_t *pc, Float_t *rc, Float_t *h, Float_t *ch, Int_t *ierr, Float_t *spx)
Definition: TGeant3.cxx:5635