#include <FPGATrackSimRegionMap.h>
|
| | FPGATrackSimRegionMap (const std::vector< std::unique_ptr< FPGATrackSimPlaneMap > > &pmaps, std::string const &filepath, bool m_inclusive) |
| void | loadModuleIDLUT (std::string const &filepath) |
| void | loadRadiiFile (std::string const &radii_file, unsigned layer_offset, unsigned layer_max) |
| const FPGATrackSimPlaneMap * | getPlaneMap (int iRegion) const |
| int | getNRegions () const |
| bool | isModuleIDLUTloaded () const |
| const FPGATrackSimRegionBoundaries & | getRegionBoundaries (int region, int layer, int section) const |
| bool | isInRegion (uint32_t region, const FPGATrackSimHit &hit) const |
| bool | isInRegion (uint32_t region, uint32_t plane, uint32_t section, int eta, int phi) const |
| std::vector< uint32_t > | getRegions (const FPGATrackSimHit &hit) const |
| uint32_t | getUnmappedID (uint32_t region, const FPGATrackSimHit &hit) const |
| uint32_t | getLocalID (uint32_t region, uint32_t layer, uint32_t globalModuleID) const |
| uint32_t | getGlobalID (uint32_t region, uint32_t layer, uint32_t localModuleID) const |
| double | getAvgRadius (unsigned region, unsigned layer) const |
| const std::vector< double > & | getAvgRadii (unsigned region) const |
Definition at line 61 of file FPGATrackSimRegionMap.h.
◆ FPGATrackSimRegionMap()
| FPGATrackSimRegionMap::FPGATrackSimRegionMap |
( |
const std::vector< std::unique_ptr< FPGATrackSimPlaneMap > > & | pmaps, |
|
|
std::string const & | filepath, |
|
|
bool | m_inclusive ) |
Definition at line 29 of file FPGATrackSimRegionMap.cxx.
29 :
32{
33
35 ANA_MSG_INFO(
"Region map set to inclusive mode; will always treat hits as being in region");
38
42 return;
43 }
44
45
46 ifstream
fin(filepath);
48 {
50 throw ("FPGATrackSimRegionMap Couldn't open " + filepath);
51 }
53
54
56
57
58 for (
int region = 0; region <
m_nregions; region++){
60 }
61
62
65}
std::vector< std::vector< std::vector< FPGATrackSimRegionBoundaries > > > m_map
std::vector< std::unique_ptr< FPGATrackSimPlaneMap > > const & m_pmaps
std::vector< std::vector< double > > m_radii_map
void allocateMap(std::ifstream &fin)
void readRegion(std::ifstream &fin, int expected_region)
◆ allocateMap()
| void FPGATrackSimRegionMap::allocateMap |
( |
std::ifstream & | fin | ) |
|
|
private |
Definition at line 68 of file FPGATrackSimRegionMap.cxx.
69{
70 string line, towerKey;
71 bool ok = true;
72
73 ok = ok && getline(fin, line);
75
76 istringstream sline(line);
78 ok = ok && (towerKey == "towers");
82 throw ("Pmap slice size does not match Rmap:" );
83 }
84 }
85
86
88
90
91 for (
int iRegion=0; iRegion<
int(
m_map.size()); iRegion++)
92 {
93 m_map.at(iRegion).resize(
m_pmaps.at(0)->getNLogiLayers());
94 for (
size_t l = 0;
l <
m_map.at(iRegion).
size();
l++)
m_map.at(iRegion).at(l).resize(
m_pmaps.at(iRegion)->getNSections(l));
95 }
96}
l
Printing final latex table to .tex output file.
◆ getAvgRadii()
| const std::vector< double > & FPGATrackSimRegionMap::getAvgRadii |
( |
unsigned | region | ) |
const |
|
inline |
◆ getAvgRadius()
| double FPGATrackSimRegionMap::getAvgRadius |
( |
unsigned | region, |
|
|
unsigned | layer ) const |
◆ getGlobalID()
| uint32_t FPGATrackSimRegionMap::getGlobalID |
( |
uint32_t | region, |
|
|
uint32_t | layer, |
|
|
uint32_t | localModuleID ) const |
Definition at line 381 of file FPGATrackSimRegionMap.cxx.
382{
384 {
385 ANA_MSG_ERROR(
"getGlobalID() bad region=" << region <<
" or layer=" << layer);
386 return -1;
387 }
388
390 if (g_l.second == localModuleID) return g_l.first;
391
392 ANA_MSG_ERROR(
"getGlobalID() Did not find global id for region " << region <<
", layer " << layer <<
", localID " << localModuleID);
393 return -1;
394}
std::vector< std::vector< std::map< uint32_t, uint32_t > > > m_global_local_map
◆ getLocalID()
| uint32_t FPGATrackSimRegionMap::getLocalID |
( |
uint32_t | region, |
|
|
uint32_t | layer, |
|
|
uint32_t | globalModuleID ) const |
Definition at line 372 of file FPGATrackSimRegionMap.cxx.
373{
374
375 (void) region;
376 (void) layer;
377 return globalModuleID & 0x3ff;
378}
◆ getNRegions()
| int FPGATrackSimRegionMap::getNRegions |
( |
| ) |
const |
|
inline |
◆ getPlaneMap()
◆ getRegionBoundaries()
◆ getRegions()
| std::vector< uint32_t > FPGATrackSimRegionMap::getRegions |
( |
const FPGATrackSimHit & | hit | ) |
const |
Definition at line 305 of file FPGATrackSimRegionMap.cxx.
306{
308 for (uint32_t region = 0; region <
m_map.size(); region++) {
311 }
313}
static const std::vector< std::string > regions
bool isInRegion(uint32_t region, const FPGATrackSimHit &hit) const
◆ getUnmappedID()
| uint32_t FPGATrackSimRegionMap::getUnmappedID |
( |
uint32_t | region, |
|
|
const FPGATrackSimHit & | hit ) const |
Definition at line 315 of file FPGATrackSimRegionMap.cxx.
316{
317
318
319
320
321
322
323
324
325
326
327
328
329
330
335
336 int anyerr = 0;
337 int err[] = {1,1,1,1,1,1};
338
339 if (region >=
m_map.size()) anyerr =
err[1] = 2;
340
341 if (!anyerr && layer >=
m_map[region].
size()) anyerr =
err[2] = 2;
342
344
345 if (!anyerr) {
348
349 if (
eta < eta_min)
err[4] = 3;
350 if (
eta > eta_max)
err[4] = 2;
351
354
355
356 if (phi_min <= phi_max)
357 {
359 }
360 else
361 {
363 }
364 }
365
367
369}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
int getEtaModule(bool old=false) const
unsigned getPhiModule() const
unsigned getSection() const
◆ isInRegion() [1/2]
| bool FPGATrackSimRegionMap::isInRegion |
( |
uint32_t | region, |
|
|
const FPGATrackSimHit & | hit ) const |
Definition at line 245 of file FPGATrackSimRegionMap.cxx.
246{
247
249
250
251
252
255
259 } else {
261 }
262 if (
ls.layer<0)
return false;
265
269}
int getPairedEtaModule() const
unsigned getPairedPhysLayer() const
unsigned getPairedPhiModule() const
DetectorZone getPairedDetZone() const
SiliconTech getPairedDetType() const
unsigned getPhysLayer(bool old=false) const
SiliconTech getDetType() const
DetectorZone getDetectorZone() const
HitType getHitType() const
phimod(flags, cells_name, *args, **kw)
etamod(flags, cells_name, *args, **kw)
◆ isInRegion() [2/2]
| bool FPGATrackSimRegionMap::isInRegion |
( |
uint32_t | region, |
|
|
uint32_t | plane, |
|
|
uint32_t | section, |
|
|
int | eta, |
|
|
int | phi ) const |
Definition at line 272 of file FPGATrackSimRegionMap.cxx.
273{
274
276
277 if ( region >=
m_map.size()
278 || layer >=
m_map[region].size()
280 {
281 return false;
282 }
283
286
288
291
292
293 if (phi_min <= phi_max)
294 {
296 }
297 else
298 {
300 }
301
302 return true;
303}
◆ isModuleIDLUTloaded()
| bool FPGATrackSimRegionMap::isModuleIDLUTloaded |
( |
| ) |
const |
|
inline |
◆ loadModuleIDLUT()
| void FPGATrackSimRegionMap::loadModuleIDLUT |
( |
std::string const & | filepath | ) |
|
Definition at line 146 of file FPGATrackSimRegionMap.cxx.
147{
149 ifstream
fin(filepath);
151 {
153 throw ("FPGATrackSimRegionMap Couldn't open " + filepath);
154 }
155
158
160 while (getline(fin, line))
161 {
163 istringstream sline(line);
164
165 if (!(sline >> region >> layer >> globalID >> localID))
168 ANA_MSG_WARNING(
"loadModuleIDLUT() bad region=" << region <<
" or layer=" << layer);
169 else
171 }
172}
◆ loadRadiiFile()
| void FPGATrackSimRegionMap::loadRadiiFile |
( |
std::string const & | radii_file, |
|
|
unsigned | layer_offset = 0, |
|
|
unsigned | layer_max = 0 ) |
Definition at line 175 of file FPGATrackSimRegionMap.cxx.
176{
177
178
179 layer_max = (layer_max == 0) ?
m_pmaps.at(0)->getNLogiLayers() - layer_offset: layer_max - layer_offset;
180
181
182 std::ifstream
fin(filepath);
184 {
186 }
187
188
190 bool ok = true;
192
193
194 while (getline(fin, line))
195 {
196 if (
line.empty() || line[0] ==
'#')
continue;
197 std::istringstream sline(line);
198 std::vector<int> shifts;
199
200 int subregion{-1};
201 ok = ok && (sline >> subregion);
202
203
204
205
206
208 continue;
209 }
211 continue;
212 }
213
214
215 for (
unsigned layer = 0;
layer < layer_max;
layer++) {
216 ok = ok && (sline >>
r);
217 if (!ok) break;
218 unsigned eff_layer =
layer + layer_offset;
219 ANA_MSG_DEBUG(
"Reading average radius at effective (actual) layer = " << eff_layer <<
" (" << layer <<
") = " <<
r);
221 ANA_MSG_WARNING(
"Radius in radiiFile is "<<
r <<
" for layer: " << eff_layer <<
" setting to dummy value!");
223 }
224 if (subregion == -1) {
226 } else {
228 }
229 }
230
231 if (!ok) break;
232 }
233
234 if (!ok)
235 {
237 }
238}
◆ readRegion()
| void FPGATrackSimRegionMap::readRegion |
( |
std::ifstream & | fin, |
|
|
int | expected_region ) |
|
private |
Definition at line 100 of file FPGATrackSimRegionMap.cxx.
101{
102
104 bool ok = true;
105 int region = -1;
107
108 while (getline(fin, line))
109 {
110 if (
line.empty() || line[0] ==
'#')
continue;
111 istringstream sline(line);
112
113 if (region < 0)
114 {
115 ok = ok && (sline >> region);
116 ok = ok && !(sline >>
dummy);
117 ok = ok && (region == expected_region);
118 if (!ok) break;
119 }
120 else
121 {
122 int isPix{},
BEC{}, physLayer{}, phi_min{}, phi_max{}, phi_tot{}, eta_min{}, eta_max{}, eta_tot{};
123
124 ok = ok && (sline >>
isPix >>
BEC >> physLayer >> phi_min >> phi_max >> phi_tot >> eta_min >> eta_max >> eta_tot);
125 if (!ok) break;
126
129
130 if (logiLayer > -1)
131 m_map[region][logiLayer][
section] = { phi_min, phi_max, eta_min, eta_max };
132
133 if (++linesRead ==
m_pmaps.at(region)->getNDetLayers())
break;
134 }
135 }
136
137 if (!ok)
138 {
140 throw "FPGATrackSimRegionMap read error";
141 }
142}
◆ m_filepath
| std::string FPGATrackSimRegionMap::m_filepath |
|
private |
◆ m_global_local_map
| std::vector<std::vector<std::map<uint32_t, uint32_t> > > FPGATrackSimRegionMap::m_global_local_map |
|
private |
◆ m_inclusive
| bool FPGATrackSimRegionMap::m_inclusive = false |
|
private |
◆ m_map
◆ m_nregions
| int FPGATrackSimRegionMap::m_nregions = 0 |
|
private |
◆ m_pmaps
◆ m_radii_map
| std::vector<std::vector<double> > FPGATrackSimRegionMap::m_radii_map |
|
private |
The documentation for this class was generated from the following files: