All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TGeant3TGeo.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 $Log: TGeant3TGeo.cxx,v $
19 Revision 1.17 2006/12/19 13:16:19 brun
20 from Mohammad Al-Turany & Denis Bertini
21 
22 Changes in TGeant3/TGeant3.cxx and TGeant3.h
23 ------------------------------------
24 1. Geane interface functions are added:
25  void eufill(Int_t n, Float_t *ein, Float_t *xlf);
26  void eufilp(const int n,Float_t *ein,Float_t *pli,Float_t *plf);
27  void eufilv(Int_t n, Float_t *ein, Char_t *namv, Int_t *numv,Int_t *iovl);
28  void trscsd(Float_t *pc,Float_t *rc,Float_t *pd,Float_t *rd,
29  Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk);
30  void trsdsc(Float_t *pd,Float_t *rd,Float_t *pc,Float_t *rc,
31  Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk);
32  void trscsp(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
33  Float_t *ch,Int_t *ierr,Float_t *spx);
34  void trspsc(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
35  Float_t *ch,Int_t *ierr,Float_t *spx);
36 
37 2. The Gfang function wrapper is added
38  void g3fang( Float_t *, Float_t &,Float_t &, Float_t &, Float_t &,Int_t & );
39 
40 
41 
42 
43 changes in TGeant3/TGeant3gu.cxx
44 --------------------------
45 Adding GCalor interface
46  1. function calsig() and gcalor() are added
47  2. setting ihadr=5 will call the GCalor routine
48 
49 
50 
51 
52 changes in TGeant3/TGeant3.h
53 -----------------------
54 1. Structures for Geane output are setted as public so that the user can access them
55 
56  Ertrio_t *fErtrio
57  Eropts_t *fEropts
58  Eroptc_t *fEroptc
59  Erwork_t *fErwork
60  Trcom3_t *fTrcom3
61 
62 2. The size of the error matrix errin is corrected to 15
63 
64 Revision 1.15 2006/05/30 13:39:07 brun
65 From Andrei Gheata:
66 a patch cleaning-up the usage of TGeant3::Vname method inside TGeant3TGeo.cxx. The truncation of names is not needed when working with TGeo. In most of the cases the names were truncated to 4 chars but the result was not used in the subsequent call to TGeoMCGeometry (this is why it still worked) but a cleanup is good anyway...
67 
68 Revision 1.14 2006/05/23 15:53:11 brun
69 From Ivana:
70  Adding CurrentVolPath() overloading TGeant3 implementation
71  which does not work correctly with longer volume names
72  (Oleg Yushchenko)
73 
74 Revision 1.13 2005/11/18 21:25:22 brun
75 From Bjorn, Andrei:
76 Implemented new VMC functions for access to geometry;
77 added -Woverloaded-virtual to Makefile.linux
78 
79 Revision 1.12 2005/07/28 12:02:17 brun
80 From Andrei:
81 - Fixed problem of material indices when coming from FORTRAN code
82 (TGeant3TGeo::Gsmate)
83 - when loading the geometry from file, the value of radlen stored in TGeo is
84 injected in G3 (with negative sign not to be recomputed by G3) but abslen is
85 recomputed since it is not valid in TGeo.
86 
87 Revision 1.11 2005/07/27 13:06:52 brun
88 Simplify logic in TGeant3TGeo::Mixture (Float_t* case)
89 
90 Revision 1.10 2005/07/21 17:54:37 brun
91 Implement same code in the float* versions that were already implemented
92 in the Double* versions.
93 
94 Revision 1.9 2005/07/20 09:22:51 brun
95 From Federico:
96 Fixes to compile with gcc4CVS: ----------------------------------------------------------------------
97 
98 Revision 1.8 2005/07/13 09:36:18 brun
99 From Federico:
100  Mods for Mac and removal of stupid printout.
101 
102 Revision 1.7 2005/07/11 12:00:47 brun
103 From Andrei Gheata:
104 a fix in TGeant3TGeo::Gsmixt. The problem (found by Federico) was
105 that the array of weights for mixture components in case nlmat<0 (number of
106 atoms) was recomputed once by G3 itself then again inside Gsmixt, resulting
107 in wrong fractions.
108 
109 Revision 1.6 2005/06/15 08:49:21 brun
110 From Andrei Gheata:
111 Change related to usage of assemblies (that have no medium).
112 
113 Revision 1.5 2005/05/17 12:48:00 brun
114 From Ivana:
115 - Set name TGeant3TGeo
116 
117 Revision 1.4 2005/05/11 11:46:54 brun
118 From Andrei Gheata:
119  Implementation of gtmany (PUSH) and glvolu (POP) in
120 TGeant3TGeo class (needed for the correct boundary crossing sequence in
121 case of Cerenkov transport).
122 
123 Revision 1.3 2005/02/08 11:22:03 brun
124 From Ivana:
125 For TGeant3.h:
126 Added IsRootGeometrySupported() function
127 (now required by TVirtualMC)
128 
129 For TGeant3.cxx:
130 Updated text in Fatal in SetRootGeometry.
131 
132 Revision 1.2 2004/12/21 15:34:48 brun
133 Implement TGeant3TGeo::isRootGeometry returning kTRUE
134 
135 Revision 1.1 2004/12/17 11:55:47 brun
136 A new class TGeant3TGeo (deriving from TGeant3) is introduced.
137 TGeant3 uses by default the geant3 geometry. TGeant3TGeo uses the TGeo classes.
138 The two classes are built in the same library. The choice of which version to use
139 can now be made dynamically at run time (eg based on an environment variable)
140 or a job control option.
141 For example the examples like gexam1, gexam4 have been modified to run
142 with either geant3 geometry or TGeo. To run gexam1 with geant3 geometry do
143  gexam1 TGeant3
144 to run with TGeo (default) do
145  gexam1
146 The examples E01.C, E02 and E03 have also been modified to select the option
147 at run time based on the environment variable TVirtualMC (set in .rootrc)
148 If TVirtualMC is set to TGeant3TGeo TGeo geometry will be used.
149 The Makefile has been modified to build the two classes in the same library.
150 
151 Revision 1.37 2004/11/23 14:52:52 brun
152 From Andreas Morsch:
153 on request of ALICE/TPC I added a new method to TVirtualMC.h
154 
155 void TVirtualMC::ForceDecayTime(Float_t);
156 
157 
158 This allows to force the decay time of the current particle.
159 The use-case implemented in AliRoot is the decay of primary particles
160 within a user defined radius range.
161 
162 Revision 1.36 2004/10/13 10:38:32 brun
163 From Andrei Gheata:
164 some modifications in the current TGeant3.cxx :
165 
166 from Mihaela:
167 - modifications in STATISTICS option: added branches to statistics tree
168 (statsame + statpath)
169 - global gckine added. gckine->itrtyp == 7 used in gtnext to optimize
170 speed - 1% gain (computation of global matrix only when called from gtckov)
171 - bias of 1E-7 (used previously for making sure a boundary is crossed)
172 eliminated
173 
174 I removed the option WITHBOTH and fixed a problem in VolId() - in the
175 last version of AliRoot some detector was calling gMC->VolId(name) with
176 a name containing a blank at the end and now all volumes have the blanks
177 supressed. Fixing this I noticed that there are 4 detectors that in
178 their StepManager() they call at each step things like:
179  if (gMC->CurrentVolId(copy) == gMC->VolId("RICH")) ...
180 Incredible !!! In G3 native this search by name does not penalize so
181 much since names are converted to Int_t and the volume bank is looked
182 for this Int_t. In TGeo we cannot do this since we support long names so
183 we have to go to gGeoManager->GetVolume("name") which scans a list of
184 2000 objects at each step several times... I fixed this by hand by
185 puting static variables in these methods and Peter will commit the
186 changes. The gain in speed for TGeo case is considerable with full AliRoot.
187 
188 Revision 1.35 2004/10/12 07:46:23 brun
189 >From Ivana:
190 Implemented new functions from TVirtualMC:
191  Int_t NofVolDaughters(const char* volName) const;
192  const char* VolDaughterName(const char* volName, Int_t i) const;
193  Int_t VolDaughterCopyNo(const char* volName, Int_t i) const;
194  const char* CurrentVolPath();
195 
196 Revision 1.34 2004/09/17 08:51:55 brun
197 >From Ivana
198  SetRootGeometry() allowed only with WITHROOT option;
199  added Fatal() for other modes.
200 
201 Revision 1.33 2004/08/25 07:28:54 brun
202 >From Ivana and Lionel Chaussard
203  In method DefineParticles(), we had:
204 
205  pdgcode(Tau+)=15
206  pdgcode(Tau-)=-15
207 
208  This is in contradiction with the other leptons (pdgcode>0 for
209  negative leptons, pdgcode<0 for positive leptons). I also checked
210  in the PDG WEB pages that Tau- should have a code +15.
211 
212  changed to:
213  pdgcode(tau+)=-15
214  pdgcode(tau-)=+15 ?
215 
216 Revision 1.32 2004/08/05 12:20:39 brun
217 >From Andrei Gheata:
218 I have found/fixed a bug in TGeoManager::IsSameLocation(x,y,z). Also I
219 have eliminated the penalizing check of IsSameLocation() in gtnext().
220 
221 Revision 1.31 2004/07/09 12:15:12 brun
222 >From Ivana:
223 in case a user defines geometry via TGeo and associates more tracking
224  media with the same material, TGeant3 duplicates this material
225  for each tracking medium.
226  I haven't found a function for getting the number of
227  materials/media (TList) so I count them by a loop
228  - maybe it can be done more intelligently...
229 
230 Revision 1.30 2004/07/09 08:11:29 brun
231 Fix by Ivana/Andrei to call TGeoMedium::setId and not TGeoMedium::SetUniqueID
232 
233 Revision 1.29 2004/06/17 13:56:53 rdm
234 changed several "const int" arguments to "int". Was causing warnings of
235 type "qualifier is meaningless".
236 
237 Revision 1.28 2004/06/08 10:27:19 brun
238 >From Ivana:
239 - Added Bool_t return value to methods
240  SetCut(), SetProcess(), DefineParticle(), DefineIon()
241 - Removed DefineParticles()
242 
243 Revision 1.27 2004/05/28 13:45:00 brun
244 >From Ivana
245 Implementation of StopRun (new function in TVirtualMC)
246 
247 Revision 1.26 2004/05/14 08:32:01 brun
248 In function gtnext, call GetNextBoundary(-step) instead of (step).
249 This fixes a problem when tracking Cherenkov photons.
250 (Thanks to Yuri Kharlov for reporting the problem and Andrei for fixing it)
251 
252 Revision 1.25 2004/03/23 11:16:44 brun
253 >From Ivana
254 With the previous changes by Andrei, all fixes by Ivana were lost.
255 This patch merges Ivana and Andrei versions.
256 
257 Revision 1.23 2004/03/15 12:18:45 brun
258 >From Andrei Gheata:
259  - minor modifications to cope with geometry retreival from file:
260  - ConstructGeometry does not need to be called
261  - CloseGeometry not needed
262 
263 Revision 1.22 2004/02/03 12:47:34 brun
264 >From Andrei Gheata:
265 TGeant3:
266 
267 - calls to gtonly return now always a true value (G3 is seeing an ONLY
268 geometry with TGeo)
269 - IsSameLocation inside gtnext not yet eliminated, but I am getting only
270 1 exception instead of 400 now (when the location really changes)
271 
272 Revision 1.21 2004/01/28 18:05:24 brun
273 New version from Peter Hristov adding the graphics interface
274 
275 Revision 1.20 2004/01/28 08:30:54 brun
276 Change the call to TRandom::RndmArray in function grndm
277 
278 Revision 1.19 2004/01/28 08:14:48 brun
279 Add a CPP option STATISTICS to monitor the fequency of calls to the geometry functions.
280 
281 Revision 1.18 2003/12/10 15:39:37 brun
282 iFollowing recent improvements by Andrei, replace in ggperp
283 the computation of normals:
284  Double_t *dblnorm = gGeoManager->FindNormal(kFALSE);
285 with :
286  Double_t *dblnorm = gGeoManager->FindNormalFast();
287 
288 Revision 1.17 2003/12/10 10:32:09 brun
289 Add a protection in TGeant3TGeo::Gsmate in case the material density is null
290 
291 Revision 1.16 2003/12/01 23:51:22 brun
292 >From Andrei and Peter:
293 add a few missing cases when compiling with the WITHROOT option.
294 
295 Revision 1.15 2003/11/28 09:44:15 brun
296 New version of TGeant3 supporting the options WITHG3 and WITHROOT
297 
298 Revision 1.14 2003/10/09 06:28:45 brun
299 In TGeant3TGeo::ParticleName, increase size of local array name[20] to name[21]
300 
301 Revision 1.13 2003/09/26 15:01:08 brun
302 >From Ivana;
303 - implemented new functions from TVirtualMC
304  enabling user to define own particles and ions
305  + getter functions::
306  DefineParticle(..)
307  DefineIon(..)
308  ParticleName(..) const
309  ParticleMass(..) const
310  Double_t ParticleCharge(..) const
311  Double_t ParticleLifeTime(..) const
312 - corrected charge in AddParticlesToPdgDataBase
313 
314 Revision 1.12 2003/07/22 06:53:28 brun
315 This version does not yet support TGeo geometry.
316 TVirtualMC must be initialized with the 3rd argument set to kFALSE
317 
318 Revision 1.11 2003/07/18 10:22:50 brun
319 Changes to reflect the equivalent changes in the abstract classes in vmc
320 (thanks Peter Hristov)
321 
322 Revision 1.10 2003/07/16 07:40:09 brun
323 >From Andreas Morsch
324 
325 - default g3 specific initialisation moved to TGeant3TGeo::Init()
326  (This avoids the cast to TGeant3* in the Config.C)
327 - "CKOV" added to SetProcess
328 
329 Revision 1.9 2003/06/03 21:26:46 brun
330 New version of gustep by Andreas Morsch
331 
332 Revision 1.8 2003/02/28 10:41:49 brun
333 >From Andreas
334  In DefineParticles(): rho0 decay channel corrected
335 
336 Revision 1.7 2003/02/04 17:50:34 brun
337 >From Ivana
338  In Mixture(): pass abs(nlmat) to CreateFloatArray calls
339  as nlmat can be negative.
340 
341 Revision 1.6 2003/01/31 18:23:06 brun
342 Ivana suggested corrections.
343 - corrected tau pdg code
344 - Warning if external decayer needed but not defined.
345 
346 Revision 1.5 2003/01/23 11:34:04 brun
347 In gustep, replace
348  gMC->TrackPosition(x,y,z);
349 by
350  geant3->TrackPosition(x,y,z);
351 
352 Revision 1.4 2003/01/06 17:20:52 brun
353 Add new functions TrackPosition and TrackMomentum as alternative to the original
354 functions filling a TLorentzVector object.
355 Use these new functions in gustep and gudcay.
356 This makes a 25 per cent speed improvement in case of Alice.
357 
358 Revision 1.3 2002/12/10 07:58:36 brun
359 Update by Federico for the calls to Grndm
360 
361 Revision 1.2 2002/12/06 16:50:30 brun
362 >From Federico:
363 the following modifications provide an >6% improvement in speed for
364 AliRoot.
365 
366 Revision 1.1.1.1 2002/07/24 15:56:26 rdm
367 initial import into CVS
368 
369 Revision 1.5 2002/07/10 09:33:19 hristov
370 Array with variable size created by new
371 
372 Revision 1.4 2002/07/10 08:38:54 alibrary
373 Cleanup of code
374 
375 */
376 
377 ///////////////////////////////////////////////////////////////////////////////
378 // //
379 // Interface Class to the Geant3.21 MonteCarlo //
380 // //
381 // //
382 // //
383 ///////////////////////////////////////////////////////////////////////////////
384 
385 #include <ctype.h>
386 #include <stdlib.h>
387 
388 #include "TROOT.h"
389 #include "TParticle.h"
390 #include "TDatabasePDG.h"
391 #include "TLorentzVector.h"
392 #include "TArrayI.h"
393 #include "TArrayD.h"
394 
396 
397 #include "TGeoManager.h"
398 #include "TGeoMatrix.h"
399 #include "TGeoMCGeometry.h"
400 
402 #include "TVirtualMCDecayer.h"
403 #include "TPDGCode.h"
404 
405 #ifndef WIN32
406 # define g3smate g3smate_
407 # define g3smixt g3smixt_
408 # define g3stmed g3stmed_
409 # define g3treve g3treve_
410 # define gtreveroot gtreveroot_
411 # define gcomad gcomad_
412 
413 # define g3brelm g3brelm_
414 # define g3prelm g3prelm_
415 
416 #else
417 
418 # define gzebra GZEBRA
419 # define grfile GRFILE
420 # define gpcxyz GPCXYZ
421 # define ggclos GGCLOS
422 # define ginit GINIT
423 # define g3cinit G3CINIT
424 # define grun GRUN
425 # define gtrig GTRIG
426 # define gtrigc GTRIGC
427 # define gtrigi GTRIGI
428 # define gwork GWORK
429 # define gfmate GFMATE
430 # define gfpart GFPART
431 # define gftmed GFTMED
432 # define gftmat GFTMAT
433 # define gsmate GSMATE
434 # define gsmixt GSMIXT
435 # define gstmed GSTMED
436 # define gstpar GSTPAR
437 # define gfkine GFKINE
438 # define gfvert GFVERT
439 # define gskine GSKINE
440 # define gsvert GSVERT
441 # define gphysi GPHYSI
442 # define gekbin GEKBIN
443 # define gfinds GFINDS
444 # define gsking GSKING
445 # define gskpho GSKPHO
446 # define gsstak GSSTAK
447 # define gtreve GTREVE
448 # define gtreveroot GTREVEROOT
449 # define gdtom GDTOM
450 # define gmedia GMEDIA
451 # define gmtod GMTOD
452 # define gsdvn GSDVN
453 # define gsdvn2 GSDVN2
454 # define gsdvs GSDVS
455 # define gsdvs2 GSDVS2
456 # define gsdvt GSDVT
457 # define gsdvt2 GSDVT2
458 # define gsord GSORD
459 # define gspos GSPOS
460 # define gsposp GSPOSP
461 # define gsrotm GSROTM
462 # define gprotm GPROTM
463 # define gsvolu GSVOLU
464 # define gprint GPRINT
465 # define gcomad GCOMAD
466 
467 #endif
468 
469 //____________________________________________________________________________
470 extern "C"
471 {
472  //
473  // Prototypes for GEANT functions
474  //
475 
476  void type_of_call g3treve();
477 
478  void type_of_call gtreveroot();
479 
480  void type_of_call g3smate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
481  Float_t &, Float_t &, Float_t &, Float_t *,
482  Int_t & DEFCHARL);
483 
484  void type_of_call g3smixt(const Int_t&, DEFCHARD, const Float_t *,
485  const Float_t *, const Float_t &, const Int_t &,
486  Float_t * DEFCHARL);
487 
488  void type_of_call g3stmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
489  Float_t &, Float_t &, Float_t &, Float_t &,
490  Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
491 
492  void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
493 }
494 
495 
496 #ifndef WIN32
497 # define gtreveroot gtreveroot_
498 
499 #else
500 # define gtreveroot GTREVEROOT
501 
502 #endif
503 
504 extern "C" type_of_call void gtreveroot();
505 extern "C" type_of_call void ginvolTGeo(Float_t*, Int_t&);
506 extern "C" type_of_call void gtmediTGeo(Float_t*, Int_t&);
507 extern "C" type_of_call void gtmanyTGeo(Int_t&);
508 extern "C" type_of_call void gtonlyTGeo(Int_t&);
509 extern "C" type_of_call void gmediaTGeo(Float_t*, Int_t&, Int_t&);
510 extern "C" type_of_call void glvoluTGeo(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier);
511 extern "C" type_of_call void gtnextTGeo();
512 extern "C" type_of_call void ggperpTGeo(Float_t*, Float_t*, Int_t&);
513 
514 //
515 // Geant3 global pointer
516 //
518 TGeoNode *gCurrentNode = 0;
519 R__EXTERN Gctrak_t *gctrak;
520 R__EXTERN Gcvolu_t *gcvolu;
521 R__EXTERN Gckine_t *gckine;
522 R__EXTERN TGeant3* geant3;
523 R__EXTERN Gcchan_t *gcchan;
524 R__EXTERN Int_t count_ginvol;
525 R__EXTERN Int_t count_gmedia;
526 R__EXTERN Int_t count_gtmedi;
527 R__EXTERN Int_t count_gtnext;
528 
529 R__EXTERN void (*fginvol)(Float_t*, Int_t&);
530 R__EXTERN void (*fgtmedi)(Float_t*, Int_t&);
531 R__EXTERN void (*fgtmany)(Int_t&);
532 R__EXTERN void (*fgtonly)(Int_t&);
533 R__EXTERN void (*fgmedia)(Float_t*, Int_t&, Int_t&);
534 R__EXTERN void (*fglvolu)(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier);
535 R__EXTERN void (*fgtnext)();
536 R__EXTERN void (*fggperp)(Float_t*, Float_t*, Int_t&);
537 
538 
539 //____________________________________________________________________________
541  : TGeant3(),
542  fMCGeo(0)
543 {
544  //
545  // Default constructor
546 }
547 
548 //____________________________________________________________________________
549 TGeant3TGeo::TGeant3TGeo(const char *title, Int_t nwgeant)
550  : TGeant3(title,nwgeant),
551  fImportRootGeometry(kFALSE)
552 {
553  //
554  // Standard constructor for TGeant3 with ZEBRA initialisation
555  //
556 
557  SetName("TGeant3TGeo");
558 
559  fMCGeo = new TGeoMCGeometry("MCGeo", "TGeo Implementation of VirtualMCGeometry");
560 
561  LoadAddress();
562  //set pointers to tracker functions
571 }
572 
573 //____________________________________________________________________________
575 {
576  delete fMCGeo;
577 }
578 
579 //____________________________________________________________________________
581 {
582  //
583  // Assigns the address of the GEANT common blocks to the structures
584  // that allow their access from C++
585  //
586 // printf("LoadAddress\n");
587 // TGeant3::LoadAddress();
588  gcomad(PASSCHARD("GCVOL1"),(int*&) fGcvol1 PASSCHARL("GCVOL1"));
589  gcvol1 = fGcvol1;
590 }
591 
592 //_____________________________________________________________________________
594 {
595  //
596  // Geometry iterator for moving upward in the geometry tree
597  // Initialise the iterator
598  //
599  fNextVol=gGeoManager->GetLevel();
600 }
601 
602 //____________________________________________________________________________
603 Int_t TGeant3TGeo::NextVolUp(Text_t *name, Int_t &copy)
604 {
605  //
606  // Geometry iterator for moving upward in the geometry tree
607  // Return next volume up
608  //
609  fNextVol--;
610  if (fNextVol>=0) {
611  Int_t level = gGeoManager->GetLevel();
612  if (level<=fNextVol) return 0;
613  TGeoNode *mother = gGeoManager->GetMother(level-fNextVol);
614  if (!mother) return 0;
615  sprintf(name, "%s", mother->GetVolume()->GetName());
616  copy = mother->GetNumber();
617  return mother->GetVolume()->GetNumber();
618  }
619  return 0;
620 }
621 
622 //_____________________________________________________________________________
623 Int_t TGeant3TGeo::CurrentVolID(Int_t &copy) const
624 {
625  //
626  // Returns the current volume ID and copy number
627  //
628  if (gGeoManager->IsOutside()) return 0;
629  TGeoNode *node = gGeoManager->GetCurrentNode();
630  copy = node->GetNumber();
631  Int_t id = node->GetVolume()->GetNumber();
632  return id;
633 }
634 
635 //_____________________________________________________________________________
636 Int_t TGeant3TGeo::CurrentVolOffID(Int_t off, Int_t &copy) const
637 {
638  //
639  // Return the current volume "off" upward in the geometrical tree
640  // ID and copy number
641  //
642  if (off<0 || off>gGeoManager->GetLevel()) return 0;
643  if (off==0) return CurrentVolID(copy);
644  TGeoNode *node = gGeoManager->GetMother(off);
645  if (!node) return 0;
646  copy = node->GetNumber();
647  return node->GetVolume()->GetNumber();
648 }
649 
650 //_____________________________________________________________________________
651 const char* TGeant3TGeo::CurrentVolName() const
652 {
653  //
654  // Returns the current volume name
655  //
656  if (gGeoManager->IsOutside()) return gGeoManager->GetTopVolume()->GetName();
657  return gGeoManager->GetCurrentVolume()->GetName();
658 }
659 
660 //_____________________________________________________________________________
661 const char* TGeant3TGeo::CurrentVolOffName(Int_t off) const
662 {
663  //
664  // Return the current volume "off" upward in the geometrical tree
665  // ID, name and copy number
666  // if name=0 no name is returned
667  //
668  Int_t i;
669  if( (i=fGcvolu->nlevel-off-1) < 0 ) {
670  Warning("CurrentVolOffName",
671  "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
672  return 0;
673  }
674  if (off<0 || off>gGeoManager->GetLevel()) return 0;
675  if (off==0) return CurrentVolName();
676  TGeoNode *node = gGeoManager->GetMother(off);
677  if (!node) return 0;
678  return node->GetVolume()->GetName();
679 }
680 
681 //______________________________________________________________________
683 {
684 // Return the path in geometry tree for the current volume
685 // ---
686 
687  return GetPath();
688 }
689 
690 //_____________________________________________________________________________
691 Int_t TGeant3TGeo::VolId(const Text_t *name) const
692 {
693  //
694  // Return the unique numeric identifier for volume name
695  //
696  char sname[20];
697  Int_t len = strlen(name)-1;
698  if (name[len] != ' ') return fMCGeo->VolId(name);
699  strncpy(sname, name, len);
700  sname[len] = 0;
701  return fMCGeo->VolId(sname);
702 }
703 
704 //_____________________________________________________________________________
706 {
707  //
708  // Return total number of volumes in the geometry
709  //
710  return fMCGeo->NofVolumes();
711 }
712 
713 //_____________________________________________________________________________
714 Int_t TGeant3TGeo::NofVolDaughters(const char* volName) const
715 {
716 // Return number of daughters of the volume specified by volName
717 // According to A. Morsch' G3toRoot class
718 // ---
719 
720  return fMCGeo->NofVolDaughters(volName);
721 }
722 
723 //_____________________________________________________________________________
724 const char* TGeant3TGeo::VolDaughterName(const char* volName, Int_t i) const
725 {
726 // Return the name of i-th daughters of the volume specified by volName
727 // According to A. Morsch' G3toRoot class
728 // ---
729 
730  return fMCGeo->VolDaughterName(volName, i);
731 }
732 
733 
734 //_____________________________________________________________________________
735 Int_t TGeant3TGeo::VolDaughterCopyNo(const char* volName, Int_t i) const
736 {
737 // Return the copyNo of i-th daughters of the volume specified by volName
738 // According to A. Morsch' G3toRoot class
739 // ---
740 
741  return fMCGeo->VolDaughterCopyNo(volName, i);
742 }
743 
744 //_____________________________________________________________________________
745 Int_t TGeant3TGeo::VolId2Mate(Int_t id) const
746 {
747  //
748  // Return material number for a given volume id
749  //
750  return fMCGeo->VolId2Mate(id);
751 }
752 
753 //_____________________________________________________________________________
754 const char* TGeant3TGeo::VolName(Int_t id) const
755 {
756  //
757  // Return the volume name given the volume identifier
758  //
759  return fMCGeo->VolName(id);
760 }
761 
762 //_____________________________________________________________________________
763 void TGeant3TGeo::Material(Int_t& kmat, const char* name, Double_t a, Double_t z,
764  Double_t dens, Double_t radl, Double_t absl, Float_t* buf,
765  Int_t nwbuf)
766 {
767  //
768  // Defines a Material
769  //
770  // kmat number assigned to the material
771  // name material name
772  // a atomic mass in au
773  // z atomic number
774  // dens density in g/cm3
775  // absl absorbtion length in cm
776  // if >=0 it is ignored and the program
777  // calculates it, if <0. -absl is taken
778  // radl radiation length in cm
779  // if >=0 it is ignored and the program
780  // calculates it, if <0. -radl is taken
781  // buf pointer to an array of user words
782  // nbuf number of user words
783  //
784 
785  Float_t* fbuf = CreateFloatArray(buf, nwbuf);
786  G3Material(kmat, name, a, z, dens, radl, absl, fbuf, nwbuf);
787  delete [] fbuf;
788 
789  fMCGeo->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
790 }
791 
792 //_____________________________________________________________________________
793 void TGeant3TGeo::Material(Int_t& kmat, const char* name, Double_t a, Double_t z,
794  Double_t dens, Double_t radl, Double_t absl, Double_t* buf,
795  Int_t nwbuf)
796 {
797  //
798  // Defines a Material
799  //
800  // kmat number assigned to the material
801  // name material name
802  // a atomic mass in au
803  // z atomic number
804  // dens density in g/cm3
805  // absl absorbtion length in cm
806  // if >=0 it is ignored and the program
807  // calculates it, if <0. -absl is taken
808  // radl radiation length in cm
809  // if >=0 it is ignored and the program
810  // calculates it, if <0. -radl is taken
811  // buf pointer to an array of user words
812  // nbuf number of user words
813  //
814 
815 
816  Float_t* fbuf = CreateFloatArray(buf, nwbuf);
817  G3Material(kmat, name, a, z, dens, radl, absl, fbuf, nwbuf);
818  delete [] fbuf;
819 
820  fMCGeo->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
821 }
822 
823 //_____________________________________________________________________________
824 void TGeant3TGeo::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
825  Double_t dens, Int_t nlmat, Float_t* wmat)
826 {
827  //
828  // Defines mixture OR COMPOUND IMAT as composed by
829  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
830  //
831  // If NLMAT > 0 then wmat contains the proportion by
832  // weights of each basic material in the mixture.
833  //
834  // If nlmat < 0 then WMAT contains the number of atoms
835  // of a given kind into the molecule of the COMPOUND
836  // In this case, WMAT in output is changed to relative
837  // weigths.
838  //
839 
840  G3Mixture(kmat, name, a, z, dens, nlmat, wmat);
841 
842  fMCGeo->Mixture(kmat, name, a, z, dens, TMath::Abs(nlmat), wmat);
843 }
844 
845 //_____________________________________________________________________________
846 void TGeant3TGeo::Mixture(Int_t& kmat, const char* name, Double_t* a, Double_t* z,
847  Double_t dens, Int_t nlmat, Double_t* wmat)
848 {
849  //
850  // Defines mixture OR COMPOUND IMAT as composed by
851  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
852  //
853  // If NLMAT > 0 then wmat contains the proportion by
854  // weights of each basic material in the mixture.
855  //
856  // If nlmat < 0 then WMAT contains the number of atoms
857  // of a given kind into the molecule of the COMPOUND
858  // In this case, WMAT in output is changed to relative
859  // weigths.
860  //
861 
862  Float_t* fa = CreateFloatArray(a, TMath::Abs(nlmat));
863  Float_t* fz = CreateFloatArray(z, TMath::Abs(nlmat));
864  Float_t* fwmat = CreateFloatArray(wmat, TMath::Abs(nlmat));
865 
866  G3Mixture(kmat, name, fa, fz, dens, nlmat, fwmat);
867  Int_t i;
868  for (i=0; i<TMath::Abs(nlmat); i++) {
869  a[i] = fa[i]; z[i] = fz[i]; wmat[i] = fwmat[i];
870  }
871 
872  delete [] fa;
873  delete [] fz;
874  delete [] fwmat;
875 
876  fMCGeo->Mixture(kmat, name, a, z, dens, TMath::Abs(nlmat), wmat);
877 }
878 
879 //_____________________________________________________________________________
880 void TGeant3TGeo::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
881  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
882  Double_t stemax, Double_t deemax, Double_t epsil,
883  Double_t stmin, Float_t* ubuf, Int_t nbuf)
884 {
885  //
886  // kmed tracking medium number assigned
887  // name tracking medium name
888  // nmat material number
889  // isvol sensitive volume flag
890  // ifield magnetic field
891  // fieldm max. field value (kilogauss)
892  // tmaxfd max. angle due to field (deg/step)
893  // stemax max. step allowed
894  // deemax max. fraction of energy lost in a step
895  // epsil tracking precision (cm)
896  // stmin min. step due to continuous processes (cm)
897  //
898  // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
899  // ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
900  // performed with g3helix; ifield = 3 if tracking performed with g3helx3.
901  //
902 
903  G3Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil,
904  stmin, ubuf, nbuf);
905 
906  fMCGeo->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
907  epsil, stmin, ubuf, nbuf);
908 }
909 
910 //_____________________________________________________________________________
911 void TGeant3TGeo::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
912  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
913  Double_t stemax, Double_t deemax, Double_t epsil,
914  Double_t stmin, Double_t* ubuf, Int_t nbuf)
915 {
916  //
917  // kmed tracking medium number assigned
918  // name tracking medium name
919  // nmat material number
920  // isvol sensitive volume flag
921  // ifield magnetic field
922  // fieldm max. field value (kilogauss)
923  // tmaxfd max. angle due to field (deg/step)
924  // stemax max. step allowed
925  // deemax max. fraction of energy lost in a step
926  // epsil tracking precision (cm)
927  // stmin min. step due to continuos processes (cm)
928  //
929  // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
930  // ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
931  // performed with g3helix; ifield = 3 if tracking performed with g3helx3.
932  //
933 
934  Float_t* fubuf = CreateFloatArray(ubuf, nbuf);
935  G3Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil,
936  stmin, fubuf, nbuf);
937  delete [] fubuf;
938 
939  fMCGeo->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
940  epsil, stmin, ubuf, nbuf);
941 }
942 
943 //_____________________________________________________________________________
944 void TGeant3TGeo::Matrix(Int_t& krot, Double_t thex, Double_t phix, Double_t they,
945  Double_t phiy, Double_t thez, Double_t phiz)
946 {
947  //
948  // krot rotation matrix number assigned
949  // theta1 polar angle for axis i
950  // phi1 azimuthal angle for axis i
951  // theta2 polar angle for axis ii
952  // phi2 azimuthal angle for axis ii
953  // theta3 polar angle for axis iii
954  // phi3 azimuthal angle for axis iii
955  //
956  // it defines the rotation matrix number irot.
957  //
958  krot = -1;
959  fMCGeo->Matrix(krot, thex, phix, they, phiy, thez, phiz);
960 }
961 
962 //_____________________________________________________________________________
964 {
965 // Notify Geant3 about use of TGeo geometry.
966 // The materials and tracking medias will be imported from
967 // TGeo at FinishGeometry().
968 
969 
970  fImportRootGeometry = kTRUE;
971 }
972 
973 //_____________________________________________________________________________
974 const char *TGeant3TGeo::GetPath()
975 {
976 // Get current path inside G3 geometry
977  return gGeoManager->GetPath();
978 }
979 
980 //_____________________________________________________________________________
982 {
983 // Get name of current G3 node
984  if (gGeoManager->IsOutside()) return "";
985  return gGeoManager->GetCurrentNode()->GetName();
986 }
987 
988 //______________________________________________________________________
989 Bool_t TGeant3TGeo::GetTransformation(const TString &volumePath,TGeoHMatrix &mat)
990 {
991  // Returns the Transformation matrix between the volume specified
992  // by the path volumePath and the Top or mater volume. The format
993  // of the path volumePath is as follows (assuming ALIC is the Top volume)
994  // "/ALIC_1/DDIP_1/S05I_2/S05H_1/S05G_3". Here ALIC is the top most
995  // or master volume which has only 1 instance of. Of all of the daughter
996  // volumes of ALICE, DDIP volume copy #1 is indicated. Similarly for
997  // the daughter volume of DDIP is S05I copy #2 and so on.
998  // Inputs:
999  // TString& volumePath The volume path to the specific volume
1000  // for which you want the matrix. Volume name
1001  // hierarchy is separated by "/" while the
1002  // copy number is appended using a "_".
1003  // Outputs:
1004  // TGeoHMatrix &mat A matrix with its values set to those
1005  // appropriate to the Local to Master transformation
1006  // Return:
1007  // A logical value if kFALSE then an error occurred and no change to
1008  // mat was made.
1009 
1010  // We have to preserve the modeler state
1011  return fMCGeo->GetTransformation(volumePath, mat);
1012 }
1013 
1014 //______________________________________________________________________
1015 Bool_t TGeant3TGeo::GetShape(const TString &volumePath,TString &shapeType,
1016  TArrayD &par)
1017 {
1018  // Returns the shape and its parameters for the volume specified
1019  // by volumeName.
1020  // Inputs:
1021  // TString& volumeName The volume name
1022  // Outputs:
1023  // TString &shapeType Shape type
1024  // TArrayD &par A TArrayD of parameters with all of the
1025  // parameters of the specified shape.
1026  // Return:
1027  // A logical indicating whether there was an error in getting this
1028  // information
1029  return fMCGeo->GetShape(volumePath, shapeType, par);
1030 }
1031 
1032 //______________________________________________________________________
1033 Bool_t TGeant3TGeo::GetMaterial(const TString &volumeName,
1034  TString &name,Int_t &imat,
1035  Double_t &a,Double_t &z,Double_t &dens,
1036  Double_t &radl,Double_t &inter,TArrayD &par)
1037 {
1038  // Returns the Material and its parameters for the volume specified
1039  // by volumeName.
1040  // Note, Geant3 stores and uses mixtures as an element with an effective
1041  // Z and A. Consequently, if the parameter Z is not integer, then
1042  // this material represents some sort of mixture.
1043  // Inputs:
1044  // TString& volumeName The volume name
1045  // Outputs:
1046  // TSrting &name Material name
1047  // Int_t &imat Material index number
1048  // Double_t &a Average Atomic mass of material
1049  // Double_t &z Average Atomic number of material
1050  // Double_t &dens Density of material [g/cm^3]
1051  // Double_t &radl Average radiation length of material [cm]
1052  // Double_t &inter Average interaction length of material [cm]
1053  // TArrayD &par A TArrayD of user defined parameters.
1054  // Return:
1055  // kTRUE if no errors
1056  Int_t i,jma,nbuf;
1057  Float_t af,zf,densf,radlf,interf;
1058  Float_t *ubuf;
1059  Char_t namec[20] = {20*'\0'};
1060  TGeoVolume *vol = gGeoManager->GetVolume(volumeName.Data());
1061  if (!vol) return kFALSE;
1062  TGeoMedium *med = vol->GetMedium();
1063  if (!med) return kFALSE;
1064  TGeoMaterial *mat = med->GetMaterial();
1065  imat = mat->GetUniqueID();
1066 
1067  nbuf = jma = Lq()[Gclink()->jmate-imat];
1068  ubuf = new Float_t[nbuf];
1069  Gfmate(imat,namec,af,zf,densf,radlf,interf,ubuf,nbuf);
1070  name = mat->GetName();
1071  name = name.Strip(TString::kTrailing, '$');
1072  //
1073  par.Set(nbuf);
1074  for(i=0;i<nbuf;i++) par.AddAt(((Double_t)ubuf[i]),i);
1075  delete[] ubuf;
1076  a = mat->GetA();
1077  z = mat->GetZ();
1078  dens = mat->GetDensity();
1079  radl = radlf;
1080  inter = interf;
1081  return kTRUE;
1082 }
1083 
1084 //______________________________________________________________________
1085 Bool_t TGeant3TGeo::GetMedium(const TString &volumeName,TString &name,
1086  Int_t &imed,Int_t &nmat,Int_t &isvol,Int_t &ifield,
1087  Double_t &fieldm,Double_t &tmaxfd,Double_t &stemax,
1088  Double_t &deemax,Double_t &epsil, Double_t &stmin,
1089  TArrayD &par)
1090 {
1091  // Returns the Medium and its parameters for the volume specified
1092  // by volumeName.
1093  // Inputs:
1094  // TString& volumeName The volume name.
1095  // Outputs:
1096  // TString &name Medium name
1097  // Int_t &nmat Material number defined for this medium
1098  // Int_t &imed The medium index number
1099  // Int_t &isvol volume number defined for this medium
1100  // Int_t &iflield Magnetic field flag
1101  // Double_t &fieldm Magnetic field strength
1102  // Double_t &tmaxfd Maximum angle of deflection per step
1103  // Double_t &stemax Maximum step size
1104  // Double_t &deemax Maximum fraction of energy allowed to be lost
1105  // to continuous process.
1106  // Double_t &epsil Boundary crossing precision
1107  // Double_t &stmin Minimum step size allowed
1108  // TArrayD &par A TArrayD of user parameters with all of the
1109  // parameters of the specified medium.
1110  // Return:
1111  // kTRUE if there where no errors
1112  Int_t i,nbuf;
1113  Float_t fieldmf,tmaxfdf,stemaxf,deemaxf,epsilf,stminf;
1114  Float_t *buf;
1115  Char_t namec[25] = {25*'\0'};
1116  TGeoVolume *vol = gGeoManager->GetVolume(volumeName.Data());
1117  if (!vol) return kFALSE;
1118  TGeoMedium *med = vol->GetMedium();
1119  if (!med) return kFALSE;
1120  imed = med->GetId();
1121  nbuf = Lq()[Gclink()->jtmed-imed];
1122  buf = new Float_t[nbuf];
1123  Gftmed(imed,namec,nmat,isvol,ifield,fieldmf,tmaxfdf,stemaxf,deemaxf,
1124  epsilf,stminf,buf,&nbuf);
1125  name = med->GetName();
1126  name = name.Strip(TString::kTrailing, '$');
1127  par.Set(nbuf);
1128  for(i=0;i<nbuf;i++) par.AddAt(((Double_t)buf[i]),i);
1129  delete[] buf;
1130  fieldm = (Double_t) fieldmf;
1131  tmaxfd = (Double_t) tmaxfdf;
1132  stemax = (Double_t) stemaxf;
1133  deemax = (Double_t) deemaxf;
1134  epsil = (Double_t) epsilf;
1135  stmin = (Double_t) stminf;
1136  return kTRUE;
1137 }
1138 
1139 //_____________________________________________________________________________
1141 {
1142 // Temporary added
1143 
1144  return TGeant3::GetMedium();
1145 }
1146 
1147 
1148 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1149 //
1150 // Functions from GBASE
1151 //
1152 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1153 //_____________________________________________________________________________
1155 {
1156  //
1157  // Closes off the geometry setting.
1158  // Initializes the search list for the contents of each
1159  // volume following the order they have been positioned, and
1160  // inserting the content '0' when a call to GSNEXT (-1) has
1161  // been required by the user.
1162  // Performs the development of the JVOLUM structure for all
1163  // volumes with variable parameters, by calling GGDVLP.
1164  // Interprets the user calls to GSORD, through GGORD.
1165  // Computes and stores in a bank (next to JVOLUM mother bank)
1166  // the number of levels in the geometrical tree and the
1167  // maximum number of contents per level, by calling GGNLEV.
1168  // Sets status bit for CONCAVE volumes, through GGCAVE.
1169  // Completes the JSET structure with the list of volume names
1170  // which identify uniquely a given physical detector, the
1171  // list of bit numbers to pack the corresponding volume copy
1172  // numbers, and the generic path(s) in the JVOLUM tree,
1173  // through the routine GHCLOS.
1174  //
1175  fVolNames = 0;
1176 }
1177 
1178 //_____________________________________________________________________________
1179 void TGeant3TGeo::Gprint(const char * /*name*/)
1180 {
1181  //
1182  // Routine to print data structures
1183  // CHNAME name of a data structure
1184  //
1185 }
1186 
1187 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1188 //
1189 // Functions from GCONS
1190 //
1191 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1192 
1193 //_____________________________________________________________________________
1194 void TGeant3TGeo::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1195  Float_t dens, Float_t radl, Float_t absl)
1196 {
1197  //
1198  // Defines a Material
1199  //
1200  // kmat number assigned to the material
1201  // name material name
1202  // a atomic mass in au
1203  // z atomic number
1204  // dens density in g/cm3
1205  // absl absorbtion length in cm
1206  // if >=0 it is ignored and the program
1207  // calculates it, if <0. -absl is taken
1208  // radl radiation length in cm
1209  // if >=0 it is ignored and the program
1210  // calculates it, if <0. -radl is taken
1211  // buf pointer to an array of user words
1212  // nbuf number of user words
1213  //
1214  Float_t *ubuf=0;
1215  Int_t nbuf=0;
1216  if (dens <= 0 && a != 0 && z != 0) {
1217  Warning("Gsmate","Density was o, set to 0.01 for imat=%d, name=%s",imat,name);
1218  dens = 0.01;
1219  }
1220  g3smate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1221  PASSCHARL(name));
1222 
1223  gGeoManager->Material(name,a,z,dens,imat);
1224 }
1225 
1226 //_____________________________________________________________________________
1227 void TGeant3TGeo::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1228  Float_t dens, Int_t nlmat, Float_t *wmat)
1229 {
1230  //
1231  // Defines mixture OR COMPOUND IMAT as composed by
1232  // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1233  //
1234  // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1235  // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1236  //
1237  // If NLMAT.LT.0 then WMAT contains the number of atoms
1238  // of a given kind into the molecule of the COMPOUND
1239  // In this case, WMAT in output is changed to relative
1240  // weigths.
1241  //
1242  g3smixt(imat,PASSCHARD(name),a,z,dens,nlmat,wmat PASSCHARL(name));
1243  fMCGeo->Mixture(imat, name, a, z, dens, TMath::Abs(nlmat), wmat);
1244 }
1245 
1246 //_____________________________________________________________________________
1247 void TGeant3TGeo::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1248  Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1249  Float_t stemax, Float_t deemax, Float_t epsil,
1250  Float_t stmin)
1251 {
1252  //
1253  // NTMED Tracking medium number
1254  // NAME Tracking medium name
1255  // NMAT Material number
1256  // ISVOL Sensitive volume flag
1257  // IFIELD Magnetic field
1258  // FIELDM Max. field value (Kilogauss)
1259  // TMAXFD Max. angle due to field (deg/step)
1260  // STEMAX Max. step allowed
1261  // DEEMAX Max. fraction of energy lost in a step
1262  // EPSIL Tracking precision (cm)
1263  // STMIN Min. step due to continuous processes (cm)
1264  //
1265  // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1266  // IFIELD = 1 if tracking performed with G3RKUTA; IFIELD = 2 if tracking
1267  // performed with G3HELIX; IFIELD = 3 if tracking performed with G3HELX3.
1268  //
1269  Float_t *ubuf=0;
1270  Int_t nbuf=0;
1271  g3stmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1272  deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1273 
1274  gGeoManager->Medium(name,numed,nmat, isvol, ifield, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
1275 }
1276 //_____________________________________________________________________________
1278 {
1279  //
1280  // Controls tracking of all particles belonging to the current event
1281  //
1282  g3treve();
1283 }
1284 
1285 //_____________________________________________________________________________
1287 {
1288  //
1289  // Controls tracking of all particles belonging to the current event
1290  //
1291  gtreveroot();
1292 }
1293 
1294 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1295 //
1296 // Functions from GGEOM
1297 //
1298 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1299 
1300 //_____________________________________________________________________________
1301 void TGeant3TGeo::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
1302 {
1303  //
1304  // Computes coordinates XM (Master Reference System
1305  // knowing the coordinates XD (Detector Ref System)
1306  // The local reference system can be initialized by
1307  // - the tracking routines and GDTOM used in GUSTEP
1308  // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
1309  // (inverse routine is GMTOD)
1310  //
1311  // If IFLAG=1 convert coordinates
1312  // IFLAG=2 convert direction cosinus
1313  //
1314  Double_t XM[3], XD[3];
1315  Int_t i;
1316  for (i=0;i<3;i++) XD[i] = xd[i];
1317  if (iflag == 1) gGeoManager->LocalToMaster(XD,XM);
1318  else gGeoManager->LocalToMasterVect(XD,XM);
1319  for (i=0;i<3;i++) xm[i]=XM[i];
1320 }
1321 
1322 //_____________________________________________________________________________
1323 void TGeant3TGeo::Gdtom(Double_t *xd, Double_t *xm, Int_t iflag)
1324 {
1325  //
1326  // Computes coordinates XM (Master Reference System
1327  // knowing the coordinates XD (Detector Ref System)
1328  // The local reference system can be initialized by
1329  // - the tracking routines and GDTOM used in GUSTEP
1330  // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
1331  // (inverse routine is GMTOD)
1332  //
1333  // If IFLAG=1 convert coordinates
1334  // IFLAG=2 convert direction cosinus
1335  //
1336 
1337  if (iflag == 1) gGeoManager->LocalToMaster(xd,xm);
1338  else gGeoManager->LocalToMasterVect(xd,xm);
1339 }
1340 
1341 //_____________________________________________________________________________
1342 void TGeant3TGeo::Gmedia(Float_t *x, Int_t &numed)
1343 {
1344  //
1345  // Finds in which volume/medium the point X is, and updates the
1346  // common /GCVOLU/ and the structure JGPAR accordingly.
1347  //
1348  // NUMED returns the tracking medium number, or 0 if point is
1349  // outside the experimental setup.
1350  //
1351 
1352  gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
1353  if (gGeoManager->IsOutside()) {
1354  numed=0;
1355  } else {
1356  gcvolu->nlevel = 1 + gGeoManager->GetLevel();
1357  gGeoManager->GetBranchNames(gcvolu->names);
1358  gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
1359  TGeoVolume *vol = gCurrentNode->GetVolume();
1360  if (vol) {
1361  TGeoMedium *medium = vol->GetMedium();
1362  if (medium) numed = medium->GetId();
1363  } else {
1364  printf("ERROR: gmedia: NULL volume\n");
1365  }
1366  }
1367 }
1368 
1369 //_____________________________________________________________________________
1370 void TGeant3TGeo::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
1371 {
1372  //
1373  // Computes coordinates XD (in DRS)
1374  // from known coordinates XM in MRS
1375  // The local reference system can be initialized by
1376  // - the tracking routines and GMTOD used in GUSTEP
1377  // - a call to GMEDIA(XM,NUMED,CHECK)
1378  // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
1379  // (inverse routine is GDTOM)
1380  //
1381  // If IFLAG=1 convert coordinates
1382  // IFLAG=2 convert direction cosinus
1383  //
1384  Double_t XM[3], XD[3];
1385  Int_t i;
1386  for (i=0;i<3;i++) XM[i]=xm[i];
1387  if (iflag == 1) gGeoManager->MasterToLocal(XM,XD);
1388  else gGeoManager->MasterToLocalVect(XM,XD);
1389  for (i=0;i<3;i++) xd[i] = XD[i];
1390 }
1391 
1392 //_____________________________________________________________________________
1393 void TGeant3TGeo::Gmtod(Double_t *xm, Double_t *xd, Int_t iflag)
1394 {
1395  //
1396  // Computes coordinates XD (in DRS)
1397  // from known coordinates XM in MRS
1398  // The local reference system can be initialized by
1399  // - the tracking routines and GMTOD used in GUSTEP
1400  // - a call to GMEDIA(XM,NUMED,CHECK)
1401  // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
1402  // (inverse routine is GDTOM)
1403  //
1404  // If IFLAG=1 convert coordinates
1405  // IFLAG=2 convert direction cosinus
1406  //
1407 
1408 
1409  if (iflag == 1) gGeoManager->MasterToLocal(xm,xd);
1410  else gGeoManager->MasterToLocalVect(xm,xd);
1411 }
1412 
1413 //_____________________________________________________________________________
1414 void TGeant3TGeo::Gsdvn(const char *name, const char *mother, Int_t ndiv,
1415  Int_t iaxis)
1416 {
1417  //
1418  // Create a new volume by dividing an existing one
1419  //
1420  // NAME Volume name
1421  // MOTHER Mother volume name
1422  // NDIV Number of divisions
1423  // IAXIS Axis value
1424  //
1425  // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
1426  // It divides a previously defined volume.
1427  //
1428  fMCGeo->Gsdvn(name, mother, ndiv, iaxis);
1429 }
1430 
1431 //_____________________________________________________________________________
1432 void TGeant3TGeo::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
1433  Int_t iaxis, Double_t c0i, Int_t numed)
1434 {
1435  //
1436  // Create a new volume by dividing an existing one
1437  //
1438  // Divides mother into ndiv divisions called name
1439  // along axis iaxis starting at coordinate value c0.
1440  // the new volume created will be medium number numed.
1441  //
1442  fMCGeo->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
1443 }
1444 
1445 //_____________________________________________________________________________
1446 void TGeant3TGeo::Gsdvs(const char *name, const char *mother, Float_t step,
1447  Int_t iaxis, Int_t numed)
1448 {
1449  //
1450  // Create a new volume by dividing an existing one
1451  //
1452  gGeoManager->Division(name,mother,iaxis,0,0,step,numed,"s");
1453 }
1454 
1455 //_____________________________________________________________________________
1456 void TGeant3TGeo::Gsdvs2(const char *name, const char *mother, Float_t step,
1457  Int_t iaxis, Float_t c0, Int_t numed)
1458 {
1459  //
1460  // Create a new volume by dividing an existing one
1461  //
1462  gGeoManager->Division(name,mother,iaxis,0,c0,step,numed,"sx");
1463 }
1464 
1465 //_____________________________________________________________________________
1466 void TGeant3TGeo::Gsdvt(const char *name, const char *mother, Double_t step,
1467  Int_t iaxis, Int_t numed, Int_t ndvmx)
1468 {
1469  //
1470  // Create a new volume by dividing an existing one
1471  //
1472  // Divides MOTHER into divisions called NAME along
1473  // axis IAXIS in steps of STEP. If not exactly divisible
1474  // will make as many as possible and will centre them
1475  // with respect to the mother. Divisions will have medium
1476  // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
1477  // NDVMX is the expected maximum number of divisions
1478  // (If 0, no protection tests are performed)
1479  //
1480  fMCGeo->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
1481 }
1482 
1483 //_____________________________________________________________________________
1484 void TGeant3TGeo::Gsdvt2(const char *name, const char *mother, Double_t step,
1485  Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
1486 {
1487  //
1488  // Create a new volume by dividing an existing one
1489  //
1490  // Divides MOTHER into divisions called NAME along
1491  // axis IAXIS starting at coordinate value C0 with step
1492  // size STEP.
1493  // The new volume created will have medium number NUMED.
1494  // If NUMED is 0, NUMED of mother is taken.
1495  // NDVMX is the expected maximum number of divisions
1496  // (If 0, no protection tests are performed)
1497  //
1498  fMCGeo->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
1499 }
1500 
1501 //_____________________________________________________________________________
1502 void TGeant3TGeo::Gsord(const char * /*name*/, Int_t /*iax*/)
1503 {
1504  //
1505  // Flags volume CHNAME whose contents will have to be ordered
1506  // along axis IAX, by setting the search flag to -IAX
1507  // IAX = 1 X axis
1508  // IAX = 2 Y axis
1509  // IAX = 3 Z axis
1510  // IAX = 4 Rxy (static ordering only -> GTMEDI)
1511  // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
1512  // IAX = 5 Rxyz (static ordering only -> GTMEDI)
1513  // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
1514  // IAX = 6 PHI (PHI=0 => X axis)
1515  // IAX = 7 THETA (THETA=0 => Z axis)
1516  //
1517 
1518 }
1519 
1520 //_____________________________________________________________________________
1521 void TGeant3TGeo::Gspos(const char *name, Int_t nr, const char *mother, Double_t x,
1522  Double_t y, Double_t z, Int_t irot, const char *konly)
1523 {
1524  //
1525  // Position a volume into an existing one
1526  //
1527  // NAME Volume name
1528  // NUMBER Copy number of the volume
1529  // MOTHER Mother volume name
1530  // X X coord. of the volume in mother ref. sys.
1531  // Y Y coord. of the volume in mother ref. sys.
1532  // Z Z coord. of the volume in mother ref. sys.
1533  // IROT Rotation matrix number w.r.t. mother ref. sys.
1534  // ONLY ONLY/MANY flag
1535  //
1536  // It positions a previously defined volume in the mother.
1537  //
1538  fMCGeo->Gspos(name, nr, mother, x, y, z, irot, konly);
1539 }
1540 
1541 //_____________________________________________________________________________
1542 void TGeant3TGeo::Gsposp(const char *name, Int_t nr, const char *mother,
1543  Double_t x, Double_t y, Double_t z, Int_t irot,
1544  const char *konly, Float_t *upar, Int_t np )
1545 {
1546  //
1547  // Place a copy of generic volume NAME with user number
1548  // NR inside MOTHER, with its parameters UPAR(1..NP)
1549  //
1550 
1551  fMCGeo->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
1552 }
1553 
1554 //_____________________________________________________________________________
1555 void TGeant3TGeo::Gsposp(const char *name, Int_t nr, const char *mother,
1556  Double_t x, Double_t y, Double_t z, Int_t irot,
1557  const char *konly, Double_t *upar, Int_t np )
1558 {
1559  //
1560  // Place a copy of generic volume NAME with user number
1561  // NR inside MOTHER, with its parameters UPAR(1..NP)
1562  //
1563 
1564  fMCGeo->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
1565 }
1566 
1567 //_____________________________________________________________________________
1568 void TGeant3TGeo::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
1569  Float_t phi2, Float_t theta3, Float_t phi3)
1570 {
1571  //
1572  // nmat Rotation matrix number
1573  // THETA1 Polar angle for axis I
1574  // PHI1 Azimuthal angle for axis I
1575  // THETA2 Polar angle for axis II
1576  // PHI2 Azimuthal angle for axis II
1577  // THETA3 Polar angle for axis III
1578  // PHI3 Azimuthal angle for axis III
1579  //
1580  // It defines the rotation matrix number IROT.
1581  //
1582 
1583  gGeoManager->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
1584 }
1585 
1586 //_____________________________________________________________________________
1587 void TGeant3TGeo::Gprotm(Int_t nmat)
1588 {
1589  //
1590  // To print rotation matrices structure JROTM
1591  // nmat Rotation matrix number
1592  //
1593  TIter next(gGeoManager->GetListOfMatrices());
1594  TGeoMatrix *matrix;
1595  while ((matrix = (TGeoMatrix*)next())) {
1596  if (UInt_t(nmat) == matrix->GetUniqueID()) {
1597  matrix->Print();
1598  return;
1599  }
1600  }
1601  Error("Gprotm","Rotation with id=%i not found", nmat);
1602  }
1603 
1604 //_____________________________________________________________________________
1605 Int_t TGeant3TGeo::Gsvolu(const char *name, const char *shape, Int_t nmed,
1606  Float_t *upar, Int_t npar)
1607 {
1608  //
1609  // NAME Volume name
1610  // SHAPE Volume type
1611  // NUMED Tracking medium number
1612  // NPAR Number of shape parameters
1613  // UPAR Vector containing shape parameters
1614  //
1615  // It creates a new volume in the JVOLUM data structure.
1616  //
1617 
1618  Int_t ivolu = 0;
1619  ivolu = fMCGeo->Gsvolu(name, shape, nmed, upar, npar);
1620  return ivolu;
1621 
1622 }
1623 
1624 //_____________________________________________________________________________
1625 Int_t TGeant3TGeo::Gsvolu(const char *name, const char *shape, Int_t nmed,
1626  Double_t *upar, Int_t npar)
1627 {
1628  //
1629  // NAME Volume name
1630  // SHAPE Volume type
1631  // NUMED Tracking medium number
1632  // NPAR Number of shape parameters
1633  // UPAR Vector containing shape parameters
1634  //
1635  // It creates a new volume in the JVOLUM data structure.
1636  //
1637 
1638 
1639  Int_t ivolu = 0;
1640  ivolu = fMCGeo->Gsvolu(name, shape, nmed, upar, npar);
1641  return ivolu;
1642 }
1643 
1644 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1645 //
1646 // T H E D R A W I N G P A C K A G E
1647 // ======================================
1648 // Drawing functions. These functions allow the visualization in several ways
1649 // of the volumes defined in the geometrical data structure. It is possible
1650 // to draw the logical tree of volumes belonging to the detector (DTREE),
1651 // to show their geometrical specification (DSPEC,DFSPC), to draw them
1652 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
1653 // these commands when the hidden line removal option is activated; in
1654 // this case, the volumes can be also either translated in the space
1655 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
1656 // possible to fill the surfaces of the volumes
1657 // with solid colours when the shading option (SHAD) is activated.
1658 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
1659 // of the detectors or to scan physical events as well.
1660 // Finally, the command MOVE will allow the rotation, translation and zooming
1661 // on real time parts of the detectors or tracks and hits of a simulated event.
1662 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
1663 // the drawing is performed by the Geant ray-tracing;
1664 // automatically, the color is assigned according to the tracking medium of each
1665 // volume and the volumes with a density lower/equal than the air are considered
1666 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
1667 // the user can set color and visibility for the desired volumes via the command
1668 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
1669 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
1670 // is the ratio between the number of pixels drawn and 20 (user coordinates).
1671 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
1672 // first case, we assume that the first mother volume of the tree is a box with
1673 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
1674 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
1675 // second case, the distance between the observer and the origin of the world
1676 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
1677 // or telescopic effects can be achieved changing the scale factors in the command
1678 // (DRAW). When the final picture does not occupy the full window,
1679 // mapping the space before tracing can speed up the drawing, but can also
1680 // produce less precise results; values from 1 to 4 are allowed in the command
1681 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
1682 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
1683 // The command (VALCUT) allows the cutting of the detector by three planes
1684 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
1685 // SATT for any desired volume and can assume values from 0 to 7; it determines
1686 // the different light processing to be performed for different materials:
1687 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
1688 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
1689 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
1690 // is 0.9) and the observer is assumed to have a light source (therefore he will
1691 // produce parallel light in the case of parallel view and point-like-source
1692 // light in the case of perspective view).
1693 //
1694 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1695 
1696 //_____________________________________________________________________________
1697 void TGeant3TGeo::Gsatt(const char *name, const char *att, Int_t val)
1698 {
1699  //
1700  // NAME Volume name
1701  // IOPT Name of the attribute to be set
1702  // IVAL Value to which the attribute is to be set
1703  //
1704  // name= "*" stands for all the volumes.
1705  // iopt can be chosen among the following :
1706  //
1707  // WORK 0=volume name is inactive for the tracking
1708  // 1=volume name is active for the tracking (default)
1709  //
1710  // SEEN 0=volume name is invisible
1711  // 1=volume name is visible (default)
1712  // -1=volume invisible with all its descendants in the tree
1713  // -2=volume visible but not its descendants in the tree
1714  //
1715  // LSTY line style 1,2,3,... (default=1)
1716  // LSTY=7 will produce a very precise approximation for
1717  // revolution bodies.
1718  //
1719  // LWID line width -7,...,1,2,3,..7 (default=1)
1720  // LWID<0 will act as abs(LWID) was set for the volume
1721  // and for all the levels below it. When SHAD is 'ON', LWID
1722  // represent the linewidth of the scan lines filling the surfaces
1723  // (whereas the FILL value represent their number). Therefore
1724  // tuning this parameter will help to obtain the desired
1725  // quality/performance ratio.
1726  //
1727  // COLO colour code -166,...,1,2,..166 (default=1)
1728  // n=1=black
1729  // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
1730  // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
1731  // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
1732  // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
1733  // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
1734  // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
1735  // colour=n*10+m, m=1,2,...9, will produce the same colour
1736  // as 'n', but with increasing luminosity according to 'm';
1737  // COLO<0 will act as if abs(COLO) was set for the volume
1738  // and for all the levels below it.
1739  // When for a volume the attribute FILL is > 1 (and the
1740  // option SHAD is on), the ABS of its colour code must be < 8
1741  // because an automatic shading of its faces will be
1742  // performed.
1743  //
1744  // FILL (1992) fill area -7,...,0,1,...7 (default=0)
1745  // when option SHAD is "on" the FILL attribute of any
1746  // volume can be set different from 0 (normal drawing);
1747  // if it is set to 1, the faces of such volume will be filled
1748  // with solid colours; if ABS(FILL) is > 1, then a light
1749  // source is placed along the observer line, and the faces of
1750  // such volumes will be painted by colours whose luminosity
1751  // will depend on the amount of light reflected;
1752  // if ABS(FILL) = 1, then it is possible to use all the 166
1753  // colours of the colour table, becouse the automatic shading
1754  // is not performed;
1755  // for increasing values of FILL the drawing will be performed
1756  // with higher and higher resolution improving the quality (the
1757  // number of scan lines used to fill the faces increases with FILL);
1758  // it is possible to set different values of FILL
1759  // for different volumes, in order to optimize at the same time
1760  // the performance and the quality of the picture;
1761  // FILL<0 will act as if abs(FILL) was set for the volume
1762  // and for all the levels below it.
1763  // This kind of drawing can be saved in 'picture files'
1764  // or in view banks.
1765  // 0=drawing without fill area
1766  // 1=faces filled with solid colours and resolution = 6
1767  // 2=lowest resolution (very fast)
1768  // 3=default resolution
1769  // 4=.................
1770  // 5=.................
1771  // 6=.................
1772  // 7=max resolution
1773  // Finally, if a coloured background is desired, the FILL
1774  // attribute for the first volume of the tree must be set
1775  // equal to -abs(colo), colo being >0 and <166.
1776  //
1777  // SET set number associated to volume name
1778  // DET detector number associated to volume name
1779  // DTYP detector type (1,2)
1780  //
1781 // InitHIGZ();
1782  gGeoManager->SetVolumeAttribute(name, att, val);
1783 }
1784 
1785 //_____________________________________________________________________________
1786 Int_t TGeant3TGeo::Glvolu(Int_t /*nlev*/, Int_t * /*lnam*/,Int_t * /*lnum*/)
1787 {
1788  //
1789  // nlev number of leveles deap into the volume tree
1790  // size of the arrays lnam and lnum
1791  // lnam an integer array whos 4 bytes contain the askii code for the
1792  // volume names
1793  // lnum an integer array containing the copy numbers for that specific
1794  // volume
1795  //
1796  // This routine fills the volulme paramters in common /gcvolu/ for a
1797  // physical tree, specified by the list lnam and lnum of volume names
1798  // and numbers, and for all its ascendants up to level 1. This routine
1799  // is optimsed and does not re-compute the part of the history already
1800  // available in GCVOLU. This means that if it is used in user programs
1801  // outside the usual framwork of the tracking, the user has to initilise
1802  // to zero NLEVEL in the common GCVOLU. It return 0 if there were no
1803  // problems in make the call.
1804  //
1805  return 0;
1806 }
1807 
1808 //_____________________________________________________________________________
1809 void TGeant3TGeo::Gdshow(Int_t /*iview*/)
1810 {
1811  //
1812  // IVIEW View number
1813  //
1814  // It shows on the screen the contents of a view bank. It
1815  // can be called after a view bank has been closed.
1816  //
1817 }
1818 
1819 //_____________________________________________________________________________
1820 void TGeant3TGeo::Gdopt(const char * /*name*/,const char * /*value*/)
1821 {
1822  //
1823  // NAME Option name
1824  // VALUE Option value
1825  //
1826  // To set/modify the drawing options.
1827  // IOPT IVAL Action
1828  //
1829  // THRZ ON Draw tracks in R vs Z
1830  // OFF (D) Draw tracks in X,Y,Z
1831  // 180
1832  // 360
1833  // PROJ PARA (D) Parallel projection
1834  // PERS Perspective
1835  // TRAK LINE (D) Trajectory drawn with lines
1836  // POIN " " with markers
1837  // HIDE ON Hidden line removal using the CG package
1838  // OFF (D) No hidden line removal
1839  // SHAD ON Fill area and shading of surfaces.
1840  // OFF (D) Normal hidden line removal.
1841  // RAYT ON Ray-tracing on.
1842  // OFF (D) Ray-tracing off.
1843  // EDGE OFF Does not draw contours when shad is on.
1844  // ON (D) Normal shading.
1845  // MAPP 1,2,3,4 Mapping before ray-tracing.
1846  // 0 (D) No mapping.
1847  // USER ON User graphics options in the raytracing.
1848  // OFF (D) Automatic graphics options.
1849  //
1850  return;
1851 }
1852 
1853 //_____________________________________________________________________________
1854 void TGeant3TGeo::Gdraw(const char * /*name*/,Double_t /*theta*/, Double_t /*phi*/, Double_t /*psi*/,
1855  Double_t /*u0*/,Double_t /*v0*/,Double_t /*ul*/,Double_t /*vl*/)
1856 {
1857  //
1858  // NAME Volume name
1859  // +
1860  // THETA Viewing angle theta (for 3D projection)
1861  // PHI Viewing angle phi (for 3D projection)
1862  // PSI Viewing angle psi (for 2D rotation)
1863  // U0 U-coord. (horizontal) of volume origin
1864  // V0 V-coord. (vertical) of volume origin
1865  // SU Scale factor for U-coord.
1866  // SV Scale factor for V-coord.
1867  //
1868  // This function will draw the volumes,
1869  // selected with their graphical attributes, set by the Gsatt
1870  // facility. The drawing may be performed with hidden line removal
1871  // and with shading effects according to the value of the options HIDE
1872  // and SHAD; if the option SHAD is ON, the contour's edges can be
1873  // drawn or not. If the option HIDE is ON, the detector can be
1874  // exploded (BOMB), clipped with different shapes (CVOL), and some
1875  // of its parts can be shifted from their original
1876  // position (SHIFT). When HIDE is ON, if
1877  // the drawing requires more than the available memory, the program
1878  // will evaluate and display the number of missing words
1879  // (so that the user can increase the
1880  // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
1881  // the program will print messages about the memory used and
1882  // statistics on the volumes' visibility.
1883  // The following commands will produce the drawing of a green
1884  // volume, specified by NAME, without using the hidden line removal
1885  // technique, using the hidden line removal technique,
1886  // with different linewidth and colour (red), with
1887  // solid colour, with shading of surfaces, and without edges.
1888  // Finally, some examples are given for the ray-tracing. (A possible
1889  // string for the NAME of the volume can be found using the command DTREE).
1890  //
1891  return;
1892 }
1893 
1894 //_____________________________________________________________________________
1895 void TGeant3TGeo::Gdrawc(const char * /*name*/,Int_t /*axis*/, Float_t /*cut*/,Float_t /*u0*/,
1896  Float_t /*v0*/,Float_t /*ul*/,Float_t /*vl*/)
1897 {
1898  //
1899  // NAME Volume name
1900  // CAXIS Axis value
1901  // CUTVAL Cut plane distance from the origin along the axis
1902  // +
1903  // U0 U-coord. (horizontal) of volume origin
1904  // V0 V-coord. (vertical) of volume origin
1905  // SU Scale factor for U-coord.
1906  // SV Scale factor for V-coord.
1907  //
1908  // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
1909  // and placed at the distance cutval from the origin.
1910  // The resulting picture is seen from the the same axis.
1911  // When HIDE Mode is ON, it is possible to get the same effect with
1912  // the CVOL/BOX function.
1913  //
1914  return;
1915 }
1916 
1917 //_____________________________________________________________________________
1918 void TGeant3TGeo::Gdrawx(const char * /*name*/,Float_t /*cutthe*/, Float_t /*cutphi*/,
1919  Float_t /*cutval*/, Float_t /*theta*/, Float_t /*phi*/, Float_t /*u0*/,
1920  Float_t /*v0*/,Float_t /*ul*/,Float_t /*vl*/)
1921 {
1922  //
1923  // NAME Volume name
1924  // CUTTHE Theta angle of the line normal to cut plane
1925  // CUTPHI Phi angle of the line normal to cut plane
1926  // CUTVAL Cut plane distance from the origin along the axis
1927  // +
1928  // THETA Viewing angle theta (for 3D projection)
1929  // PHI Viewing angle phi (for 3D projection)
1930  // U0 U-coord. (horizontal) of volume origin
1931  // V0 V-coord. (vertical) of volume origin
1932  // SU Scale factor for U-coord.
1933  // SV Scale factor for V-coord.
1934  //
1935  // The cut plane is normal to the line given by the cut angles
1936  // cutthe and cutphi and placed at the distance cutval from the origin.
1937  // The resulting picture is seen from the viewing angles theta,phi.
1938  //
1939  return;
1940 }
1941 
1942 //_____________________________________________________________________________
1943 void TGeant3TGeo::Gdspec(const char * /*name*/)
1944 {
1945  //
1946  // NAME Volume name
1947  //
1948  // Shows 3 views of the volume (two cut-views and a 3D view), together with
1949  // its geometrical specifications. The 3D drawing will
1950  // be performed according the current values of the options HIDE and
1951  // SHAD and according the current SetClipBox clipping parameters for that
1952  // volume.
1953  //
1954  return;
1955 }
1956 
1957 //_____________________________________________________________________________
1958 void TGeant3TGeo::DrawOneSpec(const char * /*name*/)
1959 {
1960  //
1961  // Function called when one double-clicks on a volume name
1962  // in a TPavelabel drawn by Gdtree.
1963  //
1964  return;
1965 }
1966 
1967 //_____________________________________________________________________________
1968 void TGeant3TGeo::Gdtree(const char * /*name*/,Int_t /*levmax*/, Int_t /*isel*/)
1969 {
1970  //
1971  // NAME Volume name
1972  // LEVMAX Depth level
1973  // ISELT Options
1974  //
1975  // This function draws the logical tree,
1976  // Each volume in the tree is represented by a TPaveTree object.
1977  // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
1978  // Use TPaveTree pop-up menu to select:
1979  // - drawing specs
1980  // - drawing tree
1981  // - drawing tree of parent
1982  //
1983  return;
1984 }
1985 
1986 //_____________________________________________________________________________
1987 void TGeant3TGeo::GdtreeParent(const char * /*name*/,Int_t /*levmax*/, Int_t /*isel*/)
1988 {
1989  //
1990  // NAME Volume name
1991  // LEVMAX Depth level
1992  // ISELT Options
1993  //
1994  // This function draws the logical tree of the parent of name.
1995  //
1996 }
1997 
1998 //____________________________________________________________________________
1999 Int_t TGeant3TGeo::ImportMaterial(const TGeoMaterial* mat)
2000 {
2001 // Imports the Root material in Geant3 and returns its Geant3 index
2002 // ---
2003 
2004  Int_t kmat;
2005  const TGeoMixture* mixt = dynamic_cast<const TGeoMixture*>(mat);
2006  if (mixt) {
2007  // TGeo stores only proportions by weigth
2008  Int_t nlmat = mixt->GetNelements();
2009  Float_t* fa = CreateFloatArray(mixt->GetAmixt(), TMath::Abs(nlmat));
2010  Float_t* fz = CreateFloatArray(mixt->GetZmixt(), TMath::Abs(nlmat));
2011  Float_t* fwmat = CreateFloatArray(mixt->GetWmixt(), TMath::Abs(nlmat));
2012  G3Mixture(kmat, mixt->GetName(), fa, fz, mixt->GetDensity(), TMath::Abs(nlmat), fwmat);
2013  delete [] fa;
2014  delete [] fz;
2015  delete [] fwmat;
2016  }
2017  else {
2018  Float_t* buf = 0;
2019  // Inject radlen with negative sign to be stored in G3
2020  Double_t radlen = mat->GetRadLen();
2021  // Ignore abslen from TGeo and let G3 compute it
2022  G3Material(kmat, mat->GetName(), mat->GetA(), mat->GetZ(),
2023  mat->GetDensity(), -radlen, 0, buf, 0);
2024  }
2025  return kmat;
2026 }
2027 
2028 //____________________________________________________________________________
2030 {
2031  //
2032  // Finalise geometry construction
2033  //
2034 
2035  //Close the geometry structure
2036  if (gDebug > 0) printf("FinishGeometry, calling ggclos\n");
2037  Ggclos();
2038 
2039  if (fImportRootGeometry) {
2040 
2041  // Import materials
2042  //
2043  TIter next1(gGeoManager->GetListOfMaterials());
2044  TGeoMaterial* mat;
2045  Int_t nofMaterials = 0;
2046  while ((mat=(TGeoMaterial*)next1())) {
2047  Int_t kmat = ImportMaterial(mat);
2048  mat->SetUniqueID(kmat);
2049  nofMaterials++;
2050  }
2051 
2052  // Number of media
2053  Int_t nofMedia = 0;
2054  TIter next2(gGeoManager->GetListOfMedia());
2055  TGeoMedium* medx;
2056  while ((medx=(TGeoMedium*)next2())) nofMedia++;
2057 
2058  // Import media
2059  //
2060  Int_t maxNofMaterials = nofMaterials + nofMedia;
2061  TArrayI usedMaterials(maxNofMaterials);
2062  for (Int_t i=0; i<maxNofMaterials; i++)
2063  usedMaterials[i] = -1;
2064 
2065  TIter next3(gGeoManager->GetListOfMedia());
2066  TGeoMedium* med;
2067  while ((med=(TGeoMedium*)next3())) {
2068  Int_t kmed;
2069  Int_t nmat = med->GetMaterial()->GetUniqueID();
2070 
2071  // if material is already used define a new Geant3 material
2072  // (do not reset TGeoMaterial index)
2073  if (usedMaterials[nmat] >0 )
2074  nmat = ImportMaterial(med->GetMaterial());
2075  usedMaterials[nmat] = 1;
2076 
2077  Int_t isvol = (Int_t) med->GetParam(0);
2078  Int_t ifield = (Int_t) med->GetParam(1);
2079  Double_t fieldm = med->GetParam(2);
2080  Double_t tmaxfd = med->GetParam(3);
2081  Double_t stemax = med->GetParam(4);
2082  Double_t deemax = med->GetParam(5);
2083  Double_t epsil = med->GetParam(6);
2084  Double_t stmin = med->GetParam(7);
2085  G3Medium(kmed, med->GetName(), nmat, isvol, ifield, fieldm, tmaxfd,
2086  stemax,deemax, epsil, stmin);
2087  med->SetId(kmed);
2088  }
2089  if (gDebug > 0) printf("FinishGeometry, geometry retreived from file, materials/media mapped to G3\n");
2090  } else {
2091  TGeoVolume *top = (TGeoVolume*)gGeoManager->GetListOfVolumes()->First();
2092  gGeoManager->SetTopVolume(top);
2093  if (gDebug > 0) printf("FinishGeometry, calling CloseGeometry\n");
2094  gGeoManager->CloseGeometry();
2095  }
2096 
2097  if (gDebug > 0) printf("FinishGeometry, calling MisalignGeometry()\n");
2098  TVirtualMCApplication::Instance()->MisalignGeometry();
2099  // gROOT->GetListOfBrowsables()->Add(gGeoManager);
2100  if (gDebug > 0) printf("FinishGeometry, calling SetColors\n");
2101 
2102  //Create the color table
2103  SetColors();
2104  if (gDebug > 0) printf("FinishGeometry, returning\n");
2105 }
2106 
2107 //_____________________________________________________________________________
2109 {
2110  //
2111  // Set the colors for all the volumes
2112  // this is done sequentially for all volumes
2113  // based on the number of their medium
2114  //
2115  TIter next(gGeoManager->GetListOfVolumes());
2116  TGeoVolume *volume;
2117  while ((volume = (TGeoVolume*)next())) {
2118  if (volume->IsAssembly()) continue;
2119  TGeoMedium *medium = (TGeoMedium*)volume->GetMedium();
2120  Int_t icol = medium->GetId()%6+2;
2121  volume->SetLineColor(icol);
2122  }
2123 }
2124 
2125 //_____________________________________________________________________________
2126 //
2127 // Interfaces to Fortran
2128 //
2129 //_____________________________________________________________________________
2130 
2131 
2132 //______________________________________________________________________
2133 void ginvolTGeo(Float_t *x, Int_t &isame)
2134 {
2135  if (gGeoManager->IsSameLocation(x[0], x[1], x[2])) isame = 1;
2136  else isame = 0;
2137 }
2138 
2139 
2140 //______________________________________________________________________
2141 void gtmediTGeo(Float_t *x, Int_t &numed)
2142 {
2143  gcchan->lsamvl = kTRUE;
2144  gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
2145  gcchan->lsamvl = gGeoManager->IsSameLocation();
2146  if (gGeoManager->IsOutside()) {
2147  numed=0;
2148  } else {
2149  gcvolu->nlevel = 1 + gGeoManager->GetLevel();
2150  gGeoManager->GetBranchNames(gcvolu->names);
2151  gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
2152  TGeoVolume *vol = gCurrentNode->GetVolume();
2153  if (vol) {
2154  TGeoMedium *medium = vol->GetMedium();
2155  if (medium) numed = medium->GetId();
2156  } else {
2157  printf("ERROR: gtmedi: NULL volume\n");
2158  }
2159  }
2160 }
2161 
2162 
2163 //______________________________________________________________________
2164 void gmediaTGeo(Float_t *x, Int_t &numed, Int_t & /*check*/)
2165 {
2166  gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
2167  if (gGeoManager->IsOutside()) {
2168  numed=0;
2169  } else {
2170  gcvolu->nlevel = 1 + gGeoManager->GetLevel();
2171  gGeoManager->GetBranchNames(gcvolu->names);
2172  gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
2173  TGeoVolume *vol = gCurrentNode->GetVolume();
2174  if (vol) {
2175  TGeoMedium *medium = vol->GetMedium();
2176  if (medium) numed = medium->GetId();
2177  } else {
2178  printf("ERROR: gmedia: NULL volume\n");
2179  }
2180  }
2181 }
2182 
2183 //______________________________________________________________________
2184 void gtmanyTGeo(Int_t &level1)
2185 {
2186  if (level1==1) {
2187  Int_t nlevel = gcvolu->nlevel;
2188 // printf("gtmanyTGeo nlevel=%i %s\n",nlevel,gGeoManager->GetPath());
2189  gcvol1->nlevl1 = nlevel;
2190  if (nlevel>0) {
2191  memcpy(gcvol1->names1, gcvolu->names, nlevel*sizeof(Int_t));
2192  memcpy(gcvol1->numbr1, gcvolu->number, nlevel*sizeof(Int_t));
2193  memcpy(gcvol1->lvolu1, gcvolu->lvolum, nlevel*sizeof(Int_t));
2194  }
2195  }
2196 }
2197 
2198 //______________________________________________________________________
2199 void gtonlyTGeo(Int_t &isOnly)
2200 {
2201  //with Geant3, return gonly(nlevel);
2202 // if (gGeoManager->IsCurrentOverlapping()) isOnly = 0;
2203 // else isOnly = 1;
2204  // With TGeo, G3 is seeing a ONLY geometry
2205  isOnly = 1;
2206 }
2207 
2208 //_____________________________________________________________________________
2209 void glvoluTGeo(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier)
2210 {
2211  //
2212  // nlev number of levels deap into the volume tree
2213  // size of the arrays lnam and lnum
2214  // lnam an integer array whos 4 bytes contain the askii code for the
2215  // volume names
2216  // lnum an integer array containing the copy numbers for that specific
2217  // volume
2218  //
2219  // This routine fills the volume parameters in common /gcvolu/ for a
2220  // physical tree, specified by the list lnam and lnum of volume names
2221  // and numbers, and for all its ascendants up to level 1. This routine
2222  // is optimised and does not re-compute the part of the history already
2223  // available in GCVOLU. This means that if it is used in user programs
2224  // outside the usual framework of the tracking, the user has to initialize
2225  // to zero NLEVEL in the common GCVOLU. It return 0 if there were no
2226  // problems in make the call.
2227  //
2228  TGeoVolume *vol = gGeoManager->GetTopVolume();
2229  TGeoVolume *vdaughter = 0;
2230  TGeoNode *node = 0;
2231  Int_t nd;
2232  Bool_t found = kFALSE;
2233  ier = 0;
2234  gGeoManager->CdTop();
2235  if (nlev<1) nlev = 1;
2236  gcvolu->nlevel = nlev;
2237  if (nlev==1) return;
2238  Int_t *lvol = gcvol1->lvolu1;
2239  memcpy(gcvolu->names, lnam, nlev*sizeof(Int_t));
2240  memcpy(gcvolu->number, lnum, nlev*sizeof(Int_t));
2241  memcpy(gcvolu->lvolum, lvol, nlev*sizeof(Int_t));
2242 // for (Int_t i=0;i<nlev;i++) printf(" #%i: %i %i %i\n", i, lnam[i], lnum[i],lvol[i]);
2243 
2244  for (Int_t i=1; i<nlev; i++) {
2245  nd = vol->GetNdaughters();
2246  found = kFALSE;
2247  for (Int_t id=0; id<nd; id++) {
2248  node = vol->GetNode(id);
2249  vdaughter = node->GetVolume();
2250  if (vdaughter->GetNumber() == lvol[i]) {
2251  if (node->GetNumber()==lnum[i]) {
2252  found = kTRUE;
2253  gGeoManager->CdDown(id);
2254  vol = vdaughter;
2255  break;
2256  }
2257  }
2258  }
2259  if (!found) {
2260  printf("### ERROR in TGeant3TGeo::glvoluTGeo(): cannot restore path\n");
2261  ier = 1;
2262  return;
2263  }
2264  }
2265 }
2266 
2267 
2268 //______________________________________________________________________
2270 {
2271  Float_t *x = gctrak->vect;
2272  Double_t step = gctrak->step;
2273  Int_t itrtyp = gckine->itrtyp;
2274  gGeoManager->SetCurrentPoint(x[0],x[1],x[2]);
2275  gGeoManager->SetCurrentDirection(x[3],x[4],x[5]);
2276  if (step<=0) {
2277  gctrak->safety = 0.;
2278  gctrak->snext = 0.;
2279  gctrak->ignext = 0;
2280  return;
2281  }
2282  // Find distance to next boundary. Global matrix computed only if
2283  // gtnext is called by gtckov.
2284  if (itrtyp==7) gGeoManager->FindNextBoundary(-step);
2285  else gGeoManager->FindNextBoundary(step);
2286  gctrak->safety = gGeoManager->GetSafeDistance();
2287  Double_t snext = gGeoManager->GetStep();
2288  if (snext<=0) {
2289  gctrak->safety = 0.;
2290  gctrak->snext = 0.;
2291  gctrak->ignext = 1;
2292  return;
2293  }
2294  if (snext < step) {
2295  gctrak->snext = snext;
2296  gctrak->ignext = 1;
2297  } else {
2298  gctrak->ignext = 0;
2299  gctrak->snext = gctrak->step;
2300  }
2301 }
2302 
2303 
2304 //______________________________________________________________________
2305 void ggperpTGeo(Float_t * /*x*/, Float_t *norm, Int_t &ierr)
2306 {
2307 // Computes the normal to the next crossed surface, assuming that
2308 // FindNextBoundary() was already called.
2309  ierr = 0;
2310  Double_t *dblnorm = gGeoManager->FindNormalFast();
2311  if (!dblnorm) {
2312  ierr = 1;
2313  return;
2314  }
2315  norm[0] = -dblnorm[0];
2316  norm[1] = -dblnorm[1];
2317  norm[2] = -dblnorm[2];
2318 }
2319 
#define PASSCHARL(string)
Definition: TCallf77.h:12
void GeomIter()
virtual void Gsdvt(const char *name, const char *mother, Double_t step, Int_t iaxis, Int_t numed, Int_t ndvmx)
R__EXTERN void(* fginvol)(Float_t *, Int_t &)
#define DEFCHARD
Definition: TCallf77.h:9
virtual void Gsdvt2(const char *name, const char *mother, Double_t step, Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
virtual Int_t GetMedium() const
R__EXTERN void(* fgtmany)(Int_t &)
Gcvolu_t * fGcvolu
GCVDMA common structure.
Definition: TGeant3.h:1157
Float_t safety
Definition: TGeant3.h:258
virtual void Gdshow(Int_t view)
Int_t ignext
Definition: TGeant3.h:266
Float_t * CreateFloatArray(Float_t *array, Int_t size) const
Definition: TGeant3.cxx:6383
#define g3treve
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)
virtual void Gmedia(Float_t *x, Int_t &numed)
virtual Bool_t GetMaterial(const TString &volumeName, TString &name, Int_t &imat, Double_t &a, Double_t &z, Double_t &density, Double_t &radl, Double_t &inter, TArrayD &par)
R__EXTERN TGeant3 * geant3
virtual void Gdspec(const char *name)
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)
Int_t NextVolUp(Text_t *name, Int_t &copy)
static const std::string volume[nvol]
Int_t NofVolumes() const
Int_t CurrentVolID(Int_t &copy) const
Int_t numbr1[15]
Definition: TGeant3TGeo.h:28
virtual void FinishGeometry()
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)
Int_t number[15]
Definition: TGeant3.h:287
Gcvol1_t * fGcvol1
Definition: TGeant3TGeo.h:211
virtual void Gprint(const char *name)
const char * GetNodeName()
R__EXTERN Int_t count_ginvol
char(* fVolNames)[5]
GCJUMP common structure.
Definition: TGeant3.h:1180
Int_t lvolu1[15]
Definition: TGeant3TGeo.h:29
virtual void Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat)
#define g3smixt
virtual void Gsdvs2(const char *name, const char *mother, Float_t step, Int_t iaxis, Float_t c0, Int_t numed)
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
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
type_of_call void gtonlyTGeo(Int_t &)
virtual void Gtreve()
virtual void Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2, Float_t theta3, Float_t phi3)
#define gcomad
R__EXTERN void(* fggperp)(Float_t *, Float_t *, Int_t &)
Float_t vect[7]
Definition: TGeant3.h:247
Gcvol1_t * gcvol1
const char * VolName(Int_t id) const
Int_t names1[15]
Definition: TGeant3TGeo.h:27
type_of_call void ggperpTGeo(Float_t *, Float_t *, Int_t &)
virtual ~TGeant3TGeo()
Bool_t fImportRootGeometry
Definition: TGeant3TGeo.h:209
#define DEFCHARL
Definition: TCallf77.h:10
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
type_of_call void gmediaTGeo(Float_t *, Int_t &, Int_t &)
R__EXTERN void(* fgtmedi)(Float_t *, Int_t &)
virtual void Gsatt(const char *name, const char *att, Int_t val)
#define g3smate
virtual void Mixture(Int_t &kmat, const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)
Int_t names[15]
Definition: TGeant3.h:286
double z
Int_t NofVolDaughters(const char *volName) const
TGeoNode * gCurrentNode
R__EXTERN Gcvolu_t * gcvolu
R__EXTERN Int_t count_gmedia
virtual void Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
virtual void Gsord(const char *name, Int_t iax)
R__EXTERN void(* fglvolu)(Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)
type_of_call void glvoluTGeo(Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)
virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Double_t c0i, Int_t numed)
Float_t step
Definition: TGeant3.h:260
virtual Int_t GetMedium() const
Definition: TGeant3.cxx:2967
virtual void LoadAddress()
Int_t VolId(const Text_t *name) const
const char * CurrentVolPath()
type_of_call void gtmediTGeo(Float_t *, Int_t &)
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
const char * CurrentVolOffName(Int_t off) const
Int_t lsamvl
Definition: TGeant3.h:632
auto norm(Vector const &v)
Return norm of the specified vector.
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")
#define gtreveroot
virtual void Gprotm(Int_t nmat=0)
Int_t lvolum[15]
Definition: TGeant3.h:288
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)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
R__EXTERN void(* fgtonly)(Int_t &)
R__EXTERN void(* fgtnext)()
#define g3stmed
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
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)
R__EXTERN Gctrak_t * gctrak
virtual void GtreveRoot()
virtual void Gdtree(const char *name, Int_t levmax=15, Int_t ispec=0)
Int_t fNextVol
Definition: TGeant3.h:1137
Int_t CurrentVolOffID(Int_t off, Int_t &copy) const
Int_t nlevel
Definition: TGeant3.h:285
const char * VolDaughterName(const char *volName, Int_t i) const
#define type_of_call
Definition: TCallf77.h:8
virtual Int_t * Lq() const
Definition: TGeant3.h:831
Float_t snext
Definition: TGeant3.h:261
R__EXTERN Int_t count_gtmedi
virtual void Gsdvs(const char *name, const char *mother, Float_t step, Int_t iaxis, Int_t numed)
Int_t VolDaughterCopyNo(const char *volName, Int_t i) const
R__EXTERN Int_t count_gtnext
T copy(T const &v)
virtual void Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
virtual void Gsmate(Int_t imat, const char *name, Float_t a, Float_t z, Float_t dens, Float_t radl, Float_t absl)
TGeoMCGeometry * fMCGeo
Definition: TGeant3TGeo.h:208
R__EXTERN Gcchan_t * gcchan
list x
Definition: train.py:276
Int_t VolId2Mate(Int_t id) const
R__EXTERN void(* fgmedia)(Float_t *, Int_t &, Int_t &)
type_of_call void gtnextTGeo()
virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t np)
type_of_call void ginvolTGeo(Float_t *, Int_t &)
const char * CurrentVolName() const
virtual void Ggclos()
virtual void Gdopt(const char *name, const char *value)
R__EXTERN Gckine_t * gckine
Int_t ImportMaterial(const TGeoMaterial *material)
Int_t itrtyp
Definition: TGeant3.h:169
virtual Int_t Glvolu(Int_t nlev, Int_t *lnam, Int_t *lnum)
virtual Bool_t GetShape(const TString &volumePath, TString &shapeType, TArrayD &par)
virtual void SetRootGeometry()
virtual Bool_t GetTransformation(const TString &volumePath, TGeoHMatrix &matrix)
virtual void DrawOneSpec(const char *name)
virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis)
virtual Gclink_t * Gclink() const
Definition: TGeant3.h:809
#define PASSCHARD(string)
Definition: TCallf77.h:11
const char * GetPath()
type_of_call void gtmanyTGeo(Int_t &)
virtual void GdtreeParent(const char *name, Int_t levmax=15, Int_t ispec=0)
virtual void SetColors()
virtual void Matrix(Int_t &krot, Double_t thex, Double_t phix, Double_t they, Double_t phiy, Double_t thez, Double_t phiz)
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)
Int_t nlevl1
Definition: TGeant3TGeo.h:26
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)