// @(#)root/geom:$Id$
// Author: Mihaela Gheata   30/05/07

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGeoBuilder
#define ROOT_TGeoBuilder

#ifndef ROOT_TObject
#include "TObject.h"
#endif

///////////////////////////////////////////////////////////////////////////
//                                                                       //
//  TGeoBuilder                                                          //
//                                                                       //
// Geometry construction class                                           //
//                                                                       //
///////////////////////////////////////////////////////////////////////////

class TGeoMaterial;
class TGeoMatrix;
class TGeoMedium;
class TGeoShape;
class TGeoVolume;
class TGeoVolumeAssembly;
class TGeoVolumeMulti;
class TGeoManager;

class TGeoBuilder : public TObject
{
protected:
   static TGeoBuilder    *fgInstance;            //! static pointer to singleton

   TGeoBuilder();
   TGeoBuilder(const TGeoBuilder&);
   TGeoBuilder& operator=(const TGeoBuilder&);

private :
   TGeoManager           *fGeometry;             //! current geometry

   void                   SetGeometry(TGeoManager *geom) {fGeometry = geom;}

public :
   virtual ~TGeoBuilder();

   static TGeoBuilder    *Instance(TGeoManager *geom);

   Int_t                  AddMaterial(TGeoMaterial *material);
   Int_t                  AddTransformation(TGeoMatrix *matrix);
   Int_t                  AddShape(TGeoShape *shape);
   void                   RegisterMatrix(TGeoMatrix *matrix);

   TGeoVolume            *MakeArb8(const char *name, TGeoMedium *medium,
                                     Double_t dz, Double_t *vertices=0);
   TGeoVolume            *MakeBox(const char *name, TGeoMedium *medium,
                                     Double_t dx, Double_t dy, Double_t dz);
   TGeoVolume            *MakeCone(const char *name, TGeoMedium *medium,
                                      Double_t dz, Double_t rmin1, Double_t rmax1,
                                      Double_t rmin2, Double_t rmax2);
   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);
   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);
   TGeoVolume            *MakeEltu(const char *name, TGeoMedium *medium,
                                      Double_t a, Double_t b, Double_t dz);
   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);
   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);
   TGeoVolume            *MakePcon(const char *name, TGeoMedium *medium,
                                      Double_t phi, Double_t dphi, Int_t nz);
   TGeoVolume            *MakeParaboloid(const char *name, TGeoMedium *medium,
                                      Double_t rlo, Double_t rhi, Double_t dz);
   TGeoVolume            *MakeHype(const char *name, TGeoMedium *medium,
                                      Double_t rin, Double_t stin, Double_t rout, Double_t stout, Double_t dz);
   TGeoVolume            *MakePgon(const char *name, TGeoMedium *medium,
                                      Double_t phi, Double_t dphi, Int_t nedges, Int_t nz);
   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);
   TGeoVolume            *MakeTorus(const char *name, TGeoMedium *medium, Double_t r,
                                    Double_t rmin, Double_t rmax, Double_t phi1=0, Double_t dphi=360);
   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);
   TGeoVolume            *MakeTrd1(const char *name, TGeoMedium *medium,
                                      Double_t dx1, Double_t dx2, Double_t dy, Double_t dz);
   TGeoVolume            *MakeTrd2(const char *name, TGeoMedium *medium,
                                      Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2,
                                      Double_t dz);
   TGeoVolume            *MakeTube(const char *name, TGeoMedium *medium,
                                      Double_t rmin, Double_t rmax, Double_t dz);
   TGeoVolume            *MakeTubs(const char *name, TGeoMedium *medium,
                                      Double_t rmin, Double_t rmax, Double_t dz,
                                      Double_t phi1, Double_t phi2);
   TGeoVolume            *MakeXtru(const char *name, TGeoMedium *medium,
                                   Int_t nz);
   TGeoVolumeAssembly    *MakeVolumeAssembly(const char *name);
   TGeoVolumeMulti       *MakeVolumeMulti(const char *name, TGeoMedium *medium);

   //--- GEANT3-like geometry creation
   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="");
   void                   Matrix(Int_t index, Double_t theta1, Double_t phi1,
                                       Double_t theta2, Double_t phi2,
                                       Double_t theta3, Double_t phi3);
   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);
   TGeoMaterial          *Mixture(const char *name, Float_t *a, Float_t *z, Double_t dens,
                                        Int_t nelem, Float_t *wmat, Int_t uid);
   TGeoMaterial          *Mixture(const char *name, Double_t *a, Double_t *z, Double_t dens,
                                        Int_t nelem, Double_t *wmat, Int_t uid);
   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);
   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);
   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, Double_t *upar, Int_t npar=0);
   TGeoVolume            *Volume(const char *name, const char *shape, Int_t nmed,
                                       Float_t *upar, Int_t npar=0);
   TGeoVolume            *Volume(const char *name, const char *shape, Int_t nmed,
                                       Double_t *upar, Int_t npar=0);

   ClassDef(TGeoBuilder, 0)          // geometry builder singleton
};

