]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11Geometry.h
Trivial modifications for local tests (file list)
[u/mrichter/AliRoot.git] / ITS / AliITSv11Geometry.h
index 290a8a3bf23451f4d7ef28f00f043d3460a63323..866c74488ddb47acc02aac4cb6ac7902eab2e908 100644 (file)
@@ -11,6 +11,7 @@
   Base class for defining large parts of the ITS geometry, v11.
  */
 #include <TObject.h>
+#include <AliLog.h>
 class TGeoArb8;
 class TGeoPcon;
 class TGeoTube;
@@ -20,80 +21,89 @@ class TGeoBBox;
 
 class AliITSv11Geometry : public TObject {
   public:
-    AliITSv11Geometry(){fDebug=kTRUE;};
-    AliITSv11Geometry(Bool_t debug){fDebug=debug;};
+    AliITSv11Geometry():fDebug(AliDebugLevel()) {};
+    AliITSv11Geometry(Int_t debug):fDebug(debug) {};
     virtual ~AliITSv11Geometry(){};
     //
     // Sets the debug flag for debugging output
-    void SetDebug(){fDebug=kTRUE;}
+    void SetDebug(Int_t level=5){fDebug=level;}
     // Clears the debug flag so no debugging output will be generated
-    void SetNoDebug(){fDebug=kFALSE;}
+    void SetNoDebug(){fDebug=0;}
     // Returns the debug flag value
-    Bool_t GetDebug()const {return fDebug;}
+    Bool_t GetDebug(Int_t level=1)const {return fDebug>=level;}
     //
     // Static functions
     //
     // Define Trig functions for use with degrees (standerd TGeo angles).
     // Sine function
-    static Double_t SinD(Double_t deg){return TMath::Sin(deg*TMath::DegToRad());}
+    Double_t SinD(Double_t deg)const{return TMath::Sin(deg*TMath::DegToRad());}
     // Cosine function
-    static Double_t CosD(Double_t deg){return TMath::Cos(deg*TMath::DegToRad());}
+    Double_t CosD(Double_t deg)const{return TMath::Cos(deg*TMath::DegToRad());}
     // Tangent function
-    static Double_t TanD(Double_t deg){return TMath::Tan(deg*TMath::DegToRad());}
+    Double_t TanD(Double_t deg)const{return TMath::Tan(deg*TMath::DegToRad());}
+    // Determine the intersection of two lines
+    void IntersectLines(Double_t m, Double_t x0, Double_t y0,
+                       Double_t n, Double_t x1, Double_t y1,
+                       Double_t &xi, Double_t &yi)const;
+    // Determine the intersection of a line and a circle
+    static Bool_t IntersectCircle(Double_t m, Double_t x0, Double_t y0,
+                          Double_t rr, Double_t xc, Double_t yc,
+                                 Double_t &xi1, Double_t &yi1,
+                          Double_t &xi2, Double_t &yi2);
     // Given the line, defined by the two points (x0,y0) and (x1,y1) and the
     // point x, return the value of y.
-    static Double_t Yfrom2Points(Double_t x0,Double_t y0,
-                                 Double_t x1,Double_t y1,Double_t x);
+    Double_t Yfrom2Points(Double_t x0,Double_t y0,
+                                 Double_t x1,Double_t y1,Double_t x)const;
     // Given the line, defined by the two points (x0,y0) and (x1,y1) and the
     // point y, return the value of x.
-    static Double_t Xfrom2Points(Double_t x0,Double_t y0,
-                                 Double_t x1,Double_t y1,Double_t y);
+    Double_t Xfrom2Points(Double_t x0,Double_t y0,
+                                 Double_t x1,Double_t y1,Double_t y)const;
     // Given 2 points from a TGeoPcon(z and Rmax) finds Rmax at given z
-    static Double_t RmaxFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2,
-                                    Double_t z);
+    Double_t RmaxFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2,
+                                    Double_t z)const;
     // Given 2 points from a TGeoPcon(z and Rmin) finds Rmin at given z
-    static Double_t RminFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2,
-                                    Double_t z);
+    Double_t RminFrom2Points(const TGeoPcon *p,Int_t i1,Int_t i2,
+                                    Double_t z)const;
     // Give two points in the array ar and az, returns the value r 
     // corresponding z along the line defined by those two points
-    static Double_t RFrom2Points(const Double_t *ar,const Double_t *az,
-                                 Int_t i1,Int_t i2,Double_t z);
+    Double_t RFrom2Points(const Double_t *ar,const Double_t *az,
+                                 Int_t i1,Int_t i2,Double_t z)const;
     // Given 2 points from a TGeoPcon(z and Rmax) finds z at given Rmin
