]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSgeom.h
Fixing typo (clang)
[u/mrichter/AliRoot.git] / ITS / AliITSgeom.h
index 2300acb91aba4fd5088fe11aaaf2bb29e88a8917..5a71ae5bd9f3d920b405fbfa594308e6255dfaa6 100644 (file)
 #include <TVector.h>
 #include <TString.h>
 #include <TArrayI.h>
-class TArrayI;
-
+#include <TMath.h>
+//
 #include "AliITSgeomMatrix.h"
+#include "AliLog.h"
 
-typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector;
+typedef enum {kND=-1,kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4, kUPG=5} AliITSDetector;
 
 //_______________________________________________________________________
 
@@ -35,7 +36,6 @@ class AliITSgeom : public TObject {
 
  public:
     AliITSgeom();                      // Default constructor
-    AliITSgeom(const char *filename);  // Constructor
     AliITSgeom(Int_t itype,Int_t nlayers,const Int_t *nlads,const Int_t *ndets,
                Int_t nmods); // Constructor
     AliITSgeom(const AliITSgeom &source);    // Copy constructor
@@ -48,8 +48,6 @@ class AliITSgeom : public TObject {
     void CreateMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det,
                       AliITSDetector idet,const Double_t tran[3],
                       const Double_t rot[10]);
-    void ReadNewFile(const char *filename);  // Constructor for new format.
-    void WriteNewFile(const char *filename)const; // Output for new format.
     // Getters
     Int_t GetTransformationType() const {return fTrans;}
     //
@@ -61,24 +59,21 @@ class AliITSgeom : public TObject {
     // for Global GEANT coordinate system to the local "Tracking" coordinate
     // system of the detector. These are the transformation used by the
     // Tracking code.
-    Bool_t IsGeantToTracking()  const {return ((fTrans&&0xfffe)!= 0);}
+    Bool_t IsGeantToTracking()  const {return ((fTrans&0xfffe)!= 0);}
     // returns kTRUE if the transformation defined by this class is
     // for Global GEANT coordinate system to the local GEANT coordinate system
     // of the detector but may have been displaced by some typically small
     // amount. These are modified transformation similar to that used by GEANT.
-    Bool_t IsGeantToDisplaced() const {return ((fTrans&&0xfffd)!= 0);}
-    // returns kTRUE if the shape defined by ishape has been defined in this
-    // set of transformations. Typical values of ishape are kSPD, kSDD, kSSD,
-    // kSSD2.
-    Bool_t IsShapeDefined(Int_t ishape)const {
-        return ((fShape.At(ishape))!=0);}
+    Bool_t IsGeantToDisplaced() const {return ((fTrans&0xfffd)!= 0);}
     //
     //     This function returns a pointer to the particular AliITSgeomMatrix
     // class for a specific module index.
     AliITSgeomMatrix *GetGeomMatrix(Int_t index){if(index<fGm.GetSize()&&index>=0)
-        return (AliITSgeomMatrix*)(fGm.At(index));else Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;}
+        return (AliITSgeomMatrix*)(fGm.At(index));else 
+            Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;}
     AliITSgeomMatrix *GetGeomMatrix(Int_t index)const{if(index<fGm.GetSize()&&index>=0)
-        return (AliITSgeomMatrix*)(fGm.At(index));else Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;}
+        return (AliITSgeomMatrix*)(fGm.At(index));else 
+            Error("GetGeomMatrix","index=%d<0||>=GetSize()=%d",index,fGm.GetSize());return 0;}
     // This function find and return the number of detector types only.
     Int_t GetNDetTypes()const{Int_t max;return GetNDetTypes(max);};
     // This function find and return the number of detector types and the
@@ -240,37 +235,13 @@ class AliITSgeom : public TObject {
           for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) mat[3*i+j] = rot[i][j];}
     //     This function sets the rotation matrix in a Double
     // precision pointer for a given module. mat[i][j] => mat[3*i+j].
-    void  SetRotMatrix(Int_t index,Double_t *mat){Double_t rot[3][3];
+    void  SetRotMatrix(Int_t index,const Double_t *mat){Double_t rot[3][3];
           for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++) rot[i][j]=mat[3*i+j];
           GetGeomMatrix(index)->SetMatrix(rot);}
+    // Return the normal for a specific module
+    void GetGlobalNormal(Int_t index,Double_t n[3]){
+        GetGeomMatrix(index)->GetGlobalNormal(n[0],n[1],n[2]);}
     //
