ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughTransformer_rz Class Reference

#include <MuonHoughTransformer_rz.h>

Inheritance diagram for MuonHoughTransformer_rz:
Collaboration diagram for MuonHoughTransformer_rz:

Public Member Functions

 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
virtual int fillHisto (double rz0, double theta, double weight, int sector) override final
 fill histogram with certain coordinate
virtual float weightHoughTransform (double r0) const override final
 weight houghtransform, give more importance to houghtransforms close to origin
float weightHoughTransform (double r0, double angle) const
int sector (const std::shared_ptr< MuonHoughHit > &hit) const override final
 returns sector for coords
virtual void fill (const MuonHoughHitContainer &event, bool subtract=false)
 fill histograms with hitcontainer
std::unique_ptr< MuonHoughPatternassociateHitsToMaximum (const MuonHoughHitContainer &event, double residu_mm, double residu_grad, int maximum_number) const
 associate hits to certain maximum number of histograms
std::unique_ptr< MuonHoughPatternassociateHitsToCoords (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
std::unique_ptr< MuonHoughPatternassociateHitsToBinnumber (const MuonHoughHitContainer &event, int binnumber, double maximum_residu_mm, double maximum_residu_angle, int sector=0) const
 associate hits to certain binnumber and sector
void resetHisto ()
 reset histograms
void useNegativeWeights (bool use_negative_weights)
 use negative weights
std::vector< std::pair< int, int > > getMaxima (int max_patterns) const
 return the first certain number of maxima of histograms
void setIP (bool ip_setting)
 set m_ip_setting (e.g.
const MuonHoughHisto2DContainerhistos () const
 access to histograms
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.

Static Public Member Functions

static double calculateAngle (double hitx, double hity, double hitz, double z0)

Protected Member Functions

std::unique_ptr< MuonHoughPatternhookAssociateHitsToMaximum (const MuonHoughHitContainer &event, std::pair< double, double > coordsmaximum, double residu_mm, double residu_grad, int sector) const override final
 pure virtual method for derived class implementation of associateHitsToMaximum method
std::pair< double, double > getEndPointsFillLoop (double radius, double stepsize, int sector) const
 returns begin and end value of the filling loop

Protected Attributes

const bool m_use_residu_grad
MuonHoughHisto2DContainer m_histos
 histogram container
double m_threshold_histo
 threshold of histograms
unsigned int m_eventsize
 size of event to be filled (can be used for weighting)
double m_eventsize_weightfactor
 weightfactor based on eventsize (used in curved hough transform)
bool m_add_weight_angle
 use weight of patterns in angle coordinate
double m_weight_constant_angle
 weight constant of patterns in angle coordinate
bool m_add_weight_radius
 use weight of patterns in radius coordinate
double m_weight_constant_radius
 weight constant of patterns in radius coordinate
bool m_use_negative_weights
 use of negative weights
MuonHoughMathUtils m_muonhoughmathutils
 object for use of mathematical formulas for trackmodels
const int m_nbins
 number of bins in histograms in radius coordinate
const int m_nbins_plus3
 number of bins in histograms in radius coordinate
const int m_nbins_angle
 number of bins in histograms in angle coordinate
const double m_detectorsize
 range of radius coordinate
const double m_detectorsize_angle
 range of angle coordinate
double m_binwidthx
 x-binwidth of histogram
double m_binwidthy
 y-binwidth of histogram
double m_stepsize
 stepsize of transform for radius coordinate
double m_stepsize_per_angle
 stepsize of transform for angle coordinate
bool m_ip_setting
 use settings for patterns originating from origin
const int m_number_of_sectors
 number of histograms (1 for cosmics 16 for rz)

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

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

Definition at line 10 of file MuonHoughTransformer_rz.h.

Constructor & Destructor Documentation

◆ MuonHoughTransformer_rz()

MuonHoughTransformer_rz::MuonHoughTransformer_rz ( int nbins,
int nbins_angle,
double detectorsize,
double detectorsize_angle,
double threshold_histo,
int number_of_sectors = 1 )

Definition at line 7 of file MuonHoughTransformer_rz.cxx.

8 :
9 MuonHoughTransformer("MuonHoughTransformer_rz", nbins, nbins_angle, detectorsize, detectorsize_angle, threshold_histo, number_of_sectors),
10 m_use_residu_grad(false) {
11 m_add_weight_radius = false;
13 m_add_weight_angle = false;
14}
bool m_add_weight_angle
use weight of patterns in angle coordinate
double m_weight_constant_radius
weight constant of patterns in radius coordinate
bool m_add_weight_radius
use weight of patterns in radius coordinate
MuonHoughTransformer(const std::string &tr_name, int nbins, int nbins_angle, double detectorsize, double detectorsize_angle, double threshold_histo, int number_of_sectors=1)
constructor, input values are those of histograms

◆ ~MuonHoughTransformer_rz()

virtual MuonHoughTransformer_rz::~MuonHoughTransformer_rz ( )
virtualdefault

Member Function Documentation

◆ 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

associate hits to certain binnumber and sector

Definition at line 96 of file MuonHoughTransformer.cxx.

97 {
98 ATH_MSG_VERBOSE("associateHitsToBinnumber() -- sector "<<sector<<",binnumber "<<binnumber<<
99 " maximum of histogram: " << m_histos.getHisto(sector)->getBinContent(binnumber));
100
101 std::pair<double, double> coordsmaximum = m_histos.getHisto(sector)->binnumberToCoords(binnumber);
102 std::unique_ptr<MuonHoughPattern> houghpattern = hookAssociateHitsToMaximum(event, coordsmaximum,
103 maximum_residu_mm, maximum_residu_angle, sector);
104 houghpattern->setMaximumHistogram(m_histos.getHisto(sector)->getBinContent(binnumber));
105 return houghpattern;
106}
#define ATH_MSG_VERBOSE(x)
MuonHoughHisto2DContainer m_histos
histogram container
virtual std::unique_ptr< MuonHoughPattern > hookAssociateHitsToMaximum(const MuonHoughHitContainer &event, std::pair< double, double > coordsmaximum, double residu_mm, double residu_angle, int sector) const =0
pure virtual method for derived class implementation of associateHitsToMaximum method
virtual int sector(const std::shared_ptr< MuonHoughHit > &hit) const =0
returns sector for coords

◆ 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

associate hits to certain coordinates and sector

Definition at line 91 of file MuonHoughTransformer.cxx.

92 {
93 return hookAssociateHitsToMaximum(event, coordsmaximum, maximum_residu_mm, maximum_residu_angle, sector);
94}

◆ associateHitsToMaximum()

std::unique_ptr< MuonHoughPattern > MuonHoughTransformer::associateHitsToMaximum ( const MuonHoughHitContainer & event,
double residu_mm,
double residu_grad,
int maximum_number ) const
inherited

associate hits to certain maximum number of histograms

Definition at line 63 of file MuonHoughTransformer.cxx.

64 {
65 std::unique_ptr<MuonHoughPattern> houghpattern{};
66 std::pair<double, double> coordsmaximum;
67 std::pair<int, int> maximumbin;
68 maximumbin = m_histos.getMaximumBinnumber();
69
70 int sector = maximumbin.first;
71
72 if (sector != -1) {
73 coordsmaximum = m_histos.getHisto(sector)->getCoordsMaximum(maximum_number);
74 if (maximumbin.second == -1){ // no maximum, no bin above threshold
75 ATH_MSG_VERBOSE("No Maximum Found");
76 return nullptr;
77 }
78 ATH_MSG_VERBOSE("maximum binnumber of histogram: " << maximumbin.second
79 << " value: " << m_histos.getHisto(sector)->getBinContent(maximumbin.second));
80 ATH_MSG_VERBOSE(" coordinates: " << coordsmaximum.first << " second " << coordsmaximum.second<<" sector: "<<sector);
81 houghpattern = hookAssociateHitsToMaximum(event, coordsmaximum, maximum_residu_mm, maximum_residu_grad, sector);
82 if (houghpattern) { houghpattern->setMaximumHistogram(m_histos.getHisto(sector)->getBinContent(maximumbin.second)); }
83 } else {
84 ATH_MSG_VERBOSE("No Maximum Found sector is -1");
85 return nullptr;
86 }
87
88 return houghpattern;
89}

◆ calculateAngle()

double MuonHoughTransformer_rz::calculateAngle ( double hitx,
double hity,
double hitz,
double z0 )
static

Definition at line 100 of file MuonHoughTransformer_rz.cxx.

100 {
101 // z0 is cartesian coordinate where track goes through z axis
102
103 // analog to xyz:
104 double theta = 0;
105 double r = std::sqrt(hitx * hitx + hity * hity);
106
107 theta = std::atan2(r, hitz - z0);
108
109 return theta;
110}
Scalar theta() const
theta method
int r
Definition globals.cxx:22

◆ fill()

void MuonHoughTransformer::fill ( const MuonHoughHitContainer & event,
bool subtract = false )
virtualinherited

fill histograms with hitcontainer

Definition at line 47 of file MuonHoughTransformer.cxx.

47 {
48 m_eventsize = event.size();
49 m_eventsize_weightfactor = 20. * std::sqrt(m_eventsize) / std::sqrt(7000.);
50 if (subtract) {
51 // invalidate maxima
52 for (int i = 0; i < m_histos.size(); ++i) m_histos.getHisto(i)->setMaximumIsValid(false);
53
54 for (unsigned int hitid = 0; hitid < m_eventsize; hitid++) {
55 std::shared_ptr<MuonHoughHit> hit = event.getHit(hitid);
56 if (hit->getAssociated()) fillHit(hit, -1. * hit->getWeight());
57 }
58 } else {
59 for (unsigned int hitid = 0; hitid < m_eventsize; hitid++) { fillHit(event.getHit(hitid), event.getHit(hitid)->getWeight()); }
60 }
61}
virtual void fillHit(const std::shared_ptr< MuonHoughHit > &hit, double weight=1.)=0
fill histograms with hit
unsigned int m_eventsize
size of event to be filled (can be used for weighting)
double m_eventsize_weightfactor
weightfactor based on eventsize (used in curved hough transform)

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

56 {
57 MuonHoughHisto2D* histo = m_histos.getHisto(sector);
58
59 double binwidthx = histo->getBinWidthX();
60 double binwidthy = histo->getBinWidthY();
61
62 int filled_binnumber = histo->fill(rz0, theta_in_grad, weight);
63 // butterfly:
64
65 // nearby sectors:
66 if (m_number_of_sectors >= 3) {
67 double third_weight = weight / 3.;
68 if (sector != 0 && sector != m_number_of_sectors - 1) {
69 m_histos.getHisto(sector + 1)->fill(rz0, theta_in_grad, third_weight);
70 m_histos.getHisto(sector - 1)->fill(rz0, theta_in_grad, third_weight);
71 } else if (sector == 0) {
72 m_histos.getHisto(sector + 1)->fill(rz0, theta_in_grad, third_weight);
73 m_histos.getHisto(m_number_of_sectors - 1)->fill(rz0, theta_in_grad, third_weight);
74 } else {
75 m_histos.getHisto(sector - 1)->fill(rz0, theta_in_grad, third_weight);
76 m_histos.getHisto(0)->fill(rz0, theta_in_grad, third_weight);
77 }
78 }
79
80 double half_weight = 0.5 * weight;
81
82 if (theta_in_grad - binwidthy < 0) {
83 histo->fill(rz0 + binwidthx, theta_in_grad + binwidthy, half_weight);
84 if (m_use_negative_weights) { histo->fill(rz0 - binwidthx, theta_in_grad + binwidthy, -half_weight); }
85
86 } else if (theta_in_grad + binwidthy > 180.) {
87 histo->fill(rz0 - binwidthx, theta_in_grad - binwidthy, half_weight);
88 if (m_use_negative_weights) { histo->fill(rz0 + binwidthx, theta_in_grad - binwidthy, -half_weight); }
89 } else {
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);
95 }
96 }
97 return filled_binnumber;
98}
int sector(const std::shared_ptr< MuonHoughHit > &hit) const override final
returns sector for coords
bool m_use_negative_weights
use of negative weights
const int m_number_of_sectors
number of histograms (1 for cosmics 16 for rz)

