]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSGeometry.h
Added reference from vertex to candidate (Andrea)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeometry.h
index 02248313d7c17a581618440c6cb85950621c6951..2b3b06e77c2e69966593bcd770d60dc2e0d44273 100644 (file)
 // 
 //*-- Author: Yves Schutz (SUBATECH)
 
-#include <assert.h> 
-
 // --- ROOT system ---
 
-#include "TNamed.h"
-#include "TString.h"
-#include "TObjArray.h"
-#include "TVector3.h" 
-
 // --- AliRoot header files ---
 
 #include "AliGeometry.h"
 #include "AliPHOSEMCAGeometry.h"
 #include "AliPHOSCPVGeometry.h"
-#include "AliPHOSPPSDGeometry.h"
 #include "AliPHOSSupportGeometry.h"
-#include "AliPHOSRecPoint.h"
 
+class AliPHOSRecPoint;
+class TVector3;
 
 class AliPHOSGeometry : public AliGeometry {
 
 public: 
 
-  AliPHOSGeometry() {
-    // default ctor 
-    // must be kept public for root persistency purposes, but should never be called by the outside world
-    fPHOSAngle = 0 ; 
-  } ;  
-
-  AliPHOSGeometry(const AliPHOSGeometry & geom) {
-    // cpy ctor requested by Coding Convention but not yet needed
-    assert(0==1) ;
-  } 
+  AliPHOSGeometry() ;
+  AliPHOSGeometry(const AliPHOSGeometry & geom) ;
   
   virtual ~AliPHOSGeometry(void) ; 
   static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ; 
   static AliPHOSGeometry * GetInstance() ; 
-  virtual void  GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const ;
-  virtual void  GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
-
-  AliPHOSGeometry & operator = (const AliPHOSGeometry  & rvalue) const {
-    // assignement operator requested by coding convention but not needed
-    assert(0==1) ;
-    return *(GetInstance()) ; 
+  virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrixF & /* gmat */) const 
+                 {GetGlobal(RecPoint,gpos); }
+  virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
+  virtual void   GetGlobalPHOS(const AliPHOSRecPoint* RecPoint, TVector3 & gpos) const ;
+  virtual void   GetGlobalPHOS(const AliPHOSRecPoint* RecPoint, TVector3 & gpos, TMatrixF & /* gmat */) const 
+                 {GetGlobalPHOS(RecPoint,gpos); }
+  virtual Bool_t Impact(const TParticle * particle) const ;
+
+  AliPHOSGeometry & operator = (const AliPHOSGeometry  & /*rvalue*/) {
+    Fatal("operator =", "not implemented") ;
+    return *this ;    
   }
  
   // General
 
-  static TString Degre(void) {
-    // a global for degree (deg)
-    return TString("deg") ; 
-  }
-
-  static TString Radian(void) { 
-    // a global for radian (rad)
-    return TString("rad") ; 
-  }
-
-  Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) ; // converts the absolute PHOS numbering to a relative 
-
-  void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() );
-                                                         // calculates the angular coverage in theta and phi of a EMC module
-  void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) ; 
-                                                         // calculates the angular coverage in theta and phi of a 
-                                                         // single crystal in a EMC module
-
-  void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & x, Double_t & z) ; 
-                                                         // calculates the impact coordinates of a neutral particle  
-                                                         // emitted in direction theta and phi in ALICE
-  void   RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) ; // gets the position of element (pad or Xtal) relative to 
-                                                                         // center of PHOS module  
-  void   RelPosInAlice(const Int_t AbsId, TVector3 &  pos) ;             // gets the position of element (pad or Xtal) relative to 
-                                                                         // Alice
-  Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) ;         // converts the absolute PHOS numbering to a relative 
-
-  Bool_t  IsInitialized(void)                  const { return fgInit ; }  
+  static TString Degre(void) { return TString("deg") ; }  // a global for degree (deg)
+
+  static TString Radian(void){ return TString("rad") ; }  // a global for radian (rad)
+
+  Bool_t AbsToRelNumbering(Int_t AbsId, Int_t * RelId) const ; 
+                                          // converts the absolute PHOS numbering to a relative 
+
+//  void EmcModuleCoverage(Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, 
+//                                       Double_t & pM, Option_t * opt = Radian() ) const ;
+//                                         // calculates the angular coverage in theta and phi of a EMC module
+//  void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ; 
+//                                         // calculates the angular coverage in theta and phi of a  
+//                                         // single crystal in a EMC module
+
+  void ImpactOnEmc(Double_t * vtx, Double_t theta, Double_t phi, 
+                  Int_t & ModuleNumber, Double_t & z, Double_t & x) const ; 
+//  void ImpactOnEmc(const TVector3& vec, Int_t & ModuleNumber, 
+//                      Double_t & z, Double_t & x) const ; 
+//  void ImpactOnEmc(const TParticle& p, Int_t & ModuleNumber, 
+//                      Double_t & z, Double_t & x) const ; 
+//                                        // calculates the impact coordinates of a neutral particle  
+//                                         // emitted in direction theta and phi in ALICE
+  Bool_t IsInEMC(Int_t id) const { if (id > GetNModules() *  GetNCristalsInModule() ) return kFALSE; return kTRUE; } 
+  void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ; 
+                                         // gets the position of element (pad or Xtal) relative to 
+                                         // center of PHOS module  
+  void RelPosInAlice(Int_t AbsId, TVector3 &  pos) const ;             
+                                         // gets the position of element (pad or Xtal) relative to Alice
+  Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ;         
+                                         // converts the absolute PHOS numbering to a relative 
+  void  RelPosToAbsId(Int_t module, Double_t x, Double_t z, Int_t & AbsId) const; 
+                                         // converts local PHOS-module (x, z) coordinates to absId 
+  void  GetIncidentVector(const TVector3 &vtx, Int_t module, Float_t x, Float_t z, TVector3& vInc) const ;
+                                         //calculates vector from vertex to current point in module local frame
+  void  Local2Global(Int_t module, Float_t x, Float_t z, TVector3 &globaPos) const ;
+
+  Bool_t IsInitialized(void)                  const { return fgInit ; }  
                                                                        
   // Return general PHOS parameters
