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 "canvas/Persistency/Common/FindManyP.h"
18 #include "fhiclcpp/ParameterSet.h"
19 #include "messagefacility/MessageLogger/MessageLogger.h"
42 void analyze(art::Event
const&
e)
override;
54 _t0_producer =
p.get<std::string>(
"T0Producer");
61 ::art::Handle<std::vector<anab::T0>> t0_h;
63 if(!t0_h.isValid() || t0_h->empty()) {
64 mf::LogWarning(
"SBNDOpT0FinderAna") <<
"Don't have good T0s." << std::endl;
67 std::vector<art::Ptr<anab::T0>> t0_v;
68 art::fill_ptr_vector(t0_v, t0_h);
71 art::FindManyP<recob::Slice> t0_to_slices(t0_h, e,
_t0_producer);
72 art::FindManyP<recob::OpFlash> t0_to_flashes(t0_h, e,
_t0_producer);
74 for (
size_t n_t0 = 0; n_t0 < t0_v.size(); n_t0++) {
77 auto const t0 = t0_v[n_t0];
80 std::vector<art::Ptr<recob::Slice>> slice_v = t0_to_slices.at(
t0.key());
81 std::vector<art::Ptr<recob::OpFlash>> flash_v = t0_to_flashes.at(
t0.key());
84 assert(slice_v.size() == 1);
85 assert(flash_v.size() == 1);
87 std::cout <<
"T0 obj: " << n_t0 <<
", score: " <<
t0->TriggerConfidence() << std::endl;
88 std::cout <<
"\t is associated with slice ID " << slice_v[0]->ID() << std::endl;
89 std::cout <<
"\t is associated with flash with time " << flash_v[0]->Time()
90 <<
", total PE " << flash_v[0]->TotalPE() << std::endl;
SBNDOpT0FinderAna & operator=(SBNDOpT0FinderAna const &)=delete
std::string _t0_producer
The T0 producer (to be set)
void analyze(art::Event const &e) override
SBNDOpT0FinderAna(fhicl::ParameterSet const &p)
BEGIN_PROLOG could also be cout