ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
eflowRec::EtaPhiLUT Class Reference

2D look up table for eflowRecClusters More...

#include <EtaPhiLUT.h>

Collaboration diagram for eflowRec::EtaPhiLUT:

Public Member Functions

 EtaPhiLUT (unsigned int nbins=50)
 constructor taking the desired binsize More...
 
void fill (eflowRecClusterContainer &clustersin)
 
std::vector< eflowRecCluster * > clustersInCone (float eta, float phi, float dr) const
 collect eflowRecClusters in a given cone More...
 

Private Attributes

unsigned int m_nphiBins
 
float m_phiBinSize
 number of bins More...
 
std::vector< std::vector< eflowRecCluster * > > m_phiBinnedLookUpTable
 bin size More...
 

Detailed Description

2D look up table for eflowRecClusters

Definition at line 26 of file EtaPhiLUT.h.

Constructor & Destructor Documentation

◆ EtaPhiLUT()

eflowRec::EtaPhiLUT::EtaPhiLUT ( unsigned int  nbins = 50)

constructor taking the desired binsize

Definition at line 25 of file EtaPhiLUT.cxx.

25  :
27  m_phiBinSize(TWOPI/m_nphiBins),
29  {}

Member Function Documentation

◆ clustersInCone()

std::vector< eflowRecCluster * > eflowRec::EtaPhiLUT::clustersInCone ( float  eta,
float  phi,
float  dr 
) const

collect eflowRecClusters in a given cone

Definition at line 43 of file EtaPhiLUT.cxx.

43  {
44  std::vector<eflowRecCluster*> result;
45 
46  // Indices corresponding to phi range
47  unsigned int iPhiMin = phiIndex( phiInRange(phi-dr), m_phiBinSize );
48  unsigned int iPhiMax = phiIndex( phiInRange(phi+dr), m_phiBinSize );
49 
50  // Extract index ranges to iterate over
51  std::vector< std::pair<int,int> > iPhiRanges;
52  if( iPhiMin < iPhiMax ) {
53  iPhiRanges.emplace_back(iPhiMin,iPhiMax );
54  } else { // special treatment for phi-wrapping
55  iPhiRanges.emplace_back(0,iPhiMax );
56  iPhiRanges.emplace_back(iPhiMin,m_nphiBins-1 );
57  }
58 
59  float dr2Cut = dr*dr;
60 
61  // loop over ranges
62  for( auto& range : iPhiRanges ){
63  unsigned int indexMin = range.first;
64  unsigned int indexMax = range.second;
65  for( ; indexMin <= indexMax; ++indexMin ){
66  const std::vector<eflowRecCluster*>& phiClusters = m_phiBinnedLookUpTable[indexMin];
67 
68  // Get iterators for clusters in relevant eta range
69  auto it_min = std::lower_bound (phiClusters.begin(), phiClusters.end(), eta-dr, [] (const eflowRecCluster* cl, float etaval) {return cl->getCluster()->eta()<etaval;} );
70  auto it_max = std::upper_bound (it_min, phiClusters.end(), eta+dr, [] (float etaval, const eflowRecCluster* cl) {return etaval<cl->getCluster()->eta();} );
71 
72  // Apply deltaR cut
73  for( ;it_min!=it_max;++it_min ){
74  const xAOD::CaloCluster& xcluster = *(*it_min)->getCluster();
75  float deta = eta - xcluster.eta();
76  float dphi = phiInRange(phi - xcluster.phi());
77  float dr2 = deta*deta + dphi*dphi;
78  if( dr2 < dr2Cut ) result.push_back(*it_min);
79  }
80  }
81  }
82  return result;
83  }

◆ fill()

void eflowRec::EtaPhiLUT::fill ( eflowRecClusterContainer clustersin)

Definition at line 31 of file EtaPhiLUT.cxx.

32  {
33  for(eflowRecCluster* cluster : clustersin) {
34  int index = phiIndex(cluster->getCluster()->phi(), m_phiBinSize);
35  m_phiBinnedLookUpTable[index].push_back(cluster);
36  }
37 
38  for( auto& vec : m_phiBinnedLookUpTable ) {
39  std::stable_sort(vec.begin(),vec.end(),[](const eflowRecCluster* c1, const eflowRecCluster* c2) { return c1->getCluster()->eta() < c2->getCluster()->eta(); });
40  }
41  }

Member Data Documentation

◆ m_nphiBins

unsigned int eflowRec::EtaPhiLUT::m_nphiBins
private

Definition at line 38 of file EtaPhiLUT.h.

◆ m_phiBinnedLookUpTable

std::vector< std::vector<eflowRecCluster*> > eflowRec::EtaPhiLUT::m_phiBinnedLookUpTable
private

bin size

Definition at line 40 of file EtaPhiLUT.h.

◆ m_phiBinSize

float eflowRec::EtaPhiLUT::m_phiBinSize
private

number of bins

Definition at line 39 of file EtaPhiLUT.h.


The documentation for this class was generated from the following files:
eflowRecCluster
This class extends the information about a xAOD::CaloCluster.
Definition: eflowRecCluster.h:40
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
get_generator_info.result
result
Definition: get_generator_info.py:21
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
index
Definition: index.py:1
extractSporadic.c1
c1
Definition: extractSporadic.py:134
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
std::stable_sort
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
Definition: DVL_algorithms.h:711
eflowRec::EtaPhiLUT::m_phiBinSize
float m_phiBinSize
number of bins
Definition: EtaPhiLUT.h:39
eflowRec::EtaPhiLUT::m_nphiBins
unsigned int m_nphiBins
Definition: EtaPhiLUT.h:38
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
eflowRec::phiInRange
float phiInRange(float phi)
hepler function to ensure phi is within +-Pi
Definition: EtaPhiLUT.cxx:16
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
compileRPVLLRates.c2
c2
Definition: compileRPVLLRates.py:361
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
DeMoScan.index
string index
Definition: DeMoScan.py:362
eflowRec::EtaPhiLUT::m_phiBinnedLookUpTable
std::vector< std::vector< eflowRecCluster * > > m_phiBinnedLookUpTable
bin size
Definition: EtaPhiLUT.h:40
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26