◆ fillHit()

void MuonHoughTransformer_rz::fillHit ( const std::shared_ptr< MuonHoughHit > & hit,
double weight = 1. )
finaloverridevirtual

fill histograms with hit

Implements MuonHoughTransformer.

Definition at line 16 of file MuonHoughTransformer_rz.cxx.

16 {
17 const double hitz = hit->getHitz();
18
19 if (m_ip_setting) // niels and peter alg, butterfly to be added, and to be looked into the method
20 {
21 const int sectorhit = sector(hit);
22 const double perp = hit->getRadius();
23 const double radius = hit->getAbs();
24
25 double dotprod = 0;
26 MuonHoughHisto2D* histo = m_histos.getHisto(sectorhit);
27 for (double rz0 = histo->getXmin() + m_stepsize / 2.; rz0 < histo->getXmax(); rz0 += m_stepsize) {
28 if (std::abs(rz0) > radius) continue;
29
30 double height = std::sqrt(radius * radius - rz0 * rz0);
31 double theta = std::atan2(perp, hitz) + std::atan2(rz0, height);
32 double theta_in_grad = (theta / M_PI) * 180.;
33
34 dotprod = perp * std::sin(theta) + hitz * std::cos(theta);
35
36 if (theta_in_grad > 180.) continue; // to keep the angle physical
37 if (theta_in_grad < 0.) continue; // idem
38
39 if (dotprod >= 0) { fillHisto(rz0, theta_in_grad, weight, sectorhit); }
40 }
41 } else {
42 int sectorhit = 0;
43 const double radius = hit->getRadius();
44
46 double theta_in_rad = M_PI * theta / 180.;
47 double rz0 = hitz * std::sin(theta_in_rad) - radius * std::cos(theta_in_rad);
48 double dotprod = 0;
49
50 dotprod = radius * std::sin(theta_in_rad) + hitz * std::cos(theta_in_rad);
51 if (dotprod >= 0) { fillHisto(rz0, theta, weight, sectorhit); } // dotprod
52 }
53 } // m_atlas_setting
54}
#define M_PI
Scalar perp() const
perp method - perpendicular length
double getRadius() const
returns radius
double getHitz() const
returns z position
double getAbs() const
returns radius
virtual int fillHisto(double rz0, double theta, double weight, int sector) override final
fill histogram with certain coordinate
const double m_detectorsize_angle
range of angle coordinate
bool m_ip_setting
use settings for patterns originating from origin
double m_stepsize_per_angle
stepsize of transform for angle coordinate
double m_stepsize
stepsize of transform for radius coordinate

