ATLAS Offline Software
RegSelEtaPhiLUT.h
Go to the documentation of this file.
1 // emacs: this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2018 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 // $Id: RegSelEtaPhiLUT.h, v0.0 Sat 25 Jun 2011 18:47:25 BST sutt $
31 
32 
33 #ifndef REGSELETAPHILUT_H
34 #define REGSELETAPHILUT_H
35 
36 #include <iostream>
37 #include <vector>
38 #include <set>
39 
40 #include "RegSelLUT/RegSelRoI.h"
43 
44 
45 
47 
48 public:
49 
52 
55  typedef std::set<EtaPhiModule> moduleset;
56 
59 
60 public:
61 
66  RegSelEtaPhiLUT(int Neta=3, int Nphi=32);
67 
69  virtual ~RegSelEtaPhiLUT();
70 
71 
74  bool addModule( EtaPhiModule& m );
75 
76 
79  void getModules( const RegSelRoI& roi,
80  std::vector<IdentifierHash>& hashids,
81  double r=600 ) const;
82 
83 
86  const std::vector< std::vector< map_element > >& map() const { return m_grandmap.payload(); };
87 
88 
92  const EtaPhiBase getElements( const RegSelRoI& roi, std::set<EtaPhiModule>& modules, double idradius=600 ) const;
93 
94 private:
95 
98  void getRowElements( const EtaPhiBase& virtual_roi,
99  const std::vector< map_element >& row,
100  int first_phi, int last_phi,
101  std::set<EtaPhiModule>& modules ) const {
102 
103  for ( int j=first_phi ; j<=last_phi ; j++ ) {
104 
106  const map_element& tower = row[j];
107 
108  moduleset::const_iterator rpitr=tower.payload().begin();
109  moduleset::const_iterator rpend=tower.payload().end();
110 
111  while ( rpitr!=rpend ) {
112  if ( virtual_roi.overlap( *rpitr ) ) modules.insert( *rpitr );
113  rpitr++;
114  }
115  }
116  }
117 
118 
119 private:
120 
123  double m_etamin;
124  double m_etamax;
125 
126  int m_Neta;
127 
129  double m_ideta;
130 
131  double m_phimin;
132  double m_phimax;
133 
134  int m_Nphi;
135 
137  double m_idphi;
138 
142 
143 };
144 
145 
146 
147 inline std::ostream& operator<<( std::ostream& s, const RegSelEtaPhiLUT& f ) {
148 
149  for ( unsigned i=0 ; i<f.map().size() ; i++ ) {
150 
151  const std::vector< RegSelEtaPhiLUT::map_element >& row = f.map()[i];
152 
153  s << "row " << i << std::endl;
154 
155  for ( unsigned j=0 ; j<row.size() ; j++ ) {
156 
157  const RegSelEtaPhiLUT::map_element& tower = row[j];
158 
159  s << "\t" << j << "\t" << (EtaPhiBase)tower << " \t:";
160 
161  RegSelEtaPhiLUT::moduleset::const_iterator rpitr=tower.payload().begin();
162  RegSelEtaPhiLUT::moduleset::const_iterator rpend=tower.payload().end();
163 
164  while ( rpitr!=rpend ) {
165  s << "\t" << (EtaPhiBase)(*rpitr);
166  rpitr++;
167  }
168 
169  s << std::endl;
170  }
171 
172  s << std::endl;
173 
174  }
175 
176  return s;
177 }
178 
179 #endif // __REGSELETAPHILUT_H
180 
181 
182 
183 
184 
185 
186 
187 
188 
189 
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:141
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:98
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
RegSelEtaPhiLUT::m_Nphi
int m_Nphi
Definition: RegSelEtaPhiLUT.h:134
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:124
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:126
RegSelEtaPhiLUT::EtaPhiModule
TRegSelEtaPhiModule< IdentifierHash > EtaPhiModule
Concrete data type.
Definition: RegSelEtaPhiLUT.h:51
RegSelEtaPhiLUT::m_ideta
double m_ideta
inverse eta element size
Definition: RegSelEtaPhiLUT.h:129
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:86
RegSelEtaPhiLUT::m_idphi
double m_idphi
inverse phi element size
Definition: RegSelEtaPhiLUT.h:137
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:147
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:92
RegSelRoI
Definition: RegSelRoI.h:32
RegSelEtaPhiLUT::m_phimin
double m_phimin
Definition: RegSelEtaPhiLUT.h:131
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:132
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:55
RegSelEtaPhiLUT::map_element
TRegSelEtaPhiModule< moduleset > map_element
element type from which the look up table is built
Definition: RegSelEtaPhiLUT.h:58
RegSelEtaPhiLUT
Definition: RegSelEtaPhiLUT.h:46
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:123
RegSelRoI.h