CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, process, debug=False, updatedTauName="slimmedTausNewID", toKeep=["deepTau2017v2p1"], tauIdDiscrMVA_trainings_run2_2017={ 'tauIdMVAIsoDBoldDMwLT2017' :"tauIdMVAIsoDBoldDMwLT2017", }, tauIdDiscrMVA_WPs_run2_2017={ 'tauIdMVAIsoDBoldDMwLT2017' :{ 'Eff95' :"DBoldDMwLTEff95", 'Eff90' :"DBoldDMwLTEff90", 'Eff80' :"DBoldDMwLTEff80", 'Eff70' :"DBoldDMwLTEff70", 'Eff60' :"DBoldDMwLTEff60", 'Eff50' :"DBoldDMwLTEff50", 'Eff40' :"DBoldDMwLTEff40" } }, tauIdDiscrMVA_2017_version="v1", conditionDB="" # preparational DB:'frontier://FrontierPrep/CMS_CONDITIONS')
 
def get_cmssw_version_number (klass, debug=False)
 
def getDeepTauVersion (self, file_name)
 
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)
 
def tauIDMVAinputs (self, module, wp)
 

Static Public Member Functions

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

Public Attributes

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

Static Public Attributes

 availableDiscriminators
 

Detailed Description

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

Definition at line 9 of file runTauIdMVA.py.

Constructor & Destructor Documentation

◆ __init__()

def runTauIdMVA.TauIDEmbedder.__init__ (   self,
  process,
  debug = False,
  updatedTauName = "slimmedTausNewID",
  toKeep = ["deepTau2017v2p1"],
  tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", },
  tauIdDiscrMVA_WPs_run2_2017 = {                     'tauIdMVAIsoDBoldDMwLT2017' : {                         'Eff95' : "DBoldDMwLTEff95",                         'Eff90' : "DBoldDMwLTEff90",                         'Eff80' : "DBoldDMwLTEff80",                         'Eff70' : "DBoldDMwLTEff70",                         'Eff60' : "DBoldDMwLTEff60",                         'Eff50' : "DBoldDMwLTEff50",                         'Eff40' : "DBoldDMwLTEff40"                     }                  },
  tauIdDiscrMVA_2017_version = "v1",
  conditionDB = "" # preparational DB: 'frontier://FrontierPrep/CMS_CONDITIONS' 
)

Definition at line 20 of file runTauIdMVA.py.

20  def __init__(self, process, debug = False,
21  updatedTauName = "slimmedTausNewID",
22  toKeep = ["deepTau2017v2p1"],
23  tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", },
24  tauIdDiscrMVA_WPs_run2_2017 = {
25  'tauIdMVAIsoDBoldDMwLT2017' : {
26  'Eff95' : "DBoldDMwLTEff95",
27  'Eff90' : "DBoldDMwLTEff90",
28  'Eff80' : "DBoldDMwLTEff80",
29  'Eff70' : "DBoldDMwLTEff70",
30  'Eff60' : "DBoldDMwLTEff60",
31  'Eff50' : "DBoldDMwLTEff50",
32  'Eff40' : "DBoldDMwLTEff40"
33  }
34  },
35  tauIdDiscrMVA_2017_version = "v1",
36  conditionDB = "" # preparational DB: 'frontier://FrontierPrep/CMS_CONDITIONS'
37  ):
38  super(TauIDEmbedder, self).__init__()
39  self.process = process
40  self.debug = debug
41  self.updatedTauName = updatedTauName
42  self.process.load('RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi')
43  if len(conditionDB) != 0:
44  self.process.CondDBTauConnection.connect = cms.string(conditionDB)
45  self.process.loadRecoTauTagMVAsFromPrepDB.connect = cms.string(conditionDB)
46  # if debug:
47  # print self.process.CondDBTauConnection.connect
48  # print dir(self.process.loadRecoTauTagMVAsFromPrepDB)
49  # print self.process.loadRecoTauTagMVAsFromPrepDB.parameterNames_
50 
51  self.tauIdDiscrMVA_trainings_run2_2017 = tauIdDiscrMVA_trainings_run2_2017
52  self.tauIdDiscrMVA_WPs_run2_2017 = tauIdDiscrMVA_WPs_run2_2017
53  self.tauIdDiscrMVA_2017_version = tauIdDiscrMVA_2017_version
54  for discr in toKeep:
55  if discr not in TauIDEmbedder.availableDiscriminators:
56  raise RuntimeError('TauIDEmbedder: discriminator "{}" is not supported'.format(discr))
57  self.toKeep = toKeep
58 
59 

Member Function Documentation

◆ get_cmssw_version()

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

Definition at line 61 of file runTauIdMVA.py.

61  def get_cmssw_version(debug = False):
62  """returns 'CMSSW_X_Y_Z'"""
63  cmssw_version = os.environ["CMSSW_VERSION"]
64  if debug: print ("get_cmssw_version:", cmssw_version)
65  return cmssw_version
66 

◆ get_cmssw_version_number()

def runTauIdMVA.TauIDEmbedder.get_cmssw_version_number (   klass,
  debug = False 
)
returns '(release, subversion, patch)' (without 'CMSSW_')

Definition at line 68 of file runTauIdMVA.py.

68  def get_cmssw_version_number(klass, debug = False):
69  """returns '(release, subversion, patch)' (without 'CMSSW_')"""
70  v = klass.get_cmssw_version().split("CMSSW_")[1].split("_")[0:3]
71  if debug: print ("get_cmssw_version_number:", v)
72  try:
73  patch = int(v[2])
74  except:
75  patch = -1
76  return int(v[0]), int(v[1]), patch
77 

References createfilelist.int, and submitPVValidationJobs.split().

◆ getDeepTauVersion()