◆ getEndPointsFillLoop()

std::pair< double, double > MuonHoughTransformer::getEndPointsFillLoop ( double radius,
double stepsize,
int sector ) const
protectedinherited

returns begin and end value of the filling loop

Definition at line 108 of file MuonHoughTransformer.cxx.

108 {
109 std::pair<double, double> endpoints(-radius + 0.00001, radius); // why +0.00001?
110
111 if (-radius < m_histos.getHisto(sector)->getXmin()) // randomizer to avoid binning effects
112 {
113 endpoints.first = m_histos.getHisto(sector)->getXmin() + 0.5 * stepsize; // no randomizer! no radius constraint
114 }
115
116 if (radius > m_histos.getHisto(sector)->getXmax()) { endpoints.second = m_histos.getHisto(sector)->getXmax(); }
117 return endpoints;
118}

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

122 {
123 std::vector<std::pair<int, int> > maximumbins; // sorted
124
125 std::vector<std::pair<std::pair<int, int>, double> > maxima;
126
127 for (int sector = 0; sector < m_number_of_sectors; sector++) // to be made more general when m_number_of_sectors ==1 e.g.
128 {
129 std::pair<int, double> maximumbin = m_histos.getHisto(sector)->getMax();
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);
135 }
136
137 sort(maxima.begin(), maxima.end(), maximaCompare());
138
139 unsigned int count_maxima = 0; // should be iterator
140 int number_of_patterns = 0;
141 std::set<int> sectors; // sectors that are already used
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;
145
146 bool check = true; // check if sector is not nearby a sector already chosen
147 int sector = maximumbin.first;
148
149 if (sectors.find(sector) != sectors.end()) { check = false; }
150
151 if (check) {
152 maximumbins.push_back(maximumbin);
153 sectors.insert(maximumbin.first);
154
155 int sectormin = sector - 1;
156 int sectorplus = sector + 1;
157 if (sectormin < 0) { sectormin = m_number_of_sectors; }
158 if (sectorplus > m_number_of_sectors) { sectorplus = 0; }
159
160 sectors.insert(sectormin);
161 sectors.insert(sectorplus);
162
163 if (m_number_of_sectors > 20 && maximumbin.first % 2 == 1) // hack for new single and overlap filling curved transform!
164 {
165 int sectorminmin = sectormin - 1;
166 int sectorplusplus = sectorplus + 1;
167 sectors.insert(sectorminmin);
168 sectors.insert(sectorplusplus);
169 }
170
171 count_maxima++;
172 number_of_patterns++;
173 } else {
174 count_maxima++;
175 }
176 }
177
178 return maximumbins;
179}
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ histos()

