21 #include "art/Framework/Core/EDProducer.h"
22 #include "art/Framework/Core/ModuleMacros.h"
23 #include "art/Framework/Principal/Event.h"
24 #include "art/Framework/Principal/Handle.h"
25 #include "art/Framework/Services/Registry/ServiceHandle.h"
26 #include "canvas/Persistency/Common/Ptr.h"
27 #include "canvas/Persistency/Common/PtrVector.h"
28 #include "fhiclcpp/ParameterSet.h"
59 DEFINE_ART_MODULE(OpFlashFinder)
70 fInputModule = pset.get<std::string>(
"InputModule");
72 fBinWidth = pset.get<
int>(
"BinWidth");
73 fFlashThreshold = pset.get<
float>(
"FlashThreshold");
74 fWidthTolerance = pset.get<
float>(
"WidthTolerance");
75 fTrigCoinc = pset.get<
double>(
"TrigCoinc");
77 produces<std::vector<recob::OpFlash>>();
78 produces<art::Assns<recob::OpFlash, recob::OpHit>>();
86 auto flashPtr = std::make_unique<std::vector<recob::OpFlash>>();
87 auto assnPtr = std::make_unique<art::Assns<recob::OpFlash, recob::OpHit>>();
91 std::vector<std::vector<int>> assocList;
93 auto const&
geometry(*lar::providerFrom<geo::Geometry>());
95 auto const clock_data =
96 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
99 auto const opHitHandle = evt.getValidHandle<std::vector<recob::OpHit>>(
fInputModule);
112 for (
size_t i = 0; i != assocList.size(); ++i) {
113 art::PtrVector<recob::OpHit> opHitPtrVector;
114 for (
size_t const hitIndex : assocList.at(i)) {
115 opHitPtrVector.emplace_back(opHitHandle, hitIndex);
118 util::CreateAssn(*
this, evt, *flashPtr, opHitPtrVector, *(assnPtr.get()), i);
121 evt.put(std::move(flashPtr));
122 evt.put(std::move(assnPtr));
Utilities related to art service access.
const geo::GeometryCore * geometry
void RunFlashFinder(std::vector< recob::OpHit > const &HitVector, std::vector< recob::OpFlash > &FlashVector, std::vector< std::vector< int >> &AssocList, double const BinWidth, geo::GeometryCore const &geom, float const FlashThreshold, float const WidthTolerance, detinfo::DetectorClocksData const &ClocksData, float const TrigCoinc)
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
void produce(art::Event &)
OpFlashFinder(const fhicl::ParameterSet &)
art framework interface to geometry description