#ifndef ALIPHOSGEOUTILS_H
#define ALIPHOSGEOUTILS_H
#include "TNamed.h"
class TGeoHMatrix ;
class TVector3;
class TParticle ;
class AliPHOSEMCAGeometry;
class AliPHOSCPVGeometry;
class AliPHOSSupportGeometry;
class AliPHOSGeoUtils : public TNamed {
public:
AliPHOSGeoUtils() ;
AliPHOSGeoUtils(const Text_t* name, const Text_t* title="") ;
AliPHOSGeoUtils(const AliPHOSGeoUtils & geom) ;
virtual ~AliPHOSGeoUtils(void) ;
AliPHOSGeoUtils & operator = (const AliPHOSGeoUtils & rvalue) ;
Bool_t AbsToRelNumbering(Int_t AbsId, Int_t * RelId) const ;
Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ;
void RelPosInModule(const Int_t * relId, Float_t & y, Float_t & z) const ;
void RelPosToAbsId(Int_t module, Double_t x, Double_t z, Int_t & AbsId) const;
void RelPosToRelId(Int_t module, Double_t x, Double_t z, Int_t * relId) const;
void RelPosInAlice(Int_t AbsId, TVector3 & pos) const ;
void Local2Global(Int_t module, Float_t x, Float_t z, TVector3 &globaPos) const ;
void Global2Local(TVector3& localPosition,const TVector3& globalPosition,Int_t module) const ;
Bool_t GlobalPos2RelId(TVector3 & global, Int_t * relId) ;
Bool_t ImpactOnEmc(const TParticle * particle,Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
Bool_t ImpactOnEmc(const Double_t * vtx, const TVector3& vec,
Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
Bool_t ImpactOnEmc(const Double_t * vtx, const Double_t theta, const Double_t phi,
Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
void GetIncidentVector(const TVector3 &vtx, Int_t module, Float_t x, Float_t z, TVector3& vInc) const ;
Bool_t IsInEMC(Int_t id) const { if (id > fNModules * fNCristalsInModule ) return kFALSE; return kTRUE; }
void SetMisalMatrix(const TGeoHMatrix * m, Int_t mod) ;
protected:
const TGeoHMatrix * GetMatrixForModule(Int_t mod)const ;
const TGeoHMatrix * GetMatrixForStrip(Int_t mod, Int_t strip)const ;
const TGeoHMatrix * GetMatrixForCPV(Int_t mod)const ;
const TGeoHMatrix * GetMatrixForPHOS(Int_t mod)const ;
protected:
AliPHOSEMCAGeometry *fGeometryEMCA ;
AliPHOSCPVGeometry *fGeometryCPV ;
AliPHOSSupportGeometry *fGeometrySUPP ;
Int_t fNModules ;
Int_t fNCristalsInModule ;
Int_t fNPhi ;
Int_t fNZ ;
Int_t fNumberOfCPVPadsPhi;
Int_t fNumberOfCPVPadsZ ;
Int_t fNCellsXInStrip ;
Int_t fNCellsZInStrip ;
Int_t fNStripZ ;
Float_t fCrystalShift ;
Float_t fXtlArrSize[3] ;
Float_t fCryCellShift ;
Float_t fCryStripShift ;
Float_t fCellStep ;
Float_t fPadSizePhi ;
Float_t fPadSizeZ ;
Float_t fCPVBoxSizeY ;
TGeoHMatrix* fEMCMatrix[5] ;
TGeoHMatrix* fStripMatrix[5][224];
TGeoHMatrix* fCPVMatrix[5] ;
const TGeoHMatrix* fPHOSMatrix[5] ;
TClonesArray * fMisalArray ;
ClassDef(AliPHOSGeoUtils,2)
} ;
#endif // AliPHOSGEOUTILS_H