1#include "MdcHoughFinder/Hough3D.h"
2#include "CgemData/CgemHitOnTrack.h"
24 _circleR=other._circleR;
25 _circleX=other._circleX;
26 _circleY=other._circleY;
27 _charge=other._charge;
38 _bunchT0=other._bunchT0;
39 _chi2_aver=other._chi2_aver;
41 _recHitVec=other._recHitVec;
42 vec_mdcHit=other.vec_mdcHit;
50 _d0 = hough2D.
getD0();
67 _d0 = hough2D.
getD0();
98 double phi0 = _phi0-
M_PI/2;
99 double kappa = _omega*333.567;
103 while(phi0<0)phi0+=2*
M_PI;
104 if (
m_debug>0)cout<<
"rec:"<<setw(12)<<dr<<
" "<<setw(12)<<phi0<<
" "<<setw(12)<<kappa<<
" "<<setw(12)<<dz<<
" "<<setw(12)<<tanl<<endl;
111 bool permitFlips =
true;
112 bool lPickHits =
true;
116 std::vector<HoughRecHit>::iterator
iter = _recHitVec.begin();
117 for (;
iter != _recHitVec.end();
iter++, digiId++) {
119 if( (*iter).getflag()!=0 )
continue;
123 if((*iter).getDetectorType()==
MDC) {
124 const MdcDigi* aDigi = (*iter).digi();
127 vector<MdcHit*>::const_iterator iter_digi = (*vec_mdcHit).
begin();
128 for (;iter_digi != (*vec_mdcHit).end(); iter_digi++) {
129 if( (*iter_digi)->digi() == (*iter).digi() ) {
136 if(
m_debug>0)cout<<
"layer: "<<layer<<
" wire: "<<wire<<endl;
149 flight = (*iter).getRet().second;
150 double distoTrack= (*iter).getDisToTrack();
158 if(hit->
driftTime(_bunchT0,0)>1000) use_in3d=0;
163 if(use_in3d==0)
continue;
165 }
else if( (*iter).getDetectorType()==
CGEM && (*iter).getCluster()->getflag()==2){
166 if(
m_debug>0) std::cout<<__FILE__<<
" "<<__LINE__<<
" add CGEM hit to fit "<<std::endl;
203 cout <<
" global 3d fit failed ";
204 if(newFit) cout <<
" nAct "<<newFit->
nActive()<<endl;
205 cout<<
"ERR1 failure ="<<err.
failure()<<endl;
212 chi2=newFit->
chisq();
219 bool badQuality =
false;
246 std::cout<<__FILE__<<
" "<<__LINE__<<
" drop track by nhit"<<nActiveHit <<
" <= "<<
m_dropTrkNhitCut<<std::endl;
251 if( badQuality) fit_stat=0;
259 cout <<
" global 3d fit success"<<endl;
260 cout<<__FILE__<<__LINE__<<
"AFTER fit 3d "<<endl;
261 newTrack->
print(std::cout);
270 double dr = -par.
d0();
272 if(phi0<0)phi0+=2*
M_PI;
273 double kappa = par.
omega()*333.567;
276 if(
m_debug>0)cout<<
"Fit:"<<setw(12)<<dr<<
" "<<setw(12)<<phi0<<
" "<<setw(12)<<kappa<<
" "<<setw(12)<<dz<<
" "<<setw(12)<<tanl<<endl<<endl;
277 _circleR=_charge/par.
omega();
280 double pxy=fabs(_circleR/333.567);
281 double pz=pxy*par.
tanDip();
282 double pxyz=_charge*sqrt(pxy*pxy+pz*pz);
287 cout<<
" circle after globle 3d: "<<
"("<<_circleX<<
","<<_circleY<<
","<<_circleR<<
")"<<endl;
288 cout<<
"pt_rec: "<<_pt<<endl;
289 cout<<
"pz_rec: "<<_pz<<endl;
290 cout<<
"p_rec: "<<_p<<endl;
294 if(
m_debug>0) cout<<
" hot list:"<<endl;
296 int lay=((
MdcHit*)(hotIter->hit()))->layernumber();
297 int wir=((
MdcHit*)(hotIter->hit()))->wirenumber();
301 cout <<
"(" <<((
MdcHit*)(hotIter->hit()))->layernumber()
302 <<
","<<((
MdcHit*)(hotIter->hit()))->wirenumber()
303 <<
":"<<hotIter->isActive()<<
") ";
311 <<
":"<<hotIter->isActive()<<
") ";
319 if (hotIter->isActive()==1) nfit3d++;
324 _chi2_aver=chi2/_nfit;
328 if(
m_debug>0) cout<<
" in 3D fit number of Active hits : "<<_nfit<<endl;
333 cout<<
" print hough3d "<<endl;
334 cout<<
"par: "<<_d0<<
" "<<_phi0<<
" "<<_omega<<
" "<<_tanl<<
" "<<_z0<<endl;
342 for(
int ihit=0;ihit<_recHitVec.size();ihit++){
343 if( _recHitVec[ihit].calDriftDist(_bunchT0,0)>0.8 || _recHitVec[ihit].driftTime(_bunchT0,0)>800 ) _recHitVec[ihit].setflag(-5);
346 vector<int> vec_layer_num[43];
347 for(
int ilay=0;ilay<43;ilay++){
348 for(
int ihit=0;ihit<_recHitVec.size();ihit++){
349 if( _recHitVec[ihit].getLayerId()==ilay && _recHitVec[ihit].getflag()==0 ) {
350 vec_layer_num[ilay].push_back( _recHitVec[ihit].getWireId() );
353 std::sort( vec_layer_num[ilay].begin(),vec_layer_num[ilay].end(),
less_layer_3D);
354 if( vec_layer_num[ilay].size() < 4 )
continue;
355 for(
int j=0;j<vec_layer_num[ilay].size();j++) {
357 for(
int jhit=0;jhit<_recHitVec.size();jhit++) {
358 if( (ilay==_recHitVec[jhit].getLayerId()) && (vec_layer_num[ilay][j]==_recHitVec[jhit].getWireId() ) ) {_recHitVec[jhit].setflag(-1);}
double abs(const EvtComplex &c)
vector< TrkRecoTrk * > vectrk_for_clean
vector< MdcHit * > vec_for_clean
bool less_layer_3D(const int &a, const int &b)
double sin(const BesAngle a)
double cos(const BesAngle a)
std::vector< HoughRecHit > recHitCol
void setCgemCalibFunSvc(const CgemCalibFunSvc *svc)
const RecCgemCluster * baseHit() const
void setCgemGeomSvc(const CgemGeomSvc *svc)
static double m_dropTrkDzCut
static double m_dropTrkNhitCut
static TrkContextEv * _context
static double m_dropTrkDrCut
static const CgemGeomSvc * _cgemGeomSvc
static const MdcCalibFunSvc * _mdcCalibFunSvc
static double m_dropTrkChi2NdfCut
static double m_dropTrkChi2Cut
static int m_qualityFactor
static const CgemCalibFunSvc * _cgemCalibFunSvc
void setCalibSvc(const MdcCalibFunSvc *calibSvc)
double driftTime(double tof, double z) const
void setCountPropTime(const bool count)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
virtual Identifier identify() const
int getlayerid(void) const
int getsheetid(void) 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 print(std::ostream &) const
const TrkFit * fitResult() const
virtual void printAll(std::ostream &) const
bool setFlipAndDrop(TrkRecoTrk &, bool allowFlips, bool allowDrops) const
TrkRecoTrk * makeTrack(const TrkExchangePar &helix, const double chi2, const TrkContext &, double trackT0) const