ATLAS Offline Software
InDetIsoTrackSelectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 // forward declares
9 #include "TrkTrack/Track.h"
12 
13 //_______________________________________________________________________________
14 InDet::InDetIsoTrackSelectorTool::InDetIsoTrackSelectorTool(const std::string & t, const std::string & n, const IInterface * p)
15  : AthAlgTool(t,n,p)
16 {
17  declareInterface<Trk::IIsoTrackSelectorTool>(this);
18 }
19 
20 //_______________________________________________________________________________
22 = default;
23 
24 //_______________________________________________________________________________
26 {
27 
30 
31  // get the extrapolator
32  if ( m_extrapolator.retrieve().isFailure() ){
33  ATH_MSG_ERROR("Could not retrieve Extrapolator '" << m_extrapolator << "' (essential). Abort.");
34  return StatusCode::FAILURE;
35  } else
36  ATH_MSG_DEBUG("Successfully retrieved " << m_extrapolator);
37 
38  // get the track selector if needed
39  if ( !m_trackSelector.empty() && m_trackSelector.retrieve().isFailure() ){
40  ATH_MSG_ERROR("Could not retrieve TrackSelector '" << m_trackSelector <<"' although configured. Abort.");
41  return StatusCode::FAILURE;
42  }
43  // done
44  return StatusCode::SUCCESS;
45 }
46 
47 
48 //_______________________________________________________________________________
50 {
51  const Trk::Perigee* tPerigee = track.perigeeParameters();
52  if (!tPerigee){
53  ATH_MSG_DEBUG("No perigee on track, discard this one.");
54  return false;
55  }
56  // call the workhorse interface
57  bool passed = decision(atl,*tPerigee);
58  // only check if needed
59  passed = (!passed || m_trackSelector.empty()) ? passed : ( passed && m_trackSelector->decision(track) );
60  // return what you have
61  ATH_MSG_VERBOSE("Track " << ( passed ? "passed" : "did not pass") << " isolation track selector.");
62  return passed;
63 }
64 
65 
66 //_______________________________________________________________________________
68 {
69 
70  // get the paramters base
71  const Trk::TrackParameters* definintParameters = &(trackParticle.definingParameters());
72  const Trk::TrackParameters* trackParameters=
73  dynamic_cast<const Trk::Perigee*>(definintParameters);
74  if (!trackParameters){
75  ATH_MSG_DEBUG("No parameters to start from on track, discard this one.");
76  return false;
77  }
78  // call the workhorse interface
79  bool passed = decision(atl,*trackParameters);
80  // only check if needed
81  passed = (!passed || m_trackSelector.empty()) ? passed : ( passed && m_trackSelector->decision(trackParticle) );
82  // return what you have
83  ATH_MSG_VERBOSE("TrackParticle " << ( passed ? "passed" : "did not pass") << " isolation track selector.");
84  return passed;
85 }
86 
87 //_______________________________________________________________________________
89 {
90  // get the surface
91  bool passed = false;
92  const Trk::StraightLineSurface& alSurface = atl.associatedSurface();
93  // no surface: bail out
94  // get the track to the BeamLine Parameters ( given by AtaStrainghtLine)
95  const Trk::TrackParameters* trackAtBL = m_extrapolator->extrapolate(
96  Gaudi::Hive::currentContext(),
97  trackPars,
98  alSurface,
100  false).release();
101  // no parameterisation : bail out
102  if (!trackAtBL) return false;
103  // d0,z0 wrt BL for reference and track
104  double d0track_wrtBL = trackAtBL->parameters()[Trk::d0];
105  double sinTheta = m_applySinThetaCorrection ? 1. : sin(trackAtBL->parameters()[Trk::theta]);
106  double z0track_wrtBL = trackAtBL->parameters()[Trk::z0]*sinTheta;
107  double sinThetaRef = m_applySinThetaCorrection ? 1. : sin(atl.parameters()[Trk::theta]);
108  double z0ref_wrtBL = atl.parameters()[Trk::z0] * sinThetaRef;
109  if (m_robustCuts){
110  // check d0 cut with respect to BL
111  passed = std::abs(d0track_wrtBL) < m_d0max;
112  ATH_MSG_VERBOSE("TrackParameters " << ( passed ? "passed" : "did not pass" ) << " d0 cut wrt BL : "
113  << d0track_wrtBL << " (cut is : | " << m_d0max << " | ).");
114  // check z0 cut with respect to reference
115  passed = std::abs(z0track_wrtBL-z0ref_wrtBL) < m_z0stMax;
116  ATH_MSG_VERBOSE("TrackParameters " << ( passed ? "passed" : "did not pass" ) << " z0 " << ( m_applySinThetaCorrection ? "*sin(theta)" : "")
117  << " cut wrt reference :"
118  << (z0track_wrtBL-z0ref_wrtBL) << " (cut is : | " << m_z0stMax << " | ).");
119  } else {
120  // cast to measured parameters
121  if (!trackAtBL->covariance()){
122  ATH_MSG_VERBOSE("Can not apply significance cut on Parameters w/o Error. Ignore Track.");
123  return false;
124  }
125  // get the error on the track
126  double covTrackD0 = (*trackAtBL->covariance())(Trk::d0,Trk::d0);
127  double covTrackZ0 = (*trackAtBL->covariance())(Trk::z0,Trk::z0);
128  // check d0 significiance cut with respect to BL
129  double d0sig2 = (d0track_wrtBL*d0track_wrtBL)/covTrackD0;
130  passed = d0sig2 < m_d0Significance2;
131  ATH_MSG_VERBOSE("TrackParameters " << ( passed ? "passed" : "did not pass" ) << " d0 significance^2 cut wrt BL : "
132  << d0sig2 << " (cut is : | " << m_d0Significance2 << " | ).");
133  double deltaZ = z0ref_wrtBL - z0track_wrtBL;
134  double z0Err2 = covTrackZ0;
136  double covTrackTheta = (*trackAtBL->covariance())(Trk::theta,Trk::theta);
137  double covTrackZ0Theta = (*trackAtBL->covariance())(Trk::z0,Trk::theta);
138  // check z0 significance cut with respect to reference -- apply theta projection into longitudinal track frame
139  double cosTheta = cos(trackAtBL->parameters()[Trk::theta]);
140  // derivatives + apply jacobian transormation
141  double dZIPdTheta = deltaZ*cosTheta;
142  double dZIPdz0 = sinTheta;
143  double DTheta2 = dZIPdTheta*dZIPdTheta*covTrackTheta;
144  double DZ02 = dZIPdz0*dZIPdz0*covTrackZ0;
145  double DThetaZ0 = 2.*dZIPdTheta*dZIPdz0*covTrackZ0Theta;
146  // check for it
147  z0Err2 = DTheta2 + DZ02 + DThetaZ0;
148  }
149  double z0sig2 = (deltaZ*deltaZ)/(z0Err2);
150  passed = z0sig2 < m_z0Significance2;
151  ATH_MSG_VERBOSE("TrackParameters " << ( passed ? "passed" : "did not pass" ) << " z0*sin(theta) significance cut wrt BL : "
152  << z0sig2 << " (cut is : | " << m_z0Significance2 << " | ).");
153  }
154  // memory cleanup
155  delete trackAtBL;
156  return passed;
157 }
158 
Trk::anyDirection
@ anyDirection
Definition: PropDirection.h:22
InDet::InDetIsoTrackSelectorTool::m_d0Significance
DoubleProperty m_d0Significance
Sophisticated cut window setting : d0/z0 significance - only when robustCuts off.
Definition: InDetIsoTrackSelectorTool.h:63
StraightLineSurface.h
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
InDet::InDetIsoTrackSelectorTool::InDetIsoTrackSelectorTool
InDetIsoTrackSelectorTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor / Destructor.
Definition: InDetIsoTrackSelectorTool.cxx:14
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
TrackParticleBase.h
InDet::InDetIsoTrackSelectorTool::m_robustCuts
BooleanProperty m_robustCuts
Robust cut window setting.
Definition: InDetIsoTrackSelectorTool.h:58
Trk::z0
@ z0
Definition: ParamDefs.h:64
InDet::InDetIsoTrackSelectorTool::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: InDetIsoTrackSelectorTool.h:69
IExtrapolator.h
InDet::InDetIsoTrackSelectorTool::m_z0Significance
DoubleProperty m_z0Significance
Definition: InDetIsoTrackSelectorTool.h:64
InDet::InDetIsoTrackSelectorTool::initialize
virtual StatusCode initialize() override
Athena AlgTool methods.
Definition: InDetIsoTrackSelectorTool.cxx:25
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDet::InDetIsoTrackSelectorTool::m_d0max
DoubleProperty m_d0max
Definition: InDetIsoTrackSelectorTool.h:60
Track.h
Trk::TrackParticleBase
Definition: TrackParticleBase.h:41
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
InDet::InDetIsoTrackSelectorTool::m_z0stMax
DoubleProperty m_z0stMax
Definition: InDetIsoTrackSelectorTool.h:61
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:66
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
InDet::InDetIsoTrackSelectorTool::m_applySinThetaCorrection
BooleanProperty m_applySinThetaCorrection
Definition: InDetIsoTrackSelectorTool.h:59
Trk::ParametersBase
Definition: ParametersBase.h:55
InDet::InDetIsoTrackSelectorTool::m_d0Significance2
double m_d0Significance2
Definition: InDetIsoTrackSelectorTool.h:65
InDet::InDetIsoTrackSelectorTool::m_trackSelector
ToolHandle< Trk::ITrackSelectorTool > m_trackSelector
Extra checks on hits & holes.
Definition: InDetIsoTrackSelectorTool.h:71
Trk::d0
@ d0
Definition: ParamDefs.h:63
InDet::InDetIsoTrackSelectorTool::decision
virtual bool decision(const Trk::AtaStraightLine &, const Trk::Track &track) const override
ESD type interface.
Definition: InDetIsoTrackSelectorTool.cxx:49
InDet::InDetIsoTrackSelectorTool::m_z0Significance2
double m_z0Significance2
Definition: InDetIsoTrackSelectorTool.h:66
InDet::InDetIsoTrackSelectorTool::~InDetIsoTrackSelectorTool
~InDetIsoTrackSelectorTool()
Trk::TrackParticleBase::definingParameters
const TrackParameters & definingParameters() const
Returns the 'defining' parameter of this TrackParticle.
Definition: TrackParticleBase.h:239
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthAlgTool
Definition: AthAlgTool.h:26
makeComparison.deltaZ
int deltaZ
Definition: makeComparison.py:46
ITrackSelectorTool.h
InDetIsoTrackSelectorTool.h
Trk::StraightLineSurface
Definition: StraightLineSurface.h:51