Skip to content

Commit

Permalink
Merge pull request #25650 from mbluj/CMSSW_10_2_X_DNNTauIDCodeFix
Browse files Browse the repository at this point in the history
Code quality fix for DNN TauID (102X)
  • Loading branch information
cmsbuild committed Jan 16, 2019
2 parents 6e348b7 + d255f7e commit 2d715a0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions RecoTauTag/RecoTau/interface/DeepTauBase.h
Expand Up @@ -83,9 +83,9 @@ class DeepTauBase : public edm::stream::EDProducer<edm::GlobalCache<DeepTauCache


DeepTauBase(const edm::ParameterSet& cfg, const OutputCollection& outputs, const DeepTauCache* cache);
virtual ~DeepTauBase() {}
~DeepTauBase() override {}

virtual void produce(edm::Event& event, const edm::EventSetup& es) override;
void produce(edm::Event& event, const edm::EventSetup& es) override;

static std::unique_ptr<DeepTauCache> initializeGlobalCache(const edm::ParameterSet& cfg);
static void globalEndJob(const DeepTauCache* cache){ }
Expand Down
2 changes: 1 addition & 1 deletion RecoTauTag/RecoTau/plugins/DPFIsolation.cc
Expand Up @@ -82,7 +82,7 @@ class DPFIsolation : public deep_tau::DeepTauBase {
}

private:
virtual tensorflow::Tensor getPredictions(edm::Event& event, const edm::EventSetup& es,
tensorflow::Tensor getPredictions(edm::Event& event, const edm::EventSetup& es,
edm::Handle<TauCollection> taus) override
{
edm::Handle<pat::PackedCandidateCollection> pfcands;
Expand Down
2 changes: 1 addition & 1 deletion RecoTauTag/RecoTau/plugins/DeepTauId.cc
Expand Up @@ -293,7 +293,7 @@ class DeepTauId : public deep_tau::DeepTauBase {
}

private:
virtual tensorflow::Tensor getPredictions(edm::Event& event, const edm::EventSetup& es,
tensorflow::Tensor getPredictions(edm::Event& event, const edm::EventSetup& es,
edm::Handle<TauCollection> taus) override
{
edm::Handle<pat::ElectronCollection> electrons;
Expand Down
2 changes: 1 addition & 1 deletion RecoTauTag/RecoTau/src/DeepTauBase.cc
Expand Up @@ -60,7 +60,7 @@ DeepTauBase::Output::ResultMap DeepTauBase::Output::get_value(const edm::Handle<
float x = 0;
for(size_t num_elem : num_)
x += pred.matrix<float>()(tau_index, num_elem);
if(x != 0 && den_.size() > 0) {
if(x != 0 && !den_.empty()) {
float den_val = 0;
for(size_t den_elem : den_)
den_val += pred.matrix<float>()(tau_index, den_elem);
Expand Down

0 comments on commit 2d715a0

Please sign in to comment.