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
BaseCrystal::getSubdetNumber
const int getSubdetNumber() const
get the subdector
Definition: BaseCrystal.h:60
Crystal::crystalEqual::crystalEqual
crystalEqual(const DetId &cell)
Definition: Crystal.h:121
Crystal::XYZVector
math::XYZVector XYZVector
Definition: Crystal.h:22
BaseCrystal::getFrontCenter
const XYZPoint & getFrontCenter() const
get front center
Definition: BaseCrystal.h:50
DDAxes::y
CaloDirection
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
CaloDirection.h
mps_fire.i
i
Definition: mps_fire.py:428
Crystal::getSide
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: Crystal.h:64
Crystal::getLateralPlane
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: Crystal.h:74
Crystal::getAxis
const XYZVector & getAxis() const
get crystal axis
Definition: Crystal.h:101
BaseCrystal
Definition: BaseCrystal.h:19
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
Crystal::getLateralEdge
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: Crystal.h:79
BaseCrystal::getBackPlane
const Plane3D & getBackPlane() const
back plane
Definition: BaseCrystal.h:80
Crystal::getLateralSide
void getLateralSide(unsigned i, std::vector< XYZPoint > &corners) const
Definition: Crystal.h:62
BaseCrystal::getLateralEdge
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: BaseCrystal.h:89
Crystal
Definition: Crystal.h:20
Crystal::getSide
void getSide(const CaloDirection &side, std::vector< XYZPoint > &corners) const
Definition: Crystal.h:67
BaseCrystal::exitingNormal
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: BaseCrystal.h:92
CrystalNeighbour.h
BaseCrystal::getBackSide
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:133
BaseCrystal::getCenter
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: BaseCrystal.h:48
Crystal::crystalNeighbour
CrystalNeighbour & crystalNeighbour(unsigned iq)
Direct acces to the iq-th neighbour.
Definition: Crystal.h:98
Crystal::getBackCenter
const XYZPoint & getBackCenter() const
get front center
Definition: Crystal.h:40
BaseCrystal::getBackCenter
const XYZPoint & getBackCenter() const
get front center
Definition: BaseCrystal.h:52
BaseCrystal::getLateralSide
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:149
BaseCrystal::getLateralPlane
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: BaseCrystal.h:82
BaseCrystal::getSide
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: BaseCrystal.cc:224
BaseCrystal::getFrontSide
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:117
DDAxes::x
Crystal::neighbours_
std::vector< CrystalNeighbour > neighbours_
Definition: Crystal.h:114
Crystal::getBackSide
void getBackSide(std::vector< XYZPoint > &corners) const
Definition: Crystal.h:57
BaseCrystal.h
BaseCrystal::getAxis
const XYZVector & getAxis() const
get crystal axis
Definition: BaseCrystal.h:102
Crystal::getFrontCenter
const XYZPoint & getFrontCenter() const
get front center
Definition: Crystal.h:38
Plane3D
ROOT::Math::Plane3D Plane3D
Definition: PreshowerHitMaker.cc:13
Crystal::getDetId
const DetId & getDetId() const
get the DetId
Definition: Crystal.h:46
DetId
Definition: DetId.h:17
Crystal::getLateralEdges
void getLateralEdges(unsigned i, XYZPoint &a, XYZPoint &b) const
get the lateral edges
Definition: Crystal.h:51
Crystal::getSubdetNumber
const int getSubdetNumber() const
get the subdector
Definition: Crystal.h:48
Crystal::getDrawingCoordinates
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: Crystal.h:87
DDAxes::z
Crystal::crystalEqual
Definition: Crystal.h:119
BaseCrystal::getFirstEdge
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: BaseCrystal.h:54
Crystal::getPlane
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: Crystal.h:76
b
double b
Definition: hdecay.h:118
Crystal::exitingNormal
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: Crystal.h:82
a
double a
Definition: hdecay.h:119
BaseCrystal::getLateralEdges
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:109
Crystal::crystalEqual::operator()
bool operator()(const Crystal &xtal) const
Definition: Crystal.h:123
Crystal::Crystal
Crystal()=default
Empty constructor.
Crystal::getFrontSide
void getFrontSide(std::vector< XYZPoint > &corners) const
Definition: Crystal.h:54
CrystalNeighbour
Definition: CrystalNeighbour.h:10
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
Crystal::crystalEqual::ref_
const DetId & ref_
Definition: Crystal.h:126
Crystal::oppositeDirection
static unsigned oppositeDirection(unsigned iside)
Crystal::print
void print() const
Definition: Crystal.h:49
BaseCrystal::getPlane
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: BaseCrystal.h:84
Crystal::setX0Back
void setX0Back(double val)
set X0back (it depends on the choosen origin, it isn't purely geometrical)
Definition: Crystal.h:104
Crystal::myCrystal_
const BaseCrystal * myCrystal_
Definition: Crystal.h:116
Crystal::X0back_
double X0back_
Definition: Crystal.h:115
Crystal::cellid_
DetId cellid_
Definition: Crystal.h:113
Crystal::Plane3D
ROOT::Math::Plane3D Plane3D
Definition: Crystal.h:24
Crystal::crystalEqual::~crystalEqual
~crystalEqual()
Definition: Crystal.h:122
Crystal::number
unsigned number() const
get the number of the crystal
Definition: Crystal.h:95
Crystal::XYZPoint
math::XYZVector XYZPoint
Definition: Crystal.h:23
BaseCrystal::getCorner
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: BaseCrystal.h:46
Crystal::getFirstEdge
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: Crystal.h:42
heppy_batch.val
val
Definition: heppy_batch.py:351
BaseCrystal::getFrontPlane
const Plane3D & getFrontPlane() const
front plane
Definition: BaseCrystal.h:78
Crystal::getCenter
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: Crystal.h:36
DetId.h
Crystal::getLateralSide
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: Crystal.h:59
Crystal::setNumber
void setNumber(unsigned n)
it might be useful to have a number assigned to the crystal
Definition: Crystal.h:92
Crystal::getFrontPlane
const Plane3D & getFrontPlane() const
front plane
Definition: Crystal.h:70
BaseCrystal::getFifthEdge
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: BaseCrystal.h:56
Crystal::number_
unsigned number_
Definition: Crystal.h:112
Crystal::~Crystal
~Crystal()
Definition: Crystal.h:109
ztail.d
d
Definition: ztail.py:151
Crystal::getBackSide
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: Crystal.h:56
BaseCrystal::print
void print() const
Definition: BaseCrystal.cc:237
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
Crystal::getFrontSide
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: Crystal.h:53
Vector3D.h
Crystal::getCorner
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: Crystal.h:34
Crystal::getBackPlane
const Plane3D & getBackPlane() const
back plane
Definition: Crystal.h:72
BaseCrystal::getDrawingCoordinates
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: BaseCrystal.cc:167
Crystal::getFifthEdge
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: Crystal.h:44
Crystal::getX0Back
double getX0Back() const
get the X0back
Definition: Crystal.h:107