ATLAS Offline Software
MuFastTrackExtrapolator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
10 
11 // --------------------------------------------------------------------------------
12 // --------------------------------------------------------------------------------
13 
15  const std::string& name,
16  const IInterface* parent):
18 {
19 }
20 
21 // --------------------------------------------------------------------------------
22 // --------------------------------------------------------------------------------
23 
24 StatusCode TrigL2MuonSA::MuFastTrackExtrapolator::extrapolateTrack(std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns,
25  double winPt) const
26 {
27  ATH_MSG_DEBUG("in extrapolateTrack");
28 
29  StatusCode sc = StatusCode::SUCCESS;
30 
31  for (TrigL2MuonSA::TrackPattern& track : v_trackPatterns) {
32 
33  const int inner = (track.s_address==-1)? xAOD::L2MuonParameters::Chamber::EndcapInner:
35 
37  muonSA->makePrivateStore();
38  muonSA->setSAddress(track.s_address);
39  muonSA->setPt(track.pt*track.charge);
40  muonSA->setEtaMS(track.etaMap);
41  muonSA->setPhiMS(track.phiMS);
42  muonSA->setRMS(track.superPoints[inner].R);
43  muonSA->setZMS(track.superPoints[inner].Z);
44 
45  double etaVtx = 0.;
46  double phiVtx = 0.;
47  double sigEta = 0.;
48  double sigPhi = 0.;
49 
50  const double eptinv = getMuFastRes(track.pt*track.charge, track.s_address, track.etaMap, track.phiMS);
51 
52  if (m_backExtrapolatorTool) {
53 
54  sc = (*m_backExtrapolatorTool)->give_eta_phi_at_vertex(muonSA, etaVtx, sigEta, phiVtx, sigPhi, winPt);
55 
56  if (sc.isFailure()) {
57  ATH_MSG_DEBUG ("BackExtrapolator problem: "
58  << "Pt of Muon Feature out of BackExtrapolator range.");
59  ATH_MSG_DEBUG ("Use Muon Feature position to fill the "
60  << "TrigRoiDescriptor for IDSCAN.");
61  etaVtx = track.etaMap;
62  phiVtx = track.phiMS;
63  }
64 
65  } else {
66 
67  ATH_MSG_ERROR("Null pointer to ITrigMuonBackExtrapolator");
68  return StatusCode::FAILURE;
69 
70  }
71 
72  track.deltaPt = (eptinv!=0.)? eptinv * track.pt * track.pt: 1.0e10;
73  track.etaVtx = etaVtx;
74  track.phiVtx = phiVtx;
75  track.deltaEtaVtx = sigEta;
76  track.deltaPhiVtx = sigPhi;
77 
78  if (muonSA) delete muonSA;
79  }
80  return sc;
81 }
82 
83 // --------------------------------------------------------------------------------
84 // --------------------------------------------------------------------------------
85 
86 // Calculation of error on pT from L2 Muon SA
87 // Original author: Stefano Giagu
88 // Copied from TrigmuComb/muCombUtil.cxx
90  const double eta, const double phi) const
91 {
92 
93  if (pt == 0) return 1.0e30;
94 
95  double AbsPtInv = std::abs(1./pt);
96  double AbsEta = std::abs(eta);
97 
98  if ( add != -1) { // Barrel
99  const int N_PARAMS = 3;
100  // relative resolution terms; vparBR[0]=constant, vparBR[1]=proportional to AbsPt, vparBR[2]=proportional to AbsPtInv
101  const double vparBR1[N_PARAMS] = {0.0495619, 0.00180415, 0.307058}; // for AbsEta < 0.534
102  const double vparBR2[N_PARAMS] = {1., 0., 0.}; // for 0.534 < AbsEta < 0.687
103  const double vparBR3[N_PARAMS] = {0.0370408, 0.00142206, -0.492544}; // for 0.687 < AbsEta < 1.05
104  const double* vpar;
105 
106  if ( AbsEta < 0.534) { vpar = vparBR1; }
107  else if( AbsEta < 0.687) { vpar = vparBR2; }
108  else { vpar = vparBR3; }
109 
110  double fracRes = sqrt(pow(vpar[0],2) + pow(vpar[1]/AbsPtInv,2) + pow(vpar[2]*AbsPtInv,2));
111  return std::abs(fracRes * AbsPtInv);
112  }
113  else {//Takuya/Kunihiro updated numbers
114 
115  const int N_PARAMS = 5;
116  const double vparEC1[N_PARAMS] = {0.291483, -6.11348, 65.1099, -285.664, 440.041};
117  const double vparEC2[N_PARAMS] = {0.286307, -4.6759, 43.2815, -163.185, 210.786};
118  const double vparEC3[N_PARAMS] = {0.330699, -6.70755, 70.4725, -291.85, 408.739};
119  const double vparEC4[N_PARAMS] = {0.261738, -4.69971, 47.4762, -183.98, 236.813};
120  const double vparEC5[N_PARAMS] = {0.196301, -3.57276, 38.3744, -159.808, 228.256};
121  const double vparEC6[N_PARAMS] = {0.172939, -3.10788, 33.3823, -142.996, 212.957};
122  const double vparEC7[N_PARAMS] = {0.233017, -4.377, 42.5691, -171.752, 245.702};
123  const double vparEC8[N_PARAMS] = {0.22389, -4.16259, 40.1369, -162.824, 236.39};
124  const double vparEC9[N_PARAMS] = {0.197992, -3.52117, 33.5997, -136.014, 197.474};
125  const double vparECA[N_PARAMS] = {0.417289, -0.852254,-31.9257, 308.873, -719.591};
126  const double vparECB[N_PARAMS] = {0.526612, -8.04087, 82.1906, -336.87, 462.973};
127 
128  const double AbsPtInvMin = 5e-3; // 200 GeV
129  const double AbsPtInvMax = 0.25; // 4 GeV
130  if( AbsPtInv < AbsPtInvMin ) AbsPtInv = AbsPtInvMin;
131  if( AbsPtInv > AbsPtInvMax ) AbsPtInv = AbsPtInvMax;
132 
133  const double* vpar;
135  if ( reg == xAOD::L2MuonParameters::ECRegions::WeakBFieldA ) { vpar = vparECA; }
136  else if( reg == xAOD::L2MuonParameters::ECRegions::WeakBFieldB ) { vpar = vparECB; }
137  else {
138  if ( AbsEta < 1.20) { vpar = vparEC1; }
139  else if( AbsEta < 1.35) { vpar = vparEC2; }
140  else if( AbsEta < 1.50) { vpar = vparEC3; }
141  else if( AbsEta < 1.65) { vpar = vparEC4; }
142  else if( AbsEta < 1.80) { vpar = vparEC5; }
143  else if( AbsEta < 1.95) { vpar = vparEC6; }
144  else if( AbsEta < 2.10) { vpar = vparEC7; }
145  else if( AbsEta < 2.35) { vpar = vparEC8; }
146  else { vpar = vparEC9; }
147  }
148 
149  double fracRes = vpar[0] + vpar[1]*AbsPtInv
150  + vpar[2]*AbsPtInv*AbsPtInv
151  + vpar[3]*AbsPtInv*AbsPtInv*AbsPtInv
152  + vpar[4]*AbsPtInv*AbsPtInv*AbsPtInv*AbsPtInv;
153 
154  return std::abs(fracRes * AbsPtInv);
155  }
156 }
157 
158 // --------------------------------------------------------------------------------
159 // --------------------------------------------------------------------------------
xAOD::L2MuonParameters::ECRegions
ECRegions
Definition: TrigMuonDefs.h:36
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AthMsgStreamMacros.h
xAOD::L2StandAloneMuon_v2
Class describing standalone muons reconstructed in the LVL2 trigger.
Definition: L2StandAloneMuon_v2.h:36
test_pyathena.pt
pt
Definition: test_pyathena.py:11
xAOD::L2StandAloneMuon_v2::setPt
void setPt(float pt)
Set the transverse momentum ( ) of the muon.
xAOD::L2MuonParameters::BarrelInner
@ BarrelInner
Inner station in the barrel spectrometer.
Definition: TrigMuonDefs.h:16
xAOD::L2StandAloneMuon_v2::setPhiMS
void setPhiMS(float value)
Set the phi at muon spectrometer.
xAOD::L2StandAloneMuon_v2::setEtaMS
void setEtaMS(float value)
Set the eta at muon spectrometer.
xAOD::L2StandAloneMuon_v2::setRMS
void setRMS(float value)
Set the R at muon spectrometer.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TrigL2MuonSA::TrackPattern
Definition: TrackData.h:16
muCombUtil::getMuFastRes
double getMuFastRes(const std::vector< double > &vec, const MuonFeature *feature)
Definition: muCombUtil.cxx:42
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::L2StandAloneMuon_v2::setSAddress
void setSAddress(int value)
Set the station address of the muon.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
WeakBFieldA
@ WeakBFieldA
Definition: MuFastSteering.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
MuFastTrackExtrapolator.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigL2MuonSA::MuFastTrackExtrapolator::getMuFastRes
double getMuFastRes(const double pt, const int add, const double eta, const double phi) const
Definition: MuFastTrackExtrapolator.cxx:89
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:192
TrigMuonDefs.h
xAOD::L2StandAloneMuon_v2::setZMS
void setZMS(float value)
Set the Z at muon spectrometer.
xAOD::L2MuonParameters::EndcapInner
@ EndcapInner
Inner station in the endcap spectrometer.
Definition: TrigMuonDefs.h:19
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
WeakBFieldB
@ WeakBFieldB
Definition: MuFastSteering.h:42
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
AthAlgTool
Definition: AthAlgTool.h:26
xAOD::L2StandAloneMuon
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
Definition: L2StandAloneMuon.h:17
TrigL2MuonSA::MuFastTrackExtrapolator::MuFastTrackExtrapolator
MuFastTrackExtrapolator(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuFastTrackExtrapolator.cxx:14
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
TrigL2MuonSA::MuFastTrackExtrapolator::extrapolateTrack
StatusCode extrapolateTrack(std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns, double winPt) const
Definition: MuFastTrackExtrapolator.cxx:24
Prompt::Def::AbsEta
@ AbsEta
Definition: VarHolder.h:77
L2StandAloneMuonAuxContainer.h
xAOD::L2MuonParameters::whichECRegion
ECRegions whichECRegion(const float eta, const float phi)
Definition: TrigMuonDefs.cxx:16