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