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, originalTauName="slimmedTaus", updatedTauName="slimmedTausNewID", postfix="", toKeep=["deepTau2017v2p1", deepTau2018v2p5, deepTau2026v2p5, conditionDB="" # preparational DB:'frontier://FrontierPrep/CMS_CONDITIONS')
 
def get_cmssw_version_number (klass, debug=False)
 
def getDeepTauVersion (self, file_name)
 
def is_above_cmssw_version (klass, release=9, subversion=4, patch=0, debug=False)
 
def load_againstElectronMVA6 (self)
 
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

 antiElectronDiscrMVA6_version
 
 antiElectronDiscrMVA6_WPs
 
 debug
 
 originalTauName
 
 postfix
 
 process
 
 tauIdDiscrMVA_2017_version
 
 tauIdDiscrMVA_trainings_run2_2017
 
 tauIdDiscrMVA_WPs_run2_2017
 
 toKeep
 
 updatedTauName
 

Static Public Attributes

 availableDiscriminators
 
 experimentalDiscriminators
 

Detailed Description

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

Definition at line 12 of file runTauIdMVA.py.

Constructor & Destructor Documentation

◆ __init__()

def runTauIdMVA.TauIDEmbedder.__init__ (   self,
  process,
  debug = False,
  originalTauName = "slimmedTaus",
  updatedTauName = "slimmedTausNewID",
  postfix = "",
  toKeep = ["deepTau2017v2p1",
  deepTau2018v2p5,
  deepTau2026v2p5,
  conditionDB = "" # preparational DB: 'frontier://FrontierPrep/CMS_CONDITIONS' 
)

Definition at line 33 of file runTauIdMVA.py.

33  ):
34  super(TauIDEmbedder, self).__init__()
35  self.process = process
36  self.debug = debug
37  self.originalTauName = originalTauName
38  self.updatedTauName = updatedTauName
39  self.postfix = postfix
40 
41  for discr in toKeep:
42  if discr not in TauIDEmbedder.availableDiscriminators:
43  raise RuntimeError('TauIDEmbedder: discriminator "{}" is not supported'.format(discr))
44  self.toKeep = toKeep
45  if not set(toKeep).isdisjoint(TauIDEmbedder.experimentalDiscriminators):
46  print('There are experimental tauIDs not from GT')
47  self.process.load('RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi')
48  if len(conditionDB) != 0:
49  self.process.CondDBTauConnection.connect = cms.string(conditionDB)
50  self.process.loadRecoTauTagMVAsFromPrepDB.connect = cms.string(conditionDB)
51  # if debug:
52  # print self.process.CondDBTauConnection.connect
53  # print dir(self.process.loadRecoTauTagMVAsFromPrepDB)
54  # print self.process.loadRecoTauTagMVAsFromPrepDB.parameterNames_
55 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def load(fileName)
Definition: svgfig.py:547

Member Function Documentation

◆ get_cmssw_version()

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

Definition at line 57 of file runTauIdMVA.py.

57  def get_cmssw_version(debug = False):
58  """returns 'CMSSW_X_Y_Z'"""
59  cmssw_version = os.environ["CMSSW_VERSION"]
60  if debug: print ("get_cmssw_version:", cmssw_version)
61  return cmssw_version
62 

◆ get_cmssw_version_number()

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

Definition at line 64 of file runTauIdMVA.py.

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

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

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

References createfilelist.int.

1313  def getDeepTauVersion(self, file_name):
1314  """returns the DeepTau year, version, subversion. File name should contain a version label with data takig year \
1315  (2011-2, 2015-8), version number (vX) and subversion (pX), e.g. 2017v0p6, in general the following format: \
1316  {year}v{version}p{subversion}"""
1317  version_search = re.search('(20[1,2][125678])v([0-9]+)(p[0-9]+|)[\._]', file_name)
1318  if not version_search:
1319  raise RuntimeError('File "{}" has an invalid name pattern, should be in the format "{year}v{version}p{subversion}". \
1320  Unable to extract version number.'.format(file_name))
1321  year = version_search.group(1)
1322  version = version_search.group(2)
1323  subversion = version_search.group(3)
1324  if len(subversion) > 0:
1325  subversion = subversion[1:]
1326  else:
1327  subversion = 0
1328  return int(year), int(version), int(subversion)

◆ is_above_cmssw_version()

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

Definition at line 82 of file runTauIdMVA.py.

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

◆ load_againstElectronMVA6()

def runTauIdMVA.TauIDEmbedder.load_againstElectronMVA6 (   self)

Definition at line 124 of file runTauIdMVA.py.

References runTauIdMVA.TauIDEmbedder.antiElectronDiscrMVA6_version, runTauIdMVA.TauIDEmbedder.antiElectronDiscrMVA6_WPs, InterpolationDebug.debug, l1ct::EGInputSelectorEmuConfig.debug, Cordic.debug, DTDigiToRawModule.debug, CSCRPCData.debug, CSCTMBScope.debug, DTDigiToRaw.debug, magneticfield::eSector.debug, ALIUtils.debug, CSCSegAlgoPreClustering.debug, magneticfield::bRod.debug, DTSegment4DT0Corrector.debug, runTauIdMVA.TauIDEmbedder.debug, DTRecSegment4DProducer.debug, L1SeedConePFJetProducer.debug, crabFunctions.CrabController.debug, DTRecHitProducer.debug, DTSegmentsTask.debug, magneticfield::bSector.debug, DTOccupancyEfficiency.debug, RPCPointProducer.debug, MuonSeedProducer.debug, CSCGEMData.debug, DTDDUUnpacker.debug, pkg.AbstractPkg.debug, DTTTrigCorrectionFirst.debug, MuScleFitFilter.debug, JetAnaPythia< Jet >.debug, magneticfield::bSlab.debug, DTRecSegment2DProducer.debug, CSCDCCEventData.debug, DTRecSegment2DExtendedProducer.debug, DTT0CalibrationRMS.debug, DTTTrigWriter.debug, DTTPDeadWriter.debug, PPSAlignmentConfigurationESSource.debug, CSCSegAlgoShowering.debug, magneticfield::bLayer.debug, MuScleFitPlotter.debug, DTOccupancyPoint.debug, TritonService::FallbackOpts.debug, GEMCSCSegAlgoRR.debug, DTNoiseComputation.debug, DTROS25Unpacker.debug, L1CaloJetHTTProducer.debug, util.rrapi.RRApi.debug, rrapi.RRApi.debug, DTSpyReader.debug, DTT0Calibration.debug, DTTTrigSyncT0Only.debug, ME0SegmentAlgorithm.debug, DTEfficiencyTask.debug, PythiaFilterEMJetHeep.debug, GEMSegmentAlgorithm.debug, DTTTrigCalibration.debug, CSCDDUEventData.debug, DTRunConditionVar.debug, DTChamberEfficiencyTask.debug, HCALResponse.debug, DTCombinatorialPatternReco4D.debug, DTMeantimerPatternReco4D.debug, DTRefitAndCombineReco4D.debug, DTClusterer.debug, l1ct::PFTkEGAlgoEmuConfig.debug, DTChamberEfficiency.debug, CSCDCCUnpacker.debug, CSCComparatorData.debug, MuonSeedCreator.debug, DTTMax.debug, L1TowerCalibrator.debug, DTLinearDriftAlgo.debug, CSCTimingExtractor.debug, MuonSeedCleaner.debug, DTVDriftCalibration.debug, DTNoDriftAlgo.debug, DTParametrizedDriftAlgo.debug, DTTTrigSyncFromDB.debug, MagGeoBuilderFromDDD.debug, CSCTMBData.debug, DTTTrigSyncTOFCorr.debug, DTCombinatorialPatternReco.debug, DTTimingExtractor.debug, DTMeantimerPatternReco.debug, MuonSeedBuilder.debug, DTCombinatorialExtendedPatternReco.debug, L1CaloJetProducer.debug, DTSegmentUpdator.debug, CSCSegAlgoDF.debug, DTLinearDriftFromDBAlgo.debug, MuScleFitUtils.debug, CSCEventData.debug, BaseParticlePropagator.debug, magneticfield::BaseVolumeHandle.debug, CSCTMBHeader.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, notcub::CachingHostAllocator.debug, notcub::CachingDeviceAllocator.debug, CSCALCTHeader.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.debug, PFHCALDenseIdNavigator< DET, TOPO, ownsTopo >.debug, crabFunctions.CrabTask.debug, Pythia8::PowhegHooksBB4L.debug, HltDiff.debug, edm::ProductLabels.process, runTauIdMVA.TauIDEmbedder.process, DTT0WireWorkflow.DTT0WireWorkflow.process, DTVdriftWorkflow.DTvdriftWorkflow.process, cscdqm::HWStandbyType.process, DTTtrigWorkflow.DTttrigWorkflow.process, edmModuleAllocMonitorAnalyze.Activity.process, edmTracerCompactLogViewer.Activity.process, EgammaHLTValidationUtils.EgammaDQMModuleMaker.process, Config.Process.process, DTWorkflow.DTWorkflow.process, ConfigBuilder.ConfigBuilder.process, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.process, JsonOutputProducer::JsonConfigurationBlock.process, and Config.TestModuleCommand.process.

124  def load_againstElectronMVA6(self):
125  if self.debug: print ("load_againstElectronMVA6: performed")
126  global cms
127  antiElectronDiscrMVA6_categories = {
128  '0' : "gbr_NoEleMatch_woGwoGSF_BL",
129  '2' : "gbr_NoEleMatch_wGwoGSF_BL",
130  '5' : "gbr_woGwGSF_BL",
131  '7' : "gbr_wGwGSF_BL",
132  '8' : "gbr_NoEleMatch_woGwoGSF_EC",
133  '10' : "gbr_NoEleMatch_wGwoGSF_EC",
134  '13' : "gbr_woGwGSF_EC",
135  '15' : "gbr_wGwGSF_EC"
136  }
137  for category, gbrForestName in antiElectronDiscrMVA6_categories.items():
138  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
139  cms.PSet(
140  record = cms.string('GBRWrapperRcd'),
141  tag = cms.string("RecoTauTag_antiElectronMVA6%s_%s" % (self.antiElectronDiscrMVA6_version, gbrForestName)),
142  label = cms.untracked.string("RecoTauTag_antiElectronMVA6%s_%s" % (self.antiElectronDiscrMVA6_version, gbrForestName))
143  )
144  )
145  for WP in self.antiElectronDiscrMVA6_WPs:
146  self.process.loadRecoTauTagMVAsFromPrepDB.toGet.append(
147  cms.PSet(
148  record = cms.string('PhysicsTGraphPayloadRcd'),
149  tag = cms.string("RecoTauTag_antiElectronMVA6%s_%s_WP%s" % (self.antiElectronDiscrMVA6_version, gbrForestName, WP)),
150  label = cms.untracked.string("RecoTauTag_antiElectronMVA6%s_%s_WP%s" % (self.antiElectronDiscrMVA6_version, gbrForestName, WP))
151  )
152  )
153 

