136 {
137
138
139
140
141
142
143
144
145
146
148 if (
m_debug>0) cout<<
"q d0 phi0 omega: "<<_charge<<
" "<<_d0<<
" "<<_phi0<<
" "<<_omega<<endl;
150 float chisum =0.;
152 bool permitFlips = true;
153 bool lPickHits = true;
155
157 int digiId=0;
158 vector<MdcHit*> t_hitCol;
159 std::vector<HoughRecHit>::iterator
iter = _recHitVec.begin();
160 for (;
iter != _recHitVec.end();
iter++, digiId++) {
161 if( (*iter).getflag()!=0) continue;
162
163
164 const MdcDigi* aDigi = (*iter).digi();
165
166
168
169
170 t_hitCol.push_back(hit);
174
175
178
179 int newAmbig = 0;
180
183 newhot->
setFltLen( (*iter).getRet().second);
184 double distoTrack= (*iter).getDisToTrack();
185
186
187 double ddCut=1.0;
188 int use_in2d=1;
189 if(hit->
driftTime(_bunchT0,0)>1000) use_in2d=0;
190 if(hit->
driftDist(_bunchT0,0)>ddCut) use_in2d=0;
191
193 if(use_in2d==0) continue;
195 }
196
197
202 int fit_stat=false;
203 double chi2=-999.;
206 cout << " global 2d fit failed ";
207 if(newFit) cout <<
" nAct "<<newFit->
nActive();
208 cout<<
"ERR1 failure ="<<err.
failure()<<endl;
209 fit_stat=0;
210 }
211 }else{
214 fit_stat = 1;
215 chi2=newFit->
chisq();
216 if(
m_debug>0) cout<<
"chi2 "<<chi2<<endl;
217 }
218 else {
219 fit_stat = 0;
220 chi2=-999;
221 }
222
223 bool badQuality = false;
227 }
228 badQuality=1;
229 }
233 }
234 badQuality=1;
235 }
239 }
240 badQuality=1;
241 }
244 std::cout<<__FILE__<<
" "<<__LINE__<<
" drop track by nhit"<<nActiveHit <<
" <= "<<
m_dropTrkNhitCut<<std::endl;
245 }
246 badQuality=1;
247 }
248 if( badQuality) fit_stat=0;
249 }
250 if( fit_stat==1 ){
252 cout << " global 2d fit success"<<endl;
253 cout<<__FILE__<<__LINE__<<"AFTER fit 2d "<<endl;
254 newTrack->
print(std::cout);
255 }
258 double phi0=par.
phi0();
259 double omega=par.
omega();
260 double r_temp=-1./par.
omega();
261 double x_cirtemp =
sin(par.
phi0()) *(par.
d0()+1/par.
omega()) * -1.;
262 double y_cirtemp = -1.*
cos(par.
phi0()) *(par.
d0()+1/par.
omega()) * -1;
264 cout<<" circle after globle 2d: "<<"("<<x_cirtemp<<","<<y_cirtemp<<","<<r_temp<<")"<<endl;
265 cout<<"pt_rec: "<<1./omega/333.567<<endl;
266 }
267 _pt=1./omega/333.567;
268 _circleX=x_cirtemp;
269 _circleY=y_cirtemp;
270 _circleR=_charge/omega;
274
275 int nfit2d=0;
276 if(
m_debug>1) cout<<
" hot list:"<<endl;
278 int lay=((
MdcHit*)(hotIter->hit()))->layernumber();
279 int wir=((
MdcHit*)(hotIter->hit()))->wirenumber();
280 int hittemp=lay*1000+wir;
282 if(
m_debug>1){ cout <<
"(" <<((
MdcHit*)(hotIter->hit()))->layernumber()
283 <<
","<<((
MdcHit*)(hotIter->hit()))->wirenumber()
284 <<":"<<hotIter->isActive()<<") ";
285 }
286 if (hotIter->isActive()==1) nfit2d++;
287 hotIter++;
288 }
289 _nfit=nfit2d;
290 }
291 _chi2_aver2D=chi2/_nfit;
292
293 for(int i=0;i<t_hitCol.size();i++){
294 delete t_hitCol[i];
295 }
296 delete newTrack;
297
298 if(
m_debug>0) cout<<
" in 2D fit number of Active hits : "<<_nfit<<endl;
299 return fit_stat;
300}
double sin(const BesAngle a)
double cos(const BesAngle a)
static double m_dropTrkChi2NdfCut
static const MdcCalibFunSvc * _mdcCalibFunSvc
static TrkContextEv * _context
static int m_qualityFactor
static double m_dropTrkChi2Cut
static double m_dropTrkNhitCut
static double m_dropTrkDrCut
double getT0(int layid, int cellid) const
double getTimeWalk(int layid, double Q) const
void setCalibSvc(const MdcCalibFunSvc *calibSvc)
double driftTime(double tof, double z) const
void setCountPropTime(const bool count)
double driftDist(double, int, double, double, double) const
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
virtual Identifier identify() const
unsigned int getChargeChannel() const
virtual double chisq() const =0
virtual int nActive() const =0
virtual TrkExchangePar helix(double fltL) const =0
TrkHitOnTrk * appendHot(const TrkHitOnTrk *theHot)
const TrkHotList & hotList() const
hot_iterator begin() const
virtual int nActive(TrkEnums::TrkViewInfo view=TrkEnums::bothView) const =0
virtual void print(std::ostream &) const
const TrkFit * fitResult() const
bool setFlipAndDrop(TrkRecoTrk &, bool allowFlips, bool allowDrops) const
TrkRecoTrk * makeTrack(const TrkExchangePar &helix, const double chi2, const TrkContext &, double trackT0) const