-    //     Will define fShape if it isn't already defined.
-    void DefineShapes(Int_t size=5){fShape.Expand(size);}
-    //     this function returns a pointer to the array of detector
-    // descriptions, Segmentation.
-    virtual TObjArray *GetShapeArray(){return &fShape;};
-    //     this function returns a pointer to the class describing a particular
-    // detector type based on AliITSDetector value. This will return a pointer
-    // to one of the classes AliITSgeomSPD, AliITSgeomSDD, or 
-    // AliITSgeomSSD, for example.
-    virtual TObject *GetShape(AliITSDetector idet){
-        return fShape.At((Int_t)idet);};
-    virtual TObject *GetShape(AliITSDetector idet)const{
-        return fShape.At((Int_t)idet);};
-    //     This function returns a pointer to the class describing the
-    // detector for a particular module index. This will return a pointer
-    // to one of the classes AliITSgeomSPD, AliITSgeomSDD, 
-    // or AliITSgeomSSD, for example.
-    virtual TObject *GetShape(Int_t index){
-        return fShape.At(GetGeomMatrix(index)->GetDetectorIndex());}
-    virtual TObject *GetShape(Int_t index)const{
-        return fShape.At(GetGeomMatrix(index)->GetDetectorIndex());}
-    //     This function returns a pointer to the class describing the
-    // detector for a particular layer ladder and detector numbers. This
-    // will return a pointer to one of the classes AliITSgeomSPD,
-    // AliITSgeomSDD, or AliITSgeomSSD, for example.
-    virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det)
-        {return GetShape(GetModuleIndex(lay,lad,det));}
     //
     //  Setters
     //     Sets the rotation angles and matrix for a give module index
@@ -319,19 +290,6 @@ class AliITSgeom : public TObject {
                   t[0] = x;t[1] = y;t[2] = z;
                   SetTrans(GetModuleIndex(lay,lad,det),t);}
     //
-    //     This function adds one more shape element to the TObjArray
-    // fShape. It is primarily used in the constructor functions of the
-    // AliITSgeom class. The pointer *shape can be the pointer to any
-    // class that is derived from TObject (this is true for nearly every
-    // ROOT class). This does not appear to be working properly at this time.
-    void AddShape(TObject *shp){fShape.AddLast(shp);}
-    //     This function deletes an existing shape element, of type TObject,
-    // and replaces it with the one specified. This is primarily used to
-    // changes the parameters to the geom class for a particular
-    // type of detector.
-    void ReSetShape(Int_t dtype,TObject *shp){
-        delete (fShape.At(dtype));fShape.AddAt(shp,dtype);}
-    //
     //  transformations
     //     Transforms from the ALICE Global coordinate system
     // to the detector local coordinate system for the detector
@@ -569,8 +527,8 @@ class AliITSgeom : public TObject {
     // Global coordinate system for the detector id[3].
     // The global and local coordinate are given in two Double point
     // arrays g[3], and l[3].
-    void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g)const{
-        LtoGMomentumTracking(GetModuleIndex(id),l,g);}
+    void LtoGMomentumTracking(const Int_t *id,const Double_t *l,Double_t *g)
+        const{LtoGMomentumTracking(GetModuleIndex(id),l,g);}
     //     Transforms of momentum types of quantities from the detector
     // local coordinate system (used for ITS tracking) to the ALICE
     // Global coordinate system for the detector layer ladder and detector
