ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
RegSelEtaPhiLUT Class Reference

#include <RegSelEtaPhiLUT.h>

Collaboration diagram for RegSelEtaPhiLUT:

Public Types

typedef TRegSelEtaPhiModule< IdentifierHashEtaPhiModule
 Concrete data type. More...
 
typedef std::set< EtaPhiModulemoduleset
 tower of the actual modules assigned to each element of the lookup table More...
 
typedef TRegSelEtaPhiModule< modulesetmap_element
 element type from which the look up table is built More...
 

Public Member Functions

 RegSelEtaPhiLUT (int Neta=3, int Nphi=32)
 defines the number of elements in the internal eta-phi element storage NB: these numbers of internal elements, 3, 32, have been optimised for 0.2 x 0.2 rois with 32 x 32 modules More...
 
virtual ~RegSelEtaPhiLUT ()
 destructor More...
 
bool addModule (EtaPhiModule &m)
 add an element, returns true if element added. More...
 
void getModules (const RegSelRoI &roi, std::vector< IdentifierHash > &hashids, double r=600) const
 get back a vector of the payload for each of the eta-phi segments that overlap with this roi More...
 
const std::vector< std::vector< map_element > > & map () const
 access the actual complete map - shouldn't be public really, is only so for the ostream streamer
More...
 
const EtaPhiBase getElements (const RegSelRoI &roi, std::set< EtaPhiModule > &modules, double idradius=600) const
 get the modules from the elements, returns the virtual eta-phi roi corresponding to the virtual eta - phi region of the roi NB: Could return the number of eta-phi modules found rather than the virtual roi More...
 

Private Member Functions

void getRowElements (const EtaPhiBase &virtual_roi, const std::vector< map_element > &row, int first_phi, int last_phi, std::set< EtaPhiModule > &modules) const
 get the modules from the elements in the phi direction, called for each eta slice processed More...
 

Private Attributes

double m_etamin
 eta and phi ranges and number of internal book keeping elements in eta and phi directions More...
 
double m_etamax
 
int m_Neta
 
double m_ideta
 inverse eta element size
More...
 
double m_phimin
 
double m_phimax
 
int m_Nphi
 
double m_idphi
 inverse phi element size More...
 
TRegSelEtaPhiModule< std::vector< std::vector< map_element > > > m_grandmap
 overall map, can get the limits from the object, can have different numbers and different ranges for different phi ranges - should swap eta and phi round probably More...
 

Detailed Description

Definition at line 45 of file RegSelEtaPhiLUT.h.

Member Typedef Documentation

◆ EtaPhiModule

Concrete data type.

Definition at line 50 of file RegSelEtaPhiLUT.h.

◆ map_element

element type from which the look up table is built

Definition at line 57 of file RegSelEtaPhiLUT.h.

◆ moduleset

tower of the actual modules assigned to each element of the lookup table

Definition at line 54 of file RegSelEtaPhiLUT.h.

Constructor & Destructor Documentation

◆ RegSelEtaPhiLUT()

RegSelEtaPhiLUT::RegSelEtaPhiLUT ( int  Neta = 3,
int  Nphi = 32 
)

defines the number of elements in the internal eta-phi element storage NB: these numbers of internal elements, 3, 32, have been optimised for 0.2 x 0.2 rois with 32 x 32 modules

constructor the number of elements in the internal eta-phi element storage

inverse element sizes

Definition at line 38 of file RegSelEtaPhiLUT.cxx.

38  :
39  m_etamin(-3), m_etamax(3), m_Neta(Neta),
40  m_phimin(0), m_phimax(2*M_PI), m_Nphi(Nphi),
42  std::vector< std::vector< map_element > >() )
43 {
47 
48  std::vector< std::vector< map_element > >& tmap = m_grandmap.payload();
49 
50  // std::cout << "RegSelEtaPhiUT::RegSelEtaPhiLUT() Neta " << Neta << "\tNphi " << Nphi << std::endl;
51 
52  moduleset empty_set;
53 
54  for ( int i=0 ; i<m_Neta ; i++ ) {
55 
56  double tetamin = m_etamin+i/m_ideta;
57  double tetamax = m_etamin+(i+1)/m_ideta;
58 
59  std::vector< map_element > row;
60 
61  for ( int j=0 ; j<m_Nphi ; j++ ) {
62  double tphimin = m_phimin+j/m_idphi;
63  double tphimax = m_phimin+(j+1)/m_idphi;
64 
65  map_element m( tetamin, tetamax, tphimin, tphimax, empty_set );
66 
67  row.push_back( m );
68 
69  }
70 
71  tmap.push_back( row );
72 
73  }
74 
75 }

