ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MuonHoughHisto2D Class Reference

Histogram class, similar to Root's TH2D. More...

#include <MuonHoughHisto2D.h>

Inheritance diagram for MuonHoughHisto2D:
Collaboration diagram for MuonHoughHisto2D:

Public Member Functions

 ~MuonHoughHisto2D ()=default
 destructor More...
 
 MuonHoughHisto2D (int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int number_of_maxima=1)
 constructor More...
 
int fill (double x, double y, double weight=1.)
 fill 2d histogram with point (x,y) with weight w, return binnumber filled More...
 
void fill (int binnumber, double weight=1.)
 fill bin with weight w More...
 
int getNbinsX () const
 returns number of bins x coordinate More...
 
int getNbinsY () const
 returns number of bins y coordinate More...
 
double getXmin () const
 returns min x axis More...
 
double getXmax () const
 returns max x axis More...
 
double getBinWidthX () const
 return binwidth x axis More...
 
double getBinWidthY () const
 return binwidth y axis More...
 
double getBinContent (int binnumber) const
 returns x axis More...
 
void reset ()
 clears histogram and bins_above_threshold More...
 
void findMaxima ()
 find maxima in histogram More...
 
std::pair< int, double > getMax () const
 returns binnumber and maximum of histogram (doesn't use m_bins_above_threshold) More...
 
std::pair< int, double > getMaximumBin (unsigned int maximum_number=0)
 returns binnumber and maximum of maximum number maximum_number More...
 
std::pair< double, double > getCoordsMaximum (unsigned int maximum_number=0)
 returns coords of maximum number maximum_number More...
 
bool checkIfMaximumAlreadyUsed (int binnumber) const
 check when searching for several maxima if binnumber is close to an earlier found maximum More...
 
bool checkIfMaximum (int binnumber, double &maximum, int &maxbin) const
 check if binnumber is a maximum More...
 
int distanceBins (int binnumber1, int binnumber2) const
 calculates the distance in binwidths between two binnumbers ("Manhattan metric") More...
 
double getMaximum (unsigned int maximum_number=0)
 return value of maximum bin More...
 
int getMaxBin (unsigned int maximum_number=0)
 return maximum binnumber More...
 
double content_Bin_Area (int binnumber) const
 return the total content of binarea (default: content of bin) More...
 
std::pair< double, double > binnumberToCoords (int binnumber, int printlevel=0) const
 gives coordinates for certain binnumber More...
 
double binnumberToXCoord (int binnumber) const
 gives x-coordinate for certain binnumber More...
 
double binnumberToYCoord (int binnumber) const
 gives y-coordinate for certain binnumber More...
 
int coordToBinnumber (double x, double y) const
 converts coordinates to a binnumber More...
 
int coordToBinx (double x) const
 converts x-coordinates to binx More...
 
int coordToBiny (double y) const
 converts y-coordinates to biny More...
 
int binInHistogram (unsigned int bin) const
 checks if bin is in histogram or if it is an under/overflow bin (unused) 0 is in histo 1 x underflow 2 x overflow 3 y underflow 4 y overflow More...
 
void setThreshold (double threshold)
 set threshold for maxima in histogram More...
 
double getThreshold () const
 returns threshold for maxima in histogram More...
 
std::unique_ptr< TH2FbookAndFillRootHistogram (const std::string &hname) const
 intialises a root histogram of MuonHoughHisto2D and fill it, used for debugging purposes More...
 
void setMaximumIsValid (bool flag)
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void init ()
 initialises private members, called in constructor More...
 
void resetHisto ()
 resets histogram More...
 
void setBinContent (int binnumber, double value)
 set bin content of binnumber More...
 
void setBinContent (int binx, int biny, double value)
 set bin content of binnumber corresponding to coordinates More...
 
MuonHoughHisto2Doperator= (const MuonHoughHisto2D &right)
 
 MuonHoughHisto2D (const MuonHoughHisto2D &)
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::unique_ptr< unsigned int[]> m_histBuffer {}
 actual storage of bin values More...
 
unsigned int m_size {0}
 size of array More...
 
unsigned int m_nbinsx {0}
 number of x bins More...
 
unsigned int m_nbinsx_plus2 {0}
 number of x bins + 2 , used for cpu speedup More...
 
double m_xmin {0}
 minimum x coordinate More...
 
double m_xmax {0}
 maximum x coordinate More...
 
unsigned int m_nbinsy {0}
 number of y bins More...
 
unsigned int m_nbinsy_plus2 {0}
 number of y bins + 2 , used for cpu speedup More...
 
double m_ymin {0.}
 minimum y coordinate More...
 
double m_ymax {0.}
 maximum y coordinate More...
 
double m_binwidthx {0.}
 binwidth x axis More...
 
double m_binwidthy {0.}
 binwidth y axis More...
 
double m_invbinwidthx {0.}
 inv binwidth x axis used for cpu speedup More...
 
double m_invbinwidthy {0.}
 inv binwidth y axis used for cpu speedup More...
 
std::set< int > m_bins_above_threshold {}
 set of bins that are above threshold used for speeding up searching for maxima More...
 
std::vector< int > m_maximumbins {}
 binnumbers found as maxima More...
 
const int m_number_of_maxima {0}
 number of maxima to be searched for More...
 
unsigned int m_scale {0}
 threshold for minimum content for a maximum More...
 
unsigned int m_threshold {0}
 
const int m_distance_to_next_maximum {0}
 minimum distance for a maximum to be away from another maximum More...
 
bool m_maxima_found {false}
 check if search for maxima already performed More...
 
int m_maximumBin {-1}
 maximum More...
 
unsigned int m_maximum {0}
 
bool m_maximumIsValid {true}
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Histogram class, similar to Root's TH2D.

Binnumbering is similar to Root's numbering. Starting in left corner to right upper corner Remind the over/under flow bins

Definition at line 22 of file MuonHoughHisto2D.h.

Constructor & Destructor Documentation

◆ ~MuonHoughHisto2D()

MuonHoughHisto2D::~MuonHoughHisto2D ( )
default

destructor

◆ MuonHoughHisto2D() [1/2]

MuonHoughHisto2D::MuonHoughHisto2D ( int  nbinsx,
double  xmin,
double  xmax,
int  nbinsy,
double  ymin,
double  ymax,
int  number_of_maxima = 1 
)

constructor

Definition at line 10 of file MuonHoughHisto2D.cxx.

10  :
11  AthMessaging("MuonHoughHisto2D"),
12  m_nbinsx(nbinsx),
13  m_xmin(xmin),
14  m_xmax(xmax),
15  m_nbinsy(nbinsy),
16  m_ymin(ymin),
17  m_ymax(ymax),
18  m_number_of_maxima(number_of_maxima),
19  m_scale(10000),
20  m_threshold(2.1 * m_scale),
22  m_nbinsx_plus2 = nbinsx + 2;
23  m_nbinsy_plus2 = nbinsy + 2;
25 
26  m_binwidthx = (m_xmax - m_xmin) / (m_nbinsx + 0.);
27  m_binwidthy = (m_ymax - m_ymin) / (m_nbinsy + 0.);
28 
31  init();
32 }

