BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
HoughTrack Class Reference

#include <HoughTrack.h>

Public Member Functions

 HoughTrack ()
 ~HoughTrack ()
 HoughTrack (const HoughTrack &other)
 HoughTrack (const HoughPeak &centerPeak, std::vector< const HoughHit * > trackHitList, double, double)
TrkRecoTrkgetTrk () const
TrkRecoTrkgetTrk2D () const
vector< MdcHit * > & getVecForClean3D ()
HoughPeak getCenterPeak () const
Hough2D get2D () const
Hough3D get3D () const
recHitColgetHoughHitList ()
void setCharge (int charge)
int getCharge () const
double getPt_least () const
double getPt2D () const
double getPt3D () const
double getP () const
double getPz () const
double getRho () const
double getTheta () const
double getD0 () const
double getOmega () const
double getPhi0 () const
double getTanl () const
double getZ0 () const
double getTanl_zs () const
double getZ0_zs () const
int getHitNum (int) const
int getHitNumA (int) const
int getHitNumS (int) const
int getNfit2D () const
int getNfit3D () const
int getStat2D () const
int getStat3D () const
double getCirR () const
double getCirX () const
double getCirY () const
double getChi2_3D () const
double getChi2_2D () const
double getNfit () const
void setHoughHitList (vector< HoughHit > vec_hit)
void printRecHit () const
void print ()
void sortHit ()
void fit (double bunchtime)
int calzs ()
void fitzs ()
int judgeTrack ()
int find_stereo_hit ()
int find_pair_hit ()
int cutNoise_inner ()
int cut_axial_inner ()
HoughTrackoperator= (const HoughTrack &other)
HoughTrackadd (const HoughTrack &other)
int fit2D (double bunchtime)
int fit3D ()
int fit3D_inner ()
int trackCharge2D ()
int trackCharge3D ()
void outerHit ()
void cald_layer ()
double getMapRho () const
double getMapTheta () const
double getPro () const
void Leastfit (vector< double >, vector< double >, double &, double &)
void setMdcHit (const vector< MdcHit * > *mdchit)

Static Public Attributes

static bool m_debug = 0

Detailed Description

Definition at line 14 of file HoughTrack.h.

Constructor & Destructor Documentation

◆ HoughTrack() [1/3]

HoughTrack::HoughTrack ( )

Definition at line 12 of file HoughTrack.cxx.

12 {
13 p_trk = NULL;
14 p_trk2D = NULL;
15}

Referenced by add(), HoughTrack(), and operator=().

◆ ~HoughTrack()

HoughTrack::~HoughTrack ( )

Definition at line 16 of file HoughTrack.cxx.

16{}

◆ HoughTrack() [2/3]

HoughTrack::HoughTrack ( const HoughTrack & other)

Definition at line 71 of file HoughTrack.cxx.

72 : _dist( other._dist )
73 , _charge( other._charge )
74 , _ptLeast( other._ptLeast )
75 , _pt2D( other._pt2D )
76 , _pt3D( other._pt3D )
77 , _pz( other._pz )
78 , _p( other._p )
79 , _d0( other._d0 )
80 , _omega( other._omega )
81 , _phi0( other._phi0 )
82 , _z0( other._z0 )
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 ) {
107 // _recHitVec.clear();
108 // if(_recHitVec.size() != 0 ){
109 // //cout<<"clear first "<<endl;
110 // for(int i =0;i<_recHitVec.size();i++){
111 // delete _recHitVec[i];
112 // _recHitVec[i]=NULL;
113 // }
114 // _recHitVec.clear();
115 //}
116 // for(int i =0;i<other._recHitVec.size();i++){
117 // //const HoughHit* p_hit= new HoughHit( *(other._recHitVec[i]));
118 // HoughRecHit p_hit ( (trackHitList[i])->digi(),0.,0. );
119 // _recHitVec.push_back(p_hit);
120 //}
121}
Index other(Index i, Index j)

◆ HoughTrack() [3/3]

HoughTrack::HoughTrack ( const HoughPeak & centerPeak,
std::vector< const HoughHit * > trackHitList,
double rho,
double theta )

Definition at line 143 of file HoughTrack.cxx.

