1#include "MdcHoughFinder/HoughPeak.h"
12 for(
int i =0;i<_houghPeakHitList.size();i++){
14 _houghPeakHitList[i]=NULL;
16 _houghPeakHitList.clear();
20 if(
this == &other )
return *
this;
21 _height=other._height;
24 _thetaBin=other._thetaBin;
25 _rhoBin=other._rhoBin;
26 _isCandiTrack=other._isCandiTrack;
27 _peakNum=other._peakNum;
28 _charge=other._charge;
29 if(_houghPeakHitList.size() != 0 ){
30 for(
int i =0;i<_houghPeakHitList.size();i++){
31 _houghPeakHitList[i]=NULL;
33 _houghPeakHitList.clear();
35 _houghPeakHitList = other._houghPeakHitList;
45 if(_houghPeakHitList.size() != 0 ){
46 for(
int i =0;i<_houghPeakHitList.size();i++){
47 _houghPeakHitList[i]=NULL;
49 _houghPeakHitList.clear();
51 _height=other._height;
54 _thetaBin=other._thetaBin;
55 _rhoBin=other._rhoBin;
56 _houghPeakHitList = other._houghPeakHitList;
57 _isCandiTrack=other._isCandiTrack;
58 _peakNum=other._peakNum;
59 _charge=other._charge;
66HoughPeak::HoughPeak(
int itheta ,
int irho,
double theta,
double rho,vector< const HoughHit* >** mapHitList,
bool isCandiTrack,
int peakNum){
71 _houghPeakHitList = mapHitList[itheta][irho];
72 _isCandiTrack =isCandiTrack;
81HoughPeak::HoughPeak(
int height,
int itheta ,
int irho,
double theta,
double rho,
bool isCandiTrack,
int peakNum,
int charge){
88 _isCandiTrack =isCandiTrack;
95 int size=_houghPeakHitList.size();
96 if( size ==0 ) return ;
97 cout<<
"Print hitlist in HoughPeak " <<endl;
98 cout<<
"at center ("<<_theta<<
" ,"<<_rho<<
"): "<<size<<endl;
99 for(
int i=0;i<size;i++){
100 int layer= _houghPeakHitList[i]->getLayerId();
101 int wire = _houghPeakHitList[i]->getWireId();
102 std::cout<<
"Peak ("<<layer<<
","<<wire<<
") "<< _houghPeakHitList[i]<<std::endl;
107 int size=_houghPeakHitList.size();
108 int n0,
n1,
n2,n3,n4,n5,n6;
109 n0=
n1=
n2=n3=n4=n5=n6=0;
110 for(
int i=0;i<size;i++){
111 int cir= _houghPeakHitList[i]->getCirList();
112 int index = _houghPeakHitList[i]->digi()->getTrackIndex();
113 int style= _houghPeakHitList[i]->getStyle();
116 if( style == 1 )
n1++;
117 if( style == 2 )
n2++;
118 if( index < 0 ) n3++;
119 if( index >=0 && cir<=1 && style==0 ) n4++;
120 if( index <0 || cir>1 ) n5++;
121 if( index >=0 && cir==0 && style==0 ) n6++;
123 if( select == 0 )
return n0;
124 if( select == 1 )
return n1;
125 if( select == 2 )
return n2;
126 if( select == 3 )
return n3;
127 if( select == 4 )
return n4;
128 if( select == 5 )
return n5;
129 if( select == 6 )
return n6;
132 int size=_houghPeakHitList.size();
133 int n0,
n1,
n2,n3,n4,n5,n6;
134 n0=
n1=
n2=n3=n4=n5=n6=0;
135 for(
int i=0;i<size;i++){
136 int cir= _houghPeakHitList[i]->getCirList();
137 int index = _houghPeakHitList[i]->digi()->getTrackIndex();
138 int type = _houghPeakHitList[i]->getSlayerType();
139 int style= _houghPeakHitList[i]->getStyle();
141 if( type==0 && style == 1 )
n1++;
142 if( type==0 && style == 2 )
n2++;
143 if( type==0 && index < 0 ) n3++;
144 if( type==0 && index >=0 && cir<=1 && style==0) n4++;
145 if( type==0 && (index <0 || cir>1) ) n5++;
146 if( type==0 && index >=0 && cir==0 && style==0) n6++;
148 if( select == 0 )
return n0;
149 if( select == 1 )
return n1;
150 if( select == 2 )
return n2;
151 if( select == 3 )
return n3;
152 if( select == 4 )
return n4;
153 if( select == 5 )
return n5;
154 if( select == 6 )
return n6;
157 int size=_houghPeakHitList.size();
158 int n0,
n1,
n2,n3,n4,n5,n6;
159 n0=
n1=
n2=n3=n4=n5=n6=0;
160 for(
int i=0;i<size;i++){
161 int cir= _houghPeakHitList[i]->getCirList();
162 int index = _houghPeakHitList[i]->digi()->getTrackIndex();
163 int type = _houghPeakHitList[i]->getSlayerType();
164 int style= _houghPeakHitList[i]->getStyle();
166 if( type!=0 && style == 1 )
n1++;
167 if( type!=0 && style == 2 )
n2++;
168 if( type!=0 && index < 0 ) n3++;
169 if( type!=0 && index >=0 && cir<=1 && style==0) n4++;
170 if( type!=0 && (index <0 || cir>1) ) n5++;
171 if( type!=0 && index >=0 && cir==0 && style==0) n6++;
173 if( select == 0 )
return n0;
174 if( select == 1 )
return n1;
175 if( select == 2 )
return n2;
176 if( select == 3 )
return n3;
177 if( select == 4 )
return n4;
178 if( select == 5 )
return n5;
179 if( select == 6 )
return n6;
186 input.open(
m_file.c_str());
189 while ( getline(input,line) ){
190 istringstream stream(line);
193 while(stream>>sigma){
200 double cirr_track = fabs(1./(_rho));
201 double cirx_track = (1./_rho)*
cos(_theta);
202 double ciry_track = (1./_rho)*
sin(_theta);
203 std::vector<HoughHit>::const_iterator
iter= hitlist.
getList().begin();
208 double cirx_hit = hit->
getMidX();
209 double ciry_hit = hit->
getMidY();
211 if( _charge == 1 && (cirx_track*ciry_hit - ciry_track*cirx_hit>=0) )
continue;
212 if( _charge ==-1 && (cirx_track*ciry_hit - ciry_track*cirx_hit<=0) )
continue;
213 double l1l2 = sqrt( (cirx_hit-cirx_track)*(cirx_hit-cirx_track)+(ciry_hit-ciry_track)*(ciry_hit-ciry_track) );
215 if( l1l2>cirr_track ) deltaD = l1l2-cirr_track-cirr_hit;
216 if( l1l2<=cirr_track ) deltaD = l1l2-cirr_track+cirr_hit;
222 if(cirx_track==0||cirx_hit-cirx_track==0){
226 theta_temp=
M_PI-atan2(ciry_hit-ciry_track,cirx_hit-cirx_track)+atan2(ciry_track,cirx_track);
227 if(theta_temp>2*
M_PI){
228 theta_temp=theta_temp-2*
M_PI;
231 theta_temp=theta_temp+2*
M_PI;
236 l_temp=cirr_track*theta_temp;
239 theta_temp=2*
M_PI-theta_temp;
240 l_temp=cirr_track*(theta_temp);
242 double pt = fabs( (1./_rho)/333.567 );
265 if( pt<0.06 && fabs(deltaD)<0.1&& l_temp<=35 ) _houghPeakHitList.push_back(hit);
266 if( 0.06<pt&&pt<0.07 && fabs(deltaD)<0.1 && l_temp<=35 ) _houghPeakHitList.push_back(hit);
267 if( 0.07<pt&&pt<0.08 && fabs(deltaD)<0.1 && l_temp<=43 ) _houghPeakHitList.push_back(hit);
268 if( 0.08<pt&&pt<0.09 && fabs(deltaD)<0.1 && l_temp<=43 ) _houghPeakHitList.push_back(hit);
269 if( 0.09<pt&&pt<0.10 && fabs(deltaD)<0.1 && l_temp<=41 ) _houghPeakHitList.push_back(hit);
270 if( 0.10<pt&&pt<0.11 && fabs(deltaD)<0.1 && l_temp<=41 ) _houghPeakHitList.push_back(hit);
271 if( 0.11<pt&&pt<0.12 && fabs(deltaD)<0.1 && l_temp<=41 ) _houghPeakHitList.push_back(hit);
273 if( pt<0.06 && fabs(deltaD)<0.1&& l_temp>35&&l_temp<45 ) _houghPeakHitList.push_back(hit);
274 if( 0.06<pt&&pt<0.07 && fabs(deltaD)<0.1 && l_temp>35&& l_temp<=45) _houghPeakHitList.push_back(hit);
275 if( 0.07<pt&&pt<0.08 && fabs(deltaD)<0.1 && l_temp>43&& l_temp<=50) _houghPeakHitList.push_back(hit);
276 if( 0.08<pt&&pt<0.09 && fabs(deltaD)<0.1 && l_temp>43&& l_temp<=50) _houghPeakHitList.push_back(hit);
280 if( pt>0.12 && fabs(deltaD)<0.1) _houghPeakHitList.push_back(hit);
319 return _houghPeakHitList.size();
double sin(const BesAngle a)
double cos(const BesAngle a)
const std::vector< HoughHit > & getList() const
int getSlayerType() const
double getDriftDist() const
int getHitNumS(int) const
static double m_dSigma_cut
static double m_dSigma_cut2
HoughPeak & operator=(const HoughPeak &other)
int collectHits(const HoughHitList &)
int getHitNumA(int) const