BOSS 8.0.0
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
13RecEmcTofHit::RecEmcTofHit( const Identifier& id, const double e, const HepPoint3D pos ) {
14 m_cellId = id;
15 m_energy = e;
16 m_pos = pos;
17}
18
20
21// Copy and assignment
23 m_cellId = tofHit.CellId();
24 m_energy = tofHit.Energy();
25 m_pos = tofHit.Position();
26}
27
29 if ( this != &tofHit )
30 {
31 m_cellId = tofHit.CellId();
32 m_energy = tofHit.Energy();
33 m_pos = tofHit.Position();
34 }
35 return *this;
36}
37
38// Other methods
40 int layer = TofID::layer( m_cellId );
41 int im = TofID::phi_module( m_cellId );
42 return im + layer * 88;
43}
44
45void RecEmcTofHit::CellId( const Identifier& id ) { m_cellId = id; }
46
47void RecEmcTofHit::Energy( const double e ) { m_energy = e; }
48
49void RecEmcTofHit::Position( const HepPoint3D pos ) { m_pos = pos; }
50
51void RecEmcTofHit::Assign( const Identifier& id, const double e, const HepPoint3D pos ) {
52 m_cellId = id;
53 m_energy = e;
54 m_pos = pos;
55}
56
58 m_cellId.clear();
59 m_energy = 0;
60 m_pos = HepPoint3D( 0, 0, 0 );
61}
62
63double RecEmcTofHit::DistanceTo( const RecEmcTofHit& tofHit ) {
64 // double dphi = m_pos.phi()-tofHit.m_pos.phi();
65
66 // if(dphi>CLHEP::pi) dphi = CLHEP::twopi - dphi;
67 // if(dphi<-CLHEP::pi) dphi = CLHEP::twopi + dphi;
68
69 Hep3Vector pos1( m_pos );
70 Hep3Vector pos2( tofHit.m_pos );
71
72 return fabs( pos1.deltaPhi( pos2 ) );
73
74 // cout<<"dphi="<<dphi<<"\tdeltaPhi="<<deltaPhi<<endl;
75 // return fabs(dphi);
76}
77
78ostream& operator<<( ostream& os, const RecEmcTofHit& tofHit ) {
79 os << "TofHit: ";
80
81 os << tofHit.IntCellId() << ", ";
82
83 os.width( 12 );
84 os.setf( ios::right );
85 os << tofHit.CellId() << ", ";
86
87 os.width( 12 );
88 os.setf( ios::right );
89 os << tofHit.Energy() << ", ";
90
91 os.width( 12 );
92 os.setf( ios::right );
93 os << tofHit.ZPosition() << endl;
94
95 return os;
96}
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:65
static int layer(const Identifier &id)
Definition TofID.cxx:59