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