Logo ROOT   6.12/07
Reference Guide
TGeoMCGeometry.cxx
Go to the documentation of this file.
1 // @(#)root/vmc:$Id$
2 // Authors: Alice collaboration 25/06/2002
3 
4 /*************************************************************************
5  * Copyright (C) 2006, Rene Brun and Fons Rademakers. *
6  * Copyright (C) 2002, ALICE Experiment at CERN. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 
14 /** \class TGeoMCGeometry
15 
16 Implementation of the TVirtualMCGeometry interface
17 for building TGeo geometry.
18 */
19 
20 #include <ctype.h>
21 #include "TError.h"
22 #include "TArrayD.h"
23 
24 #include "TGeoMCGeometry.h"
25 #include "TGeoManager.h"
26 #include "TGeoMatrix.h"
27 #include "TGeoVolume.h"
28 #include "TGeoArb8.h"
29 #include "TGeoTrd1.h"
30 #include "TGeoTrd2.h"
31 #include "TGeoTube.h"
32 #include "TGeoCone.h"
33 #include "TGeoPgon.h"
34 #include "TGeoSphere.h"
35 #include "TGeoPara.h"
36 #include "TGeoEltu.h"
37 #include "TGeoHype.h"
38 #include "TMath.h"
39 
41 
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 ///
46 /// Standard constructor
47 ///
48 
49 TGeoMCGeometry::TGeoMCGeometry(const char *name, const char *title,
50  Bool_t g3CompatibleVolumeNames)
51  : TVirtualMCGeometry(name, title),
52  fG3CompatibleVolumeNames(g3CompatibleVolumeNames)
53 {
54 }
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 ///
58 /// Default constructor
59 ///
60 
64 {
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 ///
69 /// Destructor
70 ///
71 
73 {
74  fgInstance=0;
75 }
76 
77 //
78 // private methods
79 //
80 
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 /// Return TGeoManager global pointer.
84 /// Create a new TGeoManager object if it does not yet exist.
85 
87 {
88  if ( ! gGeoManager ) new TGeoManager("TGeo", "Root geometry manager");
89 
90  return gGeoManager;
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Convert Float_t* array to Double_t*,
95 /// !! The new array has to be deleted by user.
96 
98 {
99  Double_t* doubleArray;
100  if (size>0) {
101  doubleArray = new Double_t[size];
102  for (Int_t i=0; i<size; i++) doubleArray[i] = array[i];
103  } else {
104  //doubleArray = 0;
105  doubleArray = new Double_t[1];
106  }
107  return doubleArray;
108 }
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 ///
112 /// Convert name to upper case. Make vname at least 4 chars
113 ///
114 
115 void TGeoMCGeometry::Vname(const char *name, char *vname) const
116 {
118  Int_t l = strlen(name);
119  Int_t i;
120  l = l < 4 ? l : 4;
121  for (i=0;i<l;i++) vname[i] = toupper(name[i]);
122  for (i=l;i<4;i++) vname[i] = ' ';
123  vname[4] = 0;
124  } else {
125  Int_t l = strlen(name);
126  if ( l>=79 ) l = 79;
127  for (Int_t i=0;i<l;i++) vname[i] = name[i];
128  vname[l] = 0;
129  }
130 }
131 
132 //
133 // public methods
134 //
135 
136 ////////////////////////////////////////////////////////////////////////////////
137 ///
138 /// Define a material
139 ///
140 /// - kmat number assigned to the material
141 /// - name material name
142 /// - a atomic mass in au
143 /// - z atomic number
144 /// - dens density in g/cm3
145 /// - absl absorption length in cm;
146 /// if >=0 it is ignored and the program
147 /// calculates it, if <0. -absl is taken
148 /// - radl radiation length in cm
149 /// if >=0 it is ignored and the program
150 /// calculates it, if <0. -radl is taken
151 /// - buf pointer to an array of user words
152 /// - nwbuf number of user words
153 
155  Double_t dens, Double_t radl, Double_t absl, Float_t* buf,
156  Int_t nwbuf)
157 {
158  Double_t* dbuf = CreateDoubleArray(buf, nwbuf);
159  Material(kmat, name, a, z, dens, radl, absl, dbuf, nwbuf);
160  delete [] dbuf;
161 }
162 
163 ////////////////////////////////////////////////////////////////////////////////
164 ///
165 /// Define a material
166 ///
167 /// - kmat number assigned to the material
168 /// - name material name
169 /// - a atomic mass in au
170 /// - z atomic number
171 /// - dens density in g/cm3
172 /// - absl absorption length in cm;
173 /// if >=0 it is ignored and the program
174 /// calculates it, if <0. -absl is taken
175 /// - radl radiation length in cm
176 /// if >=0 it is ignored and the program
177 /// calculates it, if <0. -radl is taken
178 /// - buf pointer to an array of user words
179 /// - nwbuf number of user words
180 
182  Double_t dens, Double_t radl, Double_t absl, Double_t* /*buf*/,
183  Int_t /*nwbuf*/)
184 {
185  GetTGeoManager()->Material(name, a, z, dens, kmat, radl, absl);
186 }
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 ///
190 /// Define a mixture or a compound
191 /// with a number kmat composed by the basic nlmat materials defined
192 /// by arrays a, z and wmat
193 ///
194 /// If nlmat > 0 then wmat contains the proportion by
195 /// weights of each basic material in the mixture.
196 ///
197 /// If nlmat < 0 then wmat contains the number of atoms
198 /// of a given kind into the molecule of the compound.
199 /// In this case, wmat in output is changed to relative
200 /// weights.
201 
202 void TGeoMCGeometry::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
203  Double_t dens, Int_t nlmat, Float_t* wmat)
204 {
205  Double_t* da = CreateDoubleArray(a, TMath::Abs(nlmat));
206  Double_t* dz = CreateDoubleArray(z, TMath::Abs(nlmat));
207  Double_t* dwmat = CreateDoubleArray(wmat, TMath::Abs(nlmat));
208 
209  Mixture(kmat, name, da, dz, dens, nlmat, dwmat);
210  for (Int_t i=0; i<nlmat; i++) {
211  a[i] = da[i]; z[i] = dz[i]; wmat[i] = dwmat[i];
212  }
213 
214  delete [] da;
215  delete [] dz;
216  delete [] dwmat;
217 }
218 
219 ////////////////////////////////////////////////////////////////////////////////
220 ///
221 /// Define a mixture or a compound
222 /// with a number kmat composed by the basic nlmat materials defined
223 /// by arrays a, z and wmat
224 ///
225 /// If nlmat > 0 then wmat contains the proportion by
226 /// weights of each basic material in the mixture.
227 ///
228 /// If nlmat < 0 then wmat contains the number of atoms
229 /// of a given kind into the molecule of the compound.
230 /// In this case, wmat in output is changed to relative
231 /// weights.
232 
233 void TGeoMCGeometry::Mixture(Int_t& kmat, const char* name, Double_t* a, Double_t* z,
234  Double_t dens, Int_t nlmat, Double_t* wmat)
235 {
236  if (nlmat < 0) {
237  nlmat = - nlmat;
238  Double_t amol = 0;
239  Int_t i;
240  for (i=0;i<nlmat;i++) {
241  amol += a[i]*wmat[i];
242  }
243  for (i=0;i<nlmat;i++) {
244  wmat[i] *= a[i]/amol;
245  }
246  }
247  GetTGeoManager()->Mixture(name, a, z, dens, nlmat, wmat, kmat);
248 }
249 
250 ////////////////////////////////////////////////////////////////////////////////
251 ///
252 /// Define a medium.
253 ///
254 /// - kmed tracking medium number assigned
255 /// - name tracking medium name
256 /// - nmat material number
257 /// - isvol sensitive volume flag
258 /// - ifield magnetic field:
259 /// - ifield = 0 if no magnetic field;
260 /// - ifield = -1 if user decision in guswim;
261 /// - ifield = 1 if tracking performed with g3rkuta;
262 /// - ifield = 2 if tracking performed with g3helix;
263 /// - ifield = 3 if tracking performed with g3helx3.
264 /// - fieldm max. field value (kilogauss)
265 /// - tmaxfd max. angle due to field (deg/step)
266 /// - stemax max. step allowed
267 /// - deemax max. fraction of energy lost in a step
268 /// - epsil tracking precision (cm)
269 /// - stmin min. step due to continuous processes (cm)
270 /// - ubuf pointer to an array of user words
271 /// - nbuf number of user words
272 
273 void TGeoMCGeometry::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
274  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
275  Double_t stemax, Double_t deemax, Double_t epsil,
276  Double_t stmin, Float_t* ubuf, Int_t nbuf)
277 {
278  //printf("Creating mediuma: %s, numed=%d, nmat=%d\n",name,kmed,nmat);
279  Double_t* dubuf = CreateDoubleArray(ubuf, nbuf);
280  Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil,
281  stmin, dubuf, nbuf);
282  delete [] dubuf;
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 ///
287 /// Define a medium.
288 ///
289 /// - kmed tracking medium number assigned
290 /// - name tracking medium name
291 /// - nmat material number
292 /// - isvol sensitive volume flag
293 /// - ifield magnetic field:
294 /// - ifield = 0 if no magnetic field;
295 /// - ifield = -1 if user decision in guswim;
296 /// - ifield = 1 if tracking performed with g3rkuta;
297 /// - ifield = 2 if tracking performed with g3helix;
298 /// - ifield = 3 if tracking performed with g3helx3.
299 /// - fieldm max. field value (kilogauss)
300 /// - tmaxfd max. angle due to field (deg/step)
301 /// - stemax max. step allowed
302 /// - deemax max. fraction of energy lost in a step
303 /// - epsil tracking precision (cm)
304 /// - stmin min. step due to continuous processes (cm)
305 /// - ubuf pointer to an array of user words
306 /// - nbuf number of user words
307 
308 void TGeoMCGeometry::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
309  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
310  Double_t stemax, Double_t deemax, Double_t epsil,
311  Double_t stmin, Double_t* /*ubuf*/, Int_t /*nbuf*/)
312 {
313  GetTGeoManager()->Medium(name,kmed,nmat, isvol, ifield, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
314 }
315 
316 ////////////////////////////////////////////////////////////////////////////////
317 ///
318 /// Define a rotation matrix
319 ///
320 /// - krot rotation matrix number assigned
321 /// - thetaX polar angle for axis X
322 /// - phiX azimuthal angle for axis X
323 /// - thetaY polar angle for axis Y
324 /// - phiY azimuthal angle for axis Y
325 /// - thetaZ polar angle for axis Z
326 /// - phiZ azimuthal angle for axis Z
327 
329  Double_t phiy, Double_t thez, Double_t phiz)
330 {
332  GetTGeoManager()->Matrix(krot, thex, phix, they, phiy, thez, phiz);
333 }
334 
335 ////////////////////////////////////////////////////////////////////////////////
336 ///
337 /// Create a new volume
338 ///
339 /// - name Volume name
340 /// - shape Volume type
341 /// - nmed Tracking medium number
342 /// - np Number of shape parameters
343 /// - upar Vector containing shape parameters
344 
345 Int_t TGeoMCGeometry::Gsvolu(const char *name, const char *shape, Int_t nmed,
346  Float_t *upar, Int_t npar)
347 {
348  Double_t* dupar = CreateDoubleArray(upar, npar);
349  Int_t id = Gsvolu(name, shape, nmed, dupar, npar);
350  delete [] dupar;
351  return id;
352 }
353 
354 ////////////////////////////////////////////////////////////////////////////////
355 ///
356 /// Create a new volume
357 ///
358 /// - name Volume name
359 /// - shape Volume type
360 /// - nmed Tracking medium number
361 /// - np Number of shape parameters
362 /// - upar Vector containing shape parameters
363 
364 Int_t TGeoMCGeometry::Gsvolu(const char *name, const char *shape, Int_t nmed,
365  Double_t *upar, Int_t npar)
366 {
367  char vname[80];
368  Vname(name,vname);
369  char vshape[5];
370  Vname(shape,vshape);
371 
372  TGeoVolume* vol = GetTGeoManager()->Volume(vname, vshape, nmed, upar, npar);
373  if (!vol) {
374  Fatal("Gsvolu", "Could not create volume %s", name);
375  return -1;
376  }
377  return vol->GetNumber();
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 ///
382 /// Create a new volume by dividing an existing one
383 ///
384 /// It divides a previously defined volume
385 /// - name Volume name
386 /// - mother Mother volume name
387 /// - ndiv Number of divisions
388 /// - iaxis Axis value:
389 /// X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
390 
391 void TGeoMCGeometry::Gsdvn(const char *name, const char *mother, Int_t ndiv,
392  Int_t iaxis)
393 {
394  char vname[80];
395  Vname(name,vname);
396  char vmother[80];
397  Vname(mother,vmother);
398 
399  GetTGeoManager()->Division(vname, vmother, iaxis, ndiv, 0, 0, 0, "n");
400 }
401 
402 ////////////////////////////////////////////////////////////////////////////////
403 ///
404 /// Create a new volume by dividing an existing one
405 ///
406 /// Divide mother into ndiv divisions called name
407 /// along axis iaxis starting at coordinate value c0.
408 /// the new volume created will be medium number numed.
409 
410 void TGeoMCGeometry::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
411  Int_t iaxis, Double_t c0i, Int_t numed)
412 {
413  char vname[80];
414  Vname(name,vname);
415  char vmother[80];
416  Vname(mother,vmother);
417 
418  GetTGeoManager()->Division(vname, vmother, iaxis, ndiv, c0i, 0, numed, "nx");
419 }
420 ////////////////////////////////////////////////////////////////////////////////
421 ///
422 /// Create a new volume by dividing an existing one
423 ///
424 /// Divide mother into divisions called name along
425 /// axis iaxis in steps of step. If not exactly divisible
426 /// will make as many as possible and will center them
427 /// with respect to the mother. Divisions will have medium
428 /// number numed. If numed is 0, numed of mother is taken.
429 /// ndvmx is the expected maximum number of divisions
430 /// (If 0, no protection tests are performed in Geant3)
431 
432 void TGeoMCGeometry::Gsdvt(const char *name, const char *mother, Double_t step,
433  Int_t iaxis, Int_t numed, Int_t /*ndvmx*/)
434 {
435  char vname[80];
436  Vname(name,vname);
437  char vmother[80];
438  Vname(mother,vmother);
439 
440  GetTGeoManager()->Division(vname, vmother, iaxis, 0, 0, step, numed, "s");
441 }
442 
443 ////////////////////////////////////////////////////////////////////////////////
444 ///
445 /// Create a new volume by dividing an existing one
446 ///
447 /// Divides mother into divisions called name along
448 /// axis iaxis starting at coordinate value c0 with step
449 /// size step.
450 /// The new volume created will have medium number numed.
451 /// If numed is 0, numed of mother is taken.
452 /// ndvmx is the expected maximum number of divisions
453 /// (If 0, no protection tests are performed in Geant3)
454 
455 void TGeoMCGeometry::Gsdvt2(const char *name, const char *mother, Double_t step,
456  Int_t iaxis, Double_t c0, Int_t numed, Int_t /*ndvmx*/)
457 {
458  char vname[80];
459  Vname(name,vname);
460  char vmother[80];
461  Vname(mother,vmother);
462 
463  GetTGeoManager()->Division(vname, vmother, iaxis, 0, c0, step, numed, "sx");
464 }
465 
466 ////////////////////////////////////////////////////////////////////////////////
467 ///
468 /// Flag volume name whose contents will have to be ordered
469 /// along axis iax, by setting the search flag to -iax
470 /// (Geant3 only)
471 /// - IAX = 1 X axis
472 /// - IAX = 2 Y axis
473 /// - IAX = 3 Z axis
474 /// - IAX = 4 Rxy (static ordering only -> GTMEDI)
475 /// - IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
476 /// - IAX = 5 Rxyz (static ordering only -> GTMEDI)
477 /// - IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
478 /// - IAX = 6 PHI (PHI=0 => X axis)
479 /// - IAX = 7 THETA (THETA=0 => Z axis)
480 /// Nothing to be done for TGeo //xx
481 
482 void TGeoMCGeometry::Gsord(const char * /*name*/, Int_t /*iax*/)
483 {
484  // TBC - keep this function
485  // nothing to be done for TGeo //xx
486 }
487 
488 ////////////////////////////////////////////////////////////////////////////////
489 ///
490 /// Position a volume into an existing one
491 ///
492 /// It positions a previously defined volume in the mother.
493 /// - name Volume name
494 /// - nr Copy number of the volume
495 /// - mother Mother volume name
496 /// - x X coord. of the volume in mother ref. sys.
497 /// - y Y coord. of the volume in mother ref. sys.
498 /// - z Z coord. of the volume in mother ref. sys.
499 /// - irot Rotation matrix number w.r.t. mother ref. sys.
500 /// - konly ONLY/MANY flag
501 
502 void TGeoMCGeometry::Gspos(const char *name, Int_t nr, const char *mother, Double_t x,
503  Double_t y, Double_t z, Int_t irot, const char *konly)
504 {
505  TString only = konly;
506  only.ToLower();
507  Bool_t isOnly = kFALSE;
508  if (only.Contains("only")) isOnly = kTRUE;
509  char vname[80];
510  Vname(name,vname);
511  char vmother[80];
512  Vname(mother,vmother);
513 
514  Double_t *upar=0;
515  GetTGeoManager()->Node(vname, nr, vmother, x, y, z, irot, isOnly, upar);
516 }
517 
518 ////////////////////////////////////////////////////////////////////////////////
519 ///
520 /// Place a copy of generic volume name with user number
521 /// nr inside mother, with its parameters upar(1..np)
522 
523 void TGeoMCGeometry::Gsposp(const char *name, Int_t nr, const char *mother,
524  Double_t x, Double_t y, Double_t z, Int_t irot,
525  const char *konly, Float_t *upar, Int_t np )
526 {
527  Double_t* dupar = CreateDoubleArray(upar, np);
528  Gsposp(name, nr, mother, x, y, z, irot, konly, dupar, np);
529  delete [] dupar;
530 }
531 
532 ////////////////////////////////////////////////////////////////////////////////
533 ///
534 /// Place a copy of generic volume name with user number
535 /// nr inside mother, with its parameters upar(1..np)
536 
537 void TGeoMCGeometry::Gsposp(const char *name, Int_t nr, const char *mother,
538  Double_t x, Double_t y, Double_t z, Int_t irot,
539  const char *konly, Double_t *upar, Int_t np )
540 {
541  TString only = konly;
542  only.ToLower();
543  Bool_t isOnly = kFALSE;
544  if (only.Contains("only")) isOnly = kTRUE;
545  char vname[80];
546  Vname(name,vname);
547  char vmother[80];
548  Vname(mother,vmother);
549 
550  GetTGeoManager()->Node(vname,nr,vmother, x,y,z,irot,isOnly,upar,np);
551 }
552 
553 ////////////////////////////////////////////////////////////////////////////////
554 ///
555 /// Return the unique numeric identifier for volume name
556 
557 Int_t TGeoMCGeometry::VolId(const char *name) const
558 {
559  Int_t uid = GetTGeoManager()->GetUID(name);
560  if (uid<0) {
561  printf("VolId: Volume %s not found\n",name);
562  return 0;
563  }
564  return uid;
565 }
566 
567 ////////////////////////////////////////////////////////////////////////////////
568 ///
569 /// Return the unique numeric identifier for medium name
570 
572 {
573  TGeoMedium* medium = GetTGeoManager()->GetMedium(name);
574  if (medium) return medium->GetId();
575 
576  printf("MediumId: Medium %s not found\n",name);
577  return 0;
578 }
579 
580 ////////////////////////////////////////////////////////////////////////////////
581 ///
582 /// Return the volume name given the volume identifier
583 
584 const char* TGeoMCGeometry::VolName(Int_t id) const
585 {
586  TGeoVolume *volume = GetTGeoManager()->GetVolume(id);
587  if (!volume) {
588  Error("VolName","volume with id=%d does not exist",id);
589  return "NULL";
590  }
591  return volume->GetName();
592 }
593 
594 ////////////////////////////////////////////////////////////////////////////////
595 ///
596 /// Return total number of volumes in the geometry
597 
599 {
601 }
602 
603 ////////////////////////////////////////////////////////////////////////////////
604 /// Return number of daughters of the volume specified by volName
605 /// According to A. Morsch' G3toRoot class (by A. Morsch)
606 
607 Int_t TGeoMCGeometry::NofVolDaughters(const char* volName) const
608 {
609  TGeoVolume* volume = GetTGeoManager()->GetVolume(volName);
610 
611  if (!volume) {
612  Error("NofVolDaughters", "Volume %s not found.", volName);
613  return 0;
614  }
615 
616  return volume->GetNdaughters();
617 }
618 
619 ////////////////////////////////////////////////////////////////////////////////
620 /// Return the name of i-th daughters of the volume specified by volName
621 /// According to A. Morsch' G3toRoot class.
622 
623 const char* TGeoMCGeometry::VolDaughterName(const char* volName, Int_t i) const
624 {
625  // Get volume
626  TGeoVolume* volume = GetTGeoManager()->GetVolume(volName);
627  if (!volume) {
628  Error("VolDaughterName", "Volume %s not found.", volName);
629  return "";
630  }
631 
632  // Check index
633  if (i<0 || i>=volume->GetNdaughters()) {
634  Error("VolDaughterName", "Volume %s Index out of limits", volName);
635  return "";
636  }
637 
638  // Return node's volume name
639  return volume->GetNode(i)->GetVolume()->GetName();
640 }
641 
642 ////////////////////////////////////////////////////////////////////////////////
643 /// Return the copyNo of i-th daughters of the volume specified by volName
644 /// According to A. Morsch' G3toRoot class.
645 
646 Int_t TGeoMCGeometry::VolDaughterCopyNo(const char* volName, Int_t i) const
647 {
648  // Get volume
649  TGeoVolume* volume = GetTGeoManager()->GetVolume(volName);
650  if (!volume) {
651  Error("VolDaughterName", "Volume %s not found.", volName);
652  return 0;
653  }
654 
655  // Check index
656  if (i<0 || i>=volume->GetNdaughters()) {
657  Error("VolDaughterName", "Volume %s Index out of limits", volName);
658  return 0;
659  }
660 
661  // Return node's copyNo
662  return volume->GetNode(i)->GetNumber();
663 }
664 
665 ////////////////////////////////////////////////////////////////////////////////
666 ///
667 /// Return material number for a given volume id
668 
670 {
671  TGeoVolume *volume = GetTGeoManager()->GetVolume(id);
672  if (!volume) {
673  Error("VolId2Mate","volume with id=%d does not exist",id);
674  return 0;
675  }
676  TGeoMedium *med = volume->GetMedium();
677  if (!med) return 0;
678  return med->GetId();
679 }
680 
681 ////////////////////////////////////////////////////////////////////////////////
682 /// Return the transformation matrix between the volume specified
683 /// by the path volumePath and the Top or mater volume.
684 ///
685 /// The format of the path volumePath is as follows (assuming ALIC is the Top volume)
686 /// "/ALIC_1/DDIP_1/S05I_2/S05H_1/S05G_3". Here ALIC is the top most
687 /// or master volume which has only 1 instance of. Of all of the daughter
688 /// volumes of ALICE, DDIP volume copy #1 is indicated. Similarly for
689 /// the daughter volume of DDIP is S05I copy #2 and so on.
690 /// - Inputs:
691 /// - TString& volumePath The volume path to the specific volume
692 /// for which you want the matrix. Volume name
693 /// hierarchy is separated by "/" while the
694 /// copy number is appended using a "_".
695 /// - Outputs:
696 /// - TGeoHMatrix &mat A matrix with its values set to those
697 /// appropriate to the Local to Master transformation
698 /// - Return:
699 /// - A logical value if kFALSE then an error occurred and no change to
700 /// mat was made.
701 
703 {
704  // We have to preserve the modeler state
706  if (!GetTGeoManager()->cd(volumePath.Data())) {
707  GetTGeoManager()->PopPath();
708  return kFALSE;
709  }
710  mat = *GetTGeoManager()->GetCurrentMatrix();
711  GetTGeoManager()->PopPath();
712  return kTRUE;
713 }
714 ////////////////////////////////////////////////////////////////////////////////
715 /// Returns the shape and its parameters for the volume specified
716 /// by volumeName.
717 /// - Inputs:
718 /// - TString& volumeName The volume name
719 /// - Outputs:
720 /// - TString &shapeType Shape type
721 /// - TArrayD &par A TArrayD of parameters with all of the
722 /// parameters of the specified shape.
723 /// - Return:
724 /// - A logical indicating whether there was an error in getting this
725 /// information
726 
727 Bool_t TGeoMCGeometry::GetShape(const TString &volumePath,TString &shapeType,
728  TArrayD &par)
729 {
730  Int_t npar;
732  if (!GetTGeoManager()->cd(volumePath.Data())) {
733  GetTGeoManager()->PopPath();
734  return kFALSE;
735  }
737  GetTGeoManager()->PopPath();
738  if (!vol) return kFALSE;
739  TGeoShape *shape = vol->GetShape();
740  TClass *class_type = shape->IsA();
741  if (class_type==TGeoBBox::Class()) {
742  shapeType = "BOX";
743  npar = 3;
744  par.Set(npar);
745  TGeoBBox *box = (TGeoBBox*)shape;
746  par.AddAt(box->GetDX(),0);
747  par.AddAt(box->GetDY(),1);
748  par.AddAt(box->GetDZ(),2);
749  return kTRUE;
750  }
751  if (class_type==TGeoTrd1::Class()) {
752  shapeType = "TRD1";
753  npar = 4;
754  par.Set(npar);
755  TGeoTrd1 *trd1 = (TGeoTrd1*)shape;
756  par.AddAt(trd1->GetDx1(),0);
757  par.AddAt(trd1->GetDx2(),1);
758  par.AddAt(trd1->GetDy(), 2);
759  par.AddAt(trd1->GetDz(), 3);
760  return kTRUE;
761  }
762  if (class_type==TGeoTrd2::Class()) {
763  shapeType = "TRD2";
764  npar = 5;
765  par.Set(npar);
766  TGeoTrd2 *trd2 = (TGeoTrd2*)shape;
767  par.AddAt(trd2->GetDx1(),0);
768  par.AddAt(trd2->GetDx2(),1);
769  par.AddAt(trd2->GetDy1(),2);
770  par.AddAt(trd2->GetDy2(),3);
771  par.AddAt(trd2->GetDz(), 4);
772  return kTRUE;
773  }
774  if (class_type==TGeoTrap::Class()) {
775  shapeType = "TRAP";
776  npar = 11;
777  par.Set(npar);
778  TGeoTrap *trap = (TGeoTrap*)shape;
779  Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad());
780  par.AddAt(trap->GetDz(),0);
781  par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1);
782  par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2);
783  par.AddAt(trap->GetH1(),3);
784  par.AddAt(trap->GetBl1(),4);
785  par.AddAt(trap->GetTl1(),5);
786  par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6);
787  par.AddAt(trap->GetH2(),7);
788  par.AddAt(trap->GetBl2(),8);
789  par.AddAt(trap->GetTl2(),9);
790  par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10);
791  return kTRUE;
792  }
793  if (class_type==TGeoTube::Class()) {
794  shapeType = "TUBE";
795  npar = 3;
796  par.Set(npar);
797  TGeoTube *tube = (TGeoTube*)shape;
798  par.AddAt(tube->GetRmin(),0);
799  par.AddAt(tube->GetRmax(),1);
800  par.AddAt(tube->GetDz(),2);
801  return kTRUE;
802  }
803  if (class_type==TGeoTubeSeg::Class()) {
804  shapeType = "TUBS";
805  npar = 5;
806  par.Set(npar);
807  TGeoTubeSeg *tubs = (TGeoTubeSeg*)shape;
808  par.AddAt(tubs->GetRmin(),0);
809  par.AddAt(tubs->GetRmax(),1);
810  par.AddAt(tubs->GetDz(),2);
811  par.AddAt(tubs->GetPhi1(),3);
812  par.AddAt(tubs->GetPhi2(),4);
813  return kTRUE;
814  }
815  if (class_type==TGeoCone::Class()) {
816  shapeType = "CONE";
817  npar = 5;
818  par.Set(npar);
819  TGeoCone *cone = (TGeoCone*)shape;
820  par.AddAt(cone->GetDz(),0);
821  par.AddAt(cone->GetRmin1(),1);
822  par.AddAt(cone->GetRmax1(),2);
823  par.AddAt(cone->GetRmin2(),3);
824  par.AddAt(cone->GetRmax2(),4);
825  return kTRUE;
826  }
827  if (class_type==TGeoConeSeg::Class()) {
828  shapeType = "CONS";
829  npar = 7;
830  par.Set(npar);
831  TGeoConeSeg *cons = (TGeoConeSeg*)shape;
832  par.AddAt(cons->GetDz(),0);
833  par.AddAt(cons->GetRmin1(),1);
834  par.AddAt(cons->GetRmax1(),2);
835  par.AddAt(cons->GetRmin2(),3);
836  par.AddAt(cons->GetRmax2(),4);
837  par.AddAt(cons->GetPhi1(),5);
838  par.AddAt(cons->GetPhi2(),6);
839  return kTRUE;
840  }
841  if (class_type==TGeoSphere::Class()) {
842  shapeType = "SPHE";
843  npar = 6;
844  par.Set(npar);
845  TGeoSphere *sphe = (TGeoSphere*)shape;
846  par.AddAt(sphe->GetRmin(),0);
847  par.AddAt(sphe->GetRmax(),1);
848  par.AddAt(sphe->GetTheta1(),2);
849  par.AddAt(sphe->GetTheta2(),3);
850  par.AddAt(sphe->GetPhi1(),4);
851  par.AddAt(sphe->GetPhi2(),5);
852  return kTRUE;
853  }
854  if (class_type==TGeoPara::Class()) {
855  shapeType = "PARA";
856  npar = 6;
857  par.Set(npar);
858  TGeoPara *para = (TGeoPara*)shape;
859  par.AddAt(para->GetX(),0);
860  par.AddAt(para->GetY(),1);
861  par.AddAt(para->GetZ(),2);
862  par.AddAt(para->GetTxy(),3);
863  par.AddAt(para->GetTxz(),4);
864  par.AddAt(para->GetTyz(),5);
865  return kTRUE;
866  }
867  if (class_type==TGeoPgon::Class()) {
868  shapeType = "PGON";
869  TGeoPgon *pgon = (TGeoPgon*)shape;
870  Int_t nz = pgon->GetNz();
871  const Double_t *rmin = pgon->GetRmin();
872  const Double_t *rmax = pgon->GetRmax();
873  const Double_t *z = pgon->GetZ();
874  npar = 4 + 3*nz;
875  par.Set(npar);
876  par.AddAt(pgon->GetPhi1(),0);
877  par.AddAt(pgon->GetDphi(),1);
878  par.AddAt(pgon->GetNedges(),2);
879  par.AddAt(pgon->GetNz(),3);
880  for (Int_t i=0; i<nz; i++) {
881  par.AddAt(z[i], 4+3*i);
882  par.AddAt(rmin[i], 4+3*i+1);
883  par.AddAt(rmax[i], 4+3*i+2);
884  }
885  return kTRUE;
886  }
887  if (class_type==TGeoPcon::Class()) {
888  shapeType = "PCON";
889  TGeoPcon *pcon = (TGeoPcon*)shape;
890  Int_t nz = pcon->GetNz();
891  const Double_t *rmin = pcon->GetRmin();
892  const Double_t *rmax = pcon->GetRmax();
893  const Double_t *z = pcon->GetZ();
894  npar = 3 + 3*nz;
895  par.Set(npar);
896  par.AddAt(pcon->GetPhi1(),0);
897  par.AddAt(pcon->GetDphi(),1);
898  par.AddAt(pcon->GetNz(),2);
899  for (Int_t i=0; i<nz; i++) {
900  par.AddAt(z[i], 3+3*i);
901  par.AddAt(rmin[i], 3+3*i+1);
902  par.AddAt(rmax[i], 3+3*i+2);
903  }
904  return kTRUE;
905  }
906  if (class_type==TGeoEltu::Class()) {
907  shapeType = "ELTU";
908  npar = 3;
909  par.Set(npar);
910  TGeoEltu *eltu = (TGeoEltu*)shape;
911  par.AddAt(eltu->GetA(),0);
912  par.AddAt(eltu->GetB(),1);
913  par.AddAt(eltu->GetDz(),2);
914  return kTRUE;
915  }
916  if (class_type==TGeoHype::Class()) {
917  shapeType = "HYPE";
918  npar = 5;
919  par.Set(npar);
920  TGeoHype *hype = (TGeoHype*)shape;
921  par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kTRUE)),0);
922  par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kFALSE)),1);
923  par.AddAt(hype->GetDZ(),2);
924  par.AddAt(hype->GetStIn(),3);
925  par.AddAt(hype->GetStOut(),4);
926  return kTRUE;
927  }
928  if (class_type==TGeoGtra::Class()) {
929  shapeType = "GTRA";
930  npar = 12;
931  par.Set(npar);
932  TGeoGtra *trap = (TGeoGtra*)shape;
933  Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad());
934  par.AddAt(trap->GetDz(),0);
935  par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1);
936  par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2);
937  par.AddAt(trap->GetH1(),3);
938  par.AddAt(trap->GetBl1(),4);
939  par.AddAt(trap->GetTl1(),5);
940  par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6);
941  par.AddAt(trap->GetH2(),7);
942  par.AddAt(trap->GetBl2(),8);
943  par.AddAt(trap->GetTl2(),9);
944  par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10);
945  par.AddAt(trap->GetTwistAngle(),11);
946  return kTRUE;
947  }
948  if (class_type==TGeoCtub::Class()) {
949  shapeType = "CTUB";
950  npar = 11;
951  par.Set(npar);
952  TGeoCtub *ctub = (TGeoCtub*)shape;
953  const Double_t *lx = ctub->GetNlow();
954  const Double_t *tx = ctub->GetNhigh();
955  par.AddAt(ctub->GetRmin(),0);
956  par.AddAt(ctub->GetRmax(),1);
957  par.AddAt(ctub->GetDz(),2);
958  par.AddAt(ctub->GetPhi1(),3);
959  par.AddAt(ctub->GetPhi2(),4);
960  par.AddAt(lx[0],5);
961  par.AddAt(lx[1],6);
962  par.AddAt(lx[2],7);
963  par.AddAt(tx[0],8);
964  par.AddAt(tx[1],9);
965  par.AddAt(tx[2],10);
966  return kTRUE;
967 
968  }
969  Error("GetShape","Getting shape parameters for shape %s not implemented", shape->ClassName());
970  return kFALSE;
971 }
972 
973 ////////////////////////////////////////////////////////////////////////////////
974 /// Returns the Material and its parameters for the volume specified
975 /// by volumeName.
976 ///
977 /// Note, Geant3 stores and uses mixtures as an element with an effective
978 /// Z and A. Consequently, if the parameter Z is not integer, then
979 /// this material represents some sort of mixture.
980 /// - Inputs:
981 /// - TString& volumeName The volume name
982 /// - Outputs:
983 /// - TSrting &name Material name
984 /// - Int_t &imat Material index number
985 /// - Double_t &a Average Atomic mass of material
986 /// - Double_t &z Average Atomic number of material
987 /// - Double_t &dens Density of material [g/cm^3]
988 /// - Double_t &radl Average radiation length of material [cm]
989 /// - Double_t &inter Average interaction length of material [cm]
990 /// - TArrayD &par A TArrayD of user defined parameters.
991 /// - Return:
992 /// - kTRUE if no errors
993 
995  TString &name,Int_t &imat,
996  Double_t &a,Double_t &z,Double_t &dens,
997  Double_t &radl,Double_t &inter,TArrayD &par)
998 {
999  TGeoVolume *vol = GetTGeoManager()->GetVolume(volumeName.Data());
1000  if (!vol) return kFALSE;
1001  TGeoMedium *med = vol->GetMedium();
1002  if (!med) return kFALSE;
1003  TGeoMaterial *mat = med->GetMaterial();
1004  imat = mat->GetUniqueID();
1005  name = mat->GetName();
1006  name = name.Strip(TString::kTrailing, '$');
1007  a = mat->GetA();
1008  z = mat->GetZ();
1009  dens = mat->GetDensity();
1010  radl = mat->GetRadLen();
1011  inter = mat->GetIntLen(); // WARNING: THIS IS NOT COMPUTED NATIVELY BY TGEO
1012  par.Set(0); // NO USER PARAMETERS STORED IN TGEO
1013  return kTRUE;
1014 }
1015 
1016 ////////////////////////////////////////////////////////////////////////////////
1017 /// Returns the Medium and its parameters for the volume specified
1018 /// by volumeName.
1019 ///
1020 /// - Inputs:
1021 /// - TString& volumeName The volume name.
1022 /// - Outputs:
1023 /// - TString &name Medium name
1024 /// - Int_t &nmat Material number defined for this medium
1025 /// - Int_t &imed The medium index number
1026 /// - Int_t &isvol volume number defined for this medium
1027 /// - Int_t &iflield Magnetic field flag
1028 /// - Double_t &fieldm Magnetic field strength
1029 /// - Double_t &tmaxfd Maximum angle of deflection per step
1030 /// - Double_t &stemax Maximum step size
1031 /// - Double_t &deemax Maximum fraction of energy allowed to be lost
1032 /// - to continuous process.
1033 /// - Double_t &epsil Boundary crossing precision
1034 /// - Double_t &stmin Minimum step size allowed
1035 /// - TArrayD &par A TArrayD of user parameters with all of the
1036 /// parameters of the specified medium.
1037 /// - Return:
1038 /// - kTRUE if there where no errors
1039 
1041  Int_t &imed,Int_t &nmat,Int_t &isvol,Int_t &ifield,
1042  Double_t &fieldm,Double_t &tmaxfd,Double_t &stemax,
1043  Double_t &deemax,Double_t &epsil, Double_t &stmin,
1044  TArrayD &par)
1045 {
1046  TGeoVolume *vol = GetTGeoManager()->GetVolume(volumeName.Data());
1047  if (!vol) return kFALSE;
1048  TGeoMedium *med = vol->GetMedium();
1049  if (!med) return kFALSE;
1050  TGeoMaterial *mat = med->GetMaterial();
1051  nmat = mat->GetUniqueID();
1052  imed = med->GetId();
1053  name = med->GetName();
1054  name = name.Strip(TString::kTrailing, '$');
1055  par.Set(0); // NO USER PARAMETERS IN TGEO
1056  isvol = (Int_t)med->GetParam(0);
1057  ifield = (Int_t)med->GetParam(1);
1058  fieldm = med->GetParam(2);
1059  tmaxfd = med->GetParam(3);
1060  stemax = med->GetParam(4);
1061  deemax = med->GetParam(5);
1062  epsil = med->GetParam(6);
1063  stmin = med->GetParam(7);
1064  return kTRUE;
1065 }
1066 
Double_t GetPhi2() const
Definition: TGeoTube.h:149
Double_t GetDy2() const
Definition: TGeoTrd2.h:59
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Double_t c0i, Int_t numed)
Create a new volume by dividing an existing one.
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:375
Double_t GetTheta() const
Definition: TGeoArb8.h:124
Spherical shell class.
Definition: TGeoSphere.h:17
Cylindrical tube class.
Definition: TGeoTube.h:17
virtual ~TGeoMCGeometry()
Destructor.
Double_t GetAlpha2() const
Definition: TGeoArb8.h:133
Double_t * GetZ() const
Definition: TGeoPcon.h:79
The manager class for any TGeo geometry.
Definition: TGeoManager.h:38
virtual void Gsdvt2(const char *name, const char *mother, Double_t step, Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
Create a new volume by dividing an existing one.
Box class.
Definition: TGeoBBox.h:17
Double_t GetDphi() const
Definition: TGeoPcon.h:72
virtual Bool_t GetShape(const TString &volumePath, TString &shapeType, TArrayD &par)
Returns the shape and its parameters for the volume specified by volumeName.
Double_t GetTxz() const
Definition: TGeoPara.h:68
Double_t GetPhi1() const
Definition: TGeoTube.h:148
virtual Double_t GetDX() const
Definition: TGeoBBox.h:70
float Float_t
Definition: RtypesCore.h:53
virtual Double_t GetDensity() const
Definition: TGeoMaterial.h:87
Gtra is a twisted trapezoid.
Definition: TGeoArb8.h:143
Double_t GetDy() const
Definition: TGeoTrd1.h:57
TGeoMaterial * Mixture(const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nelem, Float_t *wmat, Int_t uid)
Create mixture OR COMPOUND IMAT as composed by THE BASIC nelem materials defined by arrays A...
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
A polycone.
Definition: TGeoPcon.h:17
TGeoMaterial * GetMaterial() const
Definition: TGeoMedium.h:52
A polygone.
Definition: TGeoPgon.h:19
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
Double_t GetPhi() const
Definition: TGeoArb8.h:125
Int_t GetNedges() const
Definition: TGeoPgon.h:81
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, Int_t nbuf)
Define a medium.
virtual Double_t GetB() const
Definition: TGeoEltu.h:44
virtual Double_t GetRmax() const
Definition: TGeoSphere.h:68
void Vname(const char *name, char *vname) const
Convert name to upper case.
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)
Position a volume into an existing one.
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
const Double_t * GetNlow() const
Definition: TGeoTube.h:207
Int_t GetId() const
Definition: TGeoMedium.h:48
TGeoVolume * Volume(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t npar=0)
Create a volume in GEANT3 style.
Basic string class.
Definition: TString.h:125
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:420
Base class describing materials.
Definition: TGeoMaterial.h:29
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1099
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Interface to Monte Carlo geometry construction.
Double_t GetPhi1() const
Definition: TGeoCone.h:160
virtual Double_t GetRmin2() const
Definition: TGeoCone.h:75
Double_t GetDx2() const
Definition: TGeoTrd2.h:57
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
virtual Bool_t GetMedium(const TString &volumeName, TString &name, Int_t &imed, 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, TArrayD &par)
Returns the Medium and its parameters for the volume specified by volumeName.
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)
Returns the Material and its parameters for the volume specified by volumeName.
A trapezoid with only x length varying with z.
Definition: TGeoTrd1.h:17
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
Double_t GetPhi2() const
Definition: TGeoSphere.h:72
Double_t GetDx2() const
Definition: TGeoTrd1.h:56
Double_t GetPhi2() const
Definition: TGeoCone.h:161
Int_t PushPath(Int_t startlevel=0)
Definition: TGeoManager.h:542
Int_t GetNdaughters() const
Definition: TGeoVolume.h:350
Double_t GetPhi1() const
Definition: TGeoSphere.h:71
virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis)
Create a new volume by dividing an existing one.
virtual Double_t GetRmax() const
Definition: TGeoTube.h:67
Double_t GetStOut() const
Definition: TGeoHype.h:69
virtual Int_t VolId2Mate(Int_t id) const
Return material number for a given volume id.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
Double_t x[n]
Definition: legend1.C:17
A phi segment of a conical tube.
Definition: TGeoCone.h:98
void Class()
Definition: Class.C:29
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, Int_t nwbuf)
Define a material.
Implementation of the TVirtualMCGeometry interface for building TGeo geometry.
Int_t GetNz() const
Definition: TGeoPcon.h:73
Double_t GetTyz() const
Definition: TGeoPara.h:69
constexpr Double_t DegToRad()
Definition: TMath.h:64
TGeoMedium * GetMedium() const
Definition: TGeoVolume.h:176
virtual Double_t GetA() const
Definition: TGeoMaterial.h:84
virtual Double_t GetIntLen() const
Definition: TGeoMaterial.h:94
virtual Int_t VolDaughterCopyNo(const char *volName, Int_t i) const
Return the copyNo of i-th daughters of the volume specified by volName According to A...
TRAP is a general trapezoid, i.e.
Definition: TGeoArb8.h:89
XFontStruct * id
Definition: TGX11.cxx:108
virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t np)
Create a new volume.
Double_t GetH2() const
Definition: TGeoArb8.h:130
virtual Double_t GetZ() const
Definition: TGeoMaterial.h:85
virtual Double_t GetDz() const
Definition: TGeoCone.h:68
Int_t GetUID(const char *volname) const
Retrieve unique id for a volume name. Return -1 if name not found.
A trapezoid with both x and y lengths varying with z.
Definition: TGeoTrd2.h:17
Double_t * GetRmax() const
Definition: TGeoPcon.h:77
virtual void Gsord(const char *name, Int_t iax)
Flag volume name whose contents will have to be ordered along axis iax, by setting the search flag to...
Int_t GetNumber() const
Definition: TGeoNode.h:92
Parallelepiped class.
Definition: TGeoPara.h:17
Double_t GetX() const
Definition: TGeoPara.h:61
Double_t * GetRmin() const
Definition: TGeoPcon.h:75
virtual Int_t MediumId(const char *mediumName) const
Return the unique numeric identifier for medium name.
virtual Double_t GetRmin1() const
Definition: TGeoCone.h:73
Double_t GetTheta1() const
Definition: TGeoSphere.h:69
virtual Int_t NofVolDaughters(const char *volName) const
Return number of daughters of the volume specified by volName According to A.
Base abstract class for all shapes.
Definition: TGeoShape.h:25
void Matrix(Int_t index, Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3)
Create rotation matrix named &#39;mat<index>&#39;.
TGeoMedium * Medium(const char *name, Int_t numed, 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)
Create tracking medium.
Double_t * CreateDoubleArray(Float_t *array, Int_t size) const
Convert Float_t* array to Double_t*, !! The new array has to be deleted by user.
auto * a
Definition: textangle.C:12
Double_t GetY() const
Definition: TGeoPara.h:62
virtual Int_t NofVolumes() const
Return total number of volumes in the geometry.
Double_t RadiusHypeSq(Double_t z, Bool_t inner) const
Compute r^2 = x^2 + y^2 at a given z coordinate, for either inner or outer hyperbolas.
Definition: TGeoHype.cxx:680
virtual Double_t GetRmax1() const
Definition: TGeoCone.h:74
Double_t GetDz() const
Definition: TGeoTrd2.h:60
TGeoVolume * GetCurrentVolume() const
Definition: TGeoManager.h:491
Hyperboloid class defined by 5 parameters.
Definition: TGeoHype.h:17
Double_t GetBl1() const
Definition: TGeoArb8.h:127
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
TGeoHMatrix * GetCurrentMatrix() const
Definition: TGeoManager.h:484
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1080
Double_t GetBl2() const
Definition: TGeoArb8.h:131
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)
Place a copy of generic volume name with user number nr inside mother, with its parameters upar(1...
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
Bool_t PopPath()
Definition: TGeoManager.h:543
TGeoVolume * Division(const char *name, const char *mother, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Create a new volume by dividing an existing one (GEANT3 like)
virtual Double_t GetDY() const
Definition: TGeoBBox.h:71
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:462
Double_t Cos(Double_t)
Definition: TMath.h:550
const Bool_t kFALSE
Definition: RtypesCore.h:88
TGeoMedium * GetMedium(const char *medium) const
Search for a named tracking medium. All trailing blanks stripped.
virtual void Gsdvt(const char *name, const char *mother, Double_t step, Int_t iaxis, Int_t numed, Int_t ndvmx)
Create a new volume by dividing an existing one.
Double_t GetPhi1() const
Definition: TGeoPcon.h:71
TGeoMaterial * Material(const char *name, Double_t a, Double_t z, Double_t dens, Int_t uid, Double_t radlen=0, Double_t intlen=0)
Create material with given A, Z and density, having an unique id.
A tube segment cut with 2 planes.
Definition: TGeoTube.h:168
virtual Bool_t GetTransformation(const TString &volumePath, TGeoHMatrix &matrix)
Return the transformation matrix between the volume specified by the path volumePath and the Top or m...
#define ClassImp(name)
Definition: Rtypes.h:359
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:559
TGeoManager * GetTGeoManager() const
Return TGeoManager global pointer.
virtual const char * VolName(Int_t id) const
Return the volume name given the volume identifier.
double Double_t
Definition: RtypesCore.h:55
Int_t GetNumber() const
Definition: TGeoVolume.h:185
virtual Int_t VolId(const char *volName) const
Return the unique numeric identifier for volume name.
const Double_t * GetNhigh() const
Definition: TGeoTube.h:208
Conical tube class.
Definition: TGeoCone.h:17
Double_t y[n]
Definition: legend1.C:17
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
Double_t GetDy1() const
Definition: TGeoTrd2.h:58
static TGeoMCGeometry * fgInstance
Singleton instance.
Double_t GetH1() const
Definition: TGeoArb8.h:126
TObjArray * GetListOfUVolumes() const
Definition: TGeoManager.h:469
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:23
virtual Double_t GetRmax2() const
Definition: TGeoCone.h:76
Array of doubles (64 bits per element).
Definition: TArrayD.h:27
Double_t GetTwistAngle() const
Definition: TGeoArb8.h:166
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Double_t GetDx1() const
Definition: TGeoTrd2.h:56
void Node(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, Bool_t isOnly, Float_t *upar, Int_t npar=0)
Create a node called <name_nr> pointing to the volume called <name> as daughter of the volume called ...
void AddAt(Double_t c, Int_t i)
Set the double c value at position i in the array.
Definition: TArrayD.cxx:94
Double_t GetDz() const
Definition: TGeoArb8.h:63
Double_t GetTl1() const
Definition: TGeoArb8.h:128
auto * l
Definition: textangle.C:4
Elliptical tube class.
Definition: TGeoEltu.h:17
virtual Double_t GetRmin() const
Definition: TGeoTube.h:66
TGeoMCGeometry()
Default constructor.
Double_t Sin(Double_t)
Definition: TMath.h:547
Double_t GetAlpha1() const
Definition: TGeoArb8.h:129
virtual Double_t GetA() const
Definition: TGeoEltu.h:43
virtual void Mixture(Int_t &kmat, const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)
Define a mixture or a compound with a number kmat composed by the basic nlmat materials defined by ar...
Double_t GetDz() const
Definition: TGeoTrd1.h:58
Double_t Sqrt(Double_t x)
Definition: TMath.h:590
Bool_t fG3CompatibleVolumeNames
Option to convert volumes names to be compatible with G3.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:908
Double_t GetParam(Int_t i) const
Definition: TGeoMedium.h:49
virtual Double_t GetRadLen() const
Definition: TGeoMaterial.h:93
TGeoShape * GetShape() const
Definition: TGeoVolume.h:191
Double_t GetZ() const
Definition: TGeoPara.h:63
Double_t GetDx1() const
Definition: TGeoTrd1.h:55
Double_t GetTxy() const
Definition: TGeoPara.h:67
const Bool_t kTRUE
Definition: RtypesCore.h:87
void Set(Int_t n)
Set size of this array to n doubles.
Definition: TArrayD.cxx:106
virtual void Matrix(Int_t &krot, Double_t thetaX, Double_t phiX, Double_t thetaY, Double_t phiY, Double_t thetaZ, Double_t phiZ)
Define a rotation matrix.
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:94
Double_t Tan(Double_t)
Definition: TMath.h:553
virtual Double_t GetRmin() const
Definition: TGeoSphere.h:67
virtual Double_t GetDz() const
Definition: TGeoTube.h:68
char name[80]
Definition: TGX11.cxx:109
Double_t GetTl2() const
Definition: TGeoArb8.h:132
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:72
const char * Data() const
Definition: TString.h:345
Double_t GetStIn() const
Definition: TGeoHype.h:68
virtual const char * VolDaughterName(const char *volName, Int_t i) const
Return the name of i-th daughters of the volume specified by volName According to A...
Double_t GetTheta2() const
Definition: TGeoSphere.h:70
A phi segment of a tube.
Definition: TGeoTube.h:88