-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23033 from jmduarte/double-b-rebased
TensorFlow-based DeepDoubleB tagger integration
- Loading branch information
Showing
52 changed files
with
1,934 additions
and
561 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
DataFormats/BTauReco/interface/BoostedDoubleSVTagInfoFeatures.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef DataFormats_BTauReco_BoostedDoubleSVTagInfoFeatures_h | ||
#define DataFormats_BTauReco_BoostedDoubleSVTagInfoFeatures_h | ||
|
||
namespace btagbtvdeep { | ||
|
||
class BoostedDoubleSVTagInfoFeatures { | ||
|
||
// Note: these variables are intended to match the variables defined in DataFormats/BTauReco/interface/TaggingVariable.h | ||
|
||
public: | ||
float jetNTracks; // tracks associated to jet | ||
float jetNSecondaryVertices; // number of reconstructed possible secondary vertices in jet | ||
float trackSip3dSig_0; // 1st largest track 3D signed impact parameter significance | ||
float trackSip3dSig_1; // 2nd largest track 3D signed impact parameter significance | ||
float trackSip3dSig_2; // 3rd largest track 3D signed impact parameter significance | ||
float trackSip3dSig_3; // 4th largest track 3D signed impact parameter significance | ||
float tau1_trackSip3dSig_0; // 1st largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis | ||
float tau1_trackSip3dSig_1; // 2nd largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis | ||
float tau2_trackSip3dSig_0; // 1st largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis | ||
float tau2_trackSip3dSig_1; // 2nd largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis | ||
float trackSip2dSigAboveBottom_0;// track 2D signed impact parameter significance of 1st track lifting mass above bottom | ||
float trackSip2dSigAboveBottom_1;// track 2D signed impact parameter significance of 2nd track lifting mass above bottom | ||
float trackSip2dSigAboveCharm; // track 2D signed impact parameter significance of first track lifting mass above charm | ||
float tau1_trackEtaRel_0; // 1st smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis | ||
float tau1_trackEtaRel_1; // 2nd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis | ||
float tau1_trackEtaRel_2; // 3rd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis | ||
float tau2_trackEtaRel_0; // 1st smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis | ||
float tau2_trackEtaRel_1; // 2nd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis | ||
float tau2_trackEtaRel_2; // 3rd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis | ||
float tau1_vertexMass; // mass of track sum at secondary vertex associated to the 1st N-subjettiness axis | ||
float tau1_vertexEnergyRatio; // ratio of energy at secondary vertex over total energy associated to the 1st N-subjettiness axis | ||
float tau1_flightDistance2dSig; // transverse distance significance between primary and secondary vertex associated to the 1st N-subjettiness axis | ||
float tau1_vertexDeltaR; // pseudoangular distance between the 1st N-subjettiness axis and secondary vertex direction | ||
float tau2_vertexMass; // mass of track sum at secondary vertex associated to the 2nd N-subjettiness axis | ||
float tau2_vertexEnergyRatio; // ratio of energy at secondary vertex over total energy associated to the 2nd N-subjettiness axis | ||
float tau2_flightDistance2dSig; // transverse distance significance between primary and secondary vertex associated to the 2nd N-subjettiness axis | ||
float tau2_vertexDeltaR; // pseudoangular distance between the 2nd N-subjettiness axis and secondary vertex direction (NOT USED!) | ||
float z_ratio; // z ratio | ||
|
||
}; | ||
|
||
} | ||
|
||
#endif //DataFormats_BTauReco_BoostedDoubleSVTagInfoFeatures_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef DataFormats_BTauReco_DeepDoubleBFeatures_h | ||
#define DataFormats_BTauReco_DeepDoubleBFeatures_h | ||
|
||
#include <vector> | ||
|
||
#include "DataFormats/BTauReco/interface/JetFeatures.h" | ||
#include "DataFormats/BTauReco/interface/SecondaryVertexFeatures.h" | ||
#include "DataFormats/BTauReco/interface/BoostedDoubleSVTagInfoFeatures.h" | ||
#include "DataFormats/BTauReco/interface/ChargedCandidateFeatures.h" | ||
|
||
namespace btagbtvdeep { | ||
|
||
class DeepDoubleBFeatures { | ||
|
||
public: | ||
JetFeatures jet_features; | ||
BoostedDoubleSVTagInfoFeatures tag_info_features; | ||
|
||
std::vector<SecondaryVertexFeatures> sv_features; | ||
|
||
std::vector<ChargedCandidateFeatures> c_pf_features; | ||
|
||
std::size_t npv; // used by deep flavour | ||
}; | ||
|
||
|
||
} | ||
|
||
#endif //DataFormats_BTauReco_DeepDoubleBFeatures_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef DataFormats_BTauReco_DeepDoubleBTagInfo_h | ||
#define DataFormats_BTauReco_DeepDoubleBTagInfo_h | ||
|
||
#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h" | ||
#include "DataFormats/BTauReco/interface/BaseTagInfo.h" | ||
#include "DataFormats/BTauReco/interface/DeepFlavourTagInfo.h" | ||
#include "DataFormats/BTauReco/interface/DeepDoubleBFeatures.h" | ||
|
||
#include "DataFormats/PatCandidates/interface/Jet.h" | ||
|
||
namespace reco { | ||
|
||
typedef FeaturesTagInfo<btagbtvdeep::DeepDoubleBFeatures> DeepDoubleBTagInfo; | ||
|
||
DECLARE_EDM_REFS( DeepDoubleBTagInfo ) | ||
|
||
} | ||
|
||
#endif // DataFormats_BTauReco_DeepDoubleBTagInfo_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask | ||
|
||
def applyDeepBtagging( process, postfix="" ) : | ||
|
||
task = getPatAlgosToolsTask(process) | ||
|
||
from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection | ||
|
||
process.load('PhysicsTools.PatAlgos.slimming.slimmedJets_cfi') | ||
|
||
# update slimmed jets to include DeepFlavour (keep same name) | ||
# make clone for DeepFlavour-less slimmed jets, so output name is preserved | ||
addToProcessAndTask('slimmedJetsNoDeepFlavour', process.slimmedJets.clone(), process, task) | ||
updateJetCollection( | ||
process, | ||
jetSource = cms.InputTag('slimmedJetsNoDeepFlavour'), | ||
# updateJetCollection defaults to MiniAOD inputs but | ||
# here it is made explicit (as in training or MINIAOD redoing) | ||
pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'), | ||
pfCandidates = cms.InputTag('packedPFCandidates'), | ||
svSource = cms.InputTag('slimmedSecondaryVertices'), | ||
muSource = cms.InputTag('slimmedMuons'), | ||
elSource = cms.InputTag('slimmedElectrons'), | ||
jetCorrections = ('AK4PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'), | ||
btagDiscriminators = [ | ||
'pfDeepFlavourJetTags:probb', | ||
'pfDeepFlavourJetTags:probbb', | ||
'pfDeepFlavourJetTags:problepb', | ||
'pfDeepFlavourJetTags:probc', | ||
'pfDeepFlavourJetTags:probuds', | ||
'pfDeepFlavourJetTags:probg', | ||
], | ||
postfix = 'SlimmedDeepFlavour'+postfix, | ||
printWarning = False | ||
) | ||
|
||
# slimmedJets with DeepFlavour (remove DeepFlavour-less) | ||
delattr(process, 'slimmedJets') | ||
addToProcessAndTask('slimmedJets', getattr(process,'selectedUpdatedPatJetsSlimmedDeepFlavour'+postfix).clone(), process, task) | ||
# delete module not used anymore (slimmedJets substitutes) | ||
delattr(process, 'selectedUpdatedPatJetsSlimmedDeepFlavour'+postfix) | ||
|
||
|
||
|
||
# update slimmed jets to include DeepFlavour (keep same name) | ||
# make clone for DeepDoubleB-less slimmed AK8 jets, so output name is preserved | ||
addToProcessAndTask('slimmedJetsAK8NoDeepDoubleB', process.slimmedJetsAK8.clone(), process, task) | ||
updateJetCollection( | ||
process, | ||
jetSource = cms.InputTag('slimmedJetsAK8NoDeepDoubleB'), | ||
# updateJetCollection defaults to MiniAOD inputs but | ||
# here it is made explicit (as in training or MINIAOD redoing) | ||
pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'), | ||
pfCandidates = cms.InputTag('packedPFCandidates'), | ||
svSource = cms.InputTag('slimmedSecondaryVertices'), | ||
muSource = cms.InputTag('slimmedMuons'), | ||
elSource = cms.InputTag('slimmedElectrons'), | ||
rParam = 0.8, | ||
jetCorrections = ('AK8PFPuppi', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'), | ||
btagDiscriminators = [ | ||
'pfDeepDoubleBJetTags:probQ', | ||
'pfDeepDoubleBJetTags:probH', | ||
], | ||
postfix = 'SlimmedAK8DeepDoubleB'+postfix, | ||
printWarning = False | ||
) | ||
|
||
# slimmedJetsAK8 with DeepDoubleB (remove DeepDoubleB-less) | ||
delattr(process, 'slimmedJetsAK8') | ||
addToProcessAndTask('slimmedJetsAK8', getattr(process,'selectedUpdatedPatJetsSlimmedAK8DeepDoubleB'+postfix).clone(), process, task) | ||
# delete module not used anymore (slimmedJetsAK8 substitutes) | ||
delattr(process, 'selectedUpdatedPatJetsSlimmedAK8DeepDoubleB'+postfix) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.