76 <<
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Shower Reco Energy Tool ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
80 auto const pfpHandle = Event.getValidHandle<std::vector<recob::PFParticle>>(
fPFParticleLabel);
83 auto const clusHandle = Event.getValidHandle<std::vector<recob::Cluster>>(
fPFParticleLabel);
85 const art::FindManyP<recob::Cluster>& fmc =
88 std::vector<art::Ptr<recob::Cluster>> clusters = fmc.at(pfparticle.key());
91 const art::FindManyP<recob::Hit>& fmhc =
95 std::map<geo::PlaneID::PlaneID_t, std::vector<art::Ptr<recob::Hit>>> planeHits;
98 for (
auto const&
cluster : clusters) {
101 std::vector<art::Ptr<recob::Hit>> hits = fmhc.at(
cluster.key());
106 planeHits[plane].insert(planeHits[plane].
end(), hits.begin(), hits.end());
111 unsigned int bestPlaneNumHits = 0;
114 std::vector<double> energyVec(
fGeom->Nplanes(), -999.);
115 std::vector<double> energyError(
fGeom->Nplanes(), -999.);
117 auto const clockData =
118 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(Event);
120 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(Event, clockData);
122 for (
auto const& [plane, hits] : planeHits) {
124 unsigned int planeNumHits = hits.size();
129 if (Energy > 0) energyVec.at(plane) =
Energy;
131 if (planeNumHits > bestPlaneNumHits) {
133 bestPlaneNumHits = planeNumHits;
139 if (bestPlane < fGeom->Nplanes()) {
142 int bestPlaneVal(bestPlane);
unsigned int PlaneID_t
Type for the ID number.
Set of hits with a 2D structure.
auto end(FixedBins< T, C > const &) noexcept
2D representation of charge deposited in the TDC/wire plane
BEGIN_PROLOG could also be cout