81 if (
evt.isRealData())
return;
96 std::unordered_map<int,double> trkide;
104 if(!trackListHandle.
isValid()){
105 std::cerr <<
"Track handle is not valid!" <<
std::endl;
110 std::cerr <<
"Hit handle is not valid!" <<
std::endl;
114 auto const& trackList(*trackListHandle);
118 for(
size_t i_t=0; i_t<trackList.size(); ++i_t){
123 std::vector< art::Ptr<recob::Hit> > allHits = fmtht.at(i_t);
125 std::vector<anab::BackTrackerHitMatchingData const*> bthmd_vec;
126 std::vector< art::Ptr<simb::MCParticle> > matchedParticlePtrs;
128 art::FindManyP<simb::MCParticle,anab::BackTrackerHitMatchingData>
131 for(
size_t i_h=0; i_h<allHits.size(); ++i_h){
132 bthmd_vec.clear(); matchedParticlePtrs.clear();
133 particles_per_hit.get(allHits[i_h].
key(),matchedParticlePtrs,bthmd_vec);
135 for(
size_t i_p=0; i_p<matchedParticlePtrs.size(); ++i_p){
136 trkide[ matchedParticlePtrs[i_p]->TrackId() ] += bthmd_vec[i_p]->energy;
137 tote += bthmd_vec[i_p]->energy;
138 if( trkide[ matchedParticlePtrs[i_p]->TrackId() ] > maxe ){
139 maxe = trkide[ matchedParticlePtrs[i_p]->TrackId() ];
140 maxp = matchedParticlePtrs[i_p];
148 MCPartTrackassn->addSingle(trkPtr, maxp, btdata);
art::InputTag fTrackHitAssnLabel
bool isValid() const noexcept
art::InputTag fHitModuleLabel
art::InputTag fTrackModuleLabel
art::InputTag fHitParticleAssnLabel
QTextStream & endl(QTextStream &s)