14 #include "art_root_io/TFileService.h" 38 class ProtoDUNETruthBeamParticle;
90 truth = tfs->make<TTree>(
"truth",
"Beam Particle Truth Tree");
92 truth->Branch(
"run",
run,
"run[nbeamparticles]/I");
93 truth->Branch(
"subrun",
subrun,
"subrun[nbeamparticles]/I");
94 truth->Branch(
"event",
event,
"event[nbeamparticles]/I");
95 truth->Branch(
"pdg",
pdg,
"pdg[nbeamparticles]/I");
97 truth->Branch(
"mom",
mom,
"mom[nbeamparticles]/F");
98 truth->Branch(
"ene",
ene,
"ene[nbeamparticles]/F");
99 truth->Branch(
"startpos",
startpos,
"startpos[nbeamparticles][4]/F");
100 truth->Branch(
"p",
p,
"p[nbeamparticles][3]/F");
108 p_pdg = pset.
get< std::vector<int> >(
"Pdg");
120 std::vector< art::Ptr<simb::MCTruth> > mclist;
121 auto mctruthhandle = evt.
getHandle< std::vector<simb::MCTruth> >(
"generator");
126 mf::LogError(
"protoana::ProtoDUNETruthBeamParticle::analyze") <<
"Requested protoDUNE beam generator information does not exist!";
134 for(
int i = 0; i < mctruth->
NParticles(); ++i){
140 for(
unsigned int j = 0; j <
p_pdg.size(); j++){
141 if(part.PdgCode() ==
p_pdg[j]){
150 bool isgoodparticle = (part.Process() ==
"primary");
168 pdg[i] = part.PdgCode();
const int NMAXBEAMPARTICLES
Handle< PROD > getHandle(SelectorBase const &) const
ProtoDUNETruthBeamParticle(fhicl::ParameterSet const &pset)
float mom[NMAXBEAMPARTICLES]
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
EDAnalyzer(fhicl::ParameterSet const &pset)
float ene[NMAXBEAMPARTICLES]
#define DEFINE_ART_MODULE(klass)
void analyze(const art::Event &evt)
T get(std::string const &key) const
SubRunNumber_t subRun() const
const simb::MCParticle & GetParticle(int i) const
int run[NMAXBEAMPARTICLES]
float startpos[NMAXBEAMPARTICLES][4]
int subrun[NMAXBEAMPARTICLES]
virtual ~ProtoDUNETruthBeamParticle()
float p[NMAXBEAMPARTICLES][3]
EventNumber_t event() const
int goodparticle[NMAXBEAMPARTICLES]
int pdg[NMAXBEAMPARTICLES]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void reconfigure(fhicl::ParameterSet const &pset)
Event finding and building.