]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv11Geometry.h
Masking of not calibrated chambers
[u/mrichter/AliRoot.git] / ITS / AliITSv11Geometry.h
CommitLineData
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>
543b7370 14#include <AliLog.h>
172b0d90 15class TGeoArb8;
16class TGeoPcon;
17class TGeoTube;
18class TGeoTubeSeg;
19class TGeoConeSeg;
20class TGeoBBox;
21
22class AliITSv11Geometry : public TObject {
23 public:
543b7370 24 AliITSv11Geometry():fDebug(AliDebugLevel()) {};
25 AliITSv11Geometry(Int_t debug):fDebug(debug) {};
172b0d90 26 virtual ~AliITSv11Geometry(){};
27 //
166d14ba 28 // Sets the debug flag for debugging output
db486a6e 29 void SetDebug(Int_t level=5){fDebug=level;}
166d14ba 30 // Clears the debug flag so no debugging output will be generated
db486a6e 31 void SetNoDebug(){fDebug=0;}
166d14ba 32 // Returns the debug flag value
db486a6e 33 Bool_t GetDebug(Int_t level=1)const {return fDebug>=level;}
166d14ba 34 //
35 // Static functions
36 //
37 // Define Trig functions for use with degrees (standerd TGeo angles).
38 // Sine function
cee918ed 39 Double_t SinD(Double_t deg)const{return TMath::Sin(deg*TMath::DegToRad());}
166d14ba 40 // Cosine function
cee918ed 41 Double_t CosD(Double_t deg)const{return TMath::Cos(deg*TMath::DegToRad());}
166d14ba 42 // Tangent function
cee918ed 43 Double_t TanD(Double_t deg)const{return TMath::Tan(deg*TMath::DegToRad());}
798b4e0c 44 // Determine the intersection of two lines
45 void IntersectLines(Double_t m, Double_t x0, Double_t y0,
46 Double_t n, Double_t x1, Double_t y1,
47 Double_t &xi, Double_t &yi)const;
48 // Determine the intersection of a line and a circle
49 static Bool_t IntersectCircle(Double_t m, Double_t x0, Double_t y0,
50 Double_t rr, Double_t xc, Double_t yc,
51 Double_t &xi1, Double_t &yi1,
52 Double_t &xi2, Double_t &yi2);
166d14ba 53 // Given the line, defined by the two points (x0,y0) and (x1,y1) and the
54 // point x, return the value of y.
cee918ed 55 Double_t Yfrom2Points(Double_t x0,Double_t y0,
56 Double_t x1,Double_t y1,Double_t x)const;
166d14ba 57 // Given the line, defined by the two points (x0,y0) and (x1,y1) and the
58 // point y, return the value of x.
cee918ed 59 Double_t Xfrom2Points(Double_t x0,Double_t y0,
60 Double_t x1,Double_t y1,Double_t y)const;
166d14ba 61 // Given 2 points from a TGeoPcon(z and Rmax) finds Rmax at given z
cee918ed 62 Double_t RmaxFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2,
63 Double_t z)const;
166d14ba 64 // Given 2 points from a TGeoPcon(z and Rmin) finds Rmin at given z
cee918ed 65 Double_t RminFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2,
66 Double_t z)const;
166d14ba 67 // Give two points in the array ar and az, returns the value r
68 // corresponding z along the line defined by those two points
cee918ed 69 Double_t RFrom2Points(const Double_t *ar,const Double_t *az,
70 Int_t i1,Int_t i2,Double_t z)const;
166d14ba 71 // Given 2 points from a TGeoPcon(z and Rmax) finds z at given Rmin
cee918ed 72 Double_t Zfrom2MinPoints(const TGeoPcon *p,Int_t i1,Int_t i2,
73 Double_t r)const;
166d14ba 74 // Given 2 points from a TGeoPcon(z and Rmax) finds z at given Rmax
cee918ed 75 Double_t Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1,Int_t i2,
76 Double_t r)const;
166d14ba 77 // Give two points in the array ar and az, returns the value z
78 // corresponding r along the line defined by those two points
cee918ed 79 Double_t Zfrom2Points(const Double_t *az,const Double_t *ar,
80 Int_t i1,Int_t i2,Double_t r)const;
166d14ba 81 // Given 1 point from a TGeoPcon(z and Rmax) the angle tc returns r for
82 // a given z, an offset (distnace perpendicular to line at angle tc) of
83 // th may be applied.
cee918ed 84 Double_t RmaxFromZpCone(const TGeoPcon *p,int ip,Double_t tc,
85 Double_t z,Double_t th=0.0)const;
86 Double_t RFromZpCone(const Double_t *ar,const Double_t *az,int ip,
87 Double_t tc,Double_t z,Double_t th=0.0)const;
166d14ba 88 // Given 1 point from a TGeoPcon(z and Rmin) 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 RminFromZpCone(const TGeoPcon *p,Int_t ip,Double_t tc,
92 Double_t z,Double_t th=0.0)const;
166d14ba 93 // Given 1 point from a TGeoPcon(z and Rmax) the angle tc returns z for
94 // a given Rmax, an offset (distnace perpendicular to line at angle tc) of
95 // th may be applied.
cee918ed 96 Double_t ZFromRmaxpCone(const TGeoPcon *p,int ip,Double_t tc,
97 Double_t r,Double_t th=0.0)const;
166d14ba 98 // General Outer cone Surface equation for z.
cee918ed 99 Double_t ZFromRmaxpCone(const Double_t *ar,const Double_t *az,
166d14ba 100 Int_t ip,Double_t tc,Double_t r,
cee918ed 101 Double_t th=0.0)const;
166d14ba 102 // Given 1 point from a TGeoPcon(z and Rmin) the angle tc returns z for
103 // a given Rmin, an offset (distnace perpendicular to line at angle tc) of
104 // th may be applied.
cee918ed 105 Double_t ZFromRminpCone(const TGeoPcon *p,int ip,Double_t tc,
106 Double_t r,Double_t th=0.0)const;
166d14ba 107 // Given two lines defined by the points i1, i2,i3 in the TGeoPcon
108 // class p that intersect at point p->GetZ(i2) return the point z,r
109 // that is Cthick away in the TGeoPcon class q. If points i1=i2
110 // and max == kTRUE, then p->GetRmin(i1) and p->GetRmax(i2) are used.
111 // if points i2=i3 and max=kTRUE then points p->GetRmax(i2) and
112 // p->GetRmin(i3) are used. If i2=i3 and max=kFALSE, then p->GetRmin(i2)
113 // and p->GetRmax(i3) are used.
cee918ed 114 void InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2,Int_t i3,
115 Double_t Cthick,TGeoPcon *q,Int_t j1,Bool_t max)const;
166d14ba 116 // Given two intersecting lines defined by the points (x0,y0), (x1,y1) and
543b7370 117 // (x1,y1), (x2,y2) {intersecting at (x1,y1)} the point (x,y) a distance
166d14ba 118 // c away is returned such that two lines a distance c away from the
119 // lines defined above intersect at (x,y).
cee918ed 120 void InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t y1,
172b0d90 121 Double_t x2,Double_t y2,Double_t c,
cee918ed 122 Double_t &x,Double_t &y)const;
166d14ba 123 // Given a initial point z0,r0, the initial angle theta0, and the radius
124 // of curvature, returns the point z1, r1 at the angle theta1. Theta
125 // measured from the r axis in the clock wise direction [degrees].
cee918ed 126 void RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0,
127 Double_t r0,Double_t theta1,Double_t &z1,
128 Double_t &r1)const;
166d14ba 129 //
130 // Output functions for debugging
131 //
132 // Prints out the contents of the TGeoArb8
133 void PrintArb8(const TGeoArb8 *a) const;
134 // Prints out the contents of the TGeoPcon
135 void PrintPcon(const TGeoPcon *a) const;
136 // Prints out the contents of the TGeoTube
137 void PrintTube(const TGeoTube *a) const;
138 // Prints out the contents of the TGeoTubeSeg
139 void PrintTubeSeg(const TGeoTubeSeg *a) const;
140 // Prints out the contents of the TGeoConeSeg
141 void PrintConeSeg(const TGeoConeSeg *a) const;
142 // Prints out the contents of the TGeoBBox
143 void PrintBBox(const TGeoBBox *a) const;
144 // Draws a 2D crossection of the TGeoPcon r,z section
145 void DrawCrossSection(const TGeoPcon *p,Int_t fillc=7,Int_t fills=4050,
146 Int_t linec=3,Int_t lines=1,Int_t linew=4,
147 Int_t markc=2,Int_t marks=4,
148 Float_t marksize=1.0) const;
db486a6e 149 // Compute the angles where a line intersects a circle.
150 Bool_t AngleOfIntersectionWithLine(Double_t x0,Double_t y0,
151 Double_t x1,Double_t y1,
152 Double_t xc,Double_t yc,
153 Double_t rc,Double_t &t0,
154 Double_t &t1)const;
155 void AnglesForRoundedCorners(Double_t x0,Double_t y0,Double_t r0,
156 Double_t x1,Double_t y1,Double_t r1,
157 Double_t &t0,Double_t &t1)const;
54c9a3d9 158 // Define a general CreateMaterials function here so that if
159 // any specific subdetector does not define it this null function
160 // will due. This function is not declaired const so that a sub-
161 // detector's version may use class variables if they wish.
162 void CreateDefaultMaterials();
163 virtual void CreateMaterials(){};
db486a6e 164 // Function to create figure needed for this class' documentation
54c9a3d9 165 void MakeFigure1(Double_t x0=0.0,Double_t y0=0.0,Double_t r0=2.0,
166 Double_t x1=-4.0,Double_t y1=-2.0,Double_t r1=1.0);
cee918ed 167 protected:
168
169 // Units, Convert from k?? to cm,degree,GeV,seconds,
db486a6e 170 static const Double_t fgkmicron; // Convert micron to TGeom's cm.
a98296c1 171 static const Double_t fgkmm; // Convert mm to TGeom's cm.
db486a6e 172 static const Double_t fgkcm; // Convert cm to TGeom's cm.
a98296c1 173 static const Double_t fgkDegree; //Convert degrees to TGeom's degrees
174 static const Double_t fgkRadian; //To Radians
a53658c6 175 static const Double_t fgkgcm3; // Density in g/cm^3
54c9a3d9 176 static const Double_t fgkKgm3; // Density in kg/m^3
177 static const Double_t fgkKgdm3; // Density in kg/dm^3
a53658c6 178 static const Double_t fgkCelsius; // Temperature in degrees Celcius
179 static const Double_t fgkPascal; // Preasure in Pascal
180 static const Double_t fgkKPascal; // Preasure in KPascal
181 static const Double_t fgkeV; // Energy in eV
182 static const Double_t fgkKeV; // Energy in KeV
183 static const Double_t fgkMeV; // Energy in MeV
184 static const Double_t fgkGeV; // Energy in GeV
cee918ed 185
172b0d90 186 private:
db486a6e 187 Double_t AngleForRoundedCorners0(Double_t dx,Double_t dy,
188 Double_t sdr)const;
189 Double_t AngleForRoundedCorners1(Double_t dx,Double_t dy,
190 Double_t sdr)const;
191 Int_t fDebug; //! Debug flag/level
172b0d90 192 ClassDef(AliITSv11Geometry,1) // Base class for ITS v11 geometry
193};
194
172b0d90 195#endif