//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // PndTpc readout pad // Geometry definition for PndTpc Digitization // // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Sebastian Neubert TUM (original author) // Cristoforo Simonetto TUM // // //----------------------------------------------------------- #ifndef TPCPAD_HH #define TPCPAD_HH // Base Class Headers ---------------- // Collaborating Class Headers ------- #include // remove if you do not need streaming op #include #include // Collaborating Class Declarations -- class PndTpcAbsPadShape; class PndTpcPad { public: // Constructors/Destructors --------- PndTpcPad(); PndTpcPad(const double x, const double y, const double angle, PndTpcAbsPadShape* const shape, const unsigned int sectorID, const unsigned int ID); ~PndTpcPad(){;} // Operators friend bool operator== (const PndTpcPad& lhs, const PndTpcPad& rhs); friend bool operator< (const PndTpcPad& lhs, const PndTpcPad& rhs); friend std::ostream& operator<< (std::ostream& s, const PndTpcPad& me); // Accessors ----------------------- double x() const {return fx;} double y() const {return fy;} double angle() const {return fangle;} double pos(const int i) const { if(i==0) return fx; else if(i==1) return fy; else if(i==2) return fangle; else throw;} PndTpcAbsPadShape* shape() const {return fshape;} unsigned int sectorId() const {return fsectorId;}; unsigned int padId() const {return fid;} unsigned int id() const{return fid;} // Modifiers ----------------------- void setx(const double X){fx=X;} void sety(const double Y){fy=Y;} void setangle(const double Angle){ fangle=Angle; EvalBoundingRect();} void setshape(PndTpcAbsPadShape* const Shape){ fshape = Shape; EvalBoundingRect();} void setsectorId(const unsigned int Id){fsectorId=Id;} void addNeighbour(const unsigned int& Id){fneighbourIds.push_back(Id);} bool removeNeighbour(unsigned int Id); unsigned int nNeighbours() const {return fneighbourIds.size();} unsigned int getNeighbour(const unsigned int& Id) const {return fneighbourIds[Id];} // Operations ---------------------- bool Contains(const double X, const double Y) const; bool CircleIntersection(const double X, const double Y, const double r) const; double GetValue(const double X, const double Y) const; //returns the number of points, you can get with GetBoundaryPoint int GetNBoundaryPoints() const; //returns those points on the boundary, which describe the form void GetBoundaryPoint(const int index, double& X, double& Y) const; void Draw(int c=1) const; private: // Private Data Members ------------ // Center of gravity double fx; double fy; //angle (in math. direction of rotation, in rad) between padplane and shape double fangle; //The minimal sizes for a bounding box with the origin in the centre double fwidth; double fheight; PndTpcAbsPadShape* fshape; unsigned int fsectorId; unsigned int fid; std::vector fneighbourIds; // Private Methods ----------------- void ToShapeCoord(double& xP, double& yP) const; void ToPlaneCoord(double& xP, double& yP) const; void EvalBoundingRect(); public: ClassDef(PndTpcPad,1) }; #endif //-------------------------------------------------------------- // $Log$ //--------------------------------------------------------------