Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch for Flavor Description #2

Merged
merged 3 commits into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
, 'pfDeepDoubleCvLJetTags:probHcc' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvBJetTags:probHbb' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvBJetTags:probHcc' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfMassIndependentDeepDoubleCvLJetTags:probQCD' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfMassIndependentDeepDoubleCvLJetTags:probHcc' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfMassIndependentDeepDoubleCvBJetTags:probHbb' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfMassIndependentDeepDoubleCvBJetTags:probHcc' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
}

# meta-taggers are simple arithmetic on top of other taggers, they are stored here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ def applyDeepBtagging( process, postfix="" ) :
'pfDeepDoubleCvLJetTags:probQCD',
'pfDeepDoubleCvLJetTags:probHcc',
'pfDeepDoubleCvBJetTags:probHbb',
'pfDeepDoubleCvBJetTags:probHcc'
'pfDeepDoubleCvBJetTags:probHcc',
'pfMassIndependentDeepDoubleCvLJetTags:probQCD',
'pfMassIndependentDeepDoubleCvLJetTags:probHcc',
'pfMassIndependentDeepDoubleCvBJetTags:probHbb',
'pfMassIndependentDeepDoubleCvBJetTags:probHcc',
] + pfDeepBoostedJetTagsAll,
postfix = 'SlimmedAK8DeepTags'+postfix,
printWarning = False
Expand Down
1 change: 1 addition & 0 deletions RecoBTag/Configuration/python/RecoBTag_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from RecoBTag.CTagging.RecoCTagging_cff import *
from RecoBTag.Combined.deepFlavour_cff import *
from RecoBTag.TensorFlow.pfDeepFlavour_cff import *
from RecoBTag.TensorFlow.pfDeepDoubleX_cff import *
from RecoBTag.MXNet.pfDeepBoostedJet_cff import *
from RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff import *

Expand Down
80 changes: 21 additions & 59 deletions RecoBTag/TensorFlow/plugins/DeepDoubleXTFJetTagsProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,32 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio
desc.add<edm::InputTag>("src", edm::InputTag("pfDeepDoubleXTagInfos"));
desc.add<std::vector<std::string>>("input_names",
{ "input_1", "input_2", "input_3" });
desc.add<edm::FileInPath>("graph_path",
edm::FileInPath("RecoBTag/Combined/data/DeepDoubleB/V01/constant_graph_PtCut_MassSculptPen.pb"));
desc.add<std::vector<std::string>>("lp_names",
{ "db_input_batchnorm/keras_learning_phase" });
desc.add<std::vector<std::string>>("output_names",
{ "ID_pred/Softmax" });

{
edm::ParameterSetDescription psd0;
psd0.add<std::vector<unsigned int>>("probQCD", {0});
psd0.add<std::vector<unsigned int>>("probHbb", {1});
psd0.addOptional<std::vector<unsigned int>>("probHcc");
desc.add<edm::ParameterSetDescription>("flav_table", psd0);
edm::ParameterSetDescription psBvL;
psBvL.add<std::vector<unsigned int>>("probQCD", {0});
psBvL.add<std::vector<unsigned int>>("probHbb", {1});

edm::ParameterSetDescription psCvL;
psCvL.add<std::vector<unsigned int>>("probQCD", {0});
psCvL.add<std::vector<unsigned int>>("probHcc", {1});

edm::ParameterSetDescription psCvB;
psCvB.add<std::vector<unsigned int>>("probHbb", {0});
psCvB.add<std::vector<unsigned int>>("probHcc", {1});

desc.ifValue( edm::ParameterDescription<std::string>("flavor", "BvL", true),
"BvL" >> (edm::ParameterDescription<edm::ParameterSetDescription>("flav_table", psBvL, true) and
edm::ParameterDescription<edm::FileInPath>("graph_path", edm::FileInPath("RecoBTag/Combined/data/DeepDoubleB/V01/constant_graph_PtCut_MassSculptPen.pb"), true)) or
"CvL" >> (edm::ParameterDescription<edm::ParameterSetDescription>("flav_table", psCvL, true) and
edm::ParameterDescription<edm::FileInPath>("graph_path", edm::FileInPath("RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC.pb"), true) ) or
"CvB" >> (edm::ParameterDescription<edm::ParameterSetDescription>("flav_table", psCvB, true) and
edm::ParameterDescription<edm::FileInPath>("graph_path", edm::FileInPath("RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB.pb"), true))
);
}

