// $Id: PmtGeometry.hh,v 1.15 2005/04/19 22:33:28 thea Exp $ // Author: D.Demarco, M.Pallavicini /***************************************************************************** * ESAF: Euso Simulation and Analysis Framework * * * * Id: ParamOpticalSystem * * Package: Optics * * Coordinator: Marco.Pallavicini * * * *****************************************************************************/ #ifndef __PMTGEOMETRY_H_ #define __PMTGEOMETRY_H_ #include #include "Photon.hh" #include "TVector3.h" #include "EsafConfigurable.hh" //#define PMT_TOLERANCE 0.0002 #define PMT_TOLERANCE 1e-6 enum OAFace {TOP, RIGHT, LEFT, FRONT, BACK, BOTTOM}; class Photomultiplier; class OpticalAdaptor; typedef Int_t ChannelUniqueId; //////////////////////////////////////////////////////////////////////////////// // // // PmtGeometry // // // // Geometrical description of any squared photomultiplier // // // //////////////////////////////////////////////////////////////////////////////// class PmtGeometry : public EsafConfigurable { public: // ctor PmtGeometry(TVector3, TVector3, TVector3); // dtor virtual ~PmtGeometry(); EsafConfigClass(Electronics,PmtGeometry); // return parameters for this kind of pmt static Int_t NumPads() {return fgNumPads;} static Int_t Rows() {return fgNumRows;} static Double_t Side() {return fgSide;} static Double_t PadSide() {return fgPadSide;} static Double_t DeadBorder() {return fgDeadBorder;} static Double_t DeadInnerStrip() {return fgDeadInner;} // static reset class variables static void ResetClass(); // set pointers to nearest neighbors void SetNearest(PmtGeometry*, PmtGeometry*, PmtGeometry*, PmtGeometry*); // set and get parent pmt inline void SetPmt(Photomultiplier* pm) {pPmt = pm;} Photomultiplier* Pmt() const {return pPmt;} // set and get optical adaptor inline void SetOA( OpticalAdaptor *oa ){pOA = oa;} OpticalAdaptor* GetOA() const { return pOA;} void InsertOA( OpticalAdaptor* oa ); // insert oa in front of the pmt and displace geometry back of oa->GetHeight() // local coordinate origin position in local FS coordinates inline const TVector3& Position() const {return fPosition;} // returns the position of the center of a pad (local FS coordinates) TVector3 Position(Int_t,Int_t) const; // row and col TVector3 Position(Int_t) const; // channel // normal to the photocathode in EUSO coordinates inline const TVector3& Normal() const {return fZAxis;} inline const TVector3& GetX() const {return fXAxis;} inline const TVector3& GetY() const {return fYAxis;} inline const TVector3& GetZ() const {return fZAxis;} // center TVector3 Center() const; // returns pad number hit by a Photon Int_t Pad(const Photon&) const; // returns true if the photon is within geometrical acceptance Bool_t IsInside(const Photon&) const; // returns true if the photon is within geometrical acceptance Double_t IsHit(const Photon&) const; // nearest neighbors const PmtGeometry* Nearest( OAFace ) const; // unique id handlers // set first unique id associated to this pmt inline void SetStartUniqueId(ChannelUniqueId start) {fStartUniqueId = start;} // get unique id for a given channel inline ChannelUniqueId GetUniqueId(Int_t ch) const {return (fStartUniqueId+ch);} // get first unique id belonging to this pmt inline ChannelUniqueId GetStartUniqueId() const {return fStartUniqueId;} // get last unique id belonging to this pmt inline ChannelUniqueId GetLastUniqueId() const {return (fStartUniqueId + NumPads()-1);} // get channel number (from 0 to pmtsize) given a unique id // returns -1 does not exist Int_t GetChannel(ChannelUniqueId id) const; // theta and phi corresponding to this pixel in field of view (center value) Double_t ThetaFOV(Int_t nch) const; Double_t PhiFOV(Int_t nch) const; private: // set geometry paramters of the pmt (class variables) static void SetPmtGeometry(); // class variables with geometry parameters static Int_t fgNumPads; // number of active pads static Int_t fgNumRows; // number of rows and columns static Double_t fgSide; // physical total width of the pmt static Double_t fgDeadBorder; // thickness of external dead space static Double_t fgDeadInner; // thickness of internal space // ( between pads ) static Double_t fgPadSide; // width of one pad static TVector3* fgCorners[10][10]; // map of 3D points with the corner of // each pad (local coordinates) // convert from gloabl to local coordinate TVector3 LocalCoord( const TVector3& ) const; Int_t Pad( const TVector3&) const; // geometry position of this pmt TVector3 fPosition; // local coordinate origin position TVector3 fZAxis; // normal to the phocal surface TVector3 fYAxis; // y axis in global coordinate TVector3 fXAxis; // x axis in global coordinate // pointer to optical adaptor OpticalAdaptor *pOA; // pointers to nearest neighbors PmtGeometry *fRight, *fLeft, *fFront, *fBack; // parent pmt Photomultiplier* pPmt; // unique id ChannelUniqueId fStartUniqueId; static TVector3& Corner(Int_t r,Int_t c) {return *(fgCorners[r][c]);} ClassDef(PmtGeometry,0) }; #endif