]>
Commit | Line | Data |
---|---|---|
172b0d90 | 1 | #ifndef ALIITSV11GEOMETRY_H |
2 | #define ALIITSV11GEOMETRY_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 | */ | |
166d14ba | 9 | |
10 | /* | |
11 | Base class for defining large parts of the ITS geometry, v11. | |
12 | */ | |
172b0d90 | 13 | #include <TObject.h> |
14 | class TGeoArb8; | |
15 | class TGeoPcon; | |
16 | class TGeoTube; | |
17 | class TGeoTubeSeg; | |
18 | class TGeoConeSeg; | |
19 | class TGeoBBox; | |
c789ee28 | 20 | class TGeoMixture; |
21 | class TArrayD; | |
22 | class TArrayI; | |
23 | class TObjArray; | |
172b0d90 | 24 | |
25 | class AliITSv11Geometry : public TObject { | |
26 | public: | |
c789ee28 | 27 | AliITSv11Geometry(){fDebug=0;}; |
db486a6e | 28 | AliITSv11Geometry(Int_t debug){fDebug=debug;}; |
172b0d90 | 29 | virtual ~AliITSv11Geometry(){}; |
30 | // | |
c789ee28 | 31 | virtual TGeoMixture *CreateMixtureByNumber(const char* name,Int_t nel, |
32 | const TArrayI *w, | |
33 | const TObjArray *mix, | |
34 | Double_t den); | |
35 | virtual TGeoMixture *CreateMixtureByVolume(const char* name,Int_t nel, | |
36 | const TArrayD *v, | |
37 | const TObjArray *mix, | |
38 | Double_t den); | |
39 | virtual TGeoMixture *CreateMixtureByWeight(const char* name,Int_t nel, | |
40 | const TArrayD *w, | |
41 | const TObjArray *mix, | |
42 | Double_t den); | |
43 | // | |
166d14ba | 44 | // Sets the debug flag for debugging output |
db486a6e | 45 | void SetDebug(Int_t level=5){fDebug=level;} |
166d14ba | 46 | // Clears the debug flag so no debugging output will be generated |
db486a6e | 47 | void SetNoDebug(){fDebug=0;} |
166d14ba | 48 | // Returns the debug flag value |
db486a6e | 49 | Bool_t GetDebug(Int_t level=1)const {return fDebug>=level;} |
166d14ba | 50 | // |
51 | // Static functions | |
52 | // | |
53 | // Define Trig functions for use with degrees (standerd TGeo angles). | |
54 | // Sine function | |
cee918ed | 55 | Double_t SinD(Double_t deg)const{return TMath::Sin(deg*TMath::DegToRad());} |
166d14ba | 56 | // Cosine function |
cee918ed | 57 | Double_t CosD(Double_t deg)const{return TMath::Cos(deg*TMath::DegToRad());} |
166d14ba | 58 | // Tangent function |
cee918ed | 59 | Double_t TanD(Double_t deg)const{return TMath::Tan(deg*TMath::DegToRad());} |
166d14ba | 60 | // Given the line, defined by the two points (x0,y0) and (x1,y1) and the |
61 | // point x, return the value of y. | |
cee918ed | 62 | Double_t Yfrom2Points(Double_t x0,Double_t y0, |
63 | Double_t x1,Double_t y1,Double_t x)const; | |
166d14ba | 64 | // Given the line, defined by the two points (x0,y0) and (x1,y1) and the |
65 | // point y, return the value of x. | |
cee918ed | 66 | Double_t Xfrom2Points(Double_t x0,Double_t y0, |
67 | Double_t x1,Double_t y1,Double_t y)const; | |
166d14ba | 68 | // Given 2 points from a TGeoPcon(z and Rmax) finds Rmax at given z |
cee918ed | 69 | Double_t RmaxFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2, |
70 | Double_t z)const; | |
166d14ba | 71 | // Given 2 points from a TGeoPcon(z and Rmin) finds Rmin at given z |
cee918ed | 72 | Double_t RminFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2, |
73 | Double_t z)const; | |
166d14ba | 74 | // Give two points in the array ar and az, returns the value r |
75 | // corresponding z along the line defined by those two points | |
cee918ed | 76 | Double_t RFrom2Points(const Double_t *ar,const Double_t *az, |
77 | Int_t i1,Int_t i2,Double_t z)const; | |
166d14ba | 78 | // Given 2 points from a TGeoPcon(z and Rmax) finds z at given Rmin |
cee918ed | 79 | Double_t Zfrom2MinPoints(const TGeoPcon *p,Int_t i1,Int_t i2, |
80 | Double_t r)const; | |
166d14ba | 81 | // Given 2 points from a TGeoPcon(z and Rmax) finds z at given Rmax |
cee918ed | 82 | Double_t Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1,Int_t i2, |
83 | Double_t r)const; | |
166d14ba | 84 | // Give two points in the array ar and az, returns the value z |
85 | // corresponding r along the line defined by those two points | |
cee918ed | 86 | Double_t Zfrom2Points(const Double_t *az,const Double_t *ar, |
87 | Int_t i1,Int_t i2,Double_t r)const; | |
166d14ba | 88 | // Given 1 point from a TGeoPcon(z and Rmax) the angle tc returns r for |
89 | // a given z, an offset (distnace perpendicular to line at angle tc) of | |
90 | // th may be applied. | |
cee918ed | 91 | Double_t RmaxFromZpCone(const TGeoPcon *p,int ip,Double_t tc, |
92 | Double_t z,Double_t th=0.0)const; | |
93 | Double_t RFromZpCone(const Double_t *ar,const Double_t *az,int ip, | |
94 | Double_t tc,Double_t z,Double_t th=0.0)const; | |
166d14ba | 95 | // Given 1 point from a TGeoPcon(z and Rmin) the angle tc returns r for |
96 | // a given z, an offset (distnace perpendicular to line at angle tc) of | |
97 | // th may be applied. | |
cee918ed | 98 | Double_t RminFromZpCone(const TGeoPcon *p,Int_t ip,Double_t tc, |
99 | Double_t z,Double_t th=0.0)const; | |
166d14ba | 100 | // Given 1 point from a TGeoPcon(z and Rmax) the angle tc returns z for |
101 | // a given Rmax, an offset (distnace perpendicular to line at angle tc) of | |
102 | // th may be applied. | |
cee918ed | 103 | Double_t ZFromRmaxpCone(const TGeoPcon *p,int ip,Double_t tc, |
104 | Double_t r,Double_t th=0.0)const; | |
166d14ba | 105 | // General Outer cone Surface equation for z. |
cee918ed | 106 | Double_t ZFromRmaxpCone(const Double_t *ar,const Double_t *az, |
166d14ba | 107 | Int_t ip,Double_t tc,Double_t r, |
cee918ed | 108 | Double_t th=0.0)const; |
166d14ba | 109 | // Given 1 point from a TGeoPcon(z and Rmin) the angle tc returns z for |
110 | // a given Rmin, an offset (distnace perpendicular to line at angle tc) of | |
111 | // th may be applied. | |
cee918ed | 112 | Double_t ZFromRminpCone(const TGeoPcon *p,int ip,Double_t tc, |
113 | Double_t r,Double_t th=0.0)const; | |
166d14ba | 114 | // Given two lines defined by the points i1, i2,i3 in the TGeoPcon |
115 | // class p that intersect at point p->GetZ(i2) return the point z,r | |
116 | // that is Cthick away in the TGeoPcon class q. If points i1=i2 | |
117 | // and max == kTRUE, then p->GetRmin(i1) and p->GetRmax(i2) are used. | |
118 | // if points i2=i3 and max=kTRUE then points p->GetRmax(i2) and | |
119 | // p->GetRmin(i3) are used. If i2=i3 and max=kFALSE, then p->GetRmin(i2) | |
120 | // and p->GetRmax(i3) are used. | |
cee918ed | 121 | void InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2,Int_t i3, |
122 | Double_t Cthick,TGeoPcon *q,Int_t j1,Bool_t max)const; | |
166d14ba | 123 | // Given two intersecting lines defined by the points (x0,y0), (x1,y1) and |
124 | // (x1,y1), (x1,y2) {intersecting at (x1,y1)} the point (x,y) a distance | |
125 | // c away is returned such that two lines a distance c away from the | |
126 | // lines defined above intersect at (x,y). | |
cee918ed | 127 | void InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t y1, |
172b0d90 | 128 | Double_t x2,Double_t y2,Double_t c, |
cee918ed | 129 | Double_t &x,Double_t &y)const; |
166d14ba | 130 | // Given a initial point z0,r0, the initial angle theta0, and the radius |
131 | // of curvature, returns the point z1, r1 at the angle theta1. Theta | |
132 | // measured from the r axis in the clock wise direction [degrees]. | |
cee918ed | 133 | void RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0, |
134 | Double_t r0,Double_t theta1,Double_t &z1, | |
135 | Double_t &r1)const; | |
166d14ba | 136 | // |
137 | // Output functions for debugging | |
138 | // | |
139 | // Prints out the contents of the TGeoArb8 | |
140 | void PrintArb8(const TGeoArb8 *a) const; | |
141 | // Prints out the contents of the TGeoPcon | |
142 | void PrintPcon(const TGeoPcon *a) const; | |
143 | // Prints out the contents of the TGeoTube | |
144 | void PrintTube(const TGeoTube *a) const; | |
145 | // Prints out the contents of the TGeoTubeSeg | |
146 | void PrintTubeSeg(const TGeoTubeSeg *a) const; | |
147 | // Prints out the contents of the TGeoConeSeg | |
148 | void PrintConeSeg(const TGeoConeSeg *a) const; | |
149 | // Prints out the contents of the TGeoBBox | |
150 | void PrintBBox(const TGeoBBox *a) const; | |
151 | // Draws a 2D crossection of the TGeoPcon r,z section | |
152 | void DrawCrossSection(const TGeoPcon *p,Int_t fillc=7,Int_t fills=4050, | |
153 | Int_t linec=3,Int_t lines=1,Int_t linew=4, | |
154 | Int_t markc=2,Int_t marks=4, | |
155 | Float_t marksize=1.0) const; | |
db486a6e | 156 | // Compute the angles where a line intersects a circle. |
157 | Bool_t AngleOfIntersectionWithLine(Double_t x0,Double_t y0, | |
158 | Double_t x1,Double_t y1, | |
159 | Double_t xc,Double_t yc, | |
160 | Double_t rc,Double_t &t0, | |
161 | Double_t &t1)const; | |
162 | void AnglesForRoundedCorners(Double_t x0,Double_t y0,Double_t r0, | |
163 | Double_t x1,Double_t y1,Double_t r1, | |
164 | Double_t &t0,Double_t &t1)const; | |
165 | // Function to create figure needed for this class' documentation | |
166 | void MakeFigure1(Double_t x0=0.0,Double_t y0=0.0,Double_t r0=2.0, | |
167 | Double_t x1=-4.0,Double_t y1=-2.0,Double_t r1=1.0); | |
cee918ed | 168 | protected: |
169 | ||
170 | // Units, Convert from k?? to cm,degree,GeV,seconds, | |
db486a6e | 171 | static const Double_t fgkmicron; // Convert micron to TGeom's cm. |
a98296c1 | 172 | static const Double_t fgkmm; // Convert mm to TGeom's cm. |
db486a6e | 173 | static const Double_t fgkcm; // Convert cm to TGeom's cm. |
a98296c1 | 174 | static const Double_t fgkDegree; //Convert degrees to TGeom's degrees |
175 | static const Double_t fgkRadian; //To Radians | |
cee918ed | 176 | |
172b0d90 | 177 | private: |
db486a6e | 178 | Double_t AngleForRoundedCorners0(Double_t dx,Double_t dy, |
179 | Double_t sdr)const; | |
180 | Double_t AngleForRoundedCorners1(Double_t dx,Double_t dy, | |
181 | Double_t sdr)const; | |
182 | Int_t fDebug; //! Debug flag/level | |
172b0d90 | 183 | ClassDef(AliITSv11Geometry,1) // Base class for ITS v11 geometry |
184 | }; | |
185 | ||
172b0d90 | 186 | #endif |