const MuonHoughHisto2DContainer & MuonHoughTransformer::histos ( ) const
inlineinherited

access to histograms

Definition at line 60 of file MuonHoughTransformer.h.

60{ return m_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.

114 {
115
116 std::unique_ptr<MuonHoughPattern> houghpattern = std::make_unique<MuonHoughPattern>(MuonHough::hough_rz);
117
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.};
120 double coordsmaximumsecondinrad = m_muonhoughmathutils.angleFromGradToRadial(coordsmaximum.second);
121 double rz0 = coordsmaximum.first;
122
123 ATH_MSG_VERBOSE("MuonHoughTransformer_rz::hookAssociateHitsToMaximum() -- sector: " << maxsector
124 << "coordsmaximumfirst: " << rz0 << "coordsmaximumsecond: " << coordsmaximum.second
125 << " coordsmaximumsecondinrad: " << coordsmaximumsecondinrad
126 <<" size of event: " << event.size());
127
128 for (unsigned int i = 0; i < event.size(); i++) {
129 double dotprod = 0;
130 double hitx = event.getHitx(i);
131 double hity = event.getHity(i);
132 int sectorhit = sector(event.getHit(i));
133 int maxsecmax = maxsector + 1;
134 int maxsecmin = maxsector - 1;
135 if (maxsecmin < 0) maxsecmin = m_number_of_sectors - 1;
136 if (maxsecmax > m_number_of_sectors - 1) maxsecmax = 0;
137 // select which hits could be in maximum:
138 if (sectorhit == maxsector || sectorhit == maxsecmin || sectorhit == maxsecmax) {
139 double hitz = event.getHitz(i);
140 double radius = std::hypot(hitx, hity);
141
142 dotprod = radius * std::sin(coordsmaximumsecondinrad) + hitz * std::cos(coordsmaximumsecondinrad);
143
144 if (dotprod >= 0) {
145 double residu_distance_mm = MuonHoughMathUtils::signedDistanceToLine(hitz, radius, rz0, coordsmaximumsecondinrad);
146
147 // Use this code for rz scan and theta
148 //
149 double radius3 = std::hypot(hitx, hity, hitz);
150 double height{0.};
151 if (std::abs(rz0) < radius3) {
152 height = std::sqrt(radius3 * radius3 - rz0 * rz0);
153 } else {
154 height = std::sqrt(rz0 * rz0 - radius3 * radius3);
155 }
156
157 theta = std::atan2(radius, hitz) + std::atan2(rz0, height);
158 ATH_MSG_VERBOSE("theta: " << theta << " height: " << height << " radius3: " << radius3
159 << " std::atan2(radius,hitz): " << std::atan2(radius, hitz)
160 << " +std::atan2(rz0,height): " << std::atan2(rz0, height) << " rz0: ");
161 if (m_use_residu_grad == 1) {
162 double residu_distance_grad = std::abs(std::sin(theta - coordsmaximumsecondinrad));
163 residu_distance = residu_distance_grad;
164 maximum_residu = maximum_residu_angle;
165 } else {
166 residu_distance = residu_distance_mm;
167 maximum_residu = maximum_residu_mm;
168 }
169
170 ATH_MSG_VERBOSE("hitx: " << hitx << " hity: " << hity << " hitz: " << hitz
171 << ", residu_distance: " << residu_distance);
172 bool inmax = false;
173 if (std::abs(theta * 180. / M_PI - coordsmaximum.second) < 1.1) inmax = true;
174
175 if (std::abs(residu_distance) < maximum_residu) // here no circular effect
176 {
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 );
181 houghpattern->addHit(event.getHit(i));
182
183 event.getHit(i)->setAssociated(true);
184
185 double rz0hit = residu_distance_mm + rz0;
186 eradius += rz0hit;
187 ATH_MSG_VERBOSE(__FILE__<<":"<<__LINE__<<" calculateAngle: " << theta << " calculateradius: " << rz0hit
188 << " R Z hit added to hough pattern theta hit "
189 << atan2(std::hypot(event.getHitx(i) ,event.getHity(i)), event.getHitz(i))
190 << " theta all " << coordsmaximumsecondinrad);
191 sin_theta += std::sin(theta);
192 cos_theta += std::cos(theta);
193
194 phi = std::atan2(hity, hitx);
195
196 sin_phi += std::sin(phi);
197 cos_phi += std::cos(phi);
198 //}
199 } else if (inmax)
200 ATH_MSG_WARNING("LOST hit in maximum distance " );
201 } // dotprod
202 } // sector constraint
203 } // hitno
204
205 etheta = std::atan2(sin_theta, cos_theta);
206 ephi = std::atan2(sin_phi, cos_phi);
207 houghpattern->setEPhi(ephi);
208
209 eradius = eradius / (houghpattern->size() + 0.0001);
210
211 ATH_MSG_VERBOSE("Etheta : " << etheta << " Size houghpattern " << houghpattern->size() << " ephi "
212 << ephi );
213 houghpattern->setETheta(etheta);
214 houghpattern->setERTheta(eradius);
215 houghpattern->setECurvature(1.);
216
217 if (houghpattern->empty()) {
218 ATH_MSG_VERBOSE("no hits found on pattern");
219 }
220
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); // coordsmaximumsecondinrad
225 houghpattern->setERTheta(rz0);
226 }
227
228 return houghpattern;
229}
Scalar phi() const
phi method
#define ATH_MSG_WARNING(x)
static double signedDistanceToLine(double x0, double y0, double r0, double phi)
distance from (x0,y0) to the line (r0,phi), phi in rad
MuonHoughMathUtils m_muonhoughmathutils
object for use of mathematical formulas for trackmodels

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

