00001 // 00002 // Bes Tof Rec Hit 00003 // 00004 // Created by He Miao 2006,9,15 00005 // 00006 #ifndef REC_EMC_TOF_HIT_H 00007 #define REC_EMC_TOF_HIT_H 00008 00009 #include "Identifier/Identifier.h" 00010 #include <map> 00011 #include <CLHEP/Geometry/Point3D.h> 00012 #ifndef ENABLE_BACKWARDS_COMPATIBILITY 00013 typedef HepGeom::Point3D<double> HepPoint3D; 00014 #endif 00015 00016 using namespace std; 00017 using namespace CLHEP; 00018 00019 class RecEmcTofHit 00020 { 00021 public: 00022 //Constructors and destructors 00023 RecEmcTofHit(); 00024 RecEmcTofHit(const Identifier& id, 00025 const double e, 00026 const HepPoint3D pos); 00027 ~RecEmcTofHit(); 00028 00029 //Copy and assignment 00030 RecEmcTofHit(const RecEmcTofHit& tofHit); 00031 RecEmcTofHit& operator=(const RecEmcTofHit& tofHit); 00032 00033 bool operator < (const RecEmcTofHit& tofHit) const { 00034 return m_energy < tofHit.m_energy; 00035 } 00036 00037 bool operator > (const RecEmcTofHit& tofHit) const { 00038 return m_energy > tofHit.m_energy; 00039 } 00040 00041 //Read 00042 int IntCellId() const; 00043 inline Identifier CellId() const { return m_cellId; } 00044 inline double Energy() const { return m_energy; } 00045 inline HepPoint3D Position() const { return m_pos; } 00046 inline double ZPosition() const { return m_pos.z(); } 00047 00048 //Write 00049 void CellId(const Identifier& id); 00050 void Energy(const double e); 00051 void Position(const HepPoint3D pos); 00052 void ZPosition(const double z); 00053 00054 void Assign(const Identifier& id, 00055 const double e, 00056 const HepPoint3D pos); 00057 void Clear(); 00058 00059 double DistanceTo(const RecEmcTofHit &); 00060 00061 private: 00062 Identifier m_cellId; 00063 double m_energy; 00064 HepPoint3D m_pos; 00065 }; 00066 00067 typedef map<int, RecEmcTofHit, less<int> > RecEmcTofHitMap; 00068 00069 ostream& operator<<(ostream & os, const RecEmcTofHit& tofHit); 00070 00071 #endif