171 art::FindOneP<recob::Wire> channelHitWires (hitsHandle, evt,
fHitModuleLabel);
176 channelHitWires.isValid(),
182 auto assns = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint>>();
185 std::vector< art::Ptr<recob::Hit> > eventHits;
188 art::FindManyP< recob::SpacePoint > spFromHit(hitsHandle, evt,
fSpModuleLabel);
189 art::FindManyP< recob::Hit > hitsFromSp(spHandle, evt,
fSpModuleLabel);
193 std::unordered_map< size_t, size_t > spToTPC;
194 for (
size_t i = 0; i < spHandle->size(); ++i)
196 auto hits = hitsFromSp.at(i);
198 for (
const auto &
h : hits)
207 for (
const auto &
h : hits)
214 std::vector<size_t> unassignedHits;
215 std::unordered_map< size_t, geo::WireID > hitToWire;
216 std::unordered_map< size_t, std::vector<geo::WireID> > hitToNWires;
218 hitToWire.reserve(eventHits.size());
220 int n =
runOnSpacePoints(eventHits, spFromHit, spToTPC, hitToWire, indHits, unassignedHits);
221 mf::LogInfo(
"DisambigFromSpacePoints") << n <<
" hits undisambiguated by space points.";
226 mf::LogInfo(
"DisambigFromSpacePoints") << n <<
" hits undisambiguated by neighborhood.";
231 else {
mf::LogInfo(
"DisambigFromSpacePoints") <<
"Remaining undisambiguated hits dropped."; }
235 for (
auto const & hw : hitToWire)
237 size_t key = hw.first;
242 hcol.emplace_back(new_hit.move(), channelHitWires.at(key));
244 auto hitPtr = hitPtrMaker(hcol.size() - 1);
245 auto sps = spFromHit.at(eventHits[key].
key());
246 for (
auto const & spPtr : sps)
248 assns->addSingle(hitPtr, spPtr);
252 for (
auto const & hws : hitToNWires)
254 size_t key = hws.first;
255 for (
auto const & wid : hws.second)
259 hcol.emplace_back(new_hit.move(), channelHitWires.at(key));
261 auto hitPtr = hitPtrMaker(hcol.size() - 1);
262 auto sps = spFromHit.at(eventHits[key].
key());
263 for (
auto const & spPtr : sps)
265 assns->addSingle(hitPtr, spPtr);
void assignFirstAllowedWire(std::unordered_map< size_t, geo::WireID > &assignments, const std::vector< art::Ptr< recob::Hit > > &eventHits, const std::vector< size_t > &unassigned) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int runOnSpacePoints(const std::vector< art::Ptr< recob::Hit > > &eventHits, const art::FindManyP< recob::SpacePoint > &spFromHit, const std::unordered_map< size_t, size_t > &spToTPC, std::unordered_map< size_t, geo::WireID > &assignments, cryo_tpc_plane_keymap &indHits, std::vector< size_t > &unassigned)
const art::InputTag fHitModuleLabel
static constexpr WireID_t InvalidID
Special code for an invalid ID.
const art::InputTag fSpModuleLabel
std::map< unsigned int, tpc_plane_keymap > cryo_tpc_plane_keymap
const std::string fMoveLeftovers
Class managing the creation of a new recob::Hit object.
A class handling a collection of hits and its associations.
Signal from induction planes.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
int resolveUnassigned(detinfo::DetectorPropertiesData const &detProp, std::unordered_map< size_t, geo::WireID > &assignments, const std::vector< art::Ptr< recob::Hit > > &eventHits, cryo_tpc_plane_keymap &indHits, std::vector< size_t > &unassigned, size_t nNeighbors)
EventNumber_t event() const
const bool fMonitoringPlots
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
const size_t fNumNeighbors
void assignEveryAllowedWire(std::unordered_map< size_t, std::vector< geo::WireID > > &assignments, const std::vector< art::Ptr< recob::Hit > > &eventHits, const std::vector< size_t > &unassigned) const
Signal from collection planes.