From 4feb9c9ed9f2da6d0260b10448de96d79d0b0ef3 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Thu, 26 Oct 2017 15:19:13 +0200 Subject: [PATCH] Add protection againist missing (calo) tauId sources --- PhysicsTools/PatAlgos/plugins/PATTauProducer.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc index fcbd72bbf422b..9dccbe8f70709 100755 --- a/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc @@ -330,6 +330,11 @@ void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup edm::Handle caloTauIdDiscr; iEvent.getByToken(caloTauIDTokens_[i], caloTauIdDiscr); + if(!caloTauIdDiscr.isValid()){ + edm::LogWarning("DataSource") << "Tau discriminator '" << tauIDSrcs_[i].first + << "' has not been found in the event. It will not be embedded into the pat::Tau object."; + continue; + } ids[i].first = tauIDSrcs_[i].first; ids[i].second = getTauIdDiscriminator(caloTauCollection, idx, caloTauIdDiscr); } else {