19 _dist = ( other._dist );
20 _charge = ( other._charge );
21 _ptLeast = ( other._ptLeast );
22 _pt2D = ( other._pt2D );
23 _pt3D = ( other._pt3D );
28 _omega = other._omega;
30 _tanl = ( other._tanl );
32 _tanl_zs = ( other._tanl_zs );
33 _z0_zs = ( other._z0_zs );
35 _centerPeak = ( other._centerPeak );
36 _Hough2D = ( other._Hough2D );
37 _Hough3D = ( other._Hough3D );
38 _bunchTime = ( other._bunchTime );
39 _centerX = ( other._centerX );
40 _centerY = ( other._centerY );
41 _centerR = ( other._centerR );
42 _chi2_aver = ( other._chi2_aver );
43 _nfit = ( other._nfit );
44 _chi2_aver2D = ( other._chi2_aver2D );
45 _nfit2D = ( other._nfit2D );
46 _recHitVec = ( other._recHitVec );
47 _stat2D = ( other._stat2D );
48 _stat3D = ( other._stat3D );
50 p_trk2D = other.p_trk2D;
51 _maprho = other._maprho;
52 _maptheta = other._maptheta;
53 t_pro_correct = other.t_pro_correct;
54 _houghList = other._houghList;
55 vec_mdcHit = other.vec_mdcHit;
72 : _dist( other._dist )
73 , _charge( other._charge )
74 , _ptLeast( other._ptLeast )
75 , _pt2D( other._pt2D )
76 , _pt3D( other._pt3D )
80 , _omega( other._omega )
81 , _phi0( other._phi0 )
83 , _tanl( other._tanl )
84 , _z0_zs( other._z0_zs )
85 , _tanl_zs( other._tanl_zs )
86 , _centerPeak( other._centerPeak )
87 , _Hough2D( other._Hough2D )
88 , _Hough3D( other._Hough3D )
89 , _bunchTime( other._bunchTime )
90 , _centerX( other._centerX )
91 , _centerY( other._centerY )
92 , _centerR( other._centerR )
93 , _chi2_aver( other._chi2_aver )
94 , _nfit( other._nfit )
95 , _chi2_aver2D( other._chi2_aver2D )
96 , _nfit2D( other._nfit2D )
97 , _stat2D( other._stat2D )
98 , _stat3D( other._stat3D )
99 , _recHitVec( other._recHitVec )
100 , p_trk( other.p_trk )
101 , p_trk2D( other.p_trk2D )
102 , _maprho( other._maprho )
103 , _maptheta( other._maptheta )
104 , t_pro_correct( other.t_pro_correct )
105 , _houghList( other._houghList )
106 , vec_mdcHit( other.vec_mdcHit ) {
124 for (
int i = 0; i < other._recHitVec.size(); i++ )
127 for (
int j = 0; j < _recHitVec.size(); j++ )
129 if ( _recHitVec[j].digi() == other._recHitVec[i].digi() ) { same = 1; }
136 _recHitVec.push_back( p_hit );
144 double rho,
double theta ) {
145 _centerPeak = centerPeak;
175 int t_size = trackHitList.size();
176 for (
int i = 0; i < t_size; i++ )
178 HoughRecHit p_hit( *( trackHitList[i] ), 0., 0., 1 );
181 _recHitVec.push_back( p_hit );
189 std::sort( _recHitVec.begin(), _recHitVec.end(),
digi_in_track );
195 _bunchTime = bunchtime;
196 _stat2D = fitLeast();
198 _stat2D = fit_global2D( _recHitVec );
206bool less_layer(
const int& a,
const int& b ) {
return a < b; }
208 vector<int> vec_layer_num[43];
209 for (
int ilay = 0; ilay < 43; ilay++ )
211 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
213 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
214 { vec_layer_num[ilay].push_back( _recHitVec[ihit].getWireId() ); }
216 std::sort( vec_layer_num[ilay].begin(), vec_layer_num[ilay].end(),
less_layer );
219 if ( vec_layer_num[ilay].size() < 4 )
continue;
220 for (
int j = 0; j < vec_layer_num[ilay].size(); j++ )
226 for (
int jhit = 0; jhit < _recHitVec.size(); jhit++ )
228 if ( ( ilay == _recHitVec[jhit].getLayerId() ) &&
229 ( vec_layer_num[ilay][j] == _recHitVec[jhit].getWireId() ) )
230 { _recHitVec[jhit].setflag( -1 ); }
247void HoughTrack::collectAxialHit() {
248 vector<HoughRecHit> hitCol;
250 for (
int ilay = 8; ilay < 20; ilay++ )
253 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
255 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
257 hitCol.push_back( _recHitVec[ihit] );
261 lay_contain[ilay - 8] = lay_count;
267 a = (
int**)malloc(
sizeof(
int* ) * 12 );
268 len = (
int*)malloc(
sizeof(
int ) * 12 );
269 for (
int i = 0; i < 12; i++ )
271 int add_lay_count = 0;
272 for (
int s = 0;
s < i;
s++ ) { add_lay_count += lay_contain[
s]; }
273 int n = lay_contain[i];
275 a[i] = (
int*)malloc(
sizeof(
int ) *
n );
276 for (
int j = 0; j <
n; j++ )
278 a[i][j] = add_lay_count + j;
279 cout <<
"aij " << a[i][j] << endl;
280 cout <<
"(" << hitCol[add_lay_count + j].getLayerId() <<
","
281 << hitCol[add_lay_count + j].getWireId() <<
")" << endl;
285 fun( 0, a, len, p, hitCol, numall );
286 cout <<
" num all " << numall << endl;
289void HoughTrack::fun(
int level,
int** a,
int* len,
int* p, vector<HoughRecHit>& hitCol,
293 cout <<
"level " << level <<
" len " << len[level] << endl;
294 for (
int i = 0; i < len[level]; i++ )
296 cout << i <<
" i " << endl;
298 cout << i <<
" i " << endl;
299 cout <<
"fun " << level + 1 << endl;
300 fun( level + 1, a, len, p, hitCol, numall );
305 vector<HoughRecHit> recHitCol;
306 for (
int i = 0; i < 12; i++ )
308 int num = a[i][p[i]];
309 cout <<
"(" << hitCol[
num].getLayerId() <<
"," << hitCol[
num].getWireId() <<
")" << endl;
310 recHitCol.push_back( hitCol[
num] );
312 fit_global2D( recHitCol );
320 int nhit_zs =
calzs();
321 if ( nhit_zs >= 3 )
fitzs();
330 cout <<
" before 3d fit " << endl;
333 _stat3D = fit_global3D( 0 );
339 int nhit_zs =
calzs();
341 if ( nhit_zs >= 3 )
fitzs();
348 cutMultiCirHit_after_zs();
352 cout <<
" before 3d fit " << endl;
355 _stat3D = fit_global3D( 0 );
359void HoughTrack::cutMultiCirHit() {
360 for (
int i = 0; i < _recHitVec.size(); i++ )
362 if ( _recHitVec[i].getLayerId() > 8 )
continue;
363 if ( ( fabs( _recHitVec[i].getzAmb( 0 ) ) > 10 ) &&
364 ( fabs( _recHitVec[i].getzAmb( 1 ) ) > 10 ) )
366 _recHitVec[i].setflag( 1 );
371 _Hough3D.setRecHit( _recHitVec );
374void HoughTrack::cutMultiCirHit_after_zs() {
375 for (
int i = 0; i < _recHitVec.size(); i++ )
377 int layer = _recHitVec[i].getLayerId();
378 double zl = _recHitVec[i].getzAmb( 0 );
379 double zr = _recHitVec[i].getzAmb( 1 );
380 double sl = _recHitVec[i].getsAmb( 0 );
381 double sr = _recHitVec[i].getsAmb( 1 );
382 double dl = zl - ( sl * _tanl + _z0 );
383 double dr = zr - ( sr * _tanl + _z0 );
384 if ( layer <= 8 && fabs( dl ) > 10 && fabs( dr ) > 10 ) _recHitVec[i].setflag( 1 );
385 if ( layer > 8 && fabs( dl ) > 20 && fabs( dr ) > 20 ) _recHitVec[i].setflag( 1 );
388 _Hough3D.setRecHit( _recHitVec );
391int HoughTrack::fitLeast() {
392 _Hough2D = Hough2D( _recHitVec, _bunchTime );
393 double circleR = fabs( 1. / ( _maprho ) );
394 double circleX = ( 1. / _maprho ) *
cos( _maptheta );
395 double circleY = ( 1. / _maprho ) *
sin( _maptheta );
396 double d0 = sqrt( circleX * circleX + circleY * circleY ) - circleR;
397 double phi0 = atan2( circleY, circleX ) +
M_PI / 2.;
398 double omega = 1 / circleR;
402 omega = -1. * fabs( omega );
407 omega = 1. * fabs( omega );
410 _Hough2D.setCharge( _charge );
411 _Hough2D.setCirX( circleX );
412 _Hough2D.setCirY( circleY );
413 _Hough2D.setCirR( circleR );
414 _Hough2D.setD0( d0 );
415 _Hough2D.setPhi0( phi0 );
416 _Hough2D.setOmega( omega );
417 _Hough2D.setPt( circleR / 333.567 );
420 _centerX = _Hough2D.getCirX();
421 _centerY = _Hough2D.getCirY();
422 _centerR = _Hough2D.getCirR();
424 _pt2D = _Hough2D.getPt();
425 _d0 = _Hough2D.getD0();
426 _omega = _Hough2D.getOmega();
427 _phi0 = _Hough2D.getPhi0();
431 cout <<
" after least 2d " << endl;
437int HoughTrack::fit_global2D( vector<HoughRecHit>& recHitVec ) {
440 _Hough2D.setRecHit( recHitVec );
441 int Stat_2d = _Hough2D.fit();
442 p_trk2D = _Hough2D.getTrk();
445 _centerX = _Hough2D.getCirX();
446 _centerY = _Hough2D.getCirY();
447 _centerR = _Hough2D.getCirR();
449 _pt2D = _Hough2D.getPt();
450 _d0 = _Hough2D.getD0();
451 _omega = _Hough2D.getOmega();
452 _phi0 = _Hough2D.getPhi0();
453 _chi2_aver2D = _Hough2D.getChi2_2D();
454 _nfit2D = _Hough2D.getNfit();
455 if (
m_debug > 0 ) cout <<
"pt after global 2d: " << _pt2D << endl;
456 if (
m_debug > 0 ) cout <<
"after global 2d " << endl;
460 cout <<
" after global 2d " << endl;
466 if (
m_debug > 0 ) cout <<
" 2d global fail" << endl;
471int HoughTrack::fit_global3D(
int time ) {
473 _Hough3D = Hough3D( _Hough2D, _recHitVec, _bunchTime, _tanl, _z0, vec_mdcHit );
474 if (
m_debug > 0 ) _Hough3D.print();
476 int Stat_3d = _Hough3D.fit();
477 p_trk = _Hough3D.getTrk();
480 _centerX = _Hough3D.getCirX();
481 _centerY = _Hough3D.getCirY();
482 _centerR = _Hough3D.getCirR();
483 _pt3D = _Hough3D.getPt();
484 _p = _Hough3D.getP();
485 _pz = _Hough3D.getPz();
486 _d0 = _Hough3D.getD0();
487 _omega = _Hough3D.getOmega();
488 _phi0 = _Hough3D.getPhi0();
489 _tanl = _Hough3D.getTanl();
490 _z0 = _Hough3D.getZ0();
491 _chi2_aver = _Hough3D.getChi2();
492 _nfit = _Hough3D.getNfit();
493 if (
m_debug > 0 ) cout <<
"pt after global 3d: " << _pt3D << endl;
498 if (
m_debug > 0 ) cout <<
" 3d global fail" << endl;
503void HoughTrack::hitOnTrack() {
504 if (
m_debug > 0 ) cout <<
" calculate hit on track " << endl;
505 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
507 std::pair<double, double> theta_l = calcuArcTrack( ( _recHitVec[ihit] ) );
508 int flag = judge_half( _recHitVec[ihit] );
509 double dist = calcuDistToTrack( ( _recHitVec[ihit] ) );
510 double distToCir = calcuDistToCir( ( _recHitVec[ihit] ) );
511 _recHitVec[ihit].setflag(
flag );
512 _recHitVec[ihit].setDisToTrack( dist );
513 _recHitVec[ihit].setDisToCir( distToCir );
514 _recHitVec[ihit].setRet( theta_l );
519int HoughTrack::judge_half(
const HoughRecHit& hit ) {
523 double x_cir = _Hough2D.getCirX();
524 double y_cir = _Hough2D.getCirY();
525 double r_cir = _Hough2D.getCirR();
528 if ( ( x_cir * yhit - y_cir * xhit >= 0 ) ) cir = 0;
531 else if ( _charge == 1 )
533 if ( ( x_cir * yhit - y_cir * xhit <= 0 ) ) cir = 0;
536 else cout <<
" charge is not set !!!!!!!!!!" << endl;
541double HoughTrack::calcuDistToTrack(
const HoughRecHit& hit ) {
544 double x_cir = _Hough2D.getCirX();
545 double y_cir = _Hough2D.getCirY();
546 double r_cir = _Hough2D.getCirR();
547 double dist = sqrt( pow( ( xhit - x_cir ), 2 ) + pow( ( yhit - y_cir ), 2 ) ) - r_cir;
551double HoughTrack::calcuDistToCir(
const HoughRecHit& hit ) {
554 double x_cir = _Hough2D.getCirX();
555 double y_cir = _Hough2D.getCirY();
556 double r_cir = _Hough2D.getCirR();
557 double dist = sqrt( pow( ( xhit - x_cir ), 2 ) + pow( ( yhit - y_cir ), 2 ) );
573std::pair<double, double> HoughTrack::calcuArcTrack(
const HoughRecHit& hit ) {
576 double x_cir = _centerX;
577 double y_cir = _centerY;
578 double r_cir = _centerR;
579 std::pair<double, double> theta_l;
582 double l_temp = 1.e9;
583 if ( x_cir == 0 || xhit - x_cir == 0 ) { theta_temp = 0; }
586 theta_temp =
M_PI - atan2( yhit - y_cir, xhit - x_cir ) + atan2( y_cir, x_cir );
587 if ( theta_temp > 2 *
M_PI ) { theta_temp = theta_temp - 2 *
M_PI; }
588 if ( theta_temp < 0 ) { theta_temp = theta_temp + 2 *
M_PI; }
590 if ( _charge == -1 ) { l_temp = r_cir * theta_temp; }
593 theta_temp = 2 *
M_PI - theta_temp;
594 l_temp = r_cir * ( theta_temp );
596 theta_l.first = theta_temp;
597 theta_l.second = l_temp;
603 for (
int i = 0; i < _recHitVec.size(); i++ )
605 if ( _recHitVec[i].getSlayerType() == 0 || _recHitVec[i].getflag() != 0 )
continue;
607 HoughStereo zs( _bunchTime, &_Hough2D, &( _recHitVec[i] ) );
619 int stat = zs.
cald();
620 _recHitVec[i].setnsol( stat );
621 if ( stat == 0 ) _recHitVec[i].setflag( -999 );
624 _recHitVec[i].setAmb( -999 );
626 if ( _recHitVec[i].getLayerId() < 8 ) n_zs++;
638 _z0_zs = zsfit.
getZ0();
639 t_pro_correct = zsfit.
getPro();
644 int size = _recHitVec.size();
645 int n0,
n1,
n2, n3, n4, n5, n6;
646 n0 =
n1 =
n2 = n3 = n4 = n5 = n6 = 0;
647 for (
int i = 0; i < size; i++ )
649 int cir = _recHitVec[i].getCirList();
650 int index = _recHitVec[i].digi()->getTrackIndex();
651 int style = _recHitVec[i].getStyle();
653 if ( style == 1 )
n1++;
654 if ( style == 2 )
n2++;
655 if ( index < 0 ) n3++;
656 if ( index >= 0 && cir <= 1 && style == 0 ) n4++;
657 if ( index < 0 || cir > 1 ) n5++;
658 if ( index >= 0 && cir == 0 && style == 0 ) n6++;
660 if ( select == 0 )
return n0;
661 if ( select == 1 )
return n1;
662 if ( select == 2 )
return n2;
663 if ( select == 3 )
return n3;
664 if ( select == 4 )
return n4;
665 if ( select == 5 )
return n5;
666 if ( select == 6 )
return n6;
667 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
672 int size = _recHitVec.size();
673 int n0,
n1,
n2, n3, n4, n5, n6;
674 n0 =
n1 =
n2 = n3 = n4 = n5 = n6 = 0;
675 for (
int i = 0; i < size; i++ )
677 int cir = _recHitVec[i].getCirList();
678 int index = _recHitVec[i].digi()->getTrackIndex();
679 int type = _recHitVec[i].getSlayerType();
680 int style = _recHitVec[i].getStyle();
681 if (
type == 0 ) n0++;
682 if (
type == 0 && style == 1 )
n1++;
683 if (
type == 0 && style == 2 )
n2++;
684 if (
type == 0 && index < 0 ) n3++;
685 if (
type == 0 && index >= 0 && cir <= 1 && style == 0 ) n4++;
686 if (
type == 0 && ( index < 0 || cir > 1 ) ) n5++;
687 if (
type == 0 && index >= 0 && cir == 0 && style == 0 ) n6++;
689 if ( select == 0 )
return n0;
690 if ( select == 1 )
return n1;
691 if ( select == 2 )
return n2;
692 if ( select == 3 )
return n3;
693 if ( select == 4 )
return n4;
694 if ( select == 5 )
return n5;
695 if ( select == 6 )
return n6;
696 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
700 int size = _recHitVec.size();
701 int n0,
n1,
n2, n3, n4, n5, n6;
702 n0 =
n1 =
n2 = n3 = n4 = n5 = n6 = 0;
703 for (
int i = 0; i < size; i++ )
705 int cir = _recHitVec[i].getCirList();
706 int index = _recHitVec[i].digi()->getTrackIndex();
707 int type = _recHitVec[i].getSlayerType();
708 int style = _recHitVec[i].getStyle();
709 if (
type != 0 ) n0++;
710 if (
type != 0 && style == 1 )
n1++;
711 if (
type != 0 && style == 2 )
n2++;
712 if (
type != 0 && index < 0 ) n3++;
713 if (
type != 0 && index >= 0 && cir <= 1 && style == 0 ) n4++;
714 if (
type != 0 && ( index < 0 || cir > 1 ) ) n5++;
715 if (
type != 0 && index >= 0 && cir == 0 && style == 0 ) n6++;
717 if ( select == 0 )
return n0;
718 if ( select == 1 )
return n1;
719 if ( select == 2 )
return n2;
720 if ( select == 3 )
return n3;
721 if ( select == 4 )
return n4;
722 if ( select == 5 )
return n5;
723 if ( select == 6 )
return n6;
724 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
733 vector<int> vec_layer;
734 for (
int i = 0; i < _recHitVec.size(); i++ )
736 int layer = _recHitVec[i].getLayerId();
737 int slant = _recHitVec[i].getSlayerType();
738 if ( 0 == slant ) axialHit++;
743 if ( axialHit < 5 )
return 0;
758 vector<HoughRecHit> vec_rec;
760 for (
int ihit = 0; ihit < _houghList.size(); ihit++ )
762 const HoughHit hit = _houghList[ihit];
764 if ( hit.
driftTime( _bunchTime, 0 ) > 800 )
continue;
767 std::pair<double, double> theta_l = calcuArcTrack( p_hit );
768 double dist = calcuDistToTrack( p_hit );
769 double distToCir = calcuDistToCir( p_hit );
770 int flag = judge_half( p_hit );
774 if ( layer < 8 ) disCut = 4;
779 cout <<
"(" << layer <<
"," << wire <<
") "
780 <<
" rec hit dist theta " << dist <<
" " << theta_l.first << endl;
781 if ( fabs( dist ) < disCut )
789 if ( p_hit.
getflag() != 0 )
continue;
790 _recHitVec.push_back( p_hit );
798 for (
int ilay = 0; ilay < 43; ilay++ )
801 if ( ( ilay >= 0 && ilay <= 7 ) || ( ilay >= 20 && ilay <= 35 ) )
continue;
803 double disToCir = 9999;
807 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
809 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
812 if ( ( fabs( _recHitVec[ihit].getDisToCir() ) < disToCir ) )
814 disToCir = fabs( _recHitVec[ihit].getDisToCir() );
821 cout <<
"ilay count count_cut " << ilay <<
" " <<
count <<
" " << count_cut << endl;
822 if ( count_cut != 0 &&
count > 1 ) _recHitVec[
max].setflag( -999 );
824 cout <<
"delete (" << _recHitVec[
max].getLayerId() <<
"," << _recHitVec[
max].getWireId()
827 int size_of_axial = 0;
828 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
830 if ( _recHitVec[ihit].getSlayerType() == 0 && _recHitVec[ihit].getflag() == 0 )
833 return size_of_axial;
839 for (
int ilay = 0; ilay < 8; ilay++ )
847 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
849 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
852 if ( ( ( fabs( _recHitVec[ihit].getzAmb( 0 ) ) > z_0 ) &&
853 ( fabs( _recHitVec[ihit].getzAmb( 1 ) ) > z_1 ) ) )
855 if ( z_0 != 0 && z_1 != 0 ) count_cut++;
856 z_0 = fabs( _recHitVec[ihit].getzAmb( 0 ) );
857 z_1 = fabs( _recHitVec[ihit].getzAmb( 1 ) );
860 else if ( ( ( fabs( _recHitVec[ihit].getzAmb( 0 ) ) < z_0 ) &&
861 ( fabs( _recHitVec[ihit].getzAmb( 1 ) ) < z_1 ) ) )
866 cout <<
"ilay count count_cut " << ilay <<
" " <<
count <<
" " << count_cut << endl;
867 if ( count_cut > 0 &&
count > 1 ) _recHitVec[
min].setflag( -999 );
869 cout <<
"delete (" << _recHitVec[
min].getLayerId() <<
"," << _recHitVec[
min].getWireId()
872 int size_of_stereo = 0;
873 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
875 if ( _recHitVec[ihit].getSlayerType() != 0 && _recHitVec[ihit].getflag() == 0 )
878 return size_of_stereo;
882 cout <<
"print rec hit" << endl;
883 double rho = _centerPeak.getRho();
884 double theta = _centerPeak.getTheta();
885 int size = _recHitVec.size();
886 for (
int i = 0; i < size; i++ )
888 int layer = _recHitVec[i].getLayerId();
889 int wire = _recHitVec[i].getWireId();
890 int slant = _recHitVec[i].getSlayerType();
891 int flag = _recHitVec[i].getflag();
892 int style = _recHitVec[i].getStyle();
893 int cirlist = _recHitVec[i].getCirList();
895 std::cout <<
"axial hit (" << layer <<
"," << wire <<
") "
896 << _recHitVec[i].getDisToTrack() <<
" " << _recHitVec[i].getDisToCir() <<
" "
897 <<
flag <<
" " << style <<
" " << cirlist << std::endl;
899 for (
int i = 0; i < size; i++ )
901 int layer = _recHitVec[i].getLayerId();
902 int wire = _recHitVec[i].getWireId();
903 int slant = _recHitVec[i].getSlayerType();
904 int flag = _recHitVec[i].getflag();
905 int style = _recHitVec[i].getStyle();
906 int cirlist = _recHitVec[i].getCirList();
908 std::cout <<
"stereo hit (" << layer <<
"," << wire <<
") "
909 << _recHitVec[i].getDisToTrack() <<
" " <<
flag <<
" " << style <<
" "
910 << cirlist << std::endl;
917 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
919 double xhit = _recHitVec[ihit].getMidX();
920 double yhit = _recHitVec[ihit].getMidY();
921 double x_cir = _Hough2D.getCirX();
922 double y_cir = _Hough2D.getCirY();
923 double r_cir = _Hough2D.getCirR();
924 if ( ( x_cir * yhit - y_cir * xhit >= 0 ) ) n_neg++;
925 if ( ( x_cir * yhit - y_cir * xhit <= 0 ) ) n_pos++;
927 if (
m_debug > 0 ) cout <<
" in track charge 2d " << n_neg <<
" " << n_pos << endl;
928 if ( ( _charge == -1 && n_neg < 3 ) || ( _charge == 1 && n_pos < 3 ) )
return 0;
929 else if ( _charge == 0 ) { cout <<
" wrong ! in track charge 3D not set charge " << endl; }
932 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
939 for (
int ihit = 0; ihit < _recHitVec.size(); ihit++ )
941 if ( _recHitVec[ihit].getSlayerType() == 0 )
continue;
942 if ( _recHitVec[ihit].getLayerId() > 7 )
continue;
943 double xhit = _recHitVec[ihit].getMidX();
944 double yhit = _recHitVec[ihit].getMidY();
945 double x_cir = _Hough2D.getCirX();
946 double y_cir = _Hough2D.getCirY();
947 double r_cir = _Hough2D.getCirR();
948 if ( ( x_cir * yhit - y_cir * xhit >= 0 ) ) n_neg++;
949 if ( ( x_cir * yhit - y_cir * xhit <= 0 ) ) n_pos++;
951 if (
m_debug > 0 ) cout <<
" in track charge 3d " << n_neg <<
" " << n_pos << endl;
952 if ( ( _charge == -1 && n_neg < 2 ) || ( _charge == 1 && n_pos < 2 ) )
return 0;
953 else if ( _charge == 0 ) { cout <<
" wrong ! in track charge 3D not set charge " << endl; }
956 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
961 if ( N <= 2 )
return;
962 double* x =
new double[N];
963 double* y =
new double[N];
964 for (
int i = 0; i < N; i++ )
970 TF1* fpol1 =
new TF1(
"fpol1",
"pol1", -50, 50 );
971 TGraph* tg =
new TGraph( N, x, y );
972 tg->Fit(
"fpol1",
"QN" );
973 double ktemp = fpol1->GetParameter( 1 );
974 double btemp = fpol1->GetParameter( 0 );
984 double k, b, theta, rho, x_cross, y_cross;
985 vector<double> vtemp, utemp;
986 std::vector<HoughRecHit>::iterator
iter = _recHitVec.begin();
987 for (
int iHit = 0;
iter != _recHitVec.end();
iter++, iHit++ )
1001 x_cross = -b / ( k + 1 / k );
1002 y_cross = b / ( 1 + k * k );
1003 rho = sqrt( x_cross * x_cross + y_cross * y_cross );
1004 theta = atan2( y_cross, x_cross );
1007 std::vector<HoughRecHit>::iterator iter0 = _recHitVec.begin();
1008 for ( ; iter0 != _recHitVec.end(); iter0++ )
1014 double cirx_hit = hit->
getMidX();
1015 double ciry_hit = hit->
getMidY();
1017 double l1l2 = sqrt( ( cirx_hit - _centerX ) * ( cirx_hit - _centerX ) +
1018 ( ciry_hit - _centerY ) * ( ciry_hit - _centerY ) );
1019 double deltaD = 1.e9;
1020 if ( l1l2 > _centerR ) deltaD = l1l2 - _centerR - cirr_hit;
1021 if ( l1l2 <= _centerR ) deltaD = l1l2 - _centerR + cirr_hit;
1026 double l_temp = 1.e9;
1027 if ( _centerX == 0 || cirx_hit - _centerX == 0 ) { theta_temp = 0; }
1030 theta_temp =
M_PI - atan2( ciry_hit - _centerY, cirx_hit - _centerX ) +
1031 atan2( _centerY, _centerX );
1032 if ( theta_temp > 2 *
M_PI ) { theta_temp = theta_temp - 2 *
M_PI; }
1033 if ( theta_temp < 0 ) { theta_temp = theta_temp + 2 *
M_PI; }
1036 if ( _charge == -1 ) { l_temp = _centerR * theta_temp; }
1039 theta_temp = 2 *
M_PI - theta_temp;
1040 l_temp = _centerR * ( theta_temp );
1056 for (
int ihit = 0; ihit < _houghList.size(); ihit++ )
1058 const HoughHit hit = _houghList[ihit];
1059 if ( hit.
driftTime( _bunchTime, 0 ) > 1000 )
continue;
1063 std::pair<double, double> theta_l = calcuArcTrack( p_hit );
1064 double dist = calcuDistToTrack( p_hit );
1065 double distToCir = calcuDistToCir( p_hit );
1066 int flag = judge_half( p_hit );
1071 if ( slayer == 0 ) disCut = 6;
1074 if ( layer < 8 ) disCut = 6;
1078 cout <<
"(" << layer <<
"," << wire <<
") "
1079 <<
" pair dist flag " << dist <<
" " <<
flag << endl;
1080 if ( fabs( dist ) < disCut )
1082 if (
flag != 1 )
continue;
1083 if ( layer < 4 ) nster1++;
1084 else if ( layer < 8 ) nster2++;
1085 else if ( layer < 12 ) naxial1++;
1086 else if ( layer < 16 ) naxial2++;
1087 else if ( layer < 20 ) naxial3++;
1093 cout <<
"naxial_1 " << naxial1 << endl;
1094 cout <<
"naxial_2 " << naxial2 << endl;
1095 cout <<
"naxial_3 " << naxial3 << endl;
1096 cout <<
"stereo_1 " << nster1 << endl;
1097 cout <<
"stereo_2 " << nster2 << endl;
1098 cout <<
"stereo_3 " << nster3 << endl;
1100 if ( nster1 >= 2 && nster2 >= 2 && nster3 >= 2 && naxial1 >= 2 && naxial2 >= 2 &&
1106 cout <<
"print HoughTrack : " << p_trk->id() << endl;
1107 cout <<
"par : " << _d0 <<
"," << _omega <<
"," << _phi0 <<
"," << _z0 <<
"," << _tanl
1108 <<
", pt: " << _pt3D << endl;
1111 int lay = ( (
MdcHit*)( hotIter->
hit() ) )->layernumber();
1112 int wir = ( (
MdcHit*)( hotIter->
hit() ) )->wirenumber();
1115 cout <<
"(" << ( (
MdcHit*)( hotIter->
hit() ) )->layernumber() <<
","
1118 cout <<
"nuse " << hotIter->
hit()->
nUsedHits() << endl;
DOUBLE_PRECISION count[3]
bool digi_in_track(const HoughRecHit &hita, const HoughRecHit &hitb)
bool less_layer(const int &a, const int &b)
double sin(const BesAngle a)
double cos(const BesAngle a)
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
const MdcDigi * digi() const
void setFltLen(double flt)
int getSlayerType() const
double getDriftDist() const
void setRet(std::pair< double, double > theta_l)
void setPtr2D(Hough2D *p_hough2D)
void setDisToCir(double dis)
void setDisToTrack(double dis)
int getHitNumS(int) const
int getHitNumA(int) const
int fit2D(double bunchtime)
void Leastfit(vector< double >, vector< double >, double &, double &)
HoughTrack & add(const HoughTrack &other)
HoughTrack & operator=(const HoughTrack &other)
int getTrackIndex() const
const TrkHotList & hotList() const
const TrkFundHit * hit() const
TrkHitOnTrkIter< TrkHotList::const_iterator_traits > hot_iterator
hot_iterator begin() const