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

DeepDoubleCvL and DeepDoubleCvB tagger integration #24918

Merged
merged 46 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
217ee7c
WIP 10X
Oct 16, 2018
40f8607
Fixing modules
Oct 17, 2018
9a49df9
Removing redundant
Oct 26, 2018
f22430b
renaming
Oct 26, 2018
4c34f16
renaming"
Oct 27, 2018
912c23d
cleaning up
Oct 28, 2018
dd24af3
Removing straggling comments
Oct 28, 2018
c821036
Using one produces for all models
Oct 29, 2018
9017647
cleaning up
Oct 29, 2018
147839a
Use default DDB model
Oct 29, 2018
a90008a
merge
Oct 29, 2018
0188aba
Merge pull request #1 from andrzejnovak/renaming
andrzejnovak Oct 29, 2018
eb3e3ea
Addressing comments
Oct 30, 2018
7c16f68
Merge branch 'DDX10X' of https://github.com/andrzejnovak/cmssw into D…
Oct 30, 2018
9163e90
Adding dummy optional params to pass validation
Nov 2, 2018
d656aa9
Slava might be fine with this, I guess
Nov 2, 2018
0ed5f6f
Using switch in producer
Nov 2, 2018
afc1a59
cleaning comments
Nov 2, 2018
3c81d7b
Merge pull request #2 from andrzejnovak/switch
andrzejnovak Nov 2, 2018
79471b3
using cloning for modules
Nov 8, 2018
27bdb12
fix comments
Nov 8, 2018
81b0d65
Merge pull request #3 from andrzejnovak/switch
andrzejnovak Nov 8, 2018
f6ac641
one mass-independent cff file
Nov 10, 2018
d3b1b86
missing cff
Nov 10, 2018
e42d295
Merge pull request #4 from andrzejnovak/switch
andrzejnovak Nov 10, 2018
d17215a
Making sure of backwards compatibility for DDBFeatures&JetTags
Nov 12, 2018
5d8e94f
Merge pull request #5 from andrzejnovak/switch
andrzejnovak Nov 12, 2018
2e9926b
Cleaning up references
Nov 14, 2018
183aa17
Merge pull request #6 from andrzejnovak/switch
andrzejnovak Nov 14, 2018
3d8733b
add missing mass ind ddb
Nov 14, 2018
f338373
Merge pull request #7 from andrzejnovak/switch
andrzejnovak Nov 14, 2018
f804c4e
Adding a pt>150 cut to DDX
Nov 15, 2018
aef474e
Merge pull request #8 from andrzejnovak/switch
andrzejnovak Nov 15, 2018
aa32440
Default not predicted values to -1, use auto descriptions
Nov 18, 2018
92bb0d6
Merge pull request #9 from andrzejnovak/switch
andrzejnovak Nov 18, 2018
5703a71
Run TF only when features are filled
Nov 21, 2018
5f8c3a4
Merge pull request #10 from andrzejnovak/switch
andrzejnovak Nov 21, 2018
b456bf9
Fix batch eval
Nov 22, 2018
230e8d3
Merge pull request #11 from andrzejnovak/switch
andrzejnovak Nov 22, 2018
f3eb756
Fix print for python3
Nov 27, 2018
f74c4c1
Merge pull request #12 from andrzejnovak/switch
andrzejnovak Nov 27, 2018
40f5b44
Remove type specification
Nov 27, 2018
2c45ee3
Remove wrong flavour print check
Nov 27, 2018
1658fcb
Merge pull request #13 from andrzejnovak/switch
andrzejnovak Nov 27, 2018
bbadee2
Fix indentation
Nov 28, 2018
fc232c4
Merge pull request #14 from andrzejnovak/switch
andrzejnovak Nov 28, 2018
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
15 changes: 0 additions & 15 deletions DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DataFormats_BTauReco_DeepDoubleBFeatures_h
#define DataFormats_BTauReco_DeepDoubleBFeatures_h
#ifndef DataFormats_BTauReco_DeepDoubleXFeatures_h
#define DataFormats_BTauReco_DeepDoubleXFeatures_h

