//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Tpc readout pad // Geometry definition for Tpc 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 //Root headers #include "TVector3.h" // Collaborating Class Declarations -- class TpcAbsPadShape; class TpcPad { public: // Constructors/Destructors --------- TpcPad(); TpcPad(const double x, const double y, const double angle, TpcAbsPadShape* const shape, const unsigned int sectorID, const unsigned int ID); ~TpcPad(){;} // Operators friend bool operator== (const TpcPad& lhs, const TpcPad& rhs); friend bool operator< (const TpcPad& lhs, const TpcPad& rhs); friend std::ostream& operator<< (std::ostream& s, const TpcPad& 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;} TpcAbsPadShape* 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(TpcAbsPadShape* 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; double GetLTValue(const int X, const int Y) const; double GetWeight(const double amp, const double dirX, const double dirY); //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; std::vector GetBoundaryPoint(int index) const; double GetArea(); double GetAreaFractionBelowPlane(TVector3 origin, TVector3 normal); int IntersectWithPlane(TVector3 origin, TVector3 normal, TVector3& point1, TVector3& point2); //returns area fraction above plane (above is in direction of normal) //calculates line of intersection of plane and padplane, return: 0 if planes are parallel, 1 if planes coincide, 2 if planes intersect int FindIntersectionLine(TVector3 origin, TVector3 normal, TVector3& point, TVector3& direction); 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; TpcAbsPadShape* 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 RotToShapeCoord(double& xP, double& yP) const; void EvalBoundingRect(); public: ClassDef(TpcPad,1) }; #endif //-------------------------------------------------------------- // $Log$ //--------------------------------------------------------------