◆ MuonHoughHisto2D() [2/2]

MuonHoughHisto2D::MuonHoughHisto2D ( const MuonHoughHisto2D )
private

Member Function Documentation

◆ binInHistogram()

int MuonHoughHisto2D::binInHistogram ( unsigned int  bin) const

checks if bin is in histogram or if it is an under/overflow bin (unused) 0 is in histo 1 x underflow 2 x overflow 3 y underflow 4 y overflow

Definition at line 210 of file MuonHoughHisto2D.cxx.

210  {
211  int bininhisto = 0;
212 
213  if ((binnumber) % m_nbinsx_plus2 == 0) {
214  bininhisto = 1;
215  } else if ((binnumber + 1) % m_nbinsx_plus2 == 0) {
216  bininhisto = 2;
217  } else if (binnumber <= m_nbinsx_plus2) {
218  bininhisto = 3;
219  } else if (binnumber >= m_nbinsx_plus2 * (getNbinsY() + 1)) {
220  bininhisto = 4;
221  }
222 
223  return bininhisto;
224 }

◆ binnumberToCoords()

std::pair< double, double > MuonHoughHisto2D::binnumberToCoords ( int  binnumber,
int  printlevel = 0 
) const

gives coordinates for certain binnumber

Definition at line 189 of file MuonHoughHisto2D.cxx.

189  {
190  std::pair<double, double> coordsbin;
191  if (binnumber < 0) {
192  ATH_MSG_WARNING("MuonHoughHisto2D::ERROR: negativebinnumber: " << binnumber);
193  coordsbin.first = 99999.;
194  coordsbin.second = 99999.;
195  return coordsbin;
196  }
197 
198  double xcoord = binnumberToXCoord(binnumber);
199  double ycoord = binnumberToYCoord(binnumber);
200 
201  ATH_MSG_VERBOSE("MuonHoughHisto2D::Maximum: " << getBinContent(binnumber) << " binnumber: " << binnumber << " x: " << xcoord
202  << " y: " << ycoord);
203 
204 
205  coordsbin.first = xcoord;
206  coordsbin.second = ycoord;
207  return coordsbin;
208 }

