ATLAS Offline Software
Loading...
Searching...
No Matches
ROIPhiRZContainer Class Reference

container for phi sorted ROIs defined by phi, r and z. More...

#include <ROIPhiRZContainer.h>

Inheritance diagram for ROIPhiRZContainer:
Collaboration diagram for ROIPhiRZContainer:

Public Member Functions

bool hasMatchingROI (float phi, double eta, double r, double z, float roi_phi_width, double roi_eta_width) const
 Test whether there is a matching ROI for the given phi and r,z corrected eta.
const_iterator lowerPhiBound (float phi, float roi_phi_width) const
void addROI (const Amg::Vector3D &global_position, float roi_phi_width)
void sort ()

Static Public Member Functions

static double eta (const ROIPhiRZ &roi)
static double theta (const ROIPhiRZ &roi)
static float phi (const ROIPhiRZ &roi)

Public Attributes

elements
 STL member.

Static Protected Member Functions

static double sqr (double a)
static double deltaEta (const ROIPhiRZ &roi, double other_r, double other_z, double other_eta)
 Helper function to compute a z position corrected delta eta.
static bool order (const ROIPhiRZ &a, const ROIPhiRZ &b)
 Helper function to order ROIs defined by phi,r,z by phi.
static ROIPhiRZContainer::const_iterator lowerPhiBound (const ROIPhiRZContainer &rois, float phi, float roi_phi_width)
 Helper function to find the lower bound of ROIs which match |phi - ROI_phi| < ROI_width;.
static bool hasMatchingROI (const ROIPhiRZContainer &rois, float phi, double eta, double r, double z, float roi_phi_width, double roi_eta_width)

Detailed Description

container for phi sorted ROIs defined by phi, r and z.

Collection to hold a phi sorted array containing ROIs defined by phi, r and z, entries with close to 2 pi will also be stored with negaitve phi Thus the lower bound of ROIs with |phi - ROI_phi| < ROI_width, is can be obtained by a binary search for phi-ROI_width

Definition at line 49 of file ROIPhiRZContainer.h.

Member Function Documentation

◆ addROI()

void ROIPhiRZContainer::addROI ( const Amg::Vector3D & global_position,
float roi_phi_width )
inline

Definition at line 63 of file ROIPhiRZContainer.h.

63 {
64
65 float phi = global_position.phi();
66 assert (std::abs(phi)<=M_PI );
67 float z = global_position.z();
68 float r = global_position.perp();
69 if ( std::abs(phi) > M_PI - roi_phi_width) {
70 constexpr float pi_2 = 2*M_PI;
71 float sign_phi_times_2_pi = std::copysign(pi_2,phi);
72 // wrap ROIs close to -pi and pi around. Thus when searching for the lower bound ROI for phi-phi_width
73 // ROIs close to -pi and ROIs close to +pi will be found.
74 this->emplace_back( ROIPhiRZ{phi - sign_phi_times_2_pi, r, z} );
75 }
76 this->emplace_back( ROIPhiRZ{phi, r, z});
77 }
#define M_PI
#define z
static float phi(const ROIPhiRZ &roi)
int r
Definition globals.cxx:22

◆ deltaEta()

double ROIPhiRZContainer::deltaEta ( const ROIPhiRZ & roi,
double other_r,
double other_z,
double other_eta )
inlinestaticprotected

Helper function to compute a z position corrected delta eta.

Definition at line 101 of file ROIPhiRZContainer.h.

101 {
102 //Correct eta of ROI to take into account the z postion of the reference
103 double newR = roi.r() - other_r;
104 double newZ = roi.z() - other_z;
105 double newEta = std::atanh( newZ / std::sqrt( newR*newR + newZ*newZ ) );
106 double delta_eta = std::abs(newEta - other_eta);
107 return delta_eta;
108 }
float r() const
float z() const

◆ eta()

double ROIPhiRZContainer::eta ( const ROIPhiRZ & roi)
inlinestatic

Definition at line 84 of file ROIPhiRZContainer.h.

84 {
85 const double R = roi.r();
86 const double Z = roi.z();
87 return std::atanh( Z / std::sqrt( R*R + Z*Z ) );
88 }
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)

◆ hasMatchingROI() [1/2]

bool ROIPhiRZContainer::hasMatchingROI ( const ROIPhiRZContainer & rois,
float phi,
double eta,
double r,
double z,
float roi_phi_width,
double roi_eta_width )
inlinestaticprotected

Definition at line 129 of file ROIPhiRZContainer.h.