144 {
145 _centerPeak = centerPeak;
146 _recHitVec.clear();
147 _stat2D = 0;
148 _stat3D = 0;
149 _tanl = -999;
150 _z0 = -999;
151 _ptLeast = -999;
152 _pt2D = -999;
153 _pt3D = -999;
154 _p = -999;
155 _d0 = -999;
156 _omega = -999;
157 _phi0 = -999;
158 _z0 = -999;
159 _tanl = -999;
160 _chi2_aver = -999;
161 _nfit = -999;
162 p_trk = NULL;
163 p_trk2D = NULL;
164 _charge = 0; // undeter mine
165 _maprho = rho;
166 _maptheta = theta;
167 // if(_recHitVec.size()!= 0 ){
168 // cout<<" Mind trackhitlist size !=0 "<<endl;
169 // for(int i =0;i<_recHitVec.size();i++){
170 // delete _recHitVec[i];
171 // _recHitVec[i]=NULL;
172 // }
173 // _recHitVec.clear();
174 // }
175 int t_size = trackHitList.size();
176 for ( int i = 0; i < t_size; i++ )
177 {
178 HoughRecHit p_hit( *( trackHitList[i] ), 0., 0., 1 );
179 p_hit.setPtr2D( &_Hough2D );
180 p_hit.setflag( 0 );
181 _recHitVec.push_back( p_hit );
182 }
183}

Member Function Documentation

◆ add()

HoughTrack & HoughTrack::add ( const HoughTrack & other)

Definition at line 123 of file HoughTrack.cxx.

123 {
124 for ( int i = 0; i < other._recHitVec.size(); i++ )
125 {
126 int same = 0;
127 for ( int j = 0; j < _recHitVec.size(); j++ )
128 {
129 if ( _recHitVec[j].digi() == other._recHitVec[i].digi() ) { same = 1; }
130 }
131 if ( same == 0 )
132 {
133 // const HoughHit* p_hit= new HoughHit( *(other._recHitVec[i]));
134 // HoughRecHit p_hit ( (other._recHitVec[i]).digi(),0.,1);
135 HoughRecHit p_hit( ( other._recHitVec[i] ) );
136 _recHitVec.push_back( p_hit );
137 }
138 // cout<<" after copy: "<<i<<" new: "<<p_hit<<" old: "<<other._recHitVec[i]<<endl;
139 }
140 return *this;
141}

◆ cald_layer()

void HoughTrack::cald_layer ( )

Definition at line 982 of file HoughTrack.cxx.

982 {
983 // in truth
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++ )
988 {
989 const HoughRecHit h = ( *iter );
990 // if( h.getCirList()!=0 ) continue;
991 if ( h.digi()->getTrackIndex() >= 0 && h.getStyle() == 0 && h.getSlayerType() == 0 &&
992 h.getCirList() == 0 && utemp.size() < 10 ) // ??use 2nd half
993 {
994 utemp.push_back( h.getUTruth() );
995 vtemp.push_back( h.getVTruth() );
996 }
997 }
998 Leastfit( utemp, vtemp, k, b );
999 // calcu truth
1000 // k,b from truth
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 );
1005 //
1006 // cout<<"track center position "<<_centerX<<" "<<_centerY<<endl;
1007 std::vector<HoughRecHit>::iterator iter0 = _recHitVec.begin();
1008 for ( ; iter0 != _recHitVec.end(); iter0++ )
1009 {
1010 HoughRecHit* hit = &( *iter0 );
1011 if ( hit->getSlayerType() != 0 ) continue;
1012 // if( hit->getCirList()!=0 ) continue; // use in learn distribute
1013 // double cirr_hit = hit->getDriftDistTruth();
1014 double cirx_hit = hit->getMidX();
1015 double ciry_hit = hit->getMidY();
1016 double cirr_hit = hit->getDriftDist();
1017 double l1l2 = sqrt( ( cirx_hit - _centerX ) * ( cirx_hit - _centerX ) +
1018 ( ciry_hit - _centerY ) * ( ciry_hit - _centerY ) );
1019 double deltaD = 1.e9; // add initialize 25-05-15
1020 if ( l1l2 > _centerR ) deltaD = l1l2 - _centerR - cirr_hit;
1021 if ( l1l2 <= _centerR ) deltaD = l1l2 - _centerR + cirr_hit;
1022 hit->setDeltaD( deltaD );
1023 // cal flight length
1024
1025 double theta_temp;
1026 double l_temp = 1.e9; // add initialize 25-05-15
1027 if ( _centerX == 0 || cirx_hit - _centerX == 0 ) { theta_temp = 0; }
1028 else
1029 {
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; }
1034 }
1035 // cout<<" charge "<<_charge <<" "<<theta_temp<<endl;
1036 if ( _charge == -1 ) { l_temp = _centerR * theta_temp; }
1037 if ( _charge == 1 )
1038 {
1039 theta_temp = 2 * M_PI - theta_temp;
1040 l_temp = _centerR * ( theta_temp );
1041 }
1042 // cout<<"("<<hit->getLayerId()<<","<<hit->getWireId()<<") "<<l_temp<<endl;
1043 hit->setFltLen( l_temp );
1044
1045 // cout<<"int map deltaD: ("<<hit->getLayerId()<<","<<hit->getWireId()<<")"<<
1046 // hit->getDeltaD()<<endl;
1047 }
1048}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
#define M_PI
Definition TConstant.h:4
const MdcDigi * digi() const
Definition HoughHit.h:53
double getUTruth() const
Definition HoughHit.h:90
int getCirList() const
Definition HoughHit.h:102
void setFltLen(double flt)
Definition HoughHit.h:99
int getSlayerType() const
Definition HoughHit.h:62
double getDriftDist() const
Definition HoughHit.h:67
double getMidY() const
Definition HoughHit.h:59
void setDeltaD(double d)
Definition HoughHit.h:98
double getMidX() const
Definition HoughHit.h:58
int getStyle() const
Definition HoughHit.h:103
double getVTruth() const
Definition HoughHit.h:91
void Leastfit(vector< double >, vector< double >, double &, double &)
int getTrackIndex() const
Definition RawData.cxx:38

