17 #include "art/Framework/Core/EDProducer.h"
18 #include "art/Framework/Core/ModuleMacros.h"
19 #include "art/Framework/Principal/Event.h"
20 #include "art/Framework/Principal/Handle.h"
21 #include "art/Framework/Principal/Run.h"
22 #include "art/Persistency/Common/PtrMaker.h"
23 #include "canvas/Persistency/Common/Assns.h"
24 #include "nusimdata/SimulationBase/MCTruth.h"
25 #include "fhiclcpp/ParameterSet.h"
31 #include "canvas/Persistency/Common/Assns.h"
32 #include "art/Framework/Principal/Run.h"
47 void produce(art::Event&
e)
override;
48 void beginRun(art::Run& run)
override;
59 fGenieModuleLabel(
p.get<std::string>(
"generator_module_label",
"generator")),
60 fAllowMissingTruth(
p.get<
bool>(
"AllowMissingTruth"))
62 const size_t n_func = fWeightManager.Configure(
p, *
this);
64 produces<std::vector<sbn::evwgh::EventWeightMap> >();
65 produces<art::Assns<simb::MCTruth, sbn::evwgh::EventWeightMap> >();
66 produces<std::vector<sbn::evwgh::EventWeightParameterSet>, art::InRun>();
72 auto mcwghvec = std::make_unique<std::vector<EventWeightMap> >();
73 auto wghassns = std::make_unique<art::Assns<simb::MCTruth, sbn::evwgh::EventWeightMap> >();
75 art::PtrMaker<sbn::evwgh::EventWeightMap> makeWeightPtr(e);
78 std::vector<art::Ptr<simb::MCTruth> > mclist;
79 art::Handle<std::vector<simb::MCTruth>> mcTruthHandle;
84 art::fill_ptr_vector(mclist, mcTruthHandle);
87 for (
size_t i=0; i<mclist.size(); i++) {
89 mcwghvec->push_back(std::move(mcwgh));
91 art::Ptr<sbn::evwgh::EventWeightMap> wghPtr = makeWeightPtr(mcwghvec->size() - 1);
92 wghassns->addSingle(mclist.at(i), wghPtr);
96 e.put(std::move(mcwghvec));
97 e.put(std::move(wghassns));
102 auto p = std::make_unique<std::vector<EventWeightParameterSet> >();
105 p->push_back(it.second->fParameterSet);
108 run.put(std::move(
p));
std::string fGenieModuleLabel
std::map< std::string, std::vector< float > > EventWeightMap
Container for event-level weights.
WeightManager fWeightManager
SBNEventWeight(fhicl::ParameterSet const &p)
std::map< std::string, WeightCalc * > GetWeightCalcMap()
SBNEventWeight & operator=(SBNEventWeight const &)=delete
EventWeightMap Run(art::Event &e, const int inu)
void produce(art::Event &e) override
void beginRun(art::Run &run) override