◆ loadMVA_WPs_run2_2017()

def runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017 (   self)

Definition at line 94 of file runTauIdMVA.py.

References InterpolationDebug.debug, l1ct::EGInputSelectorEmuConfig.debug, Cordic.debug, DTDigiToRawModule.debug, CSCRPCData.debug, CSCTMBScope.debug, DTDigiToRaw.debug, magneticfield::eSector.debug, ALIUtils.debug, CSCSegAlgoPreClustering.debug, magneticfield::bRod.debug, DTSegment4DT0Corrector.debug, runTauIdMVA.TauIDEmbedder.debug, DTRecSegment4DProducer.debug, L1SeedConePFJetProducer.debug, crabFunctions.CrabController.debug, DTRecHitProducer.debug, DTSegmentsTask.debug, magneticfield::bSector.debug, DTOccupancyEfficiency.debug, RPCPointProducer.debug, MuonSeedProducer.debug, CSCGEMData.debug, DTDDUUnpacker.debug, pkg.AbstractPkg.debug, DTTTrigCorrectionFirst.debug, MuScleFitFilter.debug, JetAnaPythia< Jet >.debug, magneticfield::bSlab.debug, DTRecSegment2DProducer.debug, CSCDCCEventData.debug, DTRecSegment2DExtendedProducer.debug, DTT0CalibrationRMS.debug, DTTTrigWriter.debug, DTTPDeadWriter.debug, PPSAlignmentConfigurationESSource.debug, CSCSegAlgoShowering.debug, magneticfield::bLayer.debug, MuScleFitPlotter.debug, DTOccupancyPoint.debug, TritonService::FallbackOpts.debug, GEMCSCSegAlgoRR.debug, DTNoiseComputation.debug, DTROS25Unpacker.debug, L1CaloJetHTTProducer.debug, util.rrapi.RRApi.debug, rrapi.RRApi.debug, DTSpyReader.debug, DTT0Calibration.debug, DTTTrigSyncT0Only.debug, ME0SegmentAlgorithm.debug, DTEfficiencyTask.debug, PythiaFilterEMJetHeep.debug, GEMSegmentAlgorithm.debug, DTTTrigCalibration.debug, CSCDDUEventData.debug, DTRunConditionVar.debug, DTChamberEfficiencyTask.debug, HCALResponse.debug, DTMeantimerPatternReco4D.debug, DTCombinatorialPatternReco4D.debug, DTRefitAndCombineReco4D.debug, DTClusterer.debug, l1ct::PFTkEGAlgoEmuConfig.debug, DTChamberEfficiency.debug, CSCDCCUnpacker.debug, CSCComparatorData.debug, MuonSeedCreator.debug, DTTMax.debug, L1TowerCalibrator.debug, DTLinearDriftAlgo.debug, CSCTimingExtractor.debug, MuonSeedCleaner.debug, DTVDriftCalibration.debug, DTNoDriftAlgo.debug, DTParametrizedDriftAlgo.debug, DTTTrigSyncFromDB.debug, MagGeoBuilderFromDDD.debug, CSCTMBData.debug, DTTTrigSyncTOFCorr.debug, DTCombinatorialPatternReco.debug, DTTimingExtractor.debug, DTMeantimerPatternReco.debug, MuonSeedBuilder.debug, DTCombinatorialExtendedPatternReco.debug, L1CaloJetProducer.debug, DTSegmentUpdator.debug, CSCSegAlgoDF.debug, DTLinearDriftFromDBAlgo.debug, MuScleFitUtils.debug, CSCEventData.debug, BaseParticlePropagator.debug, magneticfield::BaseVolumeHandle.debug, CSCTMBHeader.debug, CSCSegAlgoST.debug, CSCALCTTrailer.debug, notcub::CachingHostAllocator.debug, notcub::CachingDeviceAllocator.debug, CSCALCTHeader.debug, EcalBoundaryInfoCalculator< EcalDetId >.debug, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.debug, PFHCALDenseIdNavigator< DET, TOPO, ownsTopo >.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, edmModuleAllocMonitorAnalyze.Activity.process, edmTracerCompactLogViewer.Activity.process, EgammaHLTValidationUtils.EgammaDQMModuleMaker.process, Config.Process.process, DTWorkflow.DTWorkflow.process, ConfigBuilder.ConfigBuilder.process, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.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.

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

◆ processDeepProducer()

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

Definition at line 1298 of file runTauIdMVA.py.

References postprocessor.PostProcessor.postfix, runTauIdMVA.TauIDEmbedder.postfix, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.postfix, edm::ProductLabels.process, runTauIdMVA.TauIDEmbedder.process, DTT0WireWorkflow.DTT0WireWorkflow.process, DTVdriftWorkflow.DTvdriftWorkflow.process, cscdqm::HWStandbyType.process, DTTtrigWorkflow.DTttrigWorkflow.process, edmModuleAllocMonitorAnalyze.Activity.process, edmTracerCompactLogViewer.Activity.process, EgammaHLTValidationUtils.EgammaDQMModuleMaker.process, Config.Process.process, DTWorkflow.DTWorkflow.process, ConfigBuilder.ConfigBuilder.process, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.process, JsonOutputProducer::JsonConfigurationBlock.process, Config.TestModuleCommand.process, and str.

1298  def processDeepProducer(self, producer_name, tauIDSources, workingPoints_):
1299  for target,points in workingPoints_.items():
1300  setattr(tauIDSources, 'by{}VS{}raw'.format(producer_name[0].upper()+producer_name[1:], target),
1301  cms.PSet(inputTag = cms.InputTag(producer_name+self.postfix, 'VS{}'.format(target)), workingPointIndex = cms.int32(-1)))
1302 
1303  cut_expressions = []
1304  for index, (point,cut) in enumerate(points.items()):
1305  cut_expressions.append(str(cut))
1306 
1307  setattr(tauIDSources, 'by{}{}VS{}'.format(point, producer_name[0].upper()+producer_name[1:], target),
1308  cms.PSet(inputTag = cms.InputTag(producer_name+self.postfix, 'VS{}'.format(target)), workingPointIndex = cms.int32(index)))
1309  if len(cut_expressions) > 0:
1310  setattr(getattr(self.process, producer_name+self.postfix), 'VS{}WP'.format(target), cms.vstring(*cut_expressions))
1311 
1312 
#define str(s)

◆ runTauID()

def runTauIdMVA.TauIDEmbedder.runTauID (   self)

Definition at line 154 of file runTauIdMVA.py.

References runTauIdMVA.TauIDEmbedder.originalTauName, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.originalTauName, postprocessor.PostProcessor.postfix, runTauIdMVA.TauIDEmbedder.postfix, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.postfix, edm::ProductLabels.process, runTauIdMVA.TauIDEmbedder.process, DTT0WireWorkflow.DTT0WireWorkflow.process, DTVdriftWorkflow.DTvdriftWorkflow.process, cscdqm::HWStandbyType.process, DTTtrigWorkflow.DTttrigWorkflow.process, edmModuleAllocMonitorAnalyze.Activity.process, edmTracerCompactLogViewer.Activity.process, EgammaHLTValidationUtils.EgammaDQMModuleMaker.process, Config.Process.process, DTWorkflow.DTWorkflow.process, ConfigBuilder.ConfigBuilder.process, adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.process, JsonOutputProducer::JsonConfigurationBlock.process, Config.TestModuleCommand.process, runTauIdMVA.TauIDEmbedder.tauIDMVAinputs(), runTauIdMVA.TauIDEmbedder.toKeep, and adaptToRunAtMiniAOD.adaptToRunAtMiniAOD.toKeep.

