CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
runTauIdMVA.TauIDEmbedder Class Reference
Inheritance diagram for runTauIdMVA.TauIDEmbedder:

Public Member Functions

def __init__
 
def get_cmssw_version_number (klass, debug=False)
 
def getDpfTauVersion (self, file_name)
 
def is_above_cmssw_version (klass, release=9, subversion=4, patch=0, debug=False)
 
def loadMVA_WPs_run2_2017 (self)
 
def processDeepProducer (self, producer_name, tauIDSources, workingPoints_)
 
def runTauID (self)
 

Static Public Member Functions

def get_cmssw_version (debug=False)
 
def versionToInt (release=9, subversion=4, patch=0, debug=False)
 

Public Attributes

 cms
 
 debug
 
 process
 
 rerunIsolationNewDMMVArun2016v1Task
 
 rerunIsolationNewDMMVArun2017v2Task
 
 rerunIsolationOldDMdR0p3MVArun2017v2Task
 
 rerunIsolationOldDMMVArun2016v1Task
 
 rerunIsolationOldDMMVArun2017v1Task
 
 rerunIsolationOldDMMVArun2017v2Task
 
 tauIdDiscrMVA_2017_version
 
 tauIdDiscrMVA_trainings_run2_2017
 
 tauIdDiscrMVA_WPs_run2_2017
 
 toKeep
 
 updatedTauName
 

Detailed Description

class to rerun the tau seq and acces trainings from the database

Definition at line 7 of file runTauIdMVA.py.

Constructor & Destructor Documentation