-    static Double_t Zfrom2MinPoints(const TGeoPcon *p,Int_t i1,Int_t i2,
-                                    Double_t r);
+    Double_t Zfrom2MinPoints(const TGeoPcon *p,Int_t i1,Int_t i2,
+                                    Double_t r)const;
     // Given 2 points from a TGeoPcon(z and Rmax) finds z at given Rmax
-    static Double_t Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1,Int_t i2,
-                                    Double_t r);
+    Double_t Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1,Int_t i2,
+                                    Double_t r)const;
     // Give two points in the array ar and az, returns the value z 
     // corresponding r along the line defined by those two points
-    static Double_t Zfrom2Points(const Double_t *az,const Double_t *ar,
-                                 Int_t i1,Int_t i2,Double_t r);
+    Double_t Zfrom2Points(const Double_t *az,const Double_t *ar,
+                                 Int_t i1,Int_t i2,Double_t r)const;
     // Given 1 point from a TGeoPcon(z and Rmax) the angle tc returns r for 
     // a given z, an offset (distnace perpendicular to line at angle tc) of 
     // th may be applied.
-    static Double_t RmaxFromZpCone(const TGeoPcon *p,int ip,Double_t tc,
-                                   Double_t z,Double_t th=0.0);
-    static Double_t RFromZpCone(const Double_t *ar,const Double_t *az,int ip,
-                                Double_t tc,Double_t z,Double_t th=0.0);
+    Double_t RmaxFromZpCone(const TGeoPcon *p,int ip,Double_t tc,
+                                   Double_t z,Double_t th=0.0)const;
+    Double_t RFromZpCone(const Double_t *ar,const Double_t *az,int ip,
+                                Double_t tc,Double_t z,Double_t th=0.0)const;
     // Given 1 point from a TGeoPcon(z and Rmin) the angle tc returns r for 
     // a given z, an offset (distnace perpendicular to line at angle tc) of 
     // th may be applied.
-    static Double_t RminFromZpCone(const TGeoPcon *p,Int_t ip,Double_t tc,
-                                   Double_t z,Double_t th=0.0);
+    Double_t RminFromZpCone(const TGeoPcon *p,Int_t ip,Double_t tc,
+                                   Double_t z,Double_t th=0.0)const;
     // Given 1 point from a TGeoPcon(z and Rmax) the angle tc returns z for 
     // a given Rmax, an offset (distnace perpendicular to line at angle tc) of 
     // th may be applied.
-    static Double_t ZFromRmaxpCone(const TGeoPcon *p,int ip,Double_t tc,
-                                   Double_t r,Double_t th=0.0);
+    Double_t ZFromRmaxpCone(const TGeoPcon *p,int ip,Double_t tc,
+                                   Double_t r,Double_t th=0.0)const;
     // General Outer cone Surface equation for z.
-    static Double_t ZFromRmaxpCone(const Double_t *ar,const Double_t *az,
+    Double_t ZFromRmaxpCone(const Double_t *ar,const Double_t *az,
                                    Int_t ip,Double_t tc,Double_t r,
-                                   Double_t th=0.0);
+                                   Double_t th=0.0)const;
     // Given 1 point from a TGeoPcon(z and Rmin) the angle tc returns z for 
     // a given Rmin, an offset (distnace perpendicular to line at angle tc) of 
     // th may be applied.
-    static Double_t ZFromRminpCone(const TGeoPcon *p,int ip,Double_t tc,
-                                   Double_t r,Double_t th=0.0);
+    Double_t ZFromRminpCone(const TGeoPcon *p,int ip,Double_t tc,
+                                   Double_t r,Double_t th=0.0)const;
     // Given two lines defined by the points i1, i2,i3 in the TGeoPcon 
     // class p that intersect at point p->GetZ(i2) return the point z,r 
     // that is Cthick away in the TGeoPcon class q. If points i1=i2
@@ -101,21 +111,21 @@ class AliITSv11Geometry : public TObject {
     // if points i2=i3 and max=kTRUE then points p->GetRmax(i2) and
     // p->GetRmin(i3) are used. If i2=i3 and max=kFALSE, then p->GetRmin(i2)
     // and p->GetRmax(i3) are used.
-    static void InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2,Int_t i3,
-                        Double_t Cthick,TGeoPcon *q,Int_t j1,Bool_t max);
+    void InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2,Int_t i3,
+                        Double_t Cthick,TGeoPcon *q,Int_t j1,Bool_t max)const;
     // Given two intersecting lines defined by the points (x0,y0), (x1,y1) and
