ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
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_DEBUG( "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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Class to hold for each event collections needed in the TrkAnalsis.
Tool to handle all required tracks and truth particle quality selections in this package.
const std::vector< const xAOD::TrackParticle * > & offlTrackVec(Stage stage=FULL)
StatusCode fillTrigTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Trigger tracks.
const std::vector< const xAOD::TrackParticle * > & trigTrackVec(Stage stage=FULL)
const std::string & anaTag()
— Getter methods —
std::string printInfo(Stage stage=FULL, bool printVertex=true) const
print information about tracks in the collection(s)
StatusCode fillTruthPartVec(const std::vector< const xAOD::TruthParticle * > &vec, Stage stage=FULL)
fill truth/offline/trigger track vector (TEST or REFERENCE)
const std::vector< const xAOD::TruthParticle * > & truthPartVec(Stage stage=FULL)
get truth/offline/trigger track vector (TEST or REFERENCE)
StatusCode fillOfflTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Offline tracks.
ToolHandle< ITrackSelectionTool > m_offlineSelectionTool
virtual StatusCode selectTracks(TrackAnalysisCollections &trkAnaColls) override
Main Track selection method.
virtual StatusCode initialize() override
Initialize.
ToolHandle< ITrackSelectionTool > m_objSelectionTool
ToolHandle< ITrackSelectionTool > m_truthSelectionTool
TrackQualitySelectionTool(const std::string &name)
Constructor.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition AsgTool.h:133