ATLAS Offline Software
MuFastTrackFitter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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):
16 {
17 }
18 
19 // --------------------------------------------------------------------------------
20 // --------------------------------------------------------------------------------
21 
23 {
24 
25  ATH_CHECK( m_sagittaRadiusEstimate.retrieve() );
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 
36 StatusCode TrigL2MuonSA::MuFastTrackFitter::setMCFlag(const BooleanProperty& use_mcLUT)
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 
TrigL2MuonSA::MuFastTrackFitter::setMCFlag
StatusCode setMCFlag(const BooleanProperty &use_mcLUT)
Definition: MuFastTrackFitter.cxx:36
AthMsgStreamMacros.h
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigL2MuonSA::RpcFitResult
Definition: RpcFitResult.h:14
TrigL2MuonSA::TgcFitResult
Definition: TgcFitResult.h:11
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
MuFastTrackFitter.h
TrigL2MuonSA::MuFastTrackFitter::MuFastTrackFitter
MuFastTrackFitter(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuFastTrackFitter.cxx:12
TrigL2MuonSA::TrackPattern
Definition: TrackData.h:16
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TrigL2MuonSA::MuonRoad
Definition: MuonRoad.h:20
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
TrigL2MuonSA::MuFastTrackFitter::initialize
virtual StatusCode initialize() override
Definition: MuFastTrackFitter.cxx:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigL2MuonSA::MuFastTrackFitter::findTracks
StatusCode findTracks(const TrigRoiDescriptor *p_roids, TrigL2MuonSA::RpcFitResult &rpcFitResult, std::vector< TrigL2MuonSA::TrackPattern > &v_trackPatterns) const
Definition: MuFastTrackFitter.cxx:132
TrigL2MuonSA::MuonRoad::extFtfMiddleEta
double extFtfMiddleEta
Definition: MuonRoad.h:90
AthAlgTool
Definition: AthAlgTool.h:26
ServiceHandle
Definition: ClusterMakerTool.h:37