ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
DecisionHandling
src
ViewCreatorJetSuperROITool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigSteeringEvent/TrigRoiDescriptorCollection.h
"
6
#include "
AthViews/ViewHelper.h
"
7
#include "
CxxUtils/phihelper.h
"
8
#include "
ViewCreatorJetSuperROITool.h
"
9
10
#include "
xAODJet/JetContainer.h
"
11
#include "
xAODJet/JetAuxContainer.h
"
12
13
ViewCreatorJetSuperROITool::ViewCreatorJetSuperROITool
(
const
std::string&
type
,
14
const
std::string& name,
15
const
IInterface* parent)
16
: base_class(
type
, name, parent)
17
{}
18
19
20
StatusCode
ViewCreatorJetSuperROITool::initialize
() {
21
ATH_CHECK
(
m_roisWriteHandleKey
.initialize() );
22
23
return
StatusCode::SUCCESS;
24
}
25
26
27
StatusCode
ViewCreatorJetSuperROITool::attachROILinks
(
TrigCompositeUtils::DecisionContainer
& decisions,
28
const
EventContext& ctx )
const
{
29
30
// ===================================================================================== //
31
// ===================================================================================== //
32
// Create output RoI collection
33
34
SG::WriteHandle<TrigRoiDescriptorCollection>
roisWriteHandle =
TrigCompositeUtils::createAndStoreNoAux
(
m_roisWriteHandleKey
, ctx);
35
// ===================================================================================== //
36
37
// Only expect one object in container
38
if
(decisions.size()!=1) {
39
ATH_MSG_ERROR
(
"Did not find exactly one decision object in decision container containing "
<< decisions.size() <<
" decisions"
);
40
return
StatusCode::FAILURE;
41
}
42
TrigCompositeUtils::Decision
* outputDecision = decisions[0];
43
44
// Link name should probably be configurable
45
const
TrigCompositeUtils::LinkInfo< xAOD::JetContainer>
leadingjetlink =
TrigCompositeUtils::findLink< xAOD::JetContainer >
(ctx, outputDecision,
"LeadingPreselJet"
,
TrigDefs::lastFeatureOfType
);
46
if
(!leadingjetlink.
link
.
isValid
()) {
47
ATH_MSG_ERROR
(
"Received invalid jet link from decision object! "
<< leadingjetlink.
link
);
48
return
StatusCode::FAILURE;
49
}
50
51
const
xAOD::JetContainer
* jetCont =
static_cast<
const
xAOD::JetContainer
*
>
((*leadingjetlink.
link
)->container());
52
ATH_MSG_DEBUG
(
"Found "
<< jetCont->
size
() <<
" presel jets linked from decision object."
);
53
54
// This is needed to merge the RoIs from each jet
55
std::unique_ptr<TrigRoiDescriptor> superRoI = std::make_unique<TrigRoiDescriptor>();
56
63
superRoI->setComposite(
true
);
64
superRoI->manageConstituents(
false
);
65
66
for
(
const
xAOD::Jet
*
jet
: *jetCont) {
67
if
(
jet
->pt()>
m_jetMinPt
&& std::abs(
jet
->eta())<
m_jetMaxAbsEta
) {
68
double
jetEta{
jet
->eta()}, jetPhi{
jet
->phi()};
69
70
ATH_MSG_DEBUG
(
"JET -- pt="
<<
jet
->pt() <<
71
" eta="
<<
jet
->eta() <<
72
" phi="
<<
jet
->phi() );
73
74
// create ROIs
75
ATH_MSG_DEBUG
(
"Adding RoI to RoI container"
);
76
ATH_MSG_DEBUG
(
" ** Imposing Z constraint while building RoI"
);
77
double
etaMinus = jetEta -
m_roiEtaWidth
;
78
double
etaPlus = jetEta +
m_roiEtaWidth
;
79
80
double
phiMinus =
CxxUtils::wrapToPi
( jetPhi -
m_roiPhiWidth
);
81
double
phiPlus =
CxxUtils::wrapToPi
( jetPhi +
m_roiPhiWidth
);
82
83
84
if
(
m_roiZWidth
> 0 ) {
85
// Should retrieve beamspot offset from somewhere
86
double
zMinus = -1. *
m_roiZWidth
;
87
double
zPlus =
m_roiZWidth
;
88
91
superRoI->push_back(
new
TrigRoiDescriptor
( jetEta, etaMinus, etaPlus,
92
jetPhi, phiMinus, phiPlus,
93
0.,zMinus,zPlus ) );
94
}
95
else
{
96
superRoI->push_back(
new
TrigRoiDescriptor
( jetEta, etaMinus, etaPlus,
97
jetPhi, phiMinus, phiPlus ) );
98
}
99
100
104
superRoI->manageConstituents(
true
);
105
}
106
}
107
108
roisWriteHandle->push_back(superRoI.release());
109
const
ElementLink< TrigRoiDescriptorCollection >
roiEL =
ElementLink< TrigRoiDescriptorCollection >
( *roisWriteHandle, 0, ctx );
110
outputDecision->
setObjectLink
(
TrigCompositeUtils::roiString
(), roiEL );
111
112
ATH_MSG_DEBUG
(
"PRINTING DECISION"
);
113
ATH_MSG_DEBUG
( *outputDecision );
114
115
return
StatusCode::SUCCESS;
116
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
JetAuxContainer.h
JetContainer.h
TrigRoiDescriptorCollection.h
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition
TrigSteeringEventTPCnv.cxx:68
ViewCreatorJetSuperROITool.h
ViewHelper.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink< TrigRoiDescriptorCollection >
ElementLink::isValid
bool isValid() const
Check if the element can be found.
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
ViewCreatorJetSuperROITool::m_roiEtaWidth
Gaudi::Property< double > m_roiEtaWidth
Definition
ViewCreatorJetSuperROITool.h:57
ViewCreatorJetSuperROITool::m_roiPhiWidth
Gaudi::Property< double > m_roiPhiWidth
Definition
ViewCreatorJetSuperROITool.h:60
ViewCreatorJetSuperROITool::initialize
virtual StatusCode initialize() override
Definition
ViewCreatorJetSuperROITool.cxx:20
ViewCreatorJetSuperROITool::attachROILinks
virtual StatusCode attachROILinks(TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
Tool interface method.
Definition
ViewCreatorJetSuperROITool.cxx:27
ViewCreatorJetSuperROITool::m_jetMinPt
Gaudi::Property< double > m_jetMinPt
Definition
ViewCreatorJetSuperROITool.h:50
ViewCreatorJetSuperROITool::m_roisWriteHandleKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Definition
ViewCreatorJetSuperROITool.h:44
ViewCreatorJetSuperROITool::m_roiZWidth
Gaudi::Property< double > m_roiZWidth
Definition
ViewCreatorJetSuperROITool.h:64
ViewCreatorJetSuperROITool::ViewCreatorJetSuperROITool
ViewCreatorJetSuperROITool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
ViewCreatorJetSuperROITool.cxx:13
ViewCreatorJetSuperROITool::m_jetMaxAbsEta
Gaudi::Property< double > m_jetMaxAbsEta
Definition
ViewCreatorJetSuperROITool.h:54
xAOD::TrigComposite_v1::setObjectLink
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
CxxUtils::wrapToPi
constexpr T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition
phihelper.h:31
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition
TrigComposite.h:20
TrigCompositeUtils::roiString
const std::string & roiString()
Definition
TrigCompositeUtils.h:420
TrigCompositeUtils::findLink
LinkInfo< T > findLink(const EventContext &ctx, const Decision *start, const std::string &linkName, const bool suppressMultipleLinksWarning=false)
Perform a recursive search for ElementLinks of type T and name 'linkName', starting from Decision obj...
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition
TrigCompositeContainer.h:21
TrigDefs::lastFeatureOfType
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:68
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
phihelper.h
Helper for azimuthal angle calculations.
type
TrigCompositeUtils::LinkInfo
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition
LinkInfo.h:22
TrigCompositeUtils::LinkInfo::link
ElementLink< T > link
Link to the feature.
Definition
LinkInfo.h:55
Generated on
for ATLAS Offline Software by
1.17.0