◆ ~RegSelEtaPhiLUT()

RegSelEtaPhiLUT::~RegSelEtaPhiLUT ( )
virtual

destructor

Definition at line 80 of file RegSelEtaPhiLUT.cxx.

80 { }

Member Function Documentation

◆ addModule()

bool RegSelEtaPhiLUT::addModule ( EtaPhiModule m)

add an element, returns true if element added.

Could return the number of eta-phi regions element was added to

first check if it overlaps with look up table at all

only do overlapping bits in eta

wrap in phi

does it overlap phi boundary?

Definition at line 87 of file RegSelEtaPhiLUT.cxx.

87  {
88 
89  // std::cout << "adding... " << m << std::endl;
90 
91  std::vector< std::vector< map_element > >& tmap = m_grandmap.payload();
92 
93  int first_eta = (m.etamin()-m_etamin)*m_ideta;
94  int last_eta = (m.etamax()-m_etamin)*m_ideta;
95 
96  int first_phi = (m.phimin()-m_phimin)*m_idphi;
97  int last_phi = (m.phimax()-m_phimin)*m_idphi;
98 
100  if ( !m_grandmap.overlap( m ) ) return false;
101 
103  if ( first_eta<0 ) first_eta = 0;
104  if ( last_eta>=m_Neta ) last_eta = m_Neta-1;
105 
107  if ( first_phi<0 ) first_phi += m_Nphi;
108  if ( first_phi>=m_Nphi ) first_phi -= m_Nphi;
109 
110  if ( last_phi<0 ) last_phi += m_Nphi;
111  if ( last_phi>=m_Nphi ) last_phi -= m_Nphi;
112 
113 
115  if ( first_phi<last_phi ) {
116  for ( int i=int(first_eta) ; i<=last_eta ; i++ ) {
117  for ( int j=int(first_phi) ; j<=last_phi ; j++ ) tmap[i][j].payload().insert( m );
118  }
119  }
120  else {
121  for ( int i=int(first_eta) ; i<=last_eta ; i++ ) {
122  for ( int j=0 ; j<=int(last_phi) ; j++ ) tmap[i][j].payload().insert( m );
123  for ( int j=first_phi ; j<m_Nphi ; j++ ) tmap[i][j].payload().insert( m );
124  }
125  }
126 
127  // std::cout << "added" << std::endl;
128 
129  return true;
130 }

◆ getElements()

const EtaPhiBase RegSelEtaPhiLUT::getElements ( const RegSelRoI roi,
std::set< EtaPhiModule > &  modules,
double  idradius = 600 
) const

get the modules from the elements, returns the virtual eta-phi roi corresponding to the virtual eta - phi region of the roi NB: Could return the number of eta-phi modules found rather than the virtual roi

add an element, returns the virtual eta-phi roi corresponding to the eta phi region of the roi NB: Could return the number of eta-phi modules found rather than the virtual roi

create a virtual roi for the input roi

check roi overlaps with the lookup table

don't have to cover the first_eta>=m_Neta case, etc as that is dealt with by the overlap test earlier

wrap in phi

does the roi overlap the phi boundary?

Definition at line 167 of file RegSelEtaPhiLUT.cxx.

