BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/TrkReco/include/TrkReco/THistogram.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// $Id: THistogram.h,v 1.5 2010/03/31 09:58:59 liucy Exp $
3//-----------------------------------------------------------------------------
4// Filename : THistogram.h
5// Section : Tracking
6// Owner : Yoshi Iwasaki
7// Email : yoshihito.iwasaki@kek.jp
8//-----------------------------------------------------------------------------
9// Description : A class for a histogram used in tracking.
10// See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
11//-----------------------------------------------------------------------------
12
13#ifndef THistogram_FLAG_
14#define THistogram_FLAG_
15
16#ifdef TRKRECO_DEBUG_DETAIL
17# ifndef TRKRECO_DEBUG
18# define TRKRECO_DEBUG
19# endif
20#endif
21
22#include <string>
23
24// #define HEP_SHORT_NAMES
25#include "CLHEP/Alist/AList.h"
26
27#include "TrkReco/TMLink.h"
28#include "TrkReco/TSegment.h"
29#include "TrkReco/TSegment0.h"
30
31class TCircle;
32
33/// A class for a histogram used in tracking.
34class THistogram {
35
36public:
37 /// Constructor.
38 THistogram( unsigned nBins );
39
40 /// Destructor
41 virtual ~THistogram();
42
43public: // Selectors
44 /// dumps debug information.
45 void dump( const std::string& message = std::string( "" ),
46 const std::string& prefix = std::string( "" ) ) const;
47
48 /// returns a pointer to i'th AList<TMLink>.
49 const AList<TMLink>* const bin( unsigned i ) const;
50
51 /// returns a pointer to i'th AList<TMLink>.
52 const AList<TMLink>* const bin( int i ) const;
53
54 /// returns number in i'th bin.
55 unsigned nBin( unsigned i ) const;
56
57 /// returns \# of bins.
58 unsigned nBins( void ) const;
59
60 /// returns an AList of TMLinks within 'center' bin +- 'width' bin region.
61 AList<TMLink> contents( unsigned center, unsigned width ) const;
62
63 /// returns an AList of TMLinks from 'start' bin to 'end' bin region.
64 AList<TMLink> contents( int start, int end ) const;
65
66 /// returns an AList<TMLink> of all contents.
67 const AList<TMLink>& contents( void ) const;
68
69 /// returns an AList<TSegment0> of clusters.
71
72 /// returns an AList<TSegment0> of clusters.
74
75 /// returns an AList<TSegment0> using clusters() function.
77
78 /// returns an AList<TSegment0> using clusters() function.
80
81public: // Modifiers
82 /// fills with hits.
83 void fillX( const AList<TMLink>& links );
84
85 /// fills with hits.
86 void fillY( const AList<TMLink>& links );
87
88 /// fills with hits.
89 void fillPhi( const AList<TMLink>& links );
90
91 /// removes links.
92 void remove( const AList<TMLink>& links );
93
94 /// masks a bin. Masked bin will not be returned by ::findPeak.
95 void mask( unsigned binN );
96
97 /// remove masks.
98 void unmask( void );
99
100private:
101 unsigned _nBins;
102 unsigned* _bins;
103 bool* _masks;
104 AList<TMLink>** _links;
105 AList<TMLink> _all;
106 float _binSize;
107};
108
109//-----------------------------------------------------------------------------
110
111#ifdef THistogram_NO_INLINE
112# define inline
113#else
114# undef inline
115# define THistogram_INLINE_DEFINE_HERE
116#endif
117
118#ifdef THistogram_INLINE_DEFINE_HERE
119
120inline const AList<TMLink>* const THistogram::bin( unsigned i ) const {
121 if ( i < _nBins ) return _links[i];
122 return 0;
123}
124
125inline const AList<TMLink>* const THistogram::bin( int i ) const {
126 while ( i < 0 ) i += _nBins;
127 return _links[i % _nBins];
128}
129
130inline unsigned THistogram::nBins( void ) const { return _nBins; }
131
132inline void THistogram::mask( unsigned a ) { _masks[a] = true; }
133
134inline void THistogram::unmask( void ) {
135 for ( unsigned i = 0; i < _nBins; i++ ) _masks[i] = false;
136}
137
138inline const AList<TMLink>& THistogram::contents( void ) const { return _all; }
139
140inline unsigned THistogram::nBin( unsigned i ) const {
141 if ( i < _nBins ) return _bins[i];
142 return 0;
143}
144
145#endif
146
147#undef inline
148
149#endif /* THistogram_FLAG_ */
A class to represent a circle in tracking.
A class for a histogram used in tracking.
const AList< TMLink > & contents(void) const
returns an AList<TMLink> of all contents.
void mask(unsigned binN)
masks a bin. Masked bin will not be returned by findPeak.
THistogram(unsigned nBins)
Constructor.
unsigned nBins(void) const
returns # of bins.
const AList< TMLink > *const bin(int i) const
returns a pointer to i'th AList<TMLink>.
AList< TSegment0 > clusters0(void) const
returns an AList<TSegment0> of clusters.
void fillX(const AList< TMLink > &links)
fills with hits.
virtual ~THistogram()
Destructor.
AList< TMLink > contents(unsigned center, unsigned width) const
returns an AList of TMLinks within 'center' bin +- 'width' bin region.
void remove(const AList< TMLink > &links)
removes links.
AList< TMLink > contents(int start, int end) const
returns an AList of TMLinks from 'start' bin to 'end' bin region.
AList< TSegment > segments(void) const
returns an AList<TSegment0> using clusters() function.
unsigned nBin(unsigned i) const
returns number in i'th bin.
AList< TSegment0 > segments0(void) const
returns an AList<TSegment0> using clusters() function.
const AList< TMLink > *const bin(unsigned i) const
returns a pointer to i'th AList<TMLink>.
void fillY(const AList< TMLink > &links)
fills with hits.
void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void unmask(void)
remove masks.
void fillPhi(const AList< TMLink > &links)
fills with hits.
AList< TSegment > clusters(void) const
returns an AList<TSegment0> of clusters.