Skip to content

soa accessor prototype with boost::hana

Niklas Stefan Nolte requested to merge NN_hana_soa into master

didn't want it to go to waste.

TLDR: You define a

struct muonpids {
  std::vector<int> statuss;
  std::vector<float> chi2corrs;
};

and

struct muonpid {
  int status;
  float chi2corr;
};

struct muonpid_soa {
  int_v status;
  float_v chi2corr;
};

then you can "initialize" these from "muonpids" with

muonpids m{...}
muonpid aos = get<muonpid>(m, 0); // get 0th slice
muonpid_soa soa = get<muonpid_soa>(m, 0); //get 0-7th slice
aos.chi2corr == m.chi2corrs[0]
soa.chi2corr == m.chi2corrs["0-7"]
Edited by Marco Cattaneo

Merge request reports

Loading