-    // (x1,y1), (x1,y2) {intersecting at (x1,y1)} the point (x,y) a distance
+    // (x1,y1), (x2,y2) {intersecting at (x1,y1)} the point (x,y) a distance
     // c away is returned such that two lines a distance c away from the
     // lines defined above intersect at (x,y).
-    static void InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t y1,
+     void InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t y1,
                             Double_t x2,Double_t y2,Double_t c,
-                            Double_t &x,Double_t &y);
+                            Double_t &x,Double_t &y)const;
     // Given a initial point z0,r0, the initial angle theta0, and the radius
     // of curvature, returns the point z1, r1 at the angle theta1. Theta
     // measured from the r axis in the clock wise direction [degrees].
-    static void RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0,
-                                  Double_t r0,Double_t theta1,Double_t &z1,
-                                  Double_t &r1);
+    void RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0,
+                           Double_t r0,Double_t theta1,Double_t &z1,
+                           Double_t &r1)const;
     //
     // Output functions for debugging
     //
@@ -136,15 +146,50 @@ class AliITSv11Geometry : public TObject {
                           Int_t linec=3,Int_t lines=1,Int_t linew=4,
                           Int_t markc=2,Int_t marks=4,
                           Float_t marksize=1.0) const;
+    // Compute the angles where a line intersects a circle.
+    Bool_t AngleOfIntersectionWithLine(Double_t x0,Double_t y0,
+                                       Double_t x1,Double_t y1,
+                                       Double_t xc,Double_t yc,
+                                       Double_t rc,Double_t &t0,
+                                       Double_t &t1)const;
+    void AnglesForRoundedCorners(Double_t x0,Double_t y0,Double_t r0,
+                                 Double_t x1,Double_t y1,Double_t r1,
+                                 Double_t &t0,Double_t &t1)const;
+    // Define a general CreateMaterials function here so that if
+    // any specific subdetector does not define it this null function
+    // will due. This function is not declaired const so that a sub-
+    // detector's version may use class variables if they wish.
+    void CreateDefaultMaterials();
+    virtual void CreateMaterials(){};
+    // Function to create figure needed for this class' documentation
+    void MakeFigure1(Double_t x0=0.0,Double_t y0=0.0,Double_t r0=2.0,
+                     Double_t x1=-4.0,Double_t y1=-2.0,Double_t r1=1.0);
+  protected:
+
+    // Units, Convert from k?? to cm,degree,GeV,seconds,
+    static const Double_t fgkmicron; // Convert micron to TGeom's cm.
+    static const Double_t fgkmm; // Convert mm to TGeom's cm.
+    static const Double_t fgkcm; // Convert cm to TGeom's cm.
+    static const Double_t fgkDegree; //Convert degrees to TGeom's degrees
+    static const Double_t fgkRadian; //To Radians
+    static const Double_t fgkgcm3;   // Density in g/cm^3
+    static const Double_t fgkKgm3;   // Density in kg/m^3
+    static const Double_t fgkKgdm3;   // Density in kg/dm^3
+    static const Double_t fgkCelsius; // Temperature in degrees Celcius
+    static const Double_t fgkPascal;  // Preasure in Pascal
+    static const Double_t fgkKPascal;  // Preasure in KPascal
+    static const Double_t fgkeV;  // Energy in eV
+    static const Double_t fgkKeV;  // Energy in KeV
+    static const Double_t fgkMeV;  // Energy in MeV
+    static const Double_t fgkGeV;  // Energy in GeV
+
   private:
-    Bool_t fDebug; //! Debug flag
+    Double_t AngleForRoundedCorners0(Double_t dx,Double_t dy,
+                                     Double_t sdr)const;
+    Double_t AngleForRoundedCorners1(Double_t dx,Double_t dy,
+                                     Double_t sdr)const;
+    Int_t fDebug; //! Debug flag/level
     ClassDef(AliITSv11Geometry,1) // Base class for ITS v11 geometry
 };
 
-// Units, Convert from k?? to cm,degree,GeV,seconds,
-static const Double_t kmm = 0.10; // Convert mm to TGeom's cm.
-static const Double_t kcm = 1.00; // Convert cv to TGeom's cm.
-static const Double_t kDegree = 1.0; // Convert degrees to TGeom's degrees
-static const Double_t kRadian = TMath::DegToRad(); // conver to Radians
-
 #endif