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 41 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,9 +10,18 @@

namespace btagbtvdeep {

class DeepDoubleBFeatures {
class DeepDoubleXFeatures {

public:

bool empty() const {
return is_empty_;
}

void filled(){
is_empty_ = false;
}

JetFeatures jet_features;
BoostedDoubleSVTagInfoFeatures tag_info_features;

Expand All @@ -21,9 +30,12 @@ class DeepDoubleBFeatures {
std::vector<ChargedCandidateFeatures> c_pf_features;

std::size_t npv; // used by deep flavour
};

private:
bool is_empty_ = true;

};

}

#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
23 changes: 12 additions & 11 deletions DataFormats/BTauReco/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@
#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"



namespace reco {
typedef TrackTauImpactParameterAssociationCollection::map_type TrackTauImpactParameterAssociationMapType;
typedef TrackTauImpactParameterAssociationCollection::ref_type TrackTauImpactParameterAssociationRefType;
Expand Down Expand Up @@ -419,15 +420,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
22 changes: 11 additions & 11 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="1764960743"/>
</class>
<class name="btagbtvdeep::BoostedDoubleSVTagInfoFeatures" ClassVersion="3">
<version ClassVersion="3" checksum="683471882"/>
Expand All @@ -462,15 +462,15 @@
<class name="reco::DeepFlavourTagInfoRefProd"/>
<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
18 changes: 14 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,18 @@
, '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']]
, 'pfMassIndependentDeepDoubleBvLJetTags:probQCD' : [["pfDeepDoubleXTagInfos"], ['pfBoostedDoubleSVAK8TagInfos', "pfImpactParameterAK8TagInfos", 'pfInclusiveSecondaryVertexFinderAK8TagInfos']]
, 'pfMassIndependentDeepDoubleBvLJetTags:probHbb' : [["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
14 changes: 12 additions & 2 deletions PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,18 @@ 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',
'pfMassIndependentDeepDoubleBvLJetTags:probQCD',
'pfMassIndependentDeepDoubleBvLJetTags:probHbb',
'pfMassIndependentDeepDoubleCvLJetTags:probQCD',
'pfMassIndependentDeepDoubleCvLJetTags:probHcc',
'pfMassIndependentDeepDoubleCvBJetTags:probHbb',
'pfMassIndependentDeepDoubleCvBJetTags: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
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
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 @@ -59,6 +59,7 @@ class DeepDoubleBTagInfoProducer : public edm::stream::EDProducer<>
}

const double jet_radius_;
const double min_jet_pt_;
const double min_candidate_pt_;

edm::EDGetTokenT<edm::View<reco::Jet>> jet_token_;
Expand All @@ -67,9 +68,10 @@ 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_jet_pt_(iConfig.getParameter<double>("min_jet_pt"))
, min_candidate_pt_(iConfig.getParameter<double>("min_candidate_pt"))
, jet_token_(consumes<edm::View<reco::Jet>>(
iConfig.getParameter<edm::InputTag>("jets")))
Expand All @@ -80,34 +82,35 @@ 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"));
desc.add<double>("jet_radius", 0.8);
desc.add<double>("min_jet_pt", 150);
desc.add<double>("min_candidate_pt", 0.95);
desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
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,11 +140,15 @@ 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);

edm::RefToBase<reco::Jet> jet_ref(jets, jet_n);
if (jet.pt() > min_jet_pt_)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which pt are we using at this point?
I printed out a few cases before the last changes and I see the discriminator value going to 0 for jets with pt above 150 GeV (the values below are slimmedJetsAK8 jet pt() [corrected value]).
My guess is that the pt at this point is not corrected. Is this choice OK for your physics needs?

e.g. in wf 136.8311

 loaded event 54880615
jet 0 170.957 discr 10 pfMassIndependentDeepDoubleCvBJetTags:probHbb 0                 <== was 0.324633

 loaded event 54936747
jet 2 150.022 discr 13 pfMassIndependentDeepDoubleCvLJetTags:probHcc 0                 <== was 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, IIUC this is the uncorrected pt. The 150 cut is OK, because I think we're only saving jets with pT > 170 and for our analysis we need higher pT jets. The concern is for other analyses but I think at the 150 anything 200 is safe.

Copy link
Contributor

@ferencek ferencek Nov 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cut is not at 170 but 100 GeV. But because of the loose cut, the jet pT can also go below 100 GeV (https://github.com/cms-sw/cmssw/blob/CMSSW_9_4_10/PhysicsTools/PatAlgos/python/slimming/applySubstructure_cff.py#L186-L188). This is for the default Puppi fat jets. The cut at 170 GeV (https://github.com/cms-sw/cmssw/blob/CMSSW_9_4_10/PhysicsTools/PatAlgos/python/slimming/applySubstructure_cff.py#L186-L188) is for CHS fat jets which are later matched to Puppi jets in order to pick up their kinematic properties and other variables (https://github.com/cms-sw/cmssw/blob/CMSSW_9_4_10/PhysicsTools/PatAlgos/python/slimming/applySubstructure_cff.py#L221-L243).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a lower cut then? @ferencek

Copy link
Contributor

@ferencek ferencek Nov 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 150 GeV on uncorrected pT should be fine because, as you said, meaningful analysis level cuts will be quite higher than that. I was just pointing out that the cut on ak8 puppi jets stored in MiniAOD is not a flat 170 GeV cut but is actually lower and a bit more complex because of the extra cutLoose and nLoose requirements. What will be done with jets that do not pass the cut? Some dummy discriminator value (preferably negative) will be stored?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only limited information is stored for lower-pT AK8 jets in miniAOD. @rappoccio can clarify further

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value when the output is initialized is 0, we could make it -1 I guess?

Copy link
Contributor

@ferencek ferencek Nov 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpedro88 I guess you are referring to the 170 GeV on CHS fat jets. Yes, only some of the Puppi fat jets (generally those with high pT) will have a matched CHS fat jets from which kinematic and other variables are picked up and added to the Puppi jet as userFloats.

However, here I am discussing something different since btag discriminators are added in a completely different way from userFloats so the above-mentioned cut on CHS jets plays no role. Here we are not so much after reducing the event size (although, presumably a lot of identical dummy discriminator values stored in the event can lead to better event compression) but reducing the processing time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrzejnovak I think a negative value would be better than some other normally allowed value. That way it will be easier to discriminate skipped jets based on their discriminator value.

{
features.filled();
// TagInfoCollection not in an associative container so search for matchs
const edm::View<reco::BoostedDoubleSVTagInfo>& taginfos = *shallow_tag_infos;
edm::Ptr<reco::BoostedDoubleSVTagInfo> match;
Expand Down Expand Up @@ -338,12 +345,12 @@ void DeepDoubleBTagInfoProducer::produce(edm::Event& iEvent,
}
}
}

}
output_tag_infos->emplace_back(features, jet_ref);
}

iEvent.put(std::move(output_tag_infos));
}

// 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