def runTauIdMVA.TauIDEmbedder.getDeepTauVersion (   self,
  file_name 
)
returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \
(2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \
{year}v{version}p{subversion}

Definition at line 1003 of file runTauIdMVA.py.

1003  def getDeepTauVersion(self, file_name):
1004  """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \
1005  (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \
1006  {year}v{version}p{subversion}"""
1007  version_search = re.search('(201[125678])v([0-9]+)(p[0-9]+|)[\._]', file_name)
1008  if not version_search:
1009  raise RuntimeError('File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \
1010  Unable to extract version number.'.format(file_name))
1011  year = version_search.group(1)
1012  version = version_search.group(2)
1013  subversion = version_search.group(3)
1014  if len(subversion) > 0:
1015  subversion = subversion[1:]
1016  else:
1017  subversion = 0
1018  return int(year), int(version), int(subversion)

References createfilelist.int.

◆ getDpfTauVersion()

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

993  def getDpfTauVersion(self, file_name):
994  """returns the DNN version. File name should contain a version label with data takig year (2011-2, 2015-8) and \
995  version number (vX), e.g. 2017v0, in general the following format: {year}v{version}"""
996  version_search = re.search('201[125678]v([0-9]+)[\._]', file_name)
997  if not version_search:
998  raise RuntimeError('File "{}" has an invalid name pattern, should be in the format "{year}v{version}". \
999  Unable to extract version number.'.format(file_name))
1000  version = version_search.group(1)
1001  return int(version)
1002 

References createfilelist.int.

◆ is_above_cmssw_version()

def runTauIdMVA.TauIDEmbedder.is_above_cmssw_version (   klass,
  release = 9,
  subversion = 4,
  patch = 0,
  debug = False 
)

Definition at line 86 of file runTauIdMVA.py.

86  def is_above_cmssw_version(klass, release=9, subversion=4, patch=0, debug = False):
87  split_cmssw_version = klass.get_cmssw_version_number()
88  if klass.versionToInt(release, subversion, patch) > klass.versionToInt(split_cmssw_version[0], split_cmssw_version[1], split_cmssw_version[2]):
89  if debug: print ("is_above_cmssw_version:", False)
90  return False
91  else:
92  if debug: print ("is_above_cmssw_version:", True)
93  return True
94 

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

◆ loadMVA_WPs_run2_2017()

def runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017 (   self)

Definition at line 98 of file runTauIdMVA.py.

98  def loadMVA_WPs_run2_2017(self):
99  if self.debug: print ("loadMVA_WPs_run2_2017: performed")
100  global cms
101  for training, gbrForestName in self.tauIdDiscrMVA_trainings_run2_2017.items():
102 
103  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
104  cms.PSet(
105  record = cms.string('GBRWrapperRcd'),
106  tag = cms.string("RecoTauTag_%s%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version)),
107  label = cms.untracked.string("RecoTauTag_%s%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version))
108  )
109  )
110 
111  for WP in self.tauIdDiscrMVA_WPs_run2_2017[training].keys():
112  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
113  cms.PSet(
114  record = cms.string('PhysicsTGraphPayloadRcd'),
115  tag = cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version, WP)),
116  label = cms.untracked.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, self.tauIdDiscrMVA_2017_version, WP))
117  )
118  )
119 
120  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
121  cms.PSet(
122  record = cms.string('PhysicsTFormulaPayloadRcd'),
123  tag = cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, self.tauIdDiscrMVA_2017_version)),
124  label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, self.tauIdDiscrMVA_2017_version))
125  )
126  )
127 

References DigiComparisonTask.debug, TPComparisonTask.debug, NoCQTask.debug, QIE10Task.debug, QIE11Task.debug, PedestalTask.debug, RecHitTask.debug, UMNioTask.debug, ZDCTask.debug, HcalOfflineHarvesting.debug, HcalOnlineHarvesting.debug, HFRaddamTask.debug, LaserTask.debug, RawTask.debug, TPTask.debug, InterpolationDebug.debug, DigiTask.debug, LEDTask.debug, runTauIdMVA.TauIDEmbedder.debug, DTDigiToRawModule.debug, CSCRPCData.debug, CSCTMBScope.debug, magneticfield::eSector.debug, ALIUtils.debug, DTDigiToRaw.debug, magneticfield::bRod.debug, CSCSegAlgoPreClustering.debug, DTSegment4DT0Corrector.debug, DTRecHitProducer.debug, DTRecSegment4DProducer.debug, crabFunctions.CrabController.debug, DTSegmentsTask.debug, QCDSingleJetFilter.debug, RPCPointProducer.debug, HiggsTo2GammaSkim.debug, HiggsToZZ4LeptonsSkimEff.debug, magneticfield::bSector.debug, HiggsToZZ4LeptonsPreFilter.debug, DTOccupancyEfficiency.debug, DTTTrigCorrectionFirst.debug, HiggsToZZ4LeptonsSkim.debug, MuonSeedProducer.debug, DTTPDeadWriter.debug, DTRecSegment2DProducer.debug, DTDDUUnpacker.debug, pkg.AbstractPkg.debug, DTTTrigWriter.debug, magneticfield::bSlab.debug, JetAnaPythia< Jet >.debug, DTRecSegment2DExtendedProducer.debug, DTT0CalibrationRMS.debug, MuScleFitFilter.debug, CSCDCCEventData.debug, SiPixelRawToDigi.debug, CSCAnodeLCTAnalyzer.debug, CSCCathodeLCTAnalyzer.debug, DTNoiseComputation.debug, magneticfield::bLayer.debug, CSCSegAlgoShowering.debug, DTOccupancyPoint.debug, MuScleFitPlotter.debug, GEMCSCSegAlgoRR.debug, DTTTrigSyncT0Only.debug, DTROS25Unpacker.debug, rrapi.RRApi.debug, DTSpyReader.debug, util.rrapi.RRApi.debug, DTEfficiencyTask.debug, DTT0Calibration.debug, ME0SegmentAlgorithm.debug, DTTTrigCalibration.debug, DTRunConditionVar.debug, HeavyChHiggsToTauNuSkim.debug, GEMSegmentAlgorithm.debug, PythiaFilterEMJetHeep.debug, CSCDDUEventData.debug, PPSAlignmentConfigESSource.debug, DTChamberEfficiencyTask.debug, DTCombinatorialPatternReco4D.debug, DTMeantimerPatternReco4D.debug, DTRefitAndCombineReco4D.debug, HCALResponse.debug, DTClusterer.debug, DTChamberEfficiency.debug, FCDTask.debug, CSCDCCUnpacker.debug, CSCComparatorData.debug, MuonSeedCreator.debug, DTTMax.debug, DTLinearDriftAlgo.debug, DTTTrigSyncFromDB.debug, DTVDriftCalibration.debug, CSCTimingExtractor.debug, MuonSeedCleaner.debug, CSCTMBData.debug, DTNoDriftAlgo.debug, DTParametrizedDriftAlgo.debug, MagGeoBuilderFromDDD.debug, DTCombinatorialPatternReco.debug, PixelDataFormatter.debug, DTMeantimerPatternReco.debug, DTTimingExtractor.debug, DTCombinatorialExtendedPatternReco.debug, DTTTrigSyncTOFCorr.debug, MuonSeedBuilder.debug, DTLinearDriftFromDBAlgo.debug, DTSegmentUpdator.debug, CSCTMBHeader.debug, CSCSegAlgoDF.debug, MuScleFitUtils.debug, CSCEventData.debug, BaseParticlePropagator.debug, CSCTriggerPrimitivesReader.debug, magneticfield::BaseVolumeHandle.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, CSCALCTHeader.debug, notcub::CachingHostAllocator.debug, notcub::CachingDeviceAllocator.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, crabFunctions.CrabTask.debug, Pythia8::PowhegHooksBB4L.debug, HltDiff.debug, mps_monitormerge.items, relativeConstraints.keys, 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, Config.TestModuleCommand.process, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017, and runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

◆ processDeepProducer()

def runTauIdMVA.TauIDEmbedder.processDeepProducer (   self,
  producer_name,
  tauIDSources,
  workingPoints_ 
)

Definition at line 978 of file runTauIdMVA.py.