◆ calzs()

int HoughTrack::calzs ( )

Definition at line 601 of file HoughTrack.cxx.

601 {
602 int n_zs = 0;
603 for ( int i = 0; i < _recHitVec.size(); i++ )
604 {
605 if ( _recHitVec[i].getSlayerType() == 0 || _recHitVec[i].getflag() != 0 ) continue;
606 // if ( _recHitVec[i].getLayerId()>=8) continue;
607 HoughStereo zs( _bunchTime, &_Hough2D, &( _recHitVec[i] ) );
608 // cout<<"("<<_recHitVec[i].getLayerId()<<","<<_recHitVec[i].getWireId()<<") stat
609 //"<<stat<<" style
610 //"<<_recHitVec[i].getStyle() <<endl; cout<<endl;
611
612 // zs.setAmb(-1); //right
613 // int stat_left = zs.cald();
614
615 // zs.setAmb(1); //left
616 // int stat_right= zs.cald();
617 // if( stat_left==-1 && stat_right==-1 ) _recHitVec[i].setflag(-999);
618
619 int stat = zs.cald();
620 _recHitVec[i].setnsol( stat );
621 if ( stat == 0 ) _recHitVec[i].setflag( -999 );
622
623 zs.setRecHit();
624 _recHitVec[i].setAmb( -999 ); // check
625
626 if ( _recHitVec[i].getLayerId() < 8 ) n_zs++;
627 if ( m_debug > 0 ) zs.print();
628 }
629 // int naddStero = cutNoise_inner();
630 // return naddStero;
631 return n_zs;
632}
static bool m_debug
Definition HoughTrack.h:79

Referenced by fit3D(), and fit3D_inner().

◆ cut_axial_inner()

int HoughTrack::cut_axial_inner ( )

Definition at line 797 of file HoughTrack.cxx.

797 {
798 for ( int ilay = 0; ilay < 43; ilay++ )
799 {
800 // if( (ilay<7&&ilay<20) || ilay>35 ) continue;
801 if ( ( ilay >= 0 && ilay <= 7 ) || ( ilay >= 20 && ilay <= 35 ) ) continue;
802 // for( int ilay=0;ilay<8;ilay++)
803 double disToCir = 9999;
804 int max = -999;
805 int count = 0;
806 int count_cut = 0;
807 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
808 {
809 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
810 {
811 count++;
812 if ( ( fabs( _recHitVec[ihit].getDisToCir() ) < disToCir ) )
813 {
814 disToCir = fabs( _recHitVec[ihit].getDisToCir() );
815 max = ihit;
816 count_cut = 1;
817 }
818 }
819 }
820 if ( m_debug > 0 )
821 cout << "ilay count count_cut " << ilay << " " << count << " " << count_cut << endl;
822 if ( count_cut != 0 && count > 1 ) _recHitVec[max].setflag( -999 );
823 if ( m_debug > 0 && count_cut != 0 && count > 1 )
824 cout << "delete (" << _recHitVec[max].getLayerId() << "," << _recHitVec[max].getWireId()
825 << ")" << endl;
826 }
827 int size_of_axial = 0; // add initialize 25-05-15
828 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
829 {
830 if ( _recHitVec[ihit].getSlayerType() == 0 && _recHitVec[ihit].getflag() == 0 )
831 size_of_axial++;
832 }
833 return size_of_axial;
834}
#define max(a, b)
DOUBLE_PRECISION count[3]

◆ cutNoise_inner()

int HoughTrack::cutNoise_inner ( )

Definition at line 836 of file HoughTrack.cxx.

