ATLAS Offline Software
RegSelEtaPhiLUT.h
Go to the documentation of this file.
1 // emacs: this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
5 //
6 // @file RegSelEtaPhiLUT.h
7 //
8 // a look up table for eta-phi space divided up into
9 // a set of elements Neta x Nphi.
10 //
11 // "Modules" are added to the lookup table, and are
12 // stored in each element that they overlap with, so
13 // that all the modules overlapping an internal element
14 // for a tower of modules (actually stored as a set)
15 // as the payload for the element.
16 //
17 // Because RoIs are defined in terms of a z range,
18 // without these z positions, eta coordinates are
19 // not well defined.
20 // As a result, when passed an RoI, this class calculates
21 // a virtual RoI, just in eta-phi space, where the eta
22 // range corresponds to the maxuimum and minimum eta
23 // possible from any z position with the RoI where the
24 // object can be completely contained within a user
25 // specified radius. The default value is 600mm, chosen
26 // to completely contain the outer radius of the SCT
27 //
28 //
29 //
30 
31 
32 #ifndef REGSELETAPHILUT_H
33 #define REGSELETAPHILUT_H
34 
35 #include <iostream>
36 #include <vector>
37 #include <set>
38 
39 #include "RegSelLUT/RegSelRoI.h"
42 
43 
44 
46 
47 public:
48 
51 
54  typedef std::set<EtaPhiModule> moduleset;
55 
58 
59 public:
60 
65  RegSelEtaPhiLUT(int Neta=3, int Nphi=32);
66 
68  virtual ~RegSelEtaPhiLUT();
69 
70 
73  bool addModule( EtaPhiModule& m );
74 
75 
78  void getModules( const RegSelRoI& roi,
79  std::vector<IdentifierHash>& hashids,
80  double r=600 ) const;
81 
82 
85  const std::vector< std::vector< map_element > >& map() const { return m_grandmap.payload(); };
86 
87 
91  const EtaPhiBase getElements( const RegSelRoI& roi, std::set<EtaPhiModule>& modules, double idradius=600 ) const;
92 
93 private:
94 
97  void getRowElements( const EtaPhiBase& virtual_roi,
98  const std::vector< map_element >& row,
99  int first_phi, int last_phi,
100  std::set<EtaPhiModule>& modules ) const {
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  }
116 
117 
118 private:
119 
122  double m_etamin;
123  double m_etamax;
124 
125  int m_Neta;
126 
128  double m_ideta;
129 
130  double m_phimin;
131  double m_phimax;
132 
133  int m_Nphi;
134 
136  double m_idphi;
137 
141 
142 };
143 
144 
145 
146 inline std::ostream& operator<<( std::ostream& s, const RegSelEtaPhiLUT& f ) {
147 
148  for ( unsigned i=0 ; i<f.map().size() ; i++ ) {
149 
150  const std::vector< RegSelEtaPhiLUT::map_element >& row = f.map()[i];
151 
152  s << "row " << i << std::endl;
153 
154  for ( unsigned j=0 ; j<row.size() ; j++ ) {
155 
156  const RegSelEtaPhiLUT::map_element& tower = row[j];
157 
158  s << "\t" << j << "\t" << (EtaPhiBase)tower << " \t:";
159 
160  RegSelEtaPhiLUT::moduleset::const_iterator rpitr=tower.payload().begin();
161  RegSelEtaPhiLUT::moduleset::const_iterator rpend=tower.payload().end();
162 
163  while ( rpitr!=rpend ) {
164  s << "\t" << (EtaPhiBase)(*rpitr);
165  ++rpitr;
166  }
167 
168  s << std::endl;
169  }
170 
171  s << std::endl;
172 
173  }
174 
175  return s;
176 }
177 
178 #endif // __REGSELETAPHILUT_H
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
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.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
RegSelEtaPhiLUT::m_etamax
double m_etamax
Definition: RegSelEtaPhiLUT.h:123
TRegSelEtaPhiModule
template class with payload added NB: >, <, == and != operators should be defined for the payload for...
Definition: RegSelEtaPhiModule.h:125
EtaPhiBase
base class, with just the eta-phi limits and the overlap functionality
Definition: RegSelEtaPhiModule.h:27
RegSelEtaPhiLUT::m_Neta
int m_Neta
Definition: RegSelEtaPhiLUT.h:125
RegSelEtaPhiLUT::EtaPhiModule
TRegSelEtaPhiModule< IdentifierHash > EtaPhiModule
Concrete data type.
Definition: RegSelEtaPhiLUT.h:50
RegSelEtaPhiLUT::m_ideta
double m_ideta
inverse eta element size
Definition: RegSelEtaPhiLUT.h:128
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 ...
Definition: RegSelEtaPhiLUT.cxx:38
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
RegSelEtaPhiModule.h
RegSelEtaPhiLUT::getModules
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
Definition: RegSelEtaPhiLUT.cxx:137
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
operator<<
std::ostream & operator<<(std::ostream &s, const RegSelEtaPhiLUT &f)
Definition: RegSelEtaPhiLUT.h:146
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
hist_file_dump.f
f
Definition: hist_file_dump.py:135
RegSelRoI
Definition: RegSelRoI.h:32
RegSelEtaPhiLUT::m_phimin
double m_phimin
Definition: RegSelEtaPhiLUT.h:130
IdentifierHash.h
RegSelEtaPhiLUT::addModule
bool addModule(EtaPhiModule &m)
add an element, returns true if element added.
Definition: RegSelEtaPhiLUT.cxx:87
RegSelEtaPhiLUT::m_phimax
double m_phimax
Definition: RegSelEtaPhiLUT.h:131
RegSelEtaPhiLUT::~RegSelEtaPhiLUT
virtual ~RegSelEtaPhiLUT()
destructor
Definition: RegSelEtaPhiLUT.cxx:80
TRegSelEtaPhiModule::payload
const T & payload() const
Definition: RegSelEtaPhiModule.h:134
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
Definition: RegSelEtaPhiLUT.h:45
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.h