ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | List of all members
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. More...
 
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. More...
 

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. More...
 
static bool order (const ROIPhiRZ &a, const ROIPhiRZ &b)
 Helper function to order ROIs defined by phi,r,z by phi. More...
 
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;. More...
 
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  }

◆ deltaEta()

static 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  }

◆ eta()

static 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  }

◆ hasMatchingROI() [1/2]

static 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  }

◆ 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  }

◆ lowerPhiBound() [1/2]

static 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()

static 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(); }

◆ phi()

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

Definition at line 92 of file ROIPhiRZContainer.h.

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

◆ 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  }

◆ sqr()

static double ROIPhiRZContainer::sqr ( double  a)
inlinestaticprotected

Definition at line 97 of file ROIPhiRZContainer.h.

97 { return a * a; }

◆ theta()

static 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:
beamspotman.r
def r
Definition: beamspotman.py:676
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
M_PI
#define M_PI
Definition: ActiveFraction.h:11
ROIPhiRZContainer::phi
static float phi(const ROIPhiRZ &roi)
Definition: ROIPhiRZContainer.h:92
ROIPhiRZContainer::hasMatchingROI
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.
Definition: ROIPhiRZContainer.h:55
athena.value
value
Definition: athena.py:124
ROIPhiRZContainer::eta
static double eta(const ROIPhiRZ &roi)
Definition: ROIPhiRZContainer.h:84
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
ROIPhiRZContainer::lowerPhiBound
const_iterator lowerPhiBound(float phi, float roi_phi_width) const
Definition: ROIPhiRZContainer.h:59
ROIPhiRZ::r
float r() const
Definition: ROIPhiRZContainer.h:35
z
#define z
ROIPhiRZ::phi
float phi() const
Definition: ROIPhiRZContainer.h:32
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
ROIPhiRZContainer::order
static bool order(const ROIPhiRZ &a, const ROIPhiRZ &b)
Helper function to order ROIs defined by phi,r,z by phi.
Definition: ROIPhiRZContainer.h:112
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ROIPhiRZContainer::deltaEta
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.
Definition: ROIPhiRZContainer.h:101
ROIPhiRZ::z
float z() const
Definition: ROIPhiRZContainer.h:38
a
TList * a
Definition: liststreamerinfos.cxx:10
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
TriggerTest.rois
rois
Definition: TriggerTest.py:23
ROIPhiRZ
Definition: ROIPhiRZContainer.h:19