75 produces< art::Assns<recob::Track, recob::PFParticle>>();
99 evt.
put( std::move(trackPFParticleAssns) );
109 evt.
put( std::move(trackPFParticleAssns) );
114 using HitToTrackMap = std::map<int, std::vector<art::Ptr<recob::Track>>>;
121 HitToTrackMap hitToTrackMap;
124 for(
size_t idx = 0; idx < trackHandle->size(); idx++)
128 std::vector<art::Ptr<recob::Hit>> trackHitVec = trackHitAssns.at(track.
key());
130 for (
const auto& hitPtr : trackHitVec)
132 hitToTrackMap[hitPtr.key()].push_back(track);
145 using TrackToPFParticleHitMap = std::map<art::Ptr<recob::Track>, std::map<art::Ptr<recob::PFParticle>,std::vector<art::Ptr<recob::Hit>>>>;
147 TrackToPFParticleHitMap trackToPFParticleHitMap;
150 for(
size_t idx = 0; idx < pfParticleHandle->size(); idx++)
155 std::vector<art::Ptr<recob::Cluster>> clusterVec = clusterAssns.at(pfParticle.
key());
158 for(
const auto&
cluster : clusterVec)
161 std::vector<art::Ptr<recob::Hit>> hitVec = clusterHitAssns.at(
cluster.key());
164 for(
const auto&
hit : hitVec)
168 if (hitToTrackItr != hitToTrackMap.end())
170 for(
auto&
track : hitToTrackItr->second)
171 trackToPFParticleHitMap[
track][pfParticle].push_back(
hit);
178 for (
auto& trackMapItr : trackToPFParticleHitMap)
180 std::vector<art::Ptr<recob::PFParticle>> pfParticleVec;
182 for(
auto& pfParticleMapItr : trackMapItr.second)
188 int nHitsPerView[] = {0,0,0};
190 for(
const auto&
hit : pfParticleMapItr.second)
192 nHitsPerView[
hit->View()]++;
195 int nViewsWithHits(0);
197 for(
auto& nHits : nHitsPerView)
if (nHits > 0) nViewsWithHits++;
199 if (nViewsWithHits < 2)
continue;
202 std::vector<art::Ptr<recob::Hit>> trackHitVec = trackHitAssns.at(trackMapItr.first.key());
205 float sharedHitFrac = float(pfParticleMapItr.second.size()) /
float(trackHitVec.size());
207 if (sharedHitFrac < 0.3)
continue;
210 pfParticleVec.push_back(pfParticleMapItr.first);
213 util::CreateAssn(*
this, evt, trackMapItr.first, pfParticleVec, *trackPFParticleAssns);
216 evt.
put( std::move(trackPFParticleAssns));
virtual ~TrackPFParticleMatch()
Collect all the geometry header files together.
TrackPFParticleMatch(fhicl::ParameterSet const &p)
Declaration of signal hit object.
Cluster finding and building.
ProductID put(std::unique_ptr< PROD > &&product)
std::string fTrackModuleLabel
std::string fPFParticleModuleLabel
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
Declaration of cluster object.
Provides recob::Track data product.
Detector simulation of raw signals on wires.
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
void produce(art::Event &e) override
void reconfigure(fhicl::ParameterSet const &p)
Algorithm for generating space points from hits.
art framework interface to geometry description