836 {
837 // for( int ilay=0;ilay<43;ilay++)
838 // if( (ilay>7&&ilay<20) || ilay>35 ) continue;
839 for ( int ilay = 0; ilay < 8; ilay++ )
840 {
841 double z_0 = 0;
842 double z_1 = 0;
843 int min = -999;
844 int count = 0;
845 int count_cut = 0;
846 // cout<<" size "<<_recHitVec.size()<<endl;
847 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
848 {
849 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
850 {
851 count++;
852 if ( ( ( fabs( _recHitVec[ihit].getzAmb( 0 ) ) > z_0 ) &&
853 ( fabs( _recHitVec[ihit].getzAmb( 1 ) ) > z_1 ) ) )
854 {
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 ) );
858 min = ihit;
859 }
860 else if ( ( ( fabs( _recHitVec[ihit].getzAmb( 0 ) ) < z_0 ) &&
861 ( fabs( _recHitVec[ihit].getzAmb( 1 ) ) < z_1 ) ) )
862 { count_cut++; }
863 }
864 }
865 if ( m_debug > 0 )
866 cout << "ilay count count_cut " << ilay << " " << count << " " << count_cut << endl;
867 if ( count_cut > 0 && count > 1 ) _recHitVec[min].setflag( -999 );
868 if ( m_debug > 0 && count_cut > 0 && count > 1 )
869 cout << "delete (" << _recHitVec[min].getLayerId() << "," << _recHitVec[min].getWireId()
870 << ")" << endl;
871 }
872 int size_of_stereo = 0; // add initialize 25-05-15
873 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
874 {
875 if ( _recHitVec[ihit].getSlayerType() != 0 && _recHitVec[ihit].getflag() == 0 )
876 size_of_stereo++;
877 }
878 return size_of_stereo;
879}
#define min(a, b)

◆ find_pair_hit()

int HoughTrack::find_pair_hit ( )

Definition at line 1049 of file HoughTrack.cxx.

1049 {
1050 int nster1 = 0;
1051 int nster2 = 0;
1052 int nster3 = 0;
1053 int naxial1 = 0;
1054 int naxial2 = 0;
1055 int naxial3 = 0;
1056 for ( int ihit = 0; ihit < _houghList.size(); ihit++ )
1057 {
1058 const HoughHit hit = _houghList[ihit];
1059 if ( hit.driftTime( _bunchTime, 0 ) > 1000 ) continue;
1060 if ( hit.getLayerId() >= 24 ) continue;
1061 HoughRecHit p_hit( hit, 0, 0, 1 );
1062 p_hit.setPtr2D( &_Hough2D );
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 );
1067 int layer = p_hit.getLayerId();
1068 int wire = p_hit.getWireId();
1069 int slayer = p_hit.getSlayerType();
1070 double disCut;
1071 if ( slayer == 0 ) disCut = 6;
1072 else
1073 {
1074 if ( layer < 8 ) disCut = 6;
1075 else disCut = 6;
1076 }
1077 if ( m_debug > 0 )
1078 cout << "(" << layer << "," << wire << ") "
1079 << " pair dist flag " << dist << " " << flag << endl;
1080 if ( fabs( dist ) < disCut )
1081 {
1082 if ( flag != 1 ) continue; // find hit in the 2nd half
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++;
1088 else nster3++;
1089 }
1090 }
1091 if ( m_debug > 0 )
1092 {
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;
1099 }
1100 if ( nster1 >= 2 && nster2 >= 2 && nster3 >= 2 && naxial1 >= 2 && naxial2 >= 2 &&
1101 naxial3 >= 2 )
1102 return 1;
1103 else return 0;
1104}
double driftTime() const
Definition HoughHit.cxx:170
int getLayerId() const
Definition HoughHit.h:60

Referenced by MdcHoughFinder::execute().

◆ find_stereo_hit()

int HoughTrack::find_stereo_hit ( )

Definition at line 757 of file HoughTrack.cxx.

757 {
758 vector<HoughRecHit> vec_rec; // store hit temp
759 int naddStero = 0;
760 for ( int ihit = 0; ihit < _houghList.size(); ihit++ )
761 {
762 const HoughHit hit = _houghList[ihit];
763 if ( hit.getSlayerType() == 0 ) continue;
764 if ( hit.driftTime( _bunchTime, 0 ) > 800 ) continue;
765 HoughRecHit p_hit( hit, 0, 0, 1 );
766 p_hit.setPtr2D( &_Hough2D );
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 );
771 int layer = p_hit.getLayerId();
772 int wire = p_hit.getWireId();
773 double disCut;
774 if ( layer < 8 ) disCut = 4;
775 else disCut = 6;
776 // double dist=sqrt( pow( (xhit-x_cir),2)+pow( (yhit-y_cir),2) )-r_cir;
777 // cout<<"find stereo hit dist?("<<layer<<" ,"<<wire<<" ) "<<dist<<endl;
778 if ( m_debug > 0 )
779 cout << "(" << layer << "," << wire << ") "
780 << " rec hit dist theta " << dist << " " << theta_l.first << endl;
781 if ( fabs( dist ) < disCut )
782 {
783 p_hit.setDisToTrack( dist );
784 p_hit.setDisToCir( dist );
785 p_hit.setRet( theta_l );
786 p_hit.setflag( flag );
787 // if( p_hit.getflag()==0 ) vec_rec.push_back(p_hit);
788 // vec_rec.push_back(p_hit);
789 if ( p_hit.getflag() != 0 ) continue;
790 _recHitVec.push_back( p_hit );
791 naddStero++;
792 }
793 }
794 return naddStero;
795}

Referenced by MdcHoughFinder::execute().

◆ fit()

void HoughTrack::fit ( double bunchtime)

◆ fit2D()

int HoughTrack::fit2D ( double bunchtime)

Definition at line 192 of file HoughTrack.cxx.

192 {
193 sortHit();
194 // cout<<"in fit2d"<<endl;
195 _bunchTime = bunchtime;
196 _stat2D = fitLeast();
197 // outerHit();
198 _stat2D = fit_global2D( _recHitVec );
199 // printRecHit();
200 // collectAxialHit();
201 //_Hough2D.print();
202 // cald_layer();
203 return _stat2D;
204}
void sortHit()

Referenced by MdcHoughFinder::execute().

◆ fit3D()

int HoughTrack::fit3D ( )

Definition at line 317 of file HoughTrack.cxx.

317 {
318 sortHit();
319 // cout<<"in fit3d"<<endl;
320 int nhit_zs = calzs();
321 if ( nhit_zs >= 3 ) fitzs();
322 else
323 {
324 _tanl = 0.;
325 _z0 = 0.;
326 }
327 outerHit();
328 if ( m_debug > 0 )
329 {
330 cout << " before 3d fit " << endl;
331 this->printRecHit();
332 }
333 _stat3D = fit_global3D( 0 );
334 return _stat3D;
335}
void outerHit()
void printRecHit() const

Referenced by MdcHoughFinder::execute().

◆ fit3D_inner()

int HoughTrack::fit3D_inner ( )

Definition at line 337 of file HoughTrack.cxx.

337 { // for multi turn track
338 sortHit();
339 int nhit_zs = calzs();
340 cutMultiCirHit();
341 if ( nhit_zs >= 3 ) fitzs();
342 else
343 {
344 // cout<<" not enough ster hit in zs fit"<<endl;
345 _tanl = 0.;
346 _z0 = 0.;
347 }
348 cutMultiCirHit_after_zs();
349 outerHit();
350 if ( m_debug > 0 )
351 {
352 cout << " before 3d fit " << endl;
353 this->printRecHit();
354 }
355 _stat3D = fit_global3D( 0 );
356 return _stat3D;
357}

Referenced by MdcHoughFinder::execute().

◆ fitzs()

void HoughTrack::fitzs ( )

Definition at line 633 of file HoughTrack.cxx.

633 {
634 HoughZsFit zsfit( &_recHitVec );
635 _tanl = zsfit.getTanl();
636 _z0 = zsfit.getZ0();
637 _tanl_zs = zsfit.getTanl();
638 _z0_zs = zsfit.getZ0();
639 t_pro_correct = zsfit.getPro();
640 if ( m_debug > 0 ) printRecHit();
641}

Referenced by fit3D(), and fit3D_inner().

◆ get2D()

Hough2D HoughTrack::get2D ( ) const
inline

Definition at line 30 of file HoughTrack.h.

30{ return _Hough2D; }

◆ get3D()

Hough3D HoughTrack::get3D ( ) const
inline

Definition at line 31 of file HoughTrack.h.

31{ return _Hough3D; }

◆ getCenterPeak()

HoughPeak HoughTrack::getCenterPeak ( ) const
inline

Definition at line 29 of file HoughTrack.h.

29{ return _centerPeak; }

◆ getCharge()

int HoughTrack::getCharge ( ) const
inline

Definition at line 35 of file HoughTrack.h.

35{ return _charge; }

◆ getChi2_2D()

double HoughTrack::getChi2_2D ( ) const
inline

Definition at line 63 of file HoughTrack.h.

63{ return _chi2_aver2D; }

◆ getChi2_3D()

double HoughTrack::getChi2_3D ( ) const
inline

Definition at line 62 of file HoughTrack.h.

62{ return _chi2_aver; }

◆ getCirR()

double HoughTrack::getCirR ( ) const
inline

Definition at line 59 of file HoughTrack.h.

59{ return _centerR; }

◆ getCirX()

double HoughTrack::getCirX ( ) const
inline

Definition at line 60 of file HoughTrack.h.

60{ return _centerX; }

◆ getCirY()

double HoughTrack::getCirY ( ) const
inline

Definition at line 61 of file HoughTrack.h.

61{ return _centerY; }

◆ getD0()

double HoughTrack::getD0 ( ) const
inline

Definition at line 43 of file HoughTrack.h.

43{ return _d0; }

◆ getHitNum()

int HoughTrack::getHitNum ( int select) const

Definition at line 643 of file HoughTrack.cxx.

