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