978  def processDeepProducer(self, producer_name, tauIDSources, workingPoints_):
979  for target,points in six.iteritems(workingPoints_):
980  setattr(tauIDSources, 'by{}VS{}raw'.format(producer_name[0].upper()+producer_name[1:], target),
981  cms.PSet(inputTag = cms.InputTag(producer_name, 'VS{}'.format(target)), workingPointIndex = cms.int32(-1)))
982 
983  cut_expressions = []
984  for index, (point,cut) in enumerate(six.iteritems(points)):
985  cut_expressions.append(str(cut))
986 
987  setattr(tauIDSources, 'by{}{}VS{}'.format(point, producer_name[0].upper()+producer_name[1:], target),
988  cms.PSet(inputTag = cms.InputTag(producer_name, 'VS{}'.format(target)), workingPointIndex = cms.int32(index)))
989 
990  setattr(getattr(self.process, producer_name), 'VS{}WP'.format(target), cms.vstring(*cut_expressions))
991 
992 

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, Config.TestModuleCommand.process, str, and pileupCalc.upper.

◆ runTauID()

def runTauIdMVA.TauIDEmbedder.runTauID (   self)

Definition at line 128 of file runTauIdMVA.py.

128  def runTauID(self):
129  self.process.rerunMvaIsolationTask = cms.Task()
130  self.process.rerunMvaIsolationSequence = cms.Sequence()
131  tauIDSources = cms.PSet()
132 
133  # rerun the seq to obtain the 2017 nom training with 0.5 iso cone, old DM, ptph>1, trained on 2017MCv1
134  if "2017v1" in self.toKeep:
135  self.tauIdDiscrMVA_2017_version = "v1"
136  self.tauIdDiscrMVA_trainings_run2_2017 = {
137  'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
138  }
139  self.tauIdDiscrMVA_WPs_run2_2017 = {
140  'tauIdMVAIsoDBoldDMwLT2017' : {
141  'Eff95' : "DBoldDMwLTEff95",
142  'Eff90' : "DBoldDMwLTEff90",
143  'Eff80' : "DBoldDMwLTEff80",
144  'Eff70' : "DBoldDMwLTEff70",
145  'Eff60' : "DBoldDMwLTEff60",
146  'Eff50' : "DBoldDMwLTEff50",
147  'Eff40' : "DBoldDMwLTEff40"
148  }
149  }
150  # update the list of available in DB samples
151  if not self.is_above_cmssw_version(9, 4, 4, self.debug):
152  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")
153  self.loadMVA_WPs_run2_2017()
154 
155  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
156  PATTauProducer = cms.InputTag('slimmedTaus'),
157  Prediscriminants = noPrediscriminants,
158  loadMVAfromDB = cms.bool(True),
159  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
160  mvaOpt = cms.string("DBoldDMwLTwGJ"),
161  verbosity = cms.int32(0)
162  )
163 
164  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1 = patDiscriminationByIsolationMVArun2v1.clone(
165  PATTauProducer = cms.InputTag('slimmedTaus'),
166  Prediscriminants = noPrediscriminants,
167  toMultiplex = cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v1raw'),
168  loadMVAfromDB = cms.bool(True),
169  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
170  mapping = cms.VPSet(
171  cms.PSet(
172  category = cms.uint32(0),
173  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), #writeTauIdDiscrWPs
174  variable = cms.string("pt"),
175  )
176  ),
177  workingPoints = cms.vstring(
178  "_WPEff95",
179  "_WPEff90",
180  "_WPEff80",
181  "_WPEff70",
182  "_WPEff60",
183  "_WPEff50",
184  "_WPEff40"
185  )
186  )
187 
188  self.rerunIsolationOldDMMVArun2017v1Task = cms.Task(
189  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1raw,
190  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v1
191  )
192  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2017v1Task)
193  self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMMVArun2017v1Task)
194 
195  tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "raw")
196  tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff95")
197  tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff90")
198  tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff80")
199  tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff70")
200  tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff60")
201  tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff50")
202  tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v1", "_WPEff40")
203 
204 
205  if "2017v2" in self.toKeep:
206  self.tauIdDiscrMVA_2017_version = "v2"
207  self.tauIdDiscrMVA_trainings_run2_2017 = {
208  'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
209  }
210  self.tauIdDiscrMVA_WPs_run2_2017 = {
211  'tauIdMVAIsoDBoldDMwLT2017' : {
212  'Eff95' : "DBoldDMwLTEff95",
213  'Eff90' : "DBoldDMwLTEff90",
214  'Eff80' : "DBoldDMwLTEff80",
215  'Eff70' : "DBoldDMwLTEff70",
216  'Eff60' : "DBoldDMwLTEff60",
217  'Eff50' : "DBoldDMwLTEff50",
218  'Eff40' : "DBoldDMwLTEff40"
219  }
220  }
221 
222  if not self.is_above_cmssw_version(9, 4, 5, self.debug):
223  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")
224  self.loadMVA_WPs_run2_2017()
225 
226  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
227  PATTauProducer = cms.InputTag('slimmedTaus'),
228  Prediscriminants = noPrediscriminants,
229  loadMVAfromDB = cms.bool(True),
230  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
231  mvaOpt = cms.string("DBoldDMwLTwGJ"),
232  verbosity = cms.int32(0)
233  )
234 
235  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2 = patDiscriminationByIsolationMVArun2v1.clone(
236  PATTauProducer = cms.InputTag('slimmedTaus'),
237  Prediscriminants = noPrediscriminants,
238  toMultiplex = cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2017v2raw'),
239  loadMVAfromDB = cms.bool(True),
240  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
241  mapping = cms.VPSet(
242  cms.PSet(
243  category = cms.uint32(0),
244  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"), #writeTauIdDiscrWPs
245  variable = cms.string("pt"),
246  )
247  ),
248  workingPoints = cms.vstring(
249  "_WPEff95",
250  "_WPEff90",
251  "_WPEff80",
252  "_WPEff70",
253  "_WPEff60",
254  "_WPEff50",
255  "_WPEff40"
256  ),
257  verbosity = cms.int32(0)
258  )
259 
260  self.rerunIsolationOldDMMVArun2017v2Task = cms.Task(
261  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2raw,
262  self.process.rerunDiscriminationByIsolationOldDMMVArun2017v2
263  )
264  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2017v2Task)
265  self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMMVArun2017v2Task)
266 
267  tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "raw")
268  tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff95")
269  tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff90")
270  tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff80")
271  tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff70")
272  tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff60")
273  tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff50")
274  tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2017v2", "_WPEff40")
275 
276  if "newDM2017v2" in self.toKeep:
277  self.tauIdDiscrMVA_2017_version = "v2"
278  self.tauIdDiscrMVA_trainings_run2_2017 = {
279  'tauIdMVAIsoDBnewDMwLT2017' : "tauIdMVAIsoDBnewDMwLT2017",
280  }
281  self.tauIdDiscrMVA_WPs_run2_2017 = {
282  'tauIdMVAIsoDBnewDMwLT2017' : {
283  'Eff95' : "DBnewDMwLTEff95",
284  'Eff90' : "DBnewDMwLTEff90",
285  'Eff80' : "DBnewDMwLTEff80",
286  'Eff70' : "DBnewDMwLTEff70",
287  'Eff60' : "DBnewDMwLTEff60",
288  'Eff50' : "DBnewDMwLTEff50",
289  'Eff40' : "DBnewDMwLTEff40"
290  }
291  }
292 
293  if not self.is_above_cmssw_version(9, 4, 5, self.debug):
294  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")
295  self.loadMVA_WPs_run2_2017()
296 
297  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
298  PATTauProducer = cms.InputTag('slimmedTaus'),
299  Prediscriminants = noPrediscriminants,
300  loadMVAfromDB = cms.bool(True),
301  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
302  mvaOpt = cms.string("DBnewDMwLTwGJ"),
303  verbosity = cms.int32(0)
304  )
305 
306  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2 = patDiscriminationByIsolationMVArun2v1.clone(
307  PATTauProducer = cms.InputTag('slimmedTaus'),
308  Prediscriminants = noPrediscriminants,
309  toMultiplex = cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2017v2raw'),
310  loadMVAfromDB = cms.bool(True),
311  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
312  mapping = cms.VPSet(
313  cms.PSet(
314  category = cms.uint32(0),
315  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"), #writeTauIdDiscrWPs
316  variable = cms.string("pt"),
317  )
318  ),
319  workingPoints = cms.vstring(
320  "_WPEff95",
321  "_WPEff90",
322  "_WPEff80",
323  "_WPEff70",
324  "_WPEff60",
325  "_WPEff50",
326  "_WPEff40"
327  ),
328  verbosity = cms.int32(0)
329  )
330 
331  self.rerunIsolationNewDMMVArun2017v2Task = cms.Task(
332  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2raw,
333  self.process.rerunDiscriminationByIsolationNewDMMVArun2017v2
334  )
335  self.process.rerunMvaIsolationTask.add(self.rerunIsolationNewDMMVArun2017v2Task)
336  self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationNewDMMVArun2017v2Task)
337 
338  tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "raw")
339  tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff95")
340  tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff90")
341  tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff80")
342  tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff70")
343  tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff60")
344  tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff50")
345  tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2017v2", "_WPEff40")
346 
347  if "dR0p32017v2" in self.toKeep:
348  self.tauIdDiscrMVA_2017_version = "v2"
349  self.tauIdDiscrMVA_trainings_run2_2017 = {
350  'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "tauIdMVAIsoDBoldDMdR0p3wLT2017",
351  }
352  self.tauIdDiscrMVA_WPs_run2_2017 = {
353  'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
354  'Eff95' : "DBoldDMdR0p3wLTEff95",
355  'Eff90' : "DBoldDMdR0p3wLTEff90",
356  'Eff80' : "DBoldDMdR0p3wLTEff80",
357  'Eff70' : "DBoldDMdR0p3wLTEff70",
358  'Eff60' : "DBoldDMdR0p3wLTEff60",
359  'Eff50' : "DBoldDMdR0p3wLTEff50",
360  'Eff40' : "DBoldDMdR0p3wLTEff40"
361  }
362  }
363 
364  if not self.is_above_cmssw_version(9, 4, 5, self.debug):
365  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")
366  self.loadMVA_WPs_run2_2017()
367 
368  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
369  PATTauProducer = cms.InputTag('slimmedTaus'),
370  Prediscriminants = noPrediscriminants,
371  loadMVAfromDB = cms.bool(True),
372  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
373  mvaOpt = cms.string("DBoldDMwLTwGJ"),
374  srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'),
375  srcFootprintCorrection = cms.string('footprintCorrectiondR03'),
376  srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'),
377  srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03'),
378  verbosity = cms.int32(0)
379  )
380 
381  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2= patDiscriminationByIsolationMVArun2v1.clone(
382  PATTauProducer = cms.InputTag('slimmedTaus'),
383  Prediscriminants = noPrediscriminants,
384  toMultiplex = cms.InputTag('rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw'),
385  loadMVAfromDB = cms.bool(True),
386  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
387  mapping = cms.VPSet(
388  cms.PSet(
389  category = cms.uint32(0),
390  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"), #writeTauIdDiscrWPs
391  variable = cms.string("pt"),
392  )
393  ),
394  workingPoints = cms.vstring(
395  "_WPEff95",
396  "_WPEff90",
397  "_WPEff80",
398  "_WPEff70",
399  "_WPEff60",
400  "_WPEff50",
401  "_WPEff40"
402  ),
403  verbosity = cms.int32(0)
404  )
405 
406  self.rerunIsolationOldDMdR0p3MVArun2017v2Task = cms.Task(
407  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw,
408  self.process.rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2
409  )
410  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMdR0p3MVArun2017v2Task)
411  self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMdR0p3MVArun2017v2Task)
412 
413  tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "raw")
414  tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff95")
415  tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff90")
416  tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff80")
417  tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff70")
418  tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff60")
419  tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff50")
420  tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2", "_WPEff40")
421 
422  # 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
423  # self.process.rerunDiscriminationByIsolationOldDMMVArun2v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
424  # PATTauProducer = cms.InputTag('slimmedTaus'),
425  # Prediscriminants = noPrediscriminants,
426  # loadMVAfromDB = cms.bool(True),
427  # mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2"),#RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1 writeTauIdDiscrMVAs
428  # mvaOpt = cms.string("DBoldDMwLTwGJ"),
429  # verbosity = cms.int32(0)
430  # )
431  # #
432  # self.process.rerunDiscriminationByIsolationOldDMMVArun2v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
433  # PATTauProducer = cms.InputTag('slimmedTaus'),
434  # Prediscriminants = noPrediscriminants,
435  # toMultiplex = cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v2raw'),
436  # key = cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v2raw:category'),#?
437  # loadMVAfromDB = cms.bool(True),
438  # mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
439  # mapping = cms.VPSet(
440  # cms.PSet(
441  # category = cms.uint32(0),
442  # cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2_WPEff90"), #writeTauIdDiscrWPs
443  # variable = cms.string("pt"),
444  # )
445  # )
446  # )
447 
448  # 2016 training strategy(v1), trained on 2016MC, old DM
449  if "2016v1" in self.toKeep:
450  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
451  PATTauProducer = cms.InputTag('slimmedTaus'),
452  Prediscriminants = noPrediscriminants,
453  loadMVAfromDB = cms.bool(True),
454  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
455  mvaOpt = cms.string("DBoldDMwLT"),
456  verbosity = cms.int32(0)
457  )
458 
459  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1 = patDiscriminationByIsolationMVArun2v1.clone(
460  PATTauProducer = cms.InputTag('slimmedTaus'),
461  Prediscriminants = noPrediscriminants,
462  toMultiplex = cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v1raw'),
463  loadMVAfromDB = cms.bool(True),
464  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
465  mapping = cms.VPSet(
466  cms.PSet(
467  category = cms.uint32(0),
468  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
469  variable = cms.string("pt"),
470  )
471  ),
472  workingPoints = cms.vstring(
473  "_WPEff90",
474  "_WPEff80",
475  "_WPEff70",
476  "_WPEff60",
477  "_WPEff50",
478  "_WPEff40"
479  )
480  )
481 
482  self.rerunIsolationOldDMMVArun2016v1Task = cms.Task(
483  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1raw,
484  self.process.rerunDiscriminationByIsolationOldDMMVArun2v1
485  )
486  self.process.rerunMvaIsolationTask.add(self.rerunIsolationOldDMMVArun2016v1Task)
487  self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationOldDMMVArun2016v1Task)
488 
489  tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "raw")
490  tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "_WPEff90")
491  tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "_WPEff80")
492  tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "_WPEff70")
493  tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "_WPEff60")
494  tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "_WPEff50")
495  tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationOldDMMVArun2v1", "_WPEff40")
496 
497  # 2016 training strategy(v1), trained on 2016MC, new DM
498  if "newDM2016v1" in self.toKeep:
499  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw = patDiscriminationByIsolationMVArun2v1raw.clone(
500  PATTauProducer = cms.InputTag('slimmedTaus'),
501  Prediscriminants = noPrediscriminants,
502  loadMVAfromDB = cms.bool(True),
503  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
504  mvaOpt = cms.string("DBnewDMwLT"),
505  verbosity = cms.int32(0)
506  )
507 
508  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1 = patDiscriminationByIsolationMVArun2v1.clone(
509  PATTauProducer = cms.InputTag('slimmedTaus'),
510  Prediscriminants = noPrediscriminants,
511  toMultiplex = cms.InputTag('rerunDiscriminationByIsolationNewDMMVArun2v1raw'),
512  loadMVAfromDB = cms.bool(True),
513  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
514  mapping = cms.VPSet(
515  cms.PSet(
516  category = cms.uint32(0),
517  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_WPEff90"),
518  variable = cms.string("pt"),
519  )
520  ),
521  workingPoints = cms.vstring(
522  "_WPEff90",
523  "_WPEff80",
524  "_WPEff70",
525  "_WPEff60",
526  "_WPEff50",
527  "_WPEff40"
528  )
529  )
530 
531  self.rerunIsolationNewDMMVArun2016v1Task = cms.Task(
532  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1raw,
533  self.process.rerunDiscriminationByIsolationNewDMMVArun2v1
534  )
535  self.process.rerunMvaIsolationTask.add(self.rerunIsolationNewDMMVArun2016v1Task)
536  self.process.rerunMvaIsolationSequence += cms.Sequence(self.rerunIsolationNewDMMVArun2016v1Task)
537 
538  tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "raw")
539  tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "_WPEff90")
540  tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "_WPEff80")
541  tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "_WPEff70")
542  tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "_WPEff60")
543  tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "_WPEff50")
544  tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs("rerunDiscriminationByIsolationNewDMMVArun2v1", "_WPEff40")
545 
546  if "deepTau2017v1" in self.toKeep:
547  if self.debug: print ("Adding DeepTau IDs")
548 
549  workingPoints_ = {
550  "e": {
551  "VVVLoose" : 0.96424,
552  "VVLoose" : 0.98992,
553  "VLoose" : 0.99574,
554  "Loose": 0.99831,
555  "Medium": 0.99868,
556  "Tight": 0.99898,
557  "VTight": 0.99911,
558  "VVTight": 0.99918
559  },
560  "mu": {
561  "VVVLoose" : 0.959619,
562  "VVLoose" : 0.997687,
563  "VLoose" : 0.999392,
564  "Loose": 0.999755,
565  "Medium": 0.999854,
566  "Tight": 0.999886,
567  "VTight": 0.999944,
568  "VVTight": 0.9999971
569  },
570 
571  "jet": {
572  "VVVLoose" : 0.5329,
573  "VVLoose" : 0.7645,
574  "VLoose" : 0.8623,
575  "Loose": 0.9140,
576  "Medium": 0.9464,
577  "Tight": 0.9635,
578  "VTight": 0.9760,
579  "VVTight": 0.9859
580  }
581  }
582  file_names = ['RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v1_20L1024N_quantized.pb']
583  self.process.deepTau2017v1 = cms.EDProducer("DeepTauId",
584  electrons = cms.InputTag('slimmedElectrons'),
585  muons = cms.InputTag('slimmedMuons'),
586  taus = cms.InputTag('slimmedTaus'),
587  pfcands = cms.InputTag('packedPFCandidates'),
588  vertices = cms.InputTag('offlineSlimmedPrimaryVertices'),
589  rho = cms.InputTag('fixedGridRhoAll'),
590  graph_file = cms.vstring(file_names),
591  mem_mapped = cms.bool(False),
592  version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
593  debug_level = cms.int32(0),
594  disable_dxy_pca = cms.bool(False)
595  )
596 
597  self.processDeepProducer('deepTau2017v1', tauIDSources, workingPoints_)
598 
599  self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v1)
600  self.process.rerunMvaIsolationSequence += self.process.deepTau2017v1
601 
602  if "deepTau2017v2" in self.toKeep:
603  if self.debug: print ("Adding DeepTau IDs")
604 
605  workingPoints_ = {
606  "e": {
607  "VVVLoose": 0.0630386,
608  "VVLoose": 0.1686942,
609  "VLoose": 0.3628130,
610  "Loose": 0.6815435,
611  "Medium": 0.8847544,
612  "Tight": 0.9675541,
613  "VTight": 0.9859251,
614  "VVTight": 0.9928449,
615  },
616  "mu": {
617  "VLoose": 0.1058354,
618  "Loose": 0.2158633,
619  "Medium": 0.5551894,
620  "Tight": 0.8754835,
621  },
622  "jet": {
623  "VVVLoose": 0.2599605,
624  "VVLoose": 0.4249705,
625  "VLoose": 0.5983682,
626  "Loose": 0.7848675,
627  "Medium": 0.8834768,
628  "Tight": 0.9308689,
629  "VTight": 0.9573137,
630  "VVTight": 0.9733927,
631  },
632  }
633 
634  file_names = [
635  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
636  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
637  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
638  ]
639  self.process.deepTau2017v2 = cms.EDProducer("DeepTauId",
640  electrons = cms.InputTag('slimmedElectrons'),
641  muons = cms.InputTag('slimmedMuons'),
642  taus = cms.InputTag('slimmedTaus'),
643  pfcands = cms.InputTag('packedPFCandidates'),
644  vertices = cms.InputTag('offlineSlimmedPrimaryVertices'),
645  rho = cms.InputTag('fixedGridRhoAll'),
646  graph_file = cms.vstring(file_names),
647  mem_mapped = cms.bool(False),
648  version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
649  debug_level = cms.int32(0),
650  disable_dxy_pca = cms.bool(False)
651  )
652 
653  self.processDeepProducer('deepTau2017v2', tauIDSources, workingPoints_)
654 
655  self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2)
656  self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2
657 
658  if "deepTau2017v2p1" in self.toKeep:
659  if self.debug: print ("Adding DeepTau IDs")
660 
661  workingPoints_ = {
662  "e": {
663  "VVVLoose": 0.0630386,
664  "VVLoose": 0.1686942,
665  "VLoose": 0.3628130,
666  "Loose": 0.6815435,
667  "Medium": 0.8847544,
668  "Tight": 0.9675541,
669  "VTight": 0.9859251,
670  "VVTight": 0.9928449,
671  },
672  "mu": {
673  "VLoose": 0.1058354,
674  "Loose": 0.2158633,
675  "Medium": 0.5551894,
676  "Tight": 0.8754835,
677  },
678  "jet": {
679  "VVVLoose": 0.2599605,
680  "VVLoose": 0.4249705,
681  "VLoose": 0.5983682,
682  "Loose": 0.7848675,
683  "Medium": 0.8834768,
684  "Tight": 0.9308689,
685  "VTight": 0.9573137,
686  "VVTight": 0.9733927,
687  },
688  }
689 
690  file_names = [
691  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
692  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
693  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
694  ]
695  self.process.deepTau2017v2p1 = cms.EDProducer("DeepTauId",
696  electrons = cms.InputTag('slimmedElectrons'),
697  muons = cms.InputTag('slimmedMuons'),
698  taus = cms.InputTag('slimmedTaus'),
699  pfcands = cms.InputTag('packedPFCandidates'),
700  vertices = cms.InputTag('offlineSlimmedPrimaryVertices'),
701  rho = cms.InputTag('fixedGridRhoAll'),
702  graph_file = cms.vstring(file_names),
703  mem_mapped = cms.bool(False),
704  version = cms.uint32(self.getDeepTauVersion(file_names[0])[1]),
705  debug_level = cms.int32(0),
706  disable_dxy_pca = cms.bool(True),
707  is_online = cms.bool(False)
708  )
709 
710  self.processDeepProducer('deepTau2017v2p1', tauIDSources, workingPoints_)
711 
712  self.process.rerunMvaIsolationTask.add(self.process.deepTau2017v2p1)
713  self.process.rerunMvaIsolationSequence += self.process.deepTau2017v2p1
714 
715  if "DPFTau_2016_v0" in self.toKeep:
716  if self.debug: print ("Adding DPFTau isolation (v0)")
717 
718  workingPoints_ = {
719  "all": {
720  "Tight" : "if(decayMode == 0) return (0.898328 - 0.000160992 * pt);" + \
721  "if(decayMode == 1) return (0.910138 - 0.000229923 * pt);" + \
722  "if(decayMode == 10) return (0.873958 - 0.0002328 * pt);" + \
723  "return 99.0;"
724  #"Tight" : "? decayMode == 0 ? (0.898328 - 0.000160992 * pt) : " +
725  # "(? decayMode == 1 ? 0.910138 - 0.000229923 * pt : " +
726  # "(? decayMode == 10 ? (0.873958 - 0.0002328 * pt) : 1))"
727  # "Tight" : "(decayMode == 0) * (0.898328 - 0.000160992 * pt) + \
728  # (decayMode == 1) * (0.910138 - 0.000229923 * pt) + \
729  # (decayMode == 10) * (0.873958 - 0.0002328 * pt) "
730  }
731  }
732  file_names = [ 'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v0_quantized.pb' ]
733  self.process.dpfTau2016v0 = cms.EDProducer("DPFIsolation",
734  pfcands = cms.InputTag('packedPFCandidates'),
735  taus = cms.InputTag('slimmedTaus'),
736  vertices = cms.InputTag('offlineSlimmedPrimaryVertices'),
737  graph_file = cms.vstring(file_names),
738  version = cms.uint32(self.getDpfTauVersion(file_names[0])),
739  mem_mapped = cms.bool(False)
740  )
741 
742  self.processDeepProducer('dpfTau2016v0', tauIDSources, workingPoints_)
743 
744  self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v0)
745  self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v0
746 
747 
748  if "DPFTau_2016_v1" in self.toKeep:
749  print ("Adding DPFTau isolation (v1)")
750  print ("WARNING: WPs are not defined for DPFTau_2016_v1")
751  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).")
752 
753  workingPoints_ = {
754  "all": {"Tight" : 0.123} #FIXME: define WP
755  }
756 
757  file_names = [ 'RecoTauTag/TrainingFiles/data/DPFTauId/DPFIsolation_2017v1_quantized.pb' ]
758  self.process.dpfTau2016v1 = cms.EDProducer("DPFIsolation",
759  pfcands = cms.InputTag('packedPFCandidates'),
760  taus = cms.InputTag('slimmedTaus'),
761  vertices = cms.InputTag('offlineSlimmedPrimaryVertices'),
762  graph_file = cms.vstring(file_names),
763  version = cms.uint32(self.getDpfTauVersion(file_names[0])),
764  mem_mapped = cms.bool(False)
765  )
766 
767  self.processDeepProducer('dpfTau2016v1', tauIDSources, workingPoints_)
768 
769  self.process.rerunMvaIsolationTask.add(self.process.dpfTau2016v1)
770  self.process.rerunMvaIsolationSequence += self.process.dpfTau2016v1
771 
772  if "againstEle2018" in self.toKeep:
773  antiElectronDiscrMVA6_version = "MVA6v3_noeveto"
774 
776  from RecoTauTag.RecoTau.patTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6
777  self.process.patTauDiscriminationByElectronRejectionMVA62018Raw = patTauDiscriminationAgainstElectronMVA6.clone(
778  PATTauProducer = cms.InputTag('slimmedTaus'),
779  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
780  srcElectrons = cms.InputTag('slimmedElectrons'),
781  vetoEcalCracks = cms.bool(False), #keep taus in EB-EE cracks
782  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL',
783  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC',
784  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL',
785  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC',
786  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL',
787  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC',
788  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL',
789  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC'
790  )
791 
792  from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import patTauDiscriminantCutMultiplexer
793  self.process.patTauDiscriminationByElectronRejectionMVA62018 = patTauDiscriminantCutMultiplexer.clone(
794  PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer,
795  Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA62018Raw.Prediscriminants,
796  toMultiplex = cms.InputTag("patTauDiscriminationByElectronRejectionMVA62018Raw"),
797  mapping = cms.VPSet(
798  cms.PSet(
799  category = cms.uint32(0),
800  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL'),
801  variable = cms.string('pt')
802  ),
803  cms.PSet(
804  category = cms.uint32(2),
805  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL'),
806  variable = cms.string('pt')
807  ),
808  cms.PSet(
809  category = cms.uint32(5),
810  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL'),
811  variable = cms.string('pt')
812  ),
813  cms.PSet(
814  category = cms.uint32(7),
815  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL'),
816  variable = cms.string('pt')
817  ),
818  cms.PSet(
819  category = cms.uint32(8),
820  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC'),
821  variable = cms.string('pt')
822  ),
823  cms.PSet(
824  category = cms.uint32(10),
825  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC'),
826  variable = cms.string('pt')
827  ),
828  cms.PSet(
829  category = cms.uint32(13),
830  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC'),
831  variable = cms.string('pt')
832  ),
833  cms.PSet(
834  category = cms.uint32(15),
835  cut = cms.string('RecoTauTag_antiElectron'+antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC'),
836  variable = cms.string('pt')
837  )
838  ),
839  workingPoints = cms.vstring(
840  "_WPeff98",
841  "_WPeff90",
842  "_WPeff80",
843  "_WPeff70",
844  "_WPeff60"
845  )
846  )
847 
848  self.process.patTauDiscriminationByElectronRejectionMVA62018Task = cms.Task(
849  self.process.patTauDiscriminationByElectronRejectionMVA62018Raw,
850  self.process.patTauDiscriminationByElectronRejectionMVA62018
851  )
852  self.process.patTauDiscriminationByElectronRejectionMVA62018Seq = cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
853  self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA62018Task)
854  self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA62018Seq
855 
856  _againstElectronTauIDSources = cms.PSet(
857  againstElectronMVA6Raw2018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "raw"),
858  againstElectronMVA6category2018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "category"),
859  againstElectronVLooseMVA62018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_WPeff98"),
860  againstElectronLooseMVA62018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_WPeff90"),
861  againstElectronMediumMVA62018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_WPeff80"),
862  againstElectronTightMVA62018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_WPeff70"),
863  againstElectronVTightMVA62018 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA62018", "_WPeff60")
864  )
865  _tauIDSourcesWithAgainistEle = cms.PSet(
866  tauIDSources.clone(),
867  _againstElectronTauIDSources
868  )
869  tauIDSources =_tauIDSourcesWithAgainistEle.clone()
870 
871  if "newDMPhase2v1" in self.toKeep:
872  if self.debug: print ("Adding newDMPhase2v1 ID")
873  def tauIDMVAinputs(module, wp):
874  return cms.PSet(inputTag = cms.InputTag(module), workingPointIndex = cms.int32(-1 if wp=="raw" else -2 if wp=="category" else getattr(self.process, module).workingPoints.index(wp)))
875  self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
876  PATTauProducer = 'slimmedTaus',
877  Prediscriminants = noPrediscriminants,
878  loadMVAfromDB = True,
879  mvaName = 'RecoTauTag_tauIdMVAIsoPhase2',
880  mvaOpt = 'DBnewDMwLTwGJPhase2',
881  verbosity = 0
882  )
883 
884  self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2 = patDiscriminationByIsolationMVArun2v1.clone(
885  PATTauProducer = 'slimmedTaus',
886  Prediscriminants = noPrediscriminants,
887  toMultiplex = 'rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw',
888  loadMVAfromDB = True,
889  mvaOutput_normalization = 'RecoTauTag_tauIdMVAIsoPhase2_mvaOutput_normalization',
890  mapping = cms.VPSet(
891  cms.PSet(
892  category = cms.uint32(0),
893  cut = cms.string("RecoTauTag_tauIdMVAIsoPhase2"),
894  variable = cms.string("pt"),
895  )
896  ),
897  workingPoints = cms.vstring(
898  "_VVLoose",
899  "_VLoose",
900  "_Loose",
901  "_Medium",
902  "_Tight",
903  "_VTight",
904  "_VVTight"
905  )
906  )
907  self.process.rerunIsolationMVADBnewDMwLTPhase2Task = cms.Task(
908  self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw,
909  self.process.rerunDiscriminationByIsolationMVADBnewDMwLTPhase2
910  )
911  self.process.rerunMvaIsolationTask.add(self.process.rerunIsolationMVADBnewDMwLTPhase2Task)
912  self.process.rerunMvaIsolationSequence += cms.Sequence(self.process.rerunIsolationMVADBnewDMwLTPhase2Task)
913 
914  tauIDSources.byIsolationMVADBnewDMwLTPhase2raw = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "raw")
915  tauIDSources.byVVLooseIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_VVLoose")
916  tauIDSources.byVLooseIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_VLoose")
917  tauIDSources.byLooseIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_Loose")
918  tauIDSources.byMediumIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_Medium")
919  tauIDSources.byTightIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_Tight")
920  tauIDSources.byVTightIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_VTight")
921  tauIDSources.byVVTightIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs("rerunDiscriminationByIsolationMVADBnewDMwLTPhase2", "_VVTight")
922 
923  if "againstElePhase2v1" in self.toKeep:
924  if self.debug: print ("Adding anti-e Phase2v1 ID")
925 
927  from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6Phase2_cff import patTauDiscriminationAgainstElectronMVA6Phase2Raw, patTauDiscriminationAgainstElectronMVA6Phase2, mergedSlimmedElectronsForTauId
928  self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw = patTauDiscriminationAgainstElectronMVA6Phase2Raw.clone(
929  PATTauProducer = 'slimmedTaus',
930  Prediscriminants = noPrediscriminants #already selected for MiniAOD
931  )
932 
933  self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1 = patTauDiscriminationAgainstElectronMVA6Phase2.clone(
934  PATTauProducer = self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw.PATTauProducer,
935  Prediscriminants = self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw.Prediscriminants,
936  toMultiplex = 'patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw'
937  )
938 
939  self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
940  self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Task = cms.Task(
941  self.process.mergedSlimmedElectronsForTauId,
942  self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw,
943  self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1
944  )
945  self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Seq = cms.Sequence(self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
946  self.process.rerunMvaIsolationTask.add(self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
947  self.process.rerunMvaIsolationSequence += self.process.patTauDiscriminationByElectronRejectionMVA6Phase2v1Seq
948 
949  _againstElectronTauIDPhase2v1Sources = cms.PSet(
950  againstElectronMVA6RawPhase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "raw"),
951  againstElectronMVA6categoryPhase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "category"),
952  againstElectronVLooseMVA6Phase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "_VLoose"),
953  againstElectronLooseMVA6Phase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "_Loose"),
954  againstElectronMediumMVA6Phase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "_Medium"),
955  againstElectronTightMVA6Phase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "_Tight"),
956  againstElectronVTightMVA6Phase2v1 = self.tauIDMVAinputs("patTauDiscriminationByElectronRejectionMVA6Phase2v1", "_VTight")
957  )
958  _tauIDSourcesWithAgainistElePhase2v1 = cms.PSet(
959  tauIDSources.clone(),
960  _againstElectronTauIDPhase2v1Sources
961  )
962  tauIDSources =_tauIDSourcesWithAgainistElePhase2v1.clone()
963 
964  if self.debug: print('Embedding new TauIDs into \"'+self.updatedTauName+'\"')
965  if not hasattr(self.process, self.updatedTauName):
966  embedID = cms.EDProducer("PATTauIDEmbedder",
967  src = cms.InputTag('slimmedTaus'),
968  tauIDSources = tauIDSources
969  )
970  setattr(self.process, self.updatedTauName, embedID)
971  else: #assume same type
972  tauIDSources = cms.PSet(
973  getattr(self.process, self.updatedTauName).tauIDSources,
974  tauIDSources)
975  getattr(self.process, self.updatedTauName).tauIDSources = tauIDSources
976 
977 