154  def runTauID(self):
155  _rerunMvaIsolationTask = cms.Task()
156  _rerunMvaIsolationSequence = cms.Sequence()
157  tauIDSources = cms.PSet()
158 
159  # MVAIso tauIDs with version given by payloads in GT (2017v2)
160  if "mvaIso" in self.toKeep:
161  _byIsolationOldDMMVAraw = "rerunDiscriminationByIsolationOldDMMVAraw"+self.postfix
162  setattr(self.process,_byIsolationOldDMMVAraw,patDiscriminationByIsolationMVArun2v1raw.clone(
163  PATTauProducer = self.originalTauName,
164  Prediscriminants = noPrediscriminants,
165  loadMVAfromDB = cms.bool(True),
166  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT"),
167  mvaOpt = cms.string("DBoldDMwLTwGJ"),
168  verbosity = cms.int32(0)
169  ))
170 
171  _byIsolationOldDMMVA = "rerunDiscriminationByIsolationOldDMMVA"+self.postfix
172  setattr(self.process,_byIsolationOldDMMVA,patDiscriminationByIsolationMVArun2v1.clone(
173  PATTauProducer = self.originalTauName,
174  Prediscriminants = noPrediscriminants,
175  toMultiplex = _byIsolationOldDMMVAraw,
176  loadMVAfromDB = cms.bool(True),
177  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
178  mapping = cms.VPSet(
179  cms.PSet(
180  category = cms.uint32(0),
181  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT"), #writeTauIdDiscrWPs
182  variable = cms.string("pt"),
183  )
184  ),
185  workingPoints = cms.vstring(
186  "_VVLoose",
187  "_VLoose",
188  "_Loose",
189  "_Medium",
190  "_Tight",
191  "_VTight",
192  "_VVTight"
193  )
194  ))
195 
196  _rerunIsolationOldDMMVATask = cms.Task(
197  getattr(self.process,_byIsolationOldDMMVAraw),
198  getattr(self.process,_byIsolationOldDMMVA)
199  )
200  _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVATask)
201  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVATask)
202 
203  tauIDSources.byIsolationMVArun2DBoldDMwLTraw = self.tauIDMVAinputs(_byIsolationOldDMMVA, "raw")
204  tauIDSources.byVVLooseIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_VVLoose")
205  tauIDSources.byVLooseIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_VLoose")
206  tauIDSources.byLooseIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_Loose")
207  tauIDSources.byMediumIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_Medium")
208  tauIDSources.byTightIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_Tight")
209  tauIDSources.byVTightIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_VTight")
210  tauIDSources.byVVTightIsolationMVArun2DBoldDMwLT = self.tauIDMVAinputs(_byIsolationOldDMMVA, "_VVTight")
211 
212  if "mvaIsoNewDM" in self.toKeep:
213  _byIsolationNewDMMVAraw = "rerunDiscriminationByIsolationNewDMMVAraw"+self.postfix
214  setattr(self.process,_byIsolationNewDMMVAraw,patDiscriminationByIsolationMVArun2v1raw.clone(
215  PATTauProducer = self.originalTauName,
216  Prediscriminants = noPrediscriminants,
217  loadMVAfromDB = cms.bool(True),
218  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT"),
219  mvaOpt = cms.string("DBnewDMwLTwGJ"),
220  verbosity = cms.int32(0)
221  ))
222 
223  _byIsolationNewDMMVA = "rerunDiscriminationByIsolationNewDMMVA"+self.postfix
224  setattr(self.process,_byIsolationNewDMMVA,patDiscriminationByIsolationMVArun2v1.clone(
225  PATTauProducer = self.originalTauName,
226  Prediscriminants = noPrediscriminants,
227  toMultiplex = _byIsolationNewDMMVAraw,
228  loadMVAfromDB = cms.bool(True),
229  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
230  mapping = cms.VPSet(
231  cms.PSet(
232  category = cms.uint32(0),
233  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT"), #writeTauIdDiscrWPs
234  variable = cms.string("pt"),
235  )
236  ),
237  workingPoints = cms.vstring(
238  "_VVLoose",
239  "_VLoose",
240  "_Loose",
241  "_Medium",
242  "_Tight",
243  "_VTight",
244  "_VVTight"
245  )
246  ))
247 
248  _rerunIsolationNewDMMVATask = cms.Task(
249  getattr(self.process,_byIsolationNewDMMVAraw),
250  getattr(self.process,_byIsolationNewDMMVA)
251  )
252  _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVATask)
253  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVATask)
254 
255  tauIDSources.byIsolationMVArun2DBnewDMwLTraw = self.tauIDMVAinputs(_byIsolationNewDMMVA, "raw")
256  tauIDSources.byVVLooseIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_VVLoose")
257  tauIDSources.byVLooseIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_VLoose")
258  tauIDSources.byLooseIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_Loose")
259  tauIDSources.byMediumIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_Medium")
260  tauIDSources.byTightIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_Tight")
261  tauIDSources.byVTightIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_VTight")
262  tauIDSources.byVVTightIsolationMVArun2DBnewDMwLT = self.tauIDMVAinputs(_byIsolationNewDMMVA, "_VVTight")
263 
264  if "mvaIsoDR0p3" in self.toKeep:
265  _byIsolationOldDMdR0p3MVAraw = "rerunDiscriminationByIsolationOldDMdR0p3MVAraw"+self.postfix
266  setattr(self.process,_byIsolationOldDMdR0p3MVAraw,patDiscriminationByIsolationMVArun2v1raw.clone(
267  PATTauProducer = self.originalTauName,
268  Prediscriminants = noPrediscriminants,
269  loadMVAfromDB = cms.bool(True),
270  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT"),
271  mvaOpt = cms.string("DBoldDMwLTwGJ"),
272  srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'),
273  srcFootprintCorrection = cms.string('footprintCorrectiondR03'),
274  srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'),
275  srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03'),
276  verbosity = cms.int32(0)
277  ))
278 
279  _byIsolationOldDMdR0p3MVA = "rerunDiscriminationByIsolationOldDMdR0p3MVA"+self.postfix
280  setattr(self.process,_byIsolationOldDMdR0p3MVA,patDiscriminationByIsolationMVArun2v1.clone(
281  PATTauProducer = self.originalTauName,
282  Prediscriminants = noPrediscriminants,
283  toMultiplex = _byIsolationOldDMdR0p3MVAraw,
284  loadMVAfromDB = cms.bool(True),
285  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
286  mapping = cms.VPSet(
287  cms.PSet(
288  category = cms.uint32(0),
289  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT"), #writeTauIdDiscrWPs
290  variable = cms.string("pt"),
291  )
292  ),
293  workingPoints = cms.vstring(
294  "_VVLoose",
295  "_VLoose",
296  "_Loose",
297  "_Medium",
298  "_Tight",
299  "_VTight",
300  "_VVTight"
301  )
302  ))
303 
304  _rerunIsolationOldDMdR0p3MVATask = cms.Task(
305  getattr(self.process,_byIsolationOldDMdR0p3MVAraw),
306  getattr(self.process,_byIsolationOldDMdR0p3MVA)
307  )
308  _rerunMvaIsolationTask.add(_rerunIsolationOldDMdR0p3MVATask)
309  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMdR0p3MVATask)
310 
311  tauIDSources.byIsolationMVArun2DBoldDMdR0p3wLTraw = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "raw")
312  tauIDSources.byVVLooseIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_VVLoose")
313  tauIDSources.byVLooseIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_VLoose")
314  tauIDSources.byLooseIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_Loose")
315  tauIDSources.byMediumIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_Medium")
316  tauIDSources.byTightIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_Tight")
317  tauIDSources.byVTightIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_VTight")
318  tauIDSources.byVVTightIsolationMVArun2DBoldDMdR0p3wLT = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVA, "_VVTight")
319 
320  # rerun the seq to obtain the 2017 nom training with 0.5 iso cone, old DM, ptph>1, trained on 2017MCv1
321  if "2017v1" in self.toKeep:
322  self.tauIdDiscrMVA_2017_version = "v1"
323  self.tauIdDiscrMVA_trainings_run2_2017 = {
324  'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
325  }
326  self.tauIdDiscrMVA_WPs_run2_2017 = {
327  'tauIdMVAIsoDBoldDMwLT2017' : {
328  'Eff95' : "DBoldDMwLTEff95",
329  'Eff90' : "DBoldDMwLTEff90",
330  'Eff80' : "DBoldDMwLTEff80",
331  'Eff70' : "DBoldDMwLTEff70",
332  'Eff60' : "DBoldDMwLTEff60",
333  'Eff50' : "DBoldDMwLTEff50",
334  'Eff40' : "DBoldDMwLTEff40"
335  }
336  }
337  # update the list of available in DB samples
338  if self.debug: print ("runTauID: Will update the list of available in DB samples to access 2017v1")
339  self.loadMVA_WPs_run2_2017()
340 
341  _byIsolationOldDMMVArun2017v1raw = "rerunDiscriminationByIsolationOldDMMVArun2017v1raw"+self.postfix
342  setattr(self.process,_byIsolationOldDMMVArun2017v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
343  PATTauProducer = self.originalTauName,
344  Prediscriminants = noPrediscriminants,
345  loadMVAfromDB = cms.bool(True),
346  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"),
347  mvaOpt = cms.string("DBoldDMwLTwGJ"),
348  verbosity = cms.int32(0)
349  ))
350 
351  _byIsolationOldDMMVArun2017v1 = "rerunDiscriminationByIsolationOldDMMVArun2017v1"+self.postfix
352  setattr(self.process,_byIsolationOldDMMVArun2017v1,patDiscriminationByIsolationMVArun2v1.clone(
353  PATTauProducer = self.originalTauName,
354  Prediscriminants = noPrediscriminants,
355  toMultiplex = _byIsolationOldDMMVArun2017v1raw,
356  loadMVAfromDB = cms.bool(True),
357  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
358  mapping = cms.VPSet(
359  cms.PSet(
360  category = cms.uint32(0),
361  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), #writeTauIdDiscrWPs
362  variable = cms.string("pt"),
363  )
364  ),
365  workingPoints = cms.vstring(
366  "_WPEff95",
367  "_WPEff90",
368  "_WPEff80",
369  "_WPEff70",
370  "_WPEff60",
371  "_WPEff50",
372  "_WPEff40"
373  )
374  ))
375 
376  _rerunIsolationOldDMMVArun2017v1Task = cms.Task(
377  getattr(self.process,_byIsolationOldDMMVArun2017v1raw),
378  getattr(self.process,_byIsolationOldDMMVArun2017v1)
379  )
380  _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2017v1Task)
381  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2017v1Task)
382 
383  tauIDSources.byIsolationMVArun2017v1DBoldDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "raw")
384  tauIDSources.byVVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff95")
385  tauIDSources.byVLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff90")
386  tauIDSources.byLooseIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff80")
387  tauIDSources.byMediumIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff70")
388  tauIDSources.byTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff60")
389  tauIDSources.byVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff50")
390  tauIDSources.byVVTightIsolationMVArun2017v1DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v1, "_WPEff40")
391 
392  if "2017v2" in self.toKeep:
393  self.tauIdDiscrMVA_2017_version = "v2"
394  self.tauIdDiscrMVA_trainings_run2_2017 = {
395  'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017",
396  }
397  self.tauIdDiscrMVA_WPs_run2_2017 = {
398  'tauIdMVAIsoDBoldDMwLT2017' : {
399  'Eff95' : "DBoldDMwLTEff95",
400  'Eff90' : "DBoldDMwLTEff90",
401  'Eff80' : "DBoldDMwLTEff80",
402  'Eff70' : "DBoldDMwLTEff70",
403  'Eff60' : "DBoldDMwLTEff60",
404  'Eff50' : "DBoldDMwLTEff50",
405  'Eff40' : "DBoldDMwLTEff40"
406  }
407  }
408 
409  if self.debug: print ("runTauID: Will update the list of available in DB samples to access 2017v2")
410  self.loadMVA_WPs_run2_2017()
411 
412  _byIsolationOldDMMVArun2017v2raw = "rerunDiscriminationByIsolationOldDMMVArun2017v2raw"+self.postfix
413  setattr(self.process,_byIsolationOldDMMVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
414  PATTauProducer = self.originalTauName,
415  Prediscriminants = noPrediscriminants,
416  loadMVAfromDB = cms.bool(True),
417  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"),
418  mvaOpt = cms.string("DBoldDMwLTwGJ"),
419  verbosity = cms.int32(0)
420  ))
421 
422  _byIsolationOldDMMVArun2017v2 = "rerunDiscriminationByIsolationOldDMMVArun2017v2"+self.postfix
423  setattr(self.process,_byIsolationOldDMMVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
424  PATTauProducer = self.originalTauName,
425  Prediscriminants = noPrediscriminants,
426  toMultiplex = _byIsolationOldDMMVArun2017v2raw,
427  loadMVAfromDB = cms.bool(True),
428  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
429  mapping = cms.VPSet(
430  cms.PSet(
431  category = cms.uint32(0),
432  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"), #writeTauIdDiscrWPs
433  variable = cms.string("pt"),
434  )
435  ),
436  workingPoints = cms.vstring(
437  "_WPEff95",
438  "_WPEff90",
439  "_WPEff80",
440  "_WPEff70",
441  "_WPEff60",
442  "_WPEff50",
443  "_WPEff40"
444  ),
445  verbosity = cms.int32(0)
446  ))
447 
448  _rerunIsolationOldDMMVArun2017v2Task = cms.Task(
449  getattr(self.process,_byIsolationOldDMMVArun2017v2raw),
450  getattr(self.process,_byIsolationOldDMMVArun2017v2)
451  )
452  _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2017v2Task)
453  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2017v2Task)
454 
455  tauIDSources.byIsolationMVArun2017v2DBoldDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "raw")
456  tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff95")
457  tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff90")
458  tauIDSources.byLooseIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff80")
459  tauIDSources.byMediumIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff70")
460  tauIDSources.byTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff60")
461  tauIDSources.byVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff50")
462  tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMwLT2017 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2017v2, "_WPEff40")
463 
464  if "newDM2017v2" in self.toKeep:
465  self.tauIdDiscrMVA_2017_version = "v2"
466  self.tauIdDiscrMVA_trainings_run2_2017 = {
467  'tauIdMVAIsoDBnewDMwLT2017' : "tauIdMVAIsoDBnewDMwLT2017",
468  }
469  self.tauIdDiscrMVA_WPs_run2_2017 = {
470  'tauIdMVAIsoDBnewDMwLT2017' : {
471  'Eff95' : "DBnewDMwLTEff95",
472  'Eff90' : "DBnewDMwLTEff90",
473  'Eff80' : "DBnewDMwLTEff80",
474  'Eff70' : "DBnewDMwLTEff70",
475  'Eff60' : "DBnewDMwLTEff60",
476  'Eff50' : "DBnewDMwLTEff50",
477  'Eff40' : "DBnewDMwLTEff40"
478  }
479  }
480 
481  if self.debug: print ("runTauID: Will update the list of available in DB samples to access newDM2017v2")
482  self.loadMVA_WPs_run2_2017()
483 
484  _byIsolationNewDMMVArun2017v2raw = "rerunDiscriminationByIsolationNewDMMVArun2017v2raw"+self.postfix
485  setattr(self.process,_byIsolationNewDMMVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
486  PATTauProducer = self.originalTauName,
487  Prediscriminants = noPrediscriminants,
488  loadMVAfromDB = cms.bool(True),
489  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"),
490  mvaOpt = cms.string("DBnewDMwLTwGJ"),
491  verbosity = cms.int32(0)
492  ))
493 
494  _byIsolationNewDMMVArun2017v2 = "rerunDiscriminationByIsolationNewDMMVArun2017v2"+self.postfix
495  setattr(self.process,_byIsolationNewDMMVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
496  PATTauProducer = self.originalTauName,
497  Prediscriminants = noPrediscriminants,
498  toMultiplex = _byIsolationNewDMMVArun2017v2raw,
499  loadMVAfromDB = cms.bool(True),
500  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
501  mapping = cms.VPSet(
502  cms.PSet(
503  category = cms.uint32(0),
504  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"), #writeTauIdDiscrWPs
505  variable = cms.string("pt"),
506  )
507  ),
508  workingPoints = cms.vstring(
509  "_WPEff95",
510  "_WPEff90",
511  "_WPEff80",
512  "_WPEff70",
513  "_WPEff60",
514  "_WPEff50",
515  "_WPEff40"
516  ),
517  verbosity = cms.int32(0)
518  ))
519 
520  _rerunIsolationNewDMMVArun2017v2Task = cms.Task(
521  getattr(self.process,_byIsolationNewDMMVArun2017v2raw),
522  getattr(self.process,_byIsolationNewDMMVArun2017v2)
523  )
524  _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVArun2017v2Task)
525  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVArun2017v2Task)
526 
527  tauIDSources.byIsolationMVArun2017v2DBnewDMwLTraw2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "raw")
528  tauIDSources.byVVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff95")
529  tauIDSources.byVLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff90")
530  tauIDSources.byLooseIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff80")
531  tauIDSources.byMediumIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff70")
532  tauIDSources.byTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff60")
533  tauIDSources.byVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff50")
534  tauIDSources.byVVTightIsolationMVArun2017v2DBnewDMwLT2017 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2017v2, "_WPEff40")
535 
536  if "dR0p32017v2" in self.toKeep:
537  self.tauIdDiscrMVA_2017_version = "v2"
538  self.tauIdDiscrMVA_trainings_run2_2017 = {
539  'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "tauIdMVAIsoDBoldDMdR0p3wLT2017",
540  }
541  self.tauIdDiscrMVA_WPs_run2_2017 = {
542  'tauIdMVAIsoDBoldDMdR0p3wLT2017' : {
543  'Eff95' : "DBoldDMdR0p3wLTEff95",
544  'Eff90' : "DBoldDMdR0p3wLTEff90",
545  'Eff80' : "DBoldDMdR0p3wLTEff80",
546  'Eff70' : "DBoldDMdR0p3wLTEff70",
547  'Eff60' : "DBoldDMdR0p3wLTEff60",
548  'Eff50' : "DBoldDMdR0p3wLTEff50",
549  'Eff40' : "DBoldDMdR0p3wLTEff40"
550  }
551  }
552 
553  if self.debug: print ("runTauID: Will update the list of available in DB samples to access dR0p32017v2")
554  self.loadMVA_WPs_run2_2017()
555 
556  _byIsolationOldDMdR0p3MVArun2017v2raw = "rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2raw"+self.postfix
557  setattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
558  PATTauProducer = self.originalTauName,
559  Prediscriminants = noPrediscriminants,
560  loadMVAfromDB = cms.bool(True),
561  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"),
562  mvaOpt = cms.string("DBoldDMwLTwGJ"),
563  srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'),
564  srcFootprintCorrection = cms.string('footprintCorrectiondR03'),
565  srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'),
566  srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03'),
567  verbosity = cms.int32(0)
568  ))
569 
570  _byIsolationOldDMdR0p3MVArun2017v2 = "rerunDiscriminationByIsolationOldDMdR0p3MVArun2017v2"+self.postfix
571  setattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2,patDiscriminationByIsolationMVArun2v1.clone(
572  PATTauProducer = self.originalTauName,
573  Prediscriminants = noPrediscriminants,
574  toMultiplex = _byIsolationOldDMdR0p3MVArun2017v2raw,
575  loadMVAfromDB = cms.bool(True),
576  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
577  mapping = cms.VPSet(
578  cms.PSet(
579  category = cms.uint32(0),
580  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"), #writeTauIdDiscrWPs
581  variable = cms.string("pt"),
582  )
583  ),
584  workingPoints = cms.vstring(
585  "_WPEff95",
586  "_WPEff90",
587  "_WPEff80",
588  "_WPEff70",
589  "_WPEff60",
590  "_WPEff50",
591  "_WPEff40"
592  ),
593  verbosity = cms.int32(0)
594  ))
595 
596  _rerunIsolationOldDMdR0p3MVArun2017v2Task = cms.Task(
597  getattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2raw),
598  getattr(self.process,_byIsolationOldDMdR0p3MVArun2017v2)
599  )
600  _rerunMvaIsolationTask.add(_rerunIsolationOldDMdR0p3MVArun2017v2Task)
601  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMdR0p3MVArun2017v2Task)
602 
603  tauIDSources.byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "raw")
604  tauIDSources.byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff95")
605  tauIDSources.byVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff90")
606  tauIDSources.byLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff80")
607  tauIDSources.byMediumIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff70")
608  tauIDSources.byTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff60")
609  tauIDSources.byVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff50")
610  tauIDSources.byVVTightIsolationMVArun2017v2DBoldDMdR0p3wLT2017 = self.tauIDMVAinputs(_byIsolationOldDMdR0p3MVArun2017v2, "_WPEff40")
611 
612  # 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
613  # self.process.rerunDiscriminationByIsolationOldDMMVArun2v2raw = patDiscriminationByIsolationMVArun2v1raw.clone(
614  # PATTauProducer = self.originalTauName,
615  # Prediscriminants = noPrediscriminants,
616  # loadMVAfromDB = cms.bool(True),
617  # mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2"),
618  # mvaOpt = cms.string("DBoldDMwLTwGJ"),
619  # verbosity = cms.int32(0)
620  # )
621  # #
622  # self.process.rerunDiscriminationByIsolationOldDMMVArun2v2VLoose = patDiscriminationByIsolationMVArun2v1VLoose.clone(
623  # PATTauProducer = self.originalTauName,
624  # Prediscriminants = noPrediscriminants,
625  # toMultiplex = 'rerunDiscriminationByIsolationOldDMMVArun2v2raw',
626  # key = cms.InputTag('rerunDiscriminationByIsolationOldDMMVArun2v2raw:category'),#?
627  # loadMVAfromDB = cms.bool(True),
628  # mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2_mvaOutput_normalization"), #writeTauIdDiscrMVAoutputNormalizations
629  # mapping = cms.VPSet(
630  # cms.PSet(
631  # category = cms.uint32(0),
632  # cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v2_WPEff90"), #writeTauIdDiscrWPs
633  # variable = cms.string("pt"),
634  # )
635  # )
636  # )
637 
638  # 2016 training strategy(v1), trained on 2016MC, old DM
639  if "2016v1" in self.toKeep:
640  _byIsolationOldDMMVArun2016v1raw = "rerunDiscriminationByIsolationOldDMMVArun2v1raw"+self.postfix
641  setattr(self.process,_byIsolationOldDMMVArun2016v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
642  PATTauProducer = self.originalTauName,
643  Prediscriminants = noPrediscriminants,
644  loadMVAfromDB = cms.bool(True),
645  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
646  mvaOpt = cms.string("DBoldDMwLT"),
647  verbosity = cms.int32(0)
648  ))
649 
650  _byIsolationOldDMMVArun2016v1 = "rerunDiscriminationByIsolationOldDMMVArun2v1"+self.postfix
651  setattr(self.process,_byIsolationOldDMMVArun2016v1,patDiscriminationByIsolationMVArun2v1.clone(
652  PATTauProducer = self.originalTauName,
653  Prediscriminants = noPrediscriminants,
654  toMultiplex = _byIsolationOldDMMVArun2016v1raw,
655  loadMVAfromDB = cms.bool(True),
656  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1_mvaOutput_normalization"),
657  mapping = cms.VPSet(
658  cms.PSet(
659  category = cms.uint32(0),
660  cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2016v1"),
661  variable = cms.string("pt"),
662  )
663  ),
664  workingPoints = cms.vstring(
665  "_WPEff90",
666  "_WPEff80",
667  "_WPEff70",
668  "_WPEff60",
669  "_WPEff50",
670  "_WPEff40"
671  )
672  ))
673 
674  self.tauIdDiscrMVA_2017_version = "v1"
675  self.tauIdDiscrMVA_trainings_run2_2017 = {
676  'tauIdMVAIsoDBoldDMwLT2016' : "tauIdMVAIsoDBoldDMwLT2016",
677  }
678  self.tauIdDiscrMVA_WPs_run2_2017 = {
679  'tauIdMVAIsoDBoldDMwLT2016' : {
680  'Eff90' : "DBoldDMwLT2016Eff90",
681  'Eff80' : "DBoldDMwLT2016Eff80",
682  'Eff70' : "DBoldDMwLT2016Eff70",
683  'Eff60' : "DBoldDMwLT2016Eff60",
684  'Eff50' : "DBoldDMwLT2016Eff50",
685  'Eff40' : "DBoldDMwLT2016Eff40"
686  }
687  }
688  if self.debug: print ("runTauID: Will update the list of available in DB samples to access 2016v1")
689  self.loadMVA_WPs_run2_2017()
690 
691  _rerunIsolationOldDMMVArun2016v1Task = cms.Task(
692  getattr(self.process,_byIsolationOldDMMVArun2016v1raw),
693  getattr(self.process,_byIsolationOldDMMVArun2016v1)
694  )
695  _rerunMvaIsolationTask.add(_rerunIsolationOldDMMVArun2016v1Task)
696  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationOldDMMVArun2016v1Task)
697 
698  tauIDSources.byIsolationMVArun2v1DBoldDMwLTraw2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "raw")
699  tauIDSources.byVLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "_WPEff90")
700  tauIDSources.byLooseIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "_WPEff80")
701  tauIDSources.byMediumIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "_WPEff70")
702  tauIDSources.byTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "_WPEff60")
703  tauIDSources.byVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "_WPEff50")
704  tauIDSources.byVVTightIsolationMVArun2v1DBoldDMwLT2016 = self.tauIDMVAinputs(_byIsolationOldDMMVArun2016v1, "_WPEff40")
705 
706  # 2016 training strategy(v1), trained on 2016MC, new DM
707  if "newDM2016v1" in self.toKeep:
708  _byIsolationNewDMMVArun2016v1raw = "rerunDiscriminationByIsolationNewDMMVArun2v1raw"+self.postfix
709  setattr(self.process,_byIsolationNewDMMVArun2016v1raw,patDiscriminationByIsolationMVArun2v1raw.clone(
710  PATTauProducer = self.originalTauName,
711  Prediscriminants = noPrediscriminants,
712  loadMVAfromDB = cms.bool(True),
713  mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
714  mvaOpt = cms.string("DBnewDMwLT"),
715  verbosity = cms.int32(0)
716  ))
717 
718  _byIsolationNewDMMVArun2016v1 = "rerunDiscriminationByIsolationNewDMMVArun2v1"+self.postfix
719  setattr(self.process,_byIsolationNewDMMVArun2016v1,patDiscriminationByIsolationMVArun2v1.clone(
720  PATTauProducer = self.originalTauName,
721  Prediscriminants = noPrediscriminants,
722  toMultiplex = _byIsolationNewDMMVArun2016v1raw,
723  loadMVAfromDB = cms.bool(True),
724  mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1_mvaOutput_normalization"),
725  mapping = cms.VPSet(
726  cms.PSet(
727  category = cms.uint32(0),
728  cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2016v1"),
729  variable = cms.string("pt"),
730  )
731  ),
732  workingPoints = cms.vstring(
733  "_WPEff90",
734  "_WPEff80",
735  "_WPEff70",
736  "_WPEff60",
737  "_WPEff50",
738  "_WPEff40"
739  )
740  ))
741 
742  self.tauIdDiscrMVA_2017_version = "v1"
743  self.tauIdDiscrMVA_trainings_run2_2017 = {
744  'tauIdMVAIsoDBnewDMwLT2016' : "tauIdMVAIsoDBnewDMwLT2016",
745  }
746  self.tauIdDiscrMVA_WPs_run2_2017 = {
747  'tauIdMVAIsoDBnewDMwLT2016' : {
748  'Eff90' : "DBnewDMwLT2016Eff90",
749  'Eff80' : "DBnewDMwLT2016Eff80",
750  'Eff70' : "DBnewDMwLT2016Eff70",
751  'Eff60' : "DBnewDMwLT2016Eff60",
752  'Eff50' : "DBnewDMwLT2016Eff50",
753  'Eff40' : "DBnewDMwLT2016Eff40"
754  }
755  }
756  if self.debug: print ("runTauID: Will update the list of available in DB samples to access newDM2016v1")
757  self.loadMVA_WPs_run2_2017()
758 
759  _rerunIsolationNewDMMVArun2016v1Task = cms.Task(
760  getattr(self.process,_byIsolationNewDMMVArun2016v1raw),
761  getattr(self.process,_byIsolationNewDMMVArun2016v1)
762  )
763  _rerunMvaIsolationTask.add(_rerunIsolationNewDMMVArun2016v1Task)
764  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationNewDMMVArun2016v1Task)
765 
766  tauIDSources.byIsolationMVArun2v1DBnewDMwLTraw2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "raw")
767  tauIDSources.byVLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff90")
768  tauIDSources.byLooseIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff80")
769  tauIDSources.byMediumIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff70")
770  tauIDSources.byTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff60")
771  tauIDSources.byVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff50")
772  tauIDSources.byVVTightIsolationMVArun2v1DBnewDMwLT2016 = self.tauIDMVAinputs(_byIsolationNewDMMVArun2016v1, "_WPEff40")
773 
774  if "deepTau2017v2" in self.toKeep:
775  if self.debug: print ("Adding DeepTau v2 IDs")
776 
777  _deepTauName = "deepTau2017v2"
778  workingPoints_ = WORKING_POINTS_v2p1
779 
780  file_names = [
781  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
782  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
783  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
784  ]
785  full_version = self.getDeepTauVersion(file_names[0])
786  setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
787  Prediscriminants = noPrediscriminants,
788  taus = self.originalTauName,
789  graph_file = file_names,
790  year = full_version[0],
791  version = full_version[1],
792  sub_version = 1 #MB: subversion cannot be properly deduced from file names; it should be 1 also for v2
793  ))
794 
795  _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
796 
797  from Configuration.ProcessModifiers.deepTauSonicTriton_cff import deepTauSonicTriton
798  deepTauSonicTriton.toReplaceWith(_deepTauProducer, DeepTauIdSonicProducer.clone(
799  Client = cms.PSet(
800  mode = cms.string('PseudoAsync'),
801  allowedTries = cms.untracked.uint32(0),
802  verbose = cms.untracked.bool(False),
803  modelName = cms.string("deeptau_2017v2p1"),
804  modelVersion = cms.string(''),
805  modelConfigPath = cms.FileInPath("RecoTauTag/TrainingFiles/data/DeepTauIdSONIC/deeptau_2017v2p1/config.pbtxt"),
806  preferredServer = cms.untracked.string(''),
807  timeout = cms.untracked.uint32(300),
808  useSharedMemory = cms.untracked.bool(True),
809  compression = cms.untracked.string(''),
810  outputs = cms.untracked.vstring()
811  ),
812  Prediscriminants = noPrediscriminants,
813  taus = self.originalTauName,
814  year = full_version[0],
815  version = full_version[1],
816  sub_version = 1, #MB: subversion cannot be properly deduced from file names
817  ))
818 
819  self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
820 
821  _rerunMvaIsolationTask.add(_deepTauProducer)
822  _rerunMvaIsolationSequence += _deepTauProducer
823 
824 
825  if "deepTau2017v2p1" in self.toKeep:
826  if self.debug: print ("Adding DeepTau v2p1 IDs")
827 
828  _deepTauName = "deepTau2017v2p1"
829  workingPoints_ = WORKING_POINTS_v2p1
830 
831  file_names = [
832  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
833  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
834  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
835  ]
836  full_version = self.getDeepTauVersion(file_names[0])
837  setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
838  Prediscriminants = noPrediscriminants,
839  taus = self.originalTauName,
840  graph_file = file_names,
841  year = full_version[0],
842  version = full_version[1],
843  sub_version = 1, #MB: subversion cannot be properly deduced from file names
844  disable_dxy_pca = True
845  ))
846 
847  _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
848 
849  from Configuration.ProcessModifiers.deepTauSonicTriton_cff import deepTauSonicTriton
850  deepTauSonicTriton.toReplaceWith(_deepTauProducer, DeepTauIdSonicProducer.clone(
851  Client = cms.PSet(
852  mode = cms.string('PseudoAsync'),
853  allowedTries = cms.untracked.uint32(0),
854  verbose = cms.untracked.bool(False),
855  modelName = cms.string("deeptau_2017v2p1"),
856  modelVersion = cms.string(''),
857  modelConfigPath = cms.FileInPath("RecoTauTag/TrainingFiles/data/DeepTauIdSONIC/deeptau_2017v2p1/config.pbtxt"),
858  preferredServer = cms.untracked.string(''),
859  timeout = cms.untracked.uint32(300),
860  useSharedMemory = cms.untracked.bool(True),
861  compression = cms.untracked.string(''),
862  outputs = cms.untracked.vstring()
863  ),
864  Prediscriminants = noPrediscriminants,
865  taus = self.originalTauName,
866  year = full_version[0],
867  version = full_version[1],
868  sub_version = 1, #MB: subversion cannot be properly deduced from file names
869  disable_dxy_pca = True
870  ))
871 
872  self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
873 
874  _rerunMvaIsolationTask.add(_deepTauProducer)
875  _rerunMvaIsolationSequence += _deepTauProducer
876 
877  if "deepTau2018v2p5" in self.toKeep:
878  if self.debug: print ("Adding DeepTau v2p5 IDs")
879 
880  _deepTauName = "deepTau2018v2p5"
881  workingPoints_ = WORKING_POINTS_v2p5
882 
883  file_names = [
884  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_core.pb',
885  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_inner.pb',
886  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2018v2p5_outer.pb',
887  ]
888  full_version = self.getDeepTauVersion(file_names[0])
889  setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
890  Prediscriminants = noPrediscriminants,
891  taus = self.originalTauName,
892  graph_file = file_names,
893  year = full_version[0],
894  version = full_version[1],
895  sub_version = full_version[2],
896  disable_dxy_pca = True,
897  disable_hcalFraction_workaround = True,
898  disable_CellIndex_workaround = True
899  ))
900 
901  _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
902 
903  from Configuration.ProcessModifiers.deepTauSonicTriton_cff import deepTauSonicTriton
904  deepTauSonicTriton.toReplaceWith(_deepTauProducer, DeepTauIdSonicProducer.clone(
905  Client = cms.PSet(
906  mode = cms.string('PseudoAsync'),
907  allowedTries = cms.untracked.uint32(0),
908  verbose = cms.untracked.bool(False),
909  modelName = cms.string("deeptau_2018v2p5"),
910  modelVersion = cms.string(''),
911  modelConfigPath = cms.FileInPath("RecoTauTag/TrainingFiles/data/DeepTauIdSONIC/deeptau_2018v2p5/config.pbtxt"),
912  preferredServer = cms.untracked.string(''),
913  timeout = cms.untracked.uint32(300),
914  useSharedMemory = cms.untracked.bool(True),
915  compression = cms.untracked.string(''),
916  outputs = cms.untracked.vstring(),
917  ),
918  Prediscriminants = noPrediscriminants,
919  taus = self.originalTauName,
920  year = full_version[0],
921  version = full_version[1],
922  sub_version = full_version[2],
923  disable_dxy_pca = True,
924  disable_hcalFraction_workaround = True,
925  disable_CellIndex_workaround = True
926  ))
927 
928  self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
929 
930  _rerunMvaIsolationTask.add(_deepTauProducer)
931  _rerunMvaIsolationSequence += _deepTauProducer
932 
933  if "deepTau2026v2p5" in self.toKeep:
934  if self.debug: print ("Adding Phase2 DeepTau v2p5 IDs")
935 
936  _deepTauName = "deepTau2026v2p5"
937  workingPoints_ = WORKING_POINTS_PHASEII_v2p5
938 
939  file_names = [
940  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_core.pb',
941  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_inner.pb',
942  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2026v2p5_outer.pb',
943  ]
944  full_version = self.getDeepTauVersion(file_names[0])
945  setattr(self.process,_deepTauName+self.postfix,DeepTau.clone(
946  Prediscriminants = noPrediscriminants,
947  taus = self.originalTauName,
948  graph_file = file_names,
949  year = full_version[0],
950  version = full_version[1],
951  sub_version = full_version[2],
952  disable_dxy_pca = True,
953  disable_hcalFraction_workaround = True,
954  disable_CellIndex_workaround = True
955  ))
956 
957  from RecoTauTag.RecoTau.mergedPhase2SlimmedElectronsForTauId_cff import mergedSlimmedElectronsForTauId
958  if not hasattr(self.process,"mergedSlimmedElectronsForTauId"):
959  self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
960  setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("mergedSlimmedElectronsForTauId"))
961  setattr(getattr(self.process, _deepTauName+self.postfix), "vertices", cms.InputTag("offlineSlimmedPrimaryVertices4D"))
962 
963  self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)
964 
965  _deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
966  _rerunMvaIsolationTask.add(self.process.mergedSlimmedElectronsForTauId)
967  _rerunMvaIsolationTask.add(_deepTauProducer)
968  _rerunMvaIsolationSequence += self.process.mergedSlimmedElectronsForTauId
969  _rerunMvaIsolationSequence += _deepTauProducer
970 
971  if "againstEle2018" in self.toKeep:
972  self.antiElectronDiscrMVA6_version = "v3_noeveto"
973  self.antiElectronDiscrMVA6_WPs = [ "eff98", "eff90", "eff80", "eff70", "eff60" ]
974 
976  from RecoTauTag.RecoTau.patTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6
977  _byElectronRejectionMVA62018Raw = "patTauDiscriminationByElectronRejectionMVA62018Raw"+self.postfix
978  setattr(self.process,_byElectronRejectionMVA62018Raw,patTauDiscriminationAgainstElectronMVA6.clone(
979  PATTauProducer = self.originalTauName,
980  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
981  srcElectrons = cms.InputTag('slimmedElectrons'),
982  vetoEcalCracks = cms.bool(False), #keep taus in EB-EE cracks
983  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL',
984  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC',
985  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL',
986  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC',
987  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL',
988  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC',
989  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL',
990  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC'
991  ))
992 
993  from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import patTauDiscriminantCutMultiplexer
994  _byElectronRejectionMVA62018 = "patTauDiscriminationByElectronRejectionMVA62018"+self.postfix
995  setattr(self.process,"patTauDiscriminationByElectronRejectionMVA62018"+self.postfix,patTauDiscriminantCutMultiplexer.clone(
996  PATTauProducer = self.originalTauName,
997  Prediscriminants = noPrediscriminants,
998  toMultiplex = _byElectronRejectionMVA62018Raw,
999  mapping = cms.VPSet(
1000  cms.PSet(
1001  category = cms.uint32(0),
1002  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_BL'),
1003  variable = cms.string('pt')
1004  ),
1005  cms.PSet(
1006  category = cms.uint32(2),
1007  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_BL'),
1008  variable = cms.string('pt')
1009  ),
1010  cms.PSet(
1011  category = cms.uint32(5),
1012  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_woGwGSF_BL'),
1013  variable = cms.string('pt')
1014  ),
1015  cms.PSet(
1016  category = cms.uint32(7),
1017  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_wGwGSF_BL'),
1018  variable = cms.string('pt')
1019  ),
1020  cms.PSet(
1021  category = cms.uint32(8),
1022  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_woGwoGSF_EC'),
1023  variable = cms.string('pt')
1024  ),
1025  cms.PSet(
1026  category = cms.uint32(10),
1027  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_NoEleMatch_wGwoGSF_EC'),
1028  variable = cms.string('pt')
1029  ),
1030  cms.PSet(
1031  category = cms.uint32(13),
1032  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_woGwGSF_EC'),
1033  variable = cms.string('pt')
1034  ),
1035  cms.PSet(
1036  category = cms.uint32(15),
1037  cut = cms.string('RecoTauTag_antiElectronMVA6'+self.antiElectronDiscrMVA6_version+'_gbr_wGwGSF_EC'),
1038  variable = cms.string('pt')
1039  )
1040  ),
1041  workingPoints = cms.vstring(
1042  "_WPeff98",
1043  "_WPeff90",
1044  "_WPeff80",
1045  "_WPeff70",
1046  "_WPeff60"
1047  )
1048  ))
1049 
1050  if self.debug: print ("runTauID: Will update the list of available in DB samples to access againstEle 2018")
1051  self.load_againstElectronMVA6()
1052 
1053 
1054  _patTauDiscriminationByElectronRejectionMVA62018Task = cms.Task(
1055  getattr(self.process,_byElectronRejectionMVA62018Raw),
1056  getattr(self.process,_byElectronRejectionMVA62018)
1057  )
1058  _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA62018Task)
1059  _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA62018Task)
1060 
1061  _againstElectronTauIDSources = cms.PSet(
1062  againstElectronMVA6Raw2018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "raw"),
1063  againstElectronMVA6category2018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "category"),
1064  againstElectronVLooseMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "_WPeff98"),
1065  againstElectronLooseMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "_WPeff90"),
1066  againstElectronMediumMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "_WPeff80"),
1067  againstElectronTightMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "_WPeff70"),
1068  againstElectronVTightMVA62018 = self.tauIDMVAinputs(_byElectronRejectionMVA62018, "_WPeff60")
1069  )
1070  _tauIDSourcesWithAgainistEle = cms.PSet(
1071  tauIDSources.clone(),
1072  _againstElectronTauIDSources
1073  )
1074  tauIDSources =_tauIDSourcesWithAgainistEle.clone()
1075 
1076  if "againstEle" in self.toKeep:
1077 
1079  from RecoTauTag.RecoTau.patTauDiscriminationAgainstElectronMVA6_cfi import patTauDiscriminationAgainstElectronMVA6
1080  _byElectronRejectionMVA6Raw = "patTauDiscriminationByElectronRejectionMVA6Raw"+self.postfix
1081  setattr(self.process,_byElectronRejectionMVA6Raw,patTauDiscriminationAgainstElectronMVA6.clone(
1082  PATTauProducer = self.originalTauName,
1083  Prediscriminants = noPrediscriminants, #already selected for MiniAOD
1084  srcElectrons = cms.InputTag('slimmedElectrons'),
1085  vetoEcalCracks = cms.bool(False), #keep taus in EB-EE cracks
1086  mvaName_NoEleMatch_wGwoGSF_BL = 'RecoTauTag_antiElectronMVA_NoEleMatch_wGwoGSF_BL',
1087  mvaName_NoEleMatch_wGwoGSF_EC = 'RecoTauTag_antiElectronMVA_NoEleMatch_wGwoGSF_EC',
1088  mvaName_NoEleMatch_woGwoGSF_BL = 'RecoTauTag_antiElectronMVA_NoEleMatch_woGwoGSF_BL',
1089  mvaName_NoEleMatch_woGwoGSF_EC = 'RecoTauTag_antiElectronMVA_NoEleMatch_woGwoGSF_EC',
1090  mvaName_wGwGSF_BL = 'RecoTauTag_antiElectronMVA_wGwGSF_BL',
1091  mvaName_wGwGSF_EC = 'RecoTauTag_antiElectronMVA_wGwGSF_EC',
1092  mvaName_woGwGSF_BL = 'RecoTauTag_antiElectronMVA_woGwGSF_BL',
1093  mvaName_woGwGSF_EC = 'RecoTauTag_antiElectronMVA_woGwGSF_EC'
1094  ))
1095 
1096  from RecoTauTag.RecoTau.PATTauDiscriminantCutMultiplexer_cfi import patTauDiscriminantCutMultiplexer
1097  _byElectronRejectionMVA6 = "patTauDiscriminationByElectronRejectionMVA6"+self.postfix
1098  setattr(self.process,"patTauDiscriminationByElectronRejectionMVA6"+self.postfix,patTauDiscriminantCutMultiplexer.clone(
1099  PATTauProducer = self.originalTauName,
1100  Prediscriminants = noPrediscriminants,
1101  toMultiplex = _byElectronRejectionMVA6Raw,
1102  mapping = cms.VPSet(
1103  cms.PSet(
1104  category = cms.uint32(0),
1105  cut = cms.string('RecoTauTag_antiElectronMVA_NoEleMatch_woGwoGSF_BL'),
1106  variable = cms.string('pt')
1107  ),
1108  cms.PSet(
1109  category = cms.uint32(2),
1110  cut = cms.string('RecoTauTag_antiElectronMVA_NoEleMatch_wGwoGSF_BL'),
1111  variable = cms.string('pt')
1112  ),
1113  cms.PSet(
1114  category = cms.uint32(5),
1115  cut = cms.string('RecoTauTag_antiElectronMVA_woGwGSF_BL'),
1116  variable = cms.string('pt')
1117  ),
1118  cms.PSet(
1119  category = cms.uint32(7),
1120  cut = cms.string('RecoTauTag_antiElectronMVA_wGwGSF_BL'),
1121  variable = cms.string('pt')
1122  ),
1123  cms.PSet(
1124  category = cms.uint32(8),
1125  cut = cms.string('RecoTauTag_antiElectronMVA_NoEleMatch_woGwoGSF_EC'),
1126  variable = cms.string('pt')
1127  ),
1128  cms.PSet(
1129  category = cms.uint32(10),
1130  cut = cms.string('RecoTauTag_antiElectronMVA_NoEleMatch_wGwoGSF_EC'),
1131  variable = cms.string('pt')
1132  ),
1133  cms.PSet(
1134  category = cms.uint32(13),
1135  cut = cms.string('RecoTauTag_antiElectronMVA_woGwGSF_EC'),
1136  variable = cms.string('pt')
1137  ),
1138  cms.PSet(
1139  category = cms.uint32(15),
1140  cut = cms.string('RecoTauTag_antiElectronMVA_wGwGSF_EC'),
1141  variable = cms.string('pt')
1142  )
1143  ),
1144  workingPoints = cms.vstring(
1145  "_VLoose",
1146  "_Loose",
1147  "_Medium",
1148  "_Tight",
1149  "_VTight"
1150  )
1151  ))
1152 
1153  _patTauDiscriminationByElectronRejectionMVA6Task = cms.Task(
1154  getattr(self.process,_byElectronRejectionMVA6Raw),
1155  getattr(self.process,_byElectronRejectionMVA6)
1156  )
1157  _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA6Task)
1158  _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA6Task)
1159 
1160  _againstElectronTauIDSources = cms.PSet(
1161  againstElectronMVA6Raw = self.tauIDMVAinputs(_byElectronRejectionMVA6, "raw"),
1162  againstElectronMVA6category = self.tauIDMVAinputs(_byElectronRejectionMVA6, "category"),
1163  againstElectronVLooseMVA6 = self.tauIDMVAinputs(_byElectronRejectionMVA6, "_VLoose"),
1164  againstElectronLooseMVA6 = self.tauIDMVAinputs(_byElectronRejectionMVA6, "_Loose"),
1165  againstElectronMediumMVA6 = self.tauIDMVAinputs(_byElectronRejectionMVA6, "_Medium"),
1166  againstElectronTightMVA6 = self.tauIDMVAinputs(_byElectronRejectionMVA6, "_Tight"),
1167  againstElectronVTightMVA6 = self.tauIDMVAinputs(_byElectronRejectionMVA6, "_VTight")
1168  )
1169  _tauIDSourcesWithAgainistEle = cms.PSet(
1170  tauIDSources.clone(),
1171  _againstElectronTauIDSources
1172  )
1173  tauIDSources =_tauIDSourcesWithAgainistEle.clone()
1174 
1175  if "newDMPhase2v1" in self.toKeep:
1176  if self.debug: print ("Adding newDMPhase2v1 ID")
1177  def tauIDMVAinputs(module, wp):
1178  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)))
1179  _byIsolationNewDMMVAPhase2raw = "rerunDiscriminationByIsolationMVADBnewDMwLTPhase2raw"+self.postfix
1180  setattr(self.process,_byIsolationNewDMMVAPhase2raw,patDiscriminationByIsolationMVArun2v1raw.clone(
1181  PATTauProducer = self.originalTauName,
1182  Prediscriminants = noPrediscriminants,
1183  loadMVAfromDB = True,
1184  mvaName = 'RecoTauTag_tauIdMVAIsoPhase2',
1185  mvaOpt = 'DBnewDMwLTwGJPhase2',
1186  verbosity = 0
1187  ))
1188 
1189  _byIsolationNewDMMVAPhase2 = "rerunDiscriminationByIsolationMVADBnewDMwLTPhase2"+self.postfix
1190  setattr(self.process,_byIsolationNewDMMVAPhase2,patDiscriminationByIsolationMVArun2v1.clone(
1191  PATTauProducer = self.originalTauName,
1192  Prediscriminants = noPrediscriminants,
1193  toMultiplex = _byIsolationNewDMMVAPhase2raw,
1194  loadMVAfromDB = True,
1195  mvaOutput_normalization = 'RecoTauTag_tauIdMVAIsoPhase2_mvaOutput_normalization',
1196  mapping = cms.VPSet(
1197  cms.PSet(
1198  category = cms.uint32(0),
1199  cut = cms.string("RecoTauTag_tauIdMVAIsoPhase2"),
1200  variable = cms.string("pt"),
1201  )
1202  ),
1203  workingPoints = cms.vstring(
1204  "_VVLoose",
1205  "_VLoose",
1206  "_Loose",
1207  "_Medium",
1208  "_Tight",
1209  "_VTight",
1210  "_VVTight"
1211  )
1212  ))
1213  _rerunIsolationMVADBnewDMwLTPhase2Task = cms.Task(
1214  getattr(self.process,_byIsolationNewDMMVAPhase2raw),
1215  getattr(self.process,_byIsolationNewDMMVAPhase2)
1216  )
1217  _rerunMvaIsolationTask.add(_rerunIsolationMVADBnewDMwLTPhase2Task)
1218  _rerunMvaIsolationSequence += cms.Sequence(_rerunIsolationMVADBnewDMwLTPhase2Task)
1219 
1220  tauIDSources.byIsolationMVADBnewDMwLTPhase2raw = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "raw")
1221  tauIDSources.byVVLooseIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_VVLoose")
1222  tauIDSources.byVLooseIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_VLoose")
1223  tauIDSources.byLooseIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_Loose")
1224  tauIDSources.byMediumIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_Medium")
1225  tauIDSources.byTightIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_Tight")
1226  tauIDSources.byVTightIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_VTight")
1227  tauIDSources.byVVTightIsolationMVADBnewDMwLTPhase2 = tauIDMVAinputs(_byIsolationNewDMMVAPhase2, "_VVTight")
1228 
1229  if "againstElePhase2v1" in self.toKeep:
1230  if self.debug: print ("Adding anti-e Phase2v1 ID")
1231 
1233  from RecoTauTag.RecoTau.PATTauDiscriminationAgainstElectronMVA6Phase2_cff import patTauDiscriminationAgainstElectronMVA6Phase2Raw, patTauDiscriminationAgainstElectronMVA6Phase2, mergedSlimmedElectronsForTauId
1234  _byElectronRejectionMVA6Phase2v1Raw = "patTauDiscriminationByElectronRejectionMVA6Phase2v1Raw"+self.postfix
1235  setattr(self.process,_byElectronRejectionMVA6Phase2v1Raw,patTauDiscriminationAgainstElectronMVA6Phase2Raw.clone(
1236  PATTauProducer = self.originalTauName,
1237  Prediscriminants = noPrediscriminants #already selected for MiniAOD
1238  ))
1239 
1240  _byElectronRejectionMVA6Phase2v1 = "patTauDiscriminationByElectronRejectionMVA6Phase2v1"+self.postfix
1241  setattr(self.process,_byElectronRejectionMVA6Phase2v1,patTauDiscriminationAgainstElectronMVA6Phase2.clone(
1242  PATTauProducer = self.originalTauName,
1243  Prediscriminants = noPrediscriminants,
1244  toMultiplex = _byElectronRejectionMVA6Phase2v1Raw
1245  ))
1246 
1247  if not hasattr(self.process,"mergedSlimmedElectronsForTauId"):
1248  self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
1249  _patTauDiscriminationByElectronRejectionMVA6Phase2v1Task = cms.Task(
1250  self.process.mergedSlimmedElectronsForTauId,
1251  getattr(self.process,_byElectronRejectionMVA6Phase2v1Raw),
1252  getattr(self.process,_byElectronRejectionMVA6Phase2v1)
1253  )
1254  _rerunMvaIsolationTask.add(_patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
1255  _rerunMvaIsolationSequence += cms.Sequence(_patTauDiscriminationByElectronRejectionMVA6Phase2v1Task)
1256 
1257  _againstElectronTauIDPhase2v1Sources = cms.PSet(
1258  againstElectronMVA6RawPhase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "raw"),
1259  againstElectronMVA6categoryPhase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "category"),
1260  againstElectronVLooseMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "_VLoose"),
1261  againstElectronLooseMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "_Loose"),
1262  againstElectronMediumMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "_Medium"),
1263  againstElectronTightMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "_Tight"),
1264  againstElectronVTightMVA6Phase2v1 = self.tauIDMVAinputs(_byElectronRejectionMVA6Phase2v1, "_VTight")
1265  )
1266  _tauIDSourcesWithAgainistElePhase2v1 = cms.PSet(
1267  tauIDSources.clone(),
1268  _againstElectronTauIDPhase2v1Sources
1269  )
1270  tauIDSources =_tauIDSourcesWithAgainistElePhase2v1.clone()
1271 
1272  if self.debug: print('Embedding new TauIDs into \"'+self.updatedTauName+'\"')
1273  if not hasattr(self.process, self.updatedTauName):
1274  embedID = cms.EDProducer("PATTauIDEmbedder",
1275  src = cms.InputTag(self.originalTauName),
1276  tauIDSources = tauIDSources
1277  )
1278  setattr(self.process, self.updatedTauName, embedID)
1279  else: #assume same type
1280  tauIDSources = cms.PSet(
1281  getattr(self.process, self.updatedTauName).tauIDSources,
1282  tauIDSources)
1283  getattr(self.process, self.updatedTauName).tauIDSources = tauIDSources
1284  if not hasattr(self.process,"rerunMvaIsolationTask"+self.postfix):
1285  setattr(self.process,"rerunMvaIsolationTask"+self.postfix,_rerunMvaIsolationTask)
1286  else:
1287  _updatedRerunMvaIsolationTask = getattr(self.process,"rerunMvaIsolationTask"+self.postfix)
1288  _updatedRerunMvaIsolationTask.add(_rerunMvaIsolationTask)
1289  setattr(self.process,"rerunMvaIsolationTask"+self.postfix,_updatedRerunMvaIsolationTask)
1290  if not hasattr(self.process,"rerunMvaIsolationSequence"+self.postfix):
1291  setattr(self.process,"rerunMvaIsolationSequence"+self.postfix,_rerunMvaIsolationSequence)
1292  else:
1293  _updatedRerunMvaIsolationSequence = getattr(self.process,"rerunMvaIsolationSequence"+self.postfix)
1294  _updatedRerunMvaIsolationSequence += _rerunMvaIsolationSequence
1295  setattr(self.process,"rerunMvaIsolationSequence"+self.postfix,_updatedRerunMvaIsolationSequence)
1296 
1297 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ tauIDMVAinputs()

