ATLAS Offline Software
Loading...
Searching...
No Matches
MuonHoughHit.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8#include "GaudiKernel/MsgStream.h"
12#include "TrkSurfaces/Surface.h"
13
15 const Trk::TrkDetElementBase* element = prd->detectorElement();
16 const Identifier identifier = prd->identify();
17
18 m_pos = element->surface(identifier).Trk::Surface::localToGlobal(prd->localPosition());
19
20 m_radius = m_pos.perp();
21 m_abs = m_pos.mag();
22 m_theta = std::atan2(m_radius, getHitz());
23 m_phi = m_pos.phi();
24 m_barrel = (std::abs(m_radius / getHitz()) < MuonHough::tan_barrel) ? 0 : 1;
25
28 m_prd = prd;
29}
30
31MuonHoughHit::MuonHoughHit(const Amg::Vector3D& pos_vec, bool measures_phi, MuonHough::DetectorTechnology detector_id, double prob,
32 double weight, const Trk::PrepRawData* prd, int id) :
33 m_prd(prd),
34 m_pos(pos_vec),
35 m_id(id),
37 m_abs(m_pos.mag()),
38 m_phi(m_pos.phi()),
39 m_theta(std::atan2(m_radius, getHitz())),
40 m_barrel ((std::abs(m_radius / getHitz()) < MuonHough::tan_barrel) ? 0 : 1),
43 m_weight(weight),
44 m_orig_weight(weight),
45 m_probability(prob),
46 m_detector_id(detector_id),
47 m_measures_phi(measures_phi)
48{
49}
50
51std::string MuonHoughHit::getWhichDetector() const {
52 std::string detector_name;
53 switch (m_detector_id) {
54 case MuonHough::MDT: detector_name = "MDT"; break;
55 case MuonHough::CSC: detector_name = "CSC"; break;
56 case MuonHough::RPC: detector_name = "RPC"; break;
57 case MuonHough::TGC: detector_name = "TGC"; break;
58 default:
59 MsgStream log(Athena::getMessageSvc(), "MuonHoughHit::getWhichDetector");
60 if (log.level() <= MSG::WARNING) log << MSG::WARNING << "MuonHoughHit:: no valid detector_id" << endmsg;
61 }
62 return detector_name;
63}
64
66 double phi = m_phi; // [-Pi , Pi]
68
69 if (phi < 0) phi += MuonHough::two_Pi; // [ 0 , 2*Pi ]
70 int sectorhit = static_cast<int>(phi / (2 * MuonHough::half_phisector)); // 0..15
71 if (sectorhit == MuonHough::phisectors) sectorhit += -1; // could happen in rare cases
72 return sectorhit;
73}
74
76 // for formulas see muonhoughmathutils, only here for cpu improvements
77 double magnetic_trk_ratio = 0.;
78
79 if (m_barrel) {
80 // Barrel hypothesis
81
83 double diff_b = m_radius - MuonHough::radius_cylinder;
84 magnetic_trk_ratio = diff_b * diff_b / m_abs;
85 }
86 } else {
87 int sign = 1;
88 if (getHitz() < 0) sign = -1;
89 // Endcap hypothesis
90 if (std::abs(getHitz()) < MuonHough::z_cylinder) {
91 magnetic_trk_ratio = 0.;
92 } else if (std::abs(getHitz()) < MuonHough::z_end) {
93 // Inside Toroid
94 double diff_e = getHitz() - sign * MuonHough::z_cylinder;
95 magnetic_trk_ratio = diff_e * diff_e / m_abs;
96
97 } else {
98 // Outside Toroid
100 }
101 }
102
103 return magnetic_trk_ratio;
104}
Scalar perp() const
perp method - perpendicular length
Scalar phi() const
phi method
Scalar mag() const
mag method
#define endmsg
int sign(int a)
Amg::Vector3D m_pos
double m_abs
absolute value of hit
double m_radius
radius of hit
const Trk::PrepRawData * m_prd
Pointer to preprawdata.
int calcPhiSector() const
method that calculates phi sector of hit
MuonHoughHit(const Trk::PrepRawData *prd)
default constructor (should not be used)
const double m_orig_weight
original weight
MuonHough::DetectorTechnology m_detector_id
detector technology of hit
int m_id
unique id
double getHitz() const
returns z position
double m_phi
phi of hit
std::string getWhichDetector() const
return DetectorTechnology in string
double m_probability
probability that hit belongs to true muon (based on trigger confirmation and crude segment finding (u...
double m_magnetic_trackratio
ratio of the tracklength of the particle to which hit might belong would have traversed in magnetic f...
int m_phi_sector
phi sector (0,15), Atlas Convention
bool m_barrel
hit is barrel / endcap
double m_theta
theta of hit
double m_weight
weight of hit in histogram, after rescaling
bool m_measures_phi
hit measures phi?
double calcMagneticTrackRatio() const
method that calculates 'magnetic track ratio' (for curved track model)
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
This is the base class for all tracking detector elements with read-out relevant information.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
singleton-like access to IMessageSvc via open function and helper
Eigen::Matrix< double, 3, 1 > Vector3D
IMessageSvc * getMessageSvc(bool quiet=false)
constexpr double tan_barrel
relation for transition between endcap and barrel 11.43 m (r) / 14m (z)
constexpr double radius_cylinder
radius of cylinder
constexpr int phisectors
number of phi sectors
constexpr double two_Pi
constexpr double half_phisector
angle of half a sector in rad
constexpr double z_cylinder
length of cylinder
constexpr double z_magnetic_range_squared
range where hit is curved in endcap region ('squared')
constexpr double z_end
z value whereafter no magnetic field / curvature
DetectorTechnology
enum to identify the muondetectortechnology
constexpr double z_magnetic_range
range where hit is curved in endcap region
STL namespace.