References DigiComparisonTask.debug, TPComparisonTask.debug, HcalOfflineHarvesting.debug, HcalOnlineHarvesting.debug, HFRaddamTask.debug, LaserTask.debug, NoCQTask.debug, QIE10Task.debug, PedestalTask.debug, QIE11Task.debug, RecHitTask.debug, UMNioTask.debug, ZDCTask.debug, RawTask.debug, TPTask.debug, DigiTask.debug, LEDTask.debug, InterpolationDebug.debug, runTauIdMVA.TauIDEmbedder.debug, DTDigiToRawModule.debug, CSCRPCData.debug, CSCTMBScope.debug, DTDigiToRaw.debug, ALIUtils.debug, magneticfield::eSector.debug, magneticfield::bRod.debug, CSCSegAlgoPreClustering.debug, DTSegment4DT0Corrector.debug, DTRecHitProducer.debug, DTRecSegment4DProducer.debug, crabFunctions.CrabController.debug, RPCPointProducer.debug, QCDSingleJetFilter.debug, DTSegmentsTask.debug, HiggsTo2GammaSkim.debug, HiggsToZZ4LeptonsSkimEff.debug, magneticfield::bSector.debug, DTOccupancyEfficiency.debug, HiggsToZZ4LeptonsPreFilter.debug, DTTTrigCorrectionFirst.debug, MuonSeedProducer.debug, HiggsToZZ4LeptonsSkim.debug, DTTPDeadWriter.debug, DTDDUUnpacker.debug, pkg.AbstractPkg.debug, DTRecSegment2DProducer.debug, DTTTrigWriter.debug, magneticfield::bSlab.debug, JetAnaPythia< Jet >.debug, DTRecSegment2DExtendedProducer.debug, DTT0CalibrationRMS.debug, MuScleFitFilter.debug, CSCDCCEventData.debug, SiPixelRawToDigi.debug, DTNoiseComputation.debug, CSCAnodeLCTAnalyzer.debug, CSCCathodeLCTAnalyzer.debug, magneticfield::bLayer.debug, CSCSegAlgoShowering.debug, DTOccupancyPoint.debug, MuScleFitPlotter.debug, GEMCSCSegAlgoRR.debug, DTTTrigSyncT0Only.debug, DTROS25Unpacker.debug, util.rrapi.RRApi.debug, rrapi.RRApi.debug, DTSpyReader.debug, DTEfficiencyTask.debug, DTT0Calibration.debug, ME0SegmentAlgorithm.debug, DTTTrigCalibration.debug, DTRunConditionVar.debug, GEMSegmentAlgorithm.debug, PythiaFilterEMJetHeep.debug, HeavyChHiggsToTauNuSkim.debug, CSCDDUEventData.debug, PPSAlignmentConfigESSource.debug, DTChamberEfficiencyTask.debug, DTMeantimerPatternReco4D.debug, HCALResponse.debug, DTCombinatorialPatternReco4D.debug, DTRefitAndCombineReco4D.debug, DTClusterer.debug, DTChamberEfficiency.debug, FCDTask.debug, CSCDCCUnpacker.debug, CSCComparatorData.debug, MuonSeedCreator.debug, DTTMax.debug, DTLinearDriftAlgo.debug, CSCTimingExtractor.debug, DTTTrigSyncFromDB.debug, DTVDriftCalibration.debug, MuonSeedCleaner.debug, CSCTMBData.debug, DTNoDriftAlgo.debug, DTParametrizedDriftAlgo.debug, DTCombinatorialPatternReco.debug, MagGeoBuilderFromDDD.debug, PixelDataFormatter.debug, DTTimingExtractor.debug, DTMeantimerPatternReco.debug, DTTTrigSyncTOFCorr.debug, DTCombinatorialExtendedPatternReco.debug, MuonSeedBuilder.debug, DTLinearDriftFromDBAlgo.debug, DTSegmentUpdator.debug, CSCTMBHeader.debug, CSCSegAlgoDF.debug, CSCEventData.debug, MuScleFitUtils.debug, BaseParticlePropagator.debug, CSCTriggerPrimitivesReader.debug, magneticfield::BaseVolumeHandle.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, CSCALCTHeader.debug, notcub::CachingHostAllocator.debug, notcub::CachingDeviceAllocator.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, crabFunctions.CrabTask.debug, Pythia8::PowhegHooksBB4L.debug, HltDiff.debug, runTauIdMVA.TauIDEmbedder.is_above_cmssw_version(), runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017(), 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, Config.TestModuleCommand.process, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017, runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017, and runTauIdMVA.TauIDEmbedder.toKeep.