169  {
170 
171  modules.clear();
172 
173  // struct timeval timer = simpletimer_start();
174 
176  const EtaPhiBase virtual_roi( roi.etaMinLimit(idradius), roi.etaMaxLimit(idradius),
177  roi.getphiMin(), roi.getphiMax() );
178 
179  // double time = simpletimer_stop( timer );
180 
182  bool inmap = m_grandmap.overlap( virtual_roi );
183 
184  if ( !inmap ) return virtual_roi;
185 
186  int first_phi = (virtual_roi.phimin()-m_phimin)*m_idphi;
187  int last_phi = (virtual_roi.phimax()-m_phimin)*m_idphi;
188 
189  int first_eta = (virtual_roi.etamin()-m_etamin)*m_ideta;
190  int last_eta = (virtual_roi.etamax()-m_etamin)*m_ideta;
191 
194  if ( first_eta<0 ) first_eta = 0;
195  if ( last_eta>=m_Neta ) last_eta = m_Neta-1;
196 
198  if ( first_phi<0 ) first_phi += m_Nphi;
199  if ( first_phi>=m_Nphi ) first_phi -= m_Nphi;
200 
201  if ( last_phi<0 ) last_phi += m_Nphi;
202  if ( last_phi>=m_Nphi ) last_phi -= m_Nphi;
203 
204  const std::vector< std::vector< map_element > >& tmap = map();
205 
207  if ( first_phi<last_phi ) {
208  for ( int i=first_eta ; i<=last_eta ; i++ ) {
209  getRowElements( virtual_roi, tmap[i], first_phi, last_phi, modules );
210  }
211  }
212  else {
213  for ( int i=first_eta ; i<=last_eta ; i++ ) {
214  getRowElements( virtual_roi, tmap[i], 0, last_phi, modules );
215  getRowElements( virtual_roi, tmap[i], first_phi, m_Nphi-1, modules );
216  }
217  }
218 
219  return virtual_roi;
220 }

◆ getModules()

void RegSelEtaPhiLUT::getModules ( const RegSelRoI roi,
std::vector< IdentifierHash > &  hashids,
double  r = 600 
) const

get back a vector of the payload for each of the eta-phi segments that overlap with this roi

Definition at line 137 of file RegSelEtaPhiLUT.cxx.

139  {
140 
141  hashids.clear();
142 
143  std::set<EtaPhiModule> modules;
144 
145  getElements( roi, modules, r );
146 
147  hashids.reserve( modules.size() );
148 
149  std::set<EtaPhiModule>::iterator rpitr=modules.begin();
150  std::set<EtaPhiModule>::iterator rpend=modules.end();
151 
152  while ( rpitr!=rpend ) {
153  hashids.push_back( rpitr->payload() );
154  ++rpitr;
155  }
156 
157 }

◆ getRowElements()

void RegSelEtaPhiLUT::getRowElements ( const EtaPhiBase virtual_roi,
const std::vector< map_element > &  row,
int  first_phi,
int  last_phi,
std::set< EtaPhiModule > &  modules 
) const
inlineprivate

get the modules from the elements in the phi direction, called for each eta slice processed

here, need to iterate over all the modules in the region and test whether they overlap with the roi

Definition at line 97 of file RegSelEtaPhiLUT.h.

100  {
101 
102  for ( int j=first_phi ; j<=last_phi ; j++ ) {
103 
105  const map_element& tower = row[j];
106 
107  moduleset::const_iterator rpitr=tower.payload().begin();
108  moduleset::const_iterator rpend=tower.payload().end();
109 
110  while ( rpitr!=rpend ) {
111  if ( virtual_roi.overlap( *rpitr ) ) modules.insert( *rpitr );
112  ++rpitr;
113  }
114  }
115  }

◆ map()

const std::vector< std::vector< map_element > >& RegSelEtaPhiLUT::map ( ) const
inline

access the actual complete map - shouldn't be public really, is only so for the ostream streamer

Definition at line 85 of file RegSelEtaPhiLUT.h.

85 { return m_grandmap.payload(); };

Member Data Documentation

◆ m_etamax

double RegSelEtaPhiLUT::m_etamax
private

Definition at line 123 of file RegSelEtaPhiLUT.h.

◆ m_etamin

double RegSelEtaPhiLUT::m_etamin
private

eta and phi ranges and number of internal book keeping elements in eta and phi directions

Definition at line 122 of file RegSelEtaPhiLUT.h.

◆ m_grandmap

TRegSelEtaPhiModule< std::vector< std::vector< map_element > > > RegSelEtaPhiLUT::m_grandmap
private

overall map, can get the limits from the object, can have different numbers and different ranges for different phi ranges - should swap eta and phi round probably

Definition at line 140 of file RegSelEtaPhiLUT.h.

◆ m_ideta

double RegSelEtaPhiLUT::m_ideta
private

inverse eta element size

Definition at line 128 of file RegSelEtaPhiLUT.h.

◆ m_idphi

double RegSelEtaPhiLUT::m_idphi
private

inverse phi element size

Definition at line 136 of file RegSelEtaPhiLUT.h.

◆ m_Neta

int RegSelEtaPhiLUT::m_Neta
private

