9 double threshold_histo,
int number_of_sectors) :
10 MuonHoughTransformer(
"MuonHoughTransformer_xyz",
nbins, nbins_angle, detectorsize, detectorsize_angle, threshold_histo, number_of_sectors) {
19 int sectorhit =
sector(hit);
27 dotprod = scphi.
apply(hity, hitx);
40 double r0 = scphi.
apply(hitx, -hity);
53 bool butterfly =
true;
57 double third_weight =
weight / 3.;
69 double half_weight = 0.5 *
weight;
71 histo->fill(filled_binnumber - 1, half_weight);
72 histo->fill(filled_binnumber + 1, half_weight);
79 histo->fill(upperright, half_weight);
82 histo->fill(upperright - 2, -half_weight);
85 histo->fill(lowerleft, half_weight);
88 histo->fill(lowerleft + 2, -half_weight);
92 histo->fill(lowerleft, half_weight);
93 histo->fill(upperright, half_weight);
95 histo->fill(lowerleft + 2, -half_weight);
96 histo->fill(upperright - 2, -half_weight);
100 return filled_binnumber;
105 double height_squared = hitx * hitx + hity * hity -
r0 *
r0;
106 if (height_squared >= 0) {
107 double height = std::sqrt(height_squared);
108 phi = std::atan2(hity, hitx) + std::atan2(
r0, height);
112 phi = std::atan2(hity, hitx);
122 std::pair<double, double> coordsmaximum,
double max_residu_mm,
123 double ,
int max_sector)
const {
125 ATH_MSG_DEBUG(
"MuonHoughTransformer_xyz::hookAssociateHitsToMaximum (start)");
128 double ephi{0.}, eradius{0.}, sin_phi{0.}, cos_phi{0.};
129 double dotprod{0.}, etheta{0.}, residu_distance{0.};
132 ATH_MSG_DEBUG(
"MuonHoughTransformer_xyz::found_maximum: r: " << coordsmaximum.first <<
" phi: " << coordsmaximum.second
133 <<
" sector: " << max_sector);
140 int max_secmax = max_sector + 1;
141 int max_secmin = max_sector - 1;
142 if (max_secmin < 0) max_secmin = max_sector;
145 for (
unsigned int i = 0;
i <
event.size();
i++) {
146 double hitx =
event.getHitx(
i);
147 double hity =
event.getHity(
i);
148 double hitz =
event.getHitz(
i);
150 double radiushit = std::sqrt(hitx * hitx + hity * hity);
153 if (sectorhit == max_sector || sectorhit == max_secmin || sectorhit == max_secmax) {
161 residu_distance = -coordsmaximum.first +
166 << sectorhit<<
",residu_distance: " << residu_distance);
168 if (std::abs(residu_distance) < max_residu_mm) {
169 houghpattern->addHit(
event.getHit(
i));
171 ATH_MSG_VERBOSE(
"MuonHoughTransformer_xyz::hit added to houghpattern!");
174 event.getHit(
i)->setAssociated(
true);
178 double thetah = std::atan2(radiushit, hitz);
180 <<
" phi_calc: " <<
phi <<
" phi all " << phimax <<
" theta hit " << thetah );
197 eradius = eradius / (houghpattern->size() + 0.0001);
198 etheta = etheta / (houghpattern->size() + 0.0001);
199 ephi = std::atan2(sin_phi, cos_phi);
201 ATH_MSG_VERBOSE(
"ephi: " << ephi <<
" eradius: " << eradius <<
" etheta " << etheta);
204 houghpattern->setEPhi(ephi);
206 houghpattern->setEPhi(phimax);
209 houghpattern->setERPhi(coordsmaximum.first);
210 houghpattern->setETheta(etheta);
212 if (!houghpattern->empty() && std::abs(
std::sin(houghpattern->getEPhi() - phimax)) > 0.05) {
213 ATH_MSG_WARNING(
"MuonHoughTransformer_xyz:: Ephi calculation went wrong -- histo radius: "
214 << coordsmaximum.first <<
" phi: " << phimax <<
", ephi: " << ephi);
216 houghpattern->setERPhi(coordsmaximum.first);
220 houghpattern->updateParametersRPhi(
true);
222 ATH_MSG_VERBOSE(
"updateParameterstheta new phi (phi flipped Pi for cosmics): " << houghpattern->getEPhi()
223 <<
" old phi: " << phimax <<
" new r0: " << houghpattern->getERPhi()
224 <<
" old r0: " << coordsmaximum.first);