ATLAS Offline Software
Loading...
Searching...
No Matches
ViewCreatorJetSuperROITool.cxx
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
9
12
14 const std::string& name,
15 const IInterface* parent)
16 : base_class(type, name, parent)
17{}
18
19
21 ATH_CHECK( m_roisWriteHandleKey.initialize() );
22
23 return StatusCode::SUCCESS;
24}
25
26
28 const EventContext& ctx ) const {
29
30 // ===================================================================================== //
31 // ===================================================================================== //
32 // Create output RoI collection
33
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
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());
110 outputDecision->setObjectLink( TrigCompositeUtils::roiString(), roiEL );
111
112 ATH_MSG_DEBUG("PRINTING DECISION");
113 ATH_MSG_DEBUG( *outputDecision );
114
115 return StatusCode::SUCCESS;
116}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Current TrigRoiDescriptor
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Property< double > m_roiEtaWidth
Gaudi::Property< double > m_roiPhiWidth
virtual StatusCode initialize() override
virtual StatusCode attachROILinks(TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
Tool interface method.
Gaudi::Property< double > m_jetMinPt
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Gaudi::Property< double > m_roiZWidth
ViewCreatorJetSuperROITool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< double > m_jetMaxAbsEta
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:24
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
const std::string & roiString()
LinkInfo< T > findLink(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...
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Helper for azimuthal angle calculations.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition LinkInfo.h:22
ElementLink< T > link
Link to the feature.
Definition LinkInfo.h:55