CMS 3D CMS Logo

CaloPoint.h
Go to the documentation of this file.
1 #ifndef FastSimulation_CaloGeometryTools_CaloPoint_h
2 #define FastSimulation_CaloGeometryTools_CaloPoint_h
3 /*
4  *
5  * A point belonging to a given detector
6  *
7  */
8 
9 
13 
14 #include <string>
15 
16 //ideally this class should inherit from XYZPoint & CellID
17 
18 class CaloPoint : public math::XYZVector
19 {
20 
21  public:
22 
25 
27  CaloPoint():XYZPoint(){;};
28 // /// Constructor from DetId, side and position.
29 // CaloPoint(DetId cell, CaloDirection side, const XYZPoint& position);
30 //
31 // /// Constructor side and position
32 // CaloPoint( CaloDirection side, const XYZPoint& position):XYZPoint(position),side_(side){;};
33 
35  CaloPoint(const DetId& cell, CaloDirection side, const XYZPoint& position);
36 
38  CaloPoint(DetId::Detector detector,const XYZPoint& position);
39 
41  CaloPoint(DetId::Detector detector,int subdetn,int layer, const XYZPoint & position);
42 
45  inline DetId getDetId() const {return cellid_;};
47  inline CaloDirection getSide() const {return side_;};
48 
49  inline bool operator<(const CaloPoint & p) const
50  {return this->mag2()<p.mag2() ;};
51 
52  inline void setDetId(DetId::Detector det) {detector_=det;}
53  inline DetId::Detector whichDetector() const {return detector_;};
54 
55  inline void setSubDetector(int i) {subdetector_=i;}
56 
58  inline int whichSubDetector() const {return subdetector_;};
59 
60  inline void setLayer(int i) {layer_=i;}
61 
62  inline int whichLayer() const {return layer_;}
63 
64  // const CaloGeometryHelper * getCalorimeter() const { return myCalorimeter_;}
65 
66  private:
67  // const CaloGeometryHelper * myCalorimeter_;
72  int layer_;
73 
74 
75  public:
77  {
78  public:
79  DistanceToVertex(const XYZPoint & vert):vertex(vert) {};
81  bool operator() (const CaloPoint& point1,const CaloPoint& point2)
82  {
83  return ((point1-vertex).mag2()<(point2-vertex).mag2());
84  }
85  private:
86  XYZPoint vertex;
87  };
88 };
89 #include <iosfwd>
90 std::ostream& operator <<(std::ostream& o , const CaloPoint& cid);
91 
92 #endif
std::ostream & operator<<(std::ostream &o, const CaloPoint &cid)
Definition: CaloPoint.cc:4
static const char layer_[]
DistanceToVertex(const XYZPoint &vert)
Definition: CaloPoint.h:79
DetId getDetId() const
returns the cellID
Definition: CaloPoint.h:45
bool operator<(const CaloPoint &p) const
Definition: CaloPoint.h:49
CaloPoint()
Empty constructor.
Definition: CaloPoint.h:27
int whichSubDetector() const
watch out, only valid in ECAL and preshower
Definition: CaloPoint.h:58
int layer_
Definition: CaloPoint.h:72
~CaloPoint()
Definition: CaloPoint.h:43
DetId::Detector detector_
Definition: CaloPoint.h:70
int whichLayer() const
Definition: CaloPoint.h:62
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
DetId::Detector whichDetector() const
Definition: CaloPoint.h:53
void setSubDetector(int i)
Definition: CaloPoint.h:55
Definition: DetId.h:18
CaloDirection getSide() const
returns the Side (see numbering)
Definition: CaloPoint.h:47
math::XYZVector XYZVector
Definition: CaloPoint.h:23
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
Detector
Definition: DetId.h:26
static int position[264][3]
Definition: ReadPGInfo.cc:509
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
void setDetId(DetId::Detector det)
Definition: CaloPoint.h:52
DetId cellid_
Definition: CaloPoint.h:68
math::XYZVector XYZPoint
Definition: CaloPoint.h:24
void setLayer(int i)
Definition: CaloPoint.h:60
int subdetector_
Definition: CaloPoint.h:71
CaloDirection side_
Definition: CaloPoint.h:69
bool operator()(const CaloPoint &point1, const CaloPoint &point2)
Definition: CaloPoint.h:81