#include <vector>

Expand All @@ -10,7 +10,7 @@

namespace btagbtvdeep {

class DeepDoubleBFeatures {
class DeepDoubleXFeatures {

public:
JetFeatures jet_features;
Expand All @@ -26,4 +26,4 @@ class DeepDoubleBFeatures {

}

#endif //DataFormats_BTauReco_DeepDoubleBFeatures_h
#endif //DataFormats_BTauReco_DeepDoubleXFeatures_h
15 changes: 15 additions & 0 deletions DataFormats/BTauReco/interface/DeepDoubleXTagInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef DataFormats_BTauReco_DeepDoubleXTagInfo_h
#define DataFormats_BTauReco_DeepDoubleXTagInfo_h

#include "DataFormats/BTauReco/interface/FeaturesTagInfo.h"
#include "DataFormats/BTauReco/interface/DeepDoubleXFeatures.h"

namespace reco {

typedef FeaturesTagInfo<btagbtvdeep::DeepDoubleXFeatures> DeepDoubleXTagInfo;

DECLARE_EDM_REFS( DeepDoubleXTagInfo )

}

#endif // DataFormats_BTauReco_DeepDoubleXTagInfo_h
22 changes: 11 additions & 11 deletions DataFormats/BTauReco/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
#include "DataFormats/BTauReco/interface/ChargedCandidateFeatures.h"
#include "DataFormats/BTauReco/interface/DeepFlavourFeatures.h"
#include "DataFormats/BTauReco/interface/DeepFlavourTagInfo.h"
#include "DataFormats/BTauReco/interface/DeepDoubleBFeatures.h"
#include "DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h"
#include "DataFormats/BTauReco/interface/DeepDoubleXFeatures.h"
#include "DataFormats/BTauReco/interface/DeepDoubleXTagInfo.h"
#include "DataFormats/BTauReco/interface/DeepBoostedJetTagInfo.h"


Expand Down Expand Up @@ -419,15 +419,15 @@ namespace DataFormats_BTauReco {
edm::Wrapper<reco::DeepFlavourTagInfoCollection> deep_flavour_tag_info_collection_edm_wrapper;

btagbtvdeep::BoostedDoubleSVTagInfoFeatures boosted_double_sv_tag_info_features;
btagbtvdeep::DeepDoubleBFeatures deep_doubleb_features;
reco::DeepDoubleBTagInfo deep_doubleb_tag_info;
reco::DeepDoubleBTagInfoCollection deep_doubleb_tag_info_collection;
reco::DeepDoubleBTagInfoRef deep_doubleb_tag_info_collection_ref;
reco::DeepDoubleBTagInfoFwdRef deep_doubleb_tag_info_collection_fwd_ref;
reco::DeepDoubleBTagInfoRefProd deep_doubleb_tag_info_collection_ref_prod;
reco::DeepDoubleBTagInfoRefVector deep_doubleb_tag_info_collection_ref_vector;
edm::Wrapper<reco::DeepDoubleBTagInfoCollection> deep_doubleb_tag_info_collection_edm_wrapper;

btagbtvdeep::DeepDoubleXFeatures deep_doublex_features;
reco::DeepDoubleXTagInfo deep_doublex_tag_info;
reco::DeepDoubleXTagInfoCollection deep_doublex_tag_info_collection;
reco::DeepDoubleXTagInfoRef deep_doublex_tag_info_collection_ref;
reco::DeepDoubleXTagInfoFwdRef deep_doublex_tag_info_collection_fwd_ref;
reco::DeepDoubleXTagInfoRefProd deep_doublex_tag_info_collection_ref_prod;
reco::DeepDoubleXTagInfoRefVector deep_doublex_tag_info_collection_ref_vector;
edm::Wrapper<reco::DeepDoubleXTagInfoCollection> deep_doublex_tag_info_collection_edm_wrapper;
btagbtvdeep::DeepBoostedJetFeatures deep_boosted_jet_tag_info_features;
reco::DeepBoostedJetTagInfo deep_boosted_jet_tag_info;
reco::DeepBoostedJetTagInfoCollection deep_boosted_jet_tag_info_collection;
Expand Down
20 changes: 10 additions & 10 deletions DataFormats/BTauReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@
<class name="btagbtvdeep::DeepFlavourFeatures" ClassVersion="3">
<version ClassVersion="3" checksum="2487956635"/>
</class>
<class name="btagbtvdeep::DeepDoubleBFeatures" ClassVersion="3">
<version ClassVersion="3" checksum="2060552560"/>
<class name="btagbtvdeep::DeepDoubleXFeatures" ClassVersion="3">
<version ClassVersion="3" checksum="2789036018"/>
</class>
<class name="btagbtvdeep::BoostedDoubleSVTagInfoFeatures" ClassVersion="3">
<version ClassVersion="3" checksum="683471882"/>
Expand All @@ -463,14 +463,14 @@
<class name="reco::DeepFlavourTagInfoRefVector"/>
<class name="edm::Wrapper<reco::DeepFlavourTagInfoCollection>"/>

<class name="reco::DeepDoubleBTagInfo"/>
<class name="reco::DeepDoubleBTagInfoCollection"/>
<class name="reco::DeepDoubleBTagInfoRef"/>
<class name="reco::DeepDoubleBTagInfoFwdRef"/>
<class name="reco::DeepDoubleBTagInfoRefProd"/>
<class name="reco::DeepDoubleBTagInfoRefVector"/>
<class name="edm::Wrapper<reco::DeepDoubleBTagInfoCollection>"/>

<class name="reco::DeepDoubleXTagInfo"/>
<class name="reco::DeepDoubleXTagInfoCollection"/>
<class name="reco::DeepDoubleXTagInfoRef"/>
<class name="reco::DeepDoubleXTagInfoFwdRef"/>
<class name="reco::DeepDoubleXTagInfoRefProd"/>
<class name="reco::DeepDoubleXTagInfoRefVector"/>
<class name="edm::Wrapper<reco::DeepDoubleXTagInfoCollection>"/>
<class name="btagbtvdeep::DeepBoostedJetFeatures"/>
<class name="reco::DeepBoostedJetTagInfo"/>
<class name="reco::DeepBoostedJetTagInfoCollection"/>
Expand Down
12 changes: 8 additions & 4 deletions PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
# DeepFlavour tag infos
, 'pfDeepFlavourTagInfos'
, 'pfNegativeDeepFlavourTagInfos'
# DeepDoubleB tag infos
, 'pfDeepDoubleBTagInfos'
# DeepDoubleB/C tag infos
, 'pfDeepDoubleXTagInfos'
# DeepBoostedJet tag infos
, 'pfDeepBoostedJetTagInfos'
]
Expand Down Expand Up @@ -189,8 +189,12 @@
, 'pfNegativeDeepFlavourJetTags:probc' : [["pfNegativeDeepFlavourTagInfos"], ['pfDeepCSVNegativeTagInfos', "pfImpactParameterTagInfos", 'pfInclusiveSecondaryVertexFinderNegativeTagInfos']]
, 'pfNegativeDeepFlavourJetTags:probuds' : [["pfNegativeDeepFlavourTagInfos"], ['pfDeepCSVNegativeTagInfos', "pfImpactParameterTagInfos", 'pfInclusiveSecondaryVertexFinderNegativeTagInfos']]
, 'pfNegativeDeepFlavourJetTags:probg' : [["pfNegativeDeepFlavourTagInfos"], ['pfDeepCSVNegativeTagInfos', "pfImpactParameterTagInfos", 'pfInclusiveSecondaryVertexFinderNegativeTagInfos']]
, 'pfDeepDoubleBJetTags:probQ' : [["pfDeepDoubleBTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleBJetTags:probH' : [["pfDeepDoubleBTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleBvLJetTags:probQCD' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleBvLJetTags:probHbb' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvLJetTags:probQCD' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvLJetTags:probHcc' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvBJetTags:probHbb' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfDeepDoubleCvBJetTags: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 @@ -60,8 +60,12 @@ def applyDeepBtagging( process, postfix="" ) :
rParam = 0.8,
jetCorrections = ('AK8PFPuppi', cms.vstring(['L2Relative', 'L3Absolute']), 'None'),
btagDiscriminators = [
'pfDeepDoubleBJetTags:probQ',
'pfDeepDoubleBJetTags:probH',
'pfDeepDoubleBvLJetTags:probQCD',
'pfDeepDoubleBvLJetTags:probHbb',
'pfDeepDoubleCvLJetTags:probQCD',
'pfDeepDoubleCvLJetTags:probHcc',
'pfDeepDoubleCvBJetTags:probHbb',
'pfDeepDoubleCvBJetTags:probHcc'
] + pfDeepBoostedJetTagsAll,
postfix = 'SlimmedAK8DeepTags'+postfix,
printWarning = False
Expand Down
4 changes: 2 additions & 2 deletions PhysicsTools/PatAlgos/python/tools/jetTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,9 @@ def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSou
flip = flip),
process, task)

if btagInfo == 'pfDeepDoubleBTagInfos':
if btagInfo == 'pfDeepDoubleXTagInfos':
addToProcessAndTask(btagPrefix+btagInfo+labelName+postfix,
btag.pfDeepDoubleBTagInfos.clone(
btag.pfDeepDoubleXTagInfos.clone(
jets = jetSource,
vertices=pvSource,
secondary_vertices=svSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"

#include "DataFormats/BTauReco/interface/DeepDoubleBFeatures.h"
#include "DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h"
#include "DataFormats/BTauReco/interface/DeepDoubleXFeatures.h"
#include "DataFormats/BTauReco/interface/DeepDoubleXTagInfo.h"

#include "RecoBTag/FeatureTools/interface/BoostedDoubleSVTagInfoConverter.h"
#include "RecoBTag/FeatureTools/interface/ChargedCandidateConverter.h"
Expand All @@ -34,17 +34,17 @@

#include "RecoBTag/FeatureTools/interface/deep_helpers.h"

class DeepDoubleBTagInfoProducer : public edm::stream::EDProducer<>
class DeepDoubleXTagInfoProducer : public edm::stream::EDProducer<>
{

public:
explicit DeepDoubleBTagInfoProducer(const edm::ParameterSet&);
~DeepDoubleBTagInfoProducer() override;
explicit DeepDoubleXTagInfoProducer(const edm::ParameterSet&);
~DeepDoubleXTagInfoProducer() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
typedef std::vector<reco::DeepDoubleBTagInfo> DeepDoubleBTagInfoCollection;
typedef std::vector<reco::DeepDoubleXTagInfo> DeepDoubleXTagInfoCollection;
typedef reco::VertexCompositePtrCandidateCollection SVCollection;
typedef reco::VertexCollection VertexCollection;
typedef edm::View<reco::BoostedDoubleSVTagInfo>
Expand All @@ -67,7 +67,7 @@ class DeepDoubleBTagInfoProducer : public edm::stream::EDProducer<>
edm::EDGetTokenT<BoostedDoubleSVTagInfoCollection> shallow_tag_info_token_;
};

DeepDoubleBTagInfoProducer::DeepDoubleBTagInfoProducer(
DeepDoubleXTagInfoProducer::DeepDoubleXTagInfoProducer(
const edm::ParameterSet& iConfig)
: jet_radius_(iConfig.getParameter<double>("jet_radius"))
, min_candidate_pt_(iConfig.getParameter<double>("min_candidate_pt"))
Expand All @@ -80,17 +80,17 @@ DeepDoubleBTagInfoProducer::DeepDoubleBTagInfoProducer(
, shallow_tag_info_token_(consumes<BoostedDoubleSVTagInfoCollection>(
iConfig.getParameter<edm::InputTag>("shallow_tag_infos")))
{
produces<DeepDoubleBTagInfoCollection>();
produces<DeepDoubleXTagInfoCollection>();
}

DeepDoubleBTagInfoProducer::~DeepDoubleBTagInfoProducer()
DeepDoubleXTagInfoProducer::~DeepDoubleXTagInfoProducer()
{
}

void DeepDoubleBTagInfoProducer::fillDescriptions(
void DeepDoubleXTagInfoProducer::fillDescriptions(
edm::ConfigurationDescriptions& descriptions)
{
// pfDeepDoubleBTagInfos
// pfDeepDoubleXTagInfos
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("shallow_tag_infos",
edm::InputTag("pfBoostedDoubleSVAK8TagInfos"));
Expand All @@ -100,14 +100,14 @@ void DeepDoubleBTagInfoProducer::fillDescriptions(
desc.add<edm::InputTag>("secondary_vertices",
edm::InputTag("inclusiveCandidateSecondaryVertices"));
desc.add<edm::InputTag>("jets", edm::InputTag("ak8PFJetsCHS"));
descriptions.add("pfDeepDoubleBTagInfos", desc);
descriptions.add("pfDeepDoubleXTagInfos", desc);
}

void DeepDoubleBTagInfoProducer::produce(edm::Event& iEvent,
void DeepDoubleXTagInfoProducer::produce(edm::Event& iEvent,
const edm::EventSetup& iSetup)
{

auto output_tag_infos = std::make_unique<DeepDoubleBTagInfoCollection>();
auto output_tag_infos = std::make_unique<DeepDoubleXTagInfoCollection>();

edm::Handle<edm::View<reco::Jet>> jets;
iEvent.getByToken(jet_token_, jets);
Expand Down Expand Up @@ -137,7 +137,7 @@ void DeepDoubleBTagInfoProducer::produce(edm::Event& iEvent,
{

// create data containing structure
btagbtvdeep::DeepDoubleBFeatures features;
btagbtvdeep::DeepDoubleXFeatures features;

// reco jet reference (use as much as possible)
const auto& jet = jets->at(jet_n);
Expand Down Expand Up @@ -346,4 +346,4 @@ void DeepDoubleBTagInfoProducer::produce(edm::Event& iEvent,
}

// define this as a plug-in
DEFINE_FWK_MODULE(DeepDoubleBTagInfoProducer);
DEFINE_FWK_MODULE(DeepDoubleXTagInfoProducer);
9 changes: 3 additions & 6 deletions RecoBTag/TensorFlow/interface/tensor_fillers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

#include "PhysicsTools/TensorFlow/interface/TensorFlow.h"
#include "DataFormats/BTauReco/interface/DeepFlavourTagInfo.h"
#include "DataFormats/BTauReco/interface/DeepDoubleBTagInfo.h"


#include "DataFormats/BTauReco/interface/DeepDoubleXTagInfo.h"

namespace btagbtvdeep {

Expand All @@ -23,9 +21,8 @@ namespace btagbtvdeep {

void db_tensor_filler(tensorflow::Tensor & tensor,
std::size_t jet_n,
const btagbtvdeep::DeepDoubleBFeatures & features) ;


const btagbtvdeep::DeepDoubleXFeatures & features) ;

void c_pf_tensor_filler(tensorflow::Tensor & tensor,
std::size_t jet_n,
std::size_t c_pf_n,
Expand Down
Loading