◆ resetHisto()

void MuonHoughTransformer::resetHisto ( )
inherited

reset histograms

Definition at line 120 of file MuonHoughTransformer.cxx.

120{ m_histos.reset(); }

◆ sector()

int MuonHoughTransformer_rz::sector ( const std::shared_ptr< MuonHoughHit > & hit) const
inlinefinaloverridevirtual

returns sector for coords

Implements MuonHoughTransformer.

Definition at line 33 of file MuonHoughTransformer_rz.h.

33{ return hit->phiSector(); }
int phiSector() const
phi sector of hit

◆ setIP()

void MuonHoughTransformer::setIP ( bool ip_setting)
inlineinherited

set m_ip_setting (e.g.

to not split patterns)

Definition at line 140 of file MuonHoughTransformer.h.

140{ m_ip_setting = ip_setting; }

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

◆ useNegativeWeights()

void MuonHoughTransformer::useNegativeWeights ( bool use_negative_weights)
inlineinherited

use negative weights

Definition at line 141 of file MuonHoughTransformer.h.

141{ m_use_negative_weights = use_negative_weights; }

◆ weightHoughTransform() [1/2]

float MuonHoughTransformer_rz::weightHoughTransform ( double r0) const
finaloverridevirtual

weight houghtransform, give more importance to houghtransforms close to origin

