Populate the default event tree variables.
355 gallery::Handle<std::vector<simb::MCTruth>> mctruths_handle;
356 bool mctruth_is_valid = ev.getByLabel(
fTruthTag, mctruths_handle);
358 gallery::Handle<std::vector<simb::MCParticle> > mcparticle_list;
360 bool mcparticles_is_valid = mcparticle_list.isValid();
362 gallery::Handle<std::vector<simb::GTruth> > gtruths_handle;
363 ev.getByLabel(
fTruthTag, gtruths_handle);
364 bool genie_truth_is_valid = gtruths_handle.isValid();
367 std::vector<gallery::Handle<std::vector<evwgh::MCEventWeight> > > wghs;
371 gallery::Handle<std::vector<evwgh::MCEventWeight> > this_wgh;
372 bool hasWeights = ev.getByLabel(weightTag, this_wgh);
374 if (hasWeights && mctruth_is_valid) {
375 assert(this_wgh->size() == mctruths_handle->size());
378 wghs.push_back(this_wgh);
383 gallery::Handle<std::vector<simb::MCFlux> > mcflux_handle;
384 bool flux_is_valid = ev.getByLabel(
fFluxTag, mcflux_handle);
386 if (flux_is_valid && mctruth_is_valid) {
387 assert(mctruths_handle->size() == mcflux_handle->size());
396 auto const& evaux = ev.eventAuxiliary();
402 if (mctruth_is_valid) {
404 art::FindManyP<simb::MCParticle, sim::GeneratedParticleInfo> truth_to_particles(mctruths_handle, ev,
fMCParticleTag);
405 unsigned n_truth = mctruths_handle->size();
406 for (
size_t i=0; i<n_truth; i++) {
409 interaction.
index = i;
411 auto const& mctruth = mctruths_handle->at(i);
415 if (!mctruth.NeutrinoSet())
continue;
428 for (
auto const& wgh : wghs) {
429 for (
const std::pair<std::string, std::vector<double> >& this_wgh : wgh->at(i).fWeight) {
431 if (interaction.
weights.count(this_wgh.first) == 0) {
434 std::vector<float>(this_wgh.second.begin(), this_wgh.second.end())
439 interaction.
weights.at(this_wgh.first).insert(
440 interaction.
weights.at(this_wgh.first).end(),
441 this_wgh.second.begin(),
442 this_wgh.second.end());
448 if (mcflux_handle.isValid()) {
449 const simb::MCFlux& flux = mcflux_handle->at(i);
453 TVector3(flux.fvx, flux.fvy, flux.fvz);
458 TLorentzVector q_labframe;
461 std::vector<art::Ptr<simb::MCParticle>> this_mcparticle_list;
462 std::vector<const sim::GeneratedParticleInfo *> this_mcparticle_assns;
463 if (mcparticles_is_valid) {
464 this_mcparticle_list = truth_to_particles.at(i);
465 this_mcparticle_assns = truth_to_particles.data(i);
468 if (mctruth.NeutrinoSet()) {
470 const simb::MCNeutrino&
nu = mctruth.GetNeutrino();
485 const simb::MCParticle& lepton = nu.Lepton();
486 interaction.
lepton.
pdg = lepton.PdgCode();
487 interaction.
lepton.
energy = lepton.Momentum(0).Energy();
489 interaction.
lepton.
start = lepton.Position(0).Vect();
494 const simb::MCParticle* lepton_traj =
Genie2G4MCParticle(lepton, mctruth, this_mcparticle_list, this_mcparticle_assns);
497 if (lepton_traj != NULL) {
506 interaction.
lepton.
end = lepton_traj->EndPosition().Vect();
515 q_labframe = nu.Nu().EndMomentum() - lepton.Momentum(0);
532 for (
int iparticle=0; iparticle<mctruth.NParticles(); iparticle++) {
533 const simb::MCParticle& particle = mctruth.GetParticle(iparticle);
535 if (particle.Process() !=
"primary") {
538 fsp.
pdg = particle.PdgCode();
539 fsp.
energy = particle.Momentum(0).Energy();
540 fsp.
momentum = particle.Momentum(0).Vect();
541 fsp.
start = particle.Position(0).Vect();
543 fsp.
is_primary = (particle.Process() ==
"primary");
548 const simb::MCParticle *traj =
Genie2G4MCParticle(particle, mctruth, this_mcparticle_list, this_mcparticle_assns);
563 if (genie_truth_is_valid) {
564 auto const& gtruth = gtruths_handle->at(i);
565 TLorentzVector q_nucframe(q_labframe);
568 const TLorentzVector& nucP4 = gtruth.fHitNucP4;
569 TVector3 nuc_boost(nucP4.BoostVector());
570 q_nucframe.Boost(nuc_boost);
TVector3 momentum
Neutrino three-momentum.
Metadata metadata
Event metadata.
double MCParticleLength(const simb::MCParticle &particle)
TVector3 momentum
Three-momentum.
Final state particle information.
art::InputTag fTruthTag
art tag for MCTruth information
FinalStateParticle lepton
The primary final state lepton.
int parentDecayMode
Parent hadron/muon decay mode.
TTree * fTree
The output ROOT tree.
Neutrino neutrino
The neutrino.
std::vector< geo::BoxBoundedGeo > fActiveVolumes
List of active volumes in configured detector.
TVector3 start
Start position in detector coords [cm].
int parentPDG
Parent hadron/muon PDG.
std::vector< art::InputTag > fWeightTags
art tag(s) for MCEventWeight information
bool iscc
CC (true) or NC/interference (false)
float length
Total length of the energy depositions [cm].
size_t ntruth
Size of truth.
event::Event * fEvent
The standard output event data structure.
int status_code
Status code returned by GENIE (see GenieStatus enum)
float modq_lab
|q|, lab frame
TVector3 end
End position in detector coords (may be outside of AV) [cm].
void UpdateSubRuns(gallery::Event &ev)
unsigned long fEventIndex
An incrementing index.
int targetPDG
PDG code of struck target.
bool is_primary
Whether the process producing the particle was "primary".
double MCParticleContainedLength(const simb::MCParticle &particle, const std::vector< geo::BoxBoundedGeo > &active_volumes)
Experiment fExperimentID
Experiment identifier.
art::InputTag fFluxTag
art tag for MCFlux information
float inelasticityY
Inelasticity y.
float w
Hadronic invariant mass W.
size_t index
Index in the MCTruth.
float baseline
Distance from decay to interaction.
Experiment experiment
Experiment identifier.
size_t nfinalstate
Size of finalstate.
const simb::MCParticle * Genie2G4MCParticle(const simb::MCParticle &genie_part, const simb::MCTruth &mctruth, const std::vector< art::Ptr< simb::MCParticle >> &g4_mcparticles, const std::vector< const sim::GeneratedParticleInfo * > infos)
float q0
q0, struck nucleon rest frame
float modq
|q|, struck nucleon rest frame
std::vector< FinalStateParticle > finalstate
Other final state particles.
float q0_lab
q0, lab frame
double ECCQE(const TVector3 &l_momentum, double l_energy, double energy_distortion, double angle_distortion)
float energy
Neutrino energy (GeV)
TVector3 position
Neutrino interaction position.
ProviderManager * fProviderManager
Interface for provider access.
art::InputTag fMCParticleTag
art tag for MCParticle
int pdg
PDG code of probe neutrino.
int initpdg
Initial PDG code of probe neutrino.
All truth information associated with one neutrino interaction.
static const int kUnfilled
Value for unfilled variables.
int genie_intcode
Interaction mode (as for LArSoft MCNeutrino::Mode() )
void UpdateFileMeta(gallery::Event &ev)
TVector3 parentDecayVtx
Parent hadron/muon decay vertex.
bool isnc
same as LArSoft "ccnc" - 0=CC, 1=NC
std::map< std::string, std::vector< float > > weights
std::vector< Interaction > truth
All truth interactions.