◆ tauIDMVAinputs()

def runTauIdMVA.TauIDEmbedder.tauIDMVAinputs (   self,
  module,
  wp 
)

◆ versionToInt()

def runTauIdMVA.TauIDEmbedder.versionToInt (   release = 9,
  subversion = 4,
  patch = 0,
  debug = False 
)
static

Definition at line 79 of file runTauIdMVA.py.

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

Member Data Documentation

◆ availableDiscriminators

runTauIdMVA.TauIDEmbedder.availableDiscriminators
static

Definition at line 11 of file runTauIdMVA.py.

◆ debug

runTauIdMVA.TauIDEmbedder.debug

◆ process

runTauIdMVA.TauIDEmbedder.process

◆ rerunIsolationNewDMMVArun2016v1Task

runTauIdMVA.TauIDEmbedder.rerunIsolationNewDMMVArun2016v1Task

Definition at line 531 of file runTauIdMVA.py.

◆ rerunIsolationNewDMMVArun2017v2Task

runTauIdMVA.TauIDEmbedder.rerunIsolationNewDMMVArun2017v2Task

Definition at line 331 of file runTauIdMVA.py.

◆ rerunIsolationOldDMdR0p3MVArun2017v2Task

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMdR0p3MVArun2017v2Task

Definition at line 406 of file runTauIdMVA.py.

◆ rerunIsolationOldDMMVArun2016v1Task

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2016v1Task

Definition at line 482 of file runTauIdMVA.py.

◆ rerunIsolationOldDMMVArun2017v1Task

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2017v1Task

Definition at line 188 of file runTauIdMVA.py.

◆ rerunIsolationOldDMMVArun2017v2Task

runTauIdMVA.TauIDEmbedder.rerunIsolationOldDMMVArun2017v2Task

Definition at line 260 of file runTauIdMVA.py.

◆ tauIdDiscrMVA_2017_version

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version

◆ tauIdDiscrMVA_trainings_run2_2017

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017

◆ tauIdDiscrMVA_WPs_run2_2017

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017

◆ toKeep

runTauIdMVA.TauIDEmbedder.toKeep

Definition at line 40 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

◆ updatedTauName

runTauIdMVA.TauIDEmbedder.updatedTauName

Definition at line 24 of file runTauIdMVA.py.

taus_updatedMVAIds_cff.tauIDMVAinputs
def tauIDMVAinputs(module, wp)
Definition: taus_updatedMVAIds_cff.py:316
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
PATTauDiscriminantCutMultiplexer_cfi
patTauDiscriminationAgainstElectronMVA6_cfi
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
str
#define str(s)
Definition: TestProcessor.cc:51
svgfig.load
def load(fileName)
Definition: svgfig.py:547
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
createfilelist.int
int
Definition: createfilelist.py:10
format
pileupCalc.upper
upper
Definition: pileupCalc.py:214