@@ -591,8 +549,8 @@ class AliITSgeom : public TObject {
     // to another detector local coordinate system for the detector
     // id1[3] to the detector id2[3]. The local coordinates are given
     // in two Double point arrays l1[3], and l2[3].
-    void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2)const{
-        LtoL(GetModuleIndex(id1[0],id1[1],id1[2]),
+    void LtoL(const Int_t *id1,const Int_t *id2,Double_t *l1,Double_t *l2)
+        const{LtoL(GetModuleIndex(id1[0],id1[1],id1[2]),
               GetModuleIndex(id2[0],id2[1],id2[2]),l1,l2);}
     //
     //     Transforms from one detector local coordinate system (used for
@@ -655,7 +613,8 @@ class AliITSgeom : public TObject {
     // system. The specific detector is determined by the module index
     // number.
     void GtoLErrorMatrix(Int_t index,const Double_t **g,Double_t **l)const{
-        GetGeomMatrix(index)->GtoLPositionError((Double_t (*)[3])g,(Double_t (*)[3])l);}
+        GetGeomMatrix(index)->GtoLPositionError(
+            (Double_t (*)[3])g,(Double_t (*)[3])l);}
     //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // the ALICE Global coordinate system to a detector local coordinate
@@ -673,7 +632,18 @@ class AliITSgeom : public TObject {
     // system. The specific detector is determined by the module index
     // number.
     void LtoGErrorMatrix(Int_t index,const Double_t **l,Double_t **g)const{
-        GetGeomMatrix(index)->LtoGPositionError((Double_t (*)[3])l,(Double_t (*)[3])g);}
+        GetGeomMatrix(index)->LtoGPositionError(
+            (Double_t (*)[3])l,(Double_t (*)[3])g);}
+    //
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // the detector local coordinate system to a ALICE Global coordinate
+    // system. The specific detector is determined by the module index
+    // number.
+    void LtoGErrorMatrix(Int_t index,const Double_t l[3][3],Double_t g[3][3])
+        const{
+        GetGeomMatrix(index)->LtoGPositionError(
+            (Double_t (*)[3])l,(Double_t (*)[3])g);}
+
     //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // the detector local coordinate system (used by ITS tracking) to a
@@ -681,10 +651,21 @@ class AliITSgeom : public TObject {
     // by the module index number.
     void LtoGErrorMatrixTracking(Int_t index,const Double_t **l,
                                  Double_t **g)const{
-        if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError((
-                                   Double_t (*)[3])g,(Double_t (*)[3])l);
-        else GetGeomMatrix(index)->LtoGPositionErrorTracking((Double_t (*)[3])l,
-                                                          (Double_t (*)[3])g);}
+        if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(
+            (Double_t (*)[3])g,(Double_t (*)[3])l);
+        else GetGeomMatrix(index)->LtoGPositionErrorTracking(
+            (Double_t (*)[3])l,(Double_t (*)[3])g);}
+    //
+    //     Transforms a matrix, like an Uncertainty or Error matrix from
+    // the detector local coordinate system (used by ITS tracking) to a
+    // ALICE Global coordinate system. The specific detector is determined
+    // by the module index number.
+    void LtoGErrorMatrixTracking(Int_t index,const Double_t l[3][3],
+                                 Double_t g[3][3])const{
+        if(IsGeantToTracking()) GetGeomMatrix(index)->LtoGPositionError(
+            (Double_t (*)[3])g,(Double_t (*)[3])l);
+        else GetGeomMatrix(index)->LtoGPositionErrorTracking(
+            (Double_t (*)[3])l,(Double_t (*)[3])g);}
     //
     //     Transforms a matrix, like an Uncertainty or Error matrix from
     // one detector local coordinate system to another detector local
@@ -720,9 +701,6 @@ class AliITSgeom : public TObject {
     // the detector/module specified by the the module index number.
     Double_t Distance(Int_t index,const Double_t g[3])const{
         return  TMath::Sqrt(GetGeomMatrix(index)->Distance2(g));}
-    // loops over modules and computes the average cylindrical
-    // radius to a given layer and the range.
-    Double_t GetAverageRadiusOfLayer(Int_t layer,Double_t &range)const;
     //  Geometry manipulation
     // This function performs a Cartesian translation and rotation of
     // the full ITS from its default position by an amount determined by
@@ -743,25 +721,24 @@ class AliITSgeom : public TObject {
     void RandomCylindericalChange(const Float_t *stran,const Float_t *srot);
     // This function converts these transformations from Alice global and
     // local to Tracking global and local.
-    void GeantToTracking(const AliITSgeom &source); // This converts the geometry
+    //
+    // This converts the geometry
+    void GeantToTracking(const AliITSgeom &source);
     //  Other routines.
-    // This routine prints, to a file, the difference between this class
-    // and "other".
-    void PrintComparison(FILE *fp,AliITSgeom *other)const;
     // This routine prints, to a file, the contents of this class.
     void PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const;
     // This function prints out this class in a single stream. This steam
     // can be read by ReadGeom.
-    ofstream &PrintGeom(ofstream &out)const;
-    // This function reads in that single steam printed out by PrintGeom.
-    ifstream &ReadGeom(ifstream &in);
+    // (Coverity warnings)    void PrintGeom(ostream *out)const;
 
     //Conversion from det. local coordinates to local ("V2") coordinates
     //used for tracking
 
-    void DetLToTrackingV2(Int_t md, Float_t xin, Float_t zin, Float_t &yout, Float_t &zout); 
+    void DetLToTrackingV2(Int_t md,Float_t xin,Float_t zin,
+                          Float_t &yout, Float_t &zout) const ; 
 
-    void TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,Float_t &xout,Float_t &zout);
+    void TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,
+                          Float_t &xout,Float_t &zout) const ;
 
  private:
     TString    fVersion; // Transformation version.
@@ -771,9 +748,9 @@ class AliITSgeom : public TObject {
     TArrayI    fNlad;    // Array of the number of ladders/layer(layer)
     TArrayI    fNdet;    // Array of the number of detector/ladder(layer)
     TObjArray  fGm;      // Structure of translation. and rotation.
-    TObjArray  fShape;   // Array of shapes and detector information.
 
-    ClassDef(AliITSgeom,3) // ITS geometry class
-};
+    ClassDef(AliITSgeom,4) // ITS geometry class
+}; 
+// Input and output function for standard C++ input/output.
 
 #endif