1 #ifndef ALIITSBASEVOLPARAMS_H
2 #define ALIITSBASEVOLPARAMS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
10 /////////////////////////////////////////////////////////////////////////
11 // Geant 3 base class for volume parameters
12 /////////////////////////////////////////////////////////////////////////
16 class AliITSBaseVolParams : public TObject {
18 AliITSBaseVolParams(){fVol=-1;} // Default constructor
19 virtual ~AliITSBaseVolParams(){} // Destructor
20 virtual void SetVid(Int_t i){fVol = i;}// Sets the volume id from the next
22 virtual Int_t GetVid(){return fVol;} // Returns volume id
23 virtual void SetName(const char *c){fName=c;}//Sets name of this volume
24 virtual TString* GetName(){return &fName;} // Returns volume name
25 virtual void Print(ostream *os){} // Prints output content of this class
26 virtual void Read(istream *is){} // Reads output created by Print above.
28 Int_t fVol; // Volume index number
29 TString fName; // Volume name
31 ClassDef(AliITSBaseVolParams,1) // Basic ITS volume parameters class
37 #ifndef ALIITSTUBEDATA_H
38 #define ALIITSTUBEDATA_H
39 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
40 * See cxx source for full Copyright notice */
46 /////////////////////////////////////////////////////////////////////////
47 // Geant 3 Poly-Cone data structure.
48 /////////////////////////////////////////////////////////////////////////
49 #include <math.h> // for the definision of NAN.
52 class AliITSTubeData : public AliITSBaseVolParams {
54 AliITSTubeData() : AliITSBaseVolParams() // Default constructor
55 {fDz=0;fRmin=0;fRmax=0;}
56 virtual ~AliITSTubeData(){} // Standard destructor
58 Double_t DzAt() // Return fDz coordiante
60 Double_t Rmin() {return fRmin;} // Returm arrau of rmin values
61 Double_t Rmax() {return fRmax;} // Returm arrau of rmax values
62 Double_t& Z()// Returns address of fDz
64 Double_t& Rn()// Returns address of fRmin
66 Double_t& Rx()// Returns address of fRmax
68 void Print(ostream *os); // Prints output content of this class
69 void Read(istream *is); // Reads output created by Print above.
71 Double_t fRmin; // Inner Radius
72 Double_t fRmax; // Outer Radius
73 Double_t fDz; // Z half length.
75 ClassDef(AliITSTubeData,1) // Poly Cone data class
77 // Input and output function for standard C++ input/output.
78 ostream &operator<<(ostream &os,AliITSTubeData &source);
79 istream &operator>>(istream &os,AliITSTubeData &source);
84 #ifndef ALIITSPCONEDATA_H
85 #define ALIITSPCONEDATA_H
86 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
87 * See cxx source for full Copyright notice */
93 /////////////////////////////////////////////////////////////////////////
94 // Geant 3 Poly-Cone data structure.
95 /////////////////////////////////////////////////////////////////////////
96 #include <math.h> // for the definision of NAN.
99 class AliITSPConeData : public AliITSBaseVolParams {
101 AliITSPConeData() : AliITSBaseVolParams() // Default constructor
102 {fNz=0;fPhi0=0.0;fDphi=0.0;fZ=0;fRmin=0;fRmax=0;}
103 AliITSPConeData(Int_t n) : AliITSBaseVolParams() // Standard constructor
104 {fNz=n;fPhi0=0.0;fDphi=360.0;fZ=new Double_t[n];
105 fRmin=new Double_t[n];fRmax=new Double_t[n];}
106 AliITSPConeData(AliITSPConeData &source) // Copy constructor
108 virtual ~AliITSPConeData() // Standard destructor
109 {delete[] fZ;delete[] fRmin;delete[] fRmax;fNz=0;}
110 AliITSPConeData& operator=(AliITSPConeData &source) // Equals operator
111 {this->SetVid(source.GetVid());
112 this->SetName((source.GetName())->Data());
113 this->fNz = source.fNz;this->fPhi0=source.fPhi0;
114 this->fDphi=source.fDphi;
115 if(this->fZ!=0) delete[] this->fZ;
116 if(this->fRmin!=0) delete[] this->fRmin;
117 if(this->fRmax!=0) delete[] this->fRmax;
118 this->fZ=0;this->fRmin=0;this->fRmax=0;if(this->fNz<=0) return *this;
119 this->fZ=new Double_t[this->fNz];this->fRmin=new Double_t[this->fNz];
120 this->fRmax=new Double_t[this->fNz];for(Int_t i=0;i<this->fNz;i++){
121 this->fZ[i]=source.fZ[i];this->fRmin[i]=source.fRmin[i];
122 fRmax[i]=source.fRmax[i];}return *this;}
123 void Size(Int_t n)// Sets the number of Z,Rmin,Rmax parameters
124 {if(fZ!=0) delete fZ;if(fRmin!=0) delete fRmin;
125 if(fRmax!=0) delete fRmax; fNz=n;fPhi0=0.0;fDphi=360.0;
126 fZ=new Double_t[n];fRmin=new Double_t[n];fRmax=new Double_t[n];}
127 void Size(Int_t n,const char *c){//Sets the number of Z,Rmin, and Rmax
128 // parameters as well as the volume name.
131 Int_t Nz() {return fNz;} // Returns fNz
132 Double_t Phi0(){return fPhi0;}// Return starting phi value
133 Double_t DPhi(){return fDphi;}// Return delta phi value
134 Double_t ZAt(Int_t i) // Return Z coordiante
135 {if(i<0||i>=fNz) return NAN;else return fZ[i];}
136 Double_t *Z(){return fZ;} // Returns array of z values
137 Double_t *Rmin() {return fRmin;} // Returm arrau of rmin values
138 Double_t *Rmax() {return fRmax;} // Returm arrau of rmax values
139 Double_t Rmin(Int_t i) // Return Inner radius value
140 {if(i<0||i>=fNz) return NAN;else return fRmin[i];}
141 Double_t Rmax(Int_t i) // Return Outer radius value
142 {if(i<0||i>=fNz) return NAN;else return fRmax[i];}
144 Double_t& P0() // Returns the address of fPhi0
146 Double_t& dP() // Returns the address of fDphi
148 Double_t& Z(Int_t i)// Returns address of fZ
149 {/*if(i<0||i>=fNz) return 0;*/return fZ[i];}
150 Double_t& Rn(Int_t i)// Returns address of fRmin
151 {/*if(i<0||i>=fNz) return 0;*/return fRmin[i];}
152 Double_t& Rx(Int_t i)// Returns address of fRmax
153 {/*if(i<0||i>=fNz) return 0;*/return fRmax[i];}
154 void Print(ostream *os); // Prints output content of this class
155 void Read(istream *is); // Reads output created by Print above.
157 Int_t fNz; // Number of z sections
158 Double_t fPhi0,fDphi; // Starting phi angle and delta phi [degrees]
159 Double_t *fZ; //[n] Z coordiantes
160 Double_t *fRmin; //[n] Inner radius
161 Double_t *fRmax; //[n] Outer radius
163 ClassDef(AliITSPConeData,1) // Poly Cone data class
165 // Input and output function for standard C++ input/output.
166 ostream &operator<<(ostream &os,AliITSPConeData &source);
167 istream &operator>>(istream &os,AliITSPConeData &source);
173 #ifndef ALIITSPGONDATA_H
174 #define ALIITSPGONDATA_H
175 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
176 * See cxx source for full Copyright notice */
182 /////////////////////////////////////////////////////////////////////////
183 // Geant 3 Poly-Gon data structure.
184 /////////////////////////////////////////////////////////////////////////
185 #include <math.h> // for the definision of NAN.
188 class AliITSPGonData : public AliITSBaseVolParams {
190 AliITSPGonData() : AliITSBaseVolParams() // Default constructor
191 {fNz=0;fNphi=0;fPhi0=0.0;fDphi=0.0;fZ=0;fRmin=0;fRmax=0;}
192 AliITSPGonData(Int_t n) : AliITSBaseVolParams() // Standard constructor
193 {fNz=n;fNphi=0;fPhi0=0.0;fDphi=360.0;fZ=new Double_t[n];
194 fRmin=new Double_t[n];fRmax=new Double_t[n];}
195 AliITSPGonData(AliITSPGonData &source) // Copy constructor
197 virtual ~AliITSPGonData() // Standard destructor
198 {delete[] fZ;delete[] fRmin;delete[] fRmax;fNz=0;}
199 AliITSPGonData& operator=(AliITSPGonData &source) // Equals operator
200 {this->SetVid(source.GetVid());
201 this->SetName((source.GetName())->Data());
202 this->fNz = source.fNz;this->fNphi=source.fNphi;
203 this->fPhi0=source.fPhi0;this->fDphi=source.fDphi;
204 if(this->fZ!=0) delete[] this->fZ;
205 if(this->fRmin!=0) delete[] this->fRmin;
206 if(this->fRmax!=0) delete[] this->fRmax;
207 this->fZ=0;this->fRmin=0;this->fRmax=0;if(this->fNz<=0) return *this;
208 this->fZ=new Double_t[this->fNz];this->fRmin=new Double_t[this->fNz];
209 this->fRmax=new Double_t[this->fNz];for(Int_t i=0;i<this->fNz;i++){
210 this->fZ[i]=source.fZ[i];this->fRmin[i]=source.fRmin[i];
211 fRmax[i]=source.fRmax[i];}return *this;}
212 void Size(Int_t n)// Sets the number of Z,Rmin,Rmax parameters
213 {if(fZ!=0) delete fZ;if(fRmin!=0) delete fRmin;
214 if(fRmax!=0) delete fRmax; fNz=n;fPhi0=0.0;fDphi=360.0;
215 fZ=new Double_t[n];fRmin=new Double_t[n];fRmax=new Double_t[n];}
216 void Size(Int_t n,const char *c){//Sets the number of Z,Rmin, and Rmax
217 // parameters as well as the volume name.
220 Int_t NPhi() {return fNz;} // Returns fNphi
221 Int_t Nz() {return fNz;} // Returns fNz
222 Double_t Phi0(){return fPhi0;}// Return starting phi value
223 Double_t DPhi(){return fDphi;}// Return delta phi value
224 Double_t *Z(){return fZ;} // Returns array of z values
225 Double_t *Rmin() {return fRmin;} // Returm arrau of rmin values
226 Double_t *Rmax() {return fRmax;} // Returm arrau of rmax values
227 Double_t ZAt(Int_t i) // Return Z coordiante
228 {if(i<0||i>=fNz) return NAN;else return fZ[i];}
229 Double_t Rmin(Int_t i) // Return Inner radius value
230 {if(i<0||i>=fNz) return NAN;else return fRmin[i];}
231 Double_t Rmax(Int_t i) // Return Outer radius value
232 {if(i<0||i>=fNz) return NAN;else return fRmax[i];}
234 void Nphi(Int_t i) {fNphi = i;} // Sets fNphi
235 Double_t& P0() // Returns the address of fPhi0
237 Double_t& dP() // Returns the address of fDphi
239 Double_t& Z(Int_t i)// Returns address of fZ
240 {/*if(i<0||i>=fNz) return 0;*/return fZ[i];}
241 Double_t& Rn(Int_t i)// Returns address of fRmin
242 {/*if(i<0||i>=fNz) return 0;*/return fRmin[i];}
243 Double_t& Rx(Int_t i)// Returns address of fRmax
244 {/*if(i<0||i>=fNz) return 0;*/return fRmax[i];}
245 void Print(ostream *os); // Prints output content of this class
246 void Read(istream *is); // Reads output created by Print above.
248 Int_t fNphi; // Number of sections in phi.
249 Int_t fNz; // Number of Z sections
250 Double_t fPhi0,fDphi; // Starting phi angle and delta phi [degrees]
251 Double_t *fZ; //[n] Z coordiantes
252 Double_t *fRmin; //[n] Inner radius
253 Double_t *fRmax; //[n] Outer radius
255 ClassDef(AliITSPGonData,1) // Poly Gon Data Class
257 // Input and output function for standard C++ input/output.
258 ostream &operator<<(ostream &os,AliITSPGonData &source);
259 istream &operator>>(istream &os,AliITSPGonData &source);
262 #ifndef ALIITSBASEGEOMETRY_H
263 #define ALIITSBASEGEOMETRY_H
264 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
265 * See cxx source for full Copyright notice */
271 /////////////////////////////////////////////////////////////////////////
272 // A basic geometry class for the ITS simulation geometry stucture
273 /////////////////////////////////////////////////////////////////////////
275 #include "AliModule.h"
279 class AliITSBaseGeometry : public TObject {
281 AliITSBaseGeometry(); // Default constructor
282 AliITSBaseGeometry(AliModule *its,Int_t iflag); // Standard Constructor
283 virtual ~AliITSBaseGeometry(); // Destructor
284 virtual void BuildDisplayGeometry(){}; // Calls ROOT geometry interface
285 // to AliRoot display
286 // Calls Geant3 interface geometry routines
287 virtual void CreateG3Geometry(){};
288 virtual void CreateG3Materials(){};//Calls Geant3 interface for materials
289 virtual Int_t IsVersion() const{return 11;}// return version of geometry.
290 // Get Index for Geant3 v name
291 Int_t ITSG3VnameToIndex(const char name[3])const;
292 Int_t ITSIndexToITSG3name(const Int_t i); // Get Geant3 volume name
293 Int_t AddVolName(const TString name); // Add volumen name to list
294 TString GetVolName(const Int_t i)const; // Return volume name at index
295 Int_t GetVolumeIndex(const TString &a);
296 void SetScalecm(){fScale = 1.0;}// Sets scale factor for centemeters
297 void SetScalemm(){fScale = 0.10;}// Sets scale factor for milimeters
298 void SetScalemicrons(){fScale = 1.0E-04;}// Sets scale factor for microns
299 void SetScale(Double_t s=1.0){fScale = s;}// Sets scale factor
300 Double_t GetScale()const{return fScale;}// Returns the scale factor
301 Bool_t IsScalecm()const{// Returens kTRUE if scale factor is set of [cm]
302 if(fScale==1.0) return kTRUE; return kFALSE;}
304 virtual void Box(const char *gnam,const TString &dis,
305 Double_t dx,Double_t dy,Double_t dz,Int_t med);
306 // Greate A Trapizoid with the x dimension varing along z.
307 virtual void Trapezoid1(const char *gnam,const TString &dis,Double_t dxn,
308 Double_t dxp,Double_t dy,Double_t dz,Int_t med);
309 // Greate A Trapizoid with the x and y dimension varing along z.
310 virtual void Trapezoid2(const char *gnam,const TString &dis,Double_t dxn,
311 Double_t dxp,Double_t dyn,Double_t dyp,Double_t dz,
313 // General trapazoid.
314 virtual void Trapezoid(const char *gnam,const TString &dis,Double_t dz,
315 Double_t thet,Double_t phi,Double_t h1,Double_t bl1,
316 Double_t tl1,Double_t alp1,Double_t h2,Double_t bl2,
317 Double_t tl2,Double_t alp2,Int_t med);
319 virtual void Tube(const char *gnam,const TString &dis,Double_t rmin,
320 Double_t rmax,Double_t dz,Int_t med);
321 virtual void Tube(AliITSTubeData &d,Int_t med);
323 virtual void TubeSegment(const char *gnam,const TString &dis,Double_t rmin,
324 Double_t rmax,Double_t dz,Double_t phi1,Double_t phi2,
327 virtual void Cone(const char *gnam,const TString &dis,Double_t dz,
328 Double_t rmin1,Double_t rmax1,Double_t rmin2,Double_t rmax2,
330 // Segment of a Cone.
331 virtual void ConeSegment(const char *gnam,const TString &dis,Double_t dz,
332 Double_t rmin1,Double_t rmax1,Double_t rmin2,
333 Double_t rmax2,Double_t phi1,Double_t phi2,Int_t med);
334 // Spherical shell segment.
335 virtual void Sphere(const char *gnam,const TString &dis,Double_t rmin,
336 Double_t rmax,Double_t the1,Double_t the2,Double_t phi1,
337 Double_t phi2,Int_t med);
339 virtual void Parallelepiped(const char *gnam,const TString &dis,
340 Double_t dx,Double_t dy,Double_t dz,
341 Double_t alph,Double_t thet,
342 Double_t phi,Int_t med);
344 virtual void PolyGon(const char *gnam,const TString &dis,Double_t phi1,
345 Double_t dphi,Int_t npdv,Int_t nz,Double_t *z,Double_t *rmin,
346 Double_t *rmax,Int_t med);
347 virtual void PolyGon(const char *gnam,const TString &dis,AliITSPGonData &d,
348 Int_t med){PolyGon(gnam,dis,d.Phi0(),d.DPhi(),d.NPhi(),
349 d.Nz(),d.Z(),d.Rmin(),d.Rmax(),med);}
350 virtual void PolyGon(AliITSPGonData &d,Int_t med);
352 virtual void PolyCone(const char *gnam,const TString &dis,Double_t phi1,
353 Double_t dphi,Int_t nz,Double_t *z,Double_t *rmin,
354 Double_t *rmax,Int_t med);
355 virtual void PolyCone(const char *gnam,const TString &dis,
357 Int_t med){PolyCone(gnam,dis,d.Phi0(),
358 d.DPhi(),d.Nz(),d.Z(),
359 d.Rmin(),d.Rmax(),med);}
360 virtual void PolyCone(AliITSPConeData &d,Int_t med);
361 // Ellliptical cross-sectino tube
362 virtual void TubeElliptical(const char *gnam,const TString &dis,
363 Double_t p1,Double_t p2,Double_t dz,Int_t med);
365 virtual void HyperbolicTube(const char *gnam,const TString &dis,
366 Double_t rmin,Double_t rmax,Double_t dz,
367 Double_t thet,Int_t med);
368 // Twisted genral trapezoid.
369 virtual void TwistedTrapezoid(const char *gnam,const TString &dis,
371 Double_t thet,Double_t phi,Double_t twist,
372 Double_t h1,Double_t bl1,Double_t tl1,
373 Double_t apl1,Double_t h2,Double_t bl2,
374 Double_t tl2,Double_t apl2,Int_t med);
376 virtual void CutTube(const char *gnam,const TString &dis,Double_t rmin,
377 Double_t rmax,Double_t dz,Double_t phi1,Double_t phi2,
378 Double_t lx,Double_t ly,Double_t lz,Double_t hx,Double_t hy,
379 Double_t hz,Int_t med);
380 // Position one volume inside another
381 virtual void Pos(const char *vol,Int_t cn,const char *moth,Double_t x,
382 Double_t y,Double_t z,Int_t irot);
383 // Position one volume inside another
384 virtual void Pos(AliITSBaseVolParams &v,Int_t cn,
385 AliITSBaseVolParams &m,TVector3 &t,Int_t irot);
386 Int_t GetMed(Int_t med){return (fits->GetIdtmed())->At(med);}
387 // Define rotation matrix
388 void Matrix(Int_t irot,Double_t thet1,Double_t phi1,Double_t thet2,
389 Double_t phi2,Double_t thet3,Double_t phi3);
390 // Defube ritatuib matrix
391 void Matrix(Int_t irot,Double_t rot[3][3]);
392 // Rotation matrix about axis i (i=0=>x, i=1=>y, i=2=>z).
393 void Matrix(Int_t irot,Int_t axis,Double_t thet);
394 // Rotation matrix about x axis
395 void XMatrix(Int_t irot,Double_t thet){Matrix(irot,0,thet);}
396 // Rotation matrix about y axis
397 void YMatrix(Int_t irot,Double_t thet){Matrix(irot,1,thet);}
398 // Rotation matrix about z axis
399 void ZMatrix(Int_t irot,Double_t thet){Matrix(irot,2,thet);}
400 // Define Element material and medium
401 void Element(Int_t imat,const char *name,Int_t z,Double_t den,Int_t istd);
402 // Define Material by constituant weights
403 void MixtureByWeight(Int_t imat,const char *name,Int_t *z,Double_t *w,
404 Double_t dens,Int_t nelments,Int_t istd);
405 // Define Material by constituant relative number
406 void MixtureByNumber(Int_t imat,const char *name,Int_t *z,Int_t *i,
407 Double_t dens,Int_t nelments,Int_t istd);
408 // Returns standard radiation lenghts of elements.
409 Float_t GetRadLength(Int_t z){return RadLength(z,(Double_t)GetA(z));}
410 // Returns natrual abundance atomic mass numbers for a given element
411 Float_t GetA(Int_t z);
412 // Returns ITS standard Theata Max transport cut values
413 Float_t GetStandardThetaMax(Int_t istd);
414 // Returns ITS standard Max step size transport cut values
415 Float_t GetStandardMaxStepSize(Int_t istd);
416 // Returns ITS standard frational energy transport cut values
417 Float_t GetStandardEfraction(Int_t istd);
418 // Returns ITS standard epsilon transport cut values
419 Float_t GetStandardEpsilon(Int_t istd);
420 // Degree Versions of TMath functions (as needed)
421 Double_t Sind(Double_t t){return TMath::Sin(TMath::Pi()*t/180.);}
422 Double_t Cosd(Double_t t){return TMath::Cos(TMath::Pi()*t/180.);}
423 Double_t Tand(Double_t t){return TMath::Tan(TMath::Pi()*t/180.);}
424 Double_t ASind(Double_t t){return 180.0*TMath::ASin(t)/TMath::Pi();}
425 Double_t ACosd(Double_t t){return 180.0*TMath::ACos(t)/TMath::Pi();}
426 Double_t ATand(Double_t t){return 180.0*TMath::ATan(t)/TMath::Pi();}
427 Double_t ATand2(Double_t y,Double_t x){return 180.0*TMath::ATan2(y,x)/
429 Double_t RadLength(Int_t iz,Double_t a); // Computes radiation length
432 void G3name(const char *gname,char *name)//Add's I to name and ending null
433 {for(Int_t i=0;i<3;i++) name[i+1] = gname[i];
434 name[0]='I';name[4]='\0';}
437 static Int_t fNCreates; //! Counts the number of time this class has
439 static const Double_t fAlpha = 7.297352533e-3; //! find structure constant
440 static const Double_t fRe = 2.81794028e-13; //![cm]classical elect. radius
441 static const Double_t fNa = 6.02214199e+23; //! [#/mole] Avogadro's number
442 static Int_t *fidrot;
443 static Int_t fidrotsize;
444 static Int_t fidrotlast;
445 static TString *fVolName; // Array of ITS Volumen names.
446 static Int_t fVolNameSize; // Size of Array fVolName
447 static Int_t fVolNameLast; // Last filled element of fVolName
448 Double_t fScale; // Scale factor (=1=>[cm]).
449 AliModule *fits; // local pointer to ITS module needed for AliMixture...
451 ClassDef(AliITSBaseGeometry,1) // Basic ITS Geometry class