ATLAS Offline Software
FPGATrackSimHoughTransform_d0phi0_Tool.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
19 
20 #include "TH2.h"
21 
22 #include <sstream>
23 #include <cmath>
24 #include <algorithm>
25 
26 static inline int quant(double min, double max, unsigned nSteps, double val);
27 static inline double unquant(double min, double max, unsigned nSteps, int step);
28 template <typename T>
29 static inline std::string to_string(std::vector<T> v);
30 static inline std::string instance_name(std::string const & s);
31 
32 
33 
35 // AthAlgTool
36 
37 FPGATrackSimHoughTransform_d0phi0_Tool::FPGATrackSimHoughTransform_d0phi0_Tool(const std::string& algname, const std::string &name, const IInterface *ifc) :
38  base_class(algname, name, ifc),
39  m_name(instance_name(name)),
40  m_monitorFile((m_name + ".root").c_str(), "RECREATE")
41 {
42  declareInterface<IFPGATrackSimRoadFinderTool>(this);
43 }
44 
45 
47 {
48  // Move temp variables over from properties to struct
53 
54  // Debug
55  ATH_MSG_INFO("Image size: " << m_imageSize_x << " x " << m_imageSize_y);
56  ATH_MSG_INFO("Convolution size: " << m_convSize_x << " x " << m_convSize_y);
57  ATH_MSG_INFO("Convolution: " << to_string(const_cast<std::vector<int>&>(m_conv.value())));
58  ATH_MSG_INFO("Hit Extend: " << to_string(const_cast<std::vector<unsigned>&>(m_hitExtend_x.value())));
59 
60  // Retrieve info
61  ATH_CHECK(m_FPGATrackSimBankSvc.retrieve());
62  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
63  m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers();
64 
65  // Error checking
66  bool ok = false;
68  ATH_MSG_FATAL("initialize() Image size must be greater than 0");
69  else if (m_conv.size() != m_convSize_x * m_convSize_y)
70  ATH_MSG_FATAL("initialize() Convolution sizes don't match");
71  else if (!m_conv.empty() && (m_convSize_x % 2 == 0 || m_convSize_y % 2 == 0))
72  ATH_MSG_FATAL("initialize() Convolution sizes must be odd");
73  else if (!m_hitExtend_x.empty() && m_hitExtend_x.size() != m_nLayers)
74  ATH_MSG_FATAL("initialize() Hit extentsion list must have size == nLayers");
75  else if (m_threshold.size() % 2 != 1)
76  ATH_MSG_FATAL("initialize() Threshold size must be odd");
77  else
78  ok = true;
79  for (unsigned const scale : m_binScale) {
80  if (m_imageSize_y % scale != 0) {
81  ATH_MSG_FATAL("initialize() The imagesize is not divisible by scale");
82  ok = false;
83  }
84  }
85  if (!ok) return StatusCode::FAILURE;
86 
87  // Warnings / corrections
89  ATH_MSG_WARNING("initialize() localMaxWindowSize requires tracing hits, turning on automatically");
90  m_traceHits = true;
91  }
92 
93  if (m_idealGeoRoads) {
94  if (m_useSectors) {
95  ATH_MSG_WARNING("initialize() idealGeoRoads conflicts with useSectors, switching off FPGATrackSim sector matching");
96  m_useSectors = false;
97 
98  }
99  if (!m_traceHits) {
100  ATH_MSG_WARNING("initialize() idealGeoRoads requires tracing hits, turning on automatically");
101  m_traceHits = true;
102  }
103  }
104 
105 
106  // Fill convenience variables
109  for (unsigned i = 0; i <= m_imageSize_x; i++)
110  m_bins_x.push_back(unquant(m_parMin[m_par_x], m_parMax[m_par_x], m_imageSize_x, i));
111  for (unsigned i = 0; i <= m_imageSize_y; i++)
112  m_bins_y.push_back(unquant(m_parMin[m_par_y], m_parMax[m_par_y], m_imageSize_y, i));
113 
114  // Initialize combine layers
115  m_nCombineLayers = *std::max_element(m_combineLayers.begin(), m_combineLayers.end()) + 1;
117  for (unsigned i = 0; i < m_combineLayers.size(); i++) {
118  m_combineLayer2D[m_combineLayers[i]].push_back(i);
119  }
120 
121  // Initialize scaled binnings
122  for (unsigned const scale : m_binScale) {
123  auto iter = m_yBins_scaled.find(scale);
124 
125  // if scale not found in keys, then push the scaled binning
126  if (iter == m_yBins_scaled.end()) {
127  unsigned new_size_y = m_imageSize_y / scale;
128  std::vector<size_t> yBins_scaled;
129  for (unsigned i = 0; i <= new_size_y; i++) {
130  yBins_scaled.push_back(scale * i);
131  }
132  m_yBins_scaled[scale] = yBins_scaled;
133  }
134  }
135 
136  return StatusCode::SUCCESS;
137 }
138 
139 
141 {
142  m_monitorFile.Write();
143  return StatusCode::SUCCESS;
144 }
145 
146 
148 // Main Algorithm
149 
150 StatusCode FPGATrackSimHoughTransform_d0phi0_Tool::getRoads(const std::vector<const FPGATrackSimHit*> & hits, std::vector<FPGATrackSimRoad*> & roads)
151 {
152  ATH_MSG_DEBUG("Event: " << m_event << ", # hits: " << hits.size());
153  roads.clear();
154  m_roads.clear();
155 
157  if (m_event < 5) drawImage(image, m_name + "_" + std::to_string(m_event));
158  if (!m_conv.empty()) image = convolute(image);
159 
160  for (unsigned y = 0; y < m_imageSize_y; y++) {
161  for (unsigned x = 0; x < m_imageSize_x; x++) {
162  if (passThreshold(image, x, y)) {
163  m_roads.push_back(createRoad(image(y,x).second, x, y));
164  }
165  }
166  }
167 
168  roads.reserve(m_roads.size());
169  for (FPGATrackSimRoad & r : m_roads) roads.push_back(&r);
170 
171  if (roads.empty() && m_event >= 5 && m_event < 200)
172  drawImage(image, m_name + "_" + std::to_string(m_event));
173 
174  m_event++;
175  return StatusCode::SUCCESS;
176 }
177 
178 
179 FPGATrackSimHoughTransform_d0phi0_Tool::Image FPGATrackSimHoughTransform_d0phi0_Tool::createLayerImage(std::vector<unsigned> const & combine_layers, std::vector<FPGATrackSimHit const *> const & hits, unsigned const scale) const
180 {
181 
183 
184  for (FPGATrackSimHit const * hit : hits) {
185 
186  bool belong1 = false, belong2 = false;
187  for (auto layer : combine_layers) {
188  if (belong1 || belong2) break;
189  if (hit->getLayer() == layer)
190  belong1 = true;
191  if (hit->getLayer() == layer + 1)
192  belong2 = true;
193  }
194 
195  if ((!belong1 && !m_stereo) ||
196  (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit))) {
197  continue;
198  }
199  else if (m_stereo && belong1) { /* Intentionally blank */ }
200  else if (m_stereo && !(hit->getLayer() > 1 && (hit->getLayer() % 2 == 1 && belong2))) {
201  continue;
202  }
203 
204  // This scans over y (d0) because that is more efficient in memory, in C.
205  // Unknown if firmware will want to scan over x instead.
206  unsigned new_size_y = m_imageSize_y / scale;
207 
208  for (unsigned y_ = 0; y_ < new_size_y; y_++) {
209  int y_bin_min = m_yBins_scaled.at(scale)[y_];
210  int y_bin_max = m_yBins_scaled.at(scale)[y_+1];
211 
212  // Find the min/max x bins
213  auto xBins = yToXBins(y_bin_min, y_bin_max, hit);
214  // Update the image
215  for (int y = y_bin_min; y < y_bin_max; y++) {
216  for (unsigned x = xBins.first; x < xBins.second; x++) {
217  image(y, x).first++;
218  if (m_traceHits) image(y, x).second.insert(hit);
219  }
220  }
221  }
222  }
223 
224  return image;
225 }
226 
228 {
230 
231  for (unsigned i = 0; i < m_nCombineLayers ; i++) {
233  if (i > 1 && i % 2 == 0 && m_stereo) ++i; // not sure how to deal with this for Combine Layer setting
234  for (unsigned x = 0; x < m_imageSize_x; ++x) {
235  for (unsigned y = 0; y < m_imageSize_y; ++y) {
236  if (layerImage(y, x).first > 0) {
237  image(y, x).first++;
238  image(y, x).second.insert(layerImage(y, x).second.begin(), layerImage(y, x).second.end());
239  }
240  }
241  }
242  }
243 
244  return image;
245 }
246 
248 {
250 
251  for (unsigned y0 = 0; y0 < m_imageSize_y; y0++) { // Loop over out
252  for (unsigned x0 = 0; x0 < m_imageSize_x; x0++) { //
253  for (unsigned r = 0; r < m_convSize_y; r++) { // Loop over conv
254  int y = -static_cast<int>(m_convSize_y) / 2 + r + y0; // Indices of input
255  for (unsigned c = 0; c < m_convSize_x; c++) {
256  int x = -static_cast<int>(m_convSize_x) / 2 + c + x0; //
257 
258  if (y >= 0 && y < static_cast<int>(m_imageSize_y) && x >= 0 && x < static_cast<int>(m_imageSize_x)) {
259  int val = m_conv[r * m_convSize_x + c] * image(y, x).first;
260  if (val > 0) {
261  out(y0, x0).first += val;
262  out(y0, x0).second.insert(image(y, x).second.begin(), image(y, x).second.end());
263  }
264  }
265  }
266  }
267  }
268  }
269 
270  return out;
271 }
272 
273 bool FPGATrackSimHoughTransform_d0phi0_Tool::passThreshold(Image const & image, unsigned x, unsigned y) const
274 {
275  // Pass window threshold
276  unsigned width = m_threshold.size() / 2;
277  if (x < width || (image.size(1) - x) < width) return false;
278  for (unsigned i = 0; i < m_threshold.size(); i++)
279  if (image(y, x - width + i).first < m_threshold[i]) return false;
280 
281  // Pass local-maximum check
283  for (int j = -m_localMaxWindowSize; j <= m_localMaxWindowSize; j++)
284  for (int i = -m_localMaxWindowSize; i <= m_localMaxWindowSize; i++) {
285  if (i == 0 && j == 0) continue;
286  if (y + j < image.size(0) && x + i < image.size(1)) {
287  if (image(y+j, x+i).first > image(y, x).first) return false;
288  if (image(y+j, x+i).first == image(y, x).first) {
289  if (image(y+j, x+i).second.size() > image(y, x).second.size()) return false;
290  if (image(y+j, x+i).second.size() == image(y, x).second.size()
291  && j <= 0 && i <= 0) return false;
292  }
293  }
294  }
295 
296  return true;
297 }
298 
300 // Helpers
301 
302 
303 // Quantizes val, given a range [min, max) split into nSteps. Returns the bin below.
304 static inline int quant(double min, double max, unsigned nSteps, double val)
305 {
306  return static_cast<int>((val - min) / (max - min) * nSteps);
307 }
308 
309 // Returns the lower bound of the bin specified by step
310 static inline double unquant(double min, double max, unsigned nSteps, int step)
311 {
312  return min + (max - min) * step / nSteps;
313 }
314 
315 template <typename T>
316 static inline std::string to_string(std::vector<T> v)
317 {
318  std::ostringstream oss;
319  oss << "[";
320  if (!v.empty()) {
321  std::copy(v.begin(), v.end()-1, std::ostream_iterator<T>(oss, ", "));
322  oss << v.back();
323  }
324  oss << "]";
325  return oss.str();
326 }
327 
328 static inline std::string instance_name(std::string const & s)
329 {
330  size_t pos = s.find_last_of('.');
331  if (pos != std::string::npos)
332  return s.substr(pos + 1);
333  return s;
334 }
335 
337 {
338  double x = 0;
339 
341  double r = hit->getR(); // TODO check this, and units
342  double phi_hit = hit->getGPhi(); // TODO check this, and units
343  x = -y/r + phi_hit;
344  }
345  else {
346  ATH_MSG_ERROR("yToX() not defined for the current m_par selection");
347  }
348 
349  return x;
350 }
351 
352 // Find the min/max x bins of the hit's line, in each y bin. Max is exclusive.
353 // Note this assumes yToX is monotonic. Returns {0, 0} if hit lies out of bounds.
354 std::pair<unsigned, unsigned> FPGATrackSimHoughTransform_d0phi0_Tool::yToXBins(size_t yBin_min, size_t yBin_max, FPGATrackSimHit const * hit) const
355 {
356  // Get float values
357  double x_min = yToX(m_bins_y[yBin_min], hit);
358  double x_max = yToX(m_bins_y[yBin_max], hit);
359  if (x_min > x_max) std::swap(x_min, x_max);
360  if (x_max < m_parMin[m_par_x] || x_min > m_parMax[m_par_x])
361  return { 0, 0 }; // out of bounds
362 
363  // Get bins
364  int x_bin_min = quant(m_parMin[m_par_x], m_parMax[m_par_x], m_imageSize_x, x_min);
365  int x_bin_max = quant(m_parMin[m_par_x], m_parMax[m_par_x], m_imageSize_x, x_max) + 1; // exclusive
366 
367  // Extend bins
368  if (!m_hitExtend_x.empty()) x_bin_min -= m_hitExtend_x[hit->getLayer()];
369  if (!m_hitExtend_x.empty()) x_bin_max += m_hitExtend_x[hit->getLayer()];
370 
371  // Clamp bins
372  if (x_bin_min < 0) x_bin_min = 0;
373  if (x_bin_max > static_cast<int>(m_imageSize_x)) x_bin_max = m_imageSize_x;
374 
375  return { x_bin_min, x_bin_max };
376 }
377 
379 {
380  float pt = r.getY()*0.001; // convert to MeV
381  auto bounds = std::equal_range(fpgatracksim::QOVERPT_BINS.begin(),fpgatracksim::QOVERPT_BINS.end(),pt);
382  int sectorbin = bounds.first-fpgatracksim::QOVERPT_BINS.begin()-1;
383 
384  // those bins are for tracks between the values, can't be below first value or more than the last value
385  if (sectorbin < 0) sectorbin = 0;
386  if (sectorbin > static_cast<int>(fpgatracksim::QOVERPT_BINS.size()-2)) sectorbin = fpgatracksim::QOVERPT_BINS.size()-2;
387  std::vector<module_t> modules;
388 
389  for (unsigned int il = 0; il < r.getNLayers(); il++) {
390  if (r.getNHits_layer()[il] == 0) {
391  modules.push_back(-1);
392  layer_bitmask_t wc_layers = r.getWCLayers();
393  wc_layers |= (0x1 << il);
394  r.setWCLayers(wc_layers);
395 
396  std::unique_ptr<FPGATrackSimHit> wcHit = std::unique_ptr<FPGATrackSimHit>(new FPGATrackSimHit());
398  wcHit->setLayer(il);
399  wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_1st()->getDetType(il));
400  r.setHits(il,std::vector<const FPGATrackSimHit*>({wcHit.get()}));
401 
402  }
403  else
404  modules.push_back(sectorbin);
405  }
406  const FPGATrackSimSectorBank* sectorbank = m_FPGATrackSimBankSvc->SectorBank_1st();
407  r.setSector(sectorbank->findSector(modules));
408 }
409 
410 // Create road via hits only
411 FPGATrackSimRoad FPGATrackSimHoughTransform_d0phi0_Tool::createRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y) const {
412  // Get the road hits
413  std::vector<const FPGATrackSimHit*> road_hits;
414  layer_bitmask_t hitLayers = 0;
415  for (const FPGATrackSimHit * hit : hits) {
416  road_hits.push_back(hit);
417  hitLayers |= 1 << hit->getLayer();
418  }
419 
420  auto sorted_hits = ::sortByLayer(road_hits);
421  sorted_hits.resize(m_nLayers); // If no hits in last layer, return from sortByLayer will be too short
422 
424  r.setRoadID(m_roads.size());
425  r.setPID(y * m_imageSize_y + x);
427  r.setHitLayers(hitLayers);
428  r.setHits(sorted_hits);
429  r.setSubRegion(m_subRegion);
430  r.setX(m_bins_x[x] + m_step_x/2);
431  r.setY(m_bins_y[y] + m_step_y/2);
432  return r;
433 }
434 
435 // Creates a road from hits that pass through the given bin (x, y), and pushes it onto m_roads
436 FPGATrackSimRoad FPGATrackSimHoughTransform_d0phi0_Tool::createRoad(std::vector<std::vector<const FPGATrackSimHit*>> const & hits, layer_bitmask_t hitLayers, unsigned x, unsigned y) const
437 {
439  r.setRoadID(m_roads.size());
440  r.setPID(y * m_imageSize_y + x);
441  if (m_useSectors) r.setSector(m_FPGATrackSimBankSvc->SectorBank_1st()->findSector(hits));
443  r.setHitLayers(hitLayers);
444  r.setHits(hits);
445  r.setSubRegion(m_subRegion);
446  r.setX(m_bins_x[x] + m_step_x/2);
447  r.setY(m_bins_y[y] + m_step_y/2);
448 
449  return r;
450 }
451 
452 
453 // Creates a road from hits that pass through the given bin (x, y), and pushes it onto m_roads
454 void FPGATrackSimHoughTransform_d0phi0_Tool::addRoad(std::unordered_set<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y)
455 {
456  layer_bitmask_t hitLayers = 0;
457  for (FPGATrackSimHit const * hit : hits) {
458  hitLayers |= 1 << hit->getLayer();
459  }
460 
461  auto sorted_hits = ::sortByLayer(hits);
462  sorted_hits.resize(m_nLayers); // If no hits in last layer, return from sortByLayer will be too short
463  m_roads.push_back(createRoad(sorted_hits, hitLayers, x, y));
464 }
465 
466 // Use this version of addRoad when hit tracing is turned off
467 void FPGATrackSimHoughTransform_d0phi0_Tool::addRoad(std::vector<const FPGATrackSimHit*> const & hits, unsigned x, unsigned y)
468 {
469  // Get the road hits
470  std::vector<FPGATrackSimHit const *> road_hits;
471  layer_bitmask_t hitLayers = 0;
472  for (const FPGATrackSimHit * hit : hits) {
473  if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue;
474 
475  // get bin scaling for the hit
476  unsigned bin_scale = 0;
477  for (unsigned i = 0; i < m_nCombineLayers; i++) {
478  for (unsigned const layer : m_combineLayer2D[i]) {
479  if (hit->getLayer() == layer) {
480  bin_scale = m_binScale[layer];
481  }
482  }
483  }
484  if (bin_scale == 0) bin_scale = 1; //avoid divide by zero,use 1:1 scale
485  unsigned y_bin_min = floor(1.0 * y / bin_scale) * bin_scale;
486  unsigned y_bin_max = ceil(1.0 * y / bin_scale) * bin_scale;
487  if (y_bin_min == y_bin_max) y_bin_max++;
488 
489  // Find the min/max x bins
490  auto xBins = yToXBins(y_bin_min, y_bin_max, hit);
491 
492  if (x >= xBins.first && x < xBins.second && y >= y_bin_min && y < y_bin_max) {
493  road_hits.push_back(hit);
494  hitLayers |= 1 << hit->getLayer();
495  }
496  }
497 
498  auto sorted_hits = ::sortByLayer(road_hits);
499  sorted_hits.resize(m_nLayers); // If no hits in last layer, return from sortByLayer will be too short
500 
501  m_roads.push_back(createRoad(sorted_hits, hitLayers, x, y));
502 }
503 
504 
505 // For debug use
507 {
508  m_monitorFile.cd();
509 
510  TH2I h(name.c_str(), "Hough Transform;phi;d0 (mm)",
513  );
514 
515  for (unsigned y = 0; y < m_imageSize_y; y++)
516  for (unsigned x = 0; x < m_imageSize_x; x++)
517  h.SetBinContent(x+1, y+1, image(y, x).first); // +1 since root bins are 1-indexed
518 
519  h.Write();
520 }
521 
FPGATrackSimHoughTransform_d0phi0_Tool::m_par_x
FPGATrackSimTrackPars::pars_index m_par_x
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:86
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
beamspotman.r
def r
Definition: beamspotman.py:676
FPGATrackSimHoughTransform_d0phi0_Tool::createLayerImage
Image createLayerImage(std::vector< unsigned > const &combine_layers, std::vector< FPGATrackSimHit const * > const &hits, unsigned const scale) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:179
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
FPGATrackSimTrackPars::ID0
@ ID0
Definition: FPGATrackSimTrackPars.h:49
getMenu.algname
algname
Definition: getMenu.py:53
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
FPGATrackSimTrackPars::phi
double phi
Definition: FPGATrackSimTrackPars.h:24
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
FPGATrackSimHoughTransform_d0phi0_Tool::addRoad
void addRoad(std::unordered_set< const FPGATrackSimHit * > const &hits, unsigned x, unsigned y)
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:454
max
#define max(a, b)
Definition: cfImp.cxx:41
FPGATrackSimHoughTransform_d0phi0_Tool::m_convSize_y
Gaudi::Property< unsigned int > m_convSize_y
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:78
FPGATrackSimHoughTransform_d0phi0_Tool::m_idealGeoRoads
Gaudi::Property< bool > m_idealGeoRoads
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:84
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
fpgatracksim::QOVERPT_BINS
constexpr std::array< double, 5 > QOVERPT_BINS
Definition: FPGATrackSimConstants.h:15
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimHoughTransform_d0phi0_Tool::m_nLayers
unsigned m_nLayers
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:98
FPGATrackSimHoughTransform_d0phi0_Tool::m_binScale
Gaudi::Property< std::vector< unsigned int > > m_binScale
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:76
FPGATrackSimHoughTransform_d0phi0_Tool::matchIdealGeoSector
void matchIdealGeoSector(FPGATrackSimRoad &r) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:378
IFPGATrackSimMappingSvc.h
FPGATrackSimTrackPars::d0
double d0
Definition: FPGATrackSimTrackPars.h:26
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
FPGATrackSimHit::getLayer
unsigned getLayer() const
Definition: FPGATrackSimHit.cxx:75
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
FPGATrackSimHoughTransform_d0phi0_Tool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:60
FPGATrackSimHoughTransform_d0phi0_Tool::m_imageSize_y
Gaudi::Property< unsigned int > m_imageSize_y
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:73
FPGATrackSimHoughTransform_d0phi0_Tool::m_tempMin_phi
Gaudi::Property< float > m_tempMin_phi
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:67
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
x
#define x
FPGATrackSimHoughTransform_d0phi0_Tool::m_conv
Gaudi::Property< std::vector< int > > m_conv
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:74
FPGATrackSimConstants.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
FPGATrackSimHit
Definition: FPGATrackSimHit.h:38
FPGATrackSimHoughTransform_d0phi0_Tool::m_threshold
Gaudi::Property< std::vector< int > > m_threshold
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:71
FPGATrackSimHit::getGPhi
float getGPhi() const
Definition: FPGATrackSimHit.h:129
FPGATrackSimHoughTransform_d0phi0_Tool::m_stereo
Gaudi::Property< bool > m_stereo
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:81
HitType::wildcard
@ wildcard
FPGATrackSimRegionMap.h
Maps ITK module indices to FPGATrackSim regions.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
FPGATrackSimHit::setDetType
void setDetType(SiliconTech detType)
Definition: FPGATrackSimHit.h:52
vector2D< std::pair< int, std::unordered_set< const FPGATrackSimHit * > > >
FPGATrackSimHoughTransform_d0phi0_Tool::m_step_y
double m_step_y
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:101
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FPGATrackSimSectorBank::findSector
sector_t findSector(std::vector< module_t > const &modules) const
Definition: FPGATrackSimSectorBank.cxx:121
FPGATrackSimHoughTransform_d0phi0_Tool::m_parMax
FPGATrackSimTrackPars m_parMax
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:90
FPGATrackSimHoughTransform_d0phi0_Tool::m_traceHits
Gaudi::Property< bool > m_traceHits
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:80
lumiFormat.i
int i
Definition: lumiFormat.py:92
FPGATrackSimHoughTransform_d0phi0_Tool::m_event
int m_event
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:123
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TH2I
Definition: rootspy.cxx:410
FPGATrackSimHoughTransform_d0phi0_Tool::m_step_x
double m_step_x
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:100
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
FPGATrackSimHoughTransform_d0phi0_Tool::FPGATrackSimHoughTransform_d0phi0_Tool
FPGATrackSimHoughTransform_d0phi0_Tool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:37
FPGATrackSimHoughTransform_d0phi0_Tool::createRoad
FPGATrackSimRoad createRoad(std::unordered_set< const FPGATrackSimHit * > const &hits, unsigned x, unsigned y) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:411
FPGATrackSimHoughTransform_d0phi0_Tool::yToX
double yToX(double y, FPGATrackSimHit const *h) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:336
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
sortByLayer
std::vector< std::vector< const FPGATrackSimHit * > > sortByLayer(Container const &hits)
Definition: FPGATrackSimHit.h:215
checkCorrelInHIST.nSteps
int nSteps
Definition: checkCorrelInHIST.py:458
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
FPGATrackSimHoughTransform_d0phi0_Tool::m_tempMax_phi
Gaudi::Property< float > m_tempMax_phi
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:68
FPGATrackSimSectorBank
Definition: FPGATrackSimSectorBank.h:30
FPGATrackSimHoughTransform_d0phi0_Tool::m_convSize_x
Gaudi::Property< unsigned int > m_convSize_x
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:77
min
#define min(a, b)
Definition: cfImp.cxx:40
FPGATrackSimHoughTransform_d0phi0_Tool::convolute
Image convolute(Image const &image) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:247
FPGATrackSimHoughTransform_d0phi0_Tool::drawImage
void drawImage(Image const &image, std::string const &name)
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:506
FPGATrackSimHoughTransform_d0phi0_Tool::m_tempMax_d0
Gaudi::Property< float > m_tempMax_d0
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:70
FPGATrackSimHoughTransform_d0phi0_Tool::finalize
virtual StatusCode finalize() override
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:140
FPGATrackSimHoughTransform_d0phi0_Tool::m_monitorFile
TFile m_monitorFile
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:125
FPGATrackSimHoughTransform_d0phi0_Tool::m_bins_y
std::vector< double > m_bins_y
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:103
FPGATrackSimHoughTransform_d0phi0_Tool::m_parMin
FPGATrackSimTrackPars m_parMin
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:89
FPGATrackSimHoughTransform_d0phi0_Tool::m_useSectors
Gaudi::Property< bool > m_useSectors
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:83
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
FPGATrackSimHoughTransform_d0phi0_Tool::m_bins_x
std::vector< double > m_bins_x
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:102
MyPlots.image
string image
Definition: MyPlots.py:43
FPGATrackSimHoughTransform_d0phi0_Tool::m_combineLayers
Gaudi::Property< std::vector< unsigned int > > m_combineLayers
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:75
FPGATrackSimTrackPars::IPHI
@ IPHI
Definition: FPGATrackSimTrackPars.h:49
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:157
FPGATrackSimHoughTransform_d0phi0_Tool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:46
FPGATrackSimHit::getR
float getR() const
Definition: FPGATrackSimHit.h:128
FPGATrackSimHit::setLayer
void setLayer(unsigned v)
Definition: FPGATrackSimHit.h:87
FPGATrackSimHoughTransform_d0phi0_Tool::createImage
Image createImage(std::vector< FPGATrackSimHit const * > const &hits) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:227
y
#define y
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
FPGATrackSimHoughTransform_d0phi0_Tool.h
Implements road finding using a Hough transform in d0 vs phi0, assuming q/pt = 0 (i....
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
layer_bitmask_t
uint32_t layer_bitmask_t
Definition: FPGATrackSimTypes.h:22
DeMoScan.first
bool first
Definition: DeMoScan.py:534
IFPGATrackSimBankSvc.h
LArCellBinning.step
step
Definition: LArCellBinning.py:158
FPGATrackSimHoughTransform_d0phi0_Tool::m_hitExtend_x
Gaudi::Property< std::vector< unsigned int > > m_hitExtend_x
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:79
FPGATrackSimHoughTransform_d0phi0_Tool::m_imageSize_x
Gaudi::Property< unsigned int > m_imageSize_x
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:72
FPGATrackSimHoughTransform_d0phi0_Tool::m_FPGATrackSimBankSvc
ServiceHandle< IFPGATrackSimBankSvc > m_FPGATrackSimBankSvc
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:59
FPGATrackSimHoughTransform_d0phi0_Tool::m_name
std::string m_name
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:124
FPGATrackSimHoughTransform_d0phi0_Tool::m_roads
std::vector< FPGATrackSimRoad > m_roads
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:118
FPGATrackSimHoughTransform_d0phi0_Tool::m_nCombineLayers
unsigned m_nCombineLayers
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:92
FPGATrackSimHoughTransform_d0phi0_Tool::getRoads
virtual StatusCode getRoads(const std::vector< const FPGATrackSimHit * > &hits, std::vector< FPGATrackSimRoad * > &roads) override
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:150
FPGATrackSimHoughTransform_d0phi0_Tool::m_tempMin_d0
Gaudi::Property< float > m_tempMin_d0
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:69
FPGATrackSimHoughTransform_d0phi0_Tool::yToXBins
std::pair< unsigned, unsigned > yToXBins(size_t yBin_min, size_t yBin_max, FPGATrackSimHit const *hit) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:354
calibdata.copy
bool copy
Definition: calibdata.py:27
FPGATrackSimHoughTransform_d0phi0_Tool::m_combineLayer2D
std::vector< std::vector< unsigned > > m_combineLayer2D
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:93
FPGATrackSimHoughTransform_d0phi0_Tool::m_yBins_scaled
std::unordered_map< int, std::vector< size_t > > m_yBins_scaled
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:106
FPGATrackSimHoughTransform_d0phi0_Tool::m_par_y
FPGATrackSimTrackPars::pars_index m_par_y
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:87
FPGATrackSimHoughTransform_d0phi0_Tool::m_localMaxWindowSize
Gaudi::Property< bool > m_localMaxWindowSize
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:82
FPGATrackSimTypes.h
python.compressB64.c
def c
Definition: compressB64.py:93
FPGATrackSimHoughTransform_d0phi0_Tool::passThreshold
bool passThreshold(Image const &image, unsigned x, unsigned y) const
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.cxx:273
FPGATrackSimSectorBank.h
This file declares a class that stores the module IDs of the sectors.
MakeTH3DFromTH2Ds.xBins
list xBins
Definition: MakeTH3DFromTH2Ds.py:76
FPGATrackSimRoad
Definition: FPGATrackSimRoad.h:29
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition: FPGATrackSimHit.h:51
FPGATrackSimHoughTransform_d0phi0_Tool::m_subRegion
Gaudi::Property< int > m_subRegion
Definition: FPGATrackSimHoughTransform_d0phi0_Tool.h:66