00001
00002
00003
00004
00005
00006 #include "EmcRecEventModel/RecEmcTofHit.h"
00007 #include "Identifier/TofID.h"
00008 #include <iostream>
00009
00010
00011 RecEmcTofHit::RecEmcTofHit()
00012 {
00013 Clear();
00014 }
00015
00016 RecEmcTofHit::RecEmcTofHit(const Identifier& id,
00017 const double e,
00018 const HepPoint3D pos)
00019 {
00020 m_cellId = id;
00021 m_energy = e;
00022 m_pos = pos;
00023 }
00024
00025 RecEmcTofHit::~RecEmcTofHit()
00026 {}
00027
00028
00029 RecEmcTofHit::RecEmcTofHit(const RecEmcTofHit& tofHit)
00030 {
00031 m_cellId = tofHit.CellId();
00032 m_energy = tofHit.Energy();
00033 m_pos = tofHit.Position();
00034 }
00035
00036 RecEmcTofHit& RecEmcTofHit::operator=(const RecEmcTofHit& tofHit)
00037 {
00038 if(this!=&tofHit) {
00039 m_cellId = tofHit.CellId();
00040 m_energy = tofHit.Energy();
00041 m_pos = tofHit.Position();
00042 }
00043 return *this;
00044 }
00045
00046
00047 int RecEmcTofHit::IntCellId() const
00048 {
00049 int layer = TofID::layer(m_cellId);
00050 int im = TofID::phi_module(m_cellId);
00051 return im+layer*88;
00052 }
00053
00054 void RecEmcTofHit::CellId(const Identifier& id)
00055 {
00056 m_cellId = id;
00057 }
00058
00059 void RecEmcTofHit::Energy(const double e)
00060 {
00061 m_energy = e;
00062 }
00063
00064 void RecEmcTofHit::Position(const HepPoint3D pos)
00065 {
00066 m_pos = pos;
00067 }
00068
00069 void RecEmcTofHit::Assign(const Identifier& id,
00070 const double e,
00071 const HepPoint3D pos)
00072 {
00073 m_cellId = id;
00074 m_energy = e;
00075 m_pos = pos;
00076 }
00077
00078 void RecEmcTofHit::Clear()
00079 {
00080 m_cellId.clear();
00081 m_energy = 0;
00082 m_pos = HepPoint3D(0,0,0);
00083 }
00084
00085 double RecEmcTofHit::DistanceTo(const RecEmcTofHit &tofHit)
00086 {
00087
00088
00089
00090
00091
00092 Hep3Vector pos1(m_pos);
00093 Hep3Vector pos2(tofHit.m_pos);
00094
00095 return fabs(pos1.deltaPhi(pos2));
00096
00097
00098
00099 }
00100
00101 ostream& operator<<(ostream & os, const RecEmcTofHit& tofHit)
00102 {
00103 os<<"TofHit: ";
00104
00105 os<<tofHit.IntCellId()<<", ";
00106
00107 os.width(12);
00108 os.setf(ios::right);
00109 os<<tofHit.CellId()<<", ";
00110
00111 os.width(12);
00112 os.setf(ios::right);
00113 os<<tofHit.Energy()<<", ";
00114
00115 os.width(12);
00116 os.setf(ios::right);
00117 os<<tofHit.ZPosition()<<endl;
00118
00119 return os;
00120 }