BOSS 8.0.0
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.

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

Referenced by HoughMap().

◆ 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 70 of file HoughMap.cxx.

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

◆ ~HoughMap()

HoughMap::~HoughMap ( )

Definition at line 143 of file HoughMap.cxx.

143{ clearMap(); }
void clearMap()
Definition HoughMap.cxx:121

Member Function Documentation

◆ clearMap()

void HoughMap::clearMap ( )

Definition at line 121 of file HoughMap.cxx.

121 {
122
123 // for(int i=0; i<_nTheta; i++){ delete []_mapHitList[i];delete []_houghNL; delete
124 // []_houghRL;delete []_houghS;} for(int i=0; i<_nTheta; i++){ delete []_mapHitList[i]; }
125 // delete []_mapHitList;
126 delete _houghSpace;
127 // for(int i=0; i<_nTheta; i++){ delete []_houghS[i];}
128 // delete []_houghS;
129 // delete _houghR;
130 // for(int i=0; i<m_N2; i++) { delete []_houghS2[i];}
131 // delete []_houghS2;
132}

Referenced by ~HoughMap().

◆ doMap()

void HoughMap::doMap ( )

Definition at line 99 of file HoughMap.cxx.

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

Referenced by HoughMap().

◆ exRho()

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

Definition at line 382 of file HoughMap.cxx.

382 {
383 // double rho = _rhoMin+(irho+1/2.)*(_rhoMax-_rhoMin)/_nRho;
384 double rho = rhomin + ( irho + 1 / 2. ) * ( rhomax - rhomin ) / n;
385 return rho;
386}
const Int_t n

◆ exRhoBin()

int HoughMap::exRhoBin ( double )

◆ exTheta()

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

Definition at line 387 of file HoughMap.cxx.

387 {
388 double theta = thetamin + ( itheta + 1 / 2. ) * ( thetamax - thetamin ) / n;
389 return theta;
390}

◆ exThetaBin()

int HoughMap::exThetaBin ( double )

◆ get_maxlayer()

double HoughMap::get_maxlayer ( ) const
inline

Definition at line 55 of file HoughMap.h.

55{ return m_maxlayer; }

◆ get_maxlayer_slant()

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

Definition at line 54 of file HoughMap.h.

54{ return maxlayer_slant; }

◆ get_nomaxlayer_slant()

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

Definition at line 56 of file HoughMap.h.

56{ return nomaxlayer_slant; }

◆ get_nomaxlayerid()

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

Definition at line 57 of file HoughMap.h.

57{ return nomaxlayerid; }

◆ getHitList()

const HoughHitList & HoughMap::getHitList ( ) const
inline

Definition at line 29 of file HoughMap.h.

29{ return _hitList; }

◆ getMdcHoughFinder()

TH2D * HoughMap::getMdcHoughFinder ( ) const
inline

Definition at line 27 of file HoughMap.h.

27{ return _houghSpace; }

◆ getNRho()

int HoughMap::getNRho ( ) const
inline

Definition at line 43 of file HoughMap.h.

43{ return _nRho; }

◆ getNTheta()

int HoughMap::getNTheta ( ) const
inline

Definition at line 42 of file HoughMap.h.

42{ return _nTheta; }

◆ getPeak()

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

Definition at line 33 of file HoughMap.h.

33{ return _houghPeakList[i]; }

◆ getPeakHigh()

int HoughMap::getPeakHigh ( ) const
inline

Definition at line 41 of file HoughMap.h.

41{ return _peakHigh; }

◆ getPeakList()

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

Definition at line 37 of file HoughMap.h.

37{ return _houghPeakList; }

◆ getPeakNumber()

int HoughMap::getPeakNumber ( ) const
inline

Definition at line 31 of file HoughMap.h.

31{ return _houghPeakList.size(); }

◆ getPeakWidth()

int HoughMap::getPeakWidth ( ) const
inline

Definition at line 40 of file HoughMap.h.

40{ return _peakWidth; }

◆ getTrack()

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

Definition at line 34 of file HoughMap.h.

34{ return _houghTrackList[i]; }

◆ getTrackList()

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

Definition at line 38 of file HoughMap.h.

38{ return _houghTrackList; }

Referenced by HoughTrackList::HoughTrackList().

◆ getTrackNumber()

int HoughMap::getTrackNumber ( ) const
inline

Definition at line 32 of file HoughMap.h.

32{ return _houghTrackList.size(); }

◆ printMapHit()

void HoughMap::printMapHit ( )

◆ printPeak()

