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() { ; };
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() { ; }
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:
110  XYZPoint corners_[8];
112  int subdetn_;
113  XYZPoint center_;
114  XYZPoint frontcenter_;
115  XYZPoint backcenter_;
118  XYZVector crystalaxis_;
119  XYZVector lateraldirection_[4];
120  Plane3D lateralPlane_[6];
121  XYZVector exitingNormal_[6];
122 };
123 #endif
XYZPoint center_
Definition: BaseCrystal.h:113
XYZPoint backcenter_
Definition: BaseCrystal.h:115
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:109
XYZVector firstedgedirection_
Definition: BaseCrystal.h:116
void setCorners(const CaloCellGeometry::CornersVec &vec, const GlobalPoint &pos)
Definition: BaseCrystal.cc:11
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: BaseCrystal.h:92
math::XYZVector XYZVector
Definition: BaseCrystal.h:21
const Plane3D & getFrontPlane() const
front plane
Definition: BaseCrystal.h:78
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: BaseCrystal.h:54
static unsigned oppositeDirection(unsigned iside)
void getDrawingCoordinates(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z) const
for debugging.
Definition: BaseCrystal.cc:167
XYZVector lateraldirection_[4]
Definition: BaseCrystal.h:119
const XYZPoint & getBackCenter() const
get front center
Definition: BaseCrystal.h:52
BaseCrystal()
Empty constructor.
Definition: BaseCrystal.h:28
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:133
XYZPoint corners_[8]
Definition: BaseCrystal.h:110
const DetId & getDetId() const
get the DetId
Definition: BaseCrystal.h:58
math::XYZVector XYZPoint
Definition: BaseCrystal.h:22
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: BaseCrystal.h:89
const XYZPoint & getFrontCenter() const
get front center
Definition: BaseCrystal.h:50
const Plane3D & getBackPlane() const
back plane
Definition: BaseCrystal.h:80
ROOT::Math::Plane3D Plane3D
Definition: BaseCrystal.h:23
const Plane3D & getLateralPlane(unsigned i) const
lateral planes
Definition: BaseCrystal.h:82
void getSide(const CaloDirection &side, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
generic access
Definition: BaseCrystal.cc:224
XYZPoint frontcenter_
Definition: BaseCrystal.h:114
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: BaseCrystal.h:48
XYZVector exitingNormal_[6]
Definition: BaseCrystal.h:121
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:149
Plane3D lateralPlane_[6]
Definition: BaseCrystal.h:120
static CaloDirection Side(unsigned i)
unsigned int -> Side conversion
const XYZVector & getFifthEdge() const
Direction of the fifth edge.
Definition: BaseCrystal.h:56
d
Definition: ztail.py:151
const XYZPoint & getCorner(unsigned i) const
get the i-th corner
Definition: BaseCrystal.h:46
Definition: DetId.h:17
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double b
Definition: hdecay.h:118
void print() const
Definition: BaseCrystal.cc:237
const int getSubdetNumber() const
get the subdector
Definition: BaseCrystal.h:60
double a
Definition: hdecay.h:119
~BaseCrystal()
Copy constructor.
Definition: BaseCrystal.h:39
DetId cellid_
Definition: BaseCrystal.h:111
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
const Plane3D & getPlane(const CaloDirection &side) const
generic access
Definition: BaseCrystal.h:84
void getFrontSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
coordinates of the front side
Definition: BaseCrystal.cc:117
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:117
const XYZVector & getAxis() const
get crystal axis
Definition: BaseCrystal.h:102
XYZVector crystalaxis_
Definition: BaseCrystal.h:118
ROOT::Math::Plane3D Plane3D
void computeBasicProperties()
Definition: BaseCrystal.cc:72