00001 // @(#)root/vmc:$Id: TVirtualMCGeometry.h 27157 2009-01-15 14:05:12Z brun $ 00002 // Authors: Alice collaboration 25/06/2002 00003 00004 /************************************************************************* 00005 * Copyright (C) 2006, Rene Brun and Fons Rademakers. * 00006 * Copyright (C) 2002, ALICE Experiment at CERN. * 00007 * All rights reserved. * 00008 * * 00009 * For the licensing terms see $ROOTSYS/LICENSE. * 00010 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00011 *************************************************************************/ 00012 00013 #ifndef ROOT_TVirtualMCGeometry 00014 #define ROOT_TVirtualMCGeometry 00015 00016 // 00017 // Class TVirtualMCGeometry 00018 // ------------------------- 00019 // Interface to Monte Carlo geometry construction 00020 // (separated from VirtualMC) 00021 00022 #include "TNamed.h" 00023 00024 class TGeoHMatrix; 00025 class TArrayD; 00026 class TString; 00027 00028 class TVirtualMCGeometry : public TNamed { 00029 00030 public: 00031 // Standard constructor 00032 TVirtualMCGeometry(const char *name, const char *title); 00033 00034 // Default constructor 00035 TVirtualMCGeometry(); 00036 00037 // Destructor 00038 virtual ~TVirtualMCGeometry(); 00039 00040 // 00041 // detector composition 00042 // ------------------------------------------------ 00043 // 00044 00045 // Define a material 00046 // kmat number assigned to the material 00047 // name material name 00048 // a atomic mass in au 00049 // z atomic number 00050 // dens density in g/cm3 00051 // absl absorption length in cm; 00052 // if >=0 it is ignored and the program 00053 // calculates it, if <0. -absl is taken 00054 // radl radiation length in cm 00055 // if >=0 it is ignored and the program 00056 // calculates it, if <0. -radl is taken 00057 // buf pointer to an array of user words 00058 // nwbuf number of user words 00059 virtual void Material(Int_t& kmat, const char* name, Double_t a, 00060 Double_t z, Double_t dens, Double_t radl, Double_t absl, 00061 Float_t* buf, Int_t nwbuf) = 0; 00062 00063 // The same as previous but in double precision 00064 virtual void Material(Int_t& kmat, const char* name, Double_t a, 00065 Double_t z, Double_t dens, Double_t radl, Double_t absl, 00066 Double_t* buf, Int_t nwbuf) = 0; 00067 00068 // Define mixture or compound 00069 // with a number kmat composed by the basic nlmat materials defined 00070 // by arrays a, z and wmat 00071 // 00072 // If nlmat > 0 then wmat contains the proportion by 00073 // weights of each basic material in the mixture. 00074 // 00075 // If nlmat < 0 then wmat contains the number of atoms 00076 // of a given kind into the molecule of the compound. 00077 // In this case, wmat in output is changed to relative 00078 // weights. 00079 virtual void Mixture(Int_t& kmat, const char *name, Float_t *a, 00080 Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) = 0; 00081 00082 // The same as previous but in double precision 00083 virtual void Mixture(Int_t& kmat, const char *name, Double_t *a, 00084 Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) = 0; 00085 00086 // Define a medium. 00087 // kmed tracking medium number assigned 00088 // name tracking medium name 00089 // nmat material number 00090 // isvol sensitive volume flag 00091 // ifield magnetic field: 00092 // - ifield = 0 if no magnetic field; 00093 // - ifield = -1 if user decision in guswim; 00094 // - ifield = 1 if tracking performed with g3rkuta; 00095 // - ifield = 2 if tracking 00096 // fieldm max. field value (kilogauss) 00097 // tmaxfd max. angle due to field (deg/step) 00098 // stemax max. step allowed 00099 // deemax max. fraction of energy lost in a step 00100 // epsil tracking precision (cm) 00101 // stmin min. step due to continuous processes (cm) 00102 // ubuf pointer to an array of user words 00103 // nbuf number of user words 00104 // performed with g3helix; ifield = 3 if tracking performed with g3helx3. 00105 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat, 00106 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 00107 Double_t stemax, Double_t deemax, Double_t epsil, 00108 Double_t stmin, Float_t* ubuf, Int_t nbuf) = 0; 00109 00110 // The same as previous but in double precision 00111 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat, 00112 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 00113 Double_t stemax, Double_t deemax, Double_t epsil, 00114 Double_t stmin, Double_t* ubuf, Int_t nbuf) = 0; 00115 00116 // Define a rotation matrix 00117 // krot rotation matrix number assigned 00118 // thetaX polar angle for axis X 00119 // phiX azimuthal angle for axis X 00120 // thetaY polar angle for axis Y 00121 // phiY azimuthal angle for axis Y 00122 // thetaZ polar angle for axis Z 00123 // phiZ azimuthal angle for axis Z 00124 virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, 00125 Double_t thetaY, Double_t phiY, Double_t thetaZ, 00126 Double_t phiZ) = 0; 00127 00128 // 00129 // functions from GGEOM 00130 // ------------------------------------------------ 00131 // 00132 00133 // Create a new volume 00134 // name Volume name 00135 // shape Volume type 00136 // nmed Tracking medium number 00137 // np Number of shape parameters 00138 // upar Vector containing shape parameters 00139 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, 00140 Float_t *upar, Int_t np) = 0; 00141 00142 // The same as previous but in double precision 00143 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, 00144 Double_t *upar, Int_t np) = 0; 00145 00146 // Create a new volume by dividing an existing one. 00147 // It divides a previously defined volume 00148 // name Volume name 00149 // mother Mother volume name 00150 // ndiv Number of divisions 00151 // iaxis Axis value: 00152 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS. 00153 virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, 00154 Int_t iaxis) = 0; 00155 00156 // Create a new volume by dividing an existing one. 00157 // Divide mother into ndiv divisions called name 00158 // along axis iaxis starting at coordinate value c0i. 00159 // The new volume created will be medium number numed. 00160 virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, 00161 Int_t iaxis, Double_t c0i, Int_t numed) = 0; 00162 00163 // Create a new volume by dividing an existing one 00164 // Divide mother into divisions called name along 00165 // axis iaxis in steps of step. If not exactly divisible 00166 // will make as many as possible and will center them 00167 // with respect to the mother. Divisions will have medium 00168 // number numed. If numed is 0, numed of mother is taken. 00169 // ndvmx is the expected maximum number of divisions 00170 // (If 0, no protection tests are performed in Geant3) 00171 virtual void Gsdvt(const char *name, const char *mother, Double_t step, 00172 Int_t iaxis, Int_t numed, Int_t ndvmx) = 0; 00173 00174 // Create a new volume by dividing an existing one 00175 // Divides mother into divisions called name along 00176 // axis iaxis starting at coordinate value c0 with step 00177 // size step. 00178 // The new volume created will have medium number numed. 00179 // If numed is 0, numed of mother is taken. 00180 // ndvmx is the expected maximum number of divisions 00181 // (If 0, no protection tests are performed in Geant3) 00182 virtual void Gsdvt2(const char *name, const char *mother, Double_t step, 00183 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) = 0; 00184 00185 // Flag volume name whose contents will have to be ordered 00186 // along axis iax, by setting the search flag to -iax 00187 // (Geant3 only) 00188 virtual void Gsord(const char *name, Int_t iax) = 0; 00189 00190 // Position a volume into an existing one. 00191 // It positions a previously defined volume in the mother. 00192 // name Volume name 00193 // nr Copy number of the volume 00194 // mother Mother volume name 00195 // x X coord. of the volume in mother ref. sys. 00196 // y Y coord. of the volume in mother ref. sys. 00197 // z Z coord. of the volume in mother ref. sys. 00198 // irot Rotation matrix number w.r.t. mother ref. sys. 00199 // konly ONLY/MANY flag 00200 virtual void Gspos(const char *name, Int_t nr, const char *mother, 00201 Double_t x, Double_t y, Double_t z, Int_t irot, 00202 const char *konly="ONLY") = 0; 00203 00204 // Place a copy of generic volume name with user number 00205 // nr inside mother, with its parameters upar(1..np) 00206 virtual void Gsposp(const char *name, Int_t nr, const char *mother, 00207 Double_t x, Double_t y, Double_t z, Int_t irot, 00208 const char *konly, Float_t *upar, Int_t np) = 0; 00209 00210 // The same as previous but in double precision 00211 virtual void Gsposp(const char *name, Int_t nr, const char *mother, 00212 Double_t x, Double_t y, Double_t z, Int_t irot, 00213 const char *konly, Double_t *upar, Int_t np) = 0; 00214 00215 // Helper function for resolving MANY. 00216 // Specify the ONLY volume that overlaps with the 00217 // specified MANY and has to be substracted. 00218 // (Geant4 only) 00219 virtual void Gsbool(const char* onlyVolName, const char* manyVolName) = 0; 00220 00221 // 00222 // functions for access to geometry 00223 // ------------------------------------------------ 00224 // 00225 00226 // Return the transformation matrix between the volume specified by 00227 // the path volumePath and the top or master volume. 00228 virtual Bool_t GetTransformation(const TString& volumePath, 00229 TGeoHMatrix& matrix) = 0; 00230 00231 // Return the name of the shape (shapeType) and its parameters par 00232 // for the volume specified by the path volumePath . 00233 virtual Bool_t GetShape(const TString& volumePath, 00234 TString& shapeType, TArrayD& par) = 0; 00235 00236 // Return the material parameters for the volume specified by 00237 // the volumeName. 00238 virtual Bool_t GetMaterial(const TString& volumeName, 00239 TString& name, Int_t& imat, 00240 Double_t& a, Double_t& z, Double_t& density, 00241 Double_t& radl, Double_t& inter, TArrayD& par) = 0; 00242 00243 // Return the medium parameters for the volume specified by the 00244 // volumeName. 00245 virtual Bool_t GetMedium(const TString& volumeName, 00246 TString& name, Int_t& imed, 00247 Int_t& nmat, Int_t& isvol, Int_t& ifield, 00248 Double_t& fieldm, Double_t& tmaxfd, Double_t& stemax, 00249 Double_t& deemax, Double_t& epsil, Double_t& stmin, 00250 TArrayD& par) = 0; 00251 00252 // functions for drawing 00253 //virtual void DrawOneSpec(const char* name) = 0; 00254 //virtual void Gsatt(const char* name, const char* att, Int_t val) = 0; 00255 //virtual void Gdraw(const char*,Double_t theta = 30, Double_t phi = 30, 00256 // Double_t psi = 0, Double_t u0 = 10, Double_t v0 = 10, 00257 // Double_t ul = 0.01, Double_t vl = 0.01) = 0; 00258 00259 // Euclid 00260 // virtual void WriteEuclid(const char*, const char*, Int_t, Int_t) = 0; 00261 00262 // 00263 // get methods 00264 // ------------------------------------------------ 00265 // 00266 00267 00268 // Return the unique numeric identifier for volume name volName 00269 virtual Int_t VolId(const char* volName) const = 0; 00270 00271 // Return the volume name for a given volume identifier id 00272 virtual const char* VolName(Int_t id) const = 0; 00273 00274 // Return the unique numeric identifier for medium name mediumName 00275 virtual Int_t MediumId(const char* mediumName) const = 0; 00276 00277 // Return total number of volumes in the geometry 00278 virtual Int_t NofVolumes() const = 0; 00279 00280 // Return number of daughters of the volume specified by volName 00281 virtual Int_t NofVolDaughters(const char* volName) const = 0; 00282 00283 // Return the name of i-th daughter of the volume specified by volName 00284 virtual const char* VolDaughterName(const char* volName, Int_t i) const = 0; 00285 00286 // Return the copyNo of i-th daughter of the volume specified by volName 00287 virtual Int_t VolDaughterCopyNo(const char* volName, Int_t i) const = 0; 00288 00289 // Return material number for a given volume id 00290 virtual Int_t VolId2Mate(Int_t id) const = 0; 00291 00292 protected: 00293 TVirtualMCGeometry(const TVirtualMCGeometry& /*rhs*/); 00294 TVirtualMCGeometry & operator=(const TVirtualMCGeometry& /*rhs*/); 00295 00296 ClassDef(TVirtualMCGeometry,1) //Interface to Monte Carlo geometry construction 00297 }; 00298 00299 #endif //ROOT_TVirtualMCGeometry 00300