ATLAS Offline Software
RoiSelectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "RoiSelectionTool.h"
11 
12 
17  const std::string& name ) :
18  asg::AsgTool( name ) { }
19 
20 
25 
27 
28  ATH_MSG_INFO( "Initializing " << name() );
29 
30  ATH_CHECK( m_trigDecTool.retrieve() );
31 
32  return StatusCode::SUCCESS;
33 }
34 
35 
39 std::vector< IDTPM::roiCollection_t > IDTPM::RoiSelectionTool::retrieveRois(
40  const std::string& chainName,
41  const std::string& roiKey,
42  const int& chainLeg ) const {
43 
44  unsigned decisionType = TrigDefs::Physics; // TrigDefs::includeFailedDecisions;
45 
46  unsigned featureType = ( roiKey.empty() ) ?
47  TrigDefs::lastFeatureOfType :
48  TrigDefs::allFeaturesOfType;
49 
50  std::vector< roiCollection_t > rois =
51  m_trigDecTool->features< TrigRoiDescriptorCollection >(
53  chainName,
54  decisionType,
55  roiKey,
56  featureType,
58  chainLeg ) );
59 
60  ATH_MSG_DEBUG( "Retrieved " << rois.size() <<
61  " RoIs for chain " << chainName <<
62  " , RoI key : " << roiKey <<
63  " , leg = " << chainLeg );
64 
65  std::vector< roiCollection_t > selectedRois;
66 
68  for( size_t ir=0 ; ir<rois.size() ; ir++ ) {
69 
72  if( roiKey == "SuperRoi" && ir > 0 ) continue;
73 
74  const ElementLink< TrigRoiDescriptorCollection > thisRoiLink = rois[ir].link;
75 
77  if( !roiKey.empty() && thisRoiLink.dataID() != roiKey ) continue;
78 
79  const TrigRoiDescriptor* const* thisRoi = thisRoiLink.cptr();
80 
82  if( thisRoi == 0 ) continue;
83 
84  ATH_MSG_DEBUG( "Retrieved RoI descriptor for chain " <<
85  chainName << " " << **thisRoi );
86 
87  selectedRois.push_back( rois[ir] );
88 
89  } // close rois loop
90 
91  return selectedRois;
92 }
93 
94 
98 std::vector< IDTPM::roiCollection_t > IDTPM::RoiSelectionTool::getRoisStandard(
99  const std::string& chainName ) const {
100 
101  return retrieveRois( chainName,
102  m_roiKey.value(),
103  m_chainLeg.value() );
104 }
105 
106 
110 std::vector< IDTPM::roiCollection_t > IDTPM::RoiSelectionTool::getRoisTnP(
111  const std::string& chainName ) const {
112 
114  std::vector< roiCollection_t > selectedRoisTag =
115  retrieveRois( chainName,
116  m_roiKeyTag.value(),
117  m_chainLegTag.value() );
118 
120  std::vector< roiCollection_t > selectedRoisProbe =
121  retrieveRois( chainName,
122  m_roiKeyProbe.value(),
123  m_chainLegProbe.value() );
124 
126  //std::vector< roiCollection_t > selectedRois =
127  // m_TnPselectionTool( selectedRoisTag, selectedRoisProbe, tracks );
128  std::vector< roiCollection_t > selectedRois = selectedRoisProbe;
129 
130  return selectedRois;
131 }
132 
133 
137 std::vector< IDTPM::roiCollection_t > IDTPM::RoiSelectionTool::getRois(
138  const std::string& chainName ) const {
139 
140  return ( m_doTnP.value() ) ?
141  getRoisTnP( chainName ) :
142  getRoisStandard( chainName );
143 }
Trig::FeatureRequestDescriptor
Definition: FeatureRequestDescriptor.h:37
IDTPM::RoiSelectionTool::RoiSelectionTool
RoiSelectionTool(const std::string &name)
Constructor.
Definition: RoiSelectionTool.cxx:16
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
asg
Definition: DataHandleTestTool.h:28
RoiSelectionTool.h
Athena includes.
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
IDTPM::RoiSelectionTool::getRois
std::vector< roiCollection_t > getRois(const std::string &chainName) const
Main method to get selected RoIs.
Definition: RoiSelectionTool.cxx:137
IDTPM::RoiSelectionTool::getRoisStandard
std::vector< roiCollection_t > getRoisStandard(const std::string &chainName) const
get selected RoIs (non-Tag&Probe selection)
Definition: RoiSelectionTool.cxx:98
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
IDTPM::RoiSelectionTool::initialize
virtual StatusCode initialize() override
RoiSelectionTool methods.
Definition: RoiSelectionTool.cxx:24
ir
int ir
counter of the current depth
Definition: fastadd.cxx:49
IDTPM::RoiSelectionTool::getRoisTnP
std::vector< roiCollection_t > getRoisTnP(const std::string &chainName) const
get selected RoIs (Tag&Probe selection)
Definition: RoiSelectionTool.cxx:110
TrigRoiDescriptorCollection
Definition: TrigRoiDescriptorCollection.h:21
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:353
TriggerTest.rois
rois
Definition: TriggerTest.py:23
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:878
asg::AsgTool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: AsgTool.h:133
IDTPM::RoiSelectionTool::retrieveRois
std::vector< roiCollection_t > retrieveRois(const std::string &chainName, const std::string &roiKey, const int &chainLeg=-1) const
Retrieve RoIs.
Definition: RoiSelectionTool.cxx:39