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