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(
54  svcLoc->service( "TrkAnaDefSvc" + trkAnaColls.anaTag() ) );
55  ATH_CHECK( trkAnaDefSvc.isValid() );
56 
58  if( trkAnaDefSvc->useOffline() ) {
60  ATH_CHECK( trkAnaColls.fillOfflTrackVec(
63  }
64 
65  if( trkAnaDefSvc->useTrigger() or trkAnaDefSvc->useEFTrigger() ) {
68  ATH_CHECK( trkAnaColls.fillTrigTrackVec(
71  }
72 
73  if( trkAnaDefSvc->useTruth() ) {
75  ATH_CHECK( trkAnaColls.fillTruthPartVec(
78  }
79 
81  ATH_MSG_DEBUG( "Tracks after initial FullScan copy: " <<
82  trkAnaColls.printInfo( TrackAnalysisCollections::FS, false ) );
83 
85  if( trkAnaDefSvc->useOffline() and m_doOfflSelection.value() ) {
86  ATH_CHECK( m_offlineSelectionTool->selectTracks( trkAnaColls ) );
87  }
88 
90  if( trkAnaDefSvc->useTruth() and m_doTruthSelection.value() ) {
91  ATH_CHECK( m_truthSelectionTool->selectTracks( trkAnaColls ) );
92  }
93 
95 
97  if( trkAnaDefSvc->useOffline() and m_doObjSelection.value() ) {
98  ATH_CHECK( m_objSelectionTool->selectTracks( trkAnaColls ) );
99  }
100 
102  ATH_MSG_DEBUG( "Tracks after full quality selection: " <<
103  trkAnaColls.printInfo( TrackAnalysisCollections::FS, false ) );
104 
105  return StatusCode::SUCCESS;
106 }
IDTPM::TrackAnalysisCollections::printInfo
std::string printInfo(Stage stage=FULL, bool printVertex=true) const
print information about tracks in the collection(s)
Definition: TrackAnalysisCollections.cxx:1034
IDTPM::TrackAnalysisCollections::fillTrigTrackVec
StatusCode fillTrigTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Trigger tracks.
Definition: TrackAnalysisCollections.cxx:353
IDTPM::TrackAnalysisCollections
Definition: TrackAnalysisCollections.h:46
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:217
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:336
IDTPM::TrackAnalysisCollections::fillTruthPartVec
StatusCode fillTruthPartVec(const std::vector< const xAOD::TruthParticle * > &vec, Stage stage=FULL)
fill truth/offline/trigger track vector (TEST or REFERENCE)
Definition: TrackAnalysisCollections.cxx:319
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:54
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:215
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
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:213
IDTPM::TrackAnalysisCollections::FULL
@ FULL
Definition: TrackAnalysisCollections.h:54
IDTPM::TrackAnalysisCollections::anaTag
const std::string & anaTag()
— Getter methods —
Definition: TrackAnalysisCollections.h:181
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133