◆ binnumberToXCoord()

double MuonHoughHisto2D::binnumberToXCoord ( int  binnumber) const
inline

gives x-coordinate for certain binnumber

Definition at line 228 of file MuonHoughHisto2D.h.

228  {
229  return m_xmin + m_binwidthx * (-0.5 + (binnumber) % m_nbinsx_plus2);
230 }

◆ binnumberToYCoord()

double MuonHoughHisto2D::binnumberToYCoord ( int  binnumber) const
inline

gives y-coordinate for certain binnumber

Definition at line 231 of file MuonHoughHisto2D.h.

231  {
232  return m_ymin + m_binwidthy * (-0.5 + (binnumber) / m_nbinsx_plus2);
233 }

◆ bookAndFillRootHistogram()

std::unique_ptr< TH2F > MuonHoughHisto2D::bookAndFillRootHistogram ( const std::string &  hname) const

intialises a root histogram of MuonHoughHisto2D and fill it, used for debugging purposes

Definition at line 226 of file MuonHoughHisto2D.cxx.

226  {
227  std::unique_ptr<TH2F> histogram = std::make_unique<TH2F>(hname.c_str(), hname.c_str(), m_nbinsx, m_xmin, m_xmax, m_nbinsy, m_ymin, m_ymax);
228  for (unsigned int i = 0; i < m_size; i++) {
229  int ix = i % m_nbinsx_plus2;
230  int iy = i / m_nbinsx_plus2;
231  histogram->SetBinContent(ix, iy, m_histBuffer[i] / (double)m_scale);
232  }
233  return histogram;
234 }

◆ checkIfMaximum()

bool MuonHoughHisto2D::checkIfMaximum ( int  binnumber,
double &  maximum,
int &  maxbin 
) const

check if binnumber is a maximum

Definition at line 157 of file MuonHoughHisto2D.cxx.

157  {
158  bool check = false;
159 
160  double content_bin_area = content_Bin_Area(binnumber); // now no area anymore == getBinContent
161 
162  // when using negative weights the following can happen:
163  if (content_bin_area < m_threshold) return check;
164 
165  if (content_bin_area == maximum) {
166  if (getBinContent(maxbin) > getBinContent(binnumber)) // give preference to maximum with peak ( _U_ )
167  {
168  check = true;
169  maximum = content_bin_area;
170  maxbin = binnumber;
171  }
172  } else if (content_bin_area > maximum) {
173  check = true;
174  maximum = content_bin_area;
175  maxbin = binnumber;
176  }
177  return check;
178 } // checkIfMaximum

◆ checkIfMaximumAlreadyUsed()

bool MuonHoughHisto2D::checkIfMaximumAlreadyUsed ( int  binnumber) const

check when searching for several maxima if binnumber is close to an earlier found maximum

Definition at line 144 of file MuonHoughHisto2D.cxx.

144  {
145  bool check = false;
146 
147  for (unsigned int i = 0; i < m_maximumbins.size(); i++) {
149  check = true;
150  return check;
151  }
152  }
153 
154  return check;
155 }

◆ content_Bin_Area()

double MuonHoughHisto2D::content_Bin_Area ( int  binnumber) const
inline

return the total content of binarea (default: content of bin)

Definition at line 206 of file MuonHoughHisto2D.h.

206 { return getBinContent(binnumber); }

◆ coordToBinnumber()

int MuonHoughHisto2D::coordToBinnumber ( double  x,
double  y 
) const
inline

converts coordinates to a binnumber

Definition at line 223 of file MuonHoughHisto2D.h.

223  {
224  int biny = coordToBiny(y);
225  int binx = coordToBinx(x);
226  return binx + biny * m_nbinsx_plus2;
227 }

◆ coordToBinx()

int MuonHoughHisto2D::coordToBinx ( double  x) const
inline

converts x-coordinates to binx

Definition at line 221 of file MuonHoughHisto2D.h.

221 { return static_cast<int>((x - m_xmin) * m_invbinwidthx) + 1; }

◆ coordToBiny()

int MuonHoughHisto2D::coordToBiny ( double  y) const
inline

converts y-coordinates to biny

Definition at line 222 of file MuonHoughHisto2D.h.

