23 #include "art/Framework/Core/EDProducer.h"
24 #include "art/Framework/Core/ModuleMacros.h"
25 #include "art/Framework/Principal/Event.h"
26 #include "art/Framework/Services/Registry/ServiceHandle.h"
56 : EDProducer{pset}, fSpptAlg(pset.get<fhicl::ParameterSet>(
"SpacePointAlgParams"))
58 fHitModuleLabel = pset.get<std::string>(
"HitModuleLabel",
"tthit");
59 fUHitsInstanceLabel = pset.get<std::string>(
"UHitsInstaceLabel",
"uhits");
60 fVHitsInstanceLabel = pset.get<std::string>(
"VHitsInstaceLabel",
"vhits");
61 fYHitsInstanceLabel = pset.get<std::string>(
"YHitsInstaceLabel",
"yhits");
63 produces<std::vector<recob::SpacePoint>>();
64 produces<art::Assns<recob::SpacePoint, recob::Hit>>();
72 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob();
82 auto spptCollection = std::make_unique<std::vector<recob::SpacePoint>>();
83 auto spptAssociatedHits = std::make_unique<std::vector<std::vector<art::Ptr<recob::Hit>>>>();
86 art::Handle<std::vector<recob::Hit>> hitHandle_U;
88 std::vector<art::Ptr<recob::Hit>> hitVec_U;
89 art::fill_ptr_vector(hitVec_U, hitHandle_U);
91 art::Handle<std::vector<recob::Hit>> hitHandle_V;
93 std::vector<art::Ptr<recob::Hit>> hitVec_V;
94 art::fill_ptr_vector(hitVec_V, hitHandle_V);
96 art::Handle<std::vector<recob::Hit>> hitHandle_Y;
98 std::vector<art::Ptr<recob::Hit>> hitVec_Y;
99 art::fill_ptr_vector(hitVec_Y, hitHandle_Y);
101 MF_LOG_DEBUG(
"TTSpacePointFinder") <<
"Got handles to hits:\n"
102 << hitVec_U.size() <<
" u hits, " << hitVec_V.size()
103 <<
" v hits, " << hitVec_Y.size() <<
" y hits.";
106 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt);
108 detProp, hitVec_U, hitVec_V, hitVec_Y, spptCollection, spptAssociatedHits);
110 mf::LogInfo(
"TTSpacePointFinder")
111 <<
"Finished spacepoint alg. Created " << spptCollection->size() <<
" spacepoints.";
114 if (spptCollection->size() != spptAssociatedHits->size()) {
115 mf::LogError(
"TTSpacePointFinder")
116 <<
"ERROR in space point alg.\n"
117 <<
"Spacepoint and associated hit collections have different sizes!\n"
118 << spptCollection->size() <<
" != " << spptAssociatedHits->size()
119 <<
"\nWill return with no space points put on event.";
124 std::unique_ptr<art::Assns<recob::SpacePoint, recob::Hit>> spptAssns(
125 new art::Assns<recob::SpacePoint, recob::Hit>);
126 for (
unsigned int isppt = 0; isppt < spptCollection->size(); isppt++) {
127 util::CreateAssn(evt, *spptCollection, spptAssociatedHits->at(isppt), *spptAssns, isppt);
131 evt.put(std::move(spptCollection));
132 evt.put(std::move(spptAssns));
std::string fHitModuleLabel
void setTimeOffsets(detinfo::DetectorPropertiesData const &detProp)
Declaration of signal hit object.
std::string fYHitsInstanceLabel
Input V hits instance name.
void produce(art::Event &evt)
std::string fVHitsInstanceLabel
Input U hits instance name.
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 beginRun(art::Run &run)
void fillCoordinatesArrays()
std::string fUHitsInstanceLabel
Input hit module name.
void createSpacePoints(detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> &hitVec_U, std::vector< art::Ptr< recob::Hit >> &hitVec_V, std::vector< art::Ptr< recob::Hit >> &hitVec_Y, std::unique_ptr< std::vector< recob::SpacePoint >> &spptCollection, std::unique_ptr< std::vector< std::vector< art::Ptr< recob::Hit >>>> &spptAssociatedHits)
SpacePointAlg_TimeSort fSpptAlg
Input Y hits instance name.
TTSpacePointFinder(fhicl::ParameterSet const &pset)