51 class MCParticleShowerMatching;
87 produces< art::Assns<recob::Shower , simb::MCParticle, anab::BackTrackerMatchingData > > ();
120 std::unordered_map<int,double> trkide;
128 if(!showerListHandle.
isValid()){
129 std::cerr <<
"Shower handle is not valid!" << std::endl;
134 std::cerr <<
"Hit handle is not valid!" << std::endl;
138 auto const& showerList(*showerListHandle);
142 for(
size_t i_t=0; i_t<showerList.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 MCPartShowerassn->addSingle(shwPtr, maxp, btdata);
176 evt.
put(std::move(MCPartShowerassn));
void reconfigure(fhicl::ParameterSet const &p)
code to link reconstructed objects back to the MC truth information
art::InputTag fHitModuleLabel
Declaration of signal hit object.
MCParticleShowerMatching & operator=(MCParticleShowerMatching const &)=delete
ProductID put(std::unique_ptr< PROD > &&product)
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
void produce(art::Event &e) override
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
MCParticleShowerMatching(fhicl::ParameterSet const &p)
size_type get(size_type i, reference item, data_reference data) const
art::InputTag fShowerHitAssnLabel
art::InputTag fHitParticleAssnLabel
art::InputTag fShowerModuleLabel