BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecSplitWeighted Class Reference

#include <EmcRecSplitWeighted.h>

+ Inheritance diagram for EmcRecSplitWeighted:

Public Member Functions

 EmcRecSplitWeighted ()
 
 ~EmcRecSplitWeighted ()
 
virtual void Split (RecEmcCluster &aCluster, const RecEmcIDVector &aMaxVec, RecEmcShowerMap &aShowerMap)
 
- Public Member Functions inherited from EmcRecSplitAbs
 EmcRecSplitAbs ()
 
virtual ~EmcRecSplitAbs ()
 
virtual void Split (RecEmcCluster &aCluster, const RecEmcIDVector &aMaxVec, RecEmcShowerMap &aShowerMap)=0
 

Public Attributes

EmcRecShowerEnergyfShowerE
 
EmcRecShowerPosAbsfShowerPos
 
EmcRecShowerShapefShowerShape
 

Detailed Description

Definition at line 17 of file EmcRecSplitWeighted.h.

Constructor & Destructor Documentation

◆ EmcRecSplitWeighted()

EmcRecSplitWeighted::EmcRecSplitWeighted ( )

◆ ~EmcRecSplitWeighted()

EmcRecSplitWeighted::~EmcRecSplitWeighted ( )

Definition at line 34 of file EmcRecSplitWeighted.cxx.

35{
36 delete fShowerE;
37 delete fShowerPos;
38 delete fShowerShape;
39}

Member Function Documentation

◆ Split()

void EmcRecSplitWeighted::Split ( RecEmcCluster aCluster,
const RecEmcIDVector aMaxVec,
RecEmcShowerMap aShowerMap 
)
virtual

Implements EmcRecSplitAbs.

Definition at line 41 of file EmcRecSplitWeighted.cxx.

