51 class MCParticleTrackMatching;
87 produces< art::Assns<recob::Track , simb::MCParticle, anab::BackTrackerMatchingData > > ();
120 std::unordered_map<int,double> trkide;
128 if(!trackListHandle.
isValid()){
129 std::cerr <<
"Track handle is not valid!" << std::endl;
134 std::cerr <<
"Hit handle is not valid!" << std::endl;
138 auto const& trackList(*trackListHandle);
142 for(
size_t i_t=0; i_t<trackList.size(); ++i_t){
147 std::vector< art::Ptr<recob::Hit> > allHits = fmtht.at(i_t);
149 std::vector<anab::BackTrackerHitMatchingData const*> bthmd_vec;
150 std::vector< art::Ptr<simb::MCParticle> > matchedParticlePtrs;
155 for(
size_t i_h=0; i_h<allHits.size(); ++i_h){
156 bthmd_vec.clear(); matchedParticlePtrs.clear();
157 particles_per_hit.
get(allHits[i_h].key(),matchedParticlePtrs,bthmd_vec);
159 for(
size_t i_p=0; i_p<matchedParticlePtrs.size(); ++i_p){
160 trkide[ matchedParticlePtrs[i_p]->TrackId() ] += bthmd_vec[i_p]->energy;
161 tote += bthmd_vec[i_p]->energy;
162 if( trkide[ matchedParticlePtrs[i_p]->TrackId() ] > maxe ){
163 maxe = trkide[ matchedParticlePtrs[i_p]->TrackId() ];
164 maxp = matchedParticlePtrs[i_p];
172 MCPartTrackassn->addSingle(trkPtr, maxp, btdata);
176 evt.
put(std::move(MCPartTrackassn));
code to link reconstructed objects back to the MC truth information
art::InputTag fTrackHitAssnLabel
Declaration of signal hit object.
MCParticleTrackMatching & operator=(MCParticleTrackMatching const &)=delete
ProductID put(std::unique_ptr< PROD > &&product)
MCParticleTrackMatching(fhicl::ParameterSet const &p)
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
Provides recob::Track data product.
art::InputTag fHitModuleLabel
void reconfigure(fhicl::ParameterSet const &p)
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
size_type get(size_type i, reference item, data_reference data) const
void produce(art::Event &e) override
art::InputTag fTrackModuleLabel
art::InputTag fHitParticleAssnLabel