CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
22 
23  public:
24 
28 
29  // side numbering
30  // enum CrystalSide{EAST=0,NORTH=1,WEST=2,SOUTH=3,FRONT=4,BACK=5};
32  Crystal(){;};
34  Crystal(const DetId& cell,const BaseCrystal* bc=0);
35 
37  inline const XYZPoint& getCorner(unsigned i) const { return myCrystal_->getCorner(i);};
39  inline const XYZPoint& getCenter() const {return myCrystal_->getCenter();};
41  inline const XYZPoint& getFrontCenter() const {return myCrystal_->getFrontCenter();};
43  inline const XYZPoint & getBackCenter() const {return myCrystal_->getBackCenter();}
45  inline const XYZVector& getFirstEdge() const {return myCrystal_->getFirstEdge();}
47  inline const XYZVector& getFifthEdge() const {return myCrystal_->getFifthEdge();}
49  inline const DetId & getDetId() const {return cellid_;};
51  inline const int getSubdetNumber() const {return myCrystal_->getSubdetNumber();}
52  void print() const {return myCrystal_->print();}
54  void getLateralEdges(unsigned i,XYZPoint& a,XYZPoint& b) const {myCrystal_->getLateralEdges(i,a,b); };
57  void getFrontSide(std::vector<XYZPoint>& corners) const {myCrystal_->getFrontSide(corners);}
60  void getBackSide(std::vector<XYZPoint>& corners) const {myCrystal_->getBackSide(corners);}
62  void getLateralSide(unsigned i,XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const {myCrystal_->getLateralSide(i,a,b,c,d);}
63  void getLateralSide(unsigned i,std::vector<XYZPoint>& corners) const {myCrystal_->getLateralSide(i,corners);}
65  void getSide(const CaloDirection& side, XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const
66  {myCrystal_->getSide(side,a,b,c,d);}
67  void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const
68  {myCrystal_->getSide(side,corners);}
69 
70 
72  const Plane3D& getFrontPlane() const {return myCrystal_->getFrontPlane();}
74  const Plane3D& getBackPlane() const {return myCrystal_->getBackPlane();}
76  const Plane3D& getLateralPlane(unsigned i) const {return myCrystal_->getLateralPlane(i);}
78  const Plane3D& getPlane(const CaloDirection& side) const { return myCrystal_->getPlane(side);}
79 
81  inline const XYZVector& getLateralEdge(unsigned i) const {return myCrystal_->getLateralEdge(i);}
82 
84  inline const XYZVector& exitingNormal(const CaloDirection& side) const {return myCrystal_->exitingNormal(side);}
85 
86  static unsigned oppositeDirection(unsigned iside);
87 
89  void getDrawingCoordinates(std::vector<float> &x,std::vector<float> &y,std::vector<float> &z) const
90  {
92  }
93 
95  inline void setNumber(unsigned n) {number_=n;};
96 
98  inline unsigned number() const {
99  return number_;};
100 
102  inline CrystalNeighbour & crystalNeighbour(unsigned iq) { return neighbours_[iq];}
103 
105  inline const XYZVector & getAxis() const { return myCrystal_->getAxis();}
106 
108  inline void setX0Back(double val) {X0back_=val;}
109 
111  inline double getX0Back() const { return X0back_;}
112 
113  ~Crystal(){;};
114 
115  private:
116  unsigned number_;
118  std::vector<CrystalNeighbour> neighbours_;
119  double X0back_;
121 
122  public:
124  {
125  public:
126  crystalEqual(const DetId & cell):ref_(cell)
127  {;};
129  inline bool operator() (const Crystal& xtal) const
130  {
131  return (ref_==xtal.getDetId());
132  }
133  private:
134  const DetId& ref_;
135  };
136 };
137 #endif
bool operator()(const Crystal &xtal) const
Definition: Crystal.h:129
int i
Definition: DBlmapReader.cc:9
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: Crystal.h:39
crystalEqual(const DetId &cell)
Definition: Crystal.h:126
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:138
const XYZVector & getAxis() const
get crystal axis
Definition: Crystal.h:105
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: BaseCrystal.h:95
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: Crystal.h:37
void getLateralSide(unsigned i, std::vector< XYZPoint > &corners) const
Definition: Crystal.h:63
double X0back_
Definition: Crystal.h:119
const XYZPoint & getBackCenter() const
get front center
Definition: Crystal.h:43
DetId cellid_
Definition: Crystal.h:117
~Crystal()
Definition: Crystal.h:113
void print() const
Definition: Crystal.h:52
const Plane3D & getFrontPlane() const
front plane
Definition: BaseCrystal.h:83
const XYZPoint & getFrontCenter() const
get front center
Definition: Crystal.h:41
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: BaseCrystal.h:57
double getX0Back() const
get the X0back
Definition: Crystal.h:111
math::XYZVector XYZPoint
Definition: Crystal.h:26
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: BaseCrystal.cc:205
const XYZPoint & getBackCenter() const
get front center
Definition: BaseCrystal.h:55
math::XYZVector XYZVector
Definition: Crystal.h:25
void getLateralEdges(unsigned i, XYZPoint &a, XYZPoint &b) const
get the lateral edges
Definition: Crystal.h:54
float float float z
static unsigned oppositeDirection(unsigned iside)
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:166
unsigned number_
Definition: Crystal.h:113
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: Crystal.h:65
ROOT::Math::Plane3D Plane3D
Definition: Crystal.h:27
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: BaseCrystal.h:92
const XYZPoint & getFrontCenter() const
get front center
Definition: BaseCrystal.h:53
const int getSubdetNumber() const
get the subdector
Definition: Crystal.h:51
const Plane3D & getBackPlane() const
back plane
Definition: BaseCrystal.h:85
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: Crystal.h:78
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: BaseCrystal.h:87
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: BaseCrystal.cc:266
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: BaseCrystal.h:51
void setNumber(unsigned n)
it might be useful to have a number assigned to the crystal
Definition: Crystal.h:95
void setX0Back(double val)
set X0back (it depends on the choosen origin, it isn&#39;t purely geometrical)
Definition: Crystal.h:108
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:185
unsigned number() const
get the number of the crystal
Definition: Crystal.h:98
void getSide(const CaloDirection &side, std::vector< XYZPoint > &corners) const
Definition: Crystal.h:67
const Plane3D & getFrontPlane() const
front plane
Definition: Crystal.h:72
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: BaseCrystal.h:59
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: BaseCrystal.h:49
const Plane3D & getBackPlane() const
back plane
Definition: Crystal.h:74
Crystal()
Empty constructor.
Definition: Crystal.h:32
void getBackSide(std::vector< XYZPoint > &corners) const
Definition: Crystal.h:60
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: Crystal.h:81
Definition: DetId.h:20
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: Crystal.h:59
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: Crystal.h:56
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: Crystal.h:45
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:102
const BaseCrystal * myCrystal_
Definition: Crystal.h:120
double b
Definition: hdecay.h:120
void getFrontSide(std::vector< XYZPoint > &corners) const
Definition: Crystal.h:57
std::vector< CrystalNeighbour > neighbours_
Definition: Crystal.h:118
const DetId & ref_
Definition: Crystal.h:134
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: Crystal.h:76
void print() const
Definition: BaseCrystal.cc:281
const int getSubdetNumber() const
get the subdector
Definition: BaseCrystal.h:63
const DetId & getDetId() const
get the DetId
Definition: Crystal.h:49
double a
Definition: hdecay.h:121
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
Definition: DDAxes.h:10
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: Crystal.h:47
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: Crystal.h:62
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: BaseCrystal.h:89
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:147
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: Crystal.h:89
const XYZVector & getAxis() const
get crystal axis
Definition: BaseCrystal.h:103
ROOT::Math::Plane3D Plane3D
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: Crystal.h:84