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