+  Int_t    GetNModules(void)                    const { return fNModules ; }
+  Float_t  GetPHOSAngle(Int_t index)            const { return fPHOSAngle[index-1] ; }
+  Float_t* GetPHOSParams(void)                        { return fPHOSParams;}  //Half-sizes of PHOS trapecoid
+  Float_t  GetIPtoUpperCPVsurface(void)         const { return fIPtoUpperCPVsurface ; }
+  Float_t  GetOuterBoxSize(Int_t index)         const { return 2.*fPHOSParams[index]; }
+  Float_t  GetCrystalSize(Int_t index)          const { return fGeometryEMCA->GetCrystalSize(index) ;  }
+  Float_t  GetCellStep(void)                    const { return 2.*fGeometryEMCA->GetAirCellHalfSize()[0];}
+
+  Float_t GetModuleCenter(Int_t module, Int_t axis) const {
+    return fModuleCenter[module][axis];}
+  Float_t GetModuleAngle(Int_t module, Int_t axis, Int_t angle) const {
+    return fModuleAngle[module][axis][angle];}
+  
+
+  // Return ideal EMCA geometry parameters
 
-  Int_t   GetNModules(void)                    const { return fNModules ; }
-  Int_t   GetNPPSDModules(void)                const { return fNPPSDModules ; }
-  Int_t   GetNCPVModules(void)                 const { return fNModules - fNPPSDModules ; }
-  Float_t GetPHOSAngle(Int_t index)            const { return fPHOSAngle[index-1] ; }
-
-  // Return EMCA geometrical parameters
-
-  Float_t GetOuterBoxSize(Int_t index)         const { return fGeometryEMCA->GetOuterBoxSize(index);            }
-  Float_t GetAirFilledBoxSize(Int_t index)     const { return fGeometryEMCA->GetAirFilledBoxSize(index) ;       }
-  Float_t GetCrystalHolderThickness(void)      const { return fGeometryEMCA->GetCrystalHolderThickness() ;      }
-  Float_t GetCrystalSize(Int_t index)          const { return fGeometryEMCA->GetCrystalSize(index) ;            }
-  Float_t GetCrystalSupportHeight(void)        const { return fGeometryEMCA->GetCrystalSupportHeight() ;        }
-  Float_t GetCrystalWrapThickness(void)        const { return fGeometryEMCA->GetCrystalWrapThickness() ;        }
-  Float_t GetGapBetweenCrystals(void)          const { return fGeometryEMCA->GetGapBetweenCrystals() ;          }
-  Float_t GetIPtoCrystalSurface(void)          const { return fGeometryEMCA->GetIPtoCrystalSurface() ;          }
-  Float_t GetIPtoOuterCoverDistance(void)      const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ;      }
-  Float_t GetLowerThermoPlateThickness(void)   const { return fGeometryEMCA->GetLowerThermoPlateThickness() ;   }
-  Float_t GetLowerTextolitPlateThickness(void) const { return fGeometryEMCA->GetLowerTextolitPlateThickness() ; }
-  Float_t GetModuleBoxThickness(void)          const { return fGeometryEMCA->GetModuleBoxThickness() ;          }
-  Int_t   GetNPhi(void)                        const { return fGeometryEMCA->GetNPhi() ;                        }
-  Int_t   GetNZ(void)                          const { return fGeometryEMCA->GetNZ() ;                          }
-  Float_t GetOuterBoxThickness(Int_t index)    const { return fGeometryEMCA->GetOuterBoxThickness(index) ;      }
-  Float_t GetPinDiodeSize(Int_t index)         const { return fGeometryEMCA->GetPinDiodeSize(index) ;           }
-  Float_t GetSecondUpperPlateThickness(void)   const { return fGeometryEMCA->GetSecondUpperPlateThickness() ;   }
-  Float_t GetSupportPlateThickness(void)       const { return fGeometryEMCA->GetSupportPlateThickness() ;       }
-  Float_t GetTextolitBoxSize(Int_t index)      const { return fGeometryEMCA->GetTextolitBoxSize(index) ;        }
-  Float_t GetTextolitBoxThickness(Int_t index) const { return fGeometryEMCA->GetTextolitBoxThickness(index);    }
-  Float_t GetUpperPlateThickness(void)         const { return fGeometryEMCA->GetUpperPlateThickness() ;         }
-  Float_t GetUpperCoolingPlateThickness(void)  const { return fGeometryEMCA->GetUpperCoolingPlateThickness() ;  }
-
-  // Return PPSD geometrical parameters
-
-  Float_t GetAnodeThickness(void)              const { return fGeometryPPSD->GetAnodeThickness();         }
-  Float_t GetAvalancheGap(void)                const { return fGeometryPPSD->GetAvalancheGap();           }
-  Float_t GetCathodeThickness(void)            const { return fGeometryPPSD->GetCathodeThickness();       }
-  Float_t GetCompositeThickness(void)          const { return fGeometryPPSD->GetCompositeThickness();     }
-  Float_t GetConversionGap(void)               const { return fGeometryPPSD->GetConversionGap();          }
-  Float_t GetLeadConverterThickness(void)      const { return fGeometryPPSD->GetLeadConverterThickness(); }
-  Float_t GetLeadToMicro2Gap(void)             const { return fGeometryPPSD->GetLeadToMicro2Gap();        }
-  Float_t GetLidThickness(void)                const { return fGeometryPPSD->GetLidThickness();           }
-  Float_t GetMicromegas1Thickness(void)        const { return fGeometryPPSD->GetMicromegas1Thickness();   }
-  Float_t GetMicromegas2Thickness(void)        const { return fGeometryPPSD->GetMicromegas2Thickness();   }
-  Float_t GetMicromegasWallThickness(void)     const { return fGeometryPPSD->GetMicromegasWallThickness();}
-  Float_t GetMicro1ToLeadGap(void)             const { return fGeometryPPSD->GetMicro1ToLeadGap();        }
-  Int_t   GetNumberOfModulesPhi(void)          const { return fGeometryPPSD->GetNumberOfModulesPhi();     }
-  Int_t   GetNumberOfModulesZ(void)            const { return fGeometryPPSD->GetNumberOfModulesZ();       }
-  Int_t   GetNumberOfPadsPhi(void)             const { return fGeometryPPSD->GetNumberOfPadsPhi();        }
-  Int_t   GetNumberOfPadsZ(void)               const { return fGeometryPPSD->GetNumberOfPadsZ();          }
-  Float_t GetPCThickness(void)                 const { return fGeometryPPSD->GetPCThickness();            }
-  Float_t GetPhiDisplacement(void)             const { return fGeometryPPSD->GetPhiDisplacement();        }
-  Float_t GetPPSDModuleSize(Int_t index)       const { return fGeometryPPSD->GetPPSDModuleSize(index);    }
-  Float_t GetZDisplacement(void)               const { return fGeometryPPSD->GetZDisplacement();          }
-  void    SetLeadConverterThickness(Float_t x) const {        fGeometryPPSD->SetLeadConverterThickness(x);}
-
-  // Return CPV geometrical parameters
+  AliPHOSEMCAGeometry * GetEMCAGeometry()      const {return fGeometryEMCA ;}
+  Float_t   GetIPtoCrystalSurface(void)        const { return fGeometryEMCA->GetIPtoCrystalSurface() ; }
+  Float_t   GetIPtoOuterCoverDistance(void)    const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ; }
+  Int_t     GetNPhi(void)                      const { return fGeometryEMCA->GetNPhi() ; }
+  Int_t     GetNZ(void)                        const { return fGeometryEMCA->GetNZ() ; }
+  Int_t     GetNCristalsInModule(void)         const { return fGeometryEMCA->GetNPhi() * fGeometryEMCA->GetNZ() ; }
 
