New version and structure of ITS V11 geometry. Work still in progress.
[u/mrichter/AliRoot.git] / ITS / AliITSBaseGeometry.h
CommitLineData
aa9bc63b 1#ifndef ALIITSBASEGEOMETRY_H
2#define ALIITSBASEGEOMETRY_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/*
7 $Id$
8 */
9
10/////////////////////////////////////////////////////////////////////////
11// A basic geometry class for the ITS simulation geometry stucture
12/////////////////////////////////////////////////////////////////////////
13
14#include <TObject.h>
15#include <TArrayI.h>
16#include "AliModule.h"
17class TString;
18
19class AliITSBaseGeometry : public TObject {
20 public:
21 AliITSBaseGeometry(); // Default constructor
22 AliITSBaseGeometry(AliModule *its,Int_t iflag); // Standard Constructor
23 virtual ~AliITSBaseGeometry(); // Destructor
24 virtual void BuildDisplayGeometry(){}; // Calls ROOT geometry interface
25 // to AliRoot display
26 virtual void CreateG3Geometry(){}; // Calls Geant3 interface geometry routines
27 virtual void CreateG3Materials(){}; // Calls Geant3 interface for materials
28 virtual Int_t IsVersion() const{return 11;}// return version of geometry.
29
30 Int_t ITSG3VnameToIndex(const char name[3])const; // Get Index for Geant3 v name
31 char* ITSIndexToITSG3name(const Int_t i); // Get Geant3 volume name
32 Int_t AddVolName(const TString name); // Add volumen name to list
33 TString GetVolName(const Int_t i)const; // Return volume name at index
34 Int_t GetVolumeIndex(const TString &a);
35 void SetScalecm(){fScale = 1.0;}// Sets scale factor for centemeters
36 void SetScalemm(){fScale = 0.10;}// Sets scale factor for milimeters
37 void SetScalemicrons(){fScale = 1.0E-04;}// Sets scale factor for microns
38 void SetScale(Double_t s=1.0){fScale = s;}// Sets scale factor
39 Double_t GetScale()const{return fScale;}// Returns the scale factor
40 Bool_t IsScalecm()const{// Returens kTRUE if scale factor is set of [cm]
41 if(fScale==1.0) return kTRUE; return kFALSE;}
42 // Create a Box
43 void Box(const char gnam[3],const TString &dis,
44 Double_t dx,Double_t dy,Double_t dz,Int_t med);
45 // Greate A Trapizoid with the x dimension varing along z.
46 void Trapezoid1(const char gnam[3],const TString &dis,Double_t dxn,
47 Double_t dxp,Double_t dy,Double_t dz,Int_t med);
48 // Greate A Trapizoid with the x and y dimension varing along z.
49 void Trapezoid2(const char gnam[3],const TString &dis,Double_t dxn,
50 Double_t dxp,Double_t dyn,Double_t dyp,Double_t dz,
51 Int_t med);
52 // General trapazoid.
53 void Trapezoid(const char gnam[3],const TString &dis,Double_t dz,
54 Double_t thet,Double_t phi,Double_t h1,Double_t bl1,
55 Double_t tl1,Double_t alp1,Double_t h2,Double_t bl2,
56 Double_t tl2,Double_t alp2,Int_t med);
57 // Simple Tube.
58 void Tube(const char gnam[3],const TString &dis,Double_t rmin,
59 Double_t rmax,Double_t dz,Int_t med);
60 // Tube segment.
61 void TubeSegment(const char gnam[3],const TString &dis,Double_t rmin,
62 Double_t rmax,Double_t dz,Double_t phi1,Double_t phi2,
63 Int_t med);
64 // Simple Cone.
65 void Cone(const char gnam[3],const TString &dis,Double_t dz,Double_t rmin1,
66 Double_t rmax1,Double_t rmin2,Double_t rmax2,Int_t med);
67 // Segment of a Cone.
68 void ConeSegment(const char gnam[3],const TString &dis,Double_t dz,
69 Double_t rmin1,Double_t rmax1,Double_t rmin2,
70 Double_t rmax2,Double_t phi1,Double_t phi2,Int_t med);
71 // Spherical shell segment.
72 void Sphere(const char gnam[3],const TString &dis,Double_t rmin,
73 Double_t rmax,Double_t the1,Double_t the2,Double_t phi1,
74 Double_t phi2,Int_t med);
75 // Parallelepiped.
76 void Parallelepiped(const char gnam[3],const TString &dis,Double_t dx,
77 Double_t dy,Double_t dz,Double_t alph,Double_t thet,
78 Double_t phi,Int_t med);
79 // Polygon.
80 void Polygon(const char gnam[3],const TString &dis,Double_t phi1,
81 Double_t dphi,Int_t npdv,Int_t nz,Double_t *z,Double_t *rmin,
82 Double_t *rmax,Int_t med);
83 //Poly-Cone
84 void PolyCone(const char gnam[3],const TString &dis,Double_t phi1,
85 Double_t dphi,Int_t nz,Double_t *z,Double_t *rmin,
86 Double_t *rmax,Int_t med);
87 // Ellliptical cross-sectino tube
88 void TubeElliptical(const char gnam[3],const TString &dis,Double_t p1,
89 Double_t p2,Double_t dz,Int_t med);
90 // Hyperbolic tube
91 void HyperbolicTube(const char gnam[3],const TString &dis,Double_t rmin,
92 Double_t rmax,Double_t dz,Double_t thet,Int_t med);
93 // Twisted genral trapezoid.
94 void TwistedTrapezoid(const char gnam[3],const TString &dis,Double_t dz,
95 Double_t thet,Double_t phi,Double_t twist,
96 Double_t h1,Double_t bl1,Double_t tl1,
97 Double_t apl1,Double_t h2,Double_t bl2,
98 Double_t tl2,Double_t apl2,Int_t med);
99 // Cut tube.
100 void CutTube(const char gnam[3],const TString &dis,Double_t rmin,
101 Double_t rmax,Double_t dz,Double_t phi1,Double_t phi2,
102 Double_t lx,Double_t ly,Double_t lz,Double_t hx,Double_t hy,
103 Double_t hz,Int_t med);
104 // Position one volume inside another
105 void Pos(const char vol[3],Int_t cn,const char moth[3],Double_t x,
106 Double_t y,Double_t z,Int_t irot);
107 void SetMedArray(){// Sets up the array of media
108 fidmed = ((fits->GetIdtmed())->GetArray())-199;}// Define rotation matrix
109 void Matrix(Int_t irot,Double_t thet1,Double_t phi1,Double_t thet2,
110 Double_t phi2,Double_t thet3,Double_t phi3);
111 // Defube ritatuib matrix
112 void Matrix(Int_t irot,Double_t rot[3][3]);
113 // Rotation matrix about axis i (i=0=>x, i=1=>y, i=2=>z).
114 void Matrix(Int_t irot,Int_t axis,Double_t thet);
115 // Rotation matrix about x axis
116 void XMatrix(Int_t irot,Double_t thet){Matrix(irot,0,thet);}
117 // Rotation matrix about y axis
118 void YMatrix(Int_t irot,Double_t thet){Matrix(irot,1,thet);}
119 // Rotation matrix about z axis
120 void ZMatrix(Int_t irot,Double_t thet){Matrix(irot,2,thet);}
121 // Define Element material and medium
122 void Element(Int_t imat,const char *name,Int_t z,Double_t dens,Int_t istd);
123 // Define Material by constituant weights
124 void MixtureByWeight(Int_t imat,const char *name,Int_t *z,Double_t *w,
125 Double_t dens,Int_t nelments,Int_t istd);
126 // Define Material by constituant relative number
127 void MixtureByNumber(Int_t imat,const char *name,Int_t *z,Int_t *i,
128 Double_t dens,Int_t nelments,Int_t istd);
129 // Returns standard radiation lenghts of elements.
130 Float_t GetRadLength(Int_t z){return RadLength(z,(Double_t)GetA(z));}
131 // Returns natrual abundance atomic mass numbers for a given element
132 Float_t GetA(Int_t z);
133 // Returns ITS standard Theata Max transport cut values
134 Float_t GetStandardThetaMax(Int_t istd);
135 // Returns ITS standard Max step size transport cut values
136 Float_t GetStandardMaxStepSize(Int_t istd);
137 // Returns ITS standard frational energy transport cut values
138 Float_t GetStandardEfraction(Int_t istd);
139 // Returns ITS standard epsilon transport cut values
140 Float_t GetStandardEpsilon(Int_t istd);
141 // Degree Versions of TMath functions (as needed)
142 Double_t Sind(Double_t t){return TMath::Sin(TMath::Pi()*t/180.);}
143 Double_t Cosd(Double_t t){return TMath::Cos(TMath::Pi()*t/180.);}
144 Double_t Tand(Double_t t){return TMath::Tan(TMath::Pi()*t/180.);}
145 Double_t ASind(Double_t t){return 180.0*TMath::ASin(t)/TMath::Pi();}
146 Double_t ACosd(Double_t t){return 180.0*TMath::ACos(t)/TMath::Pi();}
147 Double_t ATand(Double_t t){return 180.0*TMath::ATan(t)/TMath::Pi();}
148 Double_t ATand2(Double_t y,Double_t x){return 180.0*TMath::ATan2(y,x)/
149 TMath::Pi();}
150 Double_t RadLength(Int_t iz,Double_t a); // Computes radiation length
151 // for an element
152 private:
153 static Int_t fNCreates; //! Counts the number of time this class has
154 // been created.
155 static const Double_t fAlpha = 7.297352533e-3; //! find structure constant
156 static const Double_t fRe = 2.81794028e-13;//![cm]classical electron radius
157 static const Double_t fNa = 6.02214199e+23; //! [#/mole] Avogadro's number
158 static Int_t *fidrot;
159 static Int_t fidrotsize;
160 static Int_t fidrotlast;
161 static TString *fVolName; // Array of ITS Volumen names.
162 static Int_t fVolNameSize; // Size of Array fVolName
163 static Int_t fVolNameLast; // Last filled element of fVolName
164 Double_t fScale; // Scale factor (=1=>[cm]).
165 Int_t *fidmed; // pointer to array of medium numbers
166 AliModule *fits; // local pointer to ITS module needed for AliMixture...
167
168 ClassDef(AliITSBaseGeometry,1) // Basic ITS Geometry class
169};
170
171#endif