27 _circleR=other._circleR;
28 _circleX=other._circleX;
29 _circleY=other._circleY;
33 _charge=other._charge;
36 _chi2_aver2D=other._chi2_aver2D;
37 _bunchT0=other._bunchT0;
40 _recHitVec=other._recHitVec;
85 int hitCandiSize=_recHitVec.size();
87 for(
int i=0;i<hitCandiSize;i++){
91 x_sum=x_sum+( _recHitVec[i].getMidX() );
92 y_sum=y_sum+( _recHitVec[i].getMidY() );
93 x2_sum=x2_sum+( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidX() );
94 y2_sum=y2_sum+( _recHitVec[i].getMidY() )*( _recHitVec[i].getMidY() );
95 x3_sum=x3_sum+( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidX() );
96 y3_sum=y3_sum+( _recHitVec[i].getMidY() )*( _recHitVec[i].getMidY() )*( _recHitVec[i].getMidY() );
97 x2y_sum=x2y_sum+( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidY() );
98 xy2_sum=xy2_sum+( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidY() )*( _recHitVec[i].getMidY() );
99 xy_sum=xy_sum+( _recHitVec[i].getMidX() )*( _recHitVec[i].getMidY() );
102 a1=x2_sum-x_sum*x_sum/hitCandiSize;
103 a2=xy_sum-x_sum*y_sum/hitCandiSize;
105 b2=y2_sum-y_sum*y_sum/hitCandiSize;
106 c1=(x3_sum+xy2_sum-x_sum*(x2_sum+y2_sum)/hitCandiSize)/2.;
107 c2=(y3_sum+x2y_sum-y_sum*(x2_sum+y2_sum)/hitCandiSize)/2.;
113 _circleX =(b1*c2-b2*c1)/(b1*b1-a1*b2);
114 _circleY =(b1*c1-a1*c2)/(b1*b1-a1*b2);
115 _circleR=sqrt( (x2_sum+y2_sum-2*_circleX*x_sum-2*_circleY*y_sum)/hitCandiSize+_circleX*_circleX+_circleY*_circleY );
119 _d0=sqrt(_circleX*_circleX+_circleY*_circleY)-_circleR;
120 _phi0=atan2(_circleY,_circleX)+
M_PI/2.;
122 double pt_temp=_circleR/333.567;
123 if(
m_debug>0) cout<<
" pt: "<<pt_temp<<endl;
124 if(
m_debug>0) cout<<
"par: ("<<_d0<<
","<<_phi0<<
","<<_omega<<
")"<<endl;
127 _circleX_least =(b1*c2-b2*c1)/(b1*b1-a1*b2);
128 _circleY_least =(b1*c1-a1*c2)/(b1*b1-a1*b2);
129 _circleR_least=sqrt( (x2_sum+y2_sum-2*_circleX*x_sum-2*_circleY*y_sum)/hitCandiSize+_circleX*_circleX+_circleY*_circleY );
148 if (
m_debug>0) cout<<
"q d0 phi0 omega: "<<_charge<<
" "<<_d0<<
" "<<_phi0<<
" "<<_omega<<endl;
152 bool permitFlips =
true;
153 bool lPickHits =
true;
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;
164 const MdcDigi* aDigi = (*iter).digi();
170 t_hitCol.push_back(hit);
183 newhot->
setFltLen( (*iter).getRet().second);
184 double distoTrack= (*iter).getDisToTrack();
189 if(hit->
driftTime(_bunchT0,0)>1000) use_in2d=0;
190 if(hit->
driftDist(_bunchT0,0)>ddCut) use_in2d=0;
193 if(use_in2d==0)
continue;
206 cout <<
" global 2d fit failed ";
207 if(newFit) cout <<
" nAct "<<newFit->
nActive();
208 cout<<
"ERR1 failure ="<<err.
failure()<<endl;
215 chi2=newFit->
chisq();
216 if(
m_debug>0) cout<<
"chi2 "<<chi2<<endl;
223 bool badQuality =
false;
244 std::cout<<__FILE__<<
" "<<__LINE__<<
" drop track by nhit"<<nActiveHit <<
" <= "<<
m_dropTrkNhitCut<<std::endl;
248 if( badQuality) fit_stat=0;
252 cout <<
" global 2d fit success"<<endl;
253 cout<<__FILE__<<__LINE__<<
"AFTER fit 2d "<<endl;
254 newTrack->
print(std::cout);
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;
267 _pt=1./omega/333.567;
270 _circleR=_charge/omega;
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()<<
") ";
286 if (hotIter->isActive()==1) nfit2d++;
291 _chi2_aver2D=chi2/_nfit;
293 for(
int i=0;i<t_hitCol.size();i++){
298 if(
m_debug>0) cout<<
" in 2D fit number of Active hits : "<<_nfit<<endl;
342 cout<<
" print hough2d "<<endl;
343 cout<<
"par: "<<_d0<<
" "<<_phi0<<
" "<<_omega<<endl;
double sin(const BesAngle a)
double cos(const BesAngle a)
std::vector< HoughRecHit > recHitCol
static double m_dropTrkChi2NdfCut
static double m_dropTrkDzCut
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