◆ versionToInt()

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

Definition at line 75 of file runTauIdMVA.py.

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

Member Data Documentation

◆ antiElectronDiscrMVA6_version

runTauIdMVA.TauIDEmbedder.antiElectronDiscrMVA6_version

Definition at line 972 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.load_againstElectronMVA6().

◆ antiElectronDiscrMVA6_WPs

runTauIdMVA.TauIDEmbedder.antiElectronDiscrMVA6_WPs

Definition at line 973 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.load_againstElectronMVA6().

◆ availableDiscriminators

runTauIdMVA.TauIDEmbedder.availableDiscriminators
static

Definition at line 18 of file runTauIdMVA.py.

◆ debug

runTauIdMVA.TauIDEmbedder.debug

◆ experimentalDiscriminators

runTauIdMVA.TauIDEmbedder.experimentalDiscriminators
static

Definition at line 14 of file runTauIdMVA.py.

◆ originalTauName

runTauIdMVA.TauIDEmbedder.originalTauName

Definition at line 37 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

◆ postfix

runTauIdMVA.TauIDEmbedder.postfix

◆ process

◆ tauIdDiscrMVA_2017_version

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_2017_version

Definition at line 322 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017().

◆ tauIdDiscrMVA_trainings_run2_2017

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_trainings_run2_2017

Definition at line 323 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017().

◆ tauIdDiscrMVA_WPs_run2_2017

runTauIdMVA.TauIDEmbedder.tauIdDiscrMVA_WPs_run2_2017

Definition at line 326 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.loadMVA_WPs_run2_2017().

◆ toKeep

runTauIdMVA.TauIDEmbedder.toKeep

Definition at line 44 of file runTauIdMVA.py.

Referenced by runTauIdMVA.TauIDEmbedder.runTauID().

◆ updatedTauName

runTauIdMVA.TauIDEmbedder.updatedTauName

Definition at line 38 of file runTauIdMVA.py.