00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef THistogram_FLAG_
00014 #define THistogram_FLAG_
00015
00016 #ifdef TRKRECO_DEBUG_DETAIL
00017 #ifndef TRKRECO_DEBUG
00018 #define TRKRECO_DEBUG
00019 #endif
00020 #endif
00021
00022 #include <string>
00023
00024 #define HEP_SHORT_NAMES
00025 #include "CLHEP/Alist/AList.h"
00026
00027 #include "TrkReco/TMLink.h"
00028 #include "TrkReco/TSegment0.h"
00029 #include "TrkReco/TSegment.h"
00030
00031 class TCircle;
00032
00034 class THistogram {
00035
00036 public:
00038 THistogram(unsigned nBins);
00039
00041 virtual ~THistogram();
00042
00043 public:
00045 void dump(const std::string & message = std::string(""),
00046 const std::string & prefix = std::string("")) const;
00047
00049 const AList<TMLink> * const bin(unsigned i) const;
00050
00052 const AList<TMLink> * const bin(int i) const;
00053
00055 unsigned nBin(unsigned i) const;
00056
00058 unsigned nBins(void) const;
00059
00061 AList<TMLink> contents(unsigned center, unsigned width) const;
00062
00064 AList<TMLink> contents(int start, int end) const;
00065
00067 const AList<TMLink> & contents(void) const;
00068
00070 AList<TSegment0> clusters0(void) const;
00071
00073 AList<TSegment> clusters(void) const;
00074
00076 AList<TSegment0> segments0(void) const;
00077
00079 AList<TSegment> segments(void) const;
00080
00081 public:
00083 void fillX(const AList<TMLink> & links);
00084
00086 void fillY(const AList<TMLink> & links);
00087
00089 void fillPhi(const AList<TMLink> & links);
00090
00092 void remove(const AList<TMLink> & links);
00093
00095 void mask(unsigned binN);
00096
00098 void unmask(void);
00099
00100 private:
00101 unsigned _nBins;
00102 unsigned * _bins;
00103 bool * _masks;
00104 AList<TMLink> ** _links;
00105 AList<TMLink> _all;
00106 float _binSize;
00107 };
00108
00109
00110
00111 #ifdef THistogram_NO_INLINE
00112 #define inline
00113 #else
00114 #undef inline
00115 #define THistogram_INLINE_DEFINE_HERE
00116 #endif
00117
00118 #ifdef THistogram_INLINE_DEFINE_HERE
00119
00120 inline
00121 const AList<TMLink> * const
00122 THistogram::bin(unsigned i) const {
00123 if (i < _nBins) return _links[i];
00124 return 0;
00125 }
00126
00127 inline
00128 const AList<TMLink> * const
00129 THistogram::bin(int i) const {
00130 while (i < 0) i += _nBins;
00131 return _links[i % _nBins];
00132 }
00133
00134 inline
00135 unsigned
00136 THistogram::nBins(void) const {
00137 return _nBins;
00138 }
00139
00140 inline
00141 void
00142 THistogram::mask(unsigned a) {
00143 _masks[a] = true;
00144 }
00145
00146 inline
00147 void
00148 THistogram::unmask(void) {
00149 for (unsigned i = 0; i < _nBins; i++) _masks[i] = false;
00150 }
00151
00152 inline
00153 const AList<TMLink> &
00154 THistogram::contents(void) const {
00155 return _all;
00156 }
00157
00158 inline
00159 unsigned
00160 THistogram::nBin(unsigned i) const {
00161 if (i < _nBins) return _bins[i];
00162 return 0;
00163 }
00164
00165 #endif
00166
00167 #undef inline
00168
00169 #endif