ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimMatrixAccumulator.h
Go to the documentation of this file.
1// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3#ifndef FPGATrackSimMATRIXACCUMULATOR_H
4#define FPGATrackSimMATRIXACCUMULATOR_H
5
6
17
18#include <vector>
19#include <unordered_map>
20#include <algorithm>
21#include <boost/functional/hash.hpp>
22
23#include "TTree.h"
24
27
28
29/*
30 * This struct stores all the information in the matrix file for a single sector.
31 * It is an accumulation of relevant track properties from training truth tracks
32 * used to create the sector. These are later used to generate the fit constants.
33 * See comments in FPGATrackSimConstGenAlgo.h.
34 */
36{
37 // nCoords is the number of hit coordinates for a full 13/13 track
38 // (i.e. +2 per pixel layer, +1 per strip layer)
39FPGATrackSimMatrixAccumulator(unsigned nLayers, unsigned nCoords) :
40 FTK_modules(nLayers),
41 coords_usable(nCoords),
42 hit_coords(nCoords),
43 hit_coordsG(nCoords),
44 hit_x_QoP(nCoords),
45 hit_xG_HIP(nCoords),
46 hit_x_d0(nCoords),
47 hit_x_z0(nCoords),
48 hit_x_eta(nCoords),
49 hit_xG_eta(nCoords),
50 hit_x_phi(nCoords),
51 covariance(nCoords * nCoords),
52 covarianceG(nCoords * nCoords)
53 {
54 }
55
56 std::vector<module_t> FTK_modules; // Old FTK-style module ids
57 std::vector<bool> coords_usable; // size ncoords, determine whether this is a usable coordinate or from a WC, only filled as we normali
58 size_t nusable() const {
59 size_t n = 0;
60 for (auto coord : coords_usable) {
61 if (coord) n++;
62 }
63 return n;
64 }
65
67 // For each track in this sector, add up the following variables.
69
71
72 // The hit_* vectors have size nCoords. For example, hit_x_phi stores the hit
73 // coordinates times phi for each track, so after accumulation
74 // hit_x_phi[i] = sum_tracks(track.hit_coords[i] * track.phi)
75 std::vector<float> hit_coords; // hit coordinates
76 std::vector<float> hit_coordsG; // hit global coordinates
77 std::vector<double> hit_x_QoP; // hit coordinate * half inverse pt
78 std::vector<double> hit_xG_HIP; // global hit coordinate * half inverse pt
79 std::vector<double> hit_x_d0; // hit coordinate * d0
80 std::vector<double> hit_x_z0; // hit coordinate * z0
81 std::vector<double> hit_x_eta; // hit coordinate * eta
82 std::vector<double> hit_xG_eta; // global hit coordinate * eta
83 std::vector<double> hit_x_phi; // hit coordinate * phi
84 std::vector<double> covariance; // Size nCoords * nCoords, hit_coord[i] * hit_coord[j]
85 std::vector<double> covarianceG; // Size nCoords * nCoords, hit_coordG[i] * hit_coordG[j]
86
88 // For each track in this sector, append to these variables.
90
91 std::vector<FPGATrackSimTrackParsI> track_bins; // Size # tracks (coverage).
92 // Stores the binned track parameters of each track.
93 // Note track_bins.size() conveniently also stores the coverage of this sector.
94};
95
96
97// A hash customization for std containers, to be used in unordered_map
98template <typename Container>
100{
101 std::size_t operator()(Container const& c) const
102 { return boost::hash_range(c.begin(), c.end()); }
103};
104
105
106// A useful typedef for the matrix algorithms.
107// Maps the sector definition (list of module identifier hashes) to an accumulator.
108typedef std::unordered_map<std::vector<module_t>, FPGATrackSimMatrixAccumulator, container_hash<std::vector<module_t>>> AccumulateMap;
109
110
120bool accumulate(AccumulateMap & map, std::vector<module_t> const & modules, FPGATrackSimMatrixAccumulator const & acc);
121
122
123#endif
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Helper function for adding a track/accumulator to an accumulate map.
std::unordered_map< std::vector< module_t >, FPGATrackSimMatrixAccumulator, container_hash< std::vector< module_t > > > AccumulateMap
Structs that store the 5 track parameters.
double coord
Type of coordination system.
storage of the time histories of all the cells
STL class.
FPGATrackSimMatrixAccumulator(unsigned nLayers, unsigned nCoords)
std::vector< FPGATrackSimTrackParsI > track_bins
std::size_t operator()(Container const &c) const