void HoughMap::printPeak ( )

Definition at line 133 of file HoughMap.cxx.

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

Referenced by doMap().

◆ printTrack()

void HoughMap::printTrack ( )

Definition at line 488 of file HoughMap.cxx.

488 {
489 cout << "Print Track in HoughMap: " << endl;
490 vector<HoughTrack>::iterator iter = _houghTrackList.begin();
491 for ( int i = 0; iter != _houghTrackList.end(); iter++, i++ )
492 {
493 cout << "Print Track" << i << endl;
494 ( *iter ).printRecHit();
495 }
496}

Referenced by doMap().

◆ select_slant()

void HoughMap::select_slant ( )

Definition at line 614 of file HoughMap.cxx.

614 {
615 int binx, biny, binz;
616 _houghSpace->GetMaximumBin( binx, biny, binz );
617 double thetabin = _houghSpace->GetXaxis()->GetBinCenter( binx );
618 double rhobin = _houghSpace->GetYaxis()->GetBinCenter( biny );
619 vector<int> vec_layer;
620 std::vector<HoughHit>::iterator iter1 = _hitList.getList().begin();
621 for ( ; iter1 != _hitList.getList().end(); iter1++ )
622 {
623 if ( ( *iter1 ).getSlayerType() != 0 || ( *iter1 ).getStyle() != 0 ||
624 ( *iter1 ).getCirList() != 0 )
625 continue;
626 vec_layer.push_back( ( *iter1 ).getLayerId() );
627 }
628
629 if ( vec_layer.size() == 0 ) return;
630 vector<int>::iterator laymax = max_element( vec_layer.begin(), vec_layer.end() );
631 int maxLayer = *laymax;
632 m_maxlayer = maxLayer;
633 // cout<<"max layer "<<maxLayer<<endl;
634
635 vector<int>::iterator iterlay = vec_layer.begin();
636 for ( ; iterlay != vec_layer.end(); iterlay++ )
637 {
638 if ( *iterlay == *laymax )
639 {
640 vec_layer.erase( laymax );
641 iterlay--;
642 }
643 }
644 vector<int>::iterator laymax2 = max_element( vec_layer.begin(), vec_layer.end() );
645 int maxLayer2 = *laymax2;
646 // cout<<"max layer2 "<<maxLayer2<<endl;
647
648 std::vector<HoughHit>::iterator iter = _hitList.getList().begin();
649 for ( ; iter != _hitList.getList().end(); iter++ )
650 {
651 HoughHit* hit = &( *iter );
652 if ( hit->getSlayerType() != 0 || hit->getStyle() != 0 || hit->getCirList() != 0 )
653 continue;
654 double slantOfLine = hit->getV() * cos( thetabin ) - hit->getU() * sin( thetabin );
655 // cout<<"("<<hit->getLayerId()<<","<<hit->getWireId()<<") "<< slantOfLine<<endl;
656 if ( hit->getLayerId() == maxLayer || hit->getLayerId() == maxLayer2 )
657 { maxlayer_slant.push_back( slantOfLine ); }
658 else
659 {
660 nomaxlayer_slant.push_back( slantOfLine );
661 nomaxlayerid.push_back( hit->getLayerId() );
662 }
663 }
664}
double getV() const
Definition HoughHit.h:71
int getCirList() const
Definition HoughHit.h:102
int getSlayerType() const
Definition HoughHit.h:62
double getU() const
Definition HoughHit.h:70
int getStyle() const
Definition HoughHit.h:103
int getLayerId() const
Definition HoughHit.h:60

Member Data Documentation

◆ Height

double HoughMap::Height

Definition at line 67 of file HoughMap.h.

◆ m_debug

int HoughMap::m_debug = 0
static

Definition at line 59 of file HoughMap.h.

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

◆ m_N1

int HoughMap::m_N1
static

Definition at line 61 of file HoughMap.h.

Referenced by MdcHoughFinder::initialize().

◆ m_N2

int HoughMap::m_N2
static

Definition at line 62 of file HoughMap.h.

Referenced by MdcHoughFinder::initialize().

◆ m_useHalfCir

int HoughMap::m_useHalfCir = 0
static

Definition at line 60 of file HoughMap.h.

Referenced by MdcHoughFinder::initialize().

◆ MAX

int HoughMap::MAX

Definition at line 69 of file HoughMap.h.

◆ Rho

double HoughMap::Rho

Definition at line 65 of file HoughMap.h.

◆ Theta

double HoughMap::Theta

Definition at line 66 of file HoughMap.h.


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