Implements MuonHoughTransformer.

Definition at line 231 of file MuonHoughTransformer_rz.cxx.

231 {
233 return 1. / (std::abs(r0 / (m_weight_constant_radius + 1.)));
234 } else {
235 return 1;
236 } // weight function, to give more importance to patterns close to origin
237}

◆ weightHoughTransform() [2/2]

float MuonHoughTransformer_rz::weightHoughTransform ( double r0,
double angle ) const

Definition at line 239 of file MuonHoughTransformer_rz.cxx.

240{
241 if (!m_add_weight_angle) {
242 return weightHoughTransform(r0);
243 } else {
245 double theta_rad = m_muonhoughmathutils.angleFromGradToRadial(theta);
246
247 float r_theta_weight = std::abs(std::sin(theta_rad)) / (1. + std::abs((r0 / 6000.)));
248
249 return r_theta_weight;
250 }
251
252 else {
253 return 1;
254 } // weight function, to give more importance to patterns close to origin
255 }
256}
virtual float weightHoughTransform(double r0) const override final
weight houghtransform, give more importance to houghtransforms close to origin

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_add_weight_angle

bool MuonHoughTransformer::m_add_weight_angle
protectedinherited

use weight of patterns in angle coordinate

Definition at line 90 of file MuonHoughTransformer.h.

