CMS 3D CMS Logo

BaseCrystal.h
Go to the documentation of this file.
1 #ifndef FastSimulation_GeometryTool_BaseCrystal_h
2 #define FastSimulation_GeometryTool_BaseCrystal_h
3 
4 //Data Formats
6 #include "Math/GenVector/Plane3D.h"
7 
8 // Unfortunately, GlobalPoints are also needed
14 
15 #include <vector>
16 
17 class DetId;
18 
19 class BaseCrystal {
20 public:
24 
25  // side numbering
26  // enum CrystalSide{EAST=0,NORTH=1,WEST=2,SOUTH=3,FRONT=4,BACK=5};
28  BaseCrystal() = default;
30  BaseCrystal(const DetId& cell);
31 
33  // BaseCrystal (const BaseCrystal& bc):corners_(bc.getCorners()),cellid_(bc.getDetId())
34  // {
35  // std::cout << " Copy constructor " ;
36  // computeBasicProperties();
37  // std::cout << " done " << std::endl;
38  // }
39  ~BaseCrystal() = default;
41  void setCorners(const CaloCellGeometry::CornersVec& vec, const GlobalPoint& pos);
42 
43  // inline const std::vector<XYZPoint>& getCorners() const {return corners_;}
44 
46  inline const XYZPoint& getCorner(unsigned i) const { return corners_[i]; };
48  inline const XYZPoint& getCenter() const { return center_; };
50  inline const XYZPoint& getFrontCenter() const { return frontcenter_; };
52  inline const XYZPoint& getBackCenter() const { return backcenter_; }
54  inline const XYZVector& getFirstEdge() const { return firstedgedirection_; }
56  inline const XYZVector& getFifthEdge() const { return fifthedgedirection_; }
58  inline const DetId& getDetId() const { return cellid_; };
60  inline const int getSubdetNumber() const { return subdetn_; }
61 
63  void getLateralEdges(unsigned i, XYZPoint&, XYZPoint&) const;
65  void getFrontSide(XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
66  void getFrontSide(std::vector<XYZPoint>& corners) const;
68  void getBackSide(XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
69  void getBackSide(std::vector<XYZPoint>& corners) const;
71  void getLateralSide(unsigned i, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
72  void getLateralSide(unsigned i, std::vector<XYZPoint>& corners) const;
74  void getSide(const CaloDirection& side, XYZPoint& a, XYZPoint& b, XYZPoint& c, XYZPoint& d) const;
75  void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const;
76 
78  inline const Plane3D& getFrontPlane() const { return lateralPlane_[4]; }
80  inline const Plane3D& getBackPlane() const { return lateralPlane_[5]; }
82  inline const Plane3D& getLateralPlane(unsigned i) const { return lateralPlane_[i]; };
84  const Plane3D& getPlane(const CaloDirection& side) const {
86  }
87 
89  inline const XYZVector& getLateralEdge(unsigned i) const { return lateraldirection_[i]; };
90 
92  inline const XYZVector& exitingNormal(const CaloDirection& side) const {
94  };
95 
96  static unsigned oppositeDirection(unsigned iside);
97 
99  void getDrawingCoordinates(std::vector<float>& x, std::vector<float>& y, std::vector<float>& z) const;
100 
102  inline const XYZVector& getAxis() const { return crystalaxis_; }
103 
104  void print() const;
105 
106 private:
107  void computeBasicProperties();
108 
109 private:
112  int subdetn_;
122 };
123 #endif
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:133
XYZPoint center_
Definition: BaseCrystal.h:113
BaseCrystal()=default
Empty constructor.
XYZPoint backcenter_
Definition: BaseCrystal.h:115
XYZVector firstedgedirection_
Definition: BaseCrystal.h:116
void setCorners(const CaloCellGeometry::CornersVec &vec, const GlobalPoint &pos)
Definition: BaseCrystal.cc:11
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: BaseCrystal.h:48
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
math::XYZVector XYZVector
Definition: BaseCrystal.h:21
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: BaseCrystal.cc:224
const XYZPoint & getFrontCenter() const
get front center
Definition: BaseCrystal.h:50
const Plane3D & getBackPlane() const
back plane
Definition: BaseCrystal.h:80
~BaseCrystal()=default
Copy constructor.
static unsigned oppositeDirection(unsigned iside)
XYZVector lateraldirection_[4]
Definition: BaseCrystal.h:119
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
const DetId & getDetId() const
get the DetId
Definition: BaseCrystal.h:58
const XYZVector & getAxis() const
get crystal axis
Definition: BaseCrystal.h:102
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
const XYZPoint & getBackCenter() const
get front center
Definition: BaseCrystal.h:52
math::XYZVector XYZPoint
Definition: BaseCrystal.h:22
ROOT::Math::Plane3D Plane3D
Definition: BaseCrystal.h:23
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
XYZPoint frontcenter_
Definition: BaseCrystal.h:114
XYZVector exitingNormal_[6]
Definition: BaseCrystal.h:121
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion
d
Definition: ztail.py:151
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: BaseCrystal.h:84
Definition: DetId.h:17
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double b
Definition: hdecay.h:120
math::XYZVector XYZPoint
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: BaseCrystal.h:46
double a
Definition: hdecay.h:121
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: BaseCrystal.cc:167
DetId cellid_
Definition: BaseCrystal.h:111
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
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:117
XYZVector crystalaxis_
Definition: BaseCrystal.h:118
void print() const
Definition: BaseCrystal.cc:237
const int getSubdetNumber() const
get the subdector
Definition: BaseCrystal.h:60
ROOT::Math::Plane3D Plane3D
void computeBasicProperties()
Definition: BaseCrystal.cc:72