44 for(
int iline=0;iline<8;iline++){
45 linefit[iline].
_pointCol.push_back( *(_recStereoHit[0]) );
46 linefit[iline].
_pointCol.push_back( *(_recStereoHit[1]) );
47 linefit[iline].
_pointCol.push_back( *(_recStereoHit[2]) );
50 for(
int i =0;i<3;i++){
51 cout<<
" the first 3 hits ("<<i<<
" "<< _recStereoHit[i]->getLayerId()<<
","<<_recStereoHit[i]->getWireId()<<
")"<<endl;
52 cout<<
" left "<<(_recStereoHit[i])->getsAmb(0)<<
" "<<(_recStereoHit[i])->getzAmb(0)<<endl;
53 cout<<
" right "<<(_recStereoHit[i])->getsAmb(1)<<
" "<<(_recStereoHit[i])->getzAmb(1)<<endl;
91 linefit[i].
_ambig.push_back( linefit[i]._pointCol[0].getAmbig() );
92 linefit[i].
_ambig.push_back( linefit[i]._pointCol[1].getAmbig() );
93 linefit[i].
_ambig.push_back( linefit[i]._pointCol[2].getAmbig() );
94 if(
m_debug>0) cout<<
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^begin line "<<i<<endl;
98 for(
int j=3;j<_hitSize;j++){
99 double chi_last=linefit[i].
_chi;
100 double k_last=linefit[i].
_k;
101 double b_last=linefit[i].
_b;
102 if(
m_debug>0) cout<<
"last "<<j<<
" chi k b "<<chi_last<<
" "<<k_last<<
" "<<b_last<<endl;
103 linefit[i].
_pointCol.push_back( *(_recStereoHit[j]) );
107 linefit[i].
_pointCol[line_size].setAmb(0);
108 if(
m_debug>0) cout<<
"Add point left "<<
"("<<linefit[i].
_pointCol[line_size].getLayerId()<<
","<<linefit[i].
_pointCol[line_size].getWireId()<<
") "<<linefit[i].
_pointCol[line_size].getStyle()<<
" "<<linefit[i].
_pointCol[line_size].getsPos()<<
" "<<linefit[i].
_pointCol[line_size].getzPos()<<endl;
110 double chil=linefit[i].
_chi;
111 double kl=linefit[i].
_k;
112 double bl=linefit[i].
_b;
113 if (linefit[i]._pointCol[line_size].getsPos()==-99) {
116 if(
m_debug>0) cout<<
"left "<<line_size<<
" chi k b "<<chil<<
" "<<kl<<
" "<<bl<<endl;
118 linefit[i].
_pointCol[line_size].setAmb(1);
119 if(
m_debug>0) cout<<
"Add point right "<<
"("<<linefit[i].
_pointCol[line_size].getLayerId()<<
","<<linefit[i].
_pointCol[line_size].getWireId()<<
") "<<linefit[i].
_pointCol[line_size].getStyle()<<
" "<<linefit[i].
_pointCol[line_size].getsPos()<<
" "<<linefit[i].
_pointCol[line_size].getzPos()<<endl;
121 double chir=linefit[i].
_chi;
122 double kr=linefit[i].
_k;
123 double br=linefit[i].
_b;
124 if (linefit[i]._pointCol[line_size].getsPos()==-99) {
127 if(
m_debug>0) cout<<
"right "<<line_size<<
" chi k b "<<chir<<
" "<<kr<<
" "<<br<<endl;
130 linefit[i].
_pointCol[line_size].setAmb(0);
131 linefit[i].
_chi=chil;
134 linefit[i].
_ambig.push_back(0);
137 else linefit[i].
_ambig.push_back(1);
142 for(
int ihit=0;ihit<line_size;ihit++){
143 int ambighit = linefit[i].
_pointCol[ihit].getAmbig();
144 int ambigTruth = linefit[i].
_pointCol[ihit].getLrTruth();
145 int layer =linefit[i].
_pointCol[ihit].getLayerId();
146 int wire=linefit[i].
_pointCol[ihit].getWireId();
156 double dChi = chi_last-linefit[i].
_chi;
157 double dChi_n = (linefit[i].
_chi)/(line_size-1)-(chi_last/line_size);
158 if(
m_debug>0) cout<<
"dChi: "<<dChi<<endl;
159 if(
m_debug>0) cout<<
"dChi/n: "<<dChi_n<<endl;
162 if( fabs(dChi_n) > 25.)
168 linefit[i].
_chi=chi_last;
169 linefit[i].
_k=k_last;
170 linefit[i].
_b=b_last;
171 linefit[i].
_ambig.at(j)=-999;
176 if( (linefit[i]._pointCol[0].getsPos()==-99) || (linefit[i]._pointCol[1].getsPos()==-99) || (linefit[i]._pointCol[2].getsPos()==-99) ) {
177 linefit[i].
_chi=99999;
181 for(
int i=0;i<8;i++){
182 if(
m_debug>0) cout<<
"Line :"<<i<<
" chis: "<<linefit[i].
_chi<<
" k,b: "<<linefit[i].
_k<<
" "<<linefit[i].
_b<<endl;
183 int ambig_correct = 0;
184 for(
int j=0;j<_hitSize;j++){
185 int ambig = linefit[i].
_ambig.at(j);
186 int layer= _recStereoHit.at(j)->getLayerId();
187 int wire= _recStereoHit.at(j)->getWireId();
188 int style= _recStereoHit.at(j)->getStyle();
190 if (ambig!=-999) l= _recStereoHit.at(j)->getsAmb(ambig);
192 if (ambig!=-999) z= _recStereoHit.at(j)->getzAmb(ambig);
194 if (l==-99 && z==-99) ambig=-999;
195 if(
m_debug>0) cout<<
"("<<layer<<
" ,"<<wire<<
") style "<<style<<
" ambig "<<ambig<<
" s "<<l<<
" z "<<z<<endl;
197 _recStereoHit[j]->setAmb(ambig);
198 if( ambig ==-999) _recStereoHit[j]->setflag(-999);
199 int ambigTruth = _recStereoHit.at(j)->getLrTruth();
200 if (ambigTruth == -1) ambigTruth=1;
201 else if (ambigTruth == 1) ambigTruth=0;
202 if(ambig ==ambigTruth) ambig_correct++;
204 _pro_correct = (double)ambig_correct/(
double)_hitSize;
210 if(
m_debug>0) cout<<
"z0 tanl : "<<_z0<<
" "<<_tanl<<endl;