CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
15 {
16  public:
17 
22 
23 
24  CrystalPad() { dummy_ = true;};
26  CrystalPad(unsigned number, const std::vector<CLHEP::Hep2Vector>& corners);
30  CrystalPad(unsigned number, int onEcal,
31  const std::vector<XYZPoint>& corners,
32  const XYZPoint& origin,
33  const XYZVector& vec1,
34  const XYZVector& vec2);
35 
36  CrystalPad(unsigned number,
37  const std::vector<XYZPoint>& corners,
38  const Transform3D&,
39  double scaf=1.,bool bothdirections=false);
40 
41  CrystalPad(const CrystalPad& right);
42 
43  CrystalPad& operator = (const CrystalPad& rhs );
44 
46 
48  bool inside(const CLHEP::Hep2Vector & point,bool debug=false) const;
50  // bool globalinside(XYZPoint) const;
51 
53  // CLHEP::Hep2Vector localPoint(XYZPoint point) const;
54 
56  inline const std::vector<CLHEP::Hep2Vector> & getCorners() const {return corners_;}
57 
59  void resetCorners();
60 
62  void print() const;
63 
65  inline double survivalProbability() const { return survivalProbability_;};
66  inline void setSurvivalProbability(double val) {survivalProbability_=val;};
67 
69  CLHEP::Hep2Vector& edge(unsigned iside,int n) ;
70 
72  CLHEP::Hep2Vector & edge(CaloDirection);
73 
75  inline unsigned getNumber() const{return number_;};
76 
78  /*
79  inline XYZPoint originalCoordinates(CLHEP::Hep2Vector point) const
80  {
81  XYZPoint p(point.x(),point.y(),0.);
82  return trans_.Inverse() * p;
83  }
84  */
85 
86  inline bool operator==(const CrystalPad& quad) const
87  {
88  // std::cout << " First " << quad.getCellID() << " Second " << this->getCellID() << std::endl;
89  return quad.getNumber()==this->getNumber();
90  }
91 
92  inline bool operator<(const CrystalPad& quad) const
93  {
94  return (center_.mag()<quad.center().mag());
95  }
96 
98  void extrems(double &xmin,double& xmax,double &ymin, double& ymax) const;
99 
101  inline const CLHEP::Hep2Vector& center() const {return center_;}
102 
104  void getDrawingCoordinates(std::vector<float>&x, std::vector<float>&y) const;
105 
106 
107  private:
108 
109  static std::vector<CLHEP::Hep2Vector> aVector;
110 
111  std::vector<CLHEP::Hep2Vector> corners_;
112  std::vector<CLHEP::Hep2Vector> dir_;
113  unsigned number_;
115  ROOT::Math::Rotation3D rotation_;
118  CLHEP::Hep2Vector center_;
119  double epsilon_;
120  bool dummy_;
122 
123  public:
125  class padEqual
126  {
127  public:
128  padEqual(unsigned cell):ref_(cell)
129  {
130  // std::cout << " quadEqual " << ref_ << std::endl;
131  };
132  ~padEqual(){;};
133  inline bool operator() (const CrystalPad & quad) const
134  {
135  return (ref_==quad.getNumber());
136  }
137  private:
138  unsigned ref_;
139  };
140 
141 
142 
143 };
144 
145 #include<iosfwd>
146 std::ostream& operator <<(std::ostream& o , CrystalPad & quad);
147 
148 #endif
double survivalProbability_
Definition: CrystalPad.h:117
bool dummy_
Definition: CrystalPad.h:120
double yscalefactor_
Definition: CrystalPad.h:121
PositionVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Point
Definition: Transform3DPJ.h:66
ROOT::Math::Rotation3D rotation_
Definition: CrystalPad.h:115
bool operator==(const CrystalPad &quad) const
get the coordinates in the original frame
Definition: CrystalPad.h:86
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:166
bool operator()(const CrystalPad &quad) const
Definition: CrystalPad.h:133
const std::vector< CLHEP::Hep2Vector > & getCorners() const
Check that the point (in the global frame) is inside the crystal.
Definition: CrystalPad.h:56
ROOT::Math::Transform3DPJ::Point Point
Definition: CrystalPad.h:21
void resetCorners()
Rescale the Quad to allow for some inaccuracy ...
Definition: CrystalPad.cc:309
CLHEP::Hep2Vector & edge(unsigned iside, int n)
access to the corners in direction iside; n=0,1
Definition: CrystalPad.cc:263
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
CrystalPad & operator=(const CrystalPad &rhs)
Definition: CrystalPad.cc:20
void print() const
print
Definition: CrystalPad.cc:245
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y) const
for graphic debugging
Definition: CrystalPad.cc:335
unsigned number_
Definition: CrystalPad.h:113
static std::vector< CLHEP::Hep2Vector > aVector
Definition: CrystalPad.h:109
ROOT::Math::Transform3DPJ Transform3D
Definition: CrystalPad.h:20
math::XYZVector XYZVector
double epsilon_
Definition: CrystalPad.h:119
equality operator
Definition: CrystalPad.h:125
double survivalProbability() const
access methods to the survivalProbability
Definition: CrystalPad.h:65
unsigned getNumber() const
access to the number
Definition: CrystalPad.h:75
Transform3D trans_
Definition: CrystalPad.h:114
math::XYZVector XYZPoint
Definition: CrystalPad.h:19
std::vector< CLHEP::Hep2Vector > dir_
Definition: CrystalPad.h:112
math::XYZVector XYZVector
Definition: CrystalPad.h:18
XYZVector translation_
Definition: CrystalPad.h:116
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< CLHEP::Hep2Vector > corners_
Definition: CrystalPad.h:111
bool operator<(const CrystalPad &quad) const
Definition: CrystalPad.h:92
CLHEP::Hep2Vector center_
Definition: CrystalPad.h:118
math::XYZVector XYZPoint
void extrems(double &xmin, double &xmax, double &ymin, double &ymax) const
xmin xmax, ymin ymax of the quad
Definition: CrystalPad.cc:295
void setSurvivalProbability(double val)
Definition: CrystalPad.h:66
padEqual(unsigned cell)
Definition: CrystalPad.h:128
const CLHEP::Hep2Vector & center() const
get the center
Definition: CrystalPad.h:101
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
x
Definition: VDTMath.h:216
#define debug
Definition: MEtoEDMFormat.h:34
*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