643 {
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++ )
648 {
649 int cir = _recHitVec[i].getCirList();
650 int index = _recHitVec[i].digi()->getTrackIndex();
651 int style = _recHitVec[i].getStyle();
652 n0++;
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++;
659 }
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;
668 exit( 1 );
669}
int n2
Definition SD0Tag.cxx:59
int n1
Definition SD0Tag.cxx:58

◆ getHitNumA()

int HoughTrack::getHitNumA ( int select) const

Definition at line 671 of file HoughTrack.cxx.

671 {
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++ )
676 {
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++;
688 }
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;
697 exit( 1 );
698}

◆ getHitNumS()

int HoughTrack::getHitNumS ( int select) const

Definition at line 699 of file HoughTrack.cxx.

699 {
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++ )
704 {
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++;
716 }
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;
725 exit( 1 );
726}

◆ getHoughHitList()

recHitCol & HoughTrack::getHoughHitList ( )
inline

Definition at line 32 of file HoughTrack.h.

32{ return _recHitVec; }

◆ getMapRho()

double HoughTrack::getMapRho ( ) const
inline

Definition at line 90 of file HoughTrack.h.

90{ return _maprho; }

◆ getMapTheta()

double HoughTrack::getMapTheta ( ) const
inline

Definition at line 91 of file HoughTrack.h.

91{ return _maptheta; }

◆ getNfit()

double HoughTrack::getNfit ( ) const
inline

Definition at line 64 of file HoughTrack.h.

64{ return _nfit; }

◆ getNfit2D()

int HoughTrack::getNfit2D ( ) const
inline

Definition at line 54 of file HoughTrack.h.

54{ return _Hough2D.getNfit(); }

◆ getNfit3D()

int HoughTrack::getNfit3D ( ) const
inline

Definition at line 55 of file HoughTrack.h.

55{ return _Hough3D.getNfit(); }

◆ getOmega()

double HoughTrack::getOmega ( ) const
inline

Definition at line 44 of file HoughTrack.h.

44{ return _omega; }

◆ getP()

double HoughTrack::getP ( ) const
inline

Definition at line 39 of file HoughTrack.h.

39{ return _p; }

◆ getPhi0()

double HoughTrack::getPhi0 ( ) const
inline

Definition at line 45 of file HoughTrack.h.

45{ return _phi0; }

◆ getPro()

double HoughTrack::getPro ( ) const
inline

Definition at line 92 of file HoughTrack.h.

92{ return t_pro_correct; }

◆ getPt2D()

double HoughTrack::getPt2D ( ) const
inline

Definition at line 37 of file HoughTrack.h.

37{ return _pt2D; }

◆ getPt3D()

double HoughTrack::getPt3D ( ) const
inline

Definition at line 38 of file HoughTrack.h.

38{ return _pt3D; }

Referenced by more_pt().

◆ getPt_least()

double HoughTrack::getPt_least ( ) const
inline

Definition at line 36 of file HoughTrack.h.

36{ return _ptLeast; }

◆ getPz()

double HoughTrack::getPz ( ) const
inline

Definition at line 40 of file HoughTrack.h.

40{ return _pz; }

◆ getRho()

double HoughTrack::getRho ( ) const
inline

Definition at line 41 of file HoughTrack.h.

41{ return _centerPeak.getRho(); }

◆ getStat2D()

int HoughTrack::getStat2D ( ) const
inline

Definition at line 56 of file HoughTrack.h.

56{ return _stat2D; }

◆ getStat3D()

int HoughTrack::getStat3D ( ) const
inline

Definition at line 57 of file HoughTrack.h.

57{ return _stat3D; }

◆ getTanl()

double HoughTrack::getTanl ( ) const
inline

Definition at line 46 of file HoughTrack.h.

46{ return _tanl; }

◆ getTanl_zs()

double HoughTrack::getTanl_zs ( ) const
inline

Definition at line 48 of file HoughTrack.h.

48{ return _tanl_zs; }

◆ getTheta()

double HoughTrack::getTheta ( ) const
inline

Definition at line 42 of file HoughTrack.h.

42{ return _centerPeak.getTheta(); }

◆ getTrk()

TrkRecoTrk * HoughTrack::getTrk ( ) const
inline

Definition at line 25 of file HoughTrack.h.

25{ return p_trk; }

◆ getTrk2D()

TrkRecoTrk * HoughTrack::getTrk2D ( ) const
inline

Definition at line 26 of file HoughTrack.h.

26{ return p_trk2D; }

◆ getVecForClean3D()

vector< MdcHit * > & HoughTrack::getVecForClean3D ( )
inline

Definition at line 28 of file HoughTrack.h.

28{ return _Hough3D.getVecForClean(); }

◆ getZ0()

double HoughTrack::getZ0 ( ) const
inline

Definition at line 47 of file HoughTrack.h.

