BOSS 8.0.0
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 <complex>
7#include <iostream>
8
9#include "EmcRecEventModel/RecEmcShower.h"
10
11// Constructors and destructors
13
15 // Clear();
16}
17
18// Copy and assignment
20 Clear();
21 fShowerId = RecEmcID( aShower.cellId() );
22}
23
25 Clear();
26 DstEmcShower::operator=( aShower );
27 fShowerId = RecEmcID( aShower.cellId() );
28 return *this;
29}
30
31/*RecEmcShower::RecEmcShower(const RecEmcShower& aShower)
32 :ContainedObject(aShower),DstEmcShower(aShower)
33{
34 *this = aShower;
35}
36
37RecEmcShower& RecEmcShower::operator=(const RecEmcShower& aShower)
38{
39 RecEmcFractionMap::const_iterator pFractionMap;
40
41 Clear();
42
43 if(this!=&aShower)
44 {
45 DstEmcShower::operator=(aShower);
46
47 for(pFractionMap=aShower.Begin();
48 pFractionMap!=aShower.End();
49 pFractionMap++){
50 Insert(pFractionMap->second);
51 }
52 fCellId3x3=aShower.CellId3x3();
53 fCellId5x5=aShower.CellId5x5();
54 fTofShower=aShower.TofShower();
55 fShowerId=aShower.ShowerId();
56 fClusterId=aShower.ClusterId();
57 fCluster=aShower.Cluster();
58 fEAll=aShower.EAll();
59 fELepton=aShower.ELepton();
60 fETof2x1=aShower.ETof2x1();
61 fETof2x3=aShower.ETof2x3();
62 //fPosition=aShower.Position();
63 fNearestSeed=aShower.NearestSeed();
64 fThetaGap=aShower.ThetaGap();
65 fPhiGap=aShower.PhiGap();
66 }
67
68 return *this;
69}*/
70
71// Other methods
73 fShowerId.clear();
74 fClusterId.clear();
75 fCellId3x3.clear();
76 fCellId5x5.clear();
77 fFractionMap.clear();
78 //
79 fCluster = NULL;
80 fTofShower = false;
81 fEAll = 0;
82 fELepton = 0;
83 fETof2x1 = 0;
84 fETof2x3 = 0;
85 //
86 // HepPoint3D o(0,0,0);
87 // fPosition=o;
88 //
89 fNearestSeed.clear();
90 fThetaGap = 0;
91 fPhiGap = 0;
92}
93
94// Access a Shower
96
97// Access a Cluster
99
100void RecEmcShower::Cluster( RecEmcCluster* pCluster ) { fCluster = pCluster; }
101
103 fCellId3x3.clear();
104 fCellId3x3 = id3x3;
105}
106
108 fCellId5x5.clear();
109 fCellId5x5 = id5x5;
110}
111
112RecEmcFractionMap::const_iterator RecEmcShower::Begin() const { return fFractionMap.begin(); }
113
114RecEmcFractionMap::const_iterator RecEmcShower::End() const { return fFractionMap.end(); }
115
116RecEmcFractionMap::const_iterator RecEmcShower::Find( const RecEmcID& CellId ) const {
117 // If failed the return vale is End().
118 return fFractionMap.find( CellId );
119}
120
121// Insert and Erase a Fraction
122void RecEmcShower::Insert( const RecEmcFraction& aFraction ) {
123 fFractionMap[aFraction.getCellId()] = aFraction;
124 return;
125}
126
127void RecEmcShower::Erase( const RecEmcFraction& aFraction ) {
128 RecEmcFractionMap::const_iterator pFractionMap;
129 pFractionMap = fFractionMap.find( aFraction.getCellId() );
130
131 // blank FractionMap
132 if ( fFractionMap.empty() ) { return; }
133
134 // not find
135 if ( pFractionMap == End() ) { return; }
136
137 // find it
138 if ( pFractionMap != End() )
139 {
140 fFractionMap.erase( pFractionMap->first );
141 // empty
142 if ( fFractionMap.empty() )
143 {
144 Clear();
145 return;
146 }
147 // not empty
148 else { return; }
149 }
150}
151
152// Dump out.
153void RecEmcShower::Dump() const {
154 RecEmcFractionMap::const_iterator pFractionMap;
155
156 cout << "EMC Shower: ";
157
158 cout << "Shower Id= ";
159 cout << fShowerId << endl;
160
161 for ( pFractionMap = fFractionMap.begin(); pFractionMap != fFractionMap.end();
162 pFractionMap++ )
163 { pFractionMap->second.Dump(); }
164}
165
166// physics attribute
167unsigned int RecEmcShower::getSize() const { return fFractionMap.size(); }
168
170 RecEmcFractionMap tmpFractionMap;
171 RecEmcFractionMap::const_iterator pFractionMap;
172
173 for ( pFractionMap = fFractionMap.begin(); pFractionMap != fFractionMap.end();
174 pFractionMap++ )
175 {
176 RecEmcFraction aFraction = pFractionMap->second;
177 tmpFractionMap[aFraction.getCellId()] = aFraction;
178 }
179
180 return tmpFractionMap;
181}
182
184 RecEmcFractionMap tmpFractionMap;
185 if ( fFractionMap.empty() ) return tmpFractionMap;
186
187 RecEmcFractionMap::const_iterator pFractionMap;
188 ci_RecEmcIDVector pNearCell;
189
190 for ( pFractionMap = fFractionMap.begin(); pFractionMap != fFractionMap.end();
191 pFractionMap++ )
192 {
193 for ( pNearCell = fCellId3x3.begin(); pNearCell != fCellId3x3.end(); pNearCell++ )
194 {
195 if ( pFractionMap->second.getCellId() == *pNearCell )
196 {
197 RecEmcFraction aFraction = pFractionMap->second;
198 tmpFractionMap[aFraction.getCellId()] = aFraction;
199 }
200 }
201 }
202
203 return tmpFractionMap;
204}
205
207 RecEmcFractionMap tmpFractionMap;
208 if ( fFractionMap.empty() ) return tmpFractionMap;
209
210 RecEmcFractionMap::const_iterator pFractionMap;
211 ci_RecEmcIDVector pNearCell;
212
213 for ( pFractionMap = fFractionMap.begin(); pFractionMap != fFractionMap.end();
214 pFractionMap++ )
215 {
216 for ( pNearCell = fCellId5x5.begin(); pNearCell != fCellId5x5.end(); pNearCell++ )
217 {
218 if ( pFractionMap->second.getCellId() == *pNearCell )
219 {
220 RecEmcFraction aFraction = pFractionMap->second;
221 tmpFractionMap[aFraction.getCellId()] = aFraction;
222 }
223 }
224 }
225
226 return tmpFractionMap;
227}
228
229//////////////////////////////////////////////////
234///////////////////////////////////////////////
235
237
239
240int RecEmcShower::ThetaGap() const { return fThetaGap; }
241
243
244int RecEmcShower::PhiGap() const { return fPhiGap; }
245
247
248ostream& operator<<( ostream& os, const RecEmcShower& aShower ) {
249 RecEmcFractionMap::const_iterator pFractionMap;
250 RecEmcFractionMap::const_iterator ciFractionMap3x3;
251 RecEmcFractionMap::const_iterator ciFractionMap5x5;
252
253 os << "------------------RecEmcShower:" << endl;
254 os << "Track id: " << aShower.trackId() << ", number of hits: " << aShower.getSize()
255 << ", status: " << aShower.status() << ", shower id: " << aShower.getShowerId()
256 << ", cluster id: " << aShower.getClusterId() << ", module: " << aShower.module()
257 << ", time: " << aShower.time() << endl;
258 os << "Energy: " << aShower.energy() << ", de: " << aShower.dE()
259 << ", eseed: " << aShower.eSeed() << ", e3x3: " << aShower.e3x3()
260 << ", e5x5: " << aShower.e5x5() << ", eall: " << aShower.getEAll()
261 << ", elepton: " << aShower.getELepton() << endl;
262 os << "Position: " << aShower.position() << ", theta: " << aShower.theta()
263 << ", phi: " << aShower.phi() << "\ndx: " << aShower.dx() << ", dy: " << aShower.dy()
264 << ", dz: " << aShower.dz() << ", dtheta: " << aShower.dtheta()
265 << ", dphi: " << aShower.dphi() << endl;
266 os << "Second moment: " << aShower.secondMoment() << ", lat moment: " << aShower.latMoment()
267 << ", a20 moment: " << aShower.a20Moment() << ", a42 moment: " << aShower.a42Moment()
268 << endl;
269 os << "Error matrix: \n" << aShower.errorMatrix() << endl;
270
271 if ( aShower.getSize() > 0 )
272 {
273 os << "Fraction Map: " << endl;
274 for ( pFractionMap = aShower.Begin(); pFractionMap != aShower.End(); pFractionMap++ )
275 { os << ( pFractionMap->second ); }
276 }
277
278 RecEmcFractionMap fracMap = aShower.getFractionMap3x3();
279 if ( fracMap.size() > 0 )
280 {
281 os << "Fraction Map 3x3: " << endl;
282 for ( ciFractionMap3x3 = fracMap.begin(); ciFractionMap3x3 != fracMap.end();
283 ciFractionMap3x3++ )
284 { os << ( ciFractionMap3x3->second ); }
285 }
286
287 fracMap = aShower.getFractionMap5x5();
288 if ( fracMap.size() > 0 )
289 {
290 os << "Fraction Map 5x5: " << endl;
291 for ( ciFractionMap5x5 = fracMap.begin(); ciFractionMap5x5 != fracMap.end();
292 ciFractionMap5x5++ )
293 { os << ( ciFractionMap5x5->second ); }
294 }
295
296 os << endl;
297
298 return os;
299}
RecEmcIDVector::const_iterator ci_RecEmcIDVector
map< RecEmcID, RecEmcFraction, less< RecEmcID > > RecEmcFractionMap
ostream & operator<<(ostream &os, const RecEmcShower &aShower)
double dy() const
double dz() const
double dx() const
RecEmcFractionMap::const_iterator End() const
void CellId3x3(RecEmcIDVector &id3x3)
RecEmcFractionMap getFractionMap5x5() const
RecEmcEnergy ETof2x3(RecEmcEnergy e)
RecEmcEnergy EAll(RecEmcEnergy e)
RecEmcFractionMap getFractionMap() const
RecEmcEnergy ETof2x1(RecEmcEnergy e)
RecEmcEnergy ELepton(RecEmcEnergy e)
RecEmcFractionMap::const_iterator Begin() const
void ClusterId(const RecEmcID id)
RecEmcFractionMap::const_iterator Find(const RecEmcID &CellId) const
RecEmcID ShowerId(RecEmcID id)
void Dump() const
unsigned int getSize() const
void Cluster(RecEmcCluster *pCluster)
void Erase(const RecEmcFraction &aFraction)
int ThetaGap() const
RecEmcID NearestSeed() const
void Insert(const RecEmcFraction &aFraction)
int PhiGap() const
RecEmcShower & operator=(const DstEmcShower &aShower)
RecEmcFractionMap getFractionMap3x3() const
void CellId5x5(RecEmcIDVector &id5x5)
#define ns(x)
Definition xmltok.c:1355