Classes | Functions
g4n Namespace Reference

TruthSlim – remove generated objects that don't contribute. More...

Classes

class  FLSHitListAction
 list of energy deposits from Geant4 More...
 
class  G4Alg
 An algorithm to pass interaction information to Geant4 and create hits and particle lists. More...
 
class  G4Gen
 
struct  NeutronFate
 
class  NeutronSubstitutionPhysics
 Registers NeutronSubstitutionProcess. More...
 
class  NeutronSubstitutionProcess
 Transforms neutrons into their final states according to a library. More...
 
class  ParticleListAction
 
class  PrintTables
 
class  RockCutterAction
 
class  TruthSlim
 A module to slim the generator output. More...
 
class  UpdateDaughterInformation
 

Functions

void LoadNeutronFates (const std::string &name, std::vector< NeutronFate > &out, NeutronFate::Child *&childArena)
 Fills out with list of neutrons from lowest to highest energy. More...
 

Detailed Description

TruthSlim – remove generated objects that don't contribute.

Use Geant4's user "hooks" to kill particles in the rock.

Print material and dedx tables as they are known to GEANT4.

NOvA specific Geant4 interface.

Use Geant4's user "hooks" to maintain a list of particles generated by Geant4.

Author
dwwhi.nosp@m.tti@.nosp@m.india.nosp@m.na.e.nosp@m.du
selig.nosp@m.man@.nosp@m.nevis.nosp@m..col.nosp@m.umbia.nosp@m..edu, brebe.nosp@m.l@fn.nosp@m.al.go.nosp@m.v
messi.nosp@m.er@i.nosp@m.ndian.nosp@m.a.ed.nosp@m.u
rhatc.nosp@m.her@.nosp@m.fnal..nosp@m.gov

Function Documentation

void g4n::LoadNeutronFates ( const std::string name,
std::vector< NeutronFate > &  out,
NeutronFate::Child *&  childArena 
)

Fills out with list of neutrons from lowest to highest energy.

Caller must delete childArena when done with the library

Definition at line 18 of file NeutronFates.cxx.

References a, ana::assert(), b, g4n::NeutronFate::children, g4n::NeutronFate::Child::dr, g4n::NeutronFate::Child::dt, fin, MECModelEnuComparisons::i, calib::j, g4n::NeutronFate::nchildren, g4n::NeutronFate::Child::p, g4n::NeutronFate::p, g4n::NeutronFate::Child::pdg, and make_root_from_grid_output::tr.

Referenced by g4n::NeutronSubstitutionProcess::NeutronSubstitutionProcess().

21  {
22  TFile fin(name.c_str());
23  assert(!fin.IsZombie());
24  TTree* tr = (TTree*)fin.Get("tr");
25  assert(tr);
26 
27  out.reserve(tr->GetEntries());
28 
29  NeutronFate nf;
30  tr->SetBranchAddress("nchildren", &nf.nchildren);
31 
32  long totchildren = 0;
33  for(long i = 0; i < tr->GetEntries(); ++i){
34  tr->GetEntry(i);
35  totchildren += nf.nchildren;
36  }
37  childArena = new NeutronFate::Child[totchildren];
38  NeutronFate::Child* arenaPtr = childArena;
39 
40  tr->SetBranchAddress("p", &nf.p);
41  // tr->SetBranchAddress("dt", &nf.dt);
42  // tr->SetBranchAddress("stepz", &nf.stepz);
43  // tr->SetBranchAddress("stepx", &nf.stepx);
44 
45  int childpdg[10000];
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);
56 
57  for(long i = 0; i < tr->GetEntries(); ++i){
58  tr->GetEntry(i);
59 
60  if(nf.nchildren == 0){
61  nf.children = 0;
62  }
63  else{
64  nf.children = arenaPtr;
65  for(int j = 0; j < nf.nchildren; ++j){
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];
70  ++arenaPtr;
71  }
72  }
73 
74  out.push_back(nf);
75  }
76 
77  assert(arenaPtr == childArena+totchildren);
78 
79  std::sort(out.begin(), out.end(), [](auto a, auto b){return a.p < b.p;});
80  }
TString fin
Definition: Style.C:24
const XML_Char * name
Definition: expat.h:151
const double a
const double j
Definition: BetheBloch.cxx:29
const hit & b
Definition: hits.cxx:21
assert(nhit_max >=nhit_nbins)