80 auto const showerHandle =
e.getValidHandle<std::vector<recob::Shower>>(
fShowerLabel);
81 auto const pfpHandle =
e.getValidHandle<std::vector<recob::PFParticle>>(
fPandoraLabel);
83 std::vector<art::Ptr<recob::Shower>> showers;
84 art::fill_ptr_vector(showers, showerHandle);
86 std::vector<art::Ptr<recob::PFParticle>> pfps;
87 art::fill_ptr_vector(pfps, pfpHandle);
89 const art::FindManyP<larpandoraobj::PFParticleMetadata> fmPFPMeta(pfpHandle,
e,
fPandoraLabel);
90 if (!fmPFPMeta.isValid()) {
91 throw cet::exception(
"ShowerCosmicDistance") <<
"PFP-Meta association is somehow not valid. Stopping";
94 const art::FindManyP<recob::SpacePoint> fmPFPSP(pfpHandle,
e,
fPandoraLabel);
95 if (!fmPFPSP.isValid()) {
96 throw cet::exception(
"ShowerCosmicDistance") <<
"PFP-SP association is somehow not valid. Stopping";
100 const std::vector<art::Ptr<recob::PFParticle>> cosmicPFPs(
GetCosmicPFPs(pfps, fmPFPMeta));
102 std::unique_ptr<std::vector<float>> residualCol(std::make_unique<std::vector<float>>());
103 std::unique_ptr<art::Assns<recob::Shower, float>> residualAssns(std::make_unique<art::Assns<recob::Shower, float>>());
105 for (
auto const&
shower : showers) {
113 residualCol->push_back(res);
117 e.put(std::move(residualCol));
118 e.put(std::move(residualAssns));
const std::vector< art::Ptr< recob::PFParticle > > GetCosmicPFPs(const std::vector< art::Ptr< recob::PFParticle >> &pfps, const art::FindManyP< larpandoraobj::PFParticleMetadata > fmPFPMeta) const
const float FindShowerResidual(const recob::Shower &shower, const std::vector< art::Ptr< recob::PFParticle >> &cosmicPFPs, const art::FindManyP< recob::SpacePoint > &fmPFPSP) const
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.
const float fMinShowerEnergy
const art::InputTag fPandoraLabel
const art::InputTag fShowerLabel