desc.add<bool>("batch_eval", false);
Expand All @@ -153,58 +167,6 @@ void DeepDoubleXTFJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptio

descriptions.add("pfDeepDoubleBvLJetTags", desc);

// pfDeepDoubleCvLJetTags
edm::ParameterSetDescription desc2;
desc2.add<edm::InputTag>("src", edm::InputTag("pfDeepDoubleXTagInfos"));
desc2.add<std::vector<std::string>>("input_names",
{ "input_1", "input_2", "input_3" });
desc2.add<edm::FileInPath>("graph_path",
edm::FileInPath("RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDC.pb"));
desc2.add<std::vector<std::string>>("lp_names",
{ "db_input_batchnorm/keras_learning_phase" });
desc2.add<std::vector<std::string>>("output_names",
{ "ID_pred/Softmax" });
{
edm::ParameterSetDescription psd0;
psd0.add<std::vector<unsigned int>>("probQCD", {0});
psd0.add<std::vector<unsigned int>>("probHcc", {1});
psd0.addOptional<std::vector<unsigned int>>("probHbb");
desc2.add<edm::ParameterSetDescription>("flav_table", psd0);
}

desc2.add<bool>("batch_eval", false);

desc2.add<unsigned int>("nThreads", 1);
desc2.add<std::string>("singleThreadPool", "no_threads");

descriptions.add("pfDeepDoubleCvLJetTags", desc2);

// pfDeepDoubleCvBJetTags
edm::ParameterSetDescription desc3;
desc3.add<edm::InputTag>("src", edm::InputTag("pfDeepDoubleXTagInfos"));
desc3.add<std::vector<std::string>>("input_names",
{ "input_1", "input_2", "input_3" });
desc3.add<edm::FileInPath>("graph_path",
edm::FileInPath("RecoBTag/Combined/data/DeepDoubleX/94X/V01/DDCvB.pb"));
desc3.add<std::vector<std::string>>("lp_names",
{ "db_input_batchnorm/keras_learning_phase" });
desc3.add<std::vector<std::string>>("output_names",
{ "ID_pred/Softmax" });
{
edm::ParameterSetDescription psd0;
psd0.add<std::vector<unsigned int>>("probHbb", {0});
psd0.add<std::vector<unsigned int>>("probHcc", {1});
psd0.addOptional<std::vector<unsigned int>>("probQCD");
desc3.add<edm::ParameterSetDescription>("flav_table", psd0);
}

desc3.add<bool>("batch_eval", false);

desc3.add<unsigned int>("nThreads", 1);
desc3.add<std::string>("singleThreadPool", "no_threads");
descriptions.add("pfDeepDoubleCvBJetTags", desc3);


}

std::unique_ptr<DeepDoubleXTFCache> DeepDoubleXTFJetTagsProducer::initializeGlobalCache(
Expand Down
21 changes: 21 additions & 0 deletions RecoBTag/TensorFlow/python/pfDeepDoubleCvBJetTags_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FWCore.ParameterSet.Config as cms

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')
)
21 changes: 21 additions & 0 deletions RecoBTag/TensorFlow/python/pfDeepDoubleCvLJetTags_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FWCore.ParameterSet.Config as cms

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')
)
8 changes: 8 additions & 0 deletions RecoBTag/TensorFlow/python/pfDeepDoubleX_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from RecoBTag.TensorFlow.pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags
from RecoBTag.TensorFlow.pfDeepDoubleCvBJetTags_cfi import pfDeepDoubleCvBJetTags
from RecoBTag.TensorFlow.pfDeepDoubleCvLJetTags_cfi import pfDeepDoubleCvLJetTags

