BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RecEmcHit.cxx
Go to the documentation of this file.
1//
2// Bes EMC Rec Hit
3//
4// Created by Wang.Zhe 2003, 10, 1
5//
6#include <iostream>
7
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/ISvcLocator.h"
12
13//Constructors and destructors
15{
16 fCellId.clear();
17 fEnergy=-1;
18 fTime=-1;
19}
20
22 const RecEmcEnergy& Energy,
23 const RecEmcTime& Time)
24{
27 fTime=Time;
28}
29
31{
32 //Nothing to do
33}
34
35//Copy and assignment
36//RecEmcHit::RecEmcHit(const RecEmcHit& aHit)
37// :ContainedObject(aHit)
38//{
39// fCellId=aHit.CellId();
40// fEnergy=aHit.Energy();
41// fTime=aHit.Time();
42//}
43//
44//RecEmcHit& RecEmcHit::operator=(const RecEmcHit& aHit)
45//{
46// if(this!=&aHit)
47// {
48// ContainedObject::operator=(aHit);
49// fCellId=aHit.CellId();
50// fEnergy=aHit.Energy();
51// fTime=aHit.Time();
52// }
53// return *this;
54//}
55
56//Other methods
58{
59 IEmcRecGeoSvc* iGeoSvc;
60 ISvcLocator* svcLocator = Gaudi::svcLocator();
61 StatusCode sc = svcLocator->service("EmcRecGeoSvc",iGeoSvc);
62 if(sc!=StatusCode::SUCCESS) {
63 cout<<"Error: Can't get EmcRecGeoSvc"<<endl;
64 }
65
66 return iGeoSvc->GetCCenter(fCellId);
67}
68
70{
71 IEmcRecGeoSvc* iGeoSvc;
72 ISvcLocator* svcLocator = Gaudi::svcLocator();
73 StatusCode sc = svcLocator->service("EmcRecGeoSvc",iGeoSvc);
74 if(sc!=StatusCode::SUCCESS) {
75 cout<<"Error: Can't get EmcRecGeoSvc"<<endl;
76 }
77
78 return iGeoSvc->GetCFrontCenter(fCellId);
79}
80
82{
84 return fCellId;
85}
86
88{
90 return fEnergy;
91}
92
94{
95 fTime=Time;
96 return fTime;
97}
98
99void RecEmcHit::Assign(const RecEmcID& CellId,
100 const RecEmcEnergy& Energy,
101 const RecEmcTime& Time)
102{
105 fTime=Time;
106}
107
108void RecEmcHit::Dump() const
109{
110 cout<<"Hit: ";
111
112 cout<<fCellId<<", ";
113
114 cout.width(12);
115 cout.setf(ios::right);
116 cout<<fEnergy<<", ";
117
118 cout.width(12);
119 cout.setf(ios::right);
120 cout<<fTime<<endl;
121}
122
123ostream& operator<<(ostream & os, const RecEmcHit& aHit)
124{
125 os<<"Hit: ";
126
127 os<<aHit.getCellId()<<", ";
128
129 os.width(12);
130 os.setf(ios::right);
131 os<<aHit.getEnergy()<<", ";
132
133 os.width(12);
134 os.setf(ios::right);
135 os<<aHit.getTime()<<endl;
136
137 return os;
138}
139
double RecEmcEnergy
double RecEmcTime
ostream & operator<<(ostream &os, const RecEmcHit &aHit)
Definition: RecEmcHit.cxx:123
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const =0
virtual HepPoint3D GetCCenter(const Identifier &id) const =0
void clear()
Reset to invalid state.
Definition: Identifier.h:152
RecEmcEnergy getEnergy() const
Definition: RecEmcHit.h:48
RecEmcEnergy fEnergy
Definition: RecEmcHit.h:69
void Assign(const RecEmcID &CellId, const RecEmcEnergy &Energy, const RecEmcTime &Time)
Definition: RecEmcHit.cxx:99
RecEmcEnergy Energy(const RecEmcEnergy &Energy)
Definition: RecEmcHit.cxx:87
HepPoint3D getFrontCenter() const
Definition: RecEmcHit.cxx:69
RecEmcID CellId(const RecEmcID &CellId)
Definition: RecEmcHit.cxx:81
RecEmcID getCellId() const
Definition: RecEmcHit.h:47
RecEmcID fCellId
Definition: RecEmcHit.h:68
void Dump() const
Definition: RecEmcHit.cxx:108
RecEmcTime Time(const RecEmcTime &Time)
Definition: RecEmcHit.cxx:93
RecEmcTime getTime() const
Definition: RecEmcHit.h:49
RecEmcTime fTime
Definition: RecEmcHit.h:70
HepPoint3D getCenter() const
Definition: RecEmcHit.cxx:57