26static inline int quant(
double min,
double max,
unsigned nSteps,
double val);
27static inline double unquant(
double min,
double max,
unsigned nSteps,
int step);
29static inline std::string
to_string(std::vector<T> v);
30static inline std::string
instance_name(std::string
const & s);
38 base_class(algname, name, ifc),
67 ATH_MSG_FATAL(
"initialize() Image size must be greater than 0");
73 ATH_MSG_FATAL(
"initialize() Hit extentsion list must have size == nLayers");
80 ATH_MSG_FATAL(
"initialize() The imagesize is not divisible by scale");
84 if (!ok)
return StatusCode::FAILURE;
88 ATH_MSG_WARNING(
"initialize() localMaxWindowSize requires tracing hits, turning on automatically");
94 ATH_MSG_WARNING(
"initialize() idealGeoRoads conflicts with useSectors, switching off FPGATrackSim sector matching");
99 ATH_MSG_WARNING(
"initialize() idealGeoRoads requires tracing hits, turning on automatically");
127 std::vector<size_t> yBins_scaled;
128 for (
unsigned i = 0; i <= new_size_y; i++) {
129 yBins_scaled.push_back(scale * i);
135 return StatusCode::SUCCESS;
142 return StatusCode::SUCCESS;
174 return StatusCode::SUCCESS;
183 for (
auto const & hit : hits) {
185 bool belong1 =
false, belong2 =
false;
186 for (
auto layer : combine_layers) {
187 if (belong1 || belong2)
break;
188 if (hit->getLayer() == layer)
190 if (hit->getLayer() == layer + 1)
199 else if (
m_stereo && !(hit->getLayer() > 1 && (hit->getLayer() % 2 == 1 && belong2))) {
207 for (
unsigned y_ = 0; y_ < new_size_y; y_++) {
212 auto xBins =
yToXBins(y_bin_min, y_bin_max, hit);
214 for (
int y = y_bin_min;
y < y_bin_max;
y++) {
215 for (
unsigned x = xBins.first;
x < xBins.second;
x++) {
232 if (i > 1 && i % 2 == 0 &&
m_stereo) ++i;
235 if (layerImage(
y,
x).first > 0) {
237 image(
y,
x).second.insert(layerImage(
y,
x).second.begin(), layerImage(
y,
x).second.end());
260 out(y0, x0).first += val;
261 out(y0, x0).second.insert(image(
y,
x).second.begin(), image(
y,
x).second.end());
276 if (
x <
width || (image.size(1) -
x) <
width)
return false;
284 if (i == 0 && j == 0)
continue;
285 if (
y + j < image.size(0) &&
x + i < image.size(1)) {
286 if (image(
y+j,
x+i).first > image(
y,
x).first)
return false;
287 if (image(
y+j,
x+i).first == image(
y,
x).first) {
288 if (image(
y+j,
x+i).second.size() > image(
y,
x).second.size())
return false;
289 if (image(
y+j,
x+i).second.size() == image(
y,
x).second.size()
290 && j <= 0 && i <= 0)
return false;
303static inline int quant(
double min,
double max,
unsigned nSteps,
double val)
305 return static_cast<int>((val -
min) / (
max -
min) * nSteps);
309static inline double unquant(
double min,
double max,
unsigned nSteps,
int step)
311 return min + (
max -
min) * step / nSteps;
317 std::ostringstream oss;
320 std::copy(v.begin(), v.end()-1, std::ostream_iterator<T>(oss,
", "));
329 size_t pos = s.find_last_of(
'.');
330 if (pos != std::string::npos)
331 return s.substr(pos + 1);
340 double r = hit->getR();
341 double phi_hit = hit->getGPhi();
345 ATH_MSG_ERROR(
"yToX() not defined for the current m_par selection");
358 if (x_min > x_max)
std::swap(x_min, x_max);
371 if (x_bin_min < 0) x_bin_min = 0;
374 return { x_bin_min, x_bin_max };
379 float pt =
r.getY()*0.001;
384 if (sectorbin < 0) sectorbin = 0;
386 std::vector<module_t> modules;
388 for (
unsigned int il = 0; il <
r.getNLayers(); il++) {
389 if (
r.getNHits_layer()[il] == 0) {
390 modules.push_back(-1);
392 wc_layers |= (0x1 << il);
393 r.setWCLayers(wc_layers);
395 std::unique_ptr<FPGATrackSimHit> wcHit = std::unique_ptr<FPGATrackSimHit>(
new FPGATrackSimHit());
399 r.setHits(il,std::vector<std::shared_ptr<const FPGATrackSimHit>>({std::move(wcHit)}));
403 modules.push_back(sectorbin);
412 std::vector<std::shared_ptr<const FPGATrackSimHit>> road_hits;
414 for (
const auto &hit : hits) {
415 road_hits.push_back(hit);
416 hitLayers |= 1 << hit->getLayer();
426 r.setHitLayers(hitLayers);
427 r.setHits(std::move(sorted_hits));
442 r.setHitLayers(hitLayers);
443 r.setHits(std::move(hits));
456 for (
auto const & hit : hits) {
457 hitLayers |= 1 << hit->getLayer();
469 std::vector<std::shared_ptr<const FPGATrackSimHit>> road_hits;
471 for (
const auto &hit : hits) {
475 unsigned bin_scale = 0;
478 if (hit->getLayer() == layer) {
483 if (bin_scale == 0) bin_scale = 1;
484 unsigned y_bin_min = floor(1.0 *
y / bin_scale) * bin_scale;
485 unsigned y_bin_max = ceil(1.0 *
y / bin_scale) * bin_scale;
486 if (y_bin_min == y_bin_max) y_bin_max++;
489 auto xBins =
yToXBins(y_bin_min, y_bin_max, hit);
492 road_hits.push_back(hit);
493 hitLayers |= 1 << hit->getLayer();
509 TH2I
h(name.c_str(),
"Hough Transform;phi;d0 (mm)",
516 h.SetBinContent(
x+1,
y+1, image(
y,
x).first);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
: FPGATrackSim-specific class to represent an hit in the detector.
std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > sortByLayer(Container const &hits)
Maps physical layers to logical layers.
Maps ITK module indices to FPGATrackSim regions.
This file declares a class that stores the module IDs of the sectors.
Header file for AthHistogramAlgorithm.
sector_t findSector(std::vector< module_t > const &modules) const
constexpr std::array< double, 5 > QOVERPT_BINS
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)