ATLAS Offline Software
Loading...
Searching...
No Matches
MuFastTrackFitter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MuFastTrackFitter.h"
6
8
9// --------------------------------------------------------------------------------
10// --------------------------------------------------------------------------------
11
13 const std::string& name,
14 const IInterface* parent):
15 AthAlgTool(type,name,parent)
16{
17}
18
19// --------------------------------------------------------------------------------
20// --------------------------------------------------------------------------------
21
23{
24
26 ATH_CHECK( m_alphaBetaEstimate.retrieve() );
27 ATH_CHECK( m_ptFromRadius.retrieve() );
28 ATH_CHECK( m_ptFromAlphaBeta.retrieve() );
29
30 return StatusCode::SUCCESS;
31}
32
33// --------------------------------------------------------------------------------
34// --------------------------------------------------------------------------------
35
37{
38 m_use_mcLUT = use_mcLUT;
39
40 if (m_use_mcLUT) {
41 // Barrel
42 const ServiceHandle<PtBarrelLUTSvc> ptBarrelLUTSvc("PtBarrelLUTSvc_MC", name());
43 if ( ptBarrelLUTSvc.retrieve().isFailure() ) {
44 ATH_MSG_ERROR("Could not find PtBarrelLUTSvc");
45 return StatusCode::FAILURE;
46 }
47 // Endcap
48 const ServiceHandle<PtEndcapLUTSvc> ptEndcapLUTSvc("PtEndcapLUTSvc_MC", name());
49 if ( ptEndcapLUTSvc.retrieve().isFailure() ) {
50 ATH_MSG_ERROR("Could not find PtEndcaplLUTSvc");
51 return StatusCode::FAILURE;
52 }
53
54 m_alphaBetaEstimate->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
55
56 m_ptFromRadius->setMCFlag(m_use_mcLUT, &*ptBarrelLUTSvc);
57
58 m_ptFromAlphaBeta->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
59
60 } else {
61 // Barrel
62 const ServiceHandle<PtBarrelLUTSvc> ptBarrelLUTSvc("PtBarrelLUTSvc", name());
63 if ( ptBarrelLUTSvc.retrieve().isFailure() ) {
64 ATH_MSG_ERROR("Could not find PtBarrelLUTSvc");
65 return StatusCode::FAILURE;
66 }
67 // Endcap
68 const ServiceHandle<PtEndcapLUTSvc> ptEndcapLUTSvc("PtEndcapLUTSvc", name());
69 if ( ptEndcapLUTSvc.retrieve().isFailure() ) {
70 ATH_MSG_ERROR("Could not find PtEndcaplLUTSvc");
71 return StatusCode::FAILURE;
72 }
73
74 m_alphaBetaEstimate->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
75
76 m_ptFromRadius->setMCFlag(m_use_mcLUT, &*ptBarrelLUTSvc);
77
78 m_ptFromAlphaBeta->setMCFlag(m_use_mcLUT, &*ptEndcapLUTSvc);
79
80 }
81
82 const ServiceHandle<AlignmentBarrelLUTSvc> alignmentBarrelLUTSvc("AlignmentBarrelLUTSvc", name());
83 if ( alignmentBarrelLUTSvc.retrieve().isFailure() ) {
84 ATH_MSG_ERROR("Could not find AlignmentBarrelLUTSvc");
85 return StatusCode::FAILURE;
86 }
87
88 // Calculation of sagitta and radius
89 // sc = m_sagittaRadiusEstimate.retrieve();
90 // if ( sc.isFailure() ) {
91 // ATH_MSG_ERROR("Could not retrieve " << m_sagittaRadiusEstimate);
92 // return sc;
93 // }
94 // ATH_MSG_DEBUG("Retrieved service " << m_sagittaRadiusEstimate);
95
96 m_sagittaRadiusEstimate->setMCFlag(m_use_mcLUT, &*alignmentBarrelLUTSvc);
97
98 // Calculation of alpha and beta
99 // sc = m_alphaBetaEstimate.retrieve();
100 // if ( sc.isFailure() ) {
101 // ATH_MSG_ERROR("Could not retrieve " << m_alphaBetaEstimate);
102 // return sc;
103 // }
104 // ATH_MSG_DEBUG("Retrieved service " << m_alphaBetaEstimate);
105
106
107 // conversion: radius -> pT
108 // sc = m_ptFromRadius.retrieve();
109 // if ( sc.isFailure() ) {
110 // ATH_MSG_ERROR("Could not retrieve " << m_ptFromRadius);
111 // return sc;
112 // }
113 // ATH_MSG_DEBUG("Retrieved service " << m_ptFromRadius);
114
115
116 // conversion: alpha, beta -> pT
117 // sc = m_ptFromAlphaBeta.retrieve();
118 // if ( sc.isFailure() ) {
119 // ATH_MSG_ERROR("Could not retrieve " << m_ptFromAlphaBeta);
120 // return sc;
121 // }
122 // ATH_MSG_DEBUG("Retrieved service " << m_ptFromAlphaBeta);
123
124 ATH_MSG_DEBUG( "Completed tp set " << (m_use_mcLUT?"MC":"not MC") << " flag" );
125
126 return StatusCode::SUCCESS;
127}
128
129// --------------------------------------------------------------------------------
130// --------------------------------------------------------------------------------
131
133 TrigL2MuonSA::RpcFitResult& rpcFitResult,
134 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns) const
135{
136
137 for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) {
138
139 ATH_CHECK( m_sagittaRadiusEstimate->setSagittaRadius(p_roids, rpcFitResult, itTrack) );
140
141 ATH_CHECK( m_ptFromRadius->setPt(itTrack) );
142
143 }
144
145 return StatusCode::SUCCESS;
146}
147
148// --------------------------------------------------------------------------------
149// --------------------------------------------------------------------------------
150
152 TrigL2MuonSA::TgcFitResult& tgcFitResult,
153 std::vector<TrigL2MuonSA::TrackPattern>& v_trackPatterns,
154 const TrigL2MuonSA::MuonRoad& muonRoad) const
155{
156
157 for (TrigL2MuonSA::TrackPattern& itTrack : v_trackPatterns) {
158
159 ATH_CHECK( m_alphaBetaEstimate->setAlphaBeta(p_roids, tgcFitResult, itTrack, muonRoad) );
160
161 if ( itTrack.etaBin < -1 ) {
162 itTrack.etaBin = (int)((std::abs(muonRoad.extFtfMiddleEta)-1.)/0.05); // eta binning is the same as AlphaBetaEstimate
163 if(itTrack.etaBin <= -1) itTrack.etaBin = 0;
164 }
165
166 ATH_CHECK( m_ptFromAlphaBeta->setPt(itTrack,tgcFitResult) );
167
168 }
169
170 return StatusCode::SUCCESS;
171}
172
173// --------------------------------------------------------------------------------
174// --------------------------------------------------------------------------------
175
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
ToolHandle< PtFromRadius > m_ptFromRadius
ToolHandle< SagittaRadiusEstimate > m_sagittaRadiusEstimate
StatusCode setMCFlag(bool use_mcLUT)
ToolHandle< PtFromAlphaBeta > m_ptFromAlphaBeta
virtual StatusCode initialize() override
ToolHandle< AlphaBetaEstimate > m_alphaBetaEstimate
StatusCode findTracks(const TrigRoiDescriptor *p_roids, TrigL2MuonSA::RpcFitResult &rpcFitResult, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns) const
MuFastTrackFitter(const std::string &type, const std::string &name, const IInterface *parent)
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...