#ifndef TStnCalGeometry_hh #define TStnCalGeometry_hh #include #include "TMath.h" #include "TObject.h" #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/CalParameters.hh" class TStnCalGeometry : public TObject { protected: // approximate values of theta for the // centers of the towers [in degrees] double fTheta [TOWER_NETA ]; double fCotMin[TOWER_NETA ]; double fCotMax[TOWER_NETA ]; double fEta [TOWER_NETA+1]; double fThetaMP[NMPSIDE][NMPTOW]; double fEtaMP [NMPSIDE][NMPTOW]; double fPhiMP [NMPSIDE][NMPTOW]; //----------------------------------------------------------------------------- public: TStnCalGeometry(); virtual ~TStnCalGeometry(); void Init(); //----------------------------------------------------------------------------- // static methods //----------------------------------------------------------------------------- static Int_t IPhi (int TowerKey) { return (TowerKey ) & 0x3f ; } static Int_t IEta (int TowerKey) { return (TowerKey >> 8) & 0x3f ; } static Int_t ValidCode(int TowerKey) { return (TowerKey >> 16) & 0xffff; } Int_t Type (Int_t IEta) const { return TOWER_TYPE[IEta]; } // Do not use these accessors for MiniPlug // center of tower Double_t Theta (Int_t IEta) { return fTheta[IEta]; } Double_t Eta (Int_t IEta) { return fEta [IEta]; } Double_t EtaFromKey (Int_t TowerKey) { return Eta(IEta(TowerKey)); } Int_t IEtaDet (Float_t DetEta); // eta index from DetEte Int_t IEtaCot (Float_t CotTheta); // eta index from CotTheta // from position in tower Int_t IEta (Float_t x, Float_t y, Float_t z); Double_t Phi (Int_t IEta, Int_t IPhi); Double_t Phi (Int_t TowerKey) { return Phi(IEta(TowerKey),IPhi(TowerKey)); } Int_t IPhi (Int_t IEta, Float_t phi); // Use these - only for MiniPlug Double_t ThetaMP (Int_t Ieta, Int_t Iphi) { return fThetaMP[MPISide(Ieta)][MPITow(Ieta, Iphi)]; } Double_t EtaMP (Int_t Ieta, Int_t Iphi) { return fEtaMP [MPISide(Ieta)][MPITow(Ieta, Iphi)]; } Double_t PhiMP (Int_t Ieta, Int_t Iphi) { return fPhiMP [MPISide(Ieta)][MPITow(Ieta, Iphi)]; } Int_t MPISide(int ieta) const { // return MP side (0-1) for a given ieta,iphi if (ieta >=0 && ieta <= 3 ) return 0; if (ieta >= 47 && ieta <= 51) return 1; return -1; } Int_t MPITow (int ieta, int iphi) const ; void Clear(Option_t* opt = ""); void Print(Option_t* opt = "") const; ClassDef (TStnCalGeometry,1) }; #endif