// @(#)root/vmc:$Id$
// Authors: Al;ice collaboration 25/06/2002

/*************************************************************************
 * Copyright (C) 2006, Rene Brun and Fons Rademakers.                    *
 * Copyright (C) 2002, ALICE Experiment at CERN.                         *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGeoMCGeometry
#define ROOT_TGeoMCGeometry

//
// Class TGeoMCGeometry
// --------------------
// Implementation of the TVirtualMCGeometry interface
// for building TGeo geometry.
//

#include "TVirtualMCGeometry.h"

class TGeoManager;
class TGeoHMatrix;
class TArrayD;
class TString;

class TGeoMCGeometry : public TVirtualMCGeometry {

public:
   TGeoMCGeometry(const char* name, const char* title,
                   Bool_t g3CompatibleVolumeNames = false);
   TGeoMCGeometry();
   virtual ~TGeoMCGeometry();

   // detector composition
   virtual void  Material(Int_t& kmat, const char* name, Double_t a,
                     Double_t z, Double_t dens, Double_t radl, Double_t absl,
                     Float_t* buf, Int_t nwbuf);
   virtual void  Material(Int_t& kmat, const char* name, Double_t a,
                     Double_t z, Double_t dens, Double_t radl, Double_t absl,
                     Double_t* buf, Int_t nwbuf);
   virtual void  Mixture(Int_t& kmat, const char *name, Float_t *a,
                     Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat);
   virtual void  Mixture(Int_t& kmat, const char *name, Double_t *a,
                     Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat);
   virtual void  Medium(Int_t& kmed, const char *name, 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, Float_t* ubuf, Int_t nbuf);
   virtual void  Medium(Int_t& kmed, const char *name, 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, Double_t* ubuf, Int_t nbuf);
   virtual void  Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
                     Double_t thetaY, Double_t phiY, Double_t thetaZ,
                     Double_t phiZ);

   // functions from GGEOM
   virtual Int_t  Gsvolu(const char *name, const char *shape, Int_t nmed,
                         Float_t *upar, Int_t np);
   virtual Int_t  Gsvolu(const char *name, const char *shape, Int_t nmed,
                         Double_t *upar, Int_t np);
   virtual void  Gsdvn(const char *name, const char *mother, Int_t ndiv,
                       Int_t iaxis);
   virtual void  Gsdvn2(const char *name, const char *mother, Int_t ndiv,
                        Int_t iaxis, Double_t c0i, Int_t numed);
   virtual void  Gsdvt(const char *name, const char *mother, Double_t step,
                       Int_t iaxis, Int_t numed, Int_t ndvmx);
   virtual void  Gsdvt2(const char *name, const char *mother, Double_t step,
                        Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx);
   virtual void  Gsord(const char *name, Int_t iax);
   virtual void  Gspos(const char *name, Int_t nr, const char *mother,
                       Double_t x, Double_t y, Double_t z, Int_t irot,
                       const char *konly);
   virtual void  Gsposp(const char *name, Int_t nr, const char *mother,
                        Double_t x, Double_t y, Double_t z, Int_t irot,
                        const char *konly, Float_t *upar, Int_t np);
   virtual void  Gsposp(const char *name, Int_t nr, const char *mother,
                        Double_t x, Double_t y, Double_t z, Int_t irot,
                        const char *konly, Double_t *upar, Int_t np);
   virtual void  Gsbool(const char* /*onlyVolName*/, const char* /*manyVolName*/) {}


   // functions for access to geometry
   //
   // Return the Transformation matrix between the volume specified by
   // the path volumePath and the top or master volume.
   virtual Bool_t GetTransformation(const TString& volumePath,
                        TGeoHMatrix& matrix);

   // Return the name of the shape and its parameters for the volume
   // specified by the volume name.
   virtual Bool_t GetShape(const TString& volumePath,
                         TString& shapeType, TArrayD& par);

   // Returns the material parameters for the volume specified by
   // the volume name.
   virtual Bool_t GetMaterial(const TString& volumeName,
                         TString& name, Int_t& imat,
                         Double_t& a, Double_t& z, Double_t& density,
                         Double_t& radl, Double_t& inter, TArrayD& par);

   // Returns the medium parameters for the volume specified by the
   // volume name.
   virtual Bool_t GetMedium(const TString& volumeName,
                         TString& name, Int_t& imed,
                         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,
                         TArrayD& par);
   // functions for drawing
   //virtual void  DrawOneSpec(const char* name);
   //virtual void  Gsatt(const char* name, const char* att, Int_t val);
   //virtual void  Gdraw(const char*,Double_t theta, Double_t phi,
   //          Double_t psi, Double_t u0, Double_t v0,
   //          Double_t ul, Double_t vl);

   // Euclid
   //virtual void  WriteEuclid(const char*, const char*, Int_t, Int_t);

   // get methods
   virtual Int_t VolId(const char* volName) const;
   virtual const char* VolName(Int_t id) const;
   virtual Int_t MediumId(const char* mediumName) const;
   virtual Int_t NofVolumes() const;
   virtual Int_t NofVolDaughters(const char* volName) const;
   virtual const char*  VolDaughterName(const char* volName, Int_t i) const;
   virtual Int_t        VolDaughterCopyNo(const char* volName, Int_t i) const;
   virtual Int_t VolId2Mate(Int_t id) const;

private:
   TGeoMCGeometry(const TGeoMCGeometry& /*rhs*/);
   TGeoMCGeometry& operator=(const TGeoMCGeometry& /*rhs*/);

   TGeoManager* GetTGeoManager() const;

   Double_t* CreateDoubleArray(Float_t* array, Int_t size) const;
   void     Vname(const char *name, char *vname) const;

   Bool_t  fG3CompatibleVolumeNames;   // option to convert volumes names to
                                        // be compatible with G3

   static TGeoMCGeometry*  fgInstance; // singleton instance

   ClassDef(TGeoMCGeometry,2)  // VMC TGeo Geometry builder
};

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