+  // Return ideal CPV geometry parameters
   Int_t   GetNumberOfCPVLayers(void)           const { return fGeometryCPV ->GetNumberOfCPVLayers();      }
-  Bool_t  IsLeadConverterExists(void)          const { return fGeometryCPV->IsLeadConverterExists();      }
   Float_t GetCPVActiveSize(Int_t index)        const { return fGeometryCPV->GetCPVActiveSize(index);      }
   Int_t   GetNumberOfCPVChipsPhi(void)         const { return fGeometryCPV->GetNumberOfCPVChipsPhi();     }
   Int_t   GetNumberOfCPVChipsZ(void)           const { return fGeometryCPV->GetNumberOfCPVChipsZ();       }
@@ -167,72 +130,59 @@ public:
   Float_t GetCPVCuNiFoilThickness(void)        const { return fGeometryCPV->GetCPVCuNiFoilThickness();    }
   Float_t GetFTPosition(Int_t index)           const { return fGeometryCPV->GetFTPosition(index);         }
   Float_t GetCPVFrameSize(Int_t index)         const { return fGeometryCPV->GetCPVFrameSize(index);       }
+  Float_t GetCPVBoxSize(Int_t index)           const { return fGeometryCPV ->GetCPVBoxSize(index);        } 
+  Float_t GetIPtoCPVDistance(void)             const { return  GetIPtoOuterCoverDistance() - 
+                                                              GetCPVBoxSize(1) - 1.0; }
 
