BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
RecEmcShower.cxx
Go to the documentation of this file.
1//
2// Bes Rec EMC Shower
3//
4// Created by Zhe Wang 2003, 10, 1
5//
6#include <iostream>
7#include <complex>
8
10
11//Constructors and destructors
16
18{
19 //Clear();
20}
21
22//Copy and assignment
24 :DstEmcShower(aShower)
25{
26 Clear();
27 fShowerId=RecEmcID(aShower.cellId());
28}
29
31{
32 Clear();
33 DstEmcShower::operator=(aShower);
34 fShowerId=RecEmcID(aShower.cellId());
35 return *this;
36}
37
38/*RecEmcShower::RecEmcShower(const RecEmcShower& aShower)
39 :ContainedObject(aShower),DstEmcShower(aShower)
40{
41 *this = aShower;
42}
43
44RecEmcShower& RecEmcShower::operator=(const RecEmcShower& aShower)
45{
46 RecEmcFractionMap::const_iterator pFractionMap;
47
48 Clear();
49
50 if(this!=&aShower)
51 {
52 DstEmcShower::operator=(aShower);
53
54 for(pFractionMap=aShower.Begin();
55 pFractionMap!=aShower.End();
56 pFractionMap++){
57 Insert(pFractionMap->second);
58 }
59 fCellId3x3=aShower.CellId3x3();
60 fCellId5x5=aShower.CellId5x5();
61 fTofShower=aShower.TofShower();
62 fShowerId=aShower.ShowerId();
63 fClusterId=aShower.ClusterId();
64 fCluster=aShower.Cluster();
65 fEAll=aShower.EAll();
66 fELepton=aShower.ELepton();
67 fETof2x1=aShower.ETof2x1();
68 fETof2x3=aShower.ETof2x3();
69 //fPosition=aShower.Position();
70 fNearestSeed=aShower.NearestSeed();
71 fThetaGap=aShower.ThetaGap();
72 fPhiGap=aShower.PhiGap();
73 }
74
75 return *this;
76}*/
77
78//Other methods
80{
83 fCellId3x3.clear();
84 fCellId5x5.clear();
85 fFractionMap.clear();
86 //
88 fTofShower=false;
89 fEAll=0;
90 fELepton=0;
91 fETof2x1=0;
92 fETof2x3=0;
93 //
94 //HepPoint3D o(0,0,0);
95 //fPosition=o;
96 //
98 fThetaGap=0;
99 fPhiGap=0;
100}
101
102//Access a Shower
107
108//Access a Cluster
110{
111 fClusterId=id;
112}
113
115{
116 fCluster=pCluster;
117}
118
120{
121 fCellId3x3.clear();
122 fCellId3x3=id3x3;
123}
124
126{
127 fCellId5x5.clear();
128 fCellId5x5=id5x5;
129}
130
131RecEmcFractionMap::const_iterator RecEmcShower::Begin() const
132{
133 return fFractionMap.begin();
134}
135
136RecEmcFractionMap::const_iterator RecEmcShower::End() const
137{
138 return fFractionMap.end();
139}
140
141RecEmcFractionMap::const_iterator RecEmcShower::Find(const RecEmcID& CellId) const
142{
143 // If failed the return vale is End().
144 return fFractionMap.find(CellId);
145}
146
147//Insert and Erase a Fraction
149{
150 fFractionMap[aFraction.getCellId()]=aFraction;
151 return;
152}
153
155{
156 RecEmcFractionMap::const_iterator pFractionMap;
157 pFractionMap=fFractionMap.find(aFraction.getCellId());
158
159 //blank FractionMap
160 if(fFractionMap.empty())
161 {
162 return;
163 }
164
165 //not find
166 if(pFractionMap==End())
167 {
168 return;
169 }
170
171 //find it
172 if(pFractionMap!=End())
173 {
174 fFractionMap.erase(pFractionMap->first);
175 //empty
176 if(fFractionMap.empty())
177 {
178 Clear();
179 return;
180 }
181 //not empty
182 else
183 {
184 return;
185 }
186 }
187}
188
189//Dump out.
191{
192 RecEmcFractionMap::const_iterator pFractionMap;
193
194 cout<<"EMC Shower: ";
195
196 cout<<"Shower Id= ";
197 cout<<fShowerId<<endl;
198
199 for(pFractionMap=fFractionMap.begin();
200 pFractionMap!=fFractionMap.end();
201 pFractionMap++)
202 {
203 pFractionMap->second.Dump();
204 }
205}
206
207
208//physics attribute
209unsigned int RecEmcShower::getSize() const
210{
211 return fFractionMap.size();
212}
213
215{
216 RecEmcFractionMap tmpFractionMap;
217 RecEmcFractionMap::const_iterator pFractionMap;
218
219 for(pFractionMap=fFractionMap.begin();
220 pFractionMap!=fFractionMap.end();
221 pFractionMap++){
222 RecEmcFraction aFraction=pFractionMap->second;
223 tmpFractionMap[aFraction.getCellId()]=aFraction;
224 }
225
226 return tmpFractionMap;
227}
228
230{
231 RecEmcFractionMap tmpFractionMap;
232 if(fFractionMap.empty()) return tmpFractionMap;
233
234 RecEmcFractionMap::const_iterator pFractionMap;
235 ci_RecEmcIDVector pNearCell;
236
237 for(pFractionMap=fFractionMap.begin();
238 pFractionMap!=fFractionMap.end();
239 pFractionMap++){
240 for(pNearCell=fCellId3x3.begin();
241 pNearCell!=fCellId3x3.end();
242 pNearCell++){
243 if(pFractionMap->second.getCellId()==*pNearCell){
244 RecEmcFraction aFraction=pFractionMap->second;
245 tmpFractionMap[aFraction.getCellId()]=aFraction;
246 }
247 }
248 }
249
250 return tmpFractionMap;
251}
252
254{
255 RecEmcFractionMap tmpFractionMap;
256 if(fFractionMap.empty()) return tmpFractionMap;
257
258 RecEmcFractionMap::const_iterator pFractionMap;
259 ci_RecEmcIDVector pNearCell;
260
261 for(pFractionMap=fFractionMap.begin();
262 pFractionMap!=fFractionMap.end();
263 pFractionMap++){
264 for(pNearCell=fCellId5x5.begin();
265 pNearCell!=fCellId5x5.end();
266 pNearCell++){
267 if(pFractionMap->second.getCellId()==*pNearCell){
268 RecEmcFraction aFraction=pFractionMap->second;
269 tmpFractionMap[aFraction.getCellId()]=aFraction;
270 }
271 }
272 }
273
274 return tmpFractionMap;
275}
276
277//////////////////////////////////////////////////
294///////////////////////////////////////////////
295
297{
298 return fNearestSeed;
299}
300
305
307{
308 return fThetaGap;
309}
310
311int RecEmcShower::ThetaGap(int ThetaGap)
312{
313 return fThetaGap=ThetaGap;
314}
315
317{
318 return fPhiGap;
319}
320
321int RecEmcShower::PhiGap(int PhiGap)
322{
323 return fPhiGap=PhiGap;
324}
325
326ostream& operator<<(ostream & os, const RecEmcShower& aShower)
327{
328 RecEmcFractionMap::const_iterator pFractionMap;
329 RecEmcFractionMap::const_iterator ciFractionMap3x3;
330 RecEmcFractionMap::const_iterator ciFractionMap5x5;
331
332 os<<"------------------RecEmcShower:"<<endl;
333 os<<"Track id: "<<aShower.trackId()<<", number of hits: "<<aShower.getSize()
334 <<", status: "<<aShower.status()<<", shower id: "<<aShower.getShowerId()
335 <<", cluster id: "<<aShower.getClusterId()<<", module: "<<aShower.module()
336 <<", time: "<<aShower.time()<<endl;
337 os<<"Energy: "<<aShower.energy()<<", de: "<<aShower.dE()
338 <<", eseed: "<<aShower.eSeed()
339 <<", e3x3: "<<aShower.e3x3()<<", e5x5: "<<aShower.e5x5()
340 <<", eall: "<<aShower.getEAll()<<", elepton: "<<aShower.getELepton()<<endl;
341 os<<"Position: "<<aShower.position()
342 <<", theta: "<<aShower.theta()<<", phi: "<<aShower.phi()
343 <<"\ndx: "<<aShower.dx()<<", dy: "<<aShower.dy()<<", dz: "<<aShower.dz()
344 <<", dtheta: "<<aShower.dtheta()<<", dphi: "<<aShower.dphi()<<endl;
345 os<<"Second moment: "<<aShower.secondMoment()
346 <<", lat moment: "<<aShower.latMoment()
347 <<", a20 moment: "<<aShower.a20Moment()
348 <<", a42 moment: "<<aShower.a42Moment()<<endl;
349 os<<"Error matrix: \n"<<aShower.errorMatrix()<<endl;
350
351 if(aShower.getSize()>0) {
352 os<<"Fraction Map: "<<endl;
353 for(pFractionMap=aShower.Begin();
354 pFractionMap!=aShower.End();
355 pFractionMap++){
356 os<< (pFractionMap->second);
357 }
358 }
359
360 RecEmcFractionMap fracMap = aShower.getFractionMap3x3();
361 if(fracMap.size()>0) {
362 os<<"Fraction Map 3x3: "<<endl;
363 for(ciFractionMap3x3=fracMap.begin();
364 ciFractionMap3x3!=fracMap.end();
365 ciFractionMap3x3++){
366 os<< (ciFractionMap3x3->second);
367 }
368 }
369
370 fracMap = aShower.getFractionMap5x5();
371 if(fracMap.size()>0) {
372 os<<"Fraction Map 5x5: "<<endl;
373 for(ciFractionMap5x5=fracMap.begin();
374 ciFractionMap5x5!=fracMap.end();
375 ciFractionMap5x5++){
376 os<< (ciFractionMap5x5->second);
377 }
378 }
379
380 os<<endl;
381
382 return os;
383}
384
RecEmcIDVector::const_iterator ci_RecEmcIDVector
double RecEmcEnergy
vector< RecEmcID > RecEmcIDVector
Identifier RecEmcID
map< RecEmcID, RecEmcFraction, less< RecEmcID > > RecEmcFractionMap
ostream & operator<<(ostream &os, const RecEmcShower &aShower)
#define NULL
double dy() const
int cellId() const
HepPoint3D position() const
int status() const
double latMoment() const
double a42Moment() const
double eSeed() const
double dphi() const
double theta() const
int module() const
double e3x3() const
double dz() const
double phi() const
double dx() const
double secondMoment() const
int trackId() const
HepSymMatrix errorMatrix() const
double e5x5() const
double time() const
double a20Moment() const
double energy() const
double dE() const
double dtheta() const
void clear()
Reset to invalid state.
Definition Identifier.h:152
RecEmcID getCellId() const
Definition RecEmcHit.h:47
RecEmcFractionMap::const_iterator End() const
void CellId3x3(RecEmcIDVector &id3x3)
RecEmcFractionMap getFractionMap5x5() const
RecEmcEnergy ETof2x3(RecEmcEnergy e)
RecEmcEnergy EAll(RecEmcEnergy e)
RecEmcFractionMap getFractionMap() const
RecEmcID getClusterId() const
RecEmcEnergy ETof2x1(RecEmcEnergy e)
RecEmcEnergy ELepton(RecEmcEnergy e)
RecEmcID getShowerId() const
RecEmcEnergy getELepton() const
RecEmcID fShowerId
RecEmcFractionMap::const_iterator Begin() const
RecEmcEnergy fETof2x1
RecEmcCluster * fCluster
void ClusterId(const RecEmcID id)
RecEmcEnergy fETof2x3
RecEmcFractionMap::const_iterator Find(const RecEmcID &CellId) const
RecEmcID ShowerId(RecEmcID id)
void Dump() const
unsigned int getSize() const
RecEmcID fClusterId
void Cluster(RecEmcCluster *pCluster)
void Erase(const RecEmcFraction &aFraction)
int ThetaGap() const
RecEmcID NearestSeed() const
void Insert(const RecEmcFraction &aFraction)
int PhiGap() const
RecEmcFractionMap fFractionMap
RecEmcEnergy getEAll() const
RecEmcEnergy fEAll
RecEmcShower & operator=(const DstEmcShower &aShower)
RecEmcEnergy fELepton
RecEmcFractionMap getFractionMap3x3() const
RecEmcID fNearestSeed
void CellId5x5(RecEmcIDVector &id5x5)
RecEmcIDVector fCellId5x5
RecEmcIDVector fCellId3x3
#define ns(x)
Definition xmltok.c:1504