CMS 3D CMS Logo

Crystal.h
Go to the documentation of this file.
1 #ifndef FastSimulation_GeometryTool_Crystal_h
2 #define FastSimulation_GeometryTool_Crystal_h
3 
4 // Data Formats
5 #include "Math/GenVector/Plane3D.h"
7 
8 // Unfortunately, GlobalPoints are also needed
11 
12 //FAMOS
15 
16 #include <vector>
17 
18 class DetId;
19 
20 class Crystal {
21 public:
25 
26  // side numbering
27  // enum CrystalSide{EAST=0,NORTH=1,WEST=2,SOUTH=3,FRONT=4,BACK=5};
29  Crystal() = default;
31  Crystal(const DetId& cell, const BaseCrystal* bc = nullptr);
32 
34  inline const XYZPoint& getCorner(unsigned i) const { return myCrystal_->getCorner(i); };
36  inline const XYZPoint& getCenter() const { return myCrystal_->getCenter(); };
38  inline const XYZPoint& getFrontCenter() const { return myCrystal_->getFrontCenter(); };
40  inline const XYZPoint& getBackCenter() const { return myCrystal_->getBackCenter(); }
42  inline const XYZVector& getFirstEdge() const { return myCrystal_->getFirstEdge(); }
44  inline const XYZVector& getFifthEdge() const { return myCrystal_->getFifthEdge(); }
46  inline const DetId& getDetId() const { return cellid_; };
48  inline const int getSubdetNumber() const { return myCrystal_->getSubdetNumber(); }
49  void print() const { return myCrystal_->print(); }
51  void getLateralEdges(unsigned i, XYZPoint& a, XYZPoint& b) const { myCrystal_->getLateralEdges(i, a, b); };
54  void getFrontSide(std::vector<XYZPoint>& corners) const { myCrystal_->getFrontSide(corners); }
57  void getBackSide(std::vector<XYZPoint>& corners) const { myCrystal_->getBackSide(corners); }
59  void getLateralSide(unsigned i, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const {
61  }
62  void getLateralSide(unsigned i, std::vector<XYZPoint>& corners) const { myCrystal_->getLateralSide(i, corners); }
64  void getSide(const CaloDirection& side, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const {
65  myCrystal_->getSide(side, a, b, c, d);
66  }
67  void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const { myCrystal_->getSide(side, corners); }
68 
70  const Plane3D& getFrontPlane() const { return myCrystal_->getFrontPlane(); }
72  const Plane3D& getBackPlane() const { return myCrystal_->getBackPlane(); }
74  const Plane3D& getLateralPlane(unsigned i) const { return myCrystal_->getLateralPlane(i); }
76  const Plane3D& getPlane(const CaloDirection& side) const { return myCrystal_->getPlane(side); }
77 
79  inline const XYZVector& getLateralEdge(unsigned i) const { return myCrystal_->getLateralEdge(i); }
80 
82  inline const XYZVector& exitingNormal(const CaloDirection& side) const { return myCrystal_->exitingNormal(side); }
83 
84  static unsigned oppositeDirection(unsigned iside);
85 
87  void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y, std::vector<float>& z) const {
89  }
90 
92  inline void setNumber(unsigned n) { number_ = n; };
93 
95  inline unsigned number() const { return number_; };
96 
98  inline CrystalNeighbour& crystalNeighbour(unsigned iq) { return neighbours_[iq]; }
99 
101  inline const XYZVector& getAxis() const { return myCrystal_->getAxis(); }
102 
104  inline void setX0Back(double val) { X0back_ = val; }
105 
107  inline double getX0Back() const { return X0back_; }
108 
109  ~Crystal() { ; };
110 
111 private:
112  unsigned number_ = 0;
114  std::vector<CrystalNeighbour> neighbours_;
115  double X0back_ = 0.;
116  const BaseCrystal* myCrystal_ = nullptr;
117 
118 public:
119  class crystalEqual {
120  public:
121  crystalEqual(const DetId& cell) : ref_(cell) { ; };
122  ~crystalEqual() { ; };
123  inline bool operator()(const Crystal& xtal) const { return (ref_ == xtal.getDetId()); }
124 
125  private:
126  const DetId& ref_;
127  };
128 };
129 #endif
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:133
const DetId & getDetId() const
get the DetId
Definition: Crystal.h:46
crystalEqual(const DetId &cell)
Definition: Crystal.h:121
const Plane3D & getBackPlane() const
back plane
Definition: Crystal.h:72
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: Crystal.h:36
void getFrontSide(std::vector< XYZPoint > &corners) const
Definition: Crystal.h:54
void print() const
Definition: Crystal.h:49
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: BaseCrystal.h:48
double X0back_
Definition: Crystal.h:115
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: BaseCrystal.h:82
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:149
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: BaseCrystal.h:89
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: BaseCrystal.cc:224
DetId cellid_
Definition: Crystal.h:113
const XYZPoint & getFrontCenter() const
get front center
Definition: BaseCrystal.h:50
const XYZVector & getAxis() const
get crystal axis
Definition: Crystal.h:101
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: Crystal.h:64
~Crystal()
Definition: Crystal.h:109
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: Crystal.h:82
const XYZPoint & getFrontCenter() const
get front center
Definition: Crystal.h:38
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: Crystal.h:53
const Plane3D & getBackPlane() const
back plane
Definition: BaseCrystal.h:80
unsigned number() const
get the number of the crystal
Definition: Crystal.h:95
const int getSubdetNumber() const
get the subdector
Definition: Crystal.h:48
math::XYZVector XYZPoint
Definition: Crystal.h:23
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: Crystal.h:59
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:117
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: BaseCrystal.h:92
math::XYZVector XYZVector
Definition: Crystal.h:22
static unsigned oppositeDirection(unsigned iside)
const XYZVector & getAxis() const
get crystal axis
Definition: BaseCrystal.h:102
unsigned number_
Definition: Crystal.h:112
const XYZPoint & getBackCenter() const
get front center
Definition: BaseCrystal.h:52
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: Crystal.h:74
ROOT::Math::Plane3D Plane3D
Definition: Crystal.h:24
void getLateralSide(unsigned i, std::vector< XYZPoint > &corners) const
Definition: Crystal.h:62
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: Crystal.h:42
void getLateralEdges(unsigned i, XYZPoint &a, XYZPoint &b) const
get the lateral edges
Definition: Crystal.h:51
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:109
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: BaseCrystal.h:54
void setNumber(unsigned n)
it might be useful to have a number assigned to the crystal
Definition: Crystal.h:92
void setX0Back(double val)
set X0back (it depends on the choosen origin, it isn&#39;t purely geometrical)
Definition: Crystal.h:104
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: Crystal.h:56
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: Crystal.h:76
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: Crystal.h:79
void getBackSide(std::vector< XYZPoint > &corners) const
Definition: Crystal.h:57
d
Definition: ztail.py:151
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: BaseCrystal.h:84
bool operator()(const Crystal &xtal) const
Definition: Crystal.h:123
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: Crystal.h:34
Crystal()=default
Empty constructor.
Definition: DetId.h:17
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: Crystal.h:44
const XYZPoint & getBackCenter() const
get front center
Definition: Crystal.h:40
const Plane3D & getFrontPlane() const
front plane
Definition: Crystal.h:70
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
CrystalNeighbour & crystalNeighbour(unsigned iq)
Direct acces to the iq-th neighbour.
Definition: Crystal.h:98
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: Crystal.h:87
const BaseCrystal * myCrystal_
Definition: Crystal.h:116
double b
Definition: hdecay.h:118
std::vector< CrystalNeighbour > neighbours_
Definition: Crystal.h:114
const DetId & ref_
Definition: Crystal.h:126
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: BaseCrystal.h:46
double a
Definition: hdecay.h:119
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: BaseCrystal.cc:167
void getSide(const CaloDirection &side, std::vector< XYZPoint > &corners) const
Definition: Crystal.h:67
double getX0Back() const
get the X0back
Definition: Crystal.h:107
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: BaseCrystal.h:56
const Plane3D & getFrontPlane() const
front plane
Definition: BaseCrystal.h:78
void print() const
Definition: BaseCrystal.cc:237
const int getSubdetNumber() const
get the subdector
Definition: BaseCrystal.h:60
ROOT::Math::Plane3D Plane3D