ROOT  6.06/09
Reference Guide
TVirtualMCGeometry.h
Go to the documentation of this file.
1 // @(#)root/vmc:$Id$
2 // Authors: Alice collaboration 25/06/2002
3 
4 /*************************************************************************
5  * Copyright (C) 2006, Rene Brun and Fons Rademakers. *
6  * Copyright (C) 2002, ALICE Experiment at CERN. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 #ifndef ROOT_TVirtualMCGeometry
14 #define ROOT_TVirtualMCGeometry
15 
16 //
17 // Class TVirtualMCGeometry
18 // -------------------------
19 // Interface to Monte Carlo geometry construction
20 // (separated from VirtualMC)
21 
22 #include "TNamed.h"
23 
24 class TGeoHMatrix;
25 class TArrayD;
26 class TString;
27 
28 class TVirtualMCGeometry : public TNamed {
29 
30 public:
31  // Standard constructor
32  TVirtualMCGeometry(const char *name, const char *title);
33 
34  // Default constructor
36 
37  // Destructor
38  virtual ~TVirtualMCGeometry();
39 
40  //
41  // detector composition
42  // ------------------------------------------------
43  //
44 
45  // Define a material
46  // kmat number assigned to the material
47  // name material name
48  // a atomic mass in au
49  // z atomic number
50  // dens density in g/cm3
51  // absl absorption length in cm;
52  // if >=0 it is ignored and the program
53  // calculates it, if <0. -absl is taken
54  // radl radiation length in cm
55  // if >=0 it is ignored and the program
56  // calculates it, if <0. -radl is taken
57  // buf pointer to an array of user words
58  // nwbuf number of user words
59  virtual void Material(Int_t& kmat, const char* name, Double_t a,
60  Double_t z, Double_t dens, Double_t radl, Double_t absl,
61  Float_t* buf, Int_t nwbuf) = 0;
62 
63  // The same as previous but in double precision
64  virtual void Material(Int_t& kmat, const char* name, Double_t a,
65  Double_t z, Double_t dens, Double_t radl, Double_t absl,
66  Double_t* buf, Int_t nwbuf) = 0;
67 
68  // Define mixture or compound
69  // with a number kmat composed by the basic nlmat materials defined
70  // by arrays a, z and wmat
71  //
72  // If nlmat > 0 then wmat contains the proportion by
73  // weights of each basic material in the mixture.
74  //
75  // If nlmat < 0 then wmat contains the number of atoms
76  // of a given kind into the molecule of the compound.
77  // In this case, wmat in output is changed to relative
78  // weights.
79  virtual void Mixture(Int_t& kmat, const char *name, Float_t *a,
80  Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) = 0;
81 
82  // The same as previous but in double precision
83  virtual void Mixture(Int_t& kmat, const char *name, Double_t *a,
84  Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) = 0;
85 
86  // Define a medium.
87  // kmed tracking medium number assigned
88  // name tracking medium name
89  // nmat material number
90  // isvol sensitive volume flag
91  // ifield magnetic field:
92  // - ifield = 0 if no magnetic field;
93  // - ifield = -1 if user decision in guswim;
94  // - ifield = 1 if tracking performed with g3rkuta;
95  // - ifield = 2 if tracking
96  // fieldm max. field value (kilogauss)
97  // tmaxfd max. angle due to field (deg/step)
98  // stemax max. step allowed
99  // deemax max. fraction of energy lost in a step
100  // epsil tracking precision (cm)
101  // stmin min. step due to continuous processes (cm)
102  // ubuf pointer to an array of user words
103  // nbuf number of user words
104  // performed with g3helix; ifield = 3 if tracking performed with g3helx3.
105  virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
106  Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
107  Double_t stemax, Double_t deemax, Double_t epsil,
108  Double_t stmin, Float_t* ubuf, Int_t nbuf) = 0;
109 
110  // The same as previous but in double precision
111  virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
112  Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
113  Double_t stemax, Double_t deemax, Double_t epsil,
114  Double_t stmin, Double_t* ubuf, Int_t nbuf) = 0;
115 
116  // Define a rotation matrix
117  // krot rotation matrix number assigned
118  // thetaX polar angle for axis X
119  // phiX azimuthal angle for axis X
120  // thetaY polar angle for axis Y
121  // phiY azimuthal angle for axis Y
122  // thetaZ polar angle for axis Z
123  // phiZ azimuthal angle for axis Z
124  virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
125  Double_t thetaY, Double_t phiY, Double_t thetaZ,
126  Double_t phiZ) = 0;
127 
128  //
129  // functions from GGEOM
130  // ------------------------------------------------
131  //
132 
133  // Create a new volume
134  // name Volume name
135  // shape Volume type
136  // nmed Tracking medium number
137  // np Number of shape parameters
138  // upar Vector containing shape parameters
139  virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
140  Float_t *upar, Int_t np) = 0;
141 
142  // The same as previous but in double precision
143  virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
144  Double_t *upar, Int_t np) = 0;
145 
146  // Create a new volume by dividing an existing one.
147  // It divides a previously defined volume
148  // name Volume name
149  // mother Mother volume name
150  // ndiv Number of divisions
151  // iaxis Axis value:
152  // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
153  virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv,
154  Int_t iaxis) = 0;
155 
156  // Create a new volume by dividing an existing one.
157  // Divide mother into ndiv divisions called name
158  // along axis iaxis starting at coordinate value c0i.
159  // The new volume created will be medium number numed.
160  virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
161  Int_t iaxis, Double_t c0i, Int_t numed) = 0;
162 
163  // Create a new volume by dividing an existing one
164  // Divide mother into divisions called name along
165  // axis iaxis in steps of step. If not exactly divisible
166  // will make as many as possible and will center them
167  // with respect to the mother. Divisions will have medium
168  // number numed. If numed is 0, numed of mother is taken.
169  // ndvmx is the expected maximum number of divisions
170  // (If 0, no protection tests are performed in Geant3)
171  virtual void Gsdvt(const char *name, const char *mother, Double_t step,
172  Int_t iaxis, Int_t numed, Int_t ndvmx) = 0;
173 
174  // Create a new volume by dividing an existing one
175  // Divides mother into divisions called name along
176  // axis iaxis starting at coordinate value c0 with step
177  // size step.
178  // The new volume created will have medium number numed.
179  // If numed is 0, numed of mother is taken.
180  // ndvmx is the expected maximum number of divisions
181  // (If 0, no protection tests are performed in Geant3)
182  virtual void Gsdvt2(const char *name, const char *mother, Double_t step,
183  Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) = 0;
184 
185  // Flag volume name whose contents will have to be ordered
186  // along axis iax, by setting the search flag to -iax
187  // (Geant3 only)
188  virtual void Gsord(const char *name, Int_t iax) = 0;
189 
190  // Position a volume into an existing one.
191  // It positions a previously defined volume in the mother.
192  // name Volume name
193  // nr Copy number of the volume
194  // mother Mother volume name
195  // x X coord. of the volume in mother ref. sys.
196  // y Y coord. of the volume in mother ref. sys.
197  // z Z coord. of the volume in mother ref. sys.
198  // irot Rotation matrix number w.r.t. mother ref. sys.
199  // konly ONLY/MANY flag
200  virtual void Gspos(const char *name, Int_t nr, const char *mother,
201  Double_t x, Double_t y, Double_t z, Int_t irot,
202  const char *konly="ONLY") = 0;
203 
204  // Place a copy of generic volume name with user number
205  // nr inside mother, with its parameters upar(1..np)
206  virtual void Gsposp(const char *name, Int_t nr, const char *mother,
207  Double_t x, Double_t y, Double_t z, Int_t irot,
208  const char *konly, Float_t *upar, Int_t np) = 0;
209 
210  // The same as previous but in double precision
211  virtual void Gsposp(const char *name, Int_t nr, const char *mother,
212  Double_t x, Double_t y, Double_t z, Int_t irot,
213  const char *konly, Double_t *upar, Int_t np) = 0;
214 
215  // Helper function for resolving MANY.
216  // Specify the ONLY volume that overlaps with the
217  // specified MANY and has to be substracted.
218  // (Geant4 only)
219  virtual void Gsbool(const char* onlyVolName, const char* manyVolName) = 0;
220 
221  //
222  // functions for access to geometry
223  // ------------------------------------------------
224  //
225 
226  // Return the transformation matrix between the volume specified by
227  // the path volumePath and the top or master volume.
228  virtual Bool_t GetTransformation(const TString& volumePath,
229  TGeoHMatrix& matrix) = 0;
230 
231  // Return the name of the shape (shapeType) and its parameters par
232  // for the volume specified by the path volumePath .
233  virtual Bool_t GetShape(const TString& volumePath,
234  TString& shapeType, TArrayD& par) = 0;
235 
236  // Return the material parameters for the volume specified by
237  // the volumeName.
238  virtual Bool_t GetMaterial(const TString& volumeName,
239  TString& name, Int_t& imat,
240  Double_t& a, Double_t& z, Double_t& density,
241  Double_t& radl, Double_t& inter, TArrayD& par) = 0;
242 
243  // Return the medium parameters for the volume specified by the
244  // volumeName.
245  virtual Bool_t GetMedium(const TString& volumeName,
246  TString& name, Int_t& imed,
247  Int_t& nmat, Int_t& isvol, Int_t& ifield,
248  Double_t& fieldm, Double_t& tmaxfd, Double_t& stemax,
249  Double_t& deemax, Double_t& epsil, Double_t& stmin,
250  TArrayD& par) = 0;
251 
252  // functions for drawing
253  //virtual void DrawOneSpec(const char* name) = 0;
254  //virtual void Gsatt(const char* name, const char* att, Int_t val) = 0;
255  //virtual void Gdraw(const char*,Double_t theta = 30, Double_t phi = 30,
256  // Double_t psi = 0, Double_t u0 = 10, Double_t v0 = 10,
257  // Double_t ul = 0.01, Double_t vl = 0.01) = 0;
258 
259  // Euclid
260  // virtual void WriteEuclid(const char*, const char*, Int_t, Int_t) = 0;
261 
262  //
263  // get methods
264  // ------------------------------------------------
265  //
266 
267 
268  // Return the unique numeric identifier for volume name volName
269  virtual Int_t VolId(const char* volName) const = 0;
270 
271  // Return the volume name for a given volume identifier id
272  virtual const char* VolName(Int_t id) const = 0;
273 
274  // Return the unique numeric identifier for medium name mediumName
275  virtual Int_t MediumId(const char* mediumName) const = 0;
276 
277  // Return total number of volumes in the geometry
278  virtual Int_t NofVolumes() const = 0;
279 
280  // Return number of daughters of the volume specified by volName
281  virtual Int_t NofVolDaughters(const char* volName) const = 0;
282 
283  // Return the name of i-th daughter of the volume specified by volName
284  virtual const char* VolDaughterName(const char* volName, Int_t i) const = 0;
285 
286  // Return the copyNo of i-th daughter of the volume specified by volName
287  virtual Int_t VolDaughterCopyNo(const char* volName, Int_t i) const = 0;
288 
289  // Return material number for a given volume id
290  virtual Int_t VolId2Mate(Int_t id) const = 0;
291 
292 protected:
293  TVirtualMCGeometry(const TVirtualMCGeometry& /*rhs*/);
295 
296  ClassDef(TVirtualMCGeometry,1) //Interface to Monte Carlo geometry construction
297 };
298 
299 #endif //ROOT_TVirtualMCGeometry
300 
virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t np)=0
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)=0
double par[1]
Definition: unuranDistr.cxx:38
float Float_t
Definition: RtypesCore.h:53
virtual void Gsbool(const char *onlyVolName, const char *manyVolName)=0
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)=0
Basic string class.
Definition: TString.h:137
virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis)=0
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
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="ONLY")=0
TVirtualMCGeometry & operator=(const TVirtualMCGeometry &)
virtual void Matrix(Int_t &krot, Double_t thetaX, Double_t phiX, Double_t thetaY, Double_t phiY, Double_t thetaZ, Double_t phiZ)=0
Double_t x[n]
Definition: legend1.C:17
virtual ~TVirtualMCGeometry()
Destructor.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Int_t NofVolDaughters(const char *volName) const =0
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual Int_t VolId(const char *volName) const =0
virtual void Gsdvt(const char *name, const char *mother, Double_t step, Int_t iaxis, Int_t numed, Int_t ndvmx)=0
virtual Int_t MediumId(const char *mediumName) const =0
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)=0
virtual Int_t NofVolumes() const =0
virtual Bool_t GetShape(const TString &volumePath, TString &shapeType, TArrayD &par)=0
virtual Int_t VolDaughterCopyNo(const char *volName, Int_t i) const =0
virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Double_t c0i, Int_t numed)=0
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)=0
double Double_t
Definition: RtypesCore.h:55
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)=0
Double_t y[n]
Definition: legend1.C:17
virtual Int_t VolId2Mate(Int_t id) const =0
Array of doubles (64 bits per element).
Definition: TArrayD.h:29
virtual Bool_t GetTransformation(const TString &volumePath, TGeoHMatrix &matrix)=0
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void Gsdvt2(const char *name, const char *mother, Double_t step, Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)=0
virtual const char * VolName(Int_t id) const =0
virtual void Mixture(Int_t &kmat, const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)=0
virtual const char * VolDaughterName(const char *volName, Int_t i) const =0
virtual void Gsord(const char *name, Int_t iax)=0
TVirtualMCGeometry()
Default constructor.