222 { return static_cast<int>((y - m_ymin) * m_invbinwidthy) + 1; }

◆ distanceBins()

int MuonHoughHisto2D::distanceBins ( int  binnumber1,
int  binnumber2 
) const

calculates the distance in binwidths between two binnumbers ("Manhattan metric")

Definition at line 180 of file MuonHoughHisto2D.cxx.

180  {
181  int binnumberdistance = std::abs(binnumber1 - binnumber2);
182 
183  // Manhattan metric:
184  int distance = (binnumberdistance % m_nbinsx_plus2) + (binnumberdistance / m_nbinsx_plus2);
185 
186  return distance;
187 }

◆ fill() [1/2]

int MuonHoughHisto2D::fill ( double  x,
double  y,
double  weight = 1. 
)
inline

fill 2d histogram with point (x,y) with weight w, return binnumber filled

Definition at line 190 of file MuonHoughHisto2D.h.

190  {
191  int binnumber = coordToBinnumber(x, y);
192  fill(binnumber, w);
193  return binnumber;
194 }

◆ fill() [2/2]

void MuonHoughHisto2D::fill ( int  binnumber,
double  weight = 1. 
)
inline

fill bin with weight w

Definition at line 196 of file MuonHoughHisto2D.h.

196  {
197  unsigned int& binval = m_histBuffer[binnumber];
198  binval += m_scale * weight;
199  if (binval > m_maximum) {
200  m_maximum = binval;
201  m_maximumBin = binnumber;
202  }
203 }

◆ findMaxima()

void MuonHoughHisto2D::findMaxima ( )

find maxima in histogram

Definition at line 47 of file MuonHoughHisto2D.cxx.

47  {
48  m_maximumbins.clear(); // clear old m_maxima_vector and start searching again
49 
50  int maximum_number = 0;
51 
52  while (maximum_number < m_number_of_maxima) {
53  double maximum = -1.;
54  //coverity defect 13671: max bin was set to -1 initially, but this is sued as an index into the array
55  int maxbin = 0;
56 
57  ATH_MSG_VERBOSE("MuonHoughHisto2D::size bins above threshold: " << m_bins_above_threshold.size());
58 
59  for (const int bin_num :m_bins_above_threshold) {
60  if (!checkIfMaximumAlreadyUsed(bin_num)) {
61  checkIfMaximum(bin_num, maximum, maxbin); // call by ref
62  }
63  }
64 
65  if (maximum < m_threshold) {
66  ATH_MSG_DEBUG("MuonHoughHisto2D:: no maximum found");
67  break;
68  } else {
69  ATH_MSG_DEBUG("MuonHoughHisto2D:: Maximum found: " << maximum << " binnumber: " << maxbin << " R (z) " << binnumberToCoords(maxbin).first
70  << " angle " << binnumberToCoords(maxbin).second);
71  m_maximumbins.push_back(maxbin);
72  } // maxbin <> m_threshold
73 
74  if (maximum == -1.) {
75  ATH_MSG_VERBOSE("MuonHoughHisto2D::No Bins Above Threshold");
76  } else {
77  std::pair<double, double> coords = binnumberToCoords(maxbin);
78  ATH_MSG_VERBOSE("MuonHoughHisto2D::Maximum Number: " << maximum_number << " Maximum: " << maximum
79  << " binnumber: " << maxbin << " x: " << coords.first << " y: " << coords.second);
80  }
81  maximum_number++;
82  } // number_of_maxima
83 
84  m_maxima_found = 1;
85 }

◆ getBinContent()

double MuonHoughHisto2D::getBinContent ( int  binnumber) const
inline

returns x axis

Definition at line 205 of file MuonHoughHisto2D.h.

205 { return m_histBuffer[binnumber] / m_scale; }

◆ getBinWidthX()

double MuonHoughHisto2D::getBinWidthX ( ) const
inline

return binwidth x axis

Definition at line 211 of file MuonHoughHisto2D.h.

211 { return m_binwidthx; }

◆ getBinWidthY()

double MuonHoughHisto2D::getBinWidthY ( ) const
inline

return binwidth y axis

Definition at line 212 of file MuonHoughHisto2D.h.

212 { return m_binwidthy; }

◆ getCoordsMaximum()

std::pair< double, double > MuonHoughHisto2D::getCoordsMaximum ( unsigned int  maximum_number = 0)

returns coords of maximum number maximum_number

Definition at line 130 of file MuonHoughHisto2D.cxx.