47{ return _z0; }

◆ getZ0_zs()

double HoughTrack::getZ0_zs ( ) const
inline

Definition at line 49 of file HoughTrack.h.

49{ return _z0_zs; }

◆ judgeTrack()

int HoughTrack::judgeTrack ( )

Definition at line 728 of file HoughTrack.cxx.

728 {
729 // hit number test
730 int axialHit = 0;
731 // int stereoHit=0;
732 // int innerHit=0;
733 vector<int> vec_layer;
734 for ( int i = 0; i < _recHitVec.size(); i++ )
735 {
736 int layer = _recHitVec[i].getLayerId();
737 int slant = _recHitVec[i].getSlayerType();
738 if ( 0 == slant ) axialHit++;
739 // if( 0!=slant ) stereoHit++;
740 // if( layer<8 ) innerHit++;
741 }
742 // if ( axialHit <5 || stereoHit <3 || innerHit ==0 ) return 0;
743 if ( axialHit < 5 ) return 0;
744 else return 1;
745 // // continues hit test
746 // bool continues=false;
747 // for(int i =0;i<vec_layer.size();i++){
748 // int layer = vec_layer[i];
749 // vector<int>::iterator iter = find( vec_layer.begin(),vec_layer.end(),layer+1 );
750 // if( iter != vec_layer.end() ){
751 // vector<int>::iterator iter2 = find( vec_layer.begin(),vec_layer.end(),layer-1 );
752 // if( iter2 != vec_layer.end() ) continues = true;
753 // }
754 // }
755}

◆ Leastfit()

void HoughTrack::Leastfit ( vector< double > u,
vector< double > v,
double & k,
double & b )

Definition at line 959 of file HoughTrack.cxx.

959 {
960 int N = u.size();
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++ )
965 {
966 x[i] = u[i];
967 y[i] = v[i];
968 }
969
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 );
975 k = ktemp;
976 b = btemp;
977 delete[] x;
978 delete[] y;
979 delete fpol1;
980 delete tg;
981}
Double_t x[10]
**********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
Definition KarLud.h:35

Referenced by cald_layer().

◆ operator=()

HoughTrack & HoughTrack::operator= ( const HoughTrack & other)

Definition at line 18 of file HoughTrack.cxx.

18 {
19 _dist = ( other._dist );
20 _charge = ( other._charge );
21 _ptLeast = ( other._ptLeast );
22 _pt2D = ( other._pt2D );
23 _pt3D = ( other._pt3D );
24 _pz = ( other._pz );
25 _p = ( other._p );
26
27 _d0 = other._d0;
28 _omega = other._omega;
29 _phi0 = other._phi0;
30 _tanl = ( other._tanl );
31 _z0 = ( other._z0 );
32 _tanl_zs = ( other._tanl_zs );
33 _z0_zs = ( other._z0_zs );
34
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 );
49 p_trk = other.p_trk;
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;
56 // if(_recHitVec.size() != 0 ){
57 // for(int i =0;i<_recHitVec.size();i++){
58 // delete _recHitVec[i];
59 // _recHitVec[i]=NULL;
60 // }
61 // _recHitVec.clear();
62 // }
63 // for(int i =0;i<other._recHitVec.size();i++){
64 // //const HoughHit* p_hit= new HoughHit( *(other._recHitVec[i]));
65 // HoughRecHit p_hit ( (trackHitList[i])->digi(),0.,0. );
66 // _recHitVec.push_back(p_hit);
67 // }
68 return *this;
69}

◆ outerHit()

void HoughTrack::outerHit ( )

Definition at line 207 of file HoughTrack.cxx.

207 {
208 vector<int> vec_layer_num[43];
209 for ( int ilay = 0; ilay < 43; ilay++ )
210 {
211 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
212 {
213 if ( _recHitVec[ihit].getLayerId() == ilay && _recHitVec[ihit].getflag() == 0 )
214 { vec_layer_num[ilay].push_back( _recHitVec[ihit].getWireId() ); }
215 }
216 std::sort( vec_layer_num[ilay].begin(), vec_layer_num[ilay].end(), less_layer );
217 // for(int j=0;j<vec_layer_num[ilay].size();j++)
218 // cout<<"("<<ilay<<","<<vec_layer_num[ilay][j]<<")"<<endl;
219 if ( vec_layer_num[ilay].size() < 4 ) continue;
220 for ( int j = 0; j < vec_layer_num[ilay].size(); j++ )
221 {
222 // if( (vec_layer_num[ilay][j]+1 == vec_layer_num[ilay][j+1]) &&
223 //(vec_layer_num[ilay][j+1]+1 ==
224 // vec_layer_num[ilay][j+2]) && (vec_layer_num[ilay][j+2]+1 == vec_layer_num[ilay][j+3])
225 // ) {
226 for ( int jhit = 0; jhit < _recHitVec.size(); jhit++ )
227 {
228 if ( ( ilay == _recHitVec[jhit].getLayerId() ) &&
229 ( vec_layer_num[ilay][j] == _recHitVec[jhit].getWireId() ) )
230 { _recHitVec[jhit].setflag( -1 ); }
231 }
232 //}
233 }
234 }
235}
bool less_layer(const int &a, const int &b)

