From 79471b35868e7a867a2df9369b6c74d8ed3422c5 Mon Sep 17 00:00:00 2001 From: anovak10 Date: Thu, 8 Nov 2018 12:10:35 +0100 Subject: [PATCH 1/2] using cloning for modules --- .../BTauReco/interface/DeepDoubleBTagInfo.h | 16 +++++++++++ .../plugins/DeepDoubleXTFJetTagsProducer.cc | 4 +-- .../python/pfDeepDoubleCvBJetTags_cfi.py | 27 +++++++------------ .../python/pfDeepDoubleCvLJetTags_cfi.py | 26 ++++++------------ ...MassIndependentDeepDoubleBvLJetTags_cfi.py | 27 +++++++------------ ...MassIndependentDeepDoubleCvBJetTags_cfi.py | 27 +++++++------------ ...MassIndependentDeepDoubleCvLJetTags_cfi.py | 26 ++++++------------ RecoBTag/TensorFlow/test/plotDDX.py | 2 +- 8 files changed, 62 insertions(+), 93 deletions(-) create mode 100644 DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h diff --git a/DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h b/DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h new file mode 100644 index 0000000000000..a6a4c497fa719 --- /dev/null +++ b/DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h @@ -0,0 +1,16 @@ +#ifndef DataFormats_BTauReco_DeepDoubleBTagInfo_h +#define DataFormats_BTauReco_DeepDoubleBTagInfo_h + +#include "DataFormats/BTauReco/interface/FeaturesTagInfo.h" +#include "DataFormats/BTauReco/interface/DeepDoubleXFeatures.h" + +//keeping for posterity +namespace reco { + +typedef FeaturesTagInfo DeepDoubleBTagInfo; + +DECLARE_EDM_REFS( DeepDoubleBTagInfo ) + +} + +#endif // DataFormats_BTauReco_DeepDoubleBTagInfo_h diff --git a/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc b/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc index b003fd9693715..ccac397332c8c 100644 --- a/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc +++ b/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc @@ -137,7 +137,7 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio desc.add>("output_names", { "ID_pred/Softmax" }); - { + //{ edm::ParameterSetDescription psBvL; psBvL.add>("probQCD", {0}); psBvL.add>("probHbb", {1}); @@ -158,7 +158,7 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio "CvB" >> (edm::ParameterDescription("flav_table", psCvB, true) and edm::ParameterDescription("graph_path", edm::FileInPath("RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB.pb"), true)) ); - } + //} desc.add("batch_eval", false); diff --git a/RecoBTag/TensorFlow/python/pfDeepDoubleCvBJetTags_cfi.py b/RecoBTag/TensorFlow/python/pfDeepDoubleCvBJetTags_cfi.py index 5ca1a9d8ce1b8..2620dfdc7749f 100644 --- a/RecoBTag/TensorFlow/python/pfDeepDoubleCvBJetTags_cfi.py +++ b/RecoBTag/TensorFlow/python/pfDeepDoubleCvBJetTags_cfi.py @@ -1,21 +1,12 @@ import FWCore.ParameterSet.Config as cms +from pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags -pfDeepDoubleCvBJetTags = cms.EDProducer('DeepDoubleXTFJetTagsProducer', - src = cms.InputTag('pfDeepDoubleXTagInfos'), - input_names = cms.vstring( - 'input_1', - 'input_2', - 'input_3' - ), - graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB.pb'), - lp_names = cms.vstring('db_input_batchnorm/keras_learning_phase'), - output_names = cms.vstring('ID_pred/Softmax'), - flavor = cms.string('CvB'), - flav_table = cms.PSet( - probHbb = cms.vuint32(0), - probHcc = cms.vuint32(1) - ), - batch_eval = cms.bool(False), - nThreads = cms.uint32(1), - singleThreadPool = cms.string('no_threads') +pfDeepDoubleCvBJetTags = pfDeepDoubleBvLJetTags.clone( + flavor = 'CvB', + graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB.pb'), + flav_table = cms.PSet( + probHbb = cms.vuint32(0), + probHcc = cms.vuint32(1) + ) ) + diff --git a/RecoBTag/TensorFlow/python/pfDeepDoubleCvLJetTags_cfi.py b/RecoBTag/TensorFlow/python/pfDeepDoubleCvLJetTags_cfi.py index 1ad3e28517179..65a57a4d0cb0f 100644 --- a/RecoBTag/TensorFlow/python/pfDeepDoubleCvLJetTags_cfi.py +++ b/RecoBTag/TensorFlow/python/pfDeepDoubleCvLJetTags_cfi.py @@ -1,21 +1,11 @@ import FWCore.ParameterSet.Config as cms +from pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags -pfDeepDoubleCvLJetTags = cms.EDProducer('DeepDoubleXTFJetTagsProducer', - src = cms.InputTag('pfDeepDoubleXTagInfos'), - input_names = cms.vstring( - 'input_1', - 'input_2', - 'input_3' - ), - graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC.pb'), - lp_names = cms.vstring('db_input_batchnorm/keras_learning_phase'), - output_names = cms.vstring('ID_pred/Softmax'), - flavor = cms.string('CvL'), - flav_table = cms.PSet( - probQCD = cms.vuint32(0), - probHcc = cms.vuint32(1) - ), - batch_eval = cms.bool(False), - nThreads = cms.uint32(1), - singleThreadPool = cms.string('no_threads') +pfDeepDoubleCvLJetTags = pfDeepDoubleBvLJetTags.clone( + flavor = 'CvL', + graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC.pb'), + flav_table = cms.PSet( + probQCD = cms.vuint32(0), + probHcc = cms.vuint32(1) + ) ) diff --git a/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleBvLJetTags_cfi.py b/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleBvLJetTags_cfi.py index dd13293716f1c..4d9ba54fdd621 100644 --- a/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleBvLJetTags_cfi.py +++ b/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleBvLJetTags_cfi.py @@ -1,21 +1,12 @@ import FWCore.ParameterSet.Config as cms +from pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags -pfMassIndependentDeepDoubleBvLJetTags = cms.EDProducer('DeepDoubleXTFJetTagsProducer', - src = cms.InputTag('pfDeepDoubleXTagInfos'), - input_names = cms.vstring( - 'input_1', - 'input_2', - 'input_3' - ), - graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDB_mass_independent.pb'), - lp_names = cms.vstring('db_input_batchnorm/keras_learning_phase'), - output_names = cms.vstring('ID_pred/Softmax'), - flavor = cms.string('BvL'), - flav_table = cms.PSet( - probQCD = cms.vuint32(0), - probHbb = cms.vuint32(1) - ), - batch_eval = cms.bool(False), - nThreads = cms.uint32(1), - singleThreadPool = cms.string('no_threads') +pfMassIndependentDeepDoubleBvLJetTags = pfDeepDoubleBvLJetTags.clone( + flavor = 'BvL', + graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDB_mass_independent.pb'), + flav_table = cms.PSet( + probQCD = cms.vuint32(0), + probHbb = cms.vuint32(1) + ) ) + diff --git a/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvBJetTags_cfi.py b/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvBJetTags_cfi.py index 0a86eb1b7502b..9c2ad90bf82b3 100644 --- a/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvBJetTags_cfi.py +++ b/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvBJetTags_cfi.py @@ -1,21 +1,12 @@ import FWCore.ParameterSet.Config as cms +from pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags -pfMassIndependentDeepDoubleCvBJetTags = cms.EDProducer('DeepDoubleXTFJetTagsProducer', - src = cms.InputTag('pfDeepDoubleXTagInfos'), - input_names = cms.vstring( - 'input_1', - 'input_2', - 'input_3' - ), - graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB_mass_independent.pb'), - lp_names = cms.vstring('db_input_batchnorm/keras_learning_phase'), - output_names = cms.vstring('ID_pred/Softmax'), - flavor = cms.string('CvB'), - flav_table = cms.PSet( - probHbb = cms.vuint32(0), - probHcc = cms.vuint32(1) - ), - batch_eval = cms.bool(False), - nThreads = cms.uint32(1), - singleThreadPool = cms.string('no_threads') +pfMassIndependentDeepDoubleCvBJetTags = pfDeepDoubleBvLJetTags.clone( + flavor = 'CvB', + graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB_mass_independent.pb'), + flav_table = cms.PSet( + probHbb = cms.vuint32(0), + probHcc = cms.vuint32(1) + ) ) + diff --git a/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvLJetTags_cfi.py b/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvLJetTags_cfi.py index 469dd8f1b4f6f..84528b0adad22 100644 --- a/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvLJetTags_cfi.py +++ b/RecoBTag/TensorFlow/python/pfMassIndependentDeepDoubleCvLJetTags_cfi.py @@ -1,21 +1,11 @@ import FWCore.ParameterSet.Config as cms +from pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags -pfMassIndependentDeepDoubleCvLJetTags = cms.EDProducer('DeepDoubleXTFJetTagsProducer', - src = cms.InputTag('pfDeepDoubleXTagInfos'), - input_names = cms.vstring( - 'input_1', - 'input_2', - 'input_3' - ), - graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC_mass_independent.pb'), - lp_names = cms.vstring('db_input_batchnorm/keras_learning_phase'), - output_names = cms.vstring('ID_pred/Softmax'), - flavor = cms.string('CvL'), - flav_table = cms.PSet( - probQCD = cms.vuint32(0), - probHcc = cms.vuint32(1) - ), - batch_eval = cms.bool(False), - nThreads = cms.uint32(1), - singleThreadPool = cms.string('no_threads') +pfMassIndependentDeepDoubleCvLJetTags = pfDeepDoubleBvLJetTags.clone( + flavor = 'CvL', + graph_path = cms.FileInPath('RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC_mass_independent.pb'), + flav_table = cms.PSet( + probQCD = cms.vuint32(0), + probHcc = cms.vuint32(1) + ) ) diff --git a/RecoBTag/TensorFlow/test/plotDDX.py b/RecoBTag/TensorFlow/test/plotDDX.py index 305468e51e5df..b403f65a2b44b 100644 --- a/RecoBTag/TensorFlow/test/plotDDX.py +++ b/RecoBTag/TensorFlow/test/plotDDX.py @@ -45,7 +45,7 @@ if jet.mass() < 40 or jet.mass() > 200: continue print jet.pt(), jet.mass() - print "DDB", jet.bDiscriminator("pfDeepDoubleBvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHbb") , jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHcc") + print "DDB", jet.bDiscriminator("pfDeepDoubleBvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHbb") , jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHcc") print "DDCvL", jet.bDiscriminator("pfDeepDoubleCvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleCvLJetTags:probHcc") , jet.bDiscriminator("pfDeepDoubleCvLJetTags:probHbb") print "DDCvL", jet.bDiscriminator("pfMassIndependentDeepDoubleCvLJetTags:probQCD"), jet.bDiscriminator("pfMassIndependentDeepDoubleCvLJetTags:probHcc") , jet.bDiscriminator("pfDeepDoubleMassIndependentCvLJetTags:probHbb") print "DDCvB", jet.bDiscriminator("pfDeepDoubleCvBJetTags:probHbb"), jet.bDiscriminator("pfDeepDoubleCvBJetTags:probHcc") , jet.bDiscriminator("pfDeepDoubleCvBJetTags:probQCD") From 27bdb12a8d338ac8452ea7188dec3fb61e1e0e5b Mon Sep 17 00:00:00 2001 From: anovak10 Date: Thu, 8 Nov 2018 15:01:22 +0100 Subject: [PATCH 2/2] fix comments --- RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc b/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc index ccac397332c8c..21a187304730c 100644 --- a/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc +++ b/RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc @@ -137,7 +137,6 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio desc.add>("output_names", { "ID_pred/Softmax" }); - //{ edm::ParameterSetDescription psBvL; psBvL.add>("probQCD", {0}); psBvL.add>("probHbb", {1}); @@ -158,7 +157,6 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio "CvB" >> (edm::ParameterDescription("flav_table", psCvB, true) and edm::ParameterDescription("graph_path", edm::FileInPath("RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB.pb"), true)) ); - //} desc.add("batch_eval", false);