130  {
131  std::pair<double, double> coordsmaximum;
132  int binnumber = getMaxBin(maximum_number);
133 
134  if (binnumber != -1) {
135  coordsmaximum = binnumberToCoords(binnumber);
136  } else {
137  ATH_MSG_WARNING("HoughTransform::No Maximum Found");
138  coordsmaximum.first = 99999.;
139  coordsmaximum.second = 99999.;
140  }
141  return coordsmaximum;
142 }

◆ getMax()

std::pair< int, double > MuonHoughHisto2D::getMax ( ) const

returns binnumber and maximum of histogram (doesn't use m_bins_above_threshold)

Definition at line 87 of file MuonHoughHisto2D.cxx.

87  {
88  std::pair<int, double> maxpair;
89  int maxbin = -1; // convention! for no bin above threshold
90  unsigned int maximum = m_threshold;
91 
92  if (m_maximumIsValid) {
93  if (m_maximum > m_threshold) {
94  maxbin = m_maximumBin;
95  maximum = m_maximum;
96  }
97  } else {
98  for (unsigned int i = 0; i < m_size; i++) {
99  if (m_histBuffer[i] > maximum) {
100  maximum = m_histBuffer[i];
101  maxbin = i;
102  }
103  }
104  }
105  maxpair.first = maxbin;
106  maxpair.second = maximum;
107 
108  return maxpair;
109 }

◆ getMaxBin()

int MuonHoughHisto2D::getMaxBin ( unsigned int  maximum_number = 0)
inline

return maximum binnumber

Definition at line 218 of file MuonHoughHisto2D.h.

218  {
219  return getMaximumBin(maximum_number).first;
220 }

◆ getMaximum()

double MuonHoughHisto2D::getMaximum ( unsigned int  maximum_number = 0)
inline

return value of maximum bin

Definition at line 215 of file MuonHoughHisto2D.h.

215  {
216  return getMaximumBin(maximum_number).second;
217 }

◆ getMaximumBin()

std::pair< int, double > MuonHoughHisto2D::getMaximumBin ( unsigned int  maximum_number = 0)

returns binnumber and maximum of maximum number maximum_number

Definition at line 111 of file MuonHoughHisto2D.cxx.

111  {
112  if (m_maxima_found == 0) {
113  findMaxima(); // fills m_maximumbins
114  }
115 
116  int maxbin = -1;
117  double maximum = -1.;
118 
119  ATH_MSG_VERBOSE("MuonHoughHisto2D:: m_maximumbins.size: " << m_maximumbins.size());
120 
121 
122  if (m_maximumbins.size() > maximum_number) {
123  maxbin = m_maximumbins[maximum_number];
124  maximum = content_Bin_Area(maxbin);
125  }
126  return std::make_pair(maxbin, maximum);
127 
128 } // getMaximumBin

◆ getNbinsX()

int MuonHoughHisto2D::getNbinsX ( ) const
inline

returns number of bins x coordinate

Definition at line 207 of file MuonHoughHisto2D.h.

207 { return m_nbinsx; }

◆ getNbinsY()

int MuonHoughHisto2D::getNbinsY ( ) const
inline

returns number of bins y coordinate

Definition at line 208 of file MuonHoughHisto2D.h.

208 { return m_nbinsy; }

◆ getThreshold()

double MuonHoughHisto2D::getThreshold ( ) const
inline

returns threshold for maxima in histogram

Definition at line 214 of file MuonHoughHisto2D.h.

214 { return m_threshold; }

◆ getXmax()

double MuonHoughHisto2D::getXmax ( ) const
inline

returns max x axis

Definition at line 210 of file MuonHoughHisto2D.h.

210 { return m_xmax; }

◆ getXmin()

double MuonHoughHisto2D::getXmin ( ) const
inline

returns min x axis

Definition at line 209 of file MuonHoughHisto2D.h.

209 { return m_xmin; }

◆ init()

void MuonHoughHisto2D::init ( )
private

initialises private members, called in constructor

Definition at line 34 of file MuonHoughHisto2D.cxx.

34 { m_histBuffer.reset( new unsigned int[m_size]); }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ operator=()

MuonHoughHisto2D& MuonHoughHisto2D::operator= ( const MuonHoughHisto2D right)
private

◆ reset()

void MuonHoughHisto2D::reset ( )

clears histogram and bins_above_threshold

Definition at line 36 of file MuonHoughHisto2D.cxx.

36  {
37  resetHisto();
38 
39  m_bins_above_threshold.clear();
40  m_maximumbins.clear(); // obsolete?
41  m_maxima_found = 0;
42  m_maximumBin = -1;
43  m_maximum = 0;
44  m_maximumIsValid = true;
45 }

◆ resetHisto()

void MuonHoughHisto2D::resetHisto ( )
inlineprivate

resets histogram

Definition at line 234 of file MuonHoughHisto2D.h.

234 { memset(m_histBuffer.get(), 0, sizeof(unsigned int) * m_size); }

◆ setBinContent() [1/2]

void MuonHoughHisto2D::setBinContent ( int  binnumber,
double  value 
)
inlineprivate

set bin content of binnumber

Definition at line 204 of file MuonHoughHisto2D.h.

204 { m_histBuffer[binnumber] = m_scale * value; }

◆ setBinContent() [2/2]

void MuonHoughHisto2D::setBinContent ( int  binx,
int  biny,
double  value 
)
private

set bin content of binnumber corresponding to coordinates

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setMaximumIsValid()

void MuonHoughHisto2D::setMaximumIsValid ( bool  flag)
inline

Definition at line 115 of file MuonHoughHisto2D.h.

115 { m_maximumIsValid = flag; }

◆ setThreshold()

void MuonHoughHisto2D::setThreshold ( double  threshold)
inline

set threshold for maxima in histogram

Definition at line 213 of file MuonHoughHisto2D.h.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_bins_above_threshold

std::set<int> MuonHoughHisto2D::m_bins_above_threshold {}
private

set of bins that are above threshold used for speeding up searching for maxima

Definition at line 158 of file MuonHoughHisto2D.h.

◆ m_binwidthx

double MuonHoughHisto2D::m_binwidthx {0.}
private

binwidth x axis

Definition at line 147 of file MuonHoughHisto2D.h.

◆ m_binwidthy

double MuonHoughHisto2D::m_binwidthy {0.}
private

binwidth y axis

Definition at line 149 of file MuonHoughHisto2D.h.

◆ m_distance_to_next_maximum

const int MuonHoughHisto2D::m_distance_to_next_maximum {0}
private

minimum distance for a maximum to be away from another maximum

Definition at line 172 of file MuonHoughHisto2D.h.

◆ m_histBuffer

std::unique_ptr<unsigned int []> MuonHoughHisto2D::m_histBuffer {}
private

actual storage of bin values

Definition at line 125 of file MuonHoughHisto2D.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_invbinwidthx

double MuonHoughHisto2D::m_invbinwidthx {0.}
private

inv binwidth x axis used for cpu speedup

Definition at line 152 of file MuonHoughHisto2D.h.

◆ m_invbinwidthy

double MuonHoughHisto2D::m_invbinwidthy {0.}
private

inv binwidth y axis used for cpu speedup

Definition at line 154 of file MuonHoughHisto2D.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_maxima_found

bool MuonHoughHisto2D::m_maxima_found {false}
private

check if search for maxima already performed

Definition at line 175 of file MuonHoughHisto2D.h.

◆ m_maximum

unsigned int MuonHoughHisto2D::m_maximum {0}
private

Definition at line 179 of file MuonHoughHisto2D.h.

◆ m_maximumBin

int MuonHoughHisto2D::m_maximumBin {-1}
private

maximum

Definition at line 178 of file MuonHoughHisto2D.h.

◆ m_maximumbins

std::vector<int> MuonHoughHisto2D::m_maximumbins {}
private

binnumbers found as maxima

Definition at line 161 of file MuonHoughHisto2D.h.

◆ m_maximumIsValid

bool MuonHoughHisto2D::m_maximumIsValid {true}
private

Definition at line 180 of file MuonHoughHisto2D.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nbinsx

unsigned int MuonHoughHisto2D::m_nbinsx {0}
private

number of x bins

Definition at line 130 of file MuonHoughHisto2D.h.

◆ m_nbinsx_plus2

unsigned int MuonHoughHisto2D::m_nbinsx_plus2 {0}
private

number of x bins + 2 , used for cpu speedup

Definition at line 132 of file MuonHoughHisto2D.h.

◆ m_nbinsy

unsigned int MuonHoughHisto2D::m_nbinsy {0}
private

number of y bins

Definition at line 138 of file MuonHoughHisto2D.h.

◆ m_nbinsy_plus2

unsigned int MuonHoughHisto2D::m_nbinsy_plus2 {0}
private

number of y bins + 2 , used for cpu speedup

Definition at line 140 of file MuonHoughHisto2D.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_number_of_maxima

const int MuonHoughHisto2D::m_number_of_maxima {0}
private

number of maxima to be searched for

Definition at line 165 of file MuonHoughHisto2D.h.

◆ m_scale

unsigned int MuonHoughHisto2D::m_scale {0}
private

threshold for minimum content for a maximum

Definition at line 168 of file MuonHoughHisto2D.h.

◆ m_size

unsigned int MuonHoughHisto2D::m_size {0}
private

size of array

Definition at line 127 of file MuonHoughHisto2D.h.

◆ m_threshold

unsigned int MuonHoughHisto2D::m_threshold {0}
private

Definition at line 169 of file MuonHoughHisto2D.h.

◆ m_xmax

double MuonHoughHisto2D::m_xmax {0}
private

maximum x coordinate

Definition at line 136 of file MuonHoughHisto2D.h.

◆ m_xmin

double MuonHoughHisto2D::m_xmin {0}
private

minimum x coordinate

Definition at line 134 of file MuonHoughHisto2D.h.

◆ m_ymax

double MuonHoughHisto2D::m_ymax {0.}
private

maximum y coordinate

Definition at line 144 of file MuonHoughHisto2D.h.

◆ m_ymin

double MuonHoughHisto2D::m_ymin {0.}
private

minimum y coordinate

Definition at line 142 of file MuonHoughHisto2D.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
MuonHoughHisto2D::getBinContent
double getBinContent(int binnumber) const
returns x axis
Definition: MuonHoughHisto2D.h:205
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
MuonHoughHisto2D::m_invbinwidthx
double m_invbinwidthx
inv binwidth x axis used for cpu speedup
Definition: MuonHoughHisto2D.h:152
ymin
double ymin
Definition: listroot.cxx:63
MuonHoughHisto2D::m_ymax
double m_ymax
maximum y coordinate
Definition: MuonHoughHisto2D.h:144
MuonHoughHisto2D::m_maximum
unsigned int m_maximum
Definition: MuonHoughHisto2D.h:179
MuonHoughHisto2D::m_binwidthy
double m_binwidthy
binwidth y axis
Definition: MuonHoughHisto2D.h:149
MuonHoughHisto2D::findMaxima
void findMaxima()
find maxima in histogram
Definition: MuonHoughHisto2D.cxx:47
MuonHoughHisto2D::m_maximumIsValid
bool m_maximumIsValid
Definition: MuonHoughHisto2D.h:180
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
MuonHoughHisto2D::binnumberToXCoord
double binnumberToXCoord(int binnumber) const
gives x-coordinate for certain binnumber
Definition: MuonHoughHisto2D.h:228
MuonHoughHisto2D::distanceBins
int distanceBins(int binnumber1, int binnumber2) const
calculates the distance in binwidths between two binnumbers ("Manhattan metric")
Definition: MuonHoughHisto2D.cxx:180
MuonHoughHisto2D::m_histBuffer
std::unique_ptr< unsigned int[]> m_histBuffer
actual storage of bin values
Definition: MuonHoughHisto2D.h:125
MuonHoughHisto2D::m_size
unsigned int m_size
size of array
Definition: MuonHoughHisto2D.h:127
MuonHoughHisto2D::coordToBiny
int coordToBiny(double y) const
converts y-coordinates to biny
Definition: MuonHoughHisto2D.h:222
MuonHoughHisto2D::init
void init()
initialises private members, called in constructor
Definition: MuonHoughHisto2D.cxx:34
athena.value
value
Definition: athena.py:122
MuonHoughHisto2D::m_maxima_found
bool m_maxima_found
check if search for maxima already performed
Definition: MuonHoughHisto2D.h:175
MuonHoughHisto2D::m_maximumbins
std::vector< int > m_maximumbins
binnumbers found as maxima
Definition: MuonHoughHisto2D.h:161
MuonHoughHisto2D::m_threshold
unsigned int m_threshold
Definition: MuonHoughHisto2D.h:169
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuonHoughHisto2D::coordToBinx
int coordToBinx(double x) const
converts x-coordinates to binx
Definition: MuonHoughHisto2D.h:221
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
x
#define x
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
MuonHoughHisto2D::m_distance_to_next_maximum
const int m_distance_to_next_maximum
minimum distance for a maximum to be away from another maximum
Definition: MuonHoughHisto2D.h:172
MuonHoughHisto2D::coordToBinnumber
int coordToBinnumber(double x, double y) const
converts coordinates to a binnumber
Definition: MuonHoughHisto2D.h:223
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
MuonHoughHisto2D::checkIfMaximum
bool checkIfMaximum(int binnumber, double &maximum, int &maxbin) const
check if binnumber is a maximum
Definition: MuonHoughHisto2D.cxx:157
MuonHoughHisto2D::m_nbinsy
unsigned int m_nbinsy
number of y bins
Definition: MuonHoughHisto2D.h:138
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
MuonHoughHisto2D::m_ymin
double m_ymin
minimum y coordinate
Definition: MuonHoughHisto2D.h:142
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
xmin
double xmin
Definition: listroot.cxx:60
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
master.flag
bool flag
Definition: master.py:29
MuonHoughHisto2D::content_Bin_Area
double content_Bin_Area(int binnumber) const
return the total content of binarea (default: content of bin)
Definition: MuonHoughHisto2D.h:206
MuonHoughHisto2D::checkIfMaximumAlreadyUsed
bool checkIfMaximumAlreadyUsed(int binnumber) const
check when searching for several maxima if binnumber is close to an earlier found maximum
Definition: MuonHoughHisto2D.cxx:144
MuonHoughHisto2D::m_nbinsx
unsigned int m_nbinsx
number of x bins
Definition: MuonHoughHisto2D.h:130
MuonHoughHisto2D::binnumberToCoords
std::pair< double, double > binnumberToCoords(int binnumber, int printlevel=0) const
gives coordinates for certain binnumber
Definition: MuonHoughHisto2D.cxx:189
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MuonHoughHisto2D::resetHisto
void resetHisto()
resets histogram
Definition: MuonHoughHisto2D.h:234
MuonHoughHisto2D::binnumberToYCoord
double binnumberToYCoord(int binnumber) const
gives y-coordinate for certain binnumber
Definition: MuonHoughHisto2D.h:231
MuonHoughHisto2D::m_xmin
double m_xmin
minimum x coordinate
Definition: MuonHoughHisto2D.h:134
MuonHoughHisto2D::getMaxBin
int getMaxBin(unsigned int maximum_number=0)
return maximum binnumber
Definition: MuonHoughHisto2D.h:218
LArNewCalib_Delay_OFC_Cali.check
check
Definition: LArNewCalib_Delay_OFC_Cali.py:208
MuonHoughHisto2D::m_xmax
double m_xmax
maximum x coordinate
Definition: MuonHoughHisto2D.h:136
MuonHoughHisto2D::getNbinsY
int getNbinsY() const
returns number of bins y coordinate
Definition: MuonHoughHisto2D.h:208
y
#define y
MuonHoughHisto2D::getMaximumBin
std::pair< int, double > getMaximumBin(unsigned int maximum_number=0)
returns binnumber and maximum of maximum number maximum_number
Definition: MuonHoughHisto2D.cxx:111
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
MuonHoughHisto2D::m_nbinsy_plus2
unsigned int m_nbinsy_plus2
number of y bins + 2 , used for cpu speedup
Definition: MuonHoughHisto2D.h:140
DeMoScan.first
bool first
Definition: DeMoScan.py:534
MuonHoughHisto2D::m_bins_above_threshold
std::set< int > m_bins_above_threshold
set of bins that are above threshold used for speeding up searching for maxima
Definition: MuonHoughHisto2D.h:158
xmax
double xmax
Definition: listroot.cxx:61
MuonHoughHisto2D::m_invbinwidthy
double m_invbinwidthy
inv binwidth y axis used for cpu speedup
Definition: MuonHoughHisto2D.h:154
MuonHoughHisto2D::fill
int fill(double x, double y, double weight=1.)
fill 2d histogram with point (x,y) with weight w, return binnumber filled
Definition: MuonHoughHisto2D.h:190
MuonHoughHisto2D::m_number_of_maxima
const int m_number_of_maxima
number of maxima to be searched for
Definition: MuonHoughHisto2D.h:165
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
MuonHoughHisto2D::m_maximumBin
int m_maximumBin
maximum
Definition: MuonHoughHisto2D.h:178
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
MuonHoughHisto2D::m_scale
unsigned int m_scale
threshold for minimum content for a maximum
Definition: MuonHoughHisto2D.h:168
histogram
std::string histogram
Definition: chains.cxx:52
MuonHoughHisto2D::m_nbinsx_plus2
unsigned int m_nbinsx_plus2
number of x bins + 2 , used for cpu speedup
Definition: MuonHoughHisto2D.h:132
ymax
double ymax
Definition: listroot.cxx:64
MuonHoughHisto2D::m_binwidthx
double m_binwidthx
binwidth x axis
Definition: MuonHoughHisto2D.h:147