ATLAS Offline Software
Loading...
Searching...
No Matches
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
47public:
48
51
54 typedef std::set<EtaPhiModule> moduleset;
55
58
59public:
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
93private:
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
118private:
119
122 double m_etamin;
123 double m_etamax;
124
126
128 double m_ideta;
129
130 double m_phimin;
131 double m_phimax;
132
134
136 double m_idphi;
137
141
142};
143
144
145
146inline 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
std::ostream & operator<<(std::ostream &s, const RegSelEtaPhiLUT &f)
base class, with just the eta-phi limits and the overlap functionality
bool overlap(const EtaPhiBase &e) const
do two eta-phi regions overlap?
bool addModule(EtaPhiModule &m)
add an element, returns true if element added.
double m_ideta
inverse eta element size
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 -...
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
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
virtual ~RegSelEtaPhiLUT()
destructor
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 ...
double m_idphi
inverse phi element size
TRegSelEtaPhiModule< IdentifierHash > EtaPhiModule
Concrete data type.
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
TRegSelEtaPhiModule< moduleset > map_element
element type from which the look up table is built
std::set< EtaPhiModule > moduleset
tower of the actual modules assigned to each element of the lookup table
RegSelEtaPhiLUT(int Neta=3, int Nphi=32)
defines the number of elements in the internal eta-phi element storage NB: these numbers of internal ...
double m_etamin
eta and phi ranges and number of internal book keeping elements in eta and phi directions
template class with payload added NB: >, <, == and != operators should be defined for the payload for...
const T & payload() const
int r
Definition globals.cxx:22