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 
12 
13 #include <string>
14 
15 //ideally this class should inherit from XYZPoint & CellID
16 
17 class CaloPoint : public math::XYZVector {
18 public:
21 
23  CaloPoint() : XYZPoint() { ; };
24  // /// Constructor from DetId, side and position.
25  // CaloPoint(DetId cell, CaloDirection side, const XYZPoint& position);
26  //
27  // /// Constructor side and position
28  // CaloPoint( CaloDirection side, const XYZPoint& position):XYZPoint(position),side_(side){;};
29 
31  CaloPoint(const DetId& cell, CaloDirection side, const XYZPoint& position);
32 
34  CaloPoint(DetId::Detector detector, const XYZPoint& position);
35 
37  CaloPoint(DetId::Detector detector, int subdetn, int layer, const XYZPoint& position);
38 
39  ~CaloPoint() { ; }
41  inline DetId getDetId() const { return cellid_; };
43  inline CaloDirection getSide() const { return side_; };
44 
45  inline bool operator<(const CaloPoint& p) const { return this->mag2() < p.mag2(); };
46 
47  inline void setDetId(DetId::Detector det) { detector_ = det; }
48  inline DetId::Detector whichDetector() const { return detector_; };
49 
50  inline void setSubDetector(int i) { subdetector_ = i; }
51 
53  inline int whichSubDetector() const { return subdetector_; };
54 
55  inline void setLayer(int i) { layer_ = i; }
56 
57  inline int whichLayer() const { return layer_; }
58 
59  // const CaloGeometryHelper * getCalorimeter() const { return myCalorimeter_;}
60 
61 private:
62  // const CaloGeometryHelper * myCalorimeter_;
67  int layer_;
68 
69 public:
71  public:
72  DistanceToVertex(const XYZPoint& vert) : vertex(vert){};
74  bool operator()(const CaloPoint& point1, const CaloPoint& point2) {
75  return ((point1 - vertex).mag2() < (point2 - vertex).mag2());
76  }
77 
78  private:
79  XYZPoint vertex;
80  };
81 };
82 #include <iosfwd>
83 std::ostream& operator<<(std::ostream& o, const CaloPoint& cid);
84 
85 #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:72
DetId getDetId() const
returns the cellID
Definition: CaloPoint.h:41
bool operator<(const CaloPoint &p) const
Definition: CaloPoint.h:45
CaloPoint()
Empty constructor.
Definition: CaloPoint.h:23
int whichSubDetector() const
watch out, only valid in ECAL and preshower
Definition: CaloPoint.h:53
int layer_
Definition: CaloPoint.h:67
~CaloPoint()
Definition: CaloPoint.h:39
DetId::Detector detector_
Definition: CaloPoint.h:65
int whichLayer() const
Definition: CaloPoint.h:57
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
DetId::Detector whichDetector() const
Definition: CaloPoint.h:48
void setSubDetector(int i)
Definition: CaloPoint.h:50
Definition: DetId.h:17
CaloDirection getSide() const
returns the Side (see numbering)
Definition: CaloPoint.h:43
math::XYZVector XYZVector
Definition: CaloPoint.h:19
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
Detector
Definition: DetId.h:24
static int position[264][3]
Definition: ReadPGInfo.cc:289
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
void setDetId(DetId::Detector det)
Definition: CaloPoint.h:47
DetId cellid_
Definition: CaloPoint.h:63
math::XYZVector XYZPoint
Definition: CaloPoint.h:20
void setLayer(int i)
Definition: CaloPoint.h:55
int subdetector_
Definition: CaloPoint.h:66
CaloDirection side_
Definition: CaloPoint.h:64
bool operator()(const CaloPoint &point1, const CaloPoint &point2)
Definition: CaloPoint.h:74