44{
45 //A exponential function will be used to describe the shape of a shower.
46 //Energy fall off with distance from centre of shower is exp(-a*dist/r)
47 //dist: distance from center
48 //r: moliere radius
49 //a: a parameter, needed to be optimised
51
52 //Calculate the cut of second moment
53 double eCluster=aCluster.getEnergy();
54 double cut=0;
55 if(eCluster>Para.SmCut(3)) {
56 cut=Para.SmCut(0)*exp(-(eCluster)/Para.SmCut(1))+Para.SmCut(2);
57 } else {
58 cut=Para.SmCut(0)*exp(-(Para.SmCut(3))/Para.SmCut(1))+Para.SmCut(2); //constant
59 }
60 cut/=10;
61
62 RecEmcShower aShower;
63 RecEmcHit aHit;
64 RecEmcFraction aFraction;
65 RecEmcHitMap::const_iterator ciHitMap;
66 if(aMaxVec.size()==0) {
67 // the cluster is abandoned
68 }
69
70 // only one seed or second moment belows cut
71 else if(aMaxVec.size()==1||aMaxVec.size()>20||aCluster.getSecondMoment()<cut) {
72 aShower.Clear();
73 aShower.setStatus(1);
74 // ID
75 aShower.ShowerId(aMaxVec[0]);
76 aShower.ClusterId(aCluster.getClusterId());
77 aCluster.InsertShowerId(aMaxVec[0]);
78 // each fraction
79 double time=aCluster.Find(aMaxVec[0])->second.getTime();
80 if(time>=Para.TimeMin()&&time<=Para.TimeMax()) {
81 for(ciHitMap=aCluster.Begin();
82 ciHitMap!=aCluster.End();
83 ++ciHitMap) {
84 aHit=ciHitMap->second;
85 //if((aHit.time()>=Para.TimeMin()) &&
86 //(aHit.time()<=Para.TimeMax())){
87 aFraction=aHit;
88 aFraction.Fraction(1);
89 aShower.Insert(aFraction);
90 //}
91 }
92
93 aShower.setTime(time);
94 fShowerE->Energy(aShower);
95 fShowerPos->Position(aShower);
97 aShower.ThetaGap(9);
98 aShower.PhiGap(9);
99 // push it into map
100 aShowerMap[aMaxVec[0]]=aShower;
101 }
102 }
103
104
105 // two or more seeds and second moment beyonds cut
106 else if(aMaxVec.size()>1&&aMaxVec.size()<=20&&aCluster.getSecondMoment()>cut) {
107 //cout<<"In EmcRecSplitWeighted: ";
108 //cout<<aMaxVec.size();
109 //cout<<" seeds in a cluster"<<endl;
110
111 RecEmcCluster tmpCluster=aCluster;
112 RecEmcHitMap::const_iterator ci_HitMap;
113 ci_RecEmcIDVector ciMax, ciMax1;;
114 RecEmcShower aShower;
115 RecEmcShowerMap tmpShowerMap;
116 RecEmcShowerMap::iterator i_ShowerMap,i2_ShowerMap;
117
118 RecEmcFraction aFrac;
119 unsigned int iterations=0; //iteration time
120 double centroidShift; //center shift between 2 iterations
121 map<RecEmcID,HepPoint3D,less<RecEmcID> > showerCentroid; //shower center
122 map<RecEmcID,HepPoint3D,less<RecEmcID> >::const_iterator ci_showerCentroid;
123
124 IEmcRecGeoSvc* iGeoSvc;
125 ISvcLocator* svcLocator = Gaudi::svcLocator();
126 StatusCode sc = svcLocator->service("EmcRecGeoSvc",iGeoSvc);
127 if(sc!=StatusCode::SUCCESS) {
128 //cout<<"Error: Can't get EmcRecGeoSvc"<<endl;
129 }
130
131 //Preparation
132 for(ciMax=aMaxVec.begin();
133 ciMax!=aMaxVec.end();
134 ++ciMax) {
135 //initialize: seed's front center
136 showerCentroid[*ciMax]=iGeoSvc->GetCFrontCenter(*ciMax);
137 }
138 do {
139 centroidShift=0.;
140 tmpShowerMap.clear();
141 for(ciMax=aMaxVec.begin();
142 ciMax!=aMaxVec.end();
143 ++ciMax) {
144 double weightTotal=0.,weight=0.;
145
146 aShower.Clear();
147 aShower.ShowerId(*ciMax);
148
149 // figure out the weight for each cell for each seed
150 for(ci_HitMap=tmpCluster.Begin();
151 ci_HitMap!=tmpCluster.End();
152 ++ci_HitMap) {
153
154 aFrac=ci_HitMap->second;
155 double aDistance=0;
156 RecEmcEnergy aESeed=0;
157
158 bool isSeed=false;
159 for(ciMax1=aMaxVec.begin();
160 ciMax1!=aMaxVec.end();
161 ++ciMax1) {
162 HepPoint3D seedPoint(showerCentroid[*ciMax1]);
163 HepPoint3D hitPoint(iGeoSvc->GetCFrontCenter(aFrac.getCellId()));
164
165 RecEmcEnergy theESeed=tmpCluster.Find(*ciMax1)->second.getEnergy();
166 double theDistance;
167 if(*ciMax1==aFrac.getCellId()) {
168 isSeed=true;
169 theDistance=0.;
170 } else {
171 theDistance=(hitPoint-seedPoint).mag();
172 }
173
174 if(*ciMax1==*ciMax) {
175 aDistance=theDistance;
176 aESeed=theESeed;
177 }
178
179 weightTotal+=theESeed*exp(-Para.LateralProfile()*theDistance/Para.MoliereRadius());
180 }
181
182 weight=aESeed*exp(-Para.LateralProfile()*aDistance/Para.MoliereRadius())/weightTotal;
183 aFrac.Fraction(weight);
184 //if((aFrac.time()>=Para.TimeMin() &&
185 //aFrac.time()<=Para.TimeMax()) ||
186 //isSeed) {
187 if(aFrac.getEnergy()*aFrac.getFraction()>Para.ElectronicsNoiseLevel()) {
188 aShower.Insert(aFrac);
189 }
190 //}
191 weightTotal=0;
192 }
193
194 fShowerE->Energy(aShower);
195 fShowerPos->Position(aShower);
196 HepPoint3D newCentroid(aShower.position());
197 HepPoint3D oldCentroid(showerCentroid[*ciMax]);
198 centroidShift+=(newCentroid-oldCentroid).mag();
199 tmpShowerMap[aShower.getShowerId()]=aShower;
200 showerCentroid[*ciMax]=newCentroid;
201 }
202
203 centroidShift/=(double)aMaxVec.size();
204 for(ci_showerCentroid=showerCentroid.begin();
205 ci_showerCentroid!=showerCentroid.end();
206 ci_showerCentroid++){
207 showerCentroid[ci_showerCentroid->first]
208 =tmpShowerMap[ci_showerCentroid->first].position();
209 }
210 iterations++;
211 //cout<<"iterations: "<<iterations<<"\tcentroidShift: "<<centroidShift<<endl;
212 }
213 while((iterations<8)&&(centroidShift>0.01));
214
215 unsigned int tht,phi;
216 unsigned int tht2,phi2;
217 unsigned int dtht,dphi;
218 unsigned int thetagap=0,phigap=0;
219 double distmin,dist;
220 RecEmcID id,id2,nearest;
221 // shower attributes
222 for(i_ShowerMap=tmpShowerMap.begin();
223 i_ShowerMap!=tmpShowerMap.end();
224 ++i_ShowerMap) {
225 aCluster.InsertShowerId(i_ShowerMap->second.getShowerId());
226 i_ShowerMap->second.ClusterId(aCluster.getClusterId());
227 i_ShowerMap->second.setStatus(2);
228 fShowerE->Energy(i_ShowerMap->second);
229 fShowerPos->Position(i_ShowerMap->second);
230 fShowerShape->CalculateMoment(i_ShowerMap->second);
231 //
232 // min theta, phi gap
233 id=(i_ShowerMap->second).getShowerId();
234 tht=EmcID::theta_module(id);
235 phi=EmcID::phi_module(id);
236 distmin=999999;
237 for(i2_ShowerMap=tmpShowerMap.begin();
238 i2_ShowerMap!=tmpShowerMap.end();
239 ++i2_ShowerMap) {
240 id2=(i2_ShowerMap->second).getShowerId();
241 tht2=EmcID::theta_module(id2);
243 if(id!=id2) {
244 dtht=tht>tht2 ? tht-tht2 : tht2-tht;
245 dphi=phi>phi2 ? phi-phi2 : phi2-phi;
246 if(dphi>(EmcID::getPHI_BARREL_MAX()+1)/2) dphi=EmcID::getPHI_BARREL_MAX()+1-dphi;
247 dist=sqrt(double(dtht*dtht+dphi*dphi));
248 if(dist<distmin) {
249 distmin=dist;
250 nearest=id2;
251 if(dtht>6) dtht=6;
252 if(dphi>6) dphi=6;
253 thetagap=dtht;
254 phigap=dphi;
255 }
256 }
257 }
258 //cout<<"+++++"<<id<<" "<<thetagap<<" "<<phigap<<endl;
259 i_ShowerMap->second.NearestSeed(nearest);
260 i_ShowerMap->second.ThetaGap(thetagap);
261 i_ShowerMap->second.PhiGap(phigap);
262
263 // save it
264 double time=
265 i_ShowerMap->second.Find(i_ShowerMap->second.getShowerId())->second.getTime();
266 if(time>=Para.TimeMin() && time<=Para.TimeMax() &&
267 (i_ShowerMap->second.getEAll()>Para.EThresholdCluster())) {
268 i_ShowerMap->second.setTime(time);
269 aShowerMap[i_ShowerMap->first]=i_ShowerMap->second;
270 }
271 }
272 tmpShowerMap.clear();
273 }
274
275}
Double_t phi2
Double_t time
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:252
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared cut
Definition: KarFin.h:27
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
Definition: KarFin.h:34
RecEmcIDVector::const_iterator ci_RecEmcIDVector
double RecEmcEnergy
map< RecEmcID, RecEmcShower, less< RecEmcID > > RecEmcShowerMap
Definition: RecEmcShower.h:169
HepPoint3D position() const
Definition: DstEmcShower.h:34
void setStatus(int st)
Definition: DstEmcShower.h:59
void setTime(double time)
Definition: DstEmcShower.h:70
static unsigned int getPHI_BARREL_MAX()
Definition: EmcID.cxx:107
static unsigned int theta_module(const Identifier &id)
Definition: EmcID.cxx:43
static unsigned int phi_module(const Identifier &id)
Definition: EmcID.cxx:48
double EThresholdCluster() const
double ElectronicsNoiseLevel() const
double LateralProfile() const
double TimeMax() const
double MoliereRadius() const
double TimeMin() const
double SmCut(int n) const
void Energy(RecEmcShower &aShower)
virtual void Position(RecEmcShower &aShower)=0
void CalculateMoment(RecEmcShower &aShower) const
virtual HepPoint3D GetCFrontCenter(const Identifier &id) const =0
RecEmcEnergy getEnergy() const
RecEmcID getClusterId() const
Definition: RecEmcCluster.h:41
RecEmcHitMap::const_iterator Find(const RecEmcID &CellId) const
double getSecondMoment() const
RecEmcHitMap::const_iterator Begin() const
RecEmcHitMap::const_iterator End() const
void InsertShowerId(const RecEmcID id)
RecEmcFrac Fraction(const RecEmcFrac &Fraction)
RecEmcFrac getFraction() const
RecEmcEnergy getEnergy() const
Definition: RecEmcHit.h:48
RecEmcID getCellId() const
Definition: RecEmcHit.h:47
RecEmcID getShowerId() const
Definition: RecEmcShower.h:55
void ClusterId(const RecEmcID id)
RecEmcID ShowerId(RecEmcID id)
int ThetaGap() const
void Insert(const RecEmcFraction &aFraction)
int PhiGap() const

Member Data Documentation

◆ fShowerE

EmcRecShowerEnergy* EmcRecSplitWeighted::fShowerE

Definition at line 29 of file EmcRecSplitWeighted.h.

Referenced by EmcRecSplitWeighted(), Split(), and ~EmcRecSplitWeighted().

◆ fShowerPos

EmcRecShowerPosAbs* EmcRecSplitWeighted::fShowerPos

Definition at line 30 of file EmcRecSplitWeighted.h.

Referenced by EmcRecSplitWeighted(), Split(), and ~EmcRecSplitWeighted().

◆ fShowerShape

EmcRecShowerShape* EmcRecSplitWeighted::fShowerShape

Definition at line 31 of file EmcRecSplitWeighted.h.

Referenced by EmcRecSplitWeighted(), Split(), and ~EmcRecSplitWeighted().


The documentation for this class was generated from the following files: