BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
HoughMap Class Reference

#include <HoughMap.h>

Public Member Functions

 HoughMap (int charge, HoughHitList &houghHitList, int mapHit, int ntheta, int nrho, double rhoMin, double rhoMaxi, int peakWidth, int peakHigh, double hitpro)
 
 HoughMap ()
 
 HoughMap (const HoughMap &other)
 
void doMap ()
 
 ~HoughMap ()
 
TH2D * getMdcHoughFinder () const
 
const HoughHitListgetHitList () const
 
int getPeakNumber () const
 
int getTrackNumber () const
 
const HoughPeakgetPeak (int i) const
 
const HoughTrackgetTrack (int i) const
 
const vector< HoughPeakgetPeakList () const
 
const vector< HoughTrackgetTrackList () const
 
int getPeakWidth () const
 
int getPeakHigh () const
 
int getNTheta () const
 
int getNRho () const
 
void printPeak ()
 
void printTrack ()
 
void clearMap ()
 
void select_slant ()
 
vector< double > get_maxlayer_slant () const
 
double get_maxlayer () const
 
vector< double > get_nomaxlayer_slant () const
 
vector< int > get_nomaxlayerid () const
 
double exTheta (int, double, double, int)
 
double exRho (int, double, double, int)
 
int exThetaBin (double)
 
int exRhoBin (double)
 
void printMapHit ()
 

Public Attributes

double Rho
 
double Theta
 
double Height
 
int MAX
 

Static Public Attributes

static int m_debug =0
 
static int m_useHalfCir =0
 
static int m_N1
 
static int m_N2
 

Detailed Description

Definition at line 18 of file HoughMap.h.

Constructor & Destructor Documentation

◆ HoughMap() [1/3]

HoughMap::HoughMap ( int  charge,
HoughHitList houghHitList,
int  mapHit,
int  ntheta,
int  nrho,
double  rhoMin,
double  rhoMaxi,
int  peakWidth,
int  peakHigh,
double  hitpro 
)

Definition at line 17 of file HoughMap.cxx.

17 {
18 _hitList=houghHitList;
19 _mapHit=mapHit;
20 _nTheta=ntheta;
21 _nRho=nrho;
22 _thetaMin=0;
23 _thetaMax=M_PI;
24 _rhoMin=rhoMin;
25 _rhoMax=rhoMax;
26 _peakWidth=peakWidth;
27 _peakHigh=peakHigh;
28 _hitpro=hitpro;
29 _charge=charge;
30
31 //_mapHitList = new vector<const HoughHit*>*[_nTheta];
32 //_houghS= new double*[_nTheta];
33 //_houghS2= new double*[m_N2];
34// _houghR= new double*[_nTheta];
35// _houghRL= new double*[_nTheta];
36// _houghNL= new double*[_nTheta];
37
38 for(int i=0; i<_nTheta; i++){
39 //_mapHitList[i] = new vector<const HoughHit*>[_nRho];
40// _houghS[i] = new double[_nRho];
41// _houghR[i] = new double[_nRho];
42// _houghRL[i] = new double[_nRho];
43// _houghNL[i] = new double[_nRho];
44// for(int j=0; j<_nRho; j++){
45// _houghS[i][j]=0;
46// _houghR[i][j]=0;
47// }
48 }
49// for(int i=0; i<m_N2; i++){
50// _houghS2[i] = new double[m_N2];
51// for(int j=0; j<m_N2; j++){
52// _houghS2[i][j]=0;
53// }
54// }
55
56 if(_charge==-1) _houghSpace = new TH2D("houghspace","houghspace",_nTheta,_thetaMin,_thetaMax,_nRho,_rhoMin,_rhoMax);
57 if(_charge==1 ) _houghSpace = new TH2D("houghspace2","houghspace2",_nTheta,_thetaMin,_thetaMax,_nRho,_rhoMin,_rhoMax);
58 // _houghR= new TH2D("houghR","houghR",_nTheta,_thetaMin,_thetaMax,_nRho,_rhoMin,_rhoMax);
59
60 doMap();
61}
#define M_PI
Definition: TConstant.h:4
void doMap()
Definition: HoughMap.cxx:98
float charge