def runTauIdMVA.TauIDEmbedder.__init__ (   self,
  process,
  cms,
  debug = False,
  updatedTauName = "slimmedTausNewID",
  toKeep = ["2016v1",
  newDM2016v1,
  deepTau2017v1,
  DPFTau_2016_v0,
  tauIdDiscrMVA_trainings_run2_2017 = {             'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
  tauIdDiscrMVA_WPs_run2_2017 = {             'tauIdMVAIsoDBoldDMwLT2017' : {                 'Eff95' : "DBoldDMwLTEff95",
  Eff90 
)

Definition at line 19 of file runTauIdMVA.py.

19  'Eff90' : "DBoldDMwLTEff90",
20  'Eff80' : "DBoldDMwLTEff80",
21  'Eff70' : "DBoldDMwLTEff70",
22  'Eff60' : "DBoldDMwLTEff60",
23  'Eff50' : "DBoldDMwLTEff50",
24  'Eff40' : "DBoldDMwLTEff40"
25  }
26  },
27  tauIdDiscrMVA_2017_version = "v1",
28  conditionDB = "" # preparational DB: 'frontier://FrontierPrep/CMS_CONDITIONS'
29  ):
30  super(TauIDEmbedder, self).__init__()
31  self.process = process
32  self.cms = cms
33  self.debug = debug
34  self.updatedTauName = updatedTauName
35  self.process.load('RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi')
36  if len(conditionDB) != 0:
37  self.process.CondDBTauConnection.connect = cms.string(conditionDB)
38  self.process.loadRecoTauTagMVAsFromPrepDB.connect = cms.string(conditionDB)
39  # if debug:
40  # print self.process.CondDBTauConnection.connect
41  # print dir(self.process.loadRecoTauTagMVAsFromPrepDB)
42  # print self.process.loadRecoTauTagMVAsFromPrepDB.parameterNames_
43 
44  self.tauIdDiscrMVA_trainings_run2_2017 = tauIdDiscrMVA_trainings_run2_2017
45  self.tauIdDiscrMVA_WPs_run2_2017 = tauIdDiscrMVA_WPs_run2_2017
46  self.tauIdDiscrMVA_2017_version = tauIdDiscrMVA_2017_version
47  self.toKeep = toKeep
48 
49 

Member Function Documentation

def runTauIdMVA.TauIDEmbedder.get_cmssw_version (   debug = False)
static
returns 'CMSSW_X_Y_Z'

Definition at line 51 of file runTauIdMVA.py.

51  def get_cmssw_version(debug = False):
52  """returns 'CMSSW_X_Y_Z'"""
53  cmssw_version = os.environ["CMSSW_VERSION"]
54  if debug: print ("get_cmssw_version:", cmssw_version)
55  return cmssw_version
56 
def get_cmssw_version(debug=False)
Definition: runTauIdMVA.py:51
def runTauIdMVA.TauIDEmbedder.get_cmssw_version_number (   klass,
  debug = False 
)
returns '(release, subversion, patch)' (without 'CMSSW_')

Definition at line 58 of file runTauIdMVA.py.

References createfilelist.int, and split.

58  def get_cmssw_version_number(klass, debug = False):
59  """returns '(release, subversion, patch)' (without 'CMSSW_')"""
60  v = klass.get_cmssw_version().split("CMSSW_")[1].split("_")[0:3]
61  if debug: print ("get_cmssw_version_number:", v)
62  if v[2] == "X":
63  patch = -1
64  else:
65  patch = int(v[2])
66  return int(v[0]), int(v[1]), patch
67 
def get_cmssw_version_number(klass, debug=False)
Definition: runTauIdMVA.py:58
double split
Definition: MVATrainer.cc:139
def runTauIdMVA.TauIDEmbedder.getDpfTauVersion (   self,
  file_name 
)
returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \
   version number (vX), e.g. 2017v0, in general the following format: {year}v{version}

Definition at line 1001 of file runTauIdMVA.py.

References createfilelist.int.

1001  def getDpfTauVersion(self, file_name):
1002  """returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \
1003  version number (vX), e.g. 2017v0, in general the following format: {year}v{version}"""
1004  version_search = re.search('201[125678]v([0-9]+)[\._]', file_name)
1005  if not version_search:
1006  raise RuntimeError('File "{}" has an invalid name pattern, should be in the format "{year}v{version}". \
1007  Unable to extract version number.'.format(file_name))
1008  version = version_search.group(1)
1009  return int(version)
1010 
def getDpfTauVersion(self, file_name)
def runTauIdMVA.TauIDEmbedder.is_above_cmssw_version (   klass,
  release = 9,
  subversion = 4,
  patch = 0,
  debug = False 
)

Definition at line 76 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

76  def is_above_cmssw_version(klass, release=9, subversion=4, patch=0, debug = False):
77  split_cmssw_version = klass.get_cmssw_version_number()
78  if klass.versionToInt(release, subversion, patch) > klass.versionToInt(split_cmssw_version[0], split_cmssw_version[1], split_cmssw_version[2]):
79  if debug: print ("is_above_cmssw_version:", False)
80  return False
81  else:
82  if debug: print ("is_above_cmssw_version:", True)
83  return True
84 
def is_above_cmssw_version(klass, release=9, subversion=4, patch=0, debug=False)
Definition: runTauIdMVA.py:76
def runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017 (   self)

Definition at line 85 of file runTauIdMVA.py.

References dumpTrg.constants.debug, dumpWBM.constants.debug, dumpRunInfo.constants.debug, InterpolationDebug.debug, lumiPatch.constants.debug, DTDigiToRawModule.debug, CSCRPCData.debug, runTauIdMVA.TauIDEmbedder.debug, CSCDCCUnpacker.debug, CSCTMBScope.debug, CSCSegAlgoPreClustering.debug, ALIUtils.debug, DTRecHitProducer.debug, RPCPointProducer.debug, crabFunctions.CrabController.debug, DTDigiToRaw.debug, DTSegment4DT0Corrector.debug, DTRecSegment4DProducer.debug, MuonSeedProducer.debug, HiggsToZZ4LeptonsSkimEff.debug, DTTTrigCorrectionFirst.debug, HiggsTo2GammaSkim.debug, HiggsToZZ4LeptonsPreFilter.debug, DTSegmentsTask.debug, QCDSingleJetFilter.debug, pkg.AbstractPkg.debug, HiggsToZZ4LeptonsSkim.debug, JetAnaPythia< Jet >.debug, CSCDCCEventData.debug, MuScleFitFilter.debug, DTTPDeadWriter.debug, DTRecSegment2DProducer.debug, DTT0CalibrationRMS.debug, DTTTrigWriter.debug, DTRecSegment2DExtendedProducer.debug, SiPixelRawToDigi.debug, DTDDUUnpacker.debug, CSCAnodeLCTAnalyzer.debug, CSCCathodeLCTAnalyzer.debug, MuScleFitPlotter.debug, DTOccupancyPoint.debug, DTTTrigSyncT0Only.debug, CSCSegAlgoShowering.debug, util.rrapi.RRApi.debug, GEMCSCSegAlgoRR.debug, rrapi.RRApi.debug, ME0SegmentAlgorithm.debug, DTNoiseComputation.debug, DTSpyReader.debug, DTROS25Unpacker.debug, GEMSegmentAlgorithm.debug, HeavyChHiggsToTauNuSkim.debug, DTT0Calibration.debug, DTTTrigCalibration.debug, DTEfficiencyTask.debug, DTRunConditionVar.debug, CSCDDUEventData.debug, HCALResponse.debug, DTCombinatorialPatternReco4D.debug, DTMeantimerPatternReco4D.debug, DTRefitAndCombineReco4D.debug, DTClusterer.debug, DTChamberEfficiencyTask.debug, DTTMax.debug, MuonSeedCreator.debug, DTChamberEfficiency.debug, CSCCLCTData.debug, CSCTimingExtractor.debug, DTTTrigSyncFromDB.debug, PythiaFilterEMJetHeep.debug, DTVDriftCalibration.debug, DTTimingExtractor.debug, DTLinearDriftAlgo.debug, MuonSeedCleaner.debug, CSCTMBData.debug, DTParametrizedDriftAlgo.debug, PixelDataFormatter.debug, DTTTrigSyncTOFCorr.debug, DTCombinatorialPatternReco.debug, DTNoDriftAlgo.debug, MuonSeedBuilder.debug, DTMeantimerPatternReco.debug, DTLinearDriftFromDBAlgo.debug, DTCombinatorialExtendedPatternReco.debug, MuScleFitUtils.debug, DTSegmentUpdator.debug, CSCSegAlgoDF.debug, MagGeoBuilderFromDDD.debug, CSCEventData.debug, CSCTriggerPrimitivesReader.debug, RPCEfficiency.debug, BaseParticlePropagator.debug, CSCTMBHeader.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, CSCALCTHeader.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, crabFunctions.CrabTask.debug, Pythia8::PowhegHooksBB4L.debug, HltDiff.debug, relativeConstraints.keys, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version, and runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

86  if self.debug: print ("loadMVA_WPs_run2_2017: performed")
87  global cms
88  for training, gbrForestName in self.tauIdDiscrMVA_trainings_run2_2017.items():
89 
90  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
91  self.cms.PSet(
92  record = self.cms.string('GBRWrapperRcd'),
93  tag = self.cms.string("RecoTauTag_%s%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version)),
94  label = self.cms.untracked.string("RecoTauTag_%s%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version))
95  )
96  )
97 
98  for WP in self.tauIdDiscrMVA_WPs_run2_2017[training].keys():
99  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
100  self.cms.PSet(
101  record = self.cms.string('PhysicsTGraphPayloadRcd'),
102  tag = self.cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version, WP)),
103  label = self.cms.untracked.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version, WP))
104  )
105  )
106 
107  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
108  self.cms.PSet(
109  record = self.cms.string('PhysicsTFormulaPayloadRcd'),
110  tag = self.cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, self.tauIdDiscrMVA_2017_version)),
111  label = self.cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, self.tauIdDiscrMVA_2017_version))
112  )
113  )
114 
def loadMVA_WPs_run2_2017(self)
Definition: runTauIdMVA.py:85
def runTauIdMVA.TauIDEmbedder.processDeepProducer (   self,
  producer_name,
  tauIDSources,
  workingPoints_ 
)

Definition at line 987 of file runTauIdMVA.py.