-  // Common PPSD and CPV parameters
-
-  Float_t GetCPVBoxSize(Int_t index)  const { 
-    if      (strcmp(fName,"GPS2")==0) return fGeometryPPSD->GetCPVBoxSize(index);
-    else if (strcmp(fName,"IHEP")==0) return fGeometryCPV ->GetCPVBoxSize(index);
-    else if (strcmp(fName,"MIXT")==0) return TMath::Max(fGeometryCPV ->GetCPVBoxSize(index),
-                                                       fGeometryPPSD->GetCPVBoxSize(index));
-    else                              return 0;
-  }
-
-  // Mixed EMCA and PPSD parameters
-
-  Float_t GetIPtoPpsdUp(void)                  const {
-    return (GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) + GetPPSDModuleSize(1)/2 ); } 
-  Float_t GetIPtoTopLidDistance(void)          const { 
-    return  GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) - 1. ; } 
-  Float_t GetIPtoPpsdLow(void)                 const { 
-    return (GetIPtoOuterCoverDistance() - GetPPSDModuleSize(1)/2 ); } 
 
-  // Mixed EMCA and CPV parameters
+  // Return real CPV geometry parameters
+  void GetModuleCenter(TVector3& center, const char *det, Int_t module) const;
+  void Global2Local(TVector3& localPosition,
+                   const TVector3& globalPosition,
+                   Int_t module) const;
 
-  Float_t GetIPtoCPVDistance(void)             const {
-    return  GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) - 1.0; }
-
-  // Return PHOS' support geometrical parameters
+  // Return PHOS' support geometry parameters
 
   Float_t GetRailOuterSize(Int_t index)  const { return fGeometrySUPP->GetRailOuterSize(index); }
   Float_t GetRailPart1    (Int_t index)  const { return fGeometrySUPP->GetRailPart1    (index); }
   Float_t GetRailPart2    (Int_t index)  const { return fGeometrySUPP->GetRailPart2    (index); }
   Float_t GetRailPart3    (Int_t index)  const { return fGeometrySUPP->GetRailPart3    (index); }
   Float_t GetRailPos      (Int_t index)  const { return fGeometrySUPP->GetRailPos      (index); }
-  Float_t GetRailLength   ()             const { return fGeometrySUPP->GetRailLength   ();      }
-  Float_t GetDistanceBetwRails()         const { return fGeometrySUPP->GetDistanceBetwRails();  }
-  Float_t GetRailsDistanceFromIP()       const { return fGeometrySUPP->GetRailsDistanceFromIP();}
+  Float_t GetRailLength   (void)         const { return fGeometrySUPP->GetRailLength   ();      }
+  Float_t GetDistanceBetwRails(void)     const { return fGeometrySUPP->GetDistanceBetwRails();  }
+  Float_t GetRailsDistanceFromIP(void)   const { return fGeometrySUPP->GetRailsDistanceFromIP();}
   Float_t GetRailRoadSize (Int_t index)  const { return fGeometrySUPP->GetRailRoadSize (index); }
-  Float_t GetCradleWallThickness()       const { return fGeometrySUPP->GetCradleWallThickness();}
+  Float_t GetCradleWallThickness(void)   const { return fGeometrySUPP->GetCradleWallThickness();}
   Float_t GetCradleWall   (Int_t index)  const { return fGeometrySUPP->GetCradleWall   (index); }
   Float_t GetCradleWheel  (Int_t index)  const { return fGeometrySUPP->GetCradleWheel  (index); }
+  void Init(void) ;            // steering method for PHOS and PPSD/CPV
 
-protected:
 
-  AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) { 
-    // ctor only for internal usage (singleton)
-    Init() ; 
-  }
-  void Init(void) ;            // steering method for PHOS and PPSD/CPV
+protected:
 
+  AliPHOSGeometry(const Text_t* name, const Text_t* title="") ;
 private:
 
   Int_t                    fNModules ;       // Number of modules constituing PHOS
-  Int_t                    fNPPSDModules ;   // Number of PPSD modules
   Float_t                  fAngle ;          // Position angles between modules
   Float_t                 *fPHOSAngle ;      //[fNModules] Position angles of modules
+  Float_t                  fPHOSParams[4] ;  // Half-sizes of PHOS trapecoid
+  Float_t                  fIPtoUpperCPVsurface; // Minimal distance from IP to PHOS
+  Float_t                  fCrystalShift ;   //Distance from crystal center to front surface
+  Float_t                  fCryCellShift ;   //Distance from crystal center to front surface
   TObjArray               *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
   AliPHOSEMCAGeometry     *fGeometryEMCA ;   // Geometry object for Electromagnetic calorimeter
   AliPHOSCPVGeometry      *fGeometryCPV ;    // Geometry object for CPV  (IHEP)
-  AliPHOSPPSDGeometry     *fGeometryPPSD ;   // Geometry object for PPSD (GPS2)
   AliPHOSSupportGeometry  *fGeometrySUPP ;   // Geometry object for PHOS support
+  Float_t fModuleCenter[5][3];   // xyz-position of the module center
+  Float_t fModuleAngle[5][3][2]; // polar and azymuth angles for 3 axes of modules
 
   void                     SetPHOSAngles();  // calculates the PHOS modules PHI angle
 
   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
   static Bool_t fgInit ;            // Tells if geometry has been succesfully set up 
 
-  ClassDef(AliPHOSGeometry,1)       // PHOS geometry class 
+  ClassDef(AliPHOSGeometry,2)       // PHOS geometry class 
 
 } ;