Referenced by fit3D(), and fit3D_inner().

◆ print()

void HoughTrack::print ( )

Definition at line 1105 of file HoughTrack.cxx.

1105 {
1106 cout << "print HoughTrack : " << p_trk->id() << endl;
1107 cout << "par : " << _d0 << "," << _omega << "," << _phi0 << "," << _z0 << "," << _tanl
1108 << ", pt: " << _pt3D << endl;
1109 TrkHitList* qhits = p_trk->hits();
1110 TrkHotList::hot_iterator hotIter = qhits->hotList().begin();
1111 int lay = ( (MdcHit*)( hotIter->hit() ) )->layernumber();
1112 int wir = ( (MdcHit*)( hotIter->hit() ) )->wirenumber();
1113 while ( hotIter != qhits->hotList().end() )
1114 {
1115 cout << "(" << ( (MdcHit*)( hotIter->hit() ) )->layernumber() << ","
1116 << ( (MdcHit*)( hotIter->hit() ) )->wirenumber() << ":" << hotIter->isActive()
1117 << ") ";
1118 cout << "nuse " << hotIter->hit()->nUsedHits() << endl;
1119
1120 hotIter++;
1121 }
1122}
int nUsedHits() const
const TrkHotList & hotList() const
TrkHitOnTrkIter< TrkHotList::const_iterator_traits > hot_iterator

◆ printRecHit()

void HoughTrack::printRecHit ( ) const

Definition at line 881 of file HoughTrack.cxx.

881 {
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++ )
887 {
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();
894 if ( slant == 0 )
895 std::cout << "axial hit (" << layer << "," << wire << ") "
896 << _recHitVec[i].getDisToTrack() << " " << _recHitVec[i].getDisToCir() << " "
897 << flag << " " << style << " " << cirlist << std::endl;
898 }
899 for ( int i = 0; i < size; i++ )
900 {
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();
907 if ( slant != 0 )
908 std::cout << "stereo hit (" << layer << "," << wire << ") "
909 << _recHitVec[i].getDisToTrack() << " " << flag << " " << style << " "
910 << cirlist << std::endl;
911 }
912}

Referenced by fit3D(), fit3D_inner(), and fitzs().

◆ setCharge()

void HoughTrack::setCharge ( int charge)
inline

Definition at line 34 of file HoughTrack.h.

34{ _charge = charge; }

Referenced by MdcHoughFinder::execute().

◆ setHoughHitList()

void HoughTrack::setHoughHitList ( vector< HoughHit > vec_hit)
inline

Definition at line 66 of file HoughTrack.h.

66{ _houghList = vec_hit; }

Referenced by MdcHoughFinder::execute().

◆ setMdcHit()

void HoughTrack::setMdcHit ( const vector< MdcHit * > * mdchit)
inline

Definition at line 94 of file HoughTrack.h.

94{ vec_mdcHit = mdchit; }

Referenced by MdcHoughFinder::execute().

◆ sortHit()

void HoughTrack::sortHit ( )

Definition at line 188 of file HoughTrack.cxx.

188 {
189 std::sort( _recHitVec.begin(), _recHitVec.end(), digi_in_track );
190}
bool digi_in_track(const HoughRecHit &hita, const HoughRecHit &hitb)

Referenced by fit2D(), fit3D(), and fit3D_inner().

◆ trackCharge2D()

int HoughTrack::trackCharge2D ( )

Definition at line 914 of file HoughTrack.cxx.

914 {
915 int n_neg( 0 );
916 int n_pos( 0 );
917 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
918 {
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++;
926 }
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; }
930 else return 1;
931
932 std::cerr << __FILE__ << ":" << __LINE__ << ": should not reach here" << std::endl;
933 exit( 1 );
934}

Referenced by MdcHoughFinder::execute().

◆ trackCharge3D()

int HoughTrack::trackCharge3D ( )

Definition at line 936 of file HoughTrack.cxx.

936 {
937 int n_neg( 0 );
938 int n_pos( 0 );
939 for ( int ihit = 0; ihit < _recHitVec.size(); ihit++ )
940 {
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++;
950 }
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; }
954 else return 1;
955
956 std::cerr << __FILE__ << ":" << __LINE__ << ": should not reach here" << std::endl;
957 exit( 1 );
958}

Referenced by MdcHoughFinder::execute().

Member Data Documentation

◆ m_debug


The documentation for this class was generated from the following files: