4 #include "fhiclcpp/ParameterSet.h"
5 #include "gallery/ValidHandle.h"
6 #include "canvas/Utilities/InputTag.h"
7 #include "nusimdata/SimulationBase/MCTruth.h"
8 #include "nusimdata/SimulationBase/MCNeutrino.h"
17 namespace ExampleAnalysis {
20 : SelectionBase(), fNuCount(0), fEventCounter(0) {}
26 100, -1000, 1000, 100, -1000, 1000);
33 fhicl::ParameterSet pconfig = \
34 config->get<fhicl::ParameterSet>(
"ExampleAnalysis");
36 fMyParam = pconfig.get<
int>(
"parameter", 0);
39 { pconfig.get<std::string>(
"MCTruthTag",
"generator") };
66 const gallery::Event& ev,
67 const std::vector<event::Interaction>& truth,
68 std::vector<event::RecoInteraction>&
reco) {
70 std::cout <<
"ExampleSelection: Processing event "
76 auto const& mctruths = \
77 *ev.getValidHandle<std::vector<simb::MCTruth>>(
fTruthTag);
84 for (
size_t i=0; i<mctruths.size(); i++) {
85 auto const& mctruth = mctruths.at(i);
88 if (mctruth.NeutrinoSet()) {
90 mctruth.GetNeutrino().Nu().Vz());
97 interaction.
reco_energy =
util::ECCQE(mctruth.GetNeutrino().Nu().Momentum().Vect(), mctruth.GetNeutrino().Lepton().E());
98 reco.push_back(interaction);
TH2D * fNuVertexXZHist
Neutrino vertex XZ projection.
void Initialize(fhicl::ParameterSet *config=NULL)
double ECCQE(const TVector3 &l_momentum, double l_energy)
TFile * fOutputFile
The output ROOT file.
An example selection analysis.
process_name opflashCryoW ana
bool ProcessEvent(const gallery::Event &ev, const std::vector< event::Interaction > &truth, std::vector< event::RecoInteraction > &reco)
const geo::GeometryCore * GetGeometryProvider() const
Access the description of detector geometry.
Contains truth level information and additional fields for selection-defined reconstruction informati...
float reco_energy
Reconstructed neutrino energy [GeV].
process_name standard_reco_uboone reco
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
#define DECLARE_SBN_PROCESSOR(classname)
unsigned fEventCounter
Count processed events.
int fMyParam
A parameter from the configuration file.
ProviderManager * fProviderManager
Interface for provider access.
int fNuCount
Number of neutrino interactions in the event.
TBranch * AddBranch(std::string name, T *obj)
int fMyVar
Another variable of interest.
art::InputTag fTruthTag
art tag for MCTruth information
BEGIN_PROLOG could also be cout