ATLAS Offline Software
Loading...
Searching...
No Matches
RoIPEBInfoWriterTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include <algorithm>
8#include <unordered_map>
9#include <string_view>
11
12// =============================================================================
13
14RoIPEBInfoWriterTool::RoIPEBInfoWriterTool(const std::string& type, const std::string& name, const IInterface* parent)
15: PEBInfoWriterToolBase(type,name,parent) {}
16
17// =============================================================================
18
20 ATH_MSG_DEBUG("Initialising RoIPEBInfoWriterTool/" << name());
21
23
24 m_extraPebInfo.robs.insert(m_extraROBs.begin(), m_extraROBs.end());
25 m_extraPebInfo.subdets.insert(m_extraSubDets.begin(), m_extraSubDets.end());
26 ATH_MSG_DEBUG("Extra PEBInfo attached to every passed event: " << m_extraPebInfo);
27
28 return StatusCode::SUCCESS;
29}
30
31// =============================================================================
32
34 // Create output PEBInfo starting from the static extra PEBInfo
36
37 ATH_MSG_DEBUG("Processing RoI " << **(input.roiEL));
38 // Assert we're not being passed a full-scan RoI which makes no sense for RoI-based PEB
39 if ((*input.roiEL)->isFullscan()) {
41 if (not met_feature_vec.empty()) {
42 ATH_MSG_DEBUG("Ignoring MET leg passed to RoIPEBInfoWriterTool");
43 return pebi;
44 } else {
45 ATH_MSG_ERROR("Full-scan RoI passed as input to RoIPEBInfoWriterTool");
46 return {};
47 }
48 }
49
50 float eta = (*input.roiEL)->eta();
51 float etaMin = eta - m_etaWidth;
52 float etaMax = eta + m_etaWidth;
53 // Stop further execution if RoI is entirely outside the max |eta| range
54 if (etaMin > m_etaEdge || etaMax < -m_etaEdge) {
55 ATH_MSG_DEBUG("The eta range (" << etaMin << ", " << etaMax << ") is outside |eta|<" << m_etaEdge
56 << " - skipping this RoI");
57 return pebi;
58 }
59 // Restrict the eta range
60 etaMin = std::max(-m_etaEdge.value(), etaMin);
61 etaMax = std::min( m_etaEdge.value(), etaMax);
62
63 float phi = (*input.roiEL)->phi();
64 float phiMin = CxxUtils::wrapToPi(phi - m_phiWidth); // range (-pi, pi)
65 float phiMax = CxxUtils::wrapToPi(phi + m_phiWidth); // range (-pi, pi)
66
67 TrigRoiDescriptor roiForPEB(eta, etaMin, etaMax, phi, phiMin, phiMax);
68
69 for (const auto& tool : m_regionSelectorTools) {
70 std::vector<uint32_t> detROBs;
71 tool->lookup(ctx)->ROBIDList(roiForPEB, detROBs);
72 pebi.robs.insert(detROBs.begin(),detROBs.end());
73 }
74
75 ATH_MSG_DEBUG("Created PEBInfo = " << pebi);
76 return pebi;
77}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
PEBInfoWriterToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Gaudi::Property< float > m_etaWidth
Gaudi::Property< std::vector< uint32_t > > m_extraROBs
PEBInfoWriterToolBase::PEBInfo m_extraPebInfo
Static PEB Info which contains ExtraROBs and ExtraSubDets.
virtual PEBInfoWriterToolBase::PEBInfo createPEBInfo(const EventContext &ctx, const PEBInfoWriterToolBase::Input &input) const override
Implementation of PEBInfoWriterToolBase::createPEBInfo.
Gaudi::Property< std::vector< uint32_t > > m_extraSubDets
ToolHandleArray< IRegSelTool > m_regionSelectorTools
virtual StatusCode initialize() override
Implementation of AthAlgTool::initialize()
Gaudi::Property< float > m_etaEdge
RoIPEBInfoWriterTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Gaudi::Property< float > m_phiWidth
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:24
const std::string & featureString()
void findLinks(const Decision *start, const std::string &linkName, std::vector< LinkInfo< T > > &links, unsigned int behaviour=TrigDefs::allFeaturesOfType, std::set< const xAOD::TrigComposite * > *fullyExploredFrom=nullptr)
search back the TC links for the object of type T linked to the one of TC (recursively) Populates pro...
static const unsigned int lastFeatureOfType
Run 3 "enum". Only return the final feature along each route through the navigation.
Helper for azimuthal angle calculations.
Input to the tool's decide method.
Structure holding the list of ROBs and SubDets.