Go to the documentation of this file.00001 #ifndef FastSimulation_CaloGeometryTools_CrystalPad
00002 #define FastSimulation_CaloGeometryTools_CrystalPad
00003
00004 #include "Geometry/CaloTopology/interface/CaloDirection.h"
00005
00006 #include "CLHEP/Vector/TwoVector.h"
00007 #include "DataFormats/Math/interface/Vector3D.h"
00008
00009 #include "FastSimulation/CaloGeometryTools/interface/Transform3DPJ.h"
00010
00011 #include <vector>
00012
00013
00014 class CrystalPad
00015 {
00016 public:
00017
00018 typedef math::XYZVector XYZVector;
00019 typedef math::XYZVector XYZPoint;
00020 typedef ROOT::Math::Transform3DPJ Transform3D;
00021 typedef ROOT::Math::Transform3DPJ::Point Point;
00022
00023
00024 CrystalPad() { dummy_ = true;};
00026 CrystalPad(unsigned number, const std::vector<CLHEP::Hep2Vector>& corners);
00030 CrystalPad(unsigned number, int onEcal,
00031 const std::vector<XYZPoint>& corners,
00032 const XYZPoint& origin,
00033 const XYZVector& vec1,
00034 const XYZVector& vec2);
00035
00036 CrystalPad(unsigned number,
00037 const std::vector<XYZPoint>& corners,
00038 const Transform3D&,
00039 double scaf=1.,bool bothdirections=false);
00040
00041 CrystalPad(const CrystalPad& right);
00042
00043 CrystalPad& operator = (const CrystalPad& rhs );
00044
00045 ~CrystalPad(){;};
00046
00048 bool inside(const CLHEP::Hep2Vector & point,bool debug=false) const;
00050
00051
00053
00054
00056 inline const std::vector<CLHEP::Hep2Vector> & getCorners() const {return corners_;}
00057
00059 void resetCorners();
00060
00062 void print() const;
00063
00065 inline double survivalProbability() const { return survivalProbability_;};
00066 inline void setSurvivalProbability(double val) {survivalProbability_=val;};
00067
00069 CLHEP::Hep2Vector& edge(unsigned iside,int n) ;
00070
00072 CLHEP::Hep2Vector & edge(CaloDirection);
00073
00075 inline unsigned getNumber() const{return number_;};
00076
00078
00079
00080
00081
00082
00083
00084
00085
00086 inline bool operator==(const CrystalPad& quad) const
00087 {
00088
00089 return quad.getNumber()==this->getNumber();
00090 }
00091
00092 inline bool operator<(const CrystalPad& quad) const
00093 {
00094 return (center_.mag()<quad.center().mag());
00095 }
00096
00098 void extrems(double &xmin,double& xmax,double &ymin, double& ymax) const;
00099
00101 inline const CLHEP::Hep2Vector& center() const {return center_;}
00102
00104 void getDrawingCoordinates(std::vector<float>&x, std::vector<float>&y) const;
00105
00106
00107 private:
00108
00109 static std::vector<CLHEP::Hep2Vector> aVector;
00110
00111 std::vector<CLHEP::Hep2Vector> corners_;
00112 std::vector<CLHEP::Hep2Vector> dir_;
00113 unsigned number_;
00114 Transform3D trans_;
00115 ROOT::Math::Rotation3D rotation_;
00116 XYZVector translation_;
00117 double survivalProbability_;
00118 CLHEP::Hep2Vector center_;
00119 double epsilon_;
00120 bool dummy_;
00121 double yscalefactor_;
00122
00123 public:
00125 class padEqual
00126 {
00127 public:
00128 padEqual(unsigned cell):ref_(cell)
00129 {
00130
00131 };
00132 ~padEqual(){;};
00133 inline bool operator() (const CrystalPad & quad) const
00134 {
00135 return (ref_==quad.getNumber());
00136 }
00137 private:
00138 unsigned ref_;
00139 };
00140
00141
00142
00143 };
00144
00145 #include<iosfwd>
00146 std::ostream& operator <<(std::ostream& o , CrystalPad & quad);
00147
00148 #endif