]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSgeom.h
Added the function GetModuleTypeName, and inlined some functions for speed.
[u/mrichter/AliRoot.git] / ITS / AliITSgeom.h
index a0a81dc4202f89b3f514ed9bb07daeb07b57b9c8..05e368a2379d29ac3b55b333ecf693ebcaa0c56b 100644 (file)
 // the information needed to do the coordinate transformation are kept in
 // a specialized structure for ease of implementation.
 /////////////////////////////////////////////////////////////////////////
-#include <fstream.h>
+#include <Riostream.h>
 #include <TObject.h>
 #include <TObjArray.h>
 #include <TVector.h>
 
 #include "AliITSgeomMatrix.h"
 
-
 typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector;
 
 //_______________________________________________________________________
@@ -36,15 +35,15 @@ class AliITSgeom : public TObject {
     AliITSgeom(const char *filename);  // Constructor
     AliITSgeom(Int_t itype,Int_t nlayers,Int_t *nlads,Int_t *ndets,
               Int_t nmods); // Constructor
+    AliITSgeom(AliITSgeom &source);    // Copy constructor
+    AliITSgeom& operator=(AliITSgeom &source);// = operator
+    virtual ~AliITSgeom();             // Default destructor
     // this function allocates a AliITSgeomMatrix for a particular module.
     void CreatMatrix(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); // Output for new format.
-    AliITSgeom(AliITSgeom &source);    // Copy constructor
-    AliITSgeom& operator=(AliITSgeom &source);// = operator
-    virtual ~AliITSgeom();             // Default destructor
 // Getters
     Int_t GetTransformationType() const {return fTrans;}
 //
@@ -74,10 +73,10 @@ class AliITSgeom : public TObject {
        return (AliITSgeomMatrix*)(fGm->At(index));}
     //     This function returns the number of detectors/ladder for a give 
     // layer. In particular it returns fNdet[layer-1].
-    Int_t GetNdetectors(Int_t lay) const {return fNdet[lay-1];}
+    Int_t GetNdetectors(Int_t lay) const;
     //     This function returns the number of ladders for a give layer. In
     // particular it returns fNlad[layer-1].
-    Int_t GetNladders(Int_t lay)   const {return fNlad[lay-1];}
+    Int_t GetNladders(Int_t lay)   const;
     //     This function returns the number of layers defined in the ITS
     // geometry. In particular it returns fNlayers.
     Int_t GetNlayers()                   const {return fNlayers;}
@@ -87,6 +86,13 @@ class AliITSgeom : public TObject {
     Int_t GetModuleIndex(const Int_t *id){
        return GetModuleIndex(id[0],id[1],id[2]);}
     void  GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det);
+    // Returns the detector type
+    Int_t GetModuleType(Int_t index){
+                          return GetGeomMatrix(index)->GetDetectorIndex();}
+    // Returns the detector type as a string
+    Char_t * GetModuleTypeName(Int_t index){switch(GetModuleType(index)) {
+    case kSPD: return "kSPD";case kSDD: return "kSDD";case kSSD: return "kSSD";
+    case kSSDp: return"kSSDp";case kSDDp: return "kSDDp"; default: return "";}}
 //
     Int_t GetStartDet(Int_t dtype );
     Int_t GetLastDet(Int_t dtype);
@@ -182,13 +188,7 @@ class AliITSgeom : public TObject {
     //      This function returns the Cartesian translation [cm] and the
     // 6 GEANT rotation angles [degrees]for a given layer ladder and
     // detector number, in the TVector x (at least 9 elements large).
-    void  GetCenterThetaPhi(Int_t lay,Int_t lad,Int_t det,
-                           TVector &x){Double_t t[3],ang[6];
-                           Int_t index=GetModuleIndex(lay,lad,det);
-                           GetTrans(index,t);GetGeantAngles(index,ang);
-                           x(0) =   t[0];x(1) =   t[1];x(2) =   t[2];
-                           x(3) = ang[0];x(4) = ang[1];x(5) = ang[2];
-                           x(6) = ang[3];x(7) = ang[4];x(8) = ang[5];}
+    void  GetCenterThetaPhi(Int_t lay,Int_t lad,Int_t det,TVector &x);
 //
     //     This function returns the rotation matrix in Double
     // precision for a given module.
@@ -223,7 +223,7 @@ class AliITSgeom : public TObject {
     // 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(const AliITSDetector idet)
+    virtual TObject *GetShape(AliITSDetector idet)
        {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
@@ -247,14 +247,14 @@ class AliITSgeom : public TObject {
     //     Sets the rotation angles and matrix for a give module index
     // via the 3 floating precision variables rx, ry, and rz [radians].
     void SetByAngles(Int_t index,
-                    const Float_t rx,const Float_t ry,const Float_t rz) {
+                    Float_t rx, Float_t ry, Float_t rz) {
                      Double_t a[3];a[0] = rx;a[1] = ry;a[2] = rz;
                      GetGeomMatrix(index)->SetAngles(a);}
     //     Sets the rotation angles and matrix for a give layer, ladder,
     // and detector numbers via the 3 floating precision variables rx,
     // ry, and rz [radians].
     void SetByAngles(Int_t lay,Int_t lad,Int_t det,
-                     const Float_t rx,const Float_t ry,const Float_t rz) {
+                     Float_t rx, Float_t ry, Float_t rz) {
                      SetByAngles(GetModuleIndex(lay,lad,det),rx,ry,rz);}
 //
     //     Sets the rotation angles and matrix for a give module index