File indexing completed on 2023-03-17 11:00:38
0001 #ifndef FastSimulation_CaloGeometryTools_CrystalPad
0002 #define FastSimulation_CaloGeometryTools_CrystalPad
0003
0004 #include "Geometry/CaloTopology/interface/CaloDirection.h"
0005
0006 #include "CLHEP/Vector/TwoVector.h"
0007 #include "DataFormats/Math/interface/Vector3D.h"
0008
0009 #include "FastSimulation/CaloGeometryTools/interface/Transform3DPJ.h"
0010
0011 #include <vector>
0012
0013 class CrystalPad {
0014 public:
0015 typedef math::XYZVector XYZVector;
0016 typedef math::XYZVector XYZPoint;
0017 typedef ROOT::Math::Transform3DPJ Transform3D;
0018 typedef ROOT::Math::Transform3DPJ::Point Point;
0019
0020 CrystalPad() { dummy_ = true; };
0021
0022 CrystalPad(unsigned number, const std::vector<CLHEP::Hep2Vector>& corners);
0023
0024
0025
0026 CrystalPad(unsigned number,
0027 int onEcal,
0028 const std::vector<XYZPoint>& corners,
0029 const XYZPoint& origin,
0030 const XYZVector& vec1,
0031 const XYZVector& vec2);
0032
0033 CrystalPad(unsigned number,
0034 const std::vector<XYZPoint>& corners,
0035 const Transform3D&,
0036 double scaf = 1.,
0037 bool bothdirections = false);
0038
0039 CrystalPad(const CrystalPad& right);
0040
0041 CrystalPad& operator=(const CrystalPad& rhs);
0042
0043 ~CrystalPad() { ; };
0044
0045
0046 bool inside(const CLHEP::Hep2Vector& point, bool debug = false) const;
0047
0048
0049
0050
0051
0052
0053
0054 inline const std::vector<CLHEP::Hep2Vector>& getCorners() const { return corners_; }
0055
0056
0057 void resetCorners();
0058
0059
0060 void print() const;
0061
0062
0063 inline double survivalProbability() const { return survivalProbability_; };
0064 inline void setSurvivalProbability(double val) { survivalProbability_ = val; };
0065
0066
0067 CLHEP::Hep2Vector& edge(unsigned iside, int n);
0068
0069
0070 CLHEP::Hep2Vector& edge(CaloDirection);
0071
0072
0073 inline unsigned getNumber() const { return number_; };
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 inline bool operator==(const CrystalPad& quad) const {
0085
0086 return quad.getNumber() == this->getNumber();
0087 }
0088
0089 inline bool operator<(const CrystalPad& quad) const { return (center_.mag() < quad.center().mag()); }
0090
0091
0092 void extrems(double& xmin, double& xmax, double& ymin, double& ymax) const;
0093
0094
0095 inline const CLHEP::Hep2Vector& center() const { return center_; }
0096
0097
0098 void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y) const;
0099
0100 private:
0101 static std::vector<CLHEP::Hep2Vector> aVector;
0102
0103 std::vector<CLHEP::Hep2Vector> corners_;
0104 std::vector<CLHEP::Hep2Vector> dir_;
0105 unsigned number_;
0106 Transform3D trans_;
0107 ROOT::Math::Rotation3D rotation_;
0108 XYZVector translation_;
0109 double survivalProbability_;
0110 CLHEP::Hep2Vector center_;
0111 double epsilon_;
0112 bool dummy_;
0113 double yscalefactor_;
0114
0115 public:
0116
0117 class padEqual {
0118 public:
0119 padEqual(unsigned cell)
0120 : ref_(cell){
0121
0122 };
0123 ~padEqual() { ; };
0124 inline bool operator()(const CrystalPad& quad) const { return (ref_ == quad.getNumber()); }
0125
0126 private:
0127 unsigned ref_;
0128 };
0129 };
0130
0131 #include <iosfwd>
0132 std::ostream& operator<<(std::ostream& o, CrystalPad& quad);
0133
0134 #endif