ATLAS Offline Software
Loading...
Searching...
No Matches
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//_______________________________________________________________________________
14InDet::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
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
BooleanProperty m_robustCuts
Robust cut window setting.
virtual bool decision(const Trk::AtaStraightLine &, const Trk::Track &track) const override
ESD type interface.
ToolHandle< Trk::ITrackSelectorTool > m_trackSelector
Extra checks on hits & holes.
InDetIsoTrackSelectorTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor / Destructor.
virtual StatusCode initialize() override
Athena AlgTool methods.
DoubleProperty m_d0Significance
Sophisticated cut window setting : d0/z0 significance - only when robustCuts off.
ToolHandle< Trk::IExtrapolator > m_extrapolator
virtual const S & associatedSurface() const override final
Access to the Surface method.
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
const TrackParameters & definingParameters() const
Returns the 'defining' parameter of this TrackParticle.
@ anyDirection
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
@ theta
Definition ParamDefs.h:66
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters