CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
20 {
21 
22  public:
23 
27 
28  // side numbering
29  // enum CrystalSide{EAST=0,NORTH=1,WEST=2,SOUTH=3,FRONT=4,BACK=5};
33  BaseCrystal(const DetId& cell);
34 
36  // BaseCrystal (const BaseCrystal& bc):corners_(bc.getCorners()),cellid_(bc.getDetId())
37  // {
38  // std::cout << " Copy constructor " ;
39  // computeBasicProperties();
40  // std::cout << " done " << std::endl;
41  // }
45 
46  inline const std::vector<XYZPoint>& getCorners() const {return corners_;}
47 
49  inline const XYZPoint& getCorner(unsigned i) const { return corners_[i];};
51  inline const XYZPoint& getCenter() const {return center_;};
53  inline const XYZPoint& getFrontCenter() const {return frontcenter_;};
55  inline const XYZPoint & getBackCenter() const {return backcenter_;}
57  inline const XYZVector& getFirstEdge() const {return firstedgedirection_;}
59  inline const XYZVector& getFifthEdge() const {return fifthedgedirection_;}
61  inline const DetId & getDetId() const {return cellid_;};
63  inline const int getSubdetNumber() const {return subdetn_;}
64 
66  void getLateralEdges(unsigned i,XYZPoint&,XYZPoint&)const;
68  void getFrontSide(XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
69  void getFrontSide(std::vector<XYZPoint>& corners) const;
71  void getBackSide(XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
72  void getBackSide(std::vector<XYZPoint>& corners) const;
74  void getLateralSide(unsigned i,XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
75  void getLateralSide(unsigned i,std::vector<XYZPoint>& corners) const;
77  void getSide(const CaloDirection& side, XYZPoint &a,XYZPoint &b,XYZPoint &c,XYZPoint &d) const;
78  void getSide(const CaloDirection& side, std::vector<XYZPoint>& corners) const;
79 
80 
81 
83  inline const Plane3D& getFrontPlane() const {return lateralPlane_[4];}
85  inline const Plane3D& getBackPlane() const {return lateralPlane_[5];}
87  inline const Plane3D& getLateralPlane(unsigned i) const {return lateralPlane_[i];};
89  const Plane3D& getPlane(const CaloDirection& side) const {return lateralPlane_[CaloDirectionOperations::Side(side)];}
90 
92  inline const XYZVector& getLateralEdge(unsigned i) const {return lateraldirection_[i];};
93 
95  inline const XYZVector& exitingNormal(const CaloDirection& side) const {return exitingNormal_[CaloDirectionOperations::Side(side)];};
96 
97  static unsigned oppositeDirection(unsigned iside);
98 
100  void getDrawingCoordinates(std::vector<float> &x,std::vector<float> &y,std::vector<float> &z) const;
101 
103  inline const XYZVector & getAxis() const { return crystalaxis_;}
104 
105  void print() const;
106 
107  private:
108  void computeBasicProperties();
109 
110  private:
111  std::vector<XYZPoint> corners_;
113  int subdetn_;
120  std::vector<XYZVector> lateraldirection_;
121  std::vector<Plane3D> lateralPlane_;
122  std::vector<XYZVector> exitingNormal_;
123 };
124 #endif
XYZPoint center_
Definition: BaseCrystal.h:114
XYZPoint backcenter_
Definition: BaseCrystal.h:116
int i
Definition: DBlmapReader.cc:9
void getLateralEdges(unsigned i, XYZPoint &, XYZPoint &) const
get the lateral edges
Definition: BaseCrystal.cc:138
XYZVector firstedgedirection_
Definition: BaseCrystal.h:117
void setCorners(const CaloCellGeometry::CornersVec &vec, const GlobalPoint &pos)
Definition: BaseCrystal.cc:14
const XYZVector & exitingNormal(const CaloDirection &side) const
normal exiting vector for the surface
Definition: BaseCrystal.h:95
std::vector< XYZVector > lateraldirection_
Definition: BaseCrystal.h:120
math::XYZVector XYZVector
Definition: BaseCrystal.h:24
const Plane3D & getFrontPlane() const
front plane
Definition: BaseCrystal.h:83
const XYZVector & getFirstEdge() const
Direction of the first edge.
Definition: BaseCrystal.h:57
std::vector< XYZPoint > corners_
Definition: BaseCrystal.h:111
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:205
const XYZPoint & getBackCenter() const
get front center
Definition: BaseCrystal.h:55
BaseCrystal()
Empty constructor.
Definition: BaseCrystal.h:31
float float float z
void getBackSide(XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the back side.
Definition: BaseCrystal.cc:166
const DetId & getDetId() const
get the DetId
Definition: BaseCrystal.h:61
math::XYZVector XYZPoint
Definition: BaseCrystal.h:25
const XYZVector & getLateralEdge(unsigned i) const
lateral directions
Definition: BaseCrystal.h:92
const XYZPoint & getFrontCenter() const
get front center
Definition: BaseCrystal.h:53
const Plane3D & getBackPlane() const
back plane
Definition: BaseCrystal.h:85
ROOT::Math::Plane3D Plane3D
Definition: BaseCrystal.h:26
std::vector< XYZVector > exitingNormal_
Definition: BaseCrystal.h:122
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
XYZPoint frontcenter_
Definition: BaseCrystal.h:115
const XYZPoint & getCenter() const
get 1/8*(Sum of corners)
Definition: BaseCrystal.h:51
void getLateralSide(unsigned i, XYZPoint &a, XYZPoint &b, XYZPoint &c, XYZPoint &d) const
Coordinates of the i=th lateral side.
Definition: BaseCrystal.cc:185
static CaloDirection Side(unsigned i)
unsigned int -&gt; Side conversion
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
Definition: DetId.h:20
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< Plane3D > lateralPlane_
Definition: BaseCrystal.h:121
double b
Definition: hdecay.h:120
void print() const
Definition: BaseCrystal.cc:281
math::XYZVector XYZPoint
const int getSubdetNumber() const
get the subdector
Definition: BaseCrystal.h:63
double a
Definition: hdecay.h:121
~BaseCrystal()
Copy constructor.
Definition: BaseCrystal.h:42
DetId cellid_
Definition: BaseCrystal.h:112
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
Definition: DDAxes.h:10
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
XYZVector fifthedgedirection_
Definition: BaseCrystal.h:118
const XYZVector & getAxis() const
get crystal axis
Definition: BaseCrystal.h:103
XYZVector crystalaxis_
Definition: BaseCrystal.h:119
const std::vector< XYZPoint > & getCorners() const
Definition: BaseCrystal.h:46
ROOT::Math::Plane3D Plane3D
void computeBasicProperties()
Definition: BaseCrystal.cc:92