ATLAS Offline Software
Classes | Typedefs | Functions
FPGATrackSimMatrixAccumulator.h File Reference

Helper struct for accumulating sector information for matrix generation. More...

#include <vector>
#include <unordered_map>
#include <algorithm>
#include <boost/functional/hash.hpp>
#include "TTree.h"
#include "FPGATrackSimObjects/FPGATrackSimTypes.h"
#include "FPGATrackSimObjects/FPGATrackSimTrackPars.h"
Include dependency graph for FPGATrackSimMatrixAccumulator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FPGATrackSimMatrixAccumulator
 
struct  container_hash< Container >
 

Typedefs

typedef std::unordered_map< std::vector< module_t >, FPGATrackSimMatrixAccumulator, container_hash< std::vector< module_t > > > AccumulateMap
 

Functions

bool accumulate (AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
 Helper function for adding a track/accumulator to an accumulate map. More...
 

Detailed Description

Helper struct for accumulating sector information for matrix generation.

Author
Riley Xu - riley.nosp@m..xu@.nosp@m.cern..nosp@m.ch
Date
May 8th, 2020 This file declares a helper struct that stores all the information needed by the matrix file, for a single sector. It also declares several helper functions and typedefs for reading and writing this struct from ROOT files.

Definition in file FPGATrackSimMatrixAccumulator.h.

Typedef Documentation

◆ AccumulateMap

typedef std::unordered_map<std::vector<module_t>, FPGATrackSimMatrixAccumulator, container_hash<std::vector<module_t> > > AccumulateMap

Definition at line 108 of file FPGATrackSimMatrixAccumulator.h.

Function Documentation

◆ accumulate()

bool accumulate ( AccumulateMap map,
std::vector< module_t > const modules,
FPGATrackSimMatrixAccumulator const acc 
)

Helper function for adding a track/accumulator to an accumulate map.

Parameters
map- map to be added to
modules- sector definition of the accumulator to be added
acc- accumulator to be added
Returns
true if a new sector was just added, and false if acc was accumulated into an existing item.

Helper function for adding a track/accumulator to an accumulate map.

a single track) to an accumulate map.

Parameters
map- map to be added to
modules- sector definition of the accumulator to be added
acc- accumulator to be added
Returns
true if a new sector was just added, and false if acc was accumulated into an existing item.

Definition at line 22 of file FPGATrackSimMatrixAccumulator.cxx.

23 {
24  auto it = map.find(modules);
25  if (it == map.end()) // Create new entry
26  {
27  map.insert({ modules, acc });
28  return true;
29  }
30  else // Add/append entries
31  {
32 
33  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
34  it->second.pars[i] += acc.pars[i];
35 
36  size_t nDim = acc.hit_coords.size();
37  for (unsigned i = 0; i < nDim; i++)
38  {
39  it->second.hit_coords[i] += acc.hit_coords[i];
40  it->second.hit_x_QoP[i] += acc.hit_x_QoP[i];
41  it->second.hit_xG_HIP[i] += acc.hit_xG_HIP[i];
42  it->second.hit_x_d0[i] += acc.hit_x_d0[i];
43  it->second.hit_x_z0[i] += acc.hit_x_z0[i];
44  it->second.hit_x_eta[i] += acc.hit_x_eta[i];
45  it->second.hit_xG_eta[i] += acc.hit_xG_eta[i];
46  it->second.hit_x_phi[i] += acc.hit_x_phi[i];
47 
48  for (unsigned j = i; j < nDim; j++)
49  it->second.covariance[i * nDim + j] += acc.covariance[i * nDim + j];
50  }
51 
52  it->second.track_bins.insert(it->second.track_bins.end(), acc.track_bins.begin(), acc.track_bins.end());
53  return false;
54  }
55 }
skel.it
it
Definition: skel.GENtoEVGEN.py:423
lumiFormat.i
int i
Definition: lumiFormat.py:92
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
FPGATrackSimTrackPars::NPARS
@ NPARS
Definition: FPGATrackSimTrackPars.h:49