]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSGeoUtils.h
Added functionality in AliPHOSTRURawReader to test if data 'Has Signal'
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeoUtils.h
1 #ifndef ALIPHOSGEOUTILS_H
2 #define ALIPHOSGEOUTILS_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 //_________________________________________________________________________
7 // class for geometry transformations in PHOS
8 // this class contains AiRoot-independent transformations,
9 // AliRoot part is in AliPHOSGeometry
10 // PHOS consists of the electromagnetic calorimeter (EMCA)
11 // charged particle veto (CPV) and support
12 // 
13 //*-- Author: Dmitri Peressounko (RRC "KI")
14
15 // --- ROOT system ---
16 #include "TNamed.h"
17
18 // --- AliRoot header files ---
19
20 class TGeoHMatrix ;
21 class TVector3;
22 class TParticle ;
23 class AliPHOSEMCAGeometry;
24 class AliPHOSCPVGeometry;
25 class AliPHOSSupportGeometry;
26
27 class AliPHOSGeoUtils : public TNamed {
28
29 public: 
30
31   AliPHOSGeoUtils() ;
32   AliPHOSGeoUtils(const Text_t* name, const Text_t* title="") ;
33   AliPHOSGeoUtils(const AliPHOSGeoUtils & geom) ;
34   
35   virtual ~AliPHOSGeoUtils(void) ; 
36   AliPHOSGeoUtils & operator = (const AliPHOSGeoUtils  & rvalue) ;
37
38   Bool_t AbsToRelNumbering(Int_t AbsId, Int_t * RelId) const ; 
39                                          // converts the absolute PHOS cell numbering to a relative 
40   Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ; 
41                                          // converts the absolute PHOS numbering to a relative         
42                                          
43   void RelPosInModule(const Int_t * relId, Float_t & y, Float_t & z) const ; 
44                                          // gets the position of element (pad or Xtal) relative to 
45                                          // center of PHOS module  
46   void RelPosToAbsId(Int_t module, Double_t x, Double_t z, Int_t & AbsId) const; 
47                                          // converts local PHOS-module (x, z) coordinates to absId 
48   void RelPosToRelId(Int_t module, Double_t x, Double_t z, Int_t * relId) const; 
49                                          // converts local PHOS-module (x, z) coordinates to relId 
50   void RelPosInAlice(Int_t AbsId, TVector3 &  pos) const ;             
51                                          // gets the position of element (pad or Xtal) relative to Alice
52
53   void Local2Global(Int_t module, Float_t x, Float_t z, TVector3 &globaPos) const ;
54               
55   void Global2Local(TVector3& localPosition,const TVector3& globalPosition,Int_t module) const ;
56
57   Bool_t GlobalPos2RelId(TVector3 & global, Int_t * relId) ;
58         //Tranfers global position into numbers in PHOS cols-raws
59         //Returns FALSE if local x,z beyond PHOS. Distance in perpendicular to PHOS direction is not checked.
60
61   Bool_t ImpactOnEmc(const TParticle * particle,Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
62                                          //Checks if NEUTRAL particle hits PHOS
63   Bool_t ImpactOnEmc(const Double_t * vtx, const TVector3& vec,                
64                    Int_t & ModuleNumber, Double_t & z, Double_t & x) const ; 
65                                          // calculates the impact coordinates of a neutral particle  
66                                          // emitted in direction theta and phi in ALICE
67   Bool_t ImpactOnEmc(const Double_t * vtx, const Double_t theta, const Double_t phi, 
68                    Int_t & ModuleNumber, Double_t & z, Double_t & x) const ; 
69                                          // calculates the impact coordinates of a neutral particle  
70                                          // emitted in direction theta and phi in ALICE
71   void  GetIncidentVector(const TVector3 &vtx, Int_t module, Float_t x, Float_t z, TVector3& vInc) const ;
72                                          //calculates vector from vertex to current point in module local frame
73
74   Bool_t IsInEMC(Int_t id) const { if (id > fNModules *  fNCristalsInModule ) return kFALSE; return kTRUE; } 
75
76   //Method to set shift-rotational matrixes from ESDHeader
77   void SetMisalMatrix(const TGeoHMatrix * m, Int_t mod) ;
78
79 protected:
80   //Returns shift-rotational matrixes for different volumes
81   const TGeoHMatrix * GetMatrixForModule(Int_t mod)const ;
82   const TGeoHMatrix * GetMatrixForStrip(Int_t mod, Int_t strip)const ;
83   const TGeoHMatrix * GetMatrixForCPV(Int_t mod)const ;
84   const TGeoHMatrix * GetMatrixForPHOS(Int_t mod)const ;
85
86 protected:
87
88   AliPHOSEMCAGeometry     *fGeometryEMCA ;   // Geometry object for Electromagnetic calorimeter
89   AliPHOSCPVGeometry      *fGeometryCPV ;    // Geometry object for CPV  (IHEP)
90   AliPHOSSupportGeometry  *fGeometrySUPP ;   // Geometry object for PHOS support
91  
92
93   Int_t fNModules ;          //Maximal designed number of modules in PHOS
94   Int_t fNCristalsInModule ; //Number of crystals in one module
95   Int_t fNPhi ;              //Number of crystals along Phi direction
96   Int_t fNZ ;                //Number of crystals along Z direction
97   Int_t fNumberOfCPVPadsPhi; //Number of CPV pads along Phi direction
98   Int_t fNumberOfCPVPadsZ ;  //Number of CPV pads along Z direction
99   Int_t fNCellsXInStrip ;    //Number of crystals in strip
100   Int_t fNCellsZInStrip ;    //Number of crystals in strip in Z direction 
101   Int_t fNStripZ ;           //Number of strips in Z direction
102
103   Float_t fCrystalShift ;    //Distance between center of module and crystal surface
104   Float_t fXtlArrSize[3] ;   //Total size of cristals array
105   Float_t fCryCellShift ; 
106   Float_t fCryStripShift ;
107   Float_t fCellStep ; 
108   Float_t fPadSizePhi ;      //Size of CPV pad in Phi direction
109   Float_t fPadSizeZ ;        //Size of CPV pad in Z direction
110   Float_t fCPVBoxSizeY ;
111
112   TGeoHMatrix* fEMCMatrix[5] ; //Orientations of crystalls array in modules
113   TGeoHMatrix* fStripMatrix[5][224];  //Orientations of strip units
114   TGeoHMatrix* fCPVMatrix[5] ; //Orientations of CPV
115   const TGeoHMatrix* fPHOSMatrix[5] ; //Orientations of PHOS modules
116
117   TClonesArray * fMisalArray ;
118
119   ClassDef(AliPHOSGeoUtils,2)       // PHOS geometry class 
120
121 } ;
122
123 #endif // AliPHOSGEOUTILS_H