BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
RecEmcTofHit.cxx
Go to the documentation of this file.
1//
2// Bes Tof Rec Hit
3//
4// Created by He Miao 2006,9,15
5//
6#include "EmcRecEventModel/RecEmcTofHit.h"
7#include "Identifier/TofID.h"
8#include <iostream>
9
10//Constructors and destructors
12{
13 Clear();
14}
15
17 const double e,
18 const HepPoint3D pos)
19{
20 m_cellId = id;
21 m_energy = e;
22 m_pos = pos;
23}
24
26{}
27
28//Copy and assignment
30{
31 m_cellId = tofHit.CellId();
32 m_energy = tofHit.Energy();
33 m_pos = tofHit.Position();
34}
35
37{
38 if(this!=&tofHit) {
39 m_cellId = tofHit.CellId();
40 m_energy = tofHit.Energy();
41 m_pos = tofHit.Position();
42 }
43 return *this;
44}
45
46//Other methods
48{
49 int layer = TofID::layer(m_cellId);
50 int im = TofID::phi_module(m_cellId);
51 return im+layer*88;
52}
53
55{
56 m_cellId = id;
57}
58
59void RecEmcTofHit::Energy(const double e)
60{
61 m_energy = e;
62}
63
65{
66 m_pos = pos;
67}
68
70 const double e,
71 const HepPoint3D pos)
72{
73 m_cellId = id;
74 m_energy = e;
75 m_pos = pos;
76}
77
79{
80 m_cellId.clear();
81 m_energy = 0;
82 m_pos = HepPoint3D(0,0,0);
83}
84
86{
87 //double dphi = m_pos.phi()-tofHit.m_pos.phi();
88
89 //if(dphi>CLHEP::pi) dphi = CLHEP::twopi - dphi;
90 //if(dphi<-CLHEP::pi) dphi = CLHEP::twopi + dphi;
91
92 Hep3Vector pos1(m_pos);
93 Hep3Vector pos2(tofHit.m_pos);
94
95 return fabs(pos1.deltaPhi(pos2));
96
97 //cout<<"dphi="<<dphi<<"\tdeltaPhi="<<deltaPhi<<endl;
98 //return fabs(dphi);
99}
100
101ostream& operator<<(ostream & os, const RecEmcTofHit& tofHit)
102{
103 os<<"TofHit: ";
104
105 os<<tofHit.IntCellId()<<", ";
106
107 os.width(12);
108 os.setf(ios::right);
109 os<<tofHit.CellId()<<", ";
110
111 os.width(12);
112 os.setf(ios::right);
113 os<<tofHit.Energy()<<", ";
114
115 os.width(12);
116 os.setf(ios::right);
117 os<<tofHit.ZPosition()<<endl;
118
119 return os;
120}
ostream & operator<<(ostream &os, const RecEmcTofHit &tofHit)
void Assign(const Identifier &id, const double e, const HepPoint3D pos)
RecEmcTofHit & operator=(const RecEmcTofHit &tofHit)
double DistanceTo(const RecEmcTofHit &)
int IntCellId() const
static int phi_module(const Identifier &id)
Definition: TofID.cxx:73
static int layer(const Identifier &id)
Definition: TofID.cxx:66