CMS 3D CMS Logo

CrystalPad.h
Go to the documentation of this file.
1 #ifndef FastSimulation_CaloGeometryTools_CrystalPad
2 #define FastSimulation_CaloGeometryTools_CrystalPad
3 
5 
6 #include "CLHEP/Vector/TwoVector.h"
8 //#include "Math/GenVector/Transform3D.h"
10 //C++ headers
11 #include <vector>
12 
13 class CrystalPad {
14 public:
19 
20  CrystalPad() { dummy_ = true; };
22  CrystalPad(unsigned number, const std::vector<CLHEP::Hep2Vector>& corners);
26  CrystalPad(unsigned number,
27  int onEcal,
28  const std::vector<XYZPoint>& corners,
29  const XYZPoint& origin,
30  const XYZVector& vec1,
31  const XYZVector& vec2);
32 
33  CrystalPad(unsigned number,
34  const std::vector<XYZPoint>& corners,
35  const Transform3D&,
36  double scaf = 1.,
37  bool bothdirections = false);
38 
39  CrystalPad(const CrystalPad& right);
40 
41  CrystalPad& operator=(const CrystalPad& rhs);
42 
43  ~CrystalPad() { ; };
44 
46  bool inside(const CLHEP::Hep2Vector& point, bool debug = false) const;
48  // bool globalinside(XYZPoint) const;
49 
51  // CLHEP::Hep2Vector localPoint(XYZPoint point) const;
52 
54  inline const std::vector<CLHEP::Hep2Vector>& getCorners() const { return corners_; }
55 
57  void resetCorners();
58 
60  void print() const;
61 
63  inline double survivalProbability() const { return survivalProbability_; };
64  inline void setSurvivalProbability(double val) { survivalProbability_ = val; };
65 
67  CLHEP::Hep2Vector& edge(unsigned iside, int n);
68 
70  CLHEP::Hep2Vector& edge(CaloDirection);
71 
73  inline unsigned getNumber() const { return number_; };
74 
76  /*
77  inline XYZPoint originalCoordinates(CLHEP::Hep2Vector point) const
78  {
79  XYZPoint p(point.x(),point.y(),0.);
80  return trans_.Inverse() * p;
81  }
82  */
83 
84  inline bool operator==(const CrystalPad& quad) const {
85  // std::cout << " First " << quad.getCellID() << " Second " << this->getCellID() << std::endl;
86  return quad.getNumber() == this->getNumber();
87  }
88 
89  inline bool operator<(const CrystalPad& quad) const { return (center_.mag() < quad.center().mag()); }
90 
92  void extrems(double& xmin, double& xmax, double& ymin, double& ymax) const;
93 
95  inline const CLHEP::Hep2Vector& center() const { return center_; }
96 
98  void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y) const;
99 
100 private:
101  static std::vector<CLHEP::Hep2Vector> aVector;
102 
103  std::vector<CLHEP::Hep2Vector> corners_;
104  std::vector<CLHEP::Hep2Vector> dir_;
105  unsigned number_;
107  ROOT::Math::Rotation3D rotation_;
110  CLHEP::Hep2Vector center_;
111  double epsilon_;
112  bool dummy_;
114 
115 public:
117  class padEqual {
118  public:
119  padEqual(unsigned cell)
120  : ref_(cell) {
121  // std::cout << " quadEqual " << ref_ << std::endl;
122  };
123  ~padEqual() { ; };
124  inline bool operator()(const CrystalPad& quad) const { return (ref_ == quad.getNumber()); }
125 
126  private:
127  unsigned ref_;
128  };
129 };
130 
131 #include <iosfwd>
132 std::ostream& operator<<(std::ostream& o, CrystalPad& quad);
133 
134 #endif
double survivalProbability_
Definition: CrystalPad.h:109
bool dummy_
Definition: CrystalPad.h:112
double yscalefactor_
Definition: CrystalPad.h:113
const std::vector< CLHEP::Hep2Vector > & getCorners() const
Check that the point (in the global frame) is inside the crystal.
Definition: CrystalPad.h:54
ROOT::Math::Rotation3D rotation_
Definition: CrystalPad.h:107
double survivalProbability() const
access methods to the survivalProbability
Definition: CrystalPad.h:63
ROOT::Math::Transform3DPJ::Point Point
Definition: CrystalPad.h:18
std::ostream & operator<<(std::ostream &o, CrystalPad &quad)
Definition: CrystalPad.cc:274
void extrems(double &xmin, double &xmax, double &ymin, double &ymax) const
xmin xmax, ymin ymax of the quad
Definition: CrystalPad.cc:246
void resetCorners()
Rescale the Quad to allow for some inaccuracy ...
Definition: CrystalPad.cc:261
const CLHEP::Hep2Vector & center() const
get the center
Definition: CrystalPad.h:95
CLHEP::Hep2Vector & edge(unsigned iside, int n)
access to the corners in direction iside; n=0,1
Definition: CrystalPad.cc:222
CrystalPad & operator=(const CrystalPad &rhs)
Definition: CrystalPad.cc:17
bool operator<(const CrystalPad &quad) const
Definition: CrystalPad.h:89
unsigned number_
Definition: CrystalPad.h:105
static std::vector< CLHEP::Hep2Vector > aVector
Definition: CrystalPad.h:101
ROOT::Math::Transform3DPJ Transform3D
Definition: CrystalPad.h:17
double epsilon_
Definition: CrystalPad.h:111
std::vector< double > vec1
Definition: HCALResponse.h:15
equality operator
Definition: CrystalPad.h:117
Transform3D trans_
Definition: CrystalPad.h:106
math::XYZVector XYZPoint
Definition: CrystalPad.h:16
PositionVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Point
Definition: Transform3DPJ.h:58
std::vector< CLHEP::Hep2Vector > dir_
Definition: CrystalPad.h:104
math::XYZVector XYZVector
Definition: CrystalPad.h:15
XYZVector translation_
Definition: CrystalPad.h:108
bool inside(const CLHEP::Hep2Vector &point, bool debug=false) const
Check that the point (in the local frame) is inside the crystal.
Definition: CrystalPad.cc:127
#define debug
Definition: HDRShower.cc:19
bool operator==(const CrystalPad &quad) const
get the coordinates in the original frame
Definition: CrystalPad.h:84
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< CLHEP::Hep2Vector > corners_
Definition: CrystalPad.h:103
CLHEP::Hep2Vector center_
Definition: CrystalPad.h:110
math::XYZVector XYZPoint
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y) const
for graphic debugging
Definition: CrystalPad.cc:284
unsigned getNumber() const
access to the number
Definition: CrystalPad.h:73
void setSurvivalProbability(double val)
Definition: CrystalPad.h:64
padEqual(unsigned cell)
Definition: CrystalPad.h:119
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
math::XYZVector XYZVector
Definition: RawParticle.h:26
bool operator()(const CrystalPad &quad) const
Definition: CrystalPad.h:124
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void print() const
print
Definition: CrystalPad.cc:205