68 auto const trackHandle(
e.getValidHandle<std::vector<recob::Track>>(
fTrackLabel));
70 std::vector<art::Ptr<recob::Track>>
tracks;
71 art::fill_ptr_vector(tracks, trackHandle);
73 art::FindManyP<anab::Calorimetry> fmTrackCalo(trackHandle,
e,
fCaloLabel);
75 auto fitVec = std::make_unique<std::vector<StoppingChi2Fit>>();
76 auto trackAssns = std::make_unique<art::Assns<recob::Track, StoppingChi2Fit>>();
77 auto caloAssns = std::make_unique<art::Assns<anab::Calorimetry, StoppingChi2Fit>>();
79 for (
auto const&
track : tracks) {
84 const std::vector<art::Ptr<anab::Calorimetry>> caloVec(fmTrackCalo.at(
track.key()));
86 if (caloVec.size() != 3)
90 const unsigned int maxHits(std::max({ caloVec[0]->dEdx().size(), caloVec[1]->dEdx().size(), caloVec[2]->dEdx().size() }));
91 const int bestPlane((caloVec[2]->
dEdx().
size() == maxHits) ? 2 : (caloVec[0]->
dEdx().
size() == maxHits) ? 0 : (caloVec[1]->
dEdx().
size() == maxHits) ? 1 : -1);
98 if (thisFit.pol0Chi2 < 0.f || thisFit.expChi2 < 0.f)
101 fitVec->push_back(thisFit);
106 e.put(std::move(fitVec));
107 e.put(std::move(trackAssns));
108 e.put(std::move(caloAssns));
ClusterModuleLabel join with tracks
const art::InputTag fCaloLabel
std::size_t size(FixedBins< T, C > const &) noexcept
process_name use argoneut_mc_hitfinder track
sbn::TrackStoppingChi2Alg fTrackStoppingChi2Alg
const float fMinTrackLength
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
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.
StoppingChi2Fit RunFit(const std::vector< float > &dEdxVec, const std::vector< float > &resRangeVec) const
const art::InputTag fTrackLabel