ATLAS Offline Software
CaloBasedRoICreatorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace 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 
21 
22  return StatusCode::SUCCESS;
23 }
24 
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(" \\__ Retrived " << 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 }
ActsTrk::CaloBasedRoICreatorTool::CaloBasedRoICreatorTool
CaloBasedRoICreatorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CaloBasedRoICreatorTool.cxx:9
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ActsTrk::CaloBasedRoICreatorTool::m_deltaEta
Gaudi::Property< double > m_deltaEta
Definition: CaloBasedRoICreatorTool.h:42
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ROIPhiRZContainer
container for phi sorted ROIs defined by phi, r and z.
Definition: ROIPhiRZContainer.h:50
M_PI
#define M_PI
Definition: ActiveFraction.h:11
RoiDescriptor::size
virtual unsigned size() const override final
number of constituents
Definition: RoiDescriptor.h:145
InDet::BeamSpotData::beamVtx
const Trk::RecVertex & beamVtx() const noexcept
Definition: BeamSpotData.h:79
ActsTrk::CaloBasedRoICreatorTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: CaloBasedRoICreatorTool.h:38
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
RoiDescriptor::push_back
void push_back(const IRoiDescriptor *roi)
add a RoiDescriptor
Definition: RoiDescriptor.h:157
RoiDescriptor::reserve
void reserve(size_t s)
reserve elements in vector
Definition: RoiDescriptor.h:154
z
#define z
ActsTrk::CaloBasedRoICreatorTool::initialize
virtual StatusCode initialize() override
Definition: CaloBasedRoICreatorTool.cxx:15
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
ActsTrk::CaloBasedRoICreatorTool::m_caloClusterROIKey
SG::ReadHandleKey< ROIPhiRZContainer > m_caloClusterROIKey
Definition: CaloBasedRoICreatorTool.h:34
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloBasedRoICreatorTool.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
Trk::Vertex::position
const Amg::Vector3D & position() const
return position of vertex
Definition: Vertex.cxx:72
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ActsTrk::CaloBasedRoICreatorTool::m_deltaPhi
Gaudi::Property< double > m_deltaPhi
Definition: CaloBasedRoICreatorTool.h:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDet::BeamSpotData
Definition: BeamSpotData.h:21
TrigRoiDescriptorCollection
Definition: TrigRoiDescriptorCollection.h:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RoiDescriptor::setComposite
void setComposite(bool b=true)
Definition: RoiDescriptor.h:138
ActsTrk::CaloBasedRoICreatorTool::m_deltaZ
Gaudi::Property< double > m_deltaZ
Definition: CaloBasedRoICreatorTool.h:46
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
ActsTrk::CaloBasedRoICreatorTool::defineRegionsOfInterest
virtual StatusCode defineRegionsOfInterest(const EventContext &ctx, TrigRoiDescriptorCollection &collectionRoI) const override
Definition: CaloBasedRoICreatorTool.cxx:25
ROIPhiRZ
Definition: ROIPhiRZContainer.h:19