3#ifndef FPGATrackSimMATRIXREADER_H
4#define FPGATrackSimMATRIXREADER_H
156template<
typename Iter>
157void fillTree(Iter begin, Iter end, TTree *
tree,
int nLayers,
int nCoords)
160 std::vector<Iter> sorted_sectors;
161 sorted_sectors.reserve(std::distance(begin, end));
162 for (Iter i = begin; i != end; i++) sorted_sectors.push_back(i);
164 std::sort(sorted_sectors.begin(), sorted_sectors.end(), [](Iter
const &
a, Iter
const & b)
165 { return a->second.track_bins.size() > b->second.track_bins.size(); }
172 for (Iter & sector_info : sorted_sectors)
173 writer.fill(sector_info->first, sector_info->second);
Helper struct for accumulating sector information for matrix generation.
std::unordered_map< std::vector< module_t >, FPGATrackSimMatrixAccumulator, container_hash< std::vector< module_t > > > AccumulateMap
void readTree(AccumulateMap &map, TTree *tree, size_t nLayers, size_t nCoords)
Reads a matrix tree, accumulating its entries into a map.
void fillTree(Iter begin, Iter end, TTree *tree, int nLayers, int nCoords)
Writes the contents of an AccumulateMap into the supplied tree (one entry per sector).
FPGATrackSimMatrixAccumulator m_acc
std::vector< short > * m_pz0
std::vector< module_t > m_modules
void setEntry(size_t entry)
FPGATrackSimMatrixReader(TTree *tree, size_t nLayers, size_t nCoords)
std::vector< short > m_bins_QoP
std::vector< short > m_bins_phi
std::vector< short > * m_pphi
std::vector< short > m_bins_eta
std::vector< module_t > & getModules()
~FPGATrackSimMatrixReader()
FPGATrackSimMatrixAccumulator & getAccumulator()
std::vector< short > m_bins_z0
std::vector< short > * m_peta
std::vector< short > m_bins_d0
std::vector< short > * m_pQoP
std::vector< short > * m_pd0
void readEntry(size_t entry)
std::vector< short > m_bins_d0
std::vector< short > m_bins_eta
std::vector< short > m_bins_z0
std::vector< short > * m_peta
std::vector< short > m_bins_phi
FPGATrackSimMatrixWriter(TTree *tree, int nLayers, int nCoords)
std::vector< short > * m_pz0
std::vector< short > m_bins_QoP
std::vector< short > * m_pd0
std::vector< short > * m_pphi
std::vector< short > * m_pQoP
size_t fill(std::vector< module_t > modules, FPGATrackSimMatrixAccumulator &acc)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.