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

Private Member Functions

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

Private Attributes

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

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}
AthMessaging()
Default constructor:
void init()
initialises private members, called in constructor
unsigned int m_size
size of array
unsigned int m_nbinsx
number of x bins
double m_invbinwidthx
inv binwidth x axis used for cpu speedup
double m_ymax
maximum y coordinate
double m_binwidthx
binwidth x axis
unsigned int m_nbinsx_plus2
number of x bins + 2 , used for cpu speedup
unsigned int m_nbinsy_plus2
number of y bins + 2 , used for cpu speedup
const int m_number_of_maxima
number of maxima to be searched for
unsigned int m_nbinsy
number of y bins
double m_xmax
maximum x coordinate
unsigned int m_scale
threshold for minimum content for a maximum
double m_xmin
minimum x coordinate
const int m_distance_to_next_maximum
minimum distance for a maximum to be away from another maximum
double m_invbinwidthy
inv binwidth y axis used for cpu speedup
unsigned int m_threshold
double m_ymin
minimum y coordinate
double m_binwidthy
binwidth y axis
double xmax
Definition listroot.cxx:61
double ymin
Definition listroot.cxx:63
double xmin
Definition listroot.cxx:60
double ymax
Definition listroot.cxx:64

◆ 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}
int getNbinsY() const
returns number of bins y coordinate

◆ 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}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double getBinContent(int binnumber) const
returns x axis
double binnumberToXCoord(int binnumber) const
gives x-coordinate for certain binnumber
double binnumberToYCoord(int binnumber) const
gives y-coordinate for certain binnumber

◆ 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}
std::string histogram
Definition chains.cxx:52
std::unique_ptr< unsigned int[]> m_histBuffer
actual storage of bin values

◆ 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
double content_Bin_Area(int binnumber) const
return the total content of binarea (default: content of bin)

◆ 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}
std::vector< int > m_maximumbins
binnumbers found as maxima
int distanceBins(int binnumber1, int binnumber2) const
calculates the distance in binwidths between two binnumbers ("Manhattan metric")

◆ 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}
#define y
#define x
int coordToBinx(double x) const
converts x-coordinates to binx
int coordToBiny(double y) const
converts y-coordinates to biny

◆ 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}
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space

◆ 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}
int coordToBinnumber(double x, double y) const
converts coordinates to a binnumber
int fill(double x, double y, double weight=1.)
fill 2d histogram with point (x,y) with weight w, return binnumber filled

◆ 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}
unsigned int m_maximum

◆ 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
85}
#define ATH_MSG_DEBUG(x)
bool checkIfMaximumAlreadyUsed(int binnumber) const
check when searching for several maxima if binnumber is close to an earlier found maximum
bool checkIfMaximum(int binnumber, double &maximum, int &maxbin) const
check if binnumber is a maximum
bool m_maxima_found
check if search for maxima already performed
std::set< int > m_bins_above_threshold
set of bins that are above threshold used for speeding up searching for maxima
std::pair< double, double > binnumberToCoords(int binnumber, int printlevel=0) const
gives coordinates for certain binnumber

◆ 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}
int getMaxBin(unsigned int maximum_number=0)
return maximum binnumber

◆ 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}
std::pair< int, double > getMaximumBin(unsigned int maximum_number=0)
returns binnumber and maximum of maximum number maximum_number

◆ 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
void findMaxima()
find maxima in histogram

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ 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 178 of file AthMessaging.h.

179{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ 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_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ 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
40 m_maximumbins.clear(); // obsolete?
42 m_maximumBin = -1;
43 m_maximum = 0;
44 m_maximumIsValid = true;
45}
void resetHisto()
resets histogram

◆ 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.

bool flag
Definition master.py:29

◆ 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.

158{};

◆ m_binwidthx

double MuonHoughHisto2D::m_binwidthx {0.}
private

binwidth x axis

Definition at line 147 of file MuonHoughHisto2D.h.

147{0.};

◆ m_binwidthy

double MuonHoughHisto2D::m_binwidthy {0.}
private

binwidth y axis

Definition at line 149 of file MuonHoughHisto2D.h.

149{0.};

◆ 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.

172{0};

◆ m_histBuffer

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

actual storage of bin values

Definition at line 125 of file MuonHoughHisto2D.h.

125{};

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_invbinwidthx

double MuonHoughHisto2D::m_invbinwidthx {0.}
private

inv binwidth x axis used for cpu speedup

Definition at line 152 of file MuonHoughHisto2D.h.

152{0.};

◆ m_invbinwidthy

double MuonHoughHisto2D::m_invbinwidthy {0.}
private

inv binwidth y axis used for cpu speedup

Definition at line 154 of file MuonHoughHisto2D.h.

154{0.};

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ 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.

175{false};

◆ m_maximum

unsigned int MuonHoughHisto2D::m_maximum {0}
private

Definition at line 179 of file MuonHoughHisto2D.h.

179{0};

◆ m_maximumBin

int MuonHoughHisto2D::m_maximumBin {-1}
private

maximum

Definition at line 178 of file MuonHoughHisto2D.h.

178{-1};

◆ m_maximumbins

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

binnumbers found as maxima

Definition at line 161 of file MuonHoughHisto2D.h.

161{};

◆ m_maximumIsValid

bool MuonHoughHisto2D::m_maximumIsValid {true}
private

Definition at line 180 of file MuonHoughHisto2D.h.

180{true}; // flag whether the maximum can be trusted

◆ 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.

130{0};

◆ 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.

132{0};

◆ m_nbinsy

unsigned int MuonHoughHisto2D::m_nbinsy {0}
private

number of y bins

Definition at line 138 of file MuonHoughHisto2D.h.

138{0};

◆ 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.

140{0};

◆ 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.

165{0};

◆ m_scale

unsigned int MuonHoughHisto2D::m_scale {0}
private

threshold for minimum content for a maximum

Definition at line 168 of file MuonHoughHisto2D.h.

168{0}; // conversion from double -> unsigned int

◆ m_size

unsigned int MuonHoughHisto2D::m_size {0}
private

size of array

Definition at line 127 of file MuonHoughHisto2D.h.

127{0};

◆ m_threshold

unsigned int MuonHoughHisto2D::m_threshold {0}
private

Definition at line 169 of file MuonHoughHisto2D.h.

169{0};

◆ m_xmax

double MuonHoughHisto2D::m_xmax {0}
private

maximum x coordinate

Definition at line 136 of file MuonHoughHisto2D.h.

136{0};

◆ m_xmin

double MuonHoughHisto2D::m_xmin {0}
private

minimum x coordinate

Definition at line 134 of file MuonHoughHisto2D.h.

134{0};

◆ m_ymax

double MuonHoughHisto2D::m_ymax {0.}
private

maximum y coordinate

Definition at line 144 of file MuonHoughHisto2D.h.

144{0.};

◆ m_ymin

double MuonHoughHisto2D::m_ymin {0.}
private

minimum y coordinate

Definition at line 142 of file MuonHoughHisto2D.h.

142{0.};

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