ATLAS Offline Software
OfflineTrackQualitySelectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 namespace IDTPM {
9 
11  : asg::AsgTool( name ) {}
12 
15  ATH_CHECK( m_offlineTool.retrieve() );
16  return StatusCode::SUCCESS;
17 }
18 
20  TrackAnalysisCollections& trkAnaColls) {
21 
22  std::vector< const xAOD::TrackParticle* > selected;
23  for ( auto trkPtr: trkAnaColls.offlTrackVec(TrackAnalysisCollections::FS)) {
24  if ( m_offlineTool->accept(trkPtr) and this->accept(trkPtr)) // TODO vertex needs to be provided here
25  selected.push_back(trkPtr);
26  }
27  ATH_MSG_DEBUG("Out of " << trkAnaColls.offlTrackVec(TrackAnalysisCollections::FS).size() << " tracks, selected " << selected.size() );
29  return StatusCode::SUCCESS;
30 }
31 
33  TrackAnalysisCollections& /*trkAnaColls*/,
34  const ElementLink<TrigRoiDescriptorCollection>& /*roiLink*/) {
35  ATH_MSG_FATAL( "using selectTracksInRoI implementation for this tool is an invalid use case" );
36  return StatusCode::FAILURE;
37 }
38 
39 
41  if (m_maxPt!=-9999. and (pT(*track)) > m_maxPt ) return false;
42  if (m_maxEta!=-9999. and (eta(*track)) > m_maxEta ) return false;
43  if (m_minEta!=-9999. and (eta(*track)) < m_minEta ) return false;
44  if (m_minPhi!=-9999. and (phi(*track)) < m_minPhi ) return false;
45  if (m_maxPhi!=-9999. and (phi(*track)) > m_maxPhi ) return false;
46  if (m_minD0!=-9999. and (d0(*track)) < m_minD0 ) return false;
47  if (m_minZ0!=-9999. and (z0(*track)) < m_minZ0 ) return false;
48  if (m_minQoPT!=-9999. and (qOverPT(*track)) < m_minQoPT ) return false;
49  if (m_maxQoPT!=-9999. and (qOverPT(*track)) > m_maxQoPT ) return false;
50  if (m_minAbsEta!=-9999. and std::fabs(eta(*track)) < m_minAbsEta ) return false;
51  if (m_minAbsPhi!=-9999. and std::fabs(phi(*track)) < m_minAbsPhi ) return false;
52  if (m_maxAbsPhi!=-9999. and std::fabs(phi(*track)) > m_maxAbsPhi ) return false;
53  if (m_minAbsD0!=-9999. and std::fabs(d0(*track)) < m_minAbsD0 ) return false;
54  if (m_maxAbsD0!=-9999. and std::fabs(d0(*track)) > m_maxAbsD0 ) return false;
55  if (m_minAbsZ0!=-9999. and std::fabs(z0(*track)) < m_minAbsZ0 ) return false;
56  if (m_maxAbsZ0!=-9999. and std::fabs(z0(*track)) > m_maxAbsZ0 ) return false;
57  if (m_minAbsQoPT!=-9999. and std::fabs(qOverPT(*track)) < m_minAbsQoPT ) return false;
58  if (m_maxAbsQoPT!=-9999. and std::fabs(qOverPT(*track)) > m_maxAbsQoPT ) return false;
59  return true;
60 }
61 
62 
63 } // namespace IDTPM
IDTPM::OfflineTrackQualitySelectionTool::m_offlineTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_offlineTool
Definition: OfflineTrackQualitySelectionTool.h:42
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
IDTPM::TrackAnalysisCollections
Definition: TrackAnalysisCollections.h:44
IDTPM::OfflineTrackQualitySelectionTool::m_minPhi
FloatProperty m_minPhi
Definition: OfflineTrackQualitySelectionTool.h:55
IDTPM::z0
float z0(const U &p)
Definition: TrackParametersHelper.h:70
IDTPM::OfflineTrackQualitySelectionTool::m_minZ0
FloatProperty m_minZ0
Definition: OfflineTrackQualitySelectionTool.h:58
IDTPM::OfflineTrackQualitySelectionTool::m_maxAbsQoPT
FloatProperty m_maxAbsQoPT
Definition: OfflineTrackQualitySelectionTool.h:51
IDTPM::OfflineTrackQualitySelectionTool::m_minAbsPhi
FloatProperty m_minAbsPhi
Definition: OfflineTrackQualitySelectionTool.h:44
asg
Definition: DataHandleTestTool.h:28
IDTPM::OfflineTrackQualitySelectionTool::m_maxPhi
FloatProperty m_maxPhi
Definition: OfflineTrackQualitySelectionTool.h:56
IDTPM::OfflineTrackQualitySelectionTool::m_minAbsQoPT
FloatProperty m_minAbsQoPT
Definition: OfflineTrackQualitySelectionTool.h:50
IDTPM::OfflineTrackQualitySelectionTool::m_maxAbsZ0
FloatProperty m_maxAbsZ0
Definition: OfflineTrackQualitySelectionTool.h:49
TrackAnalysisCollections.h
Class to hold for each event collections needed in the TrkAnalsis.
IDTPM::OfflineTrackQualitySelectionTool::selectTracks
virtual StatusCode selectTracks(TrackAnalysisCollections &trkAnaColls) override
Definition: OfflineTrackQualitySelectionTool.cxx:19
IDTPM::OfflineTrackQualitySelectionTool::m_minAbsD0
FloatProperty m_minAbsD0
Definition: OfflineTrackQualitySelectionTool.h:46
IDTPM::OfflineTrackQualitySelectionTool::m_minQoPT
FloatProperty m_minQoPT
Definition: OfflineTrackQualitySelectionTool.h:59
IDTPM::OfflineTrackQualitySelectionTool::m_maxAbsPhi
FloatProperty m_maxAbsPhi
Definition: OfflineTrackQualitySelectionTool.h:45
IDTPM::phi
float phi(const U &p)
Definition: TrackParametersHelper.h:59
IDTPM::TrackAnalysisCollections::fillOfflTrackVec
StatusCode fillOfflTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Offline tracks.
Definition: TrackAnalysisCollections.cxx:314
IDTPM::OfflineTrackQualitySelectionTool::OfflineTrackQualitySelectionTool
OfflineTrackQualitySelectionTool(const std::string &name)
Definition: OfflineTrackQualitySelectionTool.cxx:10
TrackParametersHelper.h
Utility methods to access track/truth particles parmeters in a consitent way in this package.
IDTPM::qOverPT
float qOverPT(const U &p)
Definition: TrackParametersHelper.h:112
IDTPM::eta
float eta(const U &p)
Accessor utility function for getting the value of eta.
Definition: TrackParametersHelper.h:41
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
IDTPM::TrackAnalysisCollections::FS
@ FS
Definition: TrackAnalysisCollections.h:52
IDTPM::d0
float d0(const U &p)
Definition: TrackParametersHelper.h:82
IDTPM::pT
float pT(const U &p)
Accessor utility function for getting the value of pT.
Definition: TrackParametersHelper.h:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IDTPM::TrackAnalysisCollections::offlTrackVec
const std::vector< const xAOD::TrackParticle * > & offlTrackVec(Stage stage=FULL)
Definition: TrackAnalysisCollections.h:164
IDTPM::OfflineTrackQualitySelectionTool::m_maxPt
FloatProperty m_maxPt
Definition: OfflineTrackQualitySelectionTool.h:52
IDTPM::OfflineTrackQualitySelectionTool::accept
bool accept(const xAOD::TrackParticle *track)
Definition: OfflineTrackQualitySelectionTool.cxx:40
IDTPM::OfflineTrackQualitySelectionTool::m_maxQoPT
FloatProperty m_maxQoPT
Definition: OfflineTrackQualitySelectionTool.h:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
OfflineTrackQualitySelectionTool.h
IDTPM::OfflineTrackQualitySelectionTool::m_minAbsZ0
FloatProperty m_minAbsZ0
Definition: OfflineTrackQualitySelectionTool.h:48
IDTPM::OfflineTrackQualitySelectionTool::m_maxAbsD0
FloatProperty m_maxAbsD0
Definition: OfflineTrackQualitySelectionTool.h:47
IDTPM::OfflineTrackQualitySelectionTool::m_minD0
FloatProperty m_minD0
Definition: OfflineTrackQualitySelectionTool.h:57
IDTPM::OfflineTrackQualitySelectionTool::m_minAbsEta
FloatProperty m_minAbsEta
Definition: OfflineTrackQualitySelectionTool.h:43
IDTPM::OfflineTrackQualitySelectionTool::m_maxEta
FloatProperty m_maxEta
Definition: OfflineTrackQualitySelectionTool.h:54
IDTPM::OfflineTrackQualitySelectionTool::m_minEta
FloatProperty m_minEta
Definition: OfflineTrackQualitySelectionTool.h:53
IDTPM::OfflineTrackQualitySelectionTool::selectTracksInRoI
virtual StatusCode selectTracksInRoI(TrackAnalysisCollections &trkAnaColls, const ElementLink< TrigRoiDescriptorCollection > &roiLink) override
Definition: OfflineTrackQualitySelectionTool.cxx:32
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
IDTPM
Athena include(s).
Definition: IPlotsDefinitionSvc.h:25
IDTPM::OfflineTrackQualitySelectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: OfflineTrackQualitySelectionTool.cxx:13
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133