10 #include "art/Framework/Core/EDAnalyzer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
20 #include "nusimdata/SimulationBase/MCTruth.h"
21 #include "nusimdata/SimulationBase/MCParticle.h"
25 #include <TLorentzVector.h>
43 void analyze(art::Event
const&
e)
override;
72 _output_fname =
p.get<std::string>(
"OutputFileName");
73 _particle_label =
p.get<std::string>(
"ParticleProducer");
74 _trajectory_label =
p.get<std::string>(
"TrajectoryProducer");
112 art::Handle<std::vector< simb::MCTruth > > mctruth_h;
151 art::Handle<std::vector< simb::MCParticle > > mcparticle_h;
153 for (
size_t idx = 0; idx < mcparticle_h->size(); ++idx) {
154 auto const& particle = (*mcparticle_h)[idx];
160 _time = particle.T();
165 const auto& trajectory = particle.Trajectory();
166 _x_v.resize(trajectory.size(), 0.);
167 _y_v.resize(trajectory.size(), 0.);
168 _z_v.resize(trajectory.size(), 0.);
169 _time_v.resize(trajectory.size(), 0.);
171 for (
size_t pt_idx = 0; pt_idx < trajectory.size(); ++pt_idx) {
172 _x_v[pt_idx] = trajectory.X(pt_idx);
173 _y_v[pt_idx] = trajectory.Y(pt_idx);
174 _z_v[pt_idx] = trajectory.Z(pt_idx);
175 _time_v[pt_idx] = trajectory.T(pt_idx);
176 _energy_v[pt_idx] = trajectory.E(pt_idx);
std::vector< double > _time_v
std::string _output_fname
std::string _particle_label
std::vector< double > _z_v
std::string _trajectory_label
ICARUSParticleAna & operator=(ICARUSParticleAna const &)=delete
std::vector< double > _energy_v
std::vector< double > _x_v
std::vector< double > _y_v
void analyze(art::Event const &e) override
ICARUSParticleAna(fhicl::ParameterSet const &p)