|
ATLAS Offline Software
|
#include <MuonHoughTransformer_rz.h>
|
| MuonHoughTransformer_rz (int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors=1) |
|
virtual | ~MuonHoughTransformer_rz ()=default |
|
virtual void | fillHit (const std::shared_ptr< MuonHoughHit > &hit, double weight=1.) override final |
| fill histograms with hit More...
|
|
virtual int | fillHisto (double rz0, double theta, double weight, int sector) override final |
| fill histogram with certain coordinate More...
|
|
virtual float | weightHoughTransform (double r0) const override final |
| weight houghtransform, give more importance to houghtransforms close to origin More...
|
|
float | weightHoughTransform (double r0, double angle) const |
|
int | sector (const std::shared_ptr< MuonHoughHit > &hit) const override final |
| returns sector for coords More...
|
|
virtual void | fill (const MuonHoughHitContainer &event, bool subtract=false) |
| fill histograms with hitcontainer More...
|
|
std::unique_ptr< MuonHoughPattern > | associateHitsToMaximum (const MuonHoughHitContainer &event, double residu_mm, double residu_grad, int maximum_number) const |
| associate hits to certain maximum number of histograms More...
|
|
std::unique_ptr< MuonHoughPattern > | associateHitsToCoords (const MuonHoughHitContainer &event, std::pair< double, double > coords, double residu_mm, double residu_angle, int sector=0) const |
| associate hits to certain coordinates and sector More...
|
|
std::unique_ptr< MuonHoughPattern > | associateHitsToBinnumber (const MuonHoughHitContainer &event, int binnumber, double maximum_residu_mm, double maximum_residu_angle, int sector=0) const |
| associate hits to certain binnumber and sector More...
|
|
void | resetHisto () |
| reset histograms More...
|
|
void | useNegativeWeights (bool use_negative_weights) |
| use negative weights More...
|
|
std::vector< std::pair< int, int > > | getMaxima (int max_patterns) const |
| return the first certain number of maxima of histograms More...
|
|
void | setIP (bool ip_setting) |
| set m_ip_setting (e.g. More...
|
|
const MuonHoughHisto2DContainer & | histos () const |
| access to histograms More...
|
|
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...
|
|
|
static double | calculateAngle (double hitx, double hity, double hitz, double z0) |
|
|
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...
|
|
Definition at line 10 of file MuonHoughTransformer_rz.h.
◆ MuonHoughTransformer_rz()
MuonHoughTransformer_rz::MuonHoughTransformer_rz |
( |
int |
nbins, |
|
|
int |
nbins_angle, |
|
|
double |
detectorsize, |
|
|
double |
detectorsize_angle, |
|
|
double |
threshold_histo, |
|
|
int |
number_of_sectors = 1 |
|
) |
| |
◆ ~MuonHoughTransformer_rz()
virtual MuonHoughTransformer_rz::~MuonHoughTransformer_rz |
( |
| ) |
|
|
virtualdefault |
◆ associateHitsToBinnumber()
std::unique_ptr< MuonHoughPattern > MuonHoughTransformer::associateHitsToBinnumber |
( |
const MuonHoughHitContainer & |
event, |
|
|
int |
binnumber, |
|
|
double |
maximum_residu_mm, |
|
|
double |
maximum_residu_angle, |
|
|
int |
sector = 0 |
|
) |
| const |
|
inherited |
◆ associateHitsToCoords()
std::unique_ptr< MuonHoughPattern > MuonHoughTransformer::associateHitsToCoords |
( |
const MuonHoughHitContainer & |
event, |
|
|
std::pair< double, double > |
coords, |
|
|
double |
residu_mm, |
|
|
double |
residu_angle, |
|
|
int |
sector = 0 |
|
) |
| const |
|
inherited |
◆ associateHitsToMaximum()
associate hits to certain maximum number of histograms
Definition at line 63 of file MuonHoughTransformer.cxx.
65 std::unique_ptr<MuonHoughPattern> houghpattern{};
66 std::pair<double, double> coordsmaximum;
67 std::pair<int, int> maximumbin;
70 int sector = maximumbin.first;
74 if (maximumbin.second == -1){
80 ATH_MSG_VERBOSE(
" coordinates: " << coordsmaximum.first <<
" second " << coordsmaximum.second<<
" sector: "<<
sector);
◆ calculateAngle()
double MuonHoughTransformer_rz::calculateAngle |
( |
double |
hitx, |
|
|
double |
hity, |
|
|
double |
hitz, |
|
|
double |
z0 |
|
) |
| |
|
static |
◆ fill()
fill histograms with hitcontainer
Definition at line 47 of file MuonHoughTransformer.cxx.
54 for (
unsigned int hitid = 0; hitid <
m_eventsize; hitid++) {
55 std::shared_ptr<MuonHoughHit> hit =
event.getHit(hitid);
◆ fillHisto()
int MuonHoughTransformer_rz::fillHisto |
( |
double |
coord1, |
|
|
double |
coord2, |
|
|
double |
weight, |
|
|
int |
sector |
|
) |
| |
|
finaloverridevirtual |
fill histogram with certain coordinate
Implements MuonHoughTransformer.
Definition at line 56 of file MuonHoughTransformer_rz.cxx.
59 double binwidthx =
histo->getBinWidthX();
60 double binwidthy =
histo->getBinWidthY();
62 int filled_binnumber =
histo->fill(rz0, theta_in_grad,
weight);
67 double third_weight =
weight / 3.;
80 double half_weight = 0.5 *
weight;
82 if (theta_in_grad - binwidthy < 0) {
83 histo->fill(rz0 + binwidthx, theta_in_grad + binwidthy, half_weight);
86 }
else if (theta_in_grad + binwidthy > 180.) {
87 histo->fill(rz0 - binwidthx, theta_in_grad - binwidthy, half_weight);
90 histo->fill(rz0 + binwidthx, theta_in_grad + binwidthy, half_weight);
91 histo->fill(rz0 - binwidthx, theta_in_grad - binwidthy, half_weight);
93 histo->fill(rz0 - binwidthx, theta_in_grad + binwidthy, -half_weight);
94 histo->fill(rz0 + binwidthx, theta_in_grad - binwidthy, -half_weight);
97 return filled_binnumber;
◆ fillHit()
void MuonHoughTransformer_rz::fillHit |
( |
const std::shared_ptr< MuonHoughHit > & |
hit, |
|
|
double |
weight = 1. |
|
) |
| |
|
finaloverridevirtual |
◆ getEndPointsFillLoop()
std::pair< double, double > MuonHoughTransformer::getEndPointsFillLoop |
( |
double |
radius, |
|
|
double |
stepsize, |
|
|
int |
sector |
|
) |
| const |
|
protectedinherited |
◆ getMaxima()
std::vector< std::pair< int, int > > MuonHoughTransformer::getMaxima |
( |
int |
max_patterns | ) |
const |
|
inherited |
return the first certain number of maxima of histograms
Definition at line 122 of file MuonHoughTransformer.cxx.
123 std::vector<std::pair<int, int> > maximumbins;
125 std::vector<std::pair<std::pair<int, int>,
double> > maxima;
130 std::pair<std::pair<int, int>,
double> maximum;
131 maximum.first.first =
sector;
132 maximum.first.second = maximumbin.first;
133 maximum.second = maximumbin.second;
134 maxima.push_back(maximum);
137 sort(maxima.begin(), maxima.end(), maximaCompare());
139 unsigned int count_maxima = 0;
140 int number_of_patterns = 0;
141 std::set<int> sectors;
142 const unsigned int size = maxima.size();
143 while (count_maxima !=
size && number_of_patterns != max_patterns) {
144 std::pair<int, int> maximumbin = maxima[count_maxima].first;
147 int sector = maximumbin.first;
149 if (sectors.find(
sector) != sectors.end()) {
check =
false; }
152 maximumbins.push_back(maximumbin);
153 sectors.insert(maximumbin.first);
155 int sectormin =
sector - 1;
156 int sectorplus =
sector + 1;
160 sectors.insert(sectormin);
161 sectors.insert(sectorplus);
165 int sectorminmin = sectormin - 1;
166 int sectorplusplus = sectorplus + 1;
167 sectors.insert(sectorminmin);
168 sectors.insert(sectorplusplus);
172 number_of_patterns++;
◆ histos()
◆ hookAssociateHitsToMaximum()
std::unique_ptr< MuonHoughPattern > MuonHoughTransformer_rz::hookAssociateHitsToMaximum |
( |
const MuonHoughHitContainer & |
event, |
|
|
std::pair< double, double > |
coordsmaximum, |
|
|
double |
residu_mm, |
|
|
double |
residu_angle, |
|
|
int |
sector |
|
) |
| const |
|
finaloverrideprotectedvirtual |
pure virtual method for derived class implementation of associateHitsToMaximum method
Implements MuonHoughTransformer.
Definition at line 112 of file MuonHoughTransformer_rz.cxx.
116 std::unique_ptr<MuonHoughPattern> houghpattern = std::make_unique<MuonHoughPattern>(
MuonHough::hough_rz);
118 double theta{0.}, residu_distance{0.}, maximum_residu{0.};
119 double eradius{0.}, etheta{0.}, sin_theta{0.}, cos_theta{0.}, sin_phi{0.}, cos_phi{0.},
phi{0.}, ephi{0.};
121 double rz0 = coordsmaximum.first;
123 ATH_MSG_VERBOSE(
"MuonHoughTransformer_rz::hookAssociateHitsToMaximum() -- sector: " << maxsector
124 <<
"coordsmaximumfirst: " << rz0 <<
"coordsmaximumsecond: " << coordsmaximum.second
125 <<
" coordsmaximumsecondinrad: " << coordsmaximumsecondinrad
126 <<
" size of event: " <<
event.size());
128 for (
unsigned int i = 0;
i <
event.size();
i++) {
130 double hitx =
event.getHitx(
i);
131 double hity =
event.getHity(
i);
133 int maxsecmax = maxsector + 1;
134 int maxsecmin = maxsector - 1;
138 if (sectorhit == maxsector || sectorhit == maxsecmin || sectorhit == maxsecmax) {
139 double hitz =
event.getHitz(
i);
140 double radius = std::hypot(hitx, hity);
149 double radius3 = std::hypot(hitx, hity, hitz);
151 if (std::abs(rz0) < radius3) {
152 height = std::sqrt(radius3 * radius3 - rz0 * rz0);
154 height = std::sqrt(rz0 * rz0 - radius3 * radius3);
157 theta = std::atan2(
radius, hitz) + std::atan2(rz0, height);
159 <<
" std::atan2(radius,hitz): " << std::atan2(
radius, hitz)
160 <<
" +std::atan2(rz0,height): " << std::atan2(rz0, height) <<
" rz0: ");
162 double residu_distance_grad = std::abs(
std::sin(
theta - coordsmaximumsecondinrad));
163 residu_distance = residu_distance_grad;
164 maximum_residu = maximum_residu_angle;
166 residu_distance = residu_distance_mm;
167 maximum_residu = maximum_residu_mm;
170 ATH_MSG_VERBOSE(
"hitx: " << hitx <<
" hity: " << hity <<
" hitz: " << hitz
171 <<
", residu_distance: " << residu_distance);
173 if (std::abs(
theta * 180. /
M_PI - coordsmaximum.second) < 1.1) inmax =
true;
175 if (std::abs(residu_distance) < maximum_residu)
177 ATH_MSG_VERBOSE(
" hit added to houghpattern! -- sector number hit " << sectorhit <<
" max " << maxsector
178 <<
" detector: " <<
event.getHit(
i)->getWhichDetector() <<
179 (inmax ?
" MuonHoughTransformer_rz:: in maximum " :
" OUTSIDE maximum" )<<
" theta hit " <<
theta * 180. /
M_PI <<
" max Hough theta "
180 << coordsmaximum.second );
183 event.getHit(
i)->setAssociated(
true);
185 double rz0hit = residu_distance_mm + rz0;
187 ATH_MSG_VERBOSE(__FILE__<<
":"<<__LINE__<<
" calculateAngle: " <<
theta <<
" calculateradius: " << rz0hit
188 <<
" R Z hit added to hough pattern theta hit "
190 <<
" theta all " << coordsmaximumsecondinrad);
194 phi = std::atan2(hity, hitx);
205 etheta = std::atan2(sin_theta, cos_theta);
206 ephi = std::atan2(sin_phi, cos_phi);
209 eradius = eradius / (houghpattern->
size() + 0.0001);
211 ATH_MSG_VERBOSE(
"Etheta : " << etheta <<
" Size houghpattern " << houghpattern->
size() <<
" ephi "
217 if (houghpattern->
empty()) {
221 else if (std::abs(eradius - rz0) > 500. ||
std::sin(etheta - coordsmaximumsecondinrad) > 0.05) {
222 ATH_MSG_VERBOSE(
"WARNING Eradius or Etheta calc. WRONG -- rz0: " << rz0
223 <<
" etheta: " << coordsmaximumsecondinrad<<
" eradius: " << eradius <<
" etheta: " << etheta );
224 houghpattern->
setETheta(coordsmaximumsecondinrad);
◆ 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.
◆ 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.
◆ 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
-
lvl | The message level to test against |
- Returns
- boolean Indicating if messages at given level will be printed
- Return values
-
true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.h.
◆ resetHisto()
void MuonHoughTransformer::resetHisto |
( |
| ) |
|
|
inherited |
◆ sector()
int MuonHoughTransformer_rz::sector |
( |
const std::shared_ptr< MuonHoughHit > & |
hit | ) |
const |
|
inlinefinaloverridevirtual |
◆ setIP()
void MuonHoughTransformer::setIP |
( |
bool |
ip_setting | ) |
|
|
inlineinherited |
◆ setLevel()
void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ useNegativeWeights()
void MuonHoughTransformer::useNegativeWeights |
( |
bool |
use_negative_weights | ) |
|
|
inlineinherited |
◆ weightHoughTransform() [1/2]
float MuonHoughTransformer_rz::weightHoughTransform |
( |
double |
r0 | ) |
const |
|
finaloverridevirtual |
◆ weightHoughTransform() [2/2]
float MuonHoughTransformer_rz::weightHoughTransform |
( |
double |
r0, |
|
|
double |
angle |
|
) |
| const |
◆ ATLAS_THREAD_SAFE
std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_add_weight_angle
bool MuonHoughTransformer::m_add_weight_angle |
|
protectedinherited |
◆ m_add_weight_radius
bool MuonHoughTransformer::m_add_weight_radius |
|
protectedinherited |
◆ m_binwidthx
double MuonHoughTransformer::m_binwidthx |
|
protectedinherited |
◆ m_binwidthy
double MuonHoughTransformer::m_binwidthy |
|
protectedinherited |
◆ m_detectorsize
const double MuonHoughTransformer::m_detectorsize |
|
protectedinherited |
◆ m_detectorsize_angle
const double MuonHoughTransformer::m_detectorsize_angle |
|
protectedinherited |
◆ m_eventsize
unsigned int MuonHoughTransformer::m_eventsize |
|
protectedinherited |
◆ m_eventsize_weightfactor
double MuonHoughTransformer::m_eventsize_weightfactor |
|
protectedinherited |
◆ m_histos
◆ m_imsg
std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_ip_setting
bool MuonHoughTransformer::m_ip_setting |
|
protectedinherited |
◆ m_lvl
std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ 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_muonhoughmathutils
◆ m_nbins
const int MuonHoughTransformer::m_nbins |
|
protectedinherited |
◆ m_nbins_angle
const int MuonHoughTransformer::m_nbins_angle |
|
protectedinherited |
◆ m_nbins_plus3
const int MuonHoughTransformer::m_nbins_plus3 |
|
protectedinherited |
◆ m_nm
std::string AthMessaging::m_nm |
|
privateinherited |
◆ m_number_of_sectors
const int MuonHoughTransformer::m_number_of_sectors |
|
protectedinherited |
◆ m_stepsize
double MuonHoughTransformer::m_stepsize |
|
protectedinherited |
◆ m_stepsize_per_angle
double MuonHoughTransformer::m_stepsize_per_angle |
|
protectedinherited |
◆ m_threshold_histo
double MuonHoughTransformer::m_threshold_histo |
|
protectedinherited |
◆ m_use_negative_weights
bool MuonHoughTransformer::m_use_negative_weights |
|
protectedinherited |
◆ m_use_residu_grad
const bool MuonHoughTransformer_rz::m_use_residu_grad |
|
protected |
◆ m_weight_constant_angle
double MuonHoughTransformer::m_weight_constant_angle |
|
protectedinherited |
◆ m_weight_constant_radius
double MuonHoughTransformer::m_weight_constant_radius |
|
protectedinherited |
The documentation for this class was generated from the following files:
std::atomic< MSG::Level > m_lvl
Current logging level.
double getBinContent(int binnumber) const
returns x axis
void setETheta(double etheta)
set theta of pattern
MuonHoughHisto2D * getHisto(int id) const
return histogram at place id
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
Scalar phi() const
phi method
std::pair< int, double > getMax() const
returns binnumber and maximum of histogram (doesn't use m_bins_above_threshold)
double getHitz() const
returns z position
Scalar perp() const
perp method - perpenticular length
void setMaximumIsValid(bool flag)
Scalar theta() const
theta method
void setEPhi(double ephi)
set phi of pattern
int size() const
returns size of container
#define ATH_MSG_VERBOSE(x)
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
IMessageSvc * getMessageSvc(bool quiet=false)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void addHit(const std::shared_ptr< MuonHoughHit > &hit)
add hit to container
void setERTheta(double ertheta)
set z0 of pattern
void reset() const
resets histograms
void setECurvature(double curvature)
set curvature of pattern
POOL::TEvent event(POOL::TEvent::kClassAccess)
unsigned int size() const
returns size of hitcontainer
const double r0
electron radius{cm}
double getRadius() const
returns radius
std::pair< double, double > binnumberToCoords(int binnumber, int printlevel=0) const
gives coordinates for certain binnumber
MsgStream & msg() const
The standard message stream.
double getAbs() const
returns radius
double getWeight() const
returns weight in histogram after rescaling
double getXmax() const
returns max x axis
void setMaximumHistogram(double maximumhistogram)
set maximum of histogram used to generate pattern
int phiSector() const
phi sector of hit
std::pair< int, int > getMaximumBinnumber() const
return maximum of container gives first id histogram (sector) and then maximumbin
bool empty() const
returns if hitcontainer is empty
#define ATH_MSG_WARNING(x)
std::string m_nm
Message source name.
int fill(double x, double y, double weight=1.)
fill 2d histogram with point (x,y) with weight w, return binnumber filled
std::pair< double, double > getCoordsMaximum(unsigned int maximum_number=0)
returns coords of maximum number maximum_number
void initMessaging() const
Initialize our message level and MessageSvc.
double getXmin() const
returns min x axis
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
double angleFromGradToRadial(double angle) const
converts angle in degrees to rad
bool getAssociated() const
return if hit already associated to pattern
Histogram class, similar to Root's TH2D.