Definition at line 125 of file RegSelEtaPhiLUT.h.

◆ m_Nphi

int RegSelEtaPhiLUT::m_Nphi
private

Definition at line 133 of file RegSelEtaPhiLUT.h.

◆ m_phimax

double RegSelEtaPhiLUT::m_phimax
private

Definition at line 131 of file RegSelEtaPhiLUT.h.

◆ m_phimin

double RegSelEtaPhiLUT::m_phimin
private

Definition at line 130 of file RegSelEtaPhiLUT.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
RegSelEtaPhiLUT::getElements
const EtaPhiBase getElements(const RegSelRoI &roi, std::set< EtaPhiModule > &modules, double idradius=600) const
get the modules from the elements, returns the virtual eta-phi roi corresponding to the virtual eta -...
Definition: RegSelEtaPhiLUT.cxx:167
RegSelEtaPhiLUT::m_grandmap
TRegSelEtaPhiModule< std::vector< std::vector< map_element > > > m_grandmap
overall map, can get the limits from the object, can have different numbers and different ranges for ...
Definition: RegSelEtaPhiLUT.h:140
query_example.row
row
Definition: query_example.py:24
beamspotman.r
def r
Definition: beamspotman.py:676
RegSelEtaPhiLUT::getRowElements
void getRowElements(const EtaPhiBase &virtual_roi, const std::vector< map_element > &row, int first_phi, int last_phi, std::set< EtaPhiModule > &modules) const
get the modules from the elements in the phi direction, called for each eta slice processed
Definition: RegSelEtaPhiLUT.h:97
RegSelEtaPhiLUT::m_Nphi
int m_Nphi
Definition: RegSelEtaPhiLUT.h:133
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
RegSelEtaPhiLUT::m_etamax
double m_etamax
Definition: RegSelEtaPhiLUT.h:123
EtaPhiBase
base class, with just the eta-phi limits and the overlap functionality
Definition: RegSelEtaPhiModule.h:27
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
RegSelEtaPhiLUT::m_Neta
int m_Neta
Definition: RegSelEtaPhiLUT.h:125
RegSelEtaPhiLUT::m_ideta
double m_ideta
inverse eta element size
Definition: RegSelEtaPhiLUT.h:128
M_PI
#define M_PI
Definition: ActiveFraction.h:11
RegSelEtaPhiLUT::map
const std::vector< std::vector< map_element > > & map() const
access the actual complete map - shouldn't be public really, is only so for the ostream streamer
Definition: RegSelEtaPhiLUT.h:85
RegSelEtaPhiLUT::m_idphi
double m_idphi
inverse phi element size
Definition: RegSelEtaPhiLUT.h:136
RegSelRoI::getphiMax
double getphiMax() const
Definition: RegSelRoI.h:62
EtaPhiBase::overlap
bool overlap(const EtaPhiBase &e) const
do two eta-phi regions overlap?
Definition: RegSelEtaPhiModule.h:63
lumiFormat.i
int i
Definition: lumiFormat.py:85
RegSelRoI::getphiMin
double getphiMin() const
Definition: RegSelRoI.h:61
RegSelEtaPhiLUT::m_phimin
double m_phimin
Definition: RegSelEtaPhiLUT.h:130
RegSelRoI::etaMaxLimit
double etaMaxLimit(double r) const
find the max eta limits for an object fully contained within an roi, bounded with the specifed radius
Definition: RegSelRoI.h:94
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
RegSelEtaPhiLUT::m_phimax
double m_phimax
Definition: RegSelEtaPhiLUT.h:131
RegSelEtaPhiLUT::moduleset
std::set< EtaPhiModule > moduleset
tower of the actual modules assigned to each element of the lookup table
Definition: RegSelEtaPhiLUT.h:54
RegSelEtaPhiLUT::map_element
TRegSelEtaPhiModule< moduleset > map_element
element type from which the look up table is built
Definition: RegSelEtaPhiLUT.h:57
RegSelEtaPhiLUT::m_etamin
double m_etamin
eta and phi ranges and number of internal book keeping elements in eta and phi directions
Definition: RegSelEtaPhiLUT.h:122
RegSelRoI::etaMinLimit
double etaMinLimit(double r) const
find the min eta limits for an object fully contained within an roi, bounded with the specifed radius
Definition: RegSelRoI.h:83