from RecoBTag.TensorFlow.pfMassIndependentDeepDoubleBvLJetTags_cfi import pfMassIndependentDeepDoubleBvLJetTags
from RecoBTag.TensorFlow.pfMassIndependentDeepDoubleCvBJetTags_cfi import pfMassIndependentDeepDoubleCvBJetTags
from RecoBTag.TensorFlow.pfMassIndependentDeepDoubleCvLJetTags_cfi import pfMassIndependentDeepDoubleCvLJetTags

3 changes: 0 additions & 3 deletions RecoBTag/TensorFlow/python/pfDeepFlavour_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

from RecoBTag.TensorFlow.pfDeepFlavourJetTags_cfi import pfDeepFlavourJetTags
from RecoBTag.TensorFlow.pfNegativeDeepFlavourJetTags_cfi import pfNegativeDeepFlavourJetTags
from RecoBTag.TensorFlow.pfDeepDoubleBvLJetTags_cfi import pfDeepDoubleBvLJetTags
from RecoBTag.TensorFlow.pfDeepDoubleCvBJetTags_cfi import pfDeepDoubleCvBJetTags
from RecoBTag.TensorFlow.pfDeepDoubleCvLJetTags_cfi import pfDeepDoubleCvLJetTags
from CommonTools.PileupAlgos.Puppi_cff import puppi
from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FWCore.ParameterSet.Config as cms

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')
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FWCore.ParameterSet.Config as cms

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')
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import FWCore.ParameterSet.Config as cms

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')
)
8 changes: 5 additions & 3 deletions RecoBTag/TensorFlow/test/plotDDX.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
if jet.mass() < 40 or jet.mass() > 200: continue

print jet.pt(), jet.mass()
print "DDB", jet.bDiscriminator("pfDeepDoubleBvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHbb")
print "DDCvL", jet.bDiscriminator("pfDeepDoubleCvLJetTags:probQCD"), jet.bDiscriminator("pfDeepDoubleCvLJetTags:probHcc")
print "DDCvB", jet.bDiscriminator("pfDeepDoubleCvBJetTags:probHbb"), jet.bDiscriminator("pfDeepDoubleCvBJetTags: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")
print "DDCvB", jet.bDiscriminator("pfMassIndependentDeepDoubleCvBJetTags:probHbb"), jet.bDiscriminator("pfMassIndependentDeepDoubleCvBJetTags:probHcc") , jet.bDiscriminator("pfMassIndependentDeepDoubleCvBJetTags:probQCD")
h_probQ_ddb.Fill(jet.bDiscriminator("pfDeepDoubleBvLJetTags:probQCD"))
h_probH_ddb.Fill(jet.bDiscriminator("pfDeepDoubleBvLJetTags:probHbb"))
h_probQ_ddc.Fill(jet.bDiscriminator("pfDeepDoubleCvLJetTags:probQCD"))
Expand Down
8 changes: 6 additions & 2 deletions RecoBTag/TensorFlow/test/test_deep_doublex_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@
'pfDeepDoubleCvLJetTags:probQCD',
'pfDeepDoubleCvLJetTags:probHcc',
'pfDeepDoubleCvBJetTags:probHbb',
'pfDeepDoubleCvBJetTags:probHcc'
'pfDeepDoubleCvBJetTags:probHcc',
'pfMassIndependentDeepDoubleCvLJetTags:probQCD',
'pfMassIndependentDeepDoubleCvLJetTags:probHcc',
'pfMassIndependentDeepDoubleCvBJetTags:probHbb',
'pfMassIndependentDeepDoubleCvBJetTags:probHcc',
]
)

Expand All @@ -70,7 +74,7 @@
#'/store/mc/RunIIFall17MiniAODv2/GluGluHToCC_M125_13TeV_powheg_pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v2/30000/72164088-CB67-E811-9D0D-008CFA197AC4.root',
#'/store/mc/RunIIFall17MiniAOD/QCD_HT700to1000_TuneCP5_13TeV-madgraph-pythia8/MINIAODSIM/94X_mc2017_realistic_v10-v1/20000/C0F304A4-23FA-E711-942E-E0071B6CAD20.root'
)
process.maxEvents.input = -1
process.maxEvents.input = 1000

from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
process.out.outputCommands.append('keep *_slimmedJetsAK8*_*_*')
Expand Down