14 static_assert(
sizeof(NeutronFate::XYZ) == 12,
"sizes");
15 static_assert(
sizeof(NeutronFate::Child) == 32,
"sizes");
16 static_assert(
sizeof(NeutronFate) == 16,
"sizes");
19 std::vector<NeutronFate>&
out,
22 TFile
fin(name.c_str());
24 TTree*
tr = (TTree*)
fin.Get(
"tr");
27 out.reserve(tr->GetEntries());
30 tr->SetBranchAddress(
"nchildren", &nf.
nchildren);
33 for(
long i = 0;
i < tr->GetEntries(); ++
i){
40 tr->SetBranchAddress(
"p", &nf.
p);
46 tr->SetBranchAddress(
"childpdg", &childpdg);
47 float childx[10000], childy[10000], childz[10000], childt[10000];
48 tr->SetBranchAddress(
"childx", &childx);
49 tr->SetBranchAddress(
"childy", &childy);
50 tr->SetBranchAddress(
"childz", &childz);
51 tr->SetBranchAddress(
"childt", &childt);
52 float childpx[10000], childpy[10000], childpz[10000];
53 tr->SetBranchAddress(
"childpx", &childpx);
54 tr->SetBranchAddress(
"childpy", &childpy);
55 tr->SetBranchAddress(
"childpz", &childpz);
57 for(
long i = 0;
i < tr->GetEntries(); ++
i){
66 arenaPtr->
dr = {childx[
j], childy[
j], childz[
j]};
67 arenaPtr->
dt = childt[
j];
68 arenaPtr->
p = {childpx[
j], childpy[
j], childpz[
j]};
69 arenaPtr->
pdg = childpdg[
j];
77 assert(arenaPtr == childArena+totchildren);
79 std::sort(out.begin(), out.end(), [](
auto a,
auto b){
return a.p <
b.p;});
XYZ dr
Position of the child relative to parent start (mm)
TruthSlim – remove generated objects that don't contribute.
int pdg
PDG code of child particle.
float p
Initial neutron momentum (MeV)
void LoadNeutronFates(const std::string &name, std::vector< NeutronFate > &out, NeutronFate::Child *&childArena)
Fills out with list of neutrons from lowest to highest energy.
float dt
Time of the child relative to parent start (ns)
XYZ p
three-momentum of child particle (MeV)
assert(nhit_max >=nhit_nbins)