129 {
130 ROIPhiRZContainer::const_iterator start_roi_iter = lowerPhiBound( rois, phi, roi_phi_width);
131 // by construction if the iterator is valid the cluster it is pointing to has a phi larger than phi-roi_phi_width.
132 // So now just check for all clusters which are not too far away in phi whether there is one with a matching eta.
133 for (ROIPhiRZContainer::const_iterator roi_iter = start_roi_iter; roi_iter != rois.end() && roi_iter->phi() < phi + roi_phi_width; ++roi_iter) {
134 if ( deltaEta(*roi_iter, r, z , eta) < roi_eta_width) { return true; }
135 }
136 return false;
137 }
static double deltaEta(const ROIPhiRZ &roi, double other_r, double other_z, double other_eta)
Helper function to compute a z position corrected delta eta.
const_iterator lowerPhiBound(float phi, float roi_phi_width) const
static double eta(const ROIPhiRZ &roi)

◆ hasMatchingROI() [2/2]

bool ROIPhiRZContainer::hasMatchingROI ( float phi,
double eta,
double r,
double z,
float roi_phi_width,
double roi_eta_width ) const
inline

Test whether there is a matching ROI for the given phi and r,z corrected eta.

Definition at line 55 of file ROIPhiRZContainer.h.

55 {
56 return hasMatchingROI(*this,phi,eta,r,z,roi_phi_width,roi_eta_width);
57 }
bool hasMatchingROI(float phi, double eta, double r, double z, float roi_phi_width, double roi_eta_width) const
Test whether there is a matching ROI for the given phi and r,z corrected eta.

◆ lowerPhiBound() [1/2]

ROIPhiRZContainer::const_iterator ROIPhiRZContainer::lowerPhiBound ( const ROIPhiRZContainer & rois,
float phi,
float roi_phi_width )
inlinestaticprotected

Helper function to find the lower bound of ROIs which match |phi - ROI_phi| < ROI_width;.

Parameters
roisthe phi sorted roi container
phithe phi value for which the lower bound of ROIs is desired.
ROIwidth the width of the ROI in phi (must be smaller or equal the width that was used during the creation of the ROI container.
thelower phi bound of ROIs matching |phi - ROI_phi| < ROI_width or rois.end() if there are no matching rois.

Definition at line 120 of file ROIPhiRZContainer.h.

120 {
121 if (phi>M_PI) {
122 phi -= 2*M_PI;
123 }
124 //search first ROI which is greater than phi - row_phi-width i.e. the first ROI which could be within the vicinity of phi
125 return std::upper_bound( rois.begin(), rois.end(), phi-roi_phi_width, [](float value, const ROIPhiRZ &element) { return element.phi() >= value; } );
126 }

◆ lowerPhiBound() [2/2]

const_iterator ROIPhiRZContainer::lowerPhiBound ( float phi,
float roi_phi_width ) const
inline

Definition at line 59 of file ROIPhiRZContainer.h.

59 {
60 return lowerPhiBound( *this, phi, roi_phi_width);
61 }

◆ order()

bool ROIPhiRZContainer::order ( const ROIPhiRZ & a,
const ROIPhiRZ & b )
inlinestaticprotected

Helper function to order ROIs defined by phi,r,z by phi.

Definition at line 112 of file ROIPhiRZContainer.h.

112{ return a.phi() < b.phi(); }
static Double_t a

◆ phi()

float ROIPhiRZContainer::phi ( const ROIPhiRZ & roi)
inlinestatic

Definition at line 92 of file ROIPhiRZContainer.h.

92 {
93 return roi.phi();
94 }
float phi() const

◆ sort()

void ROIPhiRZContainer::sort ( )
inline

Definition at line 79 of file ROIPhiRZContainer.h.

79 {
80 // sort output ROIs by phi
81 std::sort( this->begin(), this->end(), order );
82 }
static bool order(const ROIPhiRZ &a, const ROIPhiRZ &b)
Helper function to order ROIs defined by phi,r,z by phi.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ sqr()

double ROIPhiRZContainer::sqr ( double a)
inlinestaticprotected

Definition at line 97 of file ROIPhiRZContainer.h.

97{ return a * a; }

◆ theta()

double ROIPhiRZContainer::theta ( const ROIPhiRZ & roi)
inlinestatic

Definition at line 89 of file ROIPhiRZContainer.h.

89 {
90 return std::atan2(1., roi.z() / roi.r());
91 }

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.


The documentation for this class was generated from the following file: