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 6 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 18 of file runTauIdMVA.py.

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

Member Function Documentation

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

Definition at line 50 of file runTauIdMVA.py.

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

Definition at line 57 of file runTauIdMVA.py.

References createfilelist.int, and split.

57  def get_cmssw_version_number(klass, debug = False):
58  """returns '(release, subversion, patch)' (without 'CMSSW_')"""
59  v = klass.get_cmssw_version().split("CMSSW_")[1].split("_")[0:3]
60  if debug: print "get_cmssw_version_number:", v
61  if v[2] == "X":
62  patch = -1
63  else:
64  patch = int(v[2])
65  return int(v[0]), int(v[1]), patch
66 
def get_cmssw_version_number(klass, debug=False)
Definition: runTauIdMVA.py:57
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 1007 of file runTauIdMVA.py.

References createfilelist.int.

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

Definition at line 75 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

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

Definition at line 84 of file runTauIdMVA.py.

References dumpTrg.constants.debug, dumpWBM.constants.debug, dumpRunInfo.constants.debug, InterpolationDebug.debug, lumiPatch.constants.debug, DTDigiToRawModule.debug, runTauIdMVA.TauIDEmbedder.debug, CSCRPCData.debug, CSCDCCUnpacker.debug, CSCTMBScope.debug, ALIUtils.debug, CSCSegAlgoPreClustering.debug, DTRecHitProducer.debug, RPCPointProducer.debug, DTDigiToRaw.debug, EgammaProbeSelector.debug, DTRecSegment4DProducer.debug, DTSegment4DT0Corrector.debug, MuonSeedProducer.debug, HiggsToZZ4LeptonsSkimEff.debug, DTTTrigCorrectionFirst.debug, HiggsTo2GammaSkim.debug, HiggsToZZ4LeptonsPreFilter.debug, DTSegmentsTask.debug, QCDSingleJetFilter.debug, pkg.AbstractPkg.debug, HiggsToZZ4LeptonsSkim.debug, JetAnaPythia< Jet >.debug, DTTPDeadWriter.debug, CSCDCCEventData.debug, MuScleFitFilter.debug, IsolatedParticlesGeneratedJets.debug, DTRecSegment2DProducer.debug, DTTTrigWriter.debug, DTRecSegment2DExtendedProducer.debug, SiPixelDigiToRaw.debug, SiPixelRawToDigi.debug, DTDDUUnpacker.debug, DTT0Calibration.debug, DTT0CalibrationNew.debug, MuScleFitPlotter.debug, DTOccupancyPoint.debug, util.rrapi.RRApi.debug, rrapi.RRApi.debug, GEMCSCSegAlgoRR.debug, CSCSegAlgoShowering.debug, ME0SegmentAlgorithm.debug, DTSpyReader.debug, DTNoiseComputation.debug, DTROS25Unpacker.debug, GEMSegmentAlgorithm.debug, HeavyChHiggsToTauNuSkim.debug, DTTTrigSyncT0Only.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, DTVDriftCalibration.debug, PythiaFilterEMJetHeep.debug, DTTimingExtractor.debug, DTLinearDriftAlgo.debug, PixelDataFormatter.debug, MuonSeedCleaner.debug, DTTTrigSyncFromDB.debug, DTParametrizedDriftAlgo.debug, CSCTMBData.debug, DTCombinatorialPatternReco.debug, MuonSeedBuilder.debug, DTNoDriftAlgo.debug, DTTTrigSyncTOFCorr.debug, DTMeantimerPatternReco.debug, DTLinearDriftFromDBAlgo.debug, DTCombinatorialExtendedPatternReco.debug, DTSegmentUpdator.debug, MuScleFitUtils.debug, CSCSegAlgoDF.debug, MagGeoBuilderFromDDD.debug, BaseParticlePropagator.debug, RPCEfficiency.debug, CSCEventData.debug, CSCTMBHeader.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, CSCALCTHeader.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, HltDiff.debug, relativeConstraints.keys, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version, and runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

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

Definition at line 993 of file runTauIdMVA.py.

References edm::ProductLabels.process, DTTTrigProd.DTTTrigProd.process, DTValidSummary.DTValidSummary.process, DTDqm.DTDqm.process, DTDQMMerge.DTDQMMerge.process, DTAnalysisResiduals.DTAnalysisResiduals.process, DTVDriftMeanTimerCalibration.DTVDriftMeanTimerCalibration.process, DTVDriftSegmentCalibration.DTVDriftSegmentCalibration.process, DTDQMHarvesting.DTDQMHarvesting.process, DTNoiseCalibration.DTNoiseCalibration.process, DTResidualCalibration.DTResidualCalibration.process, DTDQMValidation.DTDQMValidation.process, DTTTrigValid.DTTTrigValid.process, DTT0DBValidation.DTT0DBValidation.process, DTVDriftMeanTimerWriter.DTVDriftMeanTimerWriter.process, DTVDriftSegmentWriter.DTVDriftSegmentWriter.process, runTauIdMVA.TauIDEmbedder.process, DTTTrigResidualCorr.DTTTrigResidualCorr.process, DTTTrigCorrFirst.DTTTrigCorrFirst.process, DTTTrigTimeBoxesWriter.DTTTrigTimeBoxesWriter.process, cscdqm::HWStandbyType.process, EgammaHLTValidationUtils.EgammaDQMModuleMaker.process, Config.Process.process, JsonOutputProducer::JsonConfigurationBlock.process, harvestTrackValidationPlots.str, and pfDeepBoostedJetPreprocessParams_cfi.upper.

993  def processDeepProducer(self, producer_name, tauIDSources, workingPoints_):
994  for target,points in workingPoints_.iteritems():
995  cuts = self.cms.PSet()
996  setattr(tauIDSources, 'by{}VS{}raw'.format(producer_name[0].upper()+producer_name[1:], target),
997  self.cms.InputTag(producer_name, 'VS{}'.format(target)))
998  for point,cut in points.iteritems():
999  setattr(cuts, point, self.cms.string(str(cut)))
1000 
1001  setattr(tauIDSources, 'by{}{}VS{}'.format(point, producer_name[0].upper()+producer_name[1:], target),
1002  self.cms.InputTag(producer_name, 'VS{}{}'.format(target, point)))
1003 
1004  setattr(getattr(self.process, producer_name), 'VS{}WP'.format(target), cuts)
1005 
1006 
def processDeepProducer(self, producer_name, tauIDSources, workingPoints_)
Definition: runTauIdMVA.py:993
def runTauIdMVA.TauIDEmbedder.runTauID (   self)

Definition at line 114 of file runTauIdMVA.py.

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

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

Definition at line 68 of file runTauIdMVA.py.

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

Member Data Documentation

runTauIdMVA.TauIDEmbedder.cms

Definition at line 31 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.debug
runTauIdMVA.TauIDEmbedder.rerunIsolationNewDMMVArun2016v1Task

Definition at line 581 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationNewDMMVArun2017v2Task

Definition at line 347 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMdR0p3MVArun2017v2Task

Definition at line 434 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2016v1Task

Definition at line 522 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2017v1Task

Definition at line 180 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2017v2Task

Definition at line 264 of file runTauIdMVA.py.

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version
runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017

Definition at line 43 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017
runTauIdMVA.TauIDEmbedder.toKeep

Definition at line 46 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

runTauIdMVA.TauIDEmbedder.updatedTauName

Definition at line 33 of file runTauIdMVA.py.