76 {
77 if(_charge==-1){
78
79
80
81 }
82 if(_charge==1){
83
84
85
86
87 }
88
89
90
92 if (
m_debug>0) cout<<
"q d0 phi0 omega: "<<_charge<<
" "<<_d0<<
" "<<_phi0<<
" "<<_omega<<
" "<<_tanl<<
" "<<_z0<<endl;
94 float chisum =0.;
96
97 bool permitFlips = true;
98 bool lPickHits = true;
101 int digiId=0;
102 std::vector<HoughRecHit>::iterator
iter = _recHitVec.begin();
103 for (;
iter != _recHitVec.end();
iter++, digiId++) {
104 if( (*iter).getflag()!=0 ) continue;
105
106
107
108
109 const MdcDigi* aDigi = (*iter).digi();
111
112 vector<MdcHit*>::const_iterator iter_digi = (*vec_mdcHit).
begin();
113 for (;iter_digi != (*vec_mdcHit).end(); iter_digi++) {
114 if( (*iter_digi)->digi() == (*iter).digi() ) {
115 hit = (*iter_digi);
116 }
117 }
123
124 int newAmbig = 0;
125
128 double flight;
129 double z_flight;
130
131
132 flight = (*iter).getRet().second;
133 double distoTrack= (*iter).getDisToTrack();
134
135
137
138
139 int use_in3d=1;
140
141 if(hit->
driftTime(_bunchT0,0)>1000) use_in3d=0;
142
143 if(
m_debug>0) cout<<
"flt : "<<flight<<endl;
145
146 if(use_in3d==0) continue;
148 }
150
155 int fit_stat=false;
156 double chi2=-999.;
158
160 cout << " global 3d fit failed ";
161 if(newFit) cout <<
" nAct "<<newFit->
nActive();
162 cout<<
"ERR1 failure ="<<err.
failure()<<endl;
163 fit_stat=0;
164 }
165 }else{
168 fit_stat = 1;
169 chi2=newFit->
chisq();
170 }
171 else {
172 fit_stat = 0;
173 chi2=-999;
174 }
175
176 bool badQuality = false;
180 }
181 badQuality=1;
182 }
186 }
187 badQuality=1;
188 }
192 }
193 badQuality=1;
194 }
198 }
199 badQuality=1;
200 }
203 std::cout<<__FILE__<<
" "<<__LINE__<<
" drop track by nhit"<<nActiveHit <<
" <= "<<
m_dropTrkNhitCut<<std::endl;
204 }
205 badQuality=1;
206 }
207
208 if( badQuality) fit_stat=0;
209 }
210 if( fit_stat!=1 ){
211 delete newTrack;
213 }
214 if( fit_stat==1 ){
216 cout << " global 3d fit success"<<endl;
217 cout<<__FILE__<<__LINE__<<"AFTER fit 3d "<<endl;
218 newTrack->
print(std::cout);
219 }
226
227 _circleR=_charge/par.
omega();
230 double pxy=fabs(_circleR/333.567);
231 double pz=pxy*par.
tanDip();
232 double pxyz=_charge*sqrt(pxy*pxy+pz*pz);
233 _pt=pxy;
234 _pz=pz;
235 _p=pxyz;
237 cout<<" circle after globle 3d: "<<"("<<_circleX<<","<<_circleY<<","<<_circleR<<")"<<endl;
238 cout<<"pt_rec: "<<_pt<<endl;
239 cout<<"pz_rec: "<<_pz<<endl;
240 cout<<"p_rec: "<<_p<<endl;
241 }
242
243 int nfit3d=0;
244 if(
m_debug>0) cout<<
" hot list:"<<endl;
246 int lay=((
MdcHit*)(hotIter->hit()))->layernumber();
247 int wir=((
MdcHit*)(hotIter->hit()))->wirenumber();
249 if(
m_debug>0){ cout <<
"(" <<((
MdcHit*)(hotIter->hit()))->layernumber()
250 <<
","<<((
MdcHit*)(hotIter->hit()))->wirenumber()
251 <<":"<<hotIter->isActive()<<") ";
252 }
253
254 if (hotIter->isActive()==1) nfit3d++;
255 hotIter++;
256 }
257 _nfit=nfit3d;
258 }
259 _chi2_aver=chi2/_nfit;
260
261
262
263 if(
m_debug>0) cout<<
" in 3D fit number of Active hits : "<<_nfit<<endl;
264 return fit_stat;
265}
double sin(const BesAngle a)
double cos(const BesAngle a)
vector< TrkRecoTrk * > vectrk_for_clean
static double m_dropTrkDzCut
static double m_dropTrkNhitCut
static TrkContextEv * _context
static double m_dropTrkDrCut
static const MdcCalibFunSvc * _mdcCalibFunSvc
static double m_dropTrkChi2NdfCut
static double m_dropTrkChi2Cut
static int m_qualityFactor
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
TrkFundHit::hot_iterator begin() const
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 printAll(std::ostream &) const
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