◆ HoughMap() [2/3]

HoughMap::HoughMap ( )

Definition at line 12 of file HoughMap.cxx.

12 {
13 //_mapHitList=NULL;
14 _houghSpace=NULL;
15}

◆ HoughMap() [3/3]

HoughMap::HoughMap ( const HoughMap other)

Definition at line 62 of file HoughMap.cxx.

62 {
63 _mapHit =other._mapHit,
64 _nTheta =other._nTheta,
65 _nRho =other._nRho,
66 _thetaMin=other._thetaMin,
67 _thetaMax=other._thetaMax,
68 _rhoMin =other._rhoMin,
69 _rhoMax =other._rhoMax,
70 _hitList =other._hitList,
71 _houghPeakList=other._houghPeakList,
72 _houghTrackList=other._houghTrackList,
73 _houghSpace = other._houghSpace,
74 _charge = other._charge;
75 //_houghR= other._houghR;
76
77 //_mapHitList = new vector<const HoughHit*>*[_nTheta];
78 //_houghNL= new double*[_nTheta];
79 //_houghRL= new double*[_nTheta];
80 //_houghS= new double*[_nTheta];
81 //for(int i=0; i<_nTheta; i++){
82 //_mapHitList[i] = new vector<const HoughHit*>[_nRho];
83 // _houghNL[i] = new double[_nRho];
84 // _houghRL[i] = new double[_nRho];
85 //_houghS[i] = new double[_nRho];
86 //}
87
88 //for(int i=0; i<_nTheta; i++){
89 // for(int j=0; j<_nRho; j++){
90 //_mapHitList[i][j]=other._mapHitList[i][j];
91 // _houghNL[i][j]=other._houghNL[i][j];
92 // _houghRL[i][j]=other._houghRL[i][j];
93 // _houghS[i][j]=other._houghS[i][j];
94 // }
95 // }
96}
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ ~HoughMap()

HoughMap::~HoughMap ( )

Definition at line 137 of file HoughMap.cxx.

137 {
138 clearMap();
139}
void clearMap()
Definition: HoughMap.cxx:116

Member Function Documentation

◆ clearMap()

void HoughMap::clearMap ( )

Definition at line 116 of file HoughMap.cxx.

116 {
117
118 // for(int i=0; i<_nTheta; i++){ delete []_mapHitList[i];delete []_houghNL; delete []_houghRL;delete []_houghS;}
119 // for(int i=0; i<_nTheta; i++){ delete []_mapHitList[i]; }
120 // delete []_mapHitList;
121 delete _houghSpace;
122 // for(int i=0; i<_nTheta; i++){ delete []_houghS[i];}
123 // delete []_houghS;
124 // delete _houghR;
125 // for(int i=0; i<m_N2; i++) { delete []_houghS2[i];}
126 // delete []_houghS2;
127}

Referenced by ~HoughMap().

◆ doMap()

void HoughMap::doMap ( )

Definition at line 98 of file HoughMap.cxx.

98 {
99 buildMap();
100 //mapDev();
101 //cald_layer();
102 //select_slant();
103 //gravity();
104 //findPeaks();
105 //if(m_debug>0) {cout<<" before sort "<<endl; printPeak();}
106 // {cout<<" before sort "<<endl; printPeak();}
107 sortPeaks();
108 hitFinding();
109 if(m_debug>0) { cout<<" after sort "<<endl; printPeak();}
110 trackFinder();
111 // {cout<<" after sort "<<endl; printPeak();}
112 // candiTrack();
113 if(m_debug>0) printTrack();
114}
void printPeak()
Definition: HoughMap.cxx:128
void printTrack()
Definition: HoughMap.cxx:433
static int m_debug
Definition: HoughMap.h:58

Referenced by HoughMap().

◆ exRho()

double HoughMap::exRho ( int  irho,
double  rhomin,
double  rhomax,
int  n 
)

Definition at line 340 of file HoughMap.cxx.

340 {
341 //double rho = _rhoMin+(irho+1/2.)*(_rhoMax-_rhoMin)/_nRho;
342 double rho = rhomin+(irho+1/2.)*(rhomax-rhomin)/n;
343 return rho;
344}

◆ exRhoBin()

int HoughMap::exRhoBin ( double  )

◆ exTheta()

double HoughMap::exTheta ( int  itheta,
double  thetamin,
double  thetamax,
int  n 
)

Definition at line 345 of file HoughMap.cxx.

345 {
346 double theta= thetamin+(itheta+1/2.)*(thetamax-thetamin)/n;
347 return theta;
348}

◆ exThetaBin()

int HoughMap::exThetaBin ( double  )

◆ get_maxlayer()

double HoughMap::get_maxlayer ( ) const
inline

Definition at line 54 of file HoughMap.h.

54{return m_maxlayer;}

◆ get_maxlayer_slant()

vector< double > HoughMap::get_maxlayer_slant ( ) const
inline

Definition at line 53 of file HoughMap.h.

53{return maxlayer_slant;}

◆ get_nomaxlayer_slant()

vector< double > HoughMap::get_nomaxlayer_slant ( ) const
inline

Definition at line 55 of file HoughMap.h.

55{return nomaxlayer_slant;}

◆ get_nomaxlayerid()

vector< int > HoughMap::get_nomaxlayerid ( ) const
inline

Definition at line 56 of file HoughMap.h.

56{return nomaxlayerid;}

◆ getHitList()

const HoughHitList & HoughMap::getHitList ( ) const
inline

Definition at line 28 of file HoughMap.h.

28{return _hitList;}

◆ getMdcHoughFinder()

TH2D * HoughMap::getMdcHoughFinder ( ) const
inline

Definition at line 26 of file HoughMap.h.

26{return _houghSpace;}

◆ getNRho()

int HoughMap::getNRho ( ) const
inline

Definition at line 42 of file HoughMap.h.

42{return _nRho;}

◆ getNTheta()

int HoughMap::getNTheta ( ) const
inline

Definition at line 41 of file HoughMap.h.

41{return _nTheta;}

◆ getPeak()

const HoughPeak & HoughMap::getPeak ( int  i) const
inline

Definition at line 32 of file HoughMap.h.

32{return _houghPeakList[i];}

◆ getPeakHigh()

int HoughMap::getPeakHigh ( ) const
inline

Definition at line 40 of file HoughMap.h.

40{return _peakHigh;}

◆ getPeakList()

const vector< HoughPeak > HoughMap::getPeakList ( ) const
inline

Definition at line 36 of file HoughMap.h.

36{return _houghPeakList;}

◆ getPeakNumber()

int HoughMap::getPeakNumber ( ) const
inline

Definition at line 30 of file HoughMap.h.

30{return _houghPeakList.size();}

◆ getPeakWidth()

int HoughMap::getPeakWidth ( ) const
inline

Definition at line 39 of file HoughMap.h.

39{return _peakWidth;}

◆ getTrack()

const HoughTrack & HoughMap::getTrack ( int  i) const
inline

Definition at line 33 of file HoughMap.h.

33{return _houghTrackList[i];}

◆ getTrackList()

const vector< HoughTrack > HoughMap::getTrackList ( ) const
inline

Definition at line 37 of file HoughMap.h.

37{return _houghTrackList;}

Referenced by HoughTrackList::HoughTrackList().

◆ getTrackNumber()

int HoughMap::getTrackNumber ( ) const
inline

Definition at line 31 of file HoughMap.h.

31{return _houghTrackList.size();}

◆ printMapHit()

void HoughMap::printMapHit ( )

◆ printPeak()

void HoughMap::printPeak ( )

Definition at line 128 of file HoughMap.cxx.

128 {
129 cout<<"Print Peak in HoughMap sumPeak: "<<_houghPeakList.size()<<endl;
130 vector<HoughPeak>::iterator iter =_houghPeakList.begin();
131 for(int i=0;iter!=_houghPeakList.end();iter++,i++){
132 cout<<"count of Peak on HoughMap: "<<(*iter).getHoughHitList().size()<<endl;
133 (*iter).printAllHit();
134 }
135}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

Referenced by doMap().

◆ printTrack()

void HoughMap::printTrack ( )

Definition at line 433 of file HoughMap.cxx.

433 {
434 cout<<"Print Track in HoughMap: "<<endl;
435 vector<HoughTrack>::iterator iter =_houghTrackList.begin();
436 for(int i=0;iter!=_houghTrackList.end();iter++,i++){
437 cout<<"Print Track"<<i<<endl;
438 (*iter).printRecHit();
439 }
440}

Referenced by doMap().

◆ select_slant()

void HoughMap::select_slant ( )

Definition at line 554 of file HoughMap.cxx.

554 {
555 int binx,biny,binz;
556 _houghSpace->GetMaximumBin(binx,biny,binz);
557 double thetabin = _houghSpace->GetXaxis()->GetBinCenter(binx);
558 double rhobin = _houghSpace->GetYaxis()->GetBinCenter(biny);
559 vector<int> vec_layer;
560 std::vector<HoughHit>::iterator iter1= _hitList.getList().begin();
561 for(; iter1!= _hitList.getList().end(); iter1++){
562 if( (*iter1).getSlayerType()!=0 || (*iter1).getStyle()!=0 || (*iter1).getCirList()!=0 ) continue;
563 vec_layer.push_back( (*iter1).getLayerId() );
564 }
565
566 if( vec_layer.size()==0 ) return;
567 vector<int>::iterator laymax=max_element( vec_layer.begin(),vec_layer.end() );
568 int maxLayer=*laymax;
569 m_maxlayer=maxLayer;
570 // cout<<"max layer "<<maxLayer<<endl;
571
572 vector<int>::iterator iterlay = vec_layer.begin();
573 for(; iterlay!= vec_layer.end(); iterlay++){
574 if ( *iterlay==*laymax) {
575 vec_layer.erase(laymax);
576 iterlay--;
577 }
578 }
579 vector<int>::iterator laymax2=max_element( vec_layer.begin(),vec_layer.end() );
580 int maxLayer2=*laymax2;
581 // cout<<"max layer2 "<<maxLayer2<<endl;
582
583 std::vector<HoughHit>::iterator iter = _hitList.getList().begin();
584 for(; iter!= _hitList.getList().end(); iter++){
585 HoughHit *hit = &(*iter);
586 if( hit->getSlayerType()!=0 || hit->getStyle()!=0 || hit->getCirList()!=0 ) continue;
587 double slantOfLine= hit->getV()*cos(thetabin) - hit->getU()*sin(thetabin);
588 //cout<<"("<<hit->getLayerId()<<","<<hit->getWireId()<<") "<< slantOfLine<<endl;
589 if( hit->getLayerId()==maxLayer || hit->getLayerId()==maxLayer2){
590 maxlayer_slant.push_back(slantOfLine);
591 }
592 else{
593 nomaxlayer_slant.push_back(slantOfLine);
594 nomaxlayerid.push_back(hit->getLayerId());
595 }
596 }
597}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const std::vector< HoughHit > & getList() const
double getV() const
Definition: HoughHit.h:73
int getCirList() const
Definition: HoughHit.h:105
int getSlayerType() const
Definition: HoughHit.h:64
double getU() const
Definition: HoughHit.h:72
int getStyle() const
Definition: HoughHit.h:106
int getLayerId() const
Definition: HoughHit.h:62

Member Data Documentation

◆ Height

double HoughMap::Height

Definition at line 66 of file HoughMap.h.

◆ m_debug

int HoughMap::m_debug =0
static

Definition at line 58 of file HoughMap.h.

Referenced by doMap(), and MdcHoughFinder::initialize().

◆ m_N1

int HoughMap::m_N1
static

Definition at line 60 of file HoughMap.h.

Referenced by MdcHoughFinder::initialize().

◆ m_N2

int HoughMap::m_N2
static

Definition at line 61 of file HoughMap.h.

Referenced by MdcHoughFinder::initialize().

◆ m_useHalfCir

int HoughMap::m_useHalfCir =0
static

Definition at line 59 of file HoughMap.h.

Referenced by MdcHoughFinder::initialize().

◆ MAX

int HoughMap::MAX

Definition at line 68 of file HoughMap.h.

◆ Rho

double HoughMap::Rho

Definition at line 64 of file HoughMap.h.

◆ Theta

double HoughMap::Theta

Definition at line 65 of file HoughMap.h.


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