ATLAS Offline Software
InDetTrackSelectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // forward declares
9 #include "VxVertex/Vertex.h"
11 #include "TrkTrack/Track.h"
12 // normal includes
14 #include "CLHEP/Matrix/Vector.h"
15 
16 namespace InDet
17 {
18 
19 //_______________________________________________________________________________
20 InDetTrackSelectorTool::InDetTrackSelectorTool(const std::string & t, const std::string & n, const IInterface * p)
21  : AthAlgTool(t,n,p)
22 {
23  declareInterface<ITrackSelectorTool>(this);
24 }
25 
26 //_______________________________________________________________________________
28 = default;
29 
30 //_______________________________________________________________________________
32 {
34  if (!m_trackSumTool.empty())
35  {
36  if(m_trackSumTool.retrieve().isFailure()) {
37  msg(MSG::ERROR)<<" Unable to retrieve "<<m_trackSumTool<<endmsg;
38  return StatusCode::FAILURE;
39  }
40  else {
42  }
43  }
44 
45  if ( m_extrapolator.retrieve().isFailure() ) {
46  msg(MSG::ERROR) << "Failed to retrieve tool " << m_extrapolator << endmsg;
47  return StatusCode::FAILURE;
48  }
49 
50  return StatusCode::SUCCESS;
51 }
52 
53 
54 //_______________________________________________________________________________
56 {
57  // decision based on the track parameters
58  if(!decision(track.perigeeParameters(), vertex, track.info().particleHypothesis()))
59  return false;
60 
61  // number of hits, silicon hits, b-layer
62  // first ask track for summary
63  std::unique_ptr<Trk::TrackSummary> summaryUniquePtr;
64  const Trk::TrackSummary * summary = track.trackSummary();
65  if (summary == nullptr && m_trackSumToolAvailable) {
66  summaryUniquePtr = m_trackSumTool->summary(Gaudi::Hive::currentContext(), track);
67  summary = summaryUniquePtr.get();
68  }
69 
70  if (nullptr==summary) {
71  ATH_MSG_DEBUG( "Track preselection: cannot create a track summary. This track will not pass." );
72  return false;
73  }
74 
76  int nPixelDead = summary->get(Trk::numberOfPixelDeadSensors);
77  if (nPixelDead<0)
78  nPixelDead=0;
79 
80  int nInLayerHits = summary->get(Trk::numberOfInnermostPixelLayerHits);
81 
82  if(nPixelHits+nPixelDead<m_numberOfPixelHits || nInLayerHits<m_numberOfInLayerHits )
83  return false;
84 
85  // all ok
86  return true;
87 }
88 
89 //_______________________________________________________________________________
91 {
92  if(!decision(&(track.definingParameters()), vertex, Trk::pion))
93  return false;
94 
95  const Trk::TrackSummary * summary = track.trackSummary();
96  if (summary == nullptr) {
97  ATH_MSG_INFO( "TrackParticleBase does not have a Track Summary. Rejected." );
98  return false;
99  }
101  int nPixelDead = summary->get(Trk::numberOfPixelDeadSensors);
102  if (nPixelDead<0)
103  nPixelDead=0;
104 
105  int nInLayerHits = summary->get(Trk::numberOfInnermostPixelLayerHits);
106 
107  return nPixelHits+nPixelDead>=m_numberOfPixelHits && nInLayerHits>=m_numberOfInLayerHits;
108 }
109 
110 //_______________________________________________________________________________
112 {
113  // checking pointer first
114  if(nullptr==track || !track->covariance()) {
115  ATH_MSG_WARNING( "Track preselection: Zero pointer to parameterbase* received (most likely a track without perigee). This track will not pass." );
116  return false;
117  }
118 
119  // getting the perigee parameters of the track
120  const Trk::Perigee * perigee(nullptr);
121  if(vertex == nullptr)
122  perigee = dynamic_cast<const Trk::Perigee *>(track);
123  else {
124  Trk::PerigeeSurface perigeeSurface(vertex->position());
125  std::unique_ptr<const Trk::TrackParameters> tmp =
126  m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
127  *track,
128  perigeeSurface,
130  true,
131  hyp);
132  //release only of right type
133  if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
134  perigee = static_cast<const Trk::Perigee*>(tmp.release());
135  }
136  }
137 
138  if(nullptr == perigee || !perigee->covariance() ) {
139  ATH_MSG_INFO( "Track preselection: cannot make a measured perigee. This track will not pass." );
140  return false;
141  }
142 
143  AmgVector(5) trackParameters = perigee->parameters();
144 
145  // d0 and z0 cuts
146  double d0 = trackParameters[Trk::d0];
147  if(std::abs(d0) > m_maxD0) { if(vertex != nullptr) { delete perigee; } return false; }
148 
149  double z0 = trackParameters[Trk::z0];
150  if (std::abs(z0)*sin(trackParameters[Trk::theta]) > m_IPz0Max)
151  { if(vertex != nullptr) { delete perigee; } return false; }
152  if (std::abs(z0) > m_maxZ0)
153  { if(vertex != nullptr) { delete perigee; } return false; }
154 
155  // transverse momentum
156  double pt = perigee->momentum().perp();
157  if(pt<m_minPt) { if(vertex != nullptr) { delete perigee; } return false; }
158 
159  // d0 significance
160  double d0Significance=std::abs(trackParameters[Trk::d0]/sqrt( (*perigee->covariance())(Trk::d0,Trk::d0) ));
161  if (d0Significance>m_maxD0overSigmaD0)
162  { if(vertex != nullptr) { delete perigee; } return false; }
163 
164  if(vertex != nullptr) { delete perigee; }
165  return true;
166 } //end of selection method
167 
168 } //end of namespace definitions
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
Trk::anyDirection
@ anyDirection
Definition: PropDirection.h:22
Trk::Vertex
Definition: Tracking/TrkEvent/VxVertex/VxVertex/Vertex.h:26
InDet::InDetTrackSelectorTool::m_IPz0Max
DoubleProperty m_IPz0Max
Definition: InDetTrackSelectorTool.h:71
ITrackSummaryTool.h
Trk::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:53
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::InDetTrackSelectorTool::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
Definition: InDetTrackSelectorTool.h:84
TrackParticleBase.h
test_pyathena.pt
pt
Definition: test_pyathena.py:11
InDet::InDetTrackSelectorTool::m_numberOfInLayerHits
IntegerProperty m_numberOfInLayerHits
Definition: InDetTrackSelectorTool.h:78
Trk::z0
@ z0
Definition: ParamDefs.h:64
IExtrapolator.h
InDet::InDetTrackSelectorTool::m_maxD0
DoubleProperty m_maxD0
Definition: InDetTrackSelectorTool.h:73
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDet::InDetTrackSelectorTool::~InDetTrackSelectorTool
~InDetTrackSelectorTool()
IDTPM::nPixelHits
float nPixelHits(const U &p)
Definition: TrackParametersHelper.h:354
InDet::InDetTrackSelectorTool::m_maxZ0
DoubleProperty m_maxZ0
Definition: InDetTrackSelectorTool.h:72
Track.h
Trk::TrackParticleBase
Definition: TrackParticleBase.h:41
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
InDetTrackSelectorTool.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
InDet::InDetTrackSelectorTool::m_maxD0overSigmaD0
DoubleProperty m_maxD0overSigmaD0
Definition: InDetTrackSelectorTool.h:75
beamspotman.n
n
Definition: beamspotman.py:731
Trk::theta
@ theta
Definition: ParamDefs.h:66
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
Trk::numberOfPixelDeadSensors
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:65
Trk::pion
@ pion
Definition: ParticleHypothesis.h:29
InDet::InDetTrackSelectorTool::m_trackSumToolAvailable
bool m_trackSumToolAvailable
Definition: InDetTrackSelectorTool.h:81
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
InDet::InDetTrackSelectorTool::InDetTrackSelectorTool
InDetTrackSelectorTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: InDetTrackSelectorTool.cxx:20
InDet::InDetTrackSelectorTool::initialize
virtual StatusCode initialize() override
Definition: InDetTrackSelectorTool.cxx:31
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::SurfaceType::Perigee
@ Perigee
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
Trk::d0
@ d0
Definition: ParamDefs.h:63
Vertex.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
InDet::InDetTrackSelectorTool::decision
virtual bool decision(const Trk::Track &track, const Trk::Vertex *vertex) const override
Definition: InDetTrackSelectorTool.cxx:55
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
InDet::InDetTrackSelectorTool::m_trackSumTool
ToolHandle< Trk::ITrackSummaryTool > m_trackSumTool
Definition: InDetTrackSelectorTool.h:80
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
AthAlgTool
Definition: AthAlgTool.h:26
InDet::InDetTrackSelectorTool::m_numberOfPixelHits
IntegerProperty m_numberOfPixelHits
Definition: InDetTrackSelectorTool.h:76
InDet::InDetTrackSelectorTool::m_minPt
DoubleProperty m_minPt
Definition: InDetTrackSelectorTool.h:69
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65