Skip to content

Commit

Permalink
Fixed problems to be compatible with branch CMSSW_10_4_X
Browse files Browse the repository at this point in the history
  • Loading branch information
MRD2F committed Oct 24, 2018
1 parent 5c3938c commit 194a1d5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
14 changes: 6 additions & 8 deletions RecoTauTag/RecoTau/plugins/DeepTauId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ class DeepTauId : public deep_tau::DeepTauBase {
desc.add<edm::InputTag>("muons", edm::InputTag("slimmedMuons"));
desc.add<edm::InputTag>("taus", edm::InputTag("slimmedTaus"));
desc.add<std::string>("graph_file", "RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N.pb");

edm::ParameterSetDescription descWP;
descWP.add<std::string>("VVVLoose", "0");
descWP.add<std::string>("VVLoose", "0");
Expand Down Expand Up @@ -345,14 +344,14 @@ class DeepTauId : public deep_tau::DeepTauBase {
? dPhi(leadChargedHadrCand->p4(), tau.p4()) : default_value;
get(dnn::leadChargedHadrCand_mass) = leadChargedHadrCand
? leadChargedHadrCand->p4().mass() : default_value;
get(dnn::pt_weighted_deta_strip) = clusterVariables.tau_pt_weighted_deta_strip(tau, tau.decayMode());
get(dnn::pt_weighted_dphi_strip) = clusterVariables.tau_pt_weighted_dphi_strip(tau, tau.decayMode());
get(dnn::pt_weighted_dr_signal) = clusterVariables.tau_pt_weighted_dr_signal(tau, tau.decayMode());
get(dnn::pt_weighted_dr_iso) = clusterVariables.tau_pt_weighted_dr_iso(tau, tau.decayMode());
get(dnn::pt_weighted_deta_strip) = reco::tau::pt_weighted_deta_strip(tau, tau.decayMode());
get(dnn::pt_weighted_dphi_strip) = reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode());
get(dnn::pt_weighted_dr_signal) = reco::tau::pt_weighted_dr_signal(tau, tau.decayMode());
get(dnn::pt_weighted_dr_iso) = reco::tau::pt_weighted_dr_iso(tau, tau.decayMode());
get(dnn::leadingTrackNormChi2) = tau.leadingTrackNormChi2();
get(dnn::e_ratio) = clusterVariables.tau_Eratio(tau);
get(dnn::e_ratio) = reco::tau::eratio(tau);
get(dnn::gj_angle_diff) = CalculateGottfriedJacksonAngleDifference(tau);
get(dnn::n_photons) = clusterVariables.tau_n_photons_total(tau);
get(dnn::n_photons) = reco::tau::n_photons_total(tau);
get(dnn::emFraction) = tau.emFraction_MVA();
get(dnn::has_gsf_track) = leadChargedHadrCand && std::abs(leadChargedHadrCand->pdgId()) == 11;
get(dnn::inside_ecal_crack) = IsInEcalCrack(tau.p4().Eta());
Expand Down Expand Up @@ -616,7 +615,6 @@ class DeepTauId : public deep_tau::DeepTauBase {
edm::EDGetTokenT<ElectronCollection> electrons_token;
edm::EDGetTokenT<MuonCollection> muons_token;
std::string input_layer, output_layer;
TauIdMVAAuxiliaries clusterVariables;
};

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down
22 changes: 15 additions & 7 deletions RecoTauTag/RecoTau/python/tools/runTauIdMVA.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,27 @@ def __init__(self, process, cms, debug = False,
@staticmethod
def get_cmssw_version(debug = False):
"""returns 'CMSSW_X_Y_Z'"""
if debug: print "get_cmssw_version:", os.environ["CMSSW_RELEASE_BASE"].split('/')[-1]
return os.environ["CMSSW_RELEASE_BASE"].split('/')[-1]
cmssw_version = os.environ["CMSSW_VERSION"]
if debug: print "get_cmssw_version:", cmssw_version
return cmssw_version

@classmethod
def get_cmssw_version_number(klass, debug = False):
"""returns 'X_Y_Z' (without 'CMSSW_')"""
if debug: print "get_cmssw_version_number:", map(int, klass.get_cmssw_version().split("CMSSW_")[1].split("_")[0:3])
return map(int, klass.get_cmssw_version().split("CMSSW_")[1].split("_")[0:3])
"""returns '(release, subversion, patch)' (without 'CMSSW_')"""
v = klass.get_cmssw_version().split("CMSSW_")[1].split("_")[0:3]
if debug: print "get_cmssw_version_number:", v
if v[2] == "X":
patch = -1
else:
patch = int(v[2])
return int(v[0]), int(v[1]), patch

@staticmethod
def versionToInt(release=9, subversion=4, patch=0, debug = False):
if debug: print "versionToInt:", release * 10000 + subversion * 100 + patch
return release * 10000 + subversion * 100 + patch
version = release * 10000 + subversion * 100 + patch + 1 # shifted by one to account for pre-releases.
if debug: print "versionToInt:", version
return version


@classmethod
def is_above_cmssw_version(klass, release=9, subversion=4, patch=0, debug = False):
Expand Down
6 changes: 3 additions & 3 deletions RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.load('Configuration.StandardSequences.EndOfProcess_cff')

process.GlobalTag.globaltag = '94X_mc2017_realistic_v14'
process.GlobalTag.globaltag = '101X_upgrade2018_realistic_v7'

# Input source
process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring(
# File from dataset /GluGluHToTauTau_M125_13TeV_powheg_pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM
'/store/mc/RunIIFall17MiniAODv2/GluGluHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/90000/0498CD6A-CC42-E811-95D3-008CFA1CB8A8.root'
# File from dataset DY1JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8
'/store/mc/RunIISummer18MiniAOD/DY1JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/MINIAODSIM/101X_upgrade2018_realistic_v7-v1/20000/0617A8FC-1CA0-E811-9992-FA163E4CB6BE.root'
))

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) )
Expand Down

0 comments on commit 194a1d5

Please sign in to comment.