ATLAS Offline Software
TrackQualitySelectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 
15 #include "GaudiKernel/ISvcLocator.h"
16 #include "GaudiKernel/Service.h"
17 
18 
23  const std::string& name ) :
24  asg::AsgTool( name ) { }
25 
26 
31 
33 
34  ATH_MSG_INFO( "Initializing " << name() );
35 
36  ATH_CHECK( m_offlineSelectionTool.retrieve( EnableTool{ m_doOfflSelection.value() } ) );
37  ATH_CHECK( m_truthSelectionTool.retrieve( EnableTool{ m_doTruthSelection.value() } ) );
38  ATH_CHECK( m_objSelectionTool.retrieve( EnableTool{ m_doObjSelection.value() } ) );
39 
40  return StatusCode::SUCCESS;
41 }
42 
43 
48  TrackAnalysisCollections& trkAnaColls ) {
49 
50  ATH_MSG_DEBUG( "Initially copying collections to FullScan vectors" );
51 
52  ISvcLocator* svcLoc = Gaudi::svcLocator();
53  SmartIF<ITrackAnalysisDefinitionSvc> trkAnaDefSvc( svcLoc->service( "TrkAnaDefSvc" + trkAnaColls.anaTag() ) );
54  ATH_CHECK( trkAnaDefSvc.isValid() );
55 
57  if( trkAnaDefSvc->useOffline() ) {
58  ATH_CHECK( trkAnaColls.fillOfflTrackVec(
61  }
62 
63  if( trkAnaDefSvc->useEFTrigger() ) {
64  ATH_CHECK( trkAnaColls.fillTrigTrackVec(
67  }
68 
69  if( trkAnaDefSvc->useTruth() ) {
70  ATH_CHECK( trkAnaColls.fillTruthPartVec(
73  }
74 
76  ATH_MSG_DEBUG( "Tracks after initial FullScan copy: " <<
77  trkAnaColls.printInfo( TrackAnalysisCollections::FS ) );
78 
80  if( trkAnaDefSvc->useOffline() and m_doOfflSelection.value() ) {
81  ATH_CHECK( m_offlineSelectionTool->selectTracks( trkAnaColls ) );
82  }
83 
85  if( trkAnaDefSvc->useTruth() and m_doTruthSelection.value() ) {
86  ATH_CHECK( m_truthSelectionTool->selectTracks( trkAnaColls ) );
87  }
88 
90  if( trkAnaDefSvc->useOffline() and m_doObjSelection.value() ) {
91  ATH_CHECK( m_objSelectionTool->selectTracks( trkAnaColls ) );
92  }
93 
95  ATH_MSG_DEBUG( "Tracks after full quality selection: " <<
96  trkAnaColls.printInfo( TrackAnalysisCollections::FS ) );
97 
98  return StatusCode::SUCCESS;
99 }
IDTPM::TrackAnalysisCollections::fillTrigTrackVec
StatusCode fillTrigTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Trigger tracks.
Definition: TrackAnalysisCollections.cxx:331
IDTPM::TrackAnalysisCollections
Definition: TrackAnalysisCollections.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
IDTPM::TrackQualitySelectionTool::TrackQualitySelectionTool
TrackQualitySelectionTool(const std::string &name)
Constructor.
Definition: TrackQualitySelectionTool.cxx:22
asg
Definition: DataHandleTestTool.h:28
TrackQualitySelectionTool.h
Tool to handle all required tracks and truth particle quality selections in this package.
IDTPM::TrackAnalysisCollections::trigTrackVec
const std::vector< const xAOD::TrackParticle * > & trigTrackVec(Stage stage=FULL)
Definition: TrackAnalysisCollections.h:166
TrackAnalysisCollections.h
Class to hold for each event collections needed in the TrkAnalsis.
IDTPM::TrackQualitySelectionTool::initialize
virtual StatusCode initialize() override
Initialize.
Definition: TrackQualitySelectionTool.cxx:30
IDTPM::TrackAnalysisCollections::fillOfflTrackVec
StatusCode fillOfflTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Offline tracks.
Definition: TrackAnalysisCollections.cxx:314
IDTPM::TrackAnalysisCollections::fillTruthPartVec
StatusCode fillTruthPartVec(const std::vector< const xAOD::TruthParticle * > &vec, Stage stage=FULL)
get truth/offline/trigger track vector (TEST or REFERENCE)
Definition: TrackAnalysisCollections.cxx:297
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
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
IDTPM::TrackQualitySelectionTool::selectTracks
virtual StatusCode selectTracks(TrackAnalysisCollections &trkAnaColls) override
Main Track selection method.
Definition: TrackQualitySelectionTool.cxx:47
IDTPM::TrackAnalysisCollections::truthPartVec
const std::vector< const xAOD::TruthParticle * > & truthPartVec(Stage stage=FULL)
get truth/offline/trigger track vector (TEST or REFERENCE)
Definition: TrackAnalysisCollections.h:162
IDTPM::TrackAnalysisCollections::printInfo
std::string printInfo(Stage stage=FULL) const
print Information about tracks in the collection(s)
Definition: TrackAnalysisCollections.cxx:546
IDTPM::TrackAnalysisCollections::FULL
@ FULL
Definition: TrackAnalysisCollections.h:52
IDTPM::TrackAnalysisCollections::anaTag
const std::string & anaTag()
— Getter methods —
Definition: TrackAnalysisCollections.h:132
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133