◆ m_add_weight_radius

bool MuonHoughTransformer::m_add_weight_radius
protectedinherited

use weight of patterns in radius coordinate

Definition at line 94 of file MuonHoughTransformer.h.

◆ m_binwidthx

double MuonHoughTransformer::m_binwidthx
protectedinherited

x-binwidth of histogram

Definition at line 115 of file MuonHoughTransformer.h.

◆ m_binwidthy

double MuonHoughTransformer::m_binwidthy
protectedinherited

y-binwidth of histogram

Definition at line 117 of file MuonHoughTransformer.h.

◆ m_detectorsize

const double MuonHoughTransformer::m_detectorsize
protectedinherited

range of radius coordinate

Definition at line 111 of file MuonHoughTransformer.h.

◆ m_detectorsize_angle

const double MuonHoughTransformer::m_detectorsize_angle
protectedinherited

range of angle coordinate

Definition at line 113 of file MuonHoughTransformer.h.

◆ m_eventsize

unsigned int MuonHoughTransformer::m_eventsize
protectedinherited

size of event to be filled (can be used for weighting)

Definition at line 85 of file MuonHoughTransformer.h.

◆ m_eventsize_weightfactor

double MuonHoughTransformer::m_eventsize_weightfactor
protectedinherited

weightfactor based on eventsize (used in curved hough transform)

Definition at line 87 of file MuonHoughTransformer.h.

◆ m_histos

MuonHoughHisto2DContainer MuonHoughTransformer::m_histos
protectedinherited

histogram container

Definition at line 79 of file MuonHoughTransformer.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_ip_setting

bool MuonHoughTransformer::m_ip_setting
protectedinherited

use settings for patterns originating from origin

Definition at line 125 of file MuonHoughTransformer.h.

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

MuonHoughMathUtils MuonHoughTransformer::m_muonhoughmathutils
protectedinherited

object for use of mathematical formulas for trackmodels

Definition at line 102 of file MuonHoughTransformer.h.

◆ m_nbins

const int MuonHoughTransformer::m_nbins
protectedinherited

number of bins in histograms in radius coordinate

Definition at line 105 of file MuonHoughTransformer.h.

◆ m_nbins_angle

const int MuonHoughTransformer::m_nbins_angle
protectedinherited

number of bins in histograms in angle coordinate

Definition at line 109 of file MuonHoughTransformer.h.

◆ m_nbins_plus3

const int MuonHoughTransformer::m_nbins_plus3
protectedinherited

number of bins in histograms in radius coordinate

Definition at line 107 of file MuonHoughTransformer.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_number_of_sectors

const int MuonHoughTransformer::m_number_of_sectors
protectedinherited

number of histograms (1 for cosmics 16 for rz)

Definition at line 128 of file MuonHoughTransformer.h.

◆ m_stepsize

double MuonHoughTransformer::m_stepsize
protectedinherited

stepsize of transform for radius coordinate

Definition at line 120 of file MuonHoughTransformer.h.

◆ m_stepsize_per_angle

double MuonHoughTransformer::m_stepsize_per_angle
protectedinherited

stepsize of transform for angle coordinate

Definition at line 122 of file MuonHoughTransformer.h.

◆ m_threshold_histo

double MuonHoughTransformer::m_threshold_histo
protectedinherited

threshold of histograms

Definition at line 82 of file MuonHoughTransformer.h.

◆ m_use_negative_weights

bool MuonHoughTransformer::m_use_negative_weights
protectedinherited

use of negative weights

Definition at line 99 of file MuonHoughTransformer.h.

◆ m_use_residu_grad

const bool MuonHoughTransformer_rz::m_use_residu_grad
protected

Definition at line 30 of file MuonHoughTransformer_rz.h.

◆ m_weight_constant_angle

double MuonHoughTransformer::m_weight_constant_angle
protectedinherited

weight constant of patterns in angle coordinate

Definition at line 92 of file MuonHoughTransformer.h.

◆ m_weight_constant_radius

double MuonHoughTransformer::m_weight_constant_radius
protectedinherited

weight constant of patterns in radius coordinate

Definition at line 96 of file MuonHoughTransformer.h.


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