#endif

 TGeoBuilder.h:1
 TGeoBuilder.h:2
 TGeoBuilder.h:3
 TGeoBuilder.h:4
 TGeoBuilder.h:5
 TGeoBuilder.h:6
 TGeoBuilder.h:7
 TGeoBuilder.h:8
 TGeoBuilder.h:9
 TGeoBuilder.h:10
 TGeoBuilder.h:11
 TGeoBuilder.h:12
 TGeoBuilder.h:13
 TGeoBuilder.h:14
 TGeoBuilder.h:15
 TGeoBuilder.h:16
 TGeoBuilder.h:17
 TGeoBuilder.h:18
 TGeoBuilder.h:19
 TGeoBuilder.h:20
 TGeoBuilder.h:21
 TGeoBuilder.h:22
 TGeoBuilder.h:23
 TGeoBuilder.h:24
 TGeoBuilder.h:25
 TGeoBuilder.h:26
 TGeoBuilder.h:27
 TGeoBuilder.h:28
 TGeoBuilder.h:29
 TGeoBuilder.h:30
 TGeoBuilder.h:31
 TGeoBuilder.h:32
 TGeoBuilder.h:33
 TGeoBuilder.h:34
 TGeoBuilder.h:35
 TGeoBuilder.h:36
 TGeoBuilder.h:37
 TGeoBuilder.h:38
 TGeoBuilder.h:39
 TGeoBuilder.h:40
 TGeoBuilder.h:41
 TGeoBuilder.h:42
 TGeoBuilder.h:43
 TGeoBuilder.h:44
 TGeoBuilder.h:45
 TGeoBuilder.h:46
 TGeoBuilder.h:47
 TGeoBuilder.h:48
 TGeoBuilder.h:49
 TGeoBuilder.h:50
 TGeoBuilder.h:51
 TGeoBuilder.h:52
 TGeoBuilder.h:53
 TGeoBuilder.h:54
 TGeoBuilder.h:55
 TGeoBuilder.h:56
 TGeoBuilder.h:57
 TGeoBuilder.h:58
 TGeoBuilder.h:59
 TGeoBuilder.h:60
 TGeoBuilder.h:61
 TGeoBuilder.h:62
 TGeoBuilder.h:63
 TGeoBuilder.h:64
 TGeoBuilder.h:65
 TGeoBuilder.h:66
 TGeoBuilder.h:67
 TGeoBuilder.h:68
 TGeoBuilder.h:69
 TGeoBuilder.h:70
 TGeoBuilder.h:71
 TGeoBuilder.h:72
 TGeoBuilder.h:73
 TGeoBuilder.h:74
 TGeoBuilder.h:75
 TGeoBuilder.h:76
 TGeoBuilder.h:77
 TGeoBuilder.h:78
 TGeoBuilder.h:79
 TGeoBuilder.h:80
 TGeoBuilder.h:81
 TGeoBuilder.h:82
 TGeoBuilder.h:83
 TGeoBuilder.h:84
 TGeoBuilder.h:85
 TGeoBuilder.h:86
 TGeoBuilder.h:87
 TGeoBuilder.h:88
 TGeoBuilder.h:89
 TGeoBuilder.h:90
 TGeoBuilder.h:91
 TGeoBuilder.h:92
 TGeoBuilder.h:93
 TGeoBuilder.h:94
 TGeoBuilder.h:95
 TGeoBuilder.h:96
 TGeoBuilder.h:97
 TGeoBuilder.h:98
 TGeoBuilder.h:99
 TGeoBuilder.h:100
 TGeoBuilder.h:101
 TGeoBuilder.h:102
 TGeoBuilder.h:103
 TGeoBuilder.h:104
 TGeoBuilder.h:105
 TGeoBuilder.h:106
 TGeoBuilder.h:107
 TGeoBuilder.h:108
 TGeoBuilder.h:109
 TGeoBuilder.h:110
 TGeoBuilder.h:111
 TGeoBuilder.h:112
 TGeoBuilder.h:113
 TGeoBuilder.h:114
 TGeoBuilder.h:115
 TGeoBuilder.h:116
 TGeoBuilder.h:117
 TGeoBuilder.h:118
 TGeoBuilder.h:119
 TGeoBuilder.h:120
 TGeoBuilder.h:121
 TGeoBuilder.h:122
 TGeoBuilder.h:123
 TGeoBuilder.h:124
 TGeoBuilder.h:125
 TGeoBuilder.h:126
 TGeoBuilder.h:127
 TGeoBuilder.h:128
 TGeoBuilder.h:129
 TGeoBuilder.h:130
 TGeoBuilder.h:131
 TGeoBuilder.h:132
 TGeoBuilder.h:133
 TGeoBuilder.h:134
 TGeoBuilder.h:135
 TGeoBuilder.h:136
 TGeoBuilder.h:137
 TGeoBuilder.h:138
 TGeoBuilder.h:139
 TGeoBuilder.h:140
 TGeoBuilder.h:141
 TGeoBuilder.h:142
 TGeoBuilder.h:143
 TGeoBuilder.h:144
 TGeoBuilder.h:145
 TGeoBuilder.h:146