References edm::ProductLabels.process, runTauIdMVA.TauIDEmbedder.process, DTT0WireWorkflow.DTT0WireWorkflow.process, DTVdriftWorkflow.DTvdriftWorkflow.process, cscdqm::HWStandbyType.process, DTTtrigWorkflow.DTttrigWorkflow.process, EgammaHLTValidationUtils.EgammaDQMModuleMaker.process, Config.Process.process, DTWorkflow.DTWorkflow.process, ConfigBuilder.ConfigBuilder.process, JsonOutputProducer::JsonConfigurationBlock.process, str, and pileupCalc.upper.

987  def processDeepProducer(self, producer_name, tauIDSources, workingPoints_):
988  for target,points in workingPoints_.iteritems():
989  cuts = self.cms.PSet()
990  setattr(tauIDSources, 'by{}VS{}raw'.format(producer_name[0].upper()+producer_name[1:], target),
991  self.cms.InputTag(producer_name, 'VS{}'.format(target)))
992  for point,cut in points.iteritems():
993  setattr(cuts, point, self.cms.string(str(cut)))
994 
995  setattr(tauIDSources, 'by{}{}VS{}'.format(point, producer_name[0].upper()+producer_name[1:], target),
996  self.cms.InputTag(producer_name, 'VS{}{}'.format(target, point)))
997 
998  setattr(getattr(self.process, producer_name), 'VS{}WP'.format(target), cuts)
999 
1000 
def processDeepProducer(self, producer_name, tauIDSources, workingPoints_)
Definition: runTauIdMVA.py:987
#define str(s)
def runTauIdMVA.TauIDEmbedder.runTauID (   self)

Definition at line 115 of file runTauIdMVA.py.

References dumpTrg.constants.debug, dumpWBM.constants.debug, dumpRunInfo.constants.debug, InterpolationDebug.debug, lumiPatch.constants.debug, DTDigiToRawModule.debug, CSCRPCData.debug, runTauIdMVA.TauIDEmbedder.debug, CSCDCCUnpacker.debug, ALIUtils.debug, CSCSegAlgoPreClustering.debug, CSCTMBScope.debug, DTRecHitProducer.debug, RPCPointProducer.debug, crabFunctions.CrabController.debug, DTDigiToRaw.debug, DTRecSegment4DProducer.debug, DTSegment4DT0Corrector.debug, MuonSeedProducer.debug, HiggsToZZ4LeptonsSkimEff.debug, DTTTrigCorrectionFirst.debug, HiggsTo2GammaSkim.debug, HiggsToZZ4LeptonsPreFilter.debug, QCDSingleJetFilter.debug, DTSegmentsTask.debug, pkg.AbstractPkg.debug, JetAnaPythia< Jet >.debug, HiggsToZZ4LeptonsSkim.debug, DTTPDeadWriter.debug, MuScleFitFilter.debug, CSCDCCEventData.debug, DTRecSegment2DProducer.debug, DTT0CalibrationRMS.debug, DTRecSegment2DExtendedProducer.debug, SiPixelRawToDigi.debug, DTTTrigWriter.debug, DTDDUUnpacker.debug, CSCAnodeLCTAnalyzer.debug, CSCCathodeLCTAnalyzer.debug, MuScleFitPlotter.debug, DTTTrigSyncT0Only.debug, DTOccupancyPoint.debug, CSCSegAlgoShowering.debug, util.rrapi.RRApi.debug, GEMCSCSegAlgoRR.debug, rrapi.RRApi.debug, DTNoiseComputation.debug, ME0SegmentAlgorithm.debug, DTSpyReader.debug, DTT0Calibration.debug, GEMSegmentAlgorithm.debug, DTROS25Unpacker.debug, HeavyChHiggsToTauNuSkim.debug, DTTTrigCalibration.debug, CSCDDUEventData.debug, DTEfficiencyTask.debug, DTRunConditionVar.debug, HCALResponse.debug, DTCombinatorialPatternReco4D.debug, DTMeantimerPatternReco4D.debug, DTRefitAndCombineReco4D.debug, DTClusterer.debug, DTChamberEfficiencyTask.debug, MuonSeedCreator.debug, DTTMax.debug, DTChamberEfficiency.debug, CSCCLCTData.debug, DTTTrigSyncFromDB.debug, CSCTimingExtractor.debug, PythiaFilterEMJetHeep.debug, DTVDriftCalibration.debug, DTTimingExtractor.debug, DTLinearDriftAlgo.debug, MuonSeedCleaner.debug, CSCTMBData.debug, DTParametrizedDriftAlgo.debug, PixelDataFormatter.debug, DTTTrigSyncTOFCorr.debug, DTCombinatorialPatternReco.debug, MuonSeedBuilder.debug, DTNoDriftAlgo.debug, DTMeantimerPatternReco.debug, DTCombinatorialExtendedPatternReco.debug, DTLinearDriftFromDBAlgo.debug, MuScleFitUtils.debug, DTSegmentUpdator.debug, CSCSegAlgoDF.debug, MagGeoBuilderFromDDD.debug, CSCEventData.debug, CSCTriggerPrimitivesReader.debug, BaseParticlePropagator.debug, RPCEfficiency.debug, CSCTMBHeader.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, CSCALCTHeader.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, crabFunctions.CrabTask.debug, Pythia8::PowhegHooksBB4L.debug, HltDiff.debug, runTauIdMVA.TauIDEmbedder.is_above_cmssw_version(), runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017(), runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017, and runTauIdMVA.TauIDEmbedder.toKeep.

