diff --git a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc index da081b082b413..56bbec7ffb236 100644 --- a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc +++ b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc @@ -151,7 +151,7 @@ std::unique_ptr PileupJetIdAlgo::getMVA(const std::vector ( dynamic_cast( tmpTMVAReader.FindMVA(tmvaMethod_.c_str()) ) ) ); } @@ -177,7 +177,7 @@ float PileupJetIdAlgo::getMVAval(const std::vector &varList, const float mvaval = -2; std::vector vars; for(std::vector::const_iterator it=varList.begin(); it!=varList.end(); ++it) { - std::pair var = variables_.at((*it).c_str()); + std::pair var = variables_.at(*it); vars.push_back( *var.first ); } mvaval = reader->GetClassifier(vars.data()); @@ -391,12 +391,15 @@ PileupJetIdentifier PileupJetIdAlgo::computeIdVariables(const reco::Jet * jet, f } if(pfTrk==nullptr) { //protection against empty pointers for the miniAOD case //To handle the electron case - if(lPF!=nullptr) { + if(isPacked) { + internalId_.d0_ = std::abs(lPack->dxy(vtx->position())); + internalId_.dZ_ = std::abs(lPack->dz(vtx->position())); + } + else if(lPF!=nullptr) { pfTrk=(lPF->trackRef().get()==nullptr)?lPF->gsfTrackRef().get():lPF->trackRef().get(); + internalId_.d0_ = std::abs(pfTrk->dxy(vtx->position())); + internalId_.dZ_ = std::abs(pfTrk->dz(vtx->position())); } - const reco::Track& impactTrack = (lPack==nullptr)?(*pfTrk):(lPack->pseudoTrack()); - internalId_.d0_ = std::abs(impactTrack.dxy(vtx->position())); - internalId_.dZ_ = std::abs(impactTrack.dz(vtx->position())); } else { internalId_.d0_ = std::abs(pfTrk->dxy(vtx->position()));