ATLAS Offline Software
Loading...
Searching...
No Matches
TestRoICreatorTool.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
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 // Check consistency
20 // We need at least one entry
21 if (m_eta_center_rois.size() == 0) {
22 ATH_MSG_ERROR("No RoI definition defined, cannot create the test RoI.");
23 return StatusCode::FAILURE;
24 }
25
26 // eta and phi vectors MUST have the same size. z vectors can have 0 size OR the same size as the eta/phi vectors
27 if (m_eta_center_rois.size() != m_phi_center_rois.size() or
30 ATH_MSG_ERROR("Inconsistent definitions for eta/phi vectors. Check their definitions!");
31 return StatusCode::FAILURE;
32 }
33
34 // Now check the z vectors
35 if (m_z_center_rois.size() != m_half_z_width_rois.size()) {
36 ATH_MSG_ERROR("Inconsistent definitions for the z vectors. Check their definitions!");
37 return StatusCode::FAILURE;
38 }
39
40 if (m_z_center_rois.size() != 0 and m_z_center_rois.size() != m_eta_center_rois.size()) {
41 ATH_MSG_ERROR("Z vector is not empty but it is not consistent with the phi/eta counterpart. Check their definitions!");
42 return StatusCode::FAILURE;
43 }
44
45 return StatusCode::SUCCESS;
46}
47
48StatusCode TestRoICreatorTool::defineRegionsOfInterest(const EventContext& /*ctx*/,
49 TrigRoiDescriptorCollection& collectionRoI) const
50{
51 bool isComposite = m_eta_center_rois.size() > 1;
52 // Add a composite RoI
53 if (isComposite) {
54 collectionRoI.push_back( new TrigRoiDescriptor() );
55 collectionRoI.back()->setComposite(true);
56 }
57
58 bool useZconstraint = m_z_center_rois.size() != 0;
59
60 for (std::size_t i(0); i<m_eta_center_rois.size(); ++i) {
61 double eta = m_eta_center_rois.value().at(i);
62 double phi = m_phi_center_rois.value().at(i);
63 double eta_half_width = m_half_eta_width_rois.value().at(i);
64 double phi_half_width = m_half_phi_width_rois.value().at(i);
65
66 TrigRoiDescriptor *toAdd = nullptr;
67 if (not useZconstraint) {
68 toAdd = new TrigRoiDescriptor(eta, eta - eta_half_width, eta + eta_half_width,
69 phi, phi - phi_half_width, phi + phi_half_width);
70 } else {
71 double z = m_z_center_rois.value().at(i);
72 double z_half_width = m_half_z_width_rois.value().at(i);
73 toAdd = new TrigRoiDescriptor(eta, eta - eta_half_width, eta + eta_half_width,
74 phi, phi - phi_half_width, phi + phi_half_width,
75 z, z - z_half_width, z + z_half_width);
76 }
77
78 // if composite roi, add the consituent to it (already in the collection)
79 // if not, the collection is empty and we have to add this one to it
80 if (isComposite) {
81 collectionRoI.back()->push_back( std::move(toAdd) );
82 } else {
83 collectionRoI.push_back( std::move(toAdd) );
84 }
85 }
86
87 ATH_MSG_DEBUG("RoI collection size: " << collectionRoI.size());
88 ATH_MSG_DEBUG("Created a test RoI");
89 if (collectionRoI.back()->composite()) {
90 ATH_MSG_DEBUG("This is a composite RoI made from " << collectionRoI.back()->size() << " constituents");
91 }
92
93 return StatusCode::SUCCESS;
94}
95
96}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Athena::TPCnvVers::Current TrigRoiDescriptor
#define z
TestRoICreatorTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::vector< double > > m_phi_center_rois
virtual StatusCode defineRegionsOfInterest(const EventContext &ctx, TrigRoiDescriptorCollection &collectionRoI) const override
Gaudi::Property< std::vector< double > > m_half_z_width_rois
virtual StatusCode initialize() override
Gaudi::Property< std::vector< double > > m_half_eta_width_rois
Gaudi::Property< std::vector< double > > m_half_phi_width_rois
Gaudi::Property< std::vector< double > > m_z_center_rois
Gaudi::Property< std::vector< double > > m_eta_center_rois
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.
size_type size() const noexcept
Returns the number of elements in the collection.
void push_back(const IRoiDescriptor *roi)
add a RoiDescriptor
void setComposite(bool b=true)
virtual unsigned size() const override final
number of constituents
virtual bool composite() const override final
SuperRoI compatability methods.
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...