115  def runTauID(self):
116  self.process.rerunMvaIsolationTask = self.cms.Task()
117  self.process.rerunMvaIsolationSequence = self.cms.Sequence()
118  tauIDSources = self.cms.PSet()
119 
120  # rerun the seq to obtain the 2017 nom training with 0.5 iso cone, old DM, ptph>1, trained on 2017MCv1
121  if "2017v1" in self.toKeep:
122  self.tauIdDiscrMVA_2017_version = "v1"
124  'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
125  }
127  'tauIdMVAIsoDBoldDMwLT2017' : {
128  'Eff95' : "DBoldDMwLTEff95",
129  'Eff90' : "DBoldDMwLTEff90",
130  'Eff80' : "DBoldDMwLTEff80",
131  'Eff70' : "DBoldDMwLTEff70",
132  'Eff60' : "DBoldDMwLTEff60",
133  'Eff50' : "DBoldDMwLTEff50",
134  'Eff40' : "DBoldDMwLTEff40"
135  }
136  }
137  # update the list of available in DB samples
138  if not self.is_above_cmssw_version(9, 4, 4, self.debug):
139  if self.debug: print ("runTauID: not is_above_cmssw_version(9, 4, 4). Will update the list of available in DB samples to access 2017v1")
140  self.loadMVA_WPs_run2_2017()
141 
142  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
143  PATTauProducer = self.cms.InputTag('slimmedTaus'),
144  Prediscriminants = noPrediscriminants,
145  loadMVAfromDB = self.cms.bool(True),
146  mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
147  mvaOpt = self.cms.string("DBoldDMwLTwGJ"),
148  verbosity = self.cms.int32(0)
149  )
150 
151  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
152  PATTauProducer = self.cms.InputTag('slimmedTaus'),
153  Prediscriminants = noPrediscriminants,
154  toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1raw'),
155  key = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1raw:category'),#?
156  loadMVAfromDB = self.cms.bool(True),
157  mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
158  mapping = self.cms.VPSet(
159  self.cms.PSet(
160  category = self.cms.uint32(0),
161  cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90"), #writeTauIdDiscrWPs
162  variable = self.cms.string("pt"),
163  )
164  )
165  )
166 
167  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
168  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95")
169  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
170  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80")
171  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
172  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70")
173  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
174  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60")
175  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
176  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50")
177  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose.clone()
178  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40")
179 
181  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
182  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose,
183  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose,
184  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Loose,
185  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Medium,
186  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1Tight,
187  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VTight,
188  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight
189  )
190  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2017v1Task)
191  self.process.rerunMvaIsolationSequence += self.cms.Sequence(self.rerunIsolationOldDMMVArun2017v1Task)
192 
193  tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1raw')
194  tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1VVLoose')
195  tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1VLoose')
196  tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1Loose')
197  tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1Medium')
198  tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1Tight')
199  tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1VTight')
200  tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1VVTight')
201 
202 
203  if "2017v2" in self.toKeep:
204  self.tauIdDiscrMVA_2017_version = "v2"
206  'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
207  }
209  'tauIdMVAIsoDBoldDMwLT2017' : {
210  'Eff95' : "DBoldDMwLTEff95",
211  'Eff90' : "DBoldDMwLTEff90",
212  'Eff80' : "DBoldDMwLTEff80",
213  'Eff70' : "DBoldDMwLTEff70",
214  'Eff60' : "DBoldDMwLTEff60",
215  'Eff50' : "DBoldDMwLTEff50",
216  'Eff40' : "DBoldDMwLTEff40"
217  }
218  }
219 
220  if not self.is_above_cmssw_version(9, 4, 5, self.debug):
221  if self.debug: print ("runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access 2017v2")
222  self.loadMVA_WPs_run2_2017()
223 
224  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
225  PATTauProducer = self.cms.InputTag('slimmedTaus'),
226  Prediscriminants = noPrediscriminants,
227  loadMVAfromDB = self.cms.bool(True),
228  mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
229  mvaOpt = self.cms.string("DBoldDMwLTwGJ"),
230  verbosity = self.cms.int32(0)
231  )
232 
233  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
234  PATTauProducer = self.cms.InputTag('slimmedTaus'),
235  Prediscriminants = noPrediscriminants,
236  toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2raw'),
237  key = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2raw:category'),#?
238  loadMVAfromDB = self.cms.bool(True),
239  mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
240  mapping = self.cms.VPSet(
241  self.cms.PSet(
242  category = self.cms.uint32(0),
243  cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff90"), #writeTauIdDiscrWPs
244  variable = self.cms.string("pt"),
245  )
246  ),
247  verbosity = self.cms.int32(0)
248  )
249 
250  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
251  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff95")
252  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
253  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff80")
254  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
255  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff70")
256  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
257  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff60")
258  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
259  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff50")
260  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose.clone()
261  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff40")
262 
264  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw,
265  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose,
266  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose,
267  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Loose,
268  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Medium,
269  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2Tight,
270  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VTight,
271  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight
272  )
273  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2017v2Task)
274  self.process.rerunMvaIsolationSequence += self.cms.Sequence(self.rerunIsolationOldDMMVArun2017v2Task)
275 
276  tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2raw')
277  tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2VVLoose')
278  tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2VLoose')
279  tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2Loose')
280  tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2Medium')
281  tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2Tight')
282  tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2VTight')
283  tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2VVTight')
284 
285  if "newDM2017v2" in self.toKeep:
286  self.tauIdDiscrMVA_2017_version = "v2"
288  'tauIdMVAIsoDBnewDMwLT2017' : "tauIdMVAIsoDBnewDMwLT2017",
289  }
291  'tauIdMVAIsoDBnewDMwLT2017' : {
292  'Eff95' : "DBnewDMwLTEff95",
293  'Eff90' : "DBnewDMwLTEff90",
294  'Eff80' : "DBnewDMwLTEff80",
295  'Eff70' : "DBnewDMwLTEff70",
296  'Eff60' : "DBnewDMwLTEff60",
297  'Eff50' : "DBnewDMwLTEff50",
298  'Eff40' : "DBnewDMwLTEff40"
299  }
300  }
301 
302  if not self.is_above_cmssw_version(9, 4, 5, self.debug):
303  if self.debug: print ("runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access newDM2017v2")
304  self.loadMVA_WPs_run2_2017()
305 
306  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
307  PATTauProducer = self.cms.InputTag('slimmedTaus'),
308  Prediscriminants = noPrediscriminants,
309  loadMVAfromDB = self.cms.bool(True),
310  mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
311  mvaOpt = self.cms.string("DBnewDMwLTwGJ"),
312  verbosity = self.cms.int32(0)
313  )
314 
315  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
316  PATTauProducer = self.cms.InputTag('slimmedTaus'),
317  Prediscriminants = noPrediscriminants,
318  toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2raw'),
319  key = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2raw:category'),#?
320  loadMVAfromDB = self.cms.bool(True),
321  mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
322  mapping = self.cms.VPSet(
323  self.cms.PSet(
324  category = self.cms.uint32(0),
325  cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90"), #writeTauIdDiscrWPs
326  variable = self.cms.string("pt"),
327  )
328  ),
329  verbosity = self.cms.int32(0)
330  )
331 
332  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
333  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95")
334  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
335  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80")
336  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
337  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70")
338  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
339  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60")
340  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
341  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50")
342  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose.clone()
343  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40")
344 
346  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
347  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose,
348  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose,
349  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Loose,
350  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Medium,
351  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2Tight,
352  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VTight,
353  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight
354  )
355  self.process.rerunMvaIsolationTask.add(self.rerunIsolationNewDMMVArun2017v2Task)
356  self.process.rerunMvaIsolationSequence += self.cms.Sequence(self.rerunIsolationNewDMMVArun2017v2Task)
357 
358  tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2raw')
359  tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2VVLoose')
360  tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2VLoose')
361  tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2Loose')
362  tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2Medium')
363  tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2Tight')
364  tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2VTight')
365  tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2VVTight')
366 
367  if "dR0p32017v2" in self.toKeep:
368  self.tauIdDiscrMVA_2017_version = "v2"
370  'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "tauIdMVAIsoDBoldDMdR0p3wLT2017",
371  }
373  'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
374  'Eff95' : "DBoldDMdR0p3wLTEff95",
375  'Eff90' : "DBoldDMdR0p3wLTEff90",
376  'Eff80' : "DBoldDMdR0p3wLTEff80",
377  'Eff70' : "DBoldDMdR0p3wLTEff70",
378  'Eff60' : "DBoldDMdR0p3wLTEff60",
379  'Eff50' : "DBoldDMdR0p3wLTEff50",
380  'Eff40' : "DBoldDMdR0p3wLTEff40"
381  }
382  }
383 
384  if not self.is_above_cmssw_version(9, 4, 5, self.debug):
385  if self.debug: print ("runTauID: not is_above_cmssw_version(9, 4, 5). Will update the list of available in DB samples to access dR0p32017v2")
386  self.loadMVA_WPs_run2_2017()
387 
388  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
389  PATTauProducer = self.cms.InputTag('slimmedTaus'),
390  Prediscriminants = noPrediscriminants,
391  loadMVAfromDB = self.cms.bool(True),
392  mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
393  mvaOpt = self.cms.string("DBoldDMwLTwGJ"),
394  srcChargedIsoPtSum = self.cms.string('chargedIsoPtSumdR03'),
395  srcFootprintCorrection = self.cms.string('footprintCorrectiondR03'),
396  srcNeutralIsoPtSum = self.cms.string('neutralIsoPtSumdR03'),
397  srcPhotonPtSumOutsideSignalCone = self.cms.string('photonPtSumOutsideSignalConedR03'),
398  verbosity = self.cms.int32(0)
399  )
400 
401  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
402  PATTauProducer = self.cms.InputTag('slimmedTaus'),
403  Prediscriminants = noPrediscriminants,
404  toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw'),
405  key = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw:category'),#?
406  loadMVAfromDB = self.cms.bool(True),
407  mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
408  mapping = self.cms.VPSet(
409  self.cms.PSet(
410  category = self.cms.uint32(0),
411  cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90"), #writeTauIdDiscrWPs
412  variable = self.cms.string("pt"),
413  )
414  ),
415  verbosity = self.cms.int32(0)
416  )
417 
418  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
419  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95")
420  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
421  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80")
422  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
423  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70")
424  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
425  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60")
426  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
427  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50")
428  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight = self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose.clone()
429  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40")
430 
432  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
433  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose,
434  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose,
435  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose,
436  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium,
437  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight,
438  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight,
439  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight
440  )
441  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMdR0p3MVArun2017v2Task)
442  self.process.rerunMvaIsolationSequence += self.cms.Sequence(self.rerunIsolationOldDMdR0p3MVArun2017v2Task)
443 
444  tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw')
445  tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVLoose')
446  tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VLoose')
447  tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Loose')
448  tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Medium')
449  tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2Tight')
450  tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VTight')
451  tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2VVTight')
452 
453  # 2016 training strategy(v2) - essentially the same as 2017 training strategy (v1), trained on 2016MC, old DM - currently not implemented in the tau sequence of any release
454  # self.process.rerunDiscriminationByIsolationOldDMMVArun2v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
455  # PATTauProducer = self.cms.InputTag('slimmedTaus'),
456  # Prediscriminants = noPrediscriminants,
457  # loadMVAfromDB = self.cms.bool(True),
458  # mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
459  # mvaOpt = self.cms.string("DBoldDMwLTwGJ"),
460  # verbosity = self.cms.int32(0)
461  # )
462  # #
463  # self.process.rerunDiscriminationByIsolationOldDMMVArun2v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
464  # PATTauProducer = self.cms.InputTag('slimmedTaus'),
465  # Prediscriminants = noPrediscriminants,
466  # toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v2raw'),
467  # key = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v2raw:category'),#?
468  # loadMVAfromDB = self.cms.bool(True),
469  # mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
470  # mapping = self.cms.VPSet(
471  # self.cms.PSet(
472  # category = self.cms.uint32(0),
473  # cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2_WPEff90"), #writeTauIdDiscrWPs
474  # variable = self.cms.string("pt"),
475  # )
476  # )
477  # )
478 
479  # 2016 training strategy(v1), trained on 2016MC, old DM
480  if "2016v1" in self.toKeep:
481  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
482  PATTauProducer = self.cms.InputTag('slimmedTaus'),
483  Prediscriminants = noPrediscriminants,
484  loadMVAfromDB = self.cms.bool(True),
485  mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
486  mvaOpt = self.cms.string("DBoldDMwLT"),
487  verbosity = self.cms.int32(0)
488  )
489 
490  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
491  PATTauProducer = self.cms.InputTag('slimmedTaus'),
492  Prediscriminants = noPrediscriminants,
493  toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1raw'),
494  key = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1raw:category'),
495  loadMVAfromDB = self.cms.bool(True),
496  mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
497  mapping = self.cms.VPSet(
498  self.cms.PSet(
499  category = self.cms.uint32(0),
500  cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff90"),
501  variable = self.cms.string("pt"),
502  )
503  )
504  )
505 
506  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
507  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff80")
508  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
509  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff70")
510  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
511  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff60")
512  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
513  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff50")
514  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose.clone()
515  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_WPEff40")
516 
518  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
519  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VLoose,
520  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Loose,
521  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Medium,
522  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1Tight,
523  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VTight,
524  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1VVTight
525  )
526  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2016v1Task)
527  self.process.rerunMvaIsolationSequence += self.cms.Sequence(self.rerunIsolationOldDMMVArun2016v1Task)
528 
529  tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1raw')
530  tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1VLoose')
531  tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1Loose')
532  tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1Medium')
533  tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1Tight')
534  tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1VTight')
535  tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1VVTight')
536 
537  # 2016 training strategy(v1), trained on 2016MC, new DM
538  if "newDM2016v1" in self.toKeep:
539  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
540  PATTauProducer = self.cms.InputTag('slimmedTaus'),
541  Prediscriminants = noPrediscriminants,
542  loadMVAfromDB = self.cms.bool(True),
543  mvaName = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
544  mvaOpt = self.cms.string("DBnewDMwLT"),
545  verbosity = self.cms.int32(0)
546  )
547 
548  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
549  PATTauProducer = self.cms.InputTag('slimmedTaus'),
550  Prediscriminants = noPrediscriminants,
551  toMultiplex = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1raw'),
552  key = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1raw:category'),
553  loadMVAfromDB = self.cms.bool(True),
554  mvaOutput_normalization = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
555  mapping = self.cms.VPSet(
556  self.cms.PSet(
557  category = self.cms.uint32(0),
558  cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
559  variable = self.cms.string("pt"),
560  )
561  )
562  )
563 
564  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
565  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff80")
566  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
567  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff70")
568  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
569  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff60")
570  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
571  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff50")
572  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight = self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose.clone()
573  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight.mapping[0].cut = self.cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff40")
574 
576  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
577  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VLoose,
578  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Loose,
579  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Medium,
580  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1Tight,
581  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VTight,
582  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1VVTight
583  )
584  self.process.rerunMvaIsolationTask.add(self.rerunIsolationNewDMMVArun2016v1Task)
585  self.process.rerunMvaIsolationSequence += self.cms.Sequence(self.rerunIsolationNewDMMVArun2016v1Task)
586 
587  tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1raw')
588  tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1VLoose')
589  tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1Loose')
590  tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1Medium')
591  tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1Tight')
592  tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1VTight')
593  tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1VVTight')
594 
595  if "deepTau2017v1" in self.toKeep:
596  print ("Adding DeepTau IDs")
597 
598  workingPoints_ = {
599  "e": {
600  "VVVLoose" : 0.96424,
601  "VVLoose" : 0.98992,
602  "VLoose" : 0.99574,
603  "Loose": 0.99831,
604  "Medium": 0.99868,
605  "Tight": 0.99898,
606  "VTight": 0.99911,
607  "VVTight": 0.99918
608  },
609  "mu": {
610  "VVVLoose" : 0.959619,
611  "VVLoose" : 0.997687,
612  "VLoose" : 0.999392,
613  "Loose": 0.999755,
614  "Medium": 0.999854,
615  "Tight": 0.999886,
616  "VTight": 0.999944,
617  "VVTight": 0.9999971
618  },
619 
620  "jet": {
621  "VVVLoose" : 0.5329,
622  "VVLoose" : 0.7645,
623  "VLoose" : 0.8623,
624  "Loose": 0.9140,
625  "Medium": 0.9464,
626  "Tight": 0.9635,
627  "VTight": 0.9760,
628  "VVTight": 0.9859
629  }
630  }
631  file_name = 'RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb'
632  self.process.deepTau2017v1 = self.cms.EDProducer("DeepTauId",
633  electrons = self.cms.InputTag('slimmedElectrons'),
634  muons = self.cms.InputTag('slimmedMuons'),
635  taus = self.cms.InputTag('slimmedTaus'),
636  graph_file = self.cms.string(file_name),
637  mem_mapped = self.cms.bool(False)
638  )
639 
640  self.processDeepProducer('deepTau2017v1', tauIDSources, workingPoints_)
641 
642  self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v1)
643  self.process.rerunMvaIsolationSequence += self.process.deepTau2017v1
644 
645  if "DPFTau_2016_v0" in self.toKeep:
646  print ("Adding DPFTau isolation (v0)")
647 
648  workingPoints_ = {
649  "all": {
650  "Tight" : "if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
651  "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
652  "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
653  "return 99.0;"
654  #"Tight" : "? decayMode == 0 ? (0.898328 - 0.000160992 * pt) : " +
655  # "(? decayMode == 1 ? 0.910138 - 0.000229923 * pt : " +
656  # "(? decayMode == 10 ? (0.873958 - 0.0002328 * pt) : 1))"
657  # "Tight" : "(decayMode == 0) * (0.898328 - 0.000160992 * pt) + \
658  # (decayMode == 1) * (0.910138 - 0.000229923 * pt) + \
659  # (decayMode == 10) * (0.873958 - 0.0002328 * pt) "
660  }
661  }
662  file_name = 'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb'
663  self.process.dpfTau2016v0 = self.cms.EDProducer("DPFIsolation",
664  pfcands = self.cms.InputTag('packedPFCandidates'),
665  taus = self.cms.InputTag('slimmedTaus'),
666  vertices = self.cms.InputTag('offlineSlimmedPrimaryVertices'),
667  graph_file = self.cms.string(file_name),
668  version = self.cms.uint32(self.getDpfTauVersion(file_name)),
669  mem_mapped = self.cms.bool(False)
670  )
671 
672  self.processDeepProducer('dpfTau2016v0', tauIDSources, workingPoints_)
673 
674  self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v0)
675  self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v0
676 
677 
678  if "DPFTau_2016_v1" in self.toKeep:
679  print ("Adding DPFTau isolation (v1)")
680  print ("WARNING: WPs are not defined for DPFTau_2016_v1")
681  print ("WARNING: The score of DPFTau_2016_v1 is inverted: i.e. for Sig->0, for Bkg->1 with -1 for undefined input (preselection not passed).")
682 
683  workingPoints_ = {
684  "all": {"Tight" : 0.123} #FIXME: define WP
685  }
686 
687  file_name = 'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb'
688  self.process.dpfTau2016v1 = self.cms.EDProducer("DPFIsolation",
689  pfcands = self.cms.InputTag('packedPFCandidates'),
690  taus = self.cms.InputTag('slimmedTaus'),
691  vertices = self.cms.InputTag('offlineSlimmedPrimaryVertices'),
692  graph_file = self.cms.string(file_name),
693  version = self.cms.uint32(self.getDpfTauVersion(file_name)),
694  mem_mapped = self.cms.bool(False)
695  )
696 
697  self.processDeepProducer('dpfTau2016v1', tauIDSources, workingPoints_)
698 
699  self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v1)
700  self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v1
701 
702  if "againstEle2018" in self.toKeep:
703  antiElectronDiscrMVA6_version = "MVA6v3_noeveto"
704  ### Define new anti-e discriminants
705  ## Raw
706  from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6
707  self.process.patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
708  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
709  vetoEcalCracks = self.cms.bool(False), #keep taus in EB-EE cracks
710  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL',
711  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC',
712  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL',
713  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC',
714  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL',
715  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC',
716  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL',
717  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC'
718  )
719  ## WPs
720  from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import patTauDiscriminantCutMultiplexer
721  # VLoose
722  self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
723  PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
724  Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
725  toMultiplex = self.cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw"),
726  key = self.cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw","category"),
727  mapping = self.cms.VPSet(
728  self.cms.PSet(
729  category = self.cms.uint32(0),
730  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff98'),
731  variable = self.cms.string('pt')
732  ),
733  self.cms.PSet(
734  category = self.cms.uint32(2),
735  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff98'),
736  variable = self.cms.string('pt')
737  ),
738  self.cms.PSet(
739  category = self.cms.uint32(5),
740  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff98'),
741  variable = self.cms.string('pt')
742  ),
743  self.cms.PSet(
744  category = self.cms.uint32(7),
745  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff98'),
746  variable = self.cms.string('pt')
747  ),
748  self.cms.PSet(
749  category = self.cms.uint32(8),
750  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff98'),
751  variable = self.cms.string('pt')
752  ),
753  self.cms.PSet(
754  category = self.cms.uint32(10),
755  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff98'),
756  variable = self.cms.string('pt')
757  ),
758  self.cms.PSet(
759  category = self.cms.uint32(13),
760  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff98'),
761  variable = self.cms.string('pt')
762  ),
763  self.cms.PSet(
764  category = self.cms.uint32(15),
765  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff98'),
766  variable = self.cms.string('pt')
767  )
768  )
769  )
770  # Loose
771  self.process.patTauDiscriminationByLooseElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
772  mapping = self.cms.VPSet(
773  self.cms.PSet(
774  category = self.cms.uint32(0),
775  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff90'),
776  variable = self.cms.string('pt')
777  ),
778  self.cms.PSet(
779  category = self.cms.uint32(2),
780  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff90'),
781  variable = self.cms.string('pt')
782  ),
783  self.cms.PSet(
784  category = self.cms.uint32(5),
785  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff90'),
786  variable = self.cms.string('pt')
787  ),
788  self.cms.PSet(
789  category = self.cms.uint32(7),
790  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff90'),
791  variable = self.cms.string('pt')
792  ),
793  self.cms.PSet(
794  category = self.cms.uint32(8),
795  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff90'),
796  variable = self.cms.string('pt')
797  ),
798  self.cms.PSet(
799  category = self.cms.uint32(10),
800  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff90'),
801  variable = self.cms.string('pt')
802  ),
803  self.cms.PSet(
804  category = self.cms.uint32(13),
805  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff90'),
806  variable = self.cms.string('pt')
807  ),
808  self.cms.PSet(
809  category = self.cms.uint32(15),
810  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff90'),
811  variable = self.cms.string('pt')
812  )
813  )
814  )
815  # Medium
816  self.process.patTauDiscriminationByMediumElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
817  mapping = self.cms.VPSet(
818  self.cms.PSet(
819  category = self.cms.uint32(0),
820  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff80'),
821  variable = self.cms.string('pt')
822  ),
823  self.cms.PSet(
824  category = self.cms.uint32(2),
825  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff80'),
826  variable = self.cms.string('pt')
827  ),
828  self.cms.PSet(
829  category = self.cms.uint32(5),
830  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff80'),
831  variable = self.cms.string('pt')
832  ),
833  self.cms.PSet(
834  category = self.cms.uint32(7),
835  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff80'),
836  variable = self.cms.string('pt')
837  ),
838  self.cms.PSet(
839  category = self.cms.uint32(8),
840  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff80'),
841  variable = self.cms.string('pt')
842  ),
843  self.cms.PSet(
844  category = self.cms.uint32(10),
845  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff80'),
846  variable = self.cms.string('pt')
847  ),
848  self.cms.PSet(
849  category = self.cms.uint32(13),
850  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff80'),
851  variable = self.cms.string('pt')
852  ),
853  self.cms.PSet(
854  category = self.cms.uint32(15),
855  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff80'),
856  variable = self.cms.string('pt')
857  )
858  )
859  )
860  # Tight
861  self.process.patTauDiscriminationByTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
862  mapping = self.cms.VPSet(
863  self.cms.PSet(
864  category = self.cms.uint32(0),
865  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff70'),
866  variable = self.cms.string('pt')
867  ),
868  self.cms.PSet(
869  category = self.cms.uint32(2),
870  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff70'),
871  variable = self.cms.string('pt')
872  ),
873  self.cms.PSet(
874  category = self.cms.uint32(5),
875  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff70'),
876  variable = self.cms.string('pt')
877  ),
878  self.cms.PSet(
879  category = self.cms.uint32(7),
880  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff70'),
881  variable = self.cms.string('pt')
882  ),
883  self.cms.PSet(
884  category = self.cms.uint32(8),
885  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff70'),
886  variable = self.cms.string('pt')
887  ),
888  self.cms.PSet(
889  category = self.cms.uint32(10),
890  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff70'),
891  variable = self.cms.string('pt')
892  ),
893  self.cms.PSet(
894  category = self.cms.uint32(13),
895  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff70'),
896  variable = self.cms.string('pt')
897  ),
898  self.cms.PSet(
899  category = self.cms.uint32(15),
900  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff70'),
901  variable = self.cms.string('pt')
902  )
903  )
904  )
905  # VTight
906  self.process.patTauDiscriminationByVTightElectronRejectionMVA62018 = self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018.clone(
907  mapping = self.cms.VPSet(
908  self.cms.PSet(
909  category = self.cms.uint32(0),
910  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL_WPeff60'),
911  variable = self.cms.string('pt')
912  ),
913  self.cms.PSet(
914  category = self.cms.uint32(2),
915  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL_WPeff60'),
916  variable = self.cms.string('pt')
917  ),
918  self.cms.PSet(
919  category = self.cms.uint32(5),
920  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL_WPeff60'),
921  variable = self.cms.string('pt')
922  ),
923  self.cms.PSet(
924  category = self.cms.uint32(7),
925  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL_WPeff60'),
926  variable = self.cms.string('pt')
927  ),
928  self.cms.PSet(
929  category = self.cms.uint32(8),
930  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC_WPeff60'),
931  variable = self.cms.string('pt')
932  ),
933  self.cms.PSet(
934  category = self.cms.uint32(10),
935  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC_WPeff60'),
936  variable = self.cms.string('pt')
937  ),
938  self.cms.PSet(
939  category = self.cms.uint32(13),
940  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC_WPeff60'),
941  variable = self.cms.string('pt')
942  ),
943  self.cms.PSet(
944  category = self.cms.uint32(15),
945  cut = self.cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC_WPeff60'),
946  variable = self.cms.string('pt')
947  )
948  )
949  )
950  ### Put all new anti-e discrminats to a sequence
951  self.process.patTauDiscriminationByElectronRejectionMVA62018Task = self.cms.Task(
952  self.process.patTauDiscriminationByElectronRejectionMVA62018Raw,
953  self.process.patTauDiscriminationByVLooseElectronRejectionMVA62018,
954  self.process.patTauDiscriminationByLooseElectronRejectionMVA62018,
955  self.process.patTauDiscriminationByMediumElectronRejectionMVA62018,
956  self.process.patTauDiscriminationByTightElectronRejectionMVA62018,
957  self.process.patTauDiscriminationByVTightElectronRejectionMVA62018
958  )
959  self.process.patTauDiscriminationByElectronRejectionMVA62018Seq = self.cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
960  self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
961  self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA62018Seq
962 
963  _againstElectronTauIDSources = self.cms.PSet(
964  againstElectronMVA6Raw2018 = self.cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw"),
965  againstElectronMVA6category2018 = self.cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw","category"),
966  againstElectronVLooseMVA62018 = self.cms.InputTag("patTauDiscriminationByVLooseElectronRejectionMVA62018"),
967  againstElectronLooseMVA62018 = self.cms.InputTag("patTauDiscriminationByLooseElectronRejectionMVA62018"),
968  againstElectronMediumMVA62018 = self.cms.InputTag("patTauDiscriminationByMediumElectronRejectionMVA62018"),
969  againstElectronTightMVA62018 = self.cms.InputTag("patTauDiscriminationByTightElectronRejectionMVA62018"),
970  againstElectronVTightMVA62018 = self.cms.InputTag("patTauDiscriminationByVTightElectronRejectionMVA62018")
971  )
972  _tauIDSourcesWithAgainistEle = self.cms.PSet(
973  tauIDSources.clone(),
974  _againstElectronTauIDSources
975  )
976  tauIDSources =_tauIDSourcesWithAgainistEle.clone()
977 
978 
979  print('Embedding new TauIDs into \"'+self.updatedTauName+'\"')
980  embedID = self.cms.EDProducer("PATTauIDEmbedder",
981  src = self.cms.InputTag('slimmedTaus'),
982  tauIDSources = tauIDSources
983  )
984  setattr(self.process, self.updatedTauName, embedID)
985 
986 
def is_above_cmssw_version(klass, release=9, subversion=4, patch=0, debug=False)
Definition: runTauIdMVA.py:76
def getDpfTauVersion(self, file_name)
def loadMVA_WPs_run2_2017(self)
Definition: runTauIdMVA.py:85
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def processDeepProducer(self, producer_name, tauIDSources, workingPoints_)
Definition: runTauIdMVA.py:987
def runTauIdMVA.TauIDEmbedder.versionToInt (   release = 9,
  subversion = 4,
  patch = 0,
  debug = False 
)
static

Definition at line 69 of file runTauIdMVA.py.

69  def versionToInt(release=9, subversion=4, patch=0, debug = False):
70  version = release * 10000 + subversion * 100 + patch + 1 # shifted by one to account for pre-releases.
71  if debug: print ("versionToInt:", version)
72  return version
73 
74 
def versionToInt(release=9, subversion=4, patch=0, debug=False)
Definition: runTauIdMVA.py:69

Member Data Documentation

runTauIdMVA.TauIDEmbedder.cms

Definition at line 32 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.debug
runTauIdMVA.TauIDEmbedder.rerunIsolationNewDMMVArun2016v1Task

Definition at line 575 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationNewDMMVArun2017v2Task

Definition at line 345 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMdR0p3MVArun2017v2Task

Definition at line 431 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2016v1Task

Definition at line 517 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2017v1Task

Definition at line 180 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2017v2Task

Definition at line 263 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version
runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017

Definition at line 44 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017
runTauIdMVA.TauIDEmbedder.toKeep

Definition at line 47 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

runTauIdMVA.TauIDEmbedder.updatedTauName

Definition at line 34 of file runTauIdMVA.py.