ATLAS Offline Software
Loading...
Searching...
No Matches
CaloBasedRoICreatorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace ActsTrk {
8
10 const std::string& name,
11 const IInterface* parent)
12 : base_class(type, name, parent)
13{}
14
16{
17 ATH_MSG_DEBUG("Inizializing " << name() << " ..." );
18
19 ATH_CHECK(m_caloClusterROIKey.initialize());
20 ATH_CHECK(m_beamSpotKey.initialize());
21
22 return StatusCode::SUCCESS;
23}
24
25StatusCode CaloBasedRoICreatorTool::defineRegionsOfInterest(const EventContext& ctx,
26 TrigRoiDescriptorCollection& collectionRoI) const
27{
28 // Define RoI as not a FS RoI
29 collectionRoI.push_back( new TrigRoiDescriptor(false) );
30 // Define RoI as composite RoI
31 collectionRoI.back()->setComposite(true);
32
33 // Retrieve Beam Spot data
35 ATH_CHECK( beamSpotHandle.isValid() );
36 const InDet::BeamSpotData* beamSpotData = beamSpotHandle.cptr();
37
38 // Retrieve the Calo info
39 ATH_MSG_DEBUG("Retrieving Calo info from key " << m_caloClusterROIKey.key());
41 ATH_CHECK( caloClustersHandle.isValid() );
42 const ROIPhiRZContainer* caloClusters = caloClustersHandle.cptr();
43 ATH_MSG_DEBUG(" \\__ Retrieved " << caloClusters->size() << " elements");
44
45 // Add component RoIs
46 collectionRoI.back()->reserve(caloClusters->size());
47 double beamZ = beamSpotData->beamVtx().position().z();
48 for (const ROIPhiRZ& calo_roi : *caloClusters) {
49 double phi = calo_roi.phi();
50 // skip duplicates < -pi and >pi
51 if (std::abs(phi) >= M_PI && phi != -M_PI)
52 continue;
53
54 double eta = calo_roi.eta();
55 double z = beamZ;
56 double roiPhiMin = phi - m_deltaPhi;
57 double roiPhiMax = phi + m_deltaPhi;
58 double roiEtaMin = eta - m_deltaEta;
59 double roiEtaMax = eta + m_deltaEta;
60 double roiZMin = beamZ - m_deltaZ;
61 double roiZMax = beamZ + m_deltaZ;
62
63 collectionRoI.back()->push_back( new TrigRoiDescriptor(eta, roiEtaMin, roiEtaMax,
64 phi, roiPhiMin ,roiPhiMax,
65 z, roiZMin, roiZMax ) );
66 }
67
68 ATH_MSG_DEBUG("Created composite RoI from Calo with " << collectionRoI.back()->size() << " RoIs");
69 return StatusCode::SUCCESS;
70}
71
72}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Current TrigRoiDescriptor
#define z
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
SG::ReadHandleKey< ROIPhiRZContainer > m_caloClusterROIKey
virtual StatusCode initialize() override
CaloBasedRoICreatorTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode defineRegionsOfInterest(const EventContext &ctx, TrigRoiDescriptorCollection &collectionRoI) const override
const T * back() const
Access the last element in the collection as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const Trk::RecVertex & beamVtx() const noexcept
container for phi sorted ROIs defined by phi, r and z.
void push_back(const IRoiDescriptor *roi)
add a RoiDescriptor
void reserve(size_t s)
reserve elements in vector
void setComposite(bool b=true)
virtual unsigned size() const override final
number of constituents
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
const Amg::Vector3D & position() const
return position of vertex
Definition Vertex.cxx:63
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())