Logo ROOT  
Reference Guide
TGeoBuilder.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Mihaela Gheata 30/05/07
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TGeoBuilder
13 \ingroup Geometry_classes
14 
15 Utility class for creating geometry objects.These will be associated
16 with the current selected geometry manager object:
17 
18 `TGeoBuilder::Instance()->SetGeometry(gGeoManager);`
19 
20 The geometry builder is a singleton that may be used to build one or more
21 geometries.
22 */
23 
24 #include "TList.h"
25 #include "TObjArray.h"
26 
27 #include "TGeoManager.h"
28 #include "TGeoElement.h"
29 #include "TGeoMaterial.h"
30 #include "TGeoMedium.h"
31 #include "TGeoMatrix.h"
32 #include "TGeoPara.h"
33 #include "TGeoParaboloid.h"
34 #include "TGeoTube.h"
35 #include "TGeoEltu.h"
36 #include "TGeoHype.h"
37 #include "TGeoCone.h"
38 #include "TGeoSphere.h"
39 #include "TGeoArb8.h"
40 #include "TGeoPgon.h"
41 #include "TGeoTrd1.h"
42 #include "TGeoTrd2.h"
43 #include "TGeoTorus.h"
44 #include "TGeoXtru.h"
45 #include "TGeoNode.h"
46 #include "TGeoVolume.h"
47 
48 #include "TGeoBuilder.h"
49 
51 
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Default constructor.
56 
58  :fGeometry(nullptr)
59 {
60  fgInstance = this;
61 }
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 /// Destructor.
65 
67 {
68  fgInstance = nullptr;
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Return pointer to singleton.
73 
75 {
76  if (!geom) {
77  printf("ERROR: Cannot create geometry builder with NULL geometry\n");
78  return NULL;
79  }
80  if (!fgInstance) fgInstance = new TGeoBuilder();
81  fgInstance->SetGeometry(geom);
82  return fgInstance;
83 }
84 
85 ////////////////////////////////////////////////////////////////////////////////
86 /// Add a material to the list. Returns index of the material in list.
87 
89 {
90  if (!material) return -1;
91  TList *materials = fGeometry->GetListOfMaterials();
92  Int_t index = materials->GetSize();
93  material->SetIndex(index);
94  materials->Add(material);
95  return index;
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// Add a matrix to the list. Returns index of the matrix in list.
100 
102 {
103  Int_t index = -1;
104  if (!matrix) return -1;
105  TObjArray *matrices = fGeometry->GetListOfMatrices();
106  index = matrices->GetEntriesFast();
107  matrices->AddAtAndExpand(matrix,index);
108  return index;
109 }
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Add a shape to the list. Returns index of the shape in list.
113 
115 {
116  Int_t index = -1;
117  if (!shape) return -1;
119  if (shape->IsRunTimeShape()) shapes = fGeometry->GetListOfGShapes();
120  index = shapes->GetEntriesFast();
121  shapes->AddAtAndExpand(shape,index);
122  return index;
123 }
124 
125 ////////////////////////////////////////////////////////////////////////////////
126 /// Register a matrix to the list of matrices. It will be cleaned-up at the
127 /// destruction TGeoManager.
128 
130 {
131  if (matrix->IsRegistered()) return;
132  TObjArray *matrices = fGeometry->GetListOfMatrices();
133  Int_t nmat = matrices->GetEntriesFast();
134  matrices->AddAtAndExpand(matrix, nmat);
135 }
136 
137 ////////////////////////////////////////////////////////////////////////////////
138 /// Make an TGeoArb8 volume.
139 
141  Double_t dz, Double_t *vertices)
142 {
143  TGeoArb8 *arb = new TGeoArb8(name, dz, vertices);
144  TGeoVolume *vol = new TGeoVolume(name, arb, medium);
145  return vol;
146 }
147 
148 ////////////////////////////////////////////////////////////////////////////////
149 /// Make in one step a volume pointing to a box shape with given medium.
150 
152  Double_t dx, Double_t dy, Double_t dz)
153 {
154  TGeoBBox *box = new TGeoBBox(name, dx, dy, dz);
155  TGeoVolume *vol = 0;
156  if (box->IsRunTimeShape()) {
157  vol = fGeometry->MakeVolumeMulti(name, medium);
158  vol->SetShape(box);
159  } else {
160  vol = new TGeoVolume(name, box, medium);
161  }
162  return vol;
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 /// Make in one step a volume pointing to a parallelepiped shape with given medium.
167 
169  Double_t dx, Double_t dy, Double_t dz,
170  Double_t alpha, Double_t theta, Double_t phi)
171 {
173  Warning("MakePara","parallelepiped %s having alpha=0, theta=0 -> making box instead", name);
174  return MakeBox(name, medium, dx, dy, dz);
175  }
176  TGeoPara *para=0;
177  para = new TGeoPara(name, dx, dy, dz, alpha, theta, phi);
178  TGeoVolume *vol = 0;
179  if (para->IsRunTimeShape()) {
180  vol = fGeometry->MakeVolumeMulti(name, medium);
181  vol->SetShape(para);
182  } else {
183  vol = new TGeoVolume(name, para, medium);
184  }
185  return vol;
186 }
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 /// Make in one step a volume pointing to a sphere shape with given medium
190 
192  Double_t rmin, Double_t rmax, Double_t themin, Double_t themax,
193  Double_t phimin, Double_t phimax)
194 {
195  TGeoSphere *sph = new TGeoSphere(name, rmin, rmax, themin, themax, phimin, phimax);
196  TGeoVolume *vol = new TGeoVolume(name, sph, medium);
197  return vol;
198 }
199 
200 ////////////////////////////////////////////////////////////////////////////////
201 /// Make in one step a volume pointing to a torus shape with given medium.
202 
204  Double_t rmin, Double_t rmax, Double_t phi1, Double_t dphi)
205 {
206  TGeoTorus *tor = new TGeoTorus(name,r,rmin,rmax,phi1,dphi);
207  TGeoVolume *vol = new TGeoVolume(name, tor, medium);
208  return vol;
209 }
210 
211 ////////////////////////////////////////////////////////////////////////////////
212 /// Make in one step a volume pointing to a tube shape with given medium.
213 
215  Double_t rmin, Double_t rmax, Double_t dz)
216 {
217  if (rmin>rmax) {
218  Error("MakeTube", "tube %s, Rmin=%g greater than Rmax=%g", name,rmin,rmax);
219  }
220  TGeoTube *tube = new TGeoTube(name, rmin, rmax, dz);
221  TGeoVolume *vol = 0;
222  if (tube->IsRunTimeShape()) {
223  vol = fGeometry->MakeVolumeMulti(name, medium);
224  vol->SetShape(tube);
225  } else {
226  vol = new TGeoVolume(name, tube, medium);
227  }
228  return vol;
229 }
230 
231 ////////////////////////////////////////////////////////////////////////////////
232 /// Make in one step a volume pointing to a tube segment shape with given medium.
233 
235  Double_t rmin, Double_t rmax, Double_t dz,
236  Double_t phi1, Double_t phi2)
237 {
238  TGeoTubeSeg *tubs = new TGeoTubeSeg(name, rmin, rmax, dz, phi1, phi2);
239  TGeoVolume *vol = 0;
240  if (tubs->IsRunTimeShape()) {
241  vol = fGeometry->MakeVolumeMulti(name, medium);
242  vol->SetShape(tubs);
243  } else {
244  vol = new TGeoVolume(name, tubs, medium);
245  }
246  return vol;
247 }
248 
249 ////////////////////////////////////////////////////////////////////////////////
250 /// Make in one step a volume pointing to a tube shape with given medium
251 
254 {
255  TGeoEltu *eltu = new TGeoEltu(name, a, b, dz);
256  TGeoVolume *vol = 0;
257  if (eltu->IsRunTimeShape()) {
258  vol = fGeometry->MakeVolumeMulti(name, medium);
259  vol->SetShape(eltu);
260  } else {
261  vol = new TGeoVolume(name, eltu, medium);
262  }
263  return vol;
264 }
265 
266 ////////////////////////////////////////////////////////////////////////////////
267 /// Make in one step a volume pointing to a tube shape with given medium
268 
270  Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
271 {
272  TGeoHype * hype = new TGeoHype(name, rin,stin,rout,stout,dz);
273  TGeoVolume *vol = 0;
274  if (hype->IsRunTimeShape()) {
275  vol = fGeometry->MakeVolumeMulti(name, medium);
276  vol->SetShape(hype);
277  } else {
278  vol = new TGeoVolume(name, hype, medium);
279  }
280  return vol;
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Make in one step a volume pointing to a tube shape with given medium
285 
287  Double_t rlo, Double_t rhi, Double_t dz)
288 {
289  TGeoParaboloid *parab = new TGeoParaboloid(name, rlo, rhi, dz);
290  TGeoVolume *vol = 0;
291  if (parab->IsRunTimeShape()) {
292  vol = fGeometry->MakeVolumeMulti(name, medium);
293  vol->SetShape(parab);
294  } else {
295  vol = new TGeoVolume(name, parab, medium);
296  }
297  return vol;
298 }
299 
300 ////////////////////////////////////////////////////////////////////////////////
301 /// Make in one step a volume pointing to a tube segment shape with given medium
302 
304  Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2,
305  Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
306 {
307  TGeoCtub *ctub = new TGeoCtub(name, rmin, rmax, dz, phi1, phi2, lx, ly, lz, tx, ty, tz);
308  TGeoVolume *vol = new TGeoVolume(name, ctub, medium);
309  return vol;
310 }
311 
312 ////////////////////////////////////////////////////////////////////////////////
313 /// Make in one step a volume pointing to a cone shape with given medium.
314 
316  Double_t dz, Double_t rmin1, Double_t rmax1,
317  Double_t rmin2, Double_t rmax2)
318 {
319  TGeoCone *cone = new TGeoCone(name, dz, rmin1, rmax1, rmin2, rmax2);
320  TGeoVolume *vol = 0;
321  if (cone->IsRunTimeShape()) {
322  vol = fGeometry->MakeVolumeMulti(name, medium);
323  vol->SetShape(cone);
324  } else {
325  vol = new TGeoVolume(name, cone, medium);
326  }
327  return vol;
328 }
329 
330 ////////////////////////////////////////////////////////////////////////////////
331 /// Make in one step a volume pointing to a cone segment shape with given medium
332 
334  Double_t dz, Double_t rmin1, Double_t rmax1,
335  Double_t rmin2, Double_t rmax2,
336  Double_t phi1, Double_t phi2)
337 {
338  TGeoConeSeg *cons = new TGeoConeSeg(name, dz, rmin1, rmax1, rmin2, rmax2, phi1, phi2);
339  TGeoVolume *vol = 0;
340  if (cons->IsRunTimeShape()) {
341  vol = fGeometry->MakeVolumeMulti(name, medium);
342  vol->SetShape(cons);
343  } else {
344  vol = new TGeoVolume(name, cons, medium);
345  }
346  return vol;
347 }
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 /// Make in one step a volume pointing to a polycone shape with given medium.
351 
353  Double_t phi, Double_t dphi, Int_t nz)
354 {
355  TGeoPcon *pcon = new TGeoPcon(name, phi, dphi, nz);
356  TGeoVolume *vol = new TGeoVolume(name, pcon, medium);
357  return vol;
358 }
359 
360 ////////////////////////////////////////////////////////////////////////////////
361 /// Make in one step a volume pointing to a polygone shape with given medium.
362 
364  Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
365 {
366  TGeoPgon *pgon = new TGeoPgon(name, phi, dphi, nedges, nz);
367  TGeoVolume *vol = new TGeoVolume(name, pgon, medium);
368  return vol;
369 }
370 
371 ////////////////////////////////////////////////////////////////////////////////
372 /// Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
373 
375  Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
376 {
377  TGeoTrd1 *trd1 = new TGeoTrd1(name, dx1, dx2, dy, dz);
378  TGeoVolume *vol = 0;
379  if (trd1->IsRunTimeShape()) {
380  vol = fGeometry->MakeVolumeMulti(name, medium);
381  vol->SetShape(trd1);
382  } else {
383  vol = new TGeoVolume(name, trd1, medium);
384  }
385  return vol;
386 }
387 
388 ////////////////////////////////////////////////////////////////////////////////
389 /// Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
390 
392  Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2,
393  Double_t dz)
394 {
395  TGeoTrd2 *trd2 = new TGeoTrd2(name, dx1, dx2, dy1, dy2, dz);
396  TGeoVolume *vol = 0;
397  if (trd2->IsRunTimeShape()) {
398  vol = fGeometry->MakeVolumeMulti(name, medium);
399  vol->SetShape(trd2);
400  } else {
401  vol = new TGeoVolume(name, trd2, medium);
402  }
403  return vol;
404 }
405 
406 ////////////////////////////////////////////////////////////////////////////////
407 /// Make in one step a volume pointing to a trapezoid shape with given medium.
408 
410  Double_t dz, Double_t theta, Double_t phi, Double_t h1,
411  Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2,
412  Double_t tl2, Double_t alpha2)
413 {
414  TGeoTrap *trap = new TGeoTrap(name, dz, theta, phi, h1, bl1, tl1, alpha1, h2, bl2,
415  tl2, alpha2);
416  TGeoVolume *vol = new TGeoVolume(name, trap, medium);
417  return vol;
418 }
419 
420 ////////////////////////////////////////////////////////////////////////////////
421 /// Make in one step a volume pointing to a twisted trapezoid shape with given medium.
422 
424  Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1,
425  Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2,
426  Double_t tl2, Double_t alpha2)
427 {
428  TGeoGtra *gtra = new TGeoGtra(name, dz, theta, phi, twist, h1, bl1, tl1, alpha1, h2, bl2,
429  tl2, alpha2);
430  TGeoVolume *vol = new TGeoVolume(name, gtra, medium);
431  return vol;
432 }
433 ////////////////////////////////////////////////////////////////////////////////
434 /// Make a TGeoXtru-shaped volume with nz planes
435 
437 {
438  TGeoXtru *xtru = new TGeoXtru(nz);
439  xtru->SetName(name);
440  TGeoVolume *vol = new TGeoVolume(name, xtru, medium);
441  return vol;
442 }
443 
444 ////////////////////////////////////////////////////////////////////////////////
445 /// Make an assembly of volumes.
446 
448 {
449  return (new TGeoVolumeAssembly(name));
450 }
451 
452 ////////////////////////////////////////////////////////////////////////////////
453 /// Make a TGeoVolumeMulti handling a list of volumes.
454 
456 {
457  return (new TGeoVolumeMulti(name, medium));
458 }
459 
460 
461 ////////////////////////////////////////////////////////////////////////////////
462 /// Create a new volume by dividing an existing one (GEANT3 like)
463 ///
464 /// Divides MOTHER into NDIV divisions called NAME
465 /// along axis IAXIS starting at coordinate value START
466 /// and having size STEP. The created volumes will have tracking
467 /// media ID=NUMED (if NUMED=0 -> same media as MOTHER)
468 /// The behavior of the division operation can be triggered using OPTION (case insensitive):
469 ///
470 /// - N - divide all range in NDIV cells (same effect as STEP<=0) (GSDVN in G3)
471 /// - NX - divide range starting with START in NDIV cells (GSDVN2 in G3)
472 /// - S - divide all range with given STEP. NDIV is computed and divisions will be centered
473 /// in full range (same effect as NDIV<=0) (GSDVS, GSDVT in G3)
474 /// - SX - same as DVS, but from START position. (GSDVS2, GSDVT2 in G3)
475 
476 TGeoVolume *TGeoBuilder::Division(const char *name, const char *mother, Int_t iaxis,
477  Int_t ndiv, Double_t start, Double_t step, Int_t numed, Option_t *option)
478 {
479  TGeoVolume *amother;
480  TString sname = name;
481  sname = sname.Strip();
482  const char *vname = sname.Data();
483  TString smname = mother;
484  smname = smname.Strip();
485  const char *mname = smname.Data();
486 
487  amother = (TGeoVolume*)fGeometry->GetListOfGVolumes()->FindObject(mname);
488  if (!amother) amother = fGeometry->GetVolume(mname);
489  if (amother) return amother->Divide(vname,iaxis,ndiv,start,step,numed, option);
490 
491  Error("Division","VOLUME: \"%s\" not defined",mname);
492 
493  return 0;
494 }
495 
496 ////////////////////////////////////////////////////////////////////////////////
497 /// Create rotation matrix named 'mat<index>'.
498 ///
499 /// - index rotation matrix number
500 /// - theta1 polar angle for axis X
501 /// - phi1 azimuthal angle for axis X
502 /// - theta2 polar angle for axis Y
503 /// - phi2 azimuthal angle for axis Y
504 /// - theta3 polar angle for axis Z
505 /// - phi3 azimuthal angle for axis Z
506 ///
507 
508 void TGeoBuilder::Matrix(Int_t index, Double_t theta1, Double_t phi1,
509  Double_t theta2, Double_t phi2,
510  Double_t theta3, Double_t phi3)
511 {
512  TGeoRotation * rot = new TGeoRotation("",theta1,phi1,theta2,phi2,theta3,phi3);
513  rot->SetUniqueID(index);
514  rot->RegisterYourself();
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// Create material with given A, Z and density, having an unique id.
519 
521 {
522  TGeoMaterial *material = new TGeoMaterial(name,a,z,dens,radlen,intlen);
523  material->SetUniqueID(uid);
524  return material;
525 }
526 
527 ////////////////////////////////////////////////////////////////////////////////
528 /// Create mixture OR COMPOUND IMAT as composed by THE BASIC nelem
529 /// materials defined by arrays A,Z and WMAT, having an unique id.
530 
532  Int_t nelem, Float_t *wmat, Int_t uid)
533 {
534  TGeoMixture *mix = new TGeoMixture(name,nelem,dens);
535  mix->SetUniqueID(uid);
536  Int_t i;
537  for (i=0;i<nelem;i++) {
538  mix->DefineElement(i,a[i],z[i],wmat[i]);
539  }
540  return (TGeoMaterial*)mix;
541 }
542 
543 ////////////////////////////////////////////////////////////////////////////////
544 /// Create mixture OR COMPOUND IMAT as composed by THE BASIC nelem
545 /// materials defined by arrays A,Z and WMAT, having an unique id.
546 
548  Int_t nelem, Double_t *wmat, Int_t uid)
549 {
550  TGeoMixture *mix = new TGeoMixture(name,nelem,dens);
551  mix->SetUniqueID(uid);
552  Int_t i;
553  for (i=0;i<nelem;i++) {
554  mix->DefineElement(i,a[i],z[i],wmat[i]);
555  }
556  return (TGeoMaterial*)mix;
557 }
558 
559 ////////////////////////////////////////////////////////////////////////////////
560 /// Create tracking medium
561 ///
562 /// - numed tracking medium number assigned
563 /// - name tracking medium name
564 /// - nmat material number
565 /// - isvol sensitive volume flag
566 /// - ifield magnetic field
567 /// - fieldm max. field value (kilogauss)
568 /// - tmaxfd max. angle due to field (deg/step)
569 /// - stemax max. step allowed
570 /// - deemax max. fraction of energy lost in a step
571 /// - epsil tracking precision (cm)
572 /// - stmin min. step due to continuous processes (cm)
573 ///
574 /// - ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
575 /// - ifield = 1 if tracking performed with g3rkuta; ifield = 2 if tracking
576 /// performed with g3helix; ifield = 3 if tracking performed with g3helx3.
577 ///
578 
579 TGeoMedium *TGeoBuilder::Medium(const char *name, Int_t numed, Int_t nmat, Int_t isvol,
580  Int_t ifield, Double_t fieldm, Double_t tmaxfd,
581  Double_t stemax, Double_t deemax, Double_t epsil,
582  Double_t stmin)
583 {
584  return new TGeoMedium(name,numed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
585 }
586 
587 ////////////////////////////////////////////////////////////////////////////////
588 /// Create a node called <name_nr> pointing to the volume called <name>
589 /// as daughter of the volume called <mother> (gspos). The relative matrix is
590 /// made of : a translation (x,y,z) and a rotation matrix named <matIROT>.
591 /// In case npar>0, create the volume to be positioned in mother, according
592 /// its actual parameters (gsposp).
593 /// - NAME Volume name
594 /// - NUMBER Copy number of the volume
595 /// - MOTHER Mother volume name
596 /// - X X coord. of the volume in mother ref. sys.
597 /// - Y Y coord. of the volume in mother ref. sys.
598 /// - Z Z coord. of the volume in mother ref. sys.
599 /// - IROT Rotation matrix number w.r.t. mother ref. sys.
600 /// - ISONLY ONLY/MANY flag
601 
602 void TGeoBuilder::Node(const char *name, Int_t nr, const char *mother,
603  Double_t x, Double_t y, Double_t z, Int_t irot,
604  Bool_t isOnly, Float_t *upar, Int_t npar)
605 {
606  TGeoVolume *amother= 0;
607  TGeoVolume *volume = 0;
608 
609  // look into special volume list first
610  amother = fGeometry->FindVolumeFast(mother,kTRUE);
611  if (!amother) amother = fGeometry->FindVolumeFast(mother);
612  if (!amother) {
613  TString mname = mother;
614  mname = mname.Strip();
615  Error("Node","Mother VOLUME \"%s\" not defined",mname.Data());
616  return;
617  }
618  Int_t i;
619  if (npar<=0) {
620  //---> acting as G3 gspos
621  if (gDebug > 0) Info("Node","Calling gspos, mother=%s, name=%s, nr=%d, x=%g, y=%g, z=%g, irot=%d, konly=%i",mother,name,nr,x,y,z,irot,(Int_t)isOnly);
622  // look into special volume list first
623  volume = fGeometry->FindVolumeFast(name,kTRUE);
624  if (!volume) volume = fGeometry->FindVolumeFast(name);
625  if (!volume) {
626  TString vname = name;
627  vname = vname.Strip();
628  Error("Node","VOLUME: \"%s\" not defined",vname.Data());
629  return;
630  }
631  if (((TObject*)volume)->TestBit(TGeoVolume::kVolumeMulti) && !volume->GetShape()) {
632  Error("Node", "cannot add multiple-volume object %s as node", volume->GetName());
633  return;
634  }
635  } else {
636  //---> acting as G3 gsposp
638  if (!vmulti) {
639  volume = fGeometry->FindVolumeFast(name);
640  if (volume) {
641  Warning("Node", "volume: %s is defined as single -> ignoring shape parameters", volume->GetName());
642  Node(name,nr,mother,x,y,z,irot,isOnly, upar);
643  return;
644  }
645  TString vname = name;
646  vname = vname.Strip();
647  Error("Node","VOLUME: \"%s\" not defined ",vname.Data());
648  return;
649  }
650  TGeoMedium *medium = vmulti->GetMedium();
651  TString sh = vmulti->GetTitle();
652  sh.ToLower();
653  if (sh.Contains("box")) {
654  volume = MakeBox(name,medium,upar[0],upar[1],upar[2]);
655  } else if (sh.Contains("trd1")) {
656  volume = MakeTrd1(name,medium,upar[0],upar[1],upar[2],upar[3]);
657  } else if (sh.Contains("trd2")) {
658  volume = MakeTrd2(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
659  } else if (sh.Contains("trap")) {
660  volume = MakeTrap(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
661  } else if (sh.Contains("gtra")) {
662  volume = MakeGtra(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10],upar[11]);
663  } else if (sh.Contains("tube")) {
664  volume = MakeTube(name,medium,upar[0],upar[1],upar[2]);
665  } else if (sh.Contains("tubs")) {
666  volume = MakeTubs(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
667  } else if (sh.Contains("cone")) {
668  volume = MakeCone(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
669  } else if (sh.Contains("cons")) {
670  volume = MakeCons(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6]);
671  } else if (sh.Contains("pgon")) {
672  volume = MakePgon(name,medium,upar[0],upar[1],(Int_t)upar[2],(Int_t)upar[3]);
673  Int_t nz = (Int_t)upar[3];
674  for (i=0;i<nz;i++) {
675  ((TGeoPgon*)volume->GetShape())->DefineSection(i,upar[3*i+4],upar[3*i+5],upar[3*i+6]);
676  }
677  } else if (sh.Contains("pcon")) {
678  volume = MakePcon(name,medium,upar[0],upar[1],(Int_t)upar[2]);
679  Int_t nz = (Int_t)upar[2];
680  for (i=0;i<nz;i++) {
681  ((TGeoPcon*)volume->GetShape())->DefineSection(i,upar[3*i+3],upar[3*i+4],upar[3*i+5]);
682  }
683  } else if (sh.Contains("eltu")) {
684  volume = MakeEltu(name,medium,upar[0],upar[1],upar[2]);
685  } else if (sh.Contains("sphe")) {
686  volume = MakeSphere(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
687  } else if (sh.Contains("ctub")) {
688  volume = MakeCtub(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
689  } else if (sh.Contains("para")) {
690  volume = MakePara(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
691  } else {
692  Error("Node","cannot create shape %s",sh.Data());
693  }
694 
695  if (!volume) return;
696  vmulti->AddVolume(volume);
697  }
698  if (irot) {
699  TGeoRotation *matrix = 0;
700  TGeoMatrix *mat;
702  while ((mat=(TGeoMatrix*)next())) {
703  if (mat->GetUniqueID()==UInt_t(irot)) {
704  matrix = dynamic_cast<TGeoRotation*>(mat);
705  break;
706  }
707  }
708  if (!matrix) {
709  Fatal("Node", "Node %s/%s_%d rotation %i not found",mother, name, nr ,irot);
710  return;
711  }
712  if (isOnly) amother->AddNode(volume,nr,new TGeoCombiTrans(x,y,z,matrix));
713  else amother->AddNodeOverlap(volume,nr,new TGeoCombiTrans(x,y,z,matrix));
714  } else {
718  if (isOnly) amother->AddNode(volume,nr);
719  else amother->AddNodeOverlap(volume,nr);
720  } else {
721  if (isOnly) amother->AddNode(volume,nr,new TGeoTranslation(x,y,z));
722  else amother->AddNodeOverlap(volume,nr,new TGeoTranslation(x,y,z));
723  }
724  }
725 }
726 
727 ////////////////////////////////////////////////////////////////////////////////
728 /// Create a node called <name_nr> pointing to the volume called <name>
729 /// as daughter of the volume called <mother> (gspos). The relative matrix is
730 /// made of : a translation (x,y,z) and a rotation matrix named <matIROT>.
731 /// In case npar>0, create the volume to be positioned in mother, according
732 /// its actual parameters (gsposp).
733 /// - NAME Volume name
734 /// - NUMBER Copy number of the volume
735 /// - MOTHER Mother volume name
736 /// - X X coord. of the volume in mother ref. sys.
737 /// - Y Y coord. of the volume in mother ref. sys.
738 /// - Z Z coord. of the volume in mother ref. sys.
739 /// - IROT Rotation matrix number w.r.t. mother ref. sys.
740 /// - ISONLY ONLY/MANY flag
741 
742 void TGeoBuilder::Node(const char *name, Int_t nr, const char *mother,
743  Double_t x, Double_t y, Double_t z, Int_t irot,
744  Bool_t isOnly, Double_t *upar, Int_t npar)
745 {
746  TGeoVolume *amother= 0;
747  TGeoVolume *volume = 0;
748 
749  // look into special volume list first
750  amother = fGeometry->FindVolumeFast(mother,kTRUE);
751  if (!amother) amother = fGeometry->FindVolumeFast(mother);
752  if (!amother) {
753  TString mname = mother;
754  mname = mname.Strip();
755  Error("Node","Mother VOLUME \"%s\" not defined",mname.Data());
756  return;
757  }
758  Int_t i;
759  if (npar<=0) {
760  //---> acting as G3 gspos
761  if (gDebug > 0) Info("Node","Calling gspos, mother=%s, name=%s, nr=%d, x=%g, y=%g, z=%g, irot=%d, konly=%i",mother,name,nr,x,y,z,irot,(Int_t)isOnly);
762  // look into special volume list first
763  volume = fGeometry->FindVolumeFast(name,kTRUE);
764  if (!volume) volume = fGeometry->FindVolumeFast(name);
765  if (!volume) {
766  TString vname = name;
767  vname = vname.Strip();
768  Error("Node","VOLUME: \"%s\" not defined",vname.Data());
769  return;
770  }
771  if (((TObject*)volume)->TestBit(TGeoVolume::kVolumeMulti) && !volume->GetShape()) {
772  Error("Node", "cannot add multiple-volume object %s as node", volume->GetName());
773  return;
774  }
775  } else {
776  //---> acting as G3 gsposp
778  if (!vmulti) {
779  volume = fGeometry->FindVolumeFast(name);
780  if (volume) {
781  Warning("Node", "volume: %s is defined as single -> ignoring shape parameters", volume->GetName());
782  Node(name,nr,mother,x,y,z,irot,isOnly, upar);
783  return;
784  }
785  TString vname = name;
786  vname = vname.Strip();
787  Error("Node","VOLUME: \"%s\" not defined ",vname.Data());
788  return;
789  }
790  TGeoMedium *medium = vmulti->GetMedium();
791  TString sh = vmulti->GetTitle();
792  sh.ToLower();
793  if (sh.Contains("box")) {
794  volume = MakeBox(name,medium,upar[0],upar[1],upar[2]);
795  } else if (sh.Contains("trd1")) {
796  volume = MakeTrd1(name,medium,upar[0],upar[1],upar[2],upar[3]);
797  } else if (sh.Contains("trd2")) {
798  volume = MakeTrd2(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
799  } else if (sh.Contains("trap")) {
800  volume = MakeTrap(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
801  } else if (sh.Contains("gtra")) {
802  volume = MakeGtra(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10],upar[11]);
803  } else if (sh.Contains("tube")) {
804  volume = MakeTube(name,medium,upar[0],upar[1],upar[2]);
805  } else if (sh.Contains("tubs")) {
806  volume = MakeTubs(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
807  } else if (sh.Contains("cone")) {
808  volume = MakeCone(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
809  } else if (sh.Contains("cons")) {
810  volume = MakeCons(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6]);
811  } else if (sh.Contains("pgon")) {
812  volume = MakePgon(name,medium,upar[0],upar[1],(Int_t)upar[2],(Int_t)upar[3]);
813  Int_t nz = (Int_t)upar[3];
814  for (i=0;i<nz;i++) {
815  ((TGeoPgon*)volume->GetShape())->DefineSection(i,upar[3*i+4],upar[3*i+5],upar[3*i+6]);
816  }
817  } else if (sh.Contains("pcon")) {
818  volume = MakePcon(name,medium,upar[0],upar[1],(Int_t)upar[2]);
819  Int_t nz = (Int_t)upar[2];
820  for (i=0;i<nz;i++) {
821  ((TGeoPcon*)volume->GetShape())->DefineSection(i,upar[3*i+3],upar[3*i+4],upar[3*i+5]);
822  }
823  } else if (sh.Contains("eltu")) {
824  volume = MakeEltu(name,medium,upar[0],upar[1],upar[2]);
825  } else if (sh.Contains("sphe")) {
826  volume = MakeSphere(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
827  } else if (sh.Contains("ctub")) {
828  volume = MakeCtub(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
829  } else if (sh.Contains("para")) {
830  volume = MakePara(name,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
831  } else {
832  Error("Node","cannot create shape %s",sh.Data());
833  }
834 
835  if (!volume) return;
836  vmulti->AddVolume(volume);
837  }
838  if (irot) {
839  TGeoRotation *matrix = 0;
840  TGeoMatrix *mat;
842  while ((mat=(TGeoMatrix*)next())) {
843  if (mat->GetUniqueID()==UInt_t(irot)) {
844  matrix = dynamic_cast<TGeoRotation*>(mat);
845  break;
846  }
847  }
848  if (!matrix) {
849  Fatal("Node", "Node %s/%s_%d rotation %i not found",mother, name, nr ,irot);
850  return;
851  }
852  if (isOnly) amother->AddNode(volume,nr,new TGeoCombiTrans(x,y,z,matrix));
853  else amother->AddNodeOverlap(volume,nr,new TGeoCombiTrans(x,y,z,matrix));
854  } else {
858  if (isOnly) amother->AddNode(volume,nr);
859  else amother->AddNodeOverlap(volume,nr);
860  } else {
861  if (isOnly) amother->AddNode(volume,nr,new TGeoTranslation(x,y,z));
862  else amother->AddNodeOverlap(volume,nr,new TGeoTranslation(x,y,z));
863  }
864  }
865 }
866 
867 ////////////////////////////////////////////////////////////////////////////////
868 /// Create a volume in GEANT3 style.
869 /// - NAME Volume name
870 /// - SHAPE Volume type
871 /// - NMED Tracking medium number
872 /// - NPAR Number of shape parameters
873 /// - UPAR Vector containing shape parameters
874 
875 TGeoVolume *TGeoBuilder::Volume(const char *name, const char *shape, Int_t nmed,
876  Float_t *upar, Int_t npar)
877 {
878  Int_t i;
879  TGeoVolume *volume = 0;
880  TGeoMedium *medium = fGeometry->GetMedium(nmed);
881  if (!medium) {
882  Error("Volume","cannot create volume: %s, medium: %d is unknown",name,nmed);
883  return 0;
884  }
885  TString sh = shape;
886  TString sname = name;
887  sname = sname.Strip();
888  const char *vname = sname.Data();
889  if (npar <= 0) {
890  //--- create a TGeoVolumeMulti
891  volume = MakeVolumeMulti(vname,medium);
892  volume->SetTitle(shape);
894  if (!vmulti) {
895  Error("Volume","volume multi: %s not created",vname);
896  return 0;
897  }
898  return vmulti;
899  }
900  //---> create a normal volume
901  sh.ToLower();
902  if (sh.Contains("box")) {
903  volume = MakeBox(vname,medium,upar[0],upar[1],upar[2]);
904  } else if (sh.Contains("trd1")) {
905  volume = MakeTrd1(vname,medium,upar[0],upar[1],upar[2],upar[3]);
906  } else if (sh.Contains("trd2")) {
907  volume = MakeTrd2(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
908  } else if (sh.Contains("trap")) {
909  volume = MakeTrap(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
910  } else if (sh.Contains("gtra")) {
911  volume = MakeGtra(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10],upar[11]);
912  } else if (sh.Contains("tube")) {
913  volume = MakeTube(vname,medium,upar[0],upar[1],upar[2]);
914  } else if (sh.Contains("tubs")) {
915  volume = MakeTubs(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
916  } else if (sh.Contains("cone")) {
917  volume = MakeCone(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
918  } else if (sh.Contains("cons")) {
919  volume = MakeCons(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6]);
920  } else if (sh.Contains("pgon")) {
921  volume = MakePgon(vname,medium,upar[0],upar[1],(Int_t)upar[2],(Int_t)upar[3]);
922  Int_t nz = (Int_t)upar[3];
923  for (i=0;i<nz;i++) {
924  ((TGeoPgon*)volume->GetShape())->DefineSection(i,upar[3*i+4],upar[3*i+5],upar[3*i+6]);
925  }
926  } else if (sh.Contains("pcon")) {
927  volume = MakePcon(vname,medium,upar[0],upar[1],(Int_t)upar[2]);
928  Int_t nz = (Int_t)upar[2];
929  for (i=0;i<nz;i++) {
930  ((TGeoPcon*)volume->GetShape())->DefineSection(i,upar[3*i+3],upar[3*i+4],upar[3*i+5]);
931  }
932  } else if (sh.Contains("eltu")) {
933  volume = MakeEltu(vname,medium,upar[0],upar[1],upar[2]);
934  } else if (sh.Contains("sphe")) {
935  volume = MakeSphere(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
936  } else if (sh.Contains("ctub")) {
937  volume = MakeCtub(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
938  } else if (sh.Contains("para")) {
939  volume = MakePara(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
940  } else if (sh.Contains("tor")) {
941  volume = MakeTorus(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
942  }
943 
944  if (!volume) {
945  Error("Volume","volume: %s not created",vname);
946  return 0;
947  }
948  return volume;
949 }
950 
951 
952 ////////////////////////////////////////////////////////////////////////////////
953 /// Create a volume in GEANT3 style.
954 /// - NAME Volume name
955 /// - SHAPE Volume type
956 /// - NMED Tracking medium number
957 /// - NPAR Number of shape parameters
958 /// - UPAR Vector containing shape parameters
959 
960 TGeoVolume *TGeoBuilder::Volume(const char *name, const char *shape, Int_t nmed,
961  Double_t *upar, Int_t npar)
962 {
963  Int_t i;
964  TGeoVolume *volume = 0;
965  TGeoMedium *medium = fGeometry->GetMedium(nmed);
966  if (!medium) {
967  Error("Volume","cannot create volume: %s, medium: %d is unknown",name,nmed);
968  return 0;
969  }
970  TString sh = shape;
971  TString sname = name;
972  sname = sname.Strip();
973  const char *vname = sname.Data();
974  if (npar <= 0) {
975  //--- create a TGeoVolumeMulti
976  volume = MakeVolumeMulti(vname,medium);
977  volume->SetTitle(shape);
979  if (!vmulti) {
980  Error("Volume","volume multi: %s not created",vname);
981  return 0;
982  }
983  return vmulti;
984  }
985  //---> create a normal volume
986  sh.ToLower();
987  if (sh.Contains("box")) {
988  volume = MakeBox(vname,medium,upar[0],upar[1],upar[2]);
989  } else if (sh.Contains("trd1")) {
990  volume = MakeTrd1(vname,medium,upar[0],upar[1],upar[2],upar[3]);
991  } else if (sh.Contains("trd2")) {
992  volume = MakeTrd2(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
993  } else if (sh.Contains("trap")) {
994  volume = MakeTrap(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
995  } else if (sh.Contains("gtra")) {
996  volume = MakeGtra(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10],upar[11]);
997  } else if (sh.Contains("tube")) {
998  volume = MakeTube(vname,medium,upar[0],upar[1],upar[2]);
999  } else if (sh.Contains("tubs")) {
1000  volume = MakeTubs(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
1001  } else if (sh.Contains("cone")) {
1002  volume = MakeCone(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
1003  } else if (sh.Contains("cons")) {
1004  volume = MakeCons(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6]);
1005  } else if (sh.Contains("pgon")) {
1006  volume = MakePgon(vname,medium,upar[0],upar[1],(Int_t)upar[2],(Int_t)upar[3]);
1007  Int_t nz = (Int_t)upar[3];
1008  for (i=0;i<nz;i++) {
1009  ((TGeoPgon*)volume->GetShape())->DefineSection(i,upar[3*i+4],upar[3*i+5],upar[3*i+6]);
1010  }
1011  } else if (sh.Contains("pcon")) {
1012  volume = MakePcon(vname,medium,upar[0],upar[1],(Int_t)upar[2]);
1013  Int_t nz = (Int_t)upar[2];
1014  for (i=0;i<nz;i++) {
1015  ((TGeoPcon*)volume->GetShape())->DefineSection(i,upar[3*i+3],upar[3*i+4],upar[3*i+5]);
1016  }
1017  } else if (sh.Contains("eltu")) {
1018  volume = MakeEltu(vname,medium,upar[0],upar[1],upar[2]);
1019  } else if (sh.Contains("sphe")) {
1020  volume = MakeSphere(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
1021  } else if (sh.Contains("ctub")) {
1022  volume = MakeCtub(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5],upar[6],upar[7],upar[8],upar[9],upar[10]);
1023  } else if (sh.Contains("para")) {
1024  volume = MakePara(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4],upar[5]);
1025  } else if (sh.Contains("tor")) {
1026  volume = MakeTorus(vname,medium,upar[0],upar[1],upar[2],upar[3],upar[4]);
1027  }
1028 
1029  if (!volume) {
1030  Error("Volume","volume: %s not created",vname);
1031  return 0;
1032  }
1033  return volume;
1034 }
1035 
TGeoMedium.h
TGeoBuilder::MakeHype
TGeoVolume * MakeHype(const char *name, TGeoMedium *medium, Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:269
TGeoBuilder::MakeCtub
TGeoVolume * MakeCtub(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2, Double_t lx, Double_t ly, Double_t lz, Double_t tx, Double_t ty, Double_t tz)
Make in one step a volume pointing to a tube segment shape with given medium.
Definition: TGeoBuilder.cxx:303
TGeoPara
Parallelepiped class.
Definition: TGeoPara.h:18
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
shapes
Definition: shapes.py:1
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
TGeoBuilder::MakePgon
TGeoVolume * MakePgon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nedges, Int_t nz)
Make in one step a volume pointing to a polygone shape with given medium.
Definition: TGeoBuilder.cxx:363
TGeoVolume::GetShape
TGeoShape * GetShape() const
Definition: TGeoVolume.h:188
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGeoCombiTrans
Class describing rotation + translation.
Definition: TGeoMatrix.h:292
TGeoBuilder::MakeXtru
TGeoVolume * MakeXtru(const char *name, TGeoMedium *medium, Int_t nz)
Make a TGeoXtru-shaped volume with nz planes.
Definition: TGeoBuilder.cxx:436
TString::Strip
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1128
TGeoMixture::DefineElement
void DefineElement(Int_t iel, Double_t a, Double_t z, Double_t weight)
Definition: TGeoMaterial.h:215
TGeoBuilder::MakePcon
TGeoVolume * MakePcon(const char *name, TGeoMedium *medium, Double_t phi, Double_t dphi, Int_t nz)
Make in one step a volume pointing to a polycone shape with given medium.
Definition: TGeoBuilder.cxx:352
TGeoBuilder::SetGeometry
void SetGeometry(TGeoManager *geom)
current geometry
Definition: TGeoBuilder.h:38
TGeoBuilder::MakeTrd1
TGeoVolume * MakeTrd1(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy, Double_t dz)
Make in one step a volume pointing to a TGeoTrd1 shape with given medium.
Definition: TGeoBuilder.cxx:374
TGeoTorus
Torus segment class.
Definition: TGeoTorus.h:18
TString::Data
const char * Data() const
Definition: TString.h:369
TGeoHype
Hyperboloid class defined by 5 parameters.
Definition: TGeoHype.h:18
TGeoCtub
A tube segment cut with 2 planes.
Definition: TGeoTube.h:172
TGeoXtru
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Definition: TGeoXtru.h:23
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGeoBuilder::AddShape
Int_t AddShape(TGeoShape *shape)
Add a shape to the list. Returns index of the shape in list.
Definition: TGeoBuilder.cxx:114
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:867
TGeoVolume::kVolumeMulti
@ kVolumeMulti
Definition: TGeoVolume.h:82
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
TGeoBuilder::MakeGtra
TGeoVolume * MakeGtra(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t twist, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a twisted trapezoid shape with given medium.
Definition: TGeoBuilder.cxx:423
TGeoBuilder::MakeVolumeAssembly
TGeoVolumeAssembly * MakeVolumeAssembly(const char *name)
Make an assembly of volumes.
Definition: TGeoBuilder.cxx:447
TGeoArb8
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition: TGeoArb8.h:18
Float_t
float Float_t
Definition: RtypesCore.h:57
TObject::Fatal
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:921
TGeoBuilder::MakeBox
TGeoVolume * MakeBox(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz)
Make in one step a volume pointing to a box shape with given medium.
Definition: TGeoBuilder.cxx:151
Int_t
int Int_t
Definition: RtypesCore.h:45
TGeoVolume.h
box
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
TObject::GetUniqueID
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:377
TGeoBuilder::Medium
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.
Definition: TGeoBuilder.cxx:579
TGeoVolume::AddNode
virtual void AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
Definition: TGeoVolume.cxx:932
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
x
Double_t x[n]
Definition: legend1.C:17
TGeoEltu.h
TList.h
TGeoCone
Conical tube class.
Definition: TGeoCone.h:18
TGeoBuilder::MakeCons
TGeoVolume * MakeCons(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a cone segment shape with given medium.
Definition: TGeoBuilder.cxx:333
TGeoBuilder::Division
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)
Definition: TGeoBuilder.cxx:476
TGeoTubeSeg
A phi segment of a tube.
Definition: TGeoTube.h:92
TMath::Abs
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
TGeoEltu
Elliptical tube class.
Definition: TGeoEltu.h:18
TString
Basic string class.
Definition: TString.h:136
TGeoMatrix::IsRegistered
Bool_t IsRegistered() const
Definition: TGeoMatrix.h:77
TGeoCone.h
TGeoTranslation
Class describing translations.
Definition: TGeoMatrix.h:122
TGeoMixture
Mixtures of elements.
Definition: TGeoMaterial.h:157
TGeoMaterial::SetIndex
void SetIndex(Int_t index)
Definition: TGeoMaterial.h:136
b
#define b(i)
Definition: RSha256.hxx:100
h1
TH1F * h1
Definition: legend1.C:5
TGeoMaterial
Base class describing materials.
Definition: TGeoMaterial.h:36
bool
TGeoVolume::GetMedium
TGeoMedium * GetMedium() const
Definition: TGeoVolume.h:173
TGeoTrd2.h
TGeoBuilder::MakePara
TGeoVolume * MakePara(const char *name, TGeoMedium *medium, Double_t dx, Double_t dy, Double_t dz, Double_t alpha, Double_t theta, Double_t phi)
Make in one step a volume pointing to a parallelepiped shape with given medium.
Definition: TGeoBuilder.cxx:168
TGeoVolumeMulti::AddVolume
void AddVolume(TGeoVolume *vol)
Add a volume with valid shape to the list of volumes.
Definition: TGeoVolume.cxx:2420
TGeoBuilder::Node
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 ...
Definition: TGeoBuilder.cxx:602
TGeoManager::FindVolumeFast
TGeoVolume * FindVolumeFast(const char *name, Bool_t multi=kFALSE)
Fast search for a named volume. All trailing blanks stripped.
Definition: TGeoManager.cxx:2723
TGeoBuilder.h
TGeoVolume::SetShape
void SetShape(const TGeoShape *shape)
set the shape associated with this volume
Definition: TGeoVolume.cxx:1941
TGeoParaboloid.h
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
TGeoBuilder::MakeCone
TGeoVolume * MakeCone(const char *name, TGeoMedium *medium, Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
Make in one step a volume pointing to a cone shape with given medium.
Definition: TGeoBuilder.cxx:315
TGeoBuilder::MakeArb8
TGeoVolume * MakeArb8(const char *name, TGeoMedium *medium, Double_t dz, Double_t *vertices=0)
Make an TGeoArb8 volume.
Definition: TGeoBuilder.cxx:140
TGeoManager::GetListOfMaterials
TList * GetListOfMaterials() const
Definition: TGeoManager.h:491
TGeoArb8.h
TGeoShape
Base abstract class for all shapes.
Definition: TGeoShape.h:26
TGeoBuilder::MakeEltu
TGeoVolume * MakeEltu(const char *name, TGeoMedium *medium, Double_t a, Double_t b, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:252
TGeoTrd1.h
TGeoBuilder::MakeTrd2
TGeoVolume * MakeTrd2(const char *name, TGeoMedium *medium, Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
Make in one step a volume pointing to a TGeoTrd2 shape with given medium.
Definition: TGeoBuilder.cxx:391
TGeoSphere
Spherical shell class.
Definition: TGeoSphere.h:18
TGeoManager::GetVolume
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
Definition: TGeoManager.cxx:2712
TGeoElement.h
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
a
auto * a
Definition: textangle.C:12
TGeoMaterial.h
TGeoRotation
Class describing rotations.
Definition: TGeoMatrix.h:175
TGeoHype.h
TGeoBuilder::RegisterMatrix
void RegisterMatrix(TGeoMatrix *matrix)
Register a matrix to the list of matrices.
Definition: TGeoBuilder.cxx:129
TGeoBuilder::fgInstance
static TGeoBuilder * fgInstance
Definition: TGeoBuilder.h:29
TGeoBuilder::AddMaterial
Int_t AddMaterial(TGeoMaterial *material)
Add a material to the list. Returns index of the material in list.
Definition: TGeoBuilder.cxx:88
TObjArray::AddAtAndExpand
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
Definition: TObjArray.cxx:235
TGeoBuilder::AddTransformation
Int_t AddTransformation(TGeoMatrix *matrix)
Add a matrix to the list. Returns index of the matrix in list.
Definition: TGeoBuilder.cxx:101
gDebug
Int_t gDebug
Definition: TROOT.cxx:590
TGeoTube
Cylindrical tube class.
Definition: TGeoTube.h:18
TGeoPgon
A polygone.
Definition: TGeoPgon.h:21
TGeoPcon
A polycone.
Definition: TGeoPcon.h:18
y
Double_t y[n]
Definition: legend1.C:17
TGeoBBox
Box class.
Definition: TGeoBBox.h:18
TGeoXtru.h
TGeoBuilder::~TGeoBuilder
virtual ~TGeoBuilder()
Destructor.
Definition: TGeoBuilder.cxx:66
TGeoBuilder::Material
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.
Definition: TGeoBuilder.cxx:520
TGeoBuilder::MakeVolumeMulti
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Definition: TGeoBuilder.cxx:455
TGeoBuilder::MakeTubs
TGeoVolume * MakeTubs(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
Make in one step a volume pointing to a tube segment shape with given medium.
Definition: TGeoBuilder.cxx:234
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
unsigned int
TGeoGtra
Gtra is a twisted trapezoid.
Definition: TGeoArb8.h:146
TGeoMatrix.h
TGeoBuilder::MakeSphere
TGeoVolume * MakeSphere(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t themin=0, Double_t themax=180, Double_t phimin=0, Double_t phimax=360)
Make in one step a volume pointing to a sphere shape with given medium.
Definition: TGeoBuilder.cxx:191
TGeoShape::IsRunTimeShape
Bool_t IsRunTimeShape() const
Definition: TGeoShape.h:139
TGeoManager.h
TGeoBuilder::MakeParaboloid
TGeoVolume * MakeParaboloid(const char *name, TGeoMedium *medium, Double_t rlo, Double_t rhi, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:286
TGeoVolume::AddNodeOverlap
virtual void AddNodeOverlap(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=0, Option_t *option="")
Add a TGeoNode to the list of nodes.
Definition: TGeoVolume.cxx:996
TGeoManager::GetListOfGShapes
TObjArray * GetListOfGShapes() const
Definition: TGeoManager.h:496
TGeoVolume::Divide
virtual TGeoVolume * Divide(const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step, Int_t numed=0, Option_t *option="")
Division a la G3.
Definition: TGeoVolume.cxx:1050
TGeoParaboloid
Paraboloid class.
Definition: TGeoParaboloid.h:18
TGeoTrd1
A trapezoid with only x length varying with z.
Definition: TGeoTrd1.h:18
Double_t
double Double_t
Definition: RtypesCore.h:59
TGeoMatrix
Geometrical transformation package.
Definition: TGeoMatrix.h:41
TGeoManager::MakeVolumeMulti
TGeoVolumeMulti * MakeVolumeMulti(const char *name, TGeoMedium *medium)
Make a TGeoVolumeMulti handling a list of volumes.
Definition: TGeoManager.cxx:3310
TObjArray.h
TGeoManager::GetListOfGVolumes
TObjArray * GetListOfGVolumes() const
Definition: TGeoManager.h:494
TObjArray::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
TCollection::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
TGeoVolumeMulti
Volume families.
Definition: TGeoVolume.h:254
TGeoBuilder::Mixture
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,...
Definition: TGeoBuilder.cxx:531
TGeoBuilder::MakeTrap
TGeoVolume * MakeTrap(const char *name, TGeoMedium *medium, Double_t dz, Double_t theta, Double_t phi, Double_t h1, Double_t bl1, Double_t tl1, Double_t alpha1, Double_t h2, Double_t bl2, Double_t tl2, Double_t alpha2)
Make in one step a volume pointing to a trapezoid shape with given medium.
Definition: TGeoBuilder.cxx:409
TGeoBuilder::Instance
static TGeoBuilder * Instance(TGeoManager *geom)
Return pointer to singleton.
Definition: TGeoBuilder.cxx:74
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
name
char name[80]
Definition: TGX11.cxx:110
TGeoBuilder::Matrix
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 'mat<index>'.
Definition: TGeoBuilder.cxx:508
TGeoManager::GetMedium
TGeoMedium * GetMedium(const char *medium) const
Search for a named tracking medium. All trailing blanks stripped.
Definition: TGeoManager.cxx:2784
TGeoBuilder::TGeoBuilder
TGeoBuilder()
static pointer to singleton
Definition: TGeoBuilder.cxx:57
TGeoPara.h
TGeoConeSeg
A phi segment of a conical tube.
Definition: TGeoCone.h:102
TIter
Definition: TCollection.h:233
TGeoShape::Tolerance
static Double_t Tolerance()
Definition: TGeoShape.h:91
TGeoMatrix::RegisterYourself
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Definition: TGeoMatrix.cxx:526
TGeoBuilder::fGeometry
TGeoManager * fGeometry
Definition: TGeoBuilder.h:36
TGeoMedium
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:24
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
TGeoTube.h
TGeoBuilder
Utility class for creating geometry objects.These will be associated with the current selected geomet...
Definition: TGeoBuilder.h:27
TString::ToLower
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1147
TGeoManager::GetListOfShapes
TObjArray * GetListOfShapes() const
Definition: TGeoManager.h:495
TGeoManager::GetListOfMatrices
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:490
TGeoManager
The manager class for any TGeo geometry.
Definition: TGeoManager.h:45
TGeoTrd2
A trapezoid with both x and y lengths varying with z.
Definition: TGeoTrd2.h:18
TGeoVolume
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:49
TGeoVolumeAssembly
Volume assemblies.
Definition: TGeoVolume.h:303
TGeoSphere.h
TGeoNode.h
TList
A doubly linked list.
Definition: TList.h:44
TGeoTrap
TRAP is a general trapezoid, i.e.
Definition: TGeoArb8.h:92
TGeoTorus.h
TGeoBuilder::Volume
TGeoVolume * Volume(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t npar=0)
Create a volume in GEANT3 style.
Definition: TGeoBuilder.cxx:875
TObject::SetUniqueID
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:707
TGeoBuilder::MakeTorus
TGeoVolume * MakeTorus(const char *name, TGeoMedium *medium, Double_t r, Double_t rmin, Double_t rmax, Double_t phi1=0, Double_t dphi=360)
Make in one step a volume pointing to a torus shape with given medium.
Definition: TGeoBuilder.cxx:203
TGeoPgon.h
int
TGeoBuilder::MakeTube
TGeoVolume * MakeTube(const char *name, TGeoMedium *medium, Double_t rmin, Double_t rmax, Double_t dz)
Make in one step a volume pointing to a tube shape with given medium.
Definition: TGeoBuilder.cxx:214