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

#include <HoughPeak.h>

Public Member Functions

 HoughPeak ()
 HoughPeak (const HoughPeak &other)
 ~HoughPeak ()
 HoughPeak (int itheta, int irho, double theta, double rho, vector< const HoughHit * > **mapHitList, bool is, int peakNum)
 HoughPeak (int height, int itheta, int irho, double theta, double rho, bool is, int peakNum, int charge)
vector< const HoughHit * > getHoughHitList () const
int peakHeight () const
int getPeakNum () const
int getThetaBin () const
int getRhoBin () const
double getTheta () const
double getRho () const
double getRho_reci () const
bool getisCandiTrack () const
void setisCandiTrack (bool is)
int getHitNum (int) const
int getHitNumA (int) const
int getHitNumS (int) const
void printAllHit () const
void print ()
HoughPeakoperator= (const HoughPeak &other)
int collectHits (const HoughHitList &)

Detailed Description

Definition at line 11 of file HoughPeak.h.

Constructor & Destructor Documentation

◆ HoughPeak() [1/4]

HoughPeak::HoughPeak ( )

Definition at line 5 of file HoughPeak.cxx.

5{}

Referenced by HoughPeak(), operator=(), and print().

◆ HoughPeak() [2/4]

HoughPeak::HoughPeak ( const HoughPeak & other)

Definition at line 38 of file HoughPeak.cxx.

38 {
39 if ( _houghPeakHitList.size() != 0 )
40 {
41 for ( int i = 0; i < _houghPeakHitList.size(); i++ ) { _houghPeakHitList[i] = NULL; }
42 _houghPeakHitList.clear();
43 }
44 _height = other._height;
45 _theta = other._theta;
46 _rho = other._rho;
47 _thetaBin = other._thetaBin;
48 _rhoBin = other._rhoBin;
49 _houghPeakHitList = other._houghPeakHitList;
50 _isCandiTrack = other._isCandiTrack;
51 _peakNum = other._peakNum;
52 _charge = other._charge;
53 // for(int i =0;i<other._houghPeakHitList.size();i++){
54 // const HoughHit* p_hit= new HoughHit( *(other._houghPeakHitList[i]));
55 // _houghPeakHitList.push_back(p_hit);
56 // }
57}
Index other(Index i, Index j)

◆ ~HoughPeak()

HoughPeak::~HoughPeak ( )

Definition at line 6 of file HoughPeak.cxx.

6 {
7 // cout<<" HoughPeak destruct" <<endl;
8 for ( int i = 0; i < _houghPeakHitList.size(); i++ )
9 {
10 // delete _houghPeakHitList[i];
11 _houghPeakHitList[i] = NULL;
12 }
13 _houghPeakHitList.clear();
14}

◆ HoughPeak() [3/4]

HoughPeak::HoughPeak ( int itheta,
int irho,
double theta,
double rho,
vector< const HoughHit * > ** mapHitList,
bool is,
int peakNum )

Definition at line 59 of file HoughPeak.cxx.

60 {
61 _thetaBin = itheta;
62 _rhoBin = irho;
63 _theta = theta;
64 _rho = rho;
65 _houghPeakHitList = mapHitList[itheta][irho];
66 _isCandiTrack = isCandiTrack;
67 _peakNum = peakNum;
68 // int t_size=mapHitList[itheta][irho].size();
69 // for(int i =0;i<t_size;i++){
70 // const HoughHit* p_hit= new HoughHit( *(mapHitList[itheta][irho][i]));
71 // _houghPeakHitList.push_back(p_hit);
72 // }
73}

◆ HoughPeak() [4/4]

HoughPeak::HoughPeak ( int height,
int itheta,
int irho,
double theta,
double rho,
bool is,
int peakNum,
int charge )

Definition at line 75 of file HoughPeak.cxx.

76 {
77 _height = height;
78 _thetaBin = itheta;
79 _rhoBin = irho;
80 _theta = theta;
81 _rho = rho;
82 // _houghPeakHitList = mapHitList[itheta][irho];
83 _isCandiTrack = isCandiTrack;
84 _peakNum = peakNum;
85 _charge = charge;
86 // collectHits(hitlist);
87}

Member Function Documentation

◆ collectHits()

int HoughPeak::collectHits ( const HoughHitList & hitlist)

Definition at line 193 of file HoughPeak.cxx.

193 {
194
195 double cirr_track = fabs( 1. / ( _rho ) );
196 double cirx_track = ( 1. / _rho ) * cos( _theta );
197 double ciry_track = ( 1. / _rho ) * sin( _theta );
198 std::vector<HoughHit>::const_iterator iter = hitlist.getList().begin();
199 for ( ; iter != hitlist.getList().end(); iter++ )
200 {
201 const HoughHit* hit = &( *iter );
202 int layer = hit->getLayerId();
203 if ( hit->getSlayerType() != 0 ) continue;
204 double cirx_hit = hit->getMidX();
205 double ciry_hit = hit->getMidY();
206 double cirr_hit = hit->getDriftDist();
207 if ( _charge == 1 && ( cirx_track * ciry_hit - ciry_track * cirx_hit >= 0 ) )
208 continue; // suppose charge -1 FIXME
209 if ( _charge == -1 && ( cirx_track * ciry_hit - ciry_track * cirx_hit <= 0 ) )
210 continue; // suppose charge -1 FIXME
211 double l1l2 = sqrt( ( cirx_hit - cirx_track ) * ( cirx_hit - cirx_track ) +
212 ( ciry_hit - ciry_track ) * ( ciry_hit - ciry_track ) );
213 double deltaD = 1.e9; // add initialize 25-05-15
214 if ( l1l2 > cirr_track ) deltaD = l1l2 - cirr_track - cirr_hit;
215 if ( l1l2 <= cirr_track ) deltaD = l1l2 - cirr_track + cirr_hit;
216
217 // cal flight length
218
219 double theta_temp;
220 double l_temp = 1.e9; // add initialize 25-05-15
221 if ( cirx_track == 0 || cirx_hit - cirx_track == 0 ) { theta_temp = 0; }
222 else
223 {
224 theta_temp = M_PI - atan2( ciry_hit - ciry_track, cirx_hit - cirx_track ) +
225 atan2( ciry_track, cirx_track );
226 if ( theta_temp > 2 * M_PI ) { theta_temp = theta_temp - 2 * M_PI; }
227 if ( theta_temp < 0 ) { theta_temp = theta_temp + 2 * M_PI; }
228 }
229 // cout<<" charge "<<_charge <<" "<<theta_temp<<endl;
230 if ( _charge == -1 ) { l_temp = cirr_track * theta_temp; }
231 if ( _charge == 1 )
232 {
233 theta_temp = 2 * M_PI - theta_temp;
234 l_temp = cirr_track * ( theta_temp );
235 }
236 double pt = fabs( ( 1. / _rho ) / 333.567 );
237 // if( fabs(deltaD)<0.2 && l_temp<=35 ) _houghPeakHitList.push_back(hit); //suppose 60MeV
238 // FIXME if( fabs(deltaD)<0.2 && l_temp>35 && l_temp<=45) _houghPeakHitList.push_back(hit);
239
240 if ( pt < 0.06 && fabs( deltaD ) < 0.1 && l_temp <= 35 )
241 _houghPeakHitList.push_back( hit );
242 if ( 0.06 < pt && pt < 0.07 && fabs( deltaD ) < 0.1 && l_temp <= 35 )
243 _houghPeakHitList.push_back( hit );
244 if ( 0.07 < pt && pt < 0.08 && fabs( deltaD ) < 0.1 && l_temp <= 43 )
245 _houghPeakHitList.push_back( hit );
246 if ( 0.08 < pt && pt < 0.09 && fabs( deltaD ) < 0.1 && l_temp <= 43 )
247 _houghPeakHitList.push_back( hit );
248 if ( 0.09 < pt && pt < 0.10 && fabs( deltaD ) < 0.1 && l_temp <= 41 )
249 _houghPeakHitList.push_back( hit );
250 if ( 0.10 < pt && pt < 0.11 && fabs( deltaD ) < 0.1 && l_temp <= 41 )
251 _houghPeakHitList.push_back( hit );
252 if ( 0.11 < pt && pt < 0.12 && fabs( deltaD ) < 0.1 && l_temp <= 41 )
253 _houghPeakHitList.push_back( hit );
254
255 if ( pt < 0.06 && fabs( deltaD ) < 0.1 && l_temp > 35 && l_temp < 45 )
256 _houghPeakHitList.push_back( hit );
257 if ( 0.06 < pt && pt < 0.07 && fabs( deltaD ) < 0.1 && l_temp > 35 && l_temp <= 45 )
258 _houghPeakHitList.push_back( hit );
259 if ( 0.07 < pt && pt < 0.08 && fabs( deltaD ) < 0.1 && l_temp > 43 && l_temp <= 50 )
260 _houghPeakHitList.push_back( hit );
261 if ( 0.08 < pt && pt < 0.09 && fabs( deltaD ) < 0.1 && l_temp > 43 && l_temp <= 50 )
262 _houghPeakHitList.push_back( hit );
263 // if( 0.09<pt&&pt<0.10 && fabs(deltaD)<0. && l_temp>41&& l_temp<=50)
264 //_houghPeakHitList.push_back(hit); if( 0.10<pt&&pt<0.11 && fabs(deltaD)<0. &&
265 // l_temp>80&& l_temp<=105) _houghPeakHitList.push_back(hit); if( 0.11<pt&&pt<0.12 &&
266 // fabs(deltaD)<0. && l_temp>80&& l_temp<=105) _houghPeakHitList.push_back(hit);
267 if ( pt > 0.12 && fabs( deltaD ) < 0.1 ) _houghPeakHitList.push_back( hit );
268 }
269 return _houghPeakHitList.size();
270}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
#define M_PI
Definition TConstant.h:4
const std::vector< HoughHit > & getList() const
int getSlayerType() const
Definition HoughHit.h:62
double getDriftDist() const
Definition HoughHit.h:67
double getMidY() const
Definition HoughHit.h:59
double getMidX() const
Definition HoughHit.h:58
int getLayerId() const
Definition HoughHit.h:60

◆ getHitNum()

int HoughPeak::getHitNum ( int select) const

Definition at line 103 of file HoughPeak.cxx.

103 {
104 int size = _houghPeakHitList.size();
105 int n0, n1, n2, n3, n4, n5, n6;
106 n0 = n1 = n2 = n3 = n4 = n5 = n6 = 0;
107 for ( int i = 0; i < size; i++ )
108 {
109 int cir = _houghPeakHitList[i]->getCirList();
110 int index = _houghPeakHitList[i]->digi()->getTrackIndex();
111 int style = _houghPeakHitList[i]->getStyle();
112 // cout<<"peak compare ("<<_houghPeakHitList[i]->getLayerId()<<" ,"
113 //<<_houghPeakHitList[i]->getWireId()<<"
114 //)"<<endl;
115 n0++;
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++;
122 }
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;
130 std::cout << "HoughTrack::getHitNum: select " << select << " is out of range, exiting"
131 << std::endl;
132 exit( 1 );
133}
int n2
Definition SD0Tag.cxx:59
int n1
Definition SD0Tag.cxx:58

◆ getHitNumA()

int HoughPeak::getHitNumA ( int select) const

Definition at line 134 of file HoughPeak.cxx.

134 {
135 int size = _houghPeakHitList.size();
136 int n0, n1, n2, n3, n4, n5, n6;
137 n0 = n1 = n2 = n3 = n4 = n5 = n6 = 0;
138 for ( int i = 0; i < size; i++ )
139 {
140 int cir = _houghPeakHitList[i]->getCirList();
141 int index = _houghPeakHitList[i]->digi()->getTrackIndex();
142 int type = _houghPeakHitList[i]->getSlayerType();
143 int style = _houghPeakHitList[i]->getStyle();
144 if ( type == 0 ) n0++;
145 if ( type == 0 && style == 1 ) n1++;
146 if ( type == 0 && style == 2 ) n2++;
147 if ( type == 0 && index < 0 ) n3++;
148 if ( type == 0 && index >= 0 && cir <= 1 && style == 0 ) n4++;
149 if ( type == 0 && ( index < 0 || cir > 1 ) ) n5++;
150 if ( type == 0 && index >= 0 && cir == 0 && style == 0 ) n6++;
151 }
152 if ( select == 0 ) return n0;
153 if ( select == 1 ) return n1;
154 if ( select == 2 ) return n2;
155 if ( select == 3 ) return n3;
156 if ( select == 4 ) return n4;
157 if ( select == 5 ) return n5;
158 if ( select == 6 ) return n6;
159 std::cout << "HoughTrack::getHitNum: select " << select << " is out of range, exiting"
160 << std::endl;
161 exit( 1 );
162}

◆ getHitNumS()

int HoughPeak::getHitNumS ( int select) const

Definition at line 163 of file HoughPeak.cxx.

163 {
164 int size = _houghPeakHitList.size();
165 int n0, n1, n2, n3, n4, n5, n6;
166 n0 = n1 = n2 = n3 = n4 = n5 = n6 = 0;
167 for ( int i = 0; i < size; i++ )
168 {
169 int cir = _houghPeakHitList[i]->getCirList();
170 int index = _houghPeakHitList[i]->digi()->getTrackIndex();
171 int type = _houghPeakHitList[i]->getSlayerType();
172 int style = _houghPeakHitList[i]->getStyle();
173 if ( type != 0 ) n0++;
174 if ( type != 0 && style == 1 ) n1++;
175 if ( type != 0 && style == 2 ) n2++;
176 if ( type != 0 && index < 0 ) n3++;
177 if ( type != 0 && index >= 0 && cir <= 1 && style == 0 ) n4++;
178 if ( type != 0 && ( index < 0 || cir > 1 ) ) n5++;
179 if ( type != 0 && index >= 0 && cir == 0 && style == 0 ) n6++;
180 }
181 if ( select == 0 ) return n0;
182 if ( select == 1 ) return n1;
183 if ( select == 2 ) return n2;
184 if ( select == 3 ) return n3;
185 if ( select == 4 ) return n4;
186 if ( select == 5 ) return n5;
187 if ( select == 6 ) return n6;
188 std::cout << "HoughTrack::getHitNum: select " << select << " is out of range, exiting"
189 << std::endl;
190 exit( 1 );
191}

◆ getHoughHitList()

vector< const HoughHit * > HoughPeak::getHoughHitList ( ) const
inline

Definition at line 23 of file HoughPeak.h.

23{ return _houghPeakHitList; }

◆ getisCandiTrack()

bool HoughPeak::getisCandiTrack ( ) const
inline

Definition at line 31 of file HoughPeak.h.

31{ return _isCandiTrack; }

◆ getPeakNum()

int HoughPeak::getPeakNum ( ) const
inline

Definition at line 25 of file HoughPeak.h.

25{ return _peakNum; }

◆ getRho()

double HoughPeak::getRho ( ) const
inline

Definition at line 29 of file HoughPeak.h.

29{ return _rho; }

◆ getRho_reci()

double HoughPeak::getRho_reci ( ) const
inline

Definition at line 30 of file HoughPeak.h.

30{ return 1. / _rho; }

◆ getRhoBin()

int HoughPeak::getRhoBin ( ) const
inline

Definition at line 27 of file HoughPeak.h.

27{ return _rhoBin; }

◆ getTheta()

double HoughPeak::getTheta ( ) const
inline

Definition at line 28 of file HoughPeak.h.

28{ return _theta; }

◆ getThetaBin()

int HoughPeak::getThetaBin ( ) const
inline

Definition at line 26 of file HoughPeak.h.

26{ return _thetaBin; }

◆ operator=()

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

Definition at line 15 of file HoughPeak.cxx.

15 {
16 if ( this == &other ) return *this;
17 _height = other._height;
18 _theta = other._theta;
19 _rho = other._rho;
20 _thetaBin = other._thetaBin;
21 _rhoBin = other._rhoBin;
22 _isCandiTrack = other._isCandiTrack;
23 _peakNum = other._peakNum;
24 _charge = other._charge;
25 if ( _houghPeakHitList.size() != 0 )
26 {
27 for ( int i = 0; i < _houghPeakHitList.size(); i++ ) { _houghPeakHitList[i] = NULL; }
28 _houghPeakHitList.clear();
29 }
30 _houghPeakHitList = other._houghPeakHitList;
31 // for(int i =0;i<other._houghPeakHitList.size();i++){
32 // const HoughHit* p_hit= new HoughHit( *(other._houghPeakHitList[i]));
33 // _houghPeakHitList.push_back(p_hit);
34 // }
35 return *this;
36}

◆ peakHeight()

int HoughPeak::peakHeight ( ) const
inline

Definition at line 24 of file HoughPeak.h.

24{ return _height; }

Referenced by less_hits_in_peak().

◆ print()

void HoughPeak::print ( )

◆ printAllHit()

void HoughPeak::printAllHit ( ) const

Definition at line 89 of file HoughPeak.cxx.

89 {
90 int size = _houghPeakHitList.size();
91 if ( size == 0 ) return;
92 cout << "Print hitlist in HoughPeak " << endl;
93 cout << "at center (" << _theta << " ," << _rho << "): " << size << endl;
94 for ( int i = 0; i < size; i++ )
95 {
96 int layer = _houghPeakHitList[i]->getLayerId();
97 int wire = _houghPeakHitList[i]->getWireId();
98 std::cout << "Peak (" << layer << "," << wire << ") " << _houghPeakHitList[i]
99 << std::endl;
100 }
101}

◆ setisCandiTrack()

void HoughPeak::setisCandiTrack ( bool is)
inline

Definition at line 32 of file HoughPeak.h.

32{ _isCandiTrack = is; }

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