CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/FastSimulation/CaloGeometryTools/interface/CaloPoint.h

Go to the documentation of this file.
00001 #ifndef FastSimulation_CaloGeometryTools_CaloPoint_h
00002 #define FastSimulation_CaloGeometryTools_CaloPoint_h
00003 /*
00004  *
00005  * A point belonging to a given detector
00006  * 
00007  */
00008 
00009 
00010 #include "Geometry/CaloTopology/interface/CaloDirection.h"
00011 #include "DataFormats/DetId/interface/DetId.h"
00012 #include "DataFormats/Math/interface/Vector3D.h"
00013 
00014 #include <string>
00015 
00016 //ideally this class should inherit from XYZPoint & CellID 
00017 
00018 class CaloPoint : public math::XYZVector
00019 {
00020 
00021  public: 
00022 
00023   typedef math::XYZVector XYZVector;
00024   typedef math::XYZVector XYZPoint;
00025 
00027   CaloPoint():XYZPoint(){;};
00028 //  /// Constructor from DetId, side and position. 
00029 //  CaloPoint(DetId cell, CaloDirection side, const XYZPoint& position);
00030 //
00031 //  /// Constructor side and position
00032 //  CaloPoint( CaloDirection side, const XYZPoint& position):XYZPoint(position),side_(side){;};
00033 
00035   CaloPoint(const  DetId& cell, CaloDirection side, const XYZPoint& position);
00036 
00038   CaloPoint(DetId::Detector detector,const XYZPoint& position);
00039 
00041   CaloPoint(DetId::Detector detector,int subdetn,int layer, const XYZPoint & position);
00042 
00043   ~CaloPoint(){;}
00045   inline DetId getDetId() const {return cellid_;};
00047   inline CaloDirection getSide() const {return side_;};
00048 
00049   inline bool operator<(const CaloPoint & p) const
00050     {return this->mag2()<p.mag2() ;};
00051       
00052   inline void setDetId(DetId::Detector det) {detector_=det;}
00053   inline DetId::Detector whichDetector() const {return detector_;};
00054 
00055   inline void setSubDetector(int i) {subdetector_=i;}
00056 
00058   inline int whichSubDetector() const {return subdetector_;};
00059 
00060   inline void setLayer(int i) {layer_=i;}
00061   
00062   inline int whichLayer() const {return layer_;}
00063 
00064             //  const CaloGeometryHelper * getCalorimeter() const { return myCalorimeter_;}
00065 
00066   private:
00067             //  const CaloGeometryHelper * myCalorimeter_;
00068   DetId cellid_;
00069   CaloDirection side_;
00070   DetId::Detector detector_;
00071   int subdetector_;
00072   int layer_;
00073 
00074 
00075  public:
00076   class DistanceToVertex
00077     {
00078     public:
00079       DistanceToVertex(const XYZPoint & vert):vertex(vert) {};
00080       ~DistanceToVertex(){};
00081       bool operator() (const CaloPoint& point1,const CaloPoint& point2)
00082         {
00083           return ((point1-vertex).mag2()<(point2-vertex).mag2());
00084         }
00085     private:
00086       XYZPoint vertex;
00087     };
00088 };
00089 #include <iosfwd>
00090 std::ostream& operator <<(std::ostream& o , const CaloPoint& cid);
00091 
00092 #endif