CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes
metUncertaintyTools.RunMEtUncertainties Class Reference
Inheritance diagram for metUncertaintyTools.RunMEtUncertainties:

Public Member Functions

def __call__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Member Functions

def _addCorrPFMEt
 
def _addModuleToSequence
 
def _addNoPileUpPFMEt
 
def _addPATMEtProducer
 
def _addPFCandidatesForPFMEtInput
 
def _addPFMEtByMVA
 
def _addShiftedParticleCollections
 
def _addSmearedJets
 
def _getLeptonsForPFMEtInput
 
def _initializeInputTag
 
def _propagateMEtUncertainties
 

Static Private Member Functions

def _isValidInputTag
 

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
 
string _label = 'runMEtUncertainties'
 

Detailed Description

Shift energy of electrons, photons, muons, tau-jets and other jets
reconstructed in the event up/down,
in order to estimate effect of energy scale uncertainties on MET

Definition at line 12 of file metUncertaintyTools.py.

Constructor & Destructor Documentation

def metUncertaintyTools.RunMEtUncertainties.__init__ (   self)

Definition at line 20 of file metUncertaintyTools.py.

References editorTools.UserCodeTool._comment, heavyIonTools.ConfigureHeavyIons._comment, HiCoreTools.RestrictInputToAOD._comment, coreTools.RunOnData._comment, trackTools.MakeAODTrackCandidates._comment, metTools.AddMETCollection._comment, heavyIonTools.ProductionDefaults._comment, editorTools.ChangeSource._comment, ConfigToolBase.ConfigToolBase._comment, HiCoreTools.RemoveMCMatching._comment, jetTools.AddJetCollection._comment, cmsswVersionTools.PickRelValInputFiles._comment, coreTools.RemoveMCMatching._comment, trackTools.MakePATTrackCandidates._comment, trigTools.SwitchOnTrigger._comment, heavyIonTools.SelectionDefaults._comment, HiCoreTools.RemoveAllPATObjectsBut._comment, heavyIonTools.DisbaleMonteCarloDeps._comment, HiCoreTools.RemoveSpecificPATObjects._comment, trigTools.SwitchOnTriggerStandAlone._comment, trackTools.MakeTrackCandidates._comment, tauTools.AddTauCollection._comment, trigTools.SwitchOnTriggerMatching._comment, HiCoreTools.RemoveCleaning._comment, HiCoreTools.AddCleaning._comment, trigTools.SwitchOnTriggerMatchingStandAlone._comment, trigTools.SwitchOnTriggerMatchEmbedding._comment, jetTools.SwitchJetCollection._comment, jetTools.AddJetID._comment, jetTools.SetTagInfos._comment, metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, metUncertaintyTools.RunMEtUncertainties._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, HiCoreTools.RestrictInputToAOD._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._parameters, metTools.AddMETCollection._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, HiCoreTools.RemoveMCMatching._parameters, TAbsFitParticle._parameters, jetTools.AddJetCollection._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, HiCoreTools.RemoveAllPATObjectsBut._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, HiCoreTools.RemoveSpecificPATObjects._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, HiCoreTools.RemoveCleaning._parameters, HiCoreTools.AddCleaning._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, trigTools.SwitchOnTriggerMatchEmbedding._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, jetTools.SetTagInfos._parameters, root::helper::RootFunctionAdapter< F, args >.addParameter(), root::helper::RootFunctionHelper< F, args, Tag >.addParameter(), ParameterMgr.addParameter(), fit::RootMinuit< Function >.addParameter(), DropBoxMetadata::Parameters.addParameter(), PythonParameterSet.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

20 
21  def __init__(self):
22  ConfigToolBase.__init__(self)
23  self.addParameter(self._defaultParameters, 'electronCollection', cms.InputTag('selectedPatElectrons'),
"Input electron collection", Type=cms.InputTag, acceptNoneValue=True)

Member Function Documentation

def metUncertaintyTools.RunMEtUncertainties.__call__ (   self,
  process,
  electronCollection = None,
  photonCollection = None,
  muonCollection = None,
  tauCollection = None,
  jetCollection = None,
  dRjetCleaning = None,
  jetCorrLabel = None,
  doSmearJets = None,
  makeType1corrPFMEt = None,
  makeType1p2corrPFMEt = None,
  makePFMEtByMVA = None,
  makeNoPileUpPFMEt = None,
  doApplyType0corr = None,
  sysShiftCorrParameter = None,
  doApplySysShiftCorr = None,
  jetSmearFileName = None,
  jetSmearHistogram = None,
  pfCandCollection = None,
  jetCorrPayloadName = None,
  varyByNsigmas = None,
  addToPatDefaultSequence = None,
  outputModule = None,
  postfix = None 
)

Definition at line 1391 of file metUncertaintyTools.py.

References metTools.AddMETCollection._defaultParameters, editorTools.UserCodeTool._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, metUncertaintyTools.RunMEtUncertainties._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, jetTools.SetTagInfos._defaultParameters, metUncertaintyTools.RunMEtUncertainties._initializeInputTag(), SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), MatrixReader.MatrixReader.apply, DummyOOTPileupCorrection.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), MatRepSparse< T, D1, D2, S, F >.apply(), ConfigToolBase.ConfigToolBase.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), reco::And< bool >.apply(), reco::Or< bool >.apply(), reco::Less< T >.apply(), reco::LessEqual< T >.apply(), reco::More< T >.apply(), reco::MoreEqual< T >.apply(), reco::Equal< T >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Accumulator >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Numeric, Len, Dim >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), ora::PoolMainTable.setParameter(), PedeReader.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt().

1392  postfix = None):
1393  electronCollection = self._initializeInputTag(electronCollection, 'electronCollection')
1394  photonCollection = self._initializeInputTag(photonCollection, 'photonCollection')
1395  muonCollection = self._initializeInputTag(muonCollection, 'muonCollection')
1396  tauCollection = self._initializeInputTag(tauCollection, 'tauCollection')
1397  jetCollection = self._initializeInputTag(jetCollection, 'jetCollection')
1398  if jetCorrLabel is None:
1399  jetCorrLabel = self._defaultParameters['jetCorrLabel'].value
1400  if dRjetCleaning is None:
1401  dRjetCleaning = self._defaultParameters['dRjetCleaning'].value
1402  if doSmearJets is None:
1403  doSmearJets = self._defaultParameters['doSmearJets'].value
1404  if makeType1corrPFMEt is None:
1405  makeType1corrPFMEt = self._defaultParameters['makeType1corrPFMEt'].value
1406  if makeType1p2corrPFMEt is None:
1407  makeType1p2corrPFMEt = self._defaultParameters['makeType1p2corrPFMEt'].value
1408  if makePFMEtByMVA is None:
1409  makePFMEtByMVA = self._defaultParameters['makePFMEtByMVA'].value
1410  if makeNoPileUpPFMEt is None:
1411  makeNoPileUpPFMEt = self._defaultParameters['makeNoPileUpPFMEt'].value
1412  if doApplyType0corr is None:
1413  doApplyType0corr = self._defaultParameters['doApplyType0corr'].value
1414  if sysShiftCorrParameter is None:
1415  sysShiftCorrParameter = self._defaultParameters['sysShiftCorrParameter'].value
1416  if doApplySysShiftCorr is None:
1417  doApplySysShiftCorr = self._defaultParameters['doApplySysShiftCorr'].value
1418  if sysShiftCorrParameter is None:
1419  if doApplySysShiftCorr:
1420  raise ValueError("MET sys. shift correction parameters must be specified explicitely !!")
1421  sysShiftCorrParameter = cms.PSet()
1422  if jetSmearFileName is None:
1423  jetSmearFileName = self._defaultParameters['jetSmearFileName'].value
1424  if jetSmearHistogram is None:
1425  jetSmearHistogram = self._defaultParameters['jetSmearHistogram'].value
1426  pfCandCollection = self._initializeInputTag(pfCandCollection, 'pfCandCollection')
1427  if jetCorrPayloadName is None:
1428  jetCorrPayloadName = self._defaultParameters['jetCorrPayloadName'].value
1429  if varyByNsigmas is None:
1430  varyByNsigmas = self._defaultParameters['varyByNsigmas'].value
1431  if addToPatDefaultSequence is None:
1432  addToPatDefaultSequence = self._defaultParameters['addToPatDefaultSequence'].value
1433  if outputModule is None:
1434  outputModule = self._defaultParameters['outputModule'].value
1435  if postfix is None:
1436  postfix = self._defaultParameters['postfix'].value
1437 
1438  self.setParameter('electronCollection', electronCollection)
1439  self.setParameter('photonCollection', photonCollection)
1440  self.setParameter('muonCollection', muonCollection)
1441  self.setParameter('tauCollection', tauCollection)
1442  self.setParameter('jetCollection', jetCollection)
1443  self.setParameter('jetCorrLabel', jetCorrLabel)
1444  self.setParameter('dRjetCleaning', dRjetCleaning)
1445  self.setParameter('doSmearJets', doSmearJets)
1446  self.setParameter('makeType1corrPFMEt', makeType1corrPFMEt)
1447  self.setParameter('makeType1p2corrPFMEt', makeType1p2corrPFMEt)
1448  self.setParameter('makePFMEtByMVA', makePFMEtByMVA)
1449  self.setParameter('makeNoPileUpPFMEt', makeNoPileUpPFMEt)
1450  self.setParameter('doApplyType0corr', doApplyType0corr)
1451  self.setParameter('doApplySysShiftCorr', doApplySysShiftCorr)
1452  self.setParameter('sysShiftCorrParameter', sysShiftCorrParameter)
1453  self.setParameter('jetSmearFileName', jetSmearFileName)
1454  self.setParameter('jetSmearHistogram', jetSmearHistogram)
1455  self.setParameter('pfCandCollection', pfCandCollection)
1456  self.setParameter('jetCorrPayloadName', jetCorrPayloadName)
1457  self.setParameter('varyByNsigmas', varyByNsigmas)
1458  self.setParameter('addToPatDefaultSequence', addToPatDefaultSequence)
1459  self.setParameter('outputModule', outputModule)
1460  self.setParameter('postfix', postfix)
1461 
1462  self.apply(process)
def metUncertaintyTools.RunMEtUncertainties._addCorrPFMEt (   self,
  process,
  metUncertaintySequence,
  shiftedParticleCollections,
  pfCandCollection,
  collectionsToKeep,
  doSmearJets,
  makeType1corrPFMEt,
  makeType1p2corrPFMEt,
  doApplyType0corr,
  sysShiftCorrParameter,
  doApplySysShiftCorr,
  jetCorrLabel,
  varyByNsigmas,
  postfix 
)
private

Definition at line 440 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addPFCandidatesForPFMEtInput(), metUncertaintyTools.RunMEtUncertainties._isValidInputTag(), metUncertaintyTools.RunMEtUncertainties._propagateMEtUncertainties(), clone(), diffTwoXMLs.label, python.rootplot.root2matplotlib.replace(), and relativeConstraints.value.

Referenced by metUncertaintyTools.RunMEtUncertainties._addShiftedParticleCollections(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

441  postfix):
442 
443  if not (makeType1corrPFMEt or makeType1p2corrPFMEt):
444  return
445 
446  if not hasattr(process, 'producePatPFMETCorrections'):
447  process.load("PhysicsTools.PatUtils.patPFMETCorrections_cff")
448 
449  # If with empty postfix, make a backup of
450  # process.producePatPFMETCorrections, because the original
451  # sequence will be modified later in this function
452  if postfix == "":
453  configtools.cloneProcessingSnippet(process, process.producePatPFMETCorrections, "OriginalReserved")
454  else:
455  if postfix == "OriginalReserved":
456  raise ValueError("Postfix label '%s' is reserved for internal usage !!" % postfix)
457 
458  if hasattr(process, "producePatPFMETCorrectionsOriginalReserved"):
459  configtools.cloneProcessingSnippet(process, process.producePatPFMETCorrectionsOriginalReserved, postfix, removePostfix="OriginalReserved")
460  else:
461  configtools.cloneProcessingSnippet(process, process.producePatPFMETCorrections, postfix)
462 
463  # add "nominal" (unshifted) pat::MET collections
464  getattr(process, "pfCandsNotInJet"+postfix).bottomCollection = pfCandCollection
465  getattr(process, "selectedPatJetsForMETtype1p2Corr"+postfix).src = shiftedParticleCollections['lastJetCollection']
466  getattr(process, "selectedPatJetsForMETtype2Corr"+postfix).src = shiftedParticleCollections['lastJetCollection']
467 
468 
469  if doApplySysShiftCorr:
470  if not hasattr(process, 'pfMEtSysShiftCorrSequence'):
471  process.load("JetMETCorrections.Type1MET.pfMETsysShiftCorrections_cfi")
472  if postfix != "":
473  configtools.cloneProcessingSnippet(process, process.pfMEtSysShiftCorrSequence, postfix)
474 
475  getattr(process, "pfMEtSysShiftCorr"+postfix).parameter = sysShiftCorrParameter
476  metUncertaintySequence += getattr(process, "pfMEtSysShiftCorrSequence"+postfix)
477 
478  metUncertaintySequence += getattr(process, "producePatPFMETCorrections"+postfix)
479 
480  patType1correctionsCentralValue = [ cms.InputTag('patPFJetMETtype1p2Corr'+postfix, 'type1') ]
481  if doApplyType0corr:
482  patType1correctionsCentralValue.extend([ cms.InputTag('patPFMETtype0Corr'+postfix) ])
483  if doApplySysShiftCorr:
484  patType1correctionsCentralValue.extend([ cms.InputTag('pfMEtSysShiftCorr'+postfix) ])
485  getattr(process, "patType1CorrectedPFMet"+postfix).srcType1Corrections = cms.VInputTag(patType1correctionsCentralValue)
486  getattr(process, "patType1p2CorrectedPFMet"+postfix).srcType1Corrections = cms.VInputTag(patType1correctionsCentralValue)
487 
488  collectionsToKeep.extend([
489  'patPFMet'+postfix,
490  'patType1CorrectedPFMet'+postfix,
491  'patType1p2CorrectedPFMet'+postfix])
492 
493  setattr(process, "selectedPatJetsForMETtype1p2CorrEnUp"+postfix,
494  getattr(process, shiftedParticleCollections['jetCollectionEnUpForCorrMEt']).clone(
495  src = cms.InputTag('selectedPatJetsForMETtype1p2Corr'+postfix)
496  ))
497  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype1p2CorrEnUp"+postfix)
498  setattr(process, "selectedPatJetsForMETtype1p2CorrEnDown"+postfix,
499  getattr(process, shiftedParticleCollections['jetCollectionEnDownForCorrMEt']).clone(
500  src = cms.InputTag('selectedPatJetsForMETtype1p2Corr'+postfix)
501  ))
502  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype1p2CorrEnDown"+postfix)
503  if makeType1p2corrPFMEt:
504  setattr(process, "selectedPatJetsForMETtype2CorrEnUp"+postfix,
505  getattr(process, shiftedParticleCollections['jetCollectionEnUpForCorrMEt']).clone(
506  src = cms.InputTag('selectedPatJetsForMETtype2Corr'+postfix)
507  ))
508  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype2CorrEnUp"+postfix)
509  setattr(process, "selectedPatJetsForMETtype2CorrEnDown"+postfix,
510  getattr(process, shiftedParticleCollections['jetCollectionEnDownForCorrMEt']).clone(
511  src = cms.InputTag('selectedPatJetsForMETtype2Corr'+postfix)
512  ))
513  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype2CorrEnDown"+postfix)
514 
515  if doSmearJets:
516  setattr(process, "selectedPatJetsForMETtype1p2CorrResUp"+postfix,
517  getattr(process, shiftedParticleCollections['jetCollectionResUp']).clone(
518  src = cms.InputTag('selectedPatJetsForMETtype1p2Corr'+postfix)
519  ))
520  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype1p2CorrResUp"+postfix)
521  setattr(process, "selectedPatJetsForMETtype1p2CorrResDown"+postfix,
522  getattr(process, shiftedParticleCollections['jetCollectionResDown']).clone(
523  src = cms.InputTag('selectedPatJetsForMETtype1p2Corr'+postfix)
524  ))
525  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype1p2CorrResDown"+postfix)
526  if makeType1p2corrPFMEt:
527  setattr(process, "selectedPatJetsForMETtype2CorrResUp"+postfix,
528  getattr(process, shiftedParticleCollections['jetCollectionResUp']).clone(
529  src = cms.InputTag('selectedPatJetsForMETtype2Corr'+postfix)
530  ))
531  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype2CorrResUp"+postfix)
532  setattr(process, "selectedPatJetsForMETtype2CorrResDown"+postfix,
533  getattr(process, shiftedParticleCollections['jetCollectionResDown']).clone(
534  src = cms.InputTag('selectedPatJetsForMETtype2Corr'+postfix)
535  ))
536  metUncertaintySequence += getattr(process, "selectedPatJetsForMETtype2CorrResDown"+postfix)
537 
538  if doSmearJets:
539  # apply MET smearing to "raw" (uncorrected) MET
540  smearedPatPFMetSequence = cms.Sequence()
541  setattr(process, "smearedPatPFMetSequence"+postfix, smearedPatPFMetSequence)
542  setattr(process, "patPFMetForMEtUncertainty"+postfix, getattr(process, "patPFMet"+postfix).clone())
543  smearedPatPFMetSequence += getattr(process, "patPFMetForMEtUncertainty"+postfix)
544  setattr(process, "patPFMETcorrJetSmearing"+postfix, cms.EDProducer("ShiftedParticleMETcorrInputProducer",
545  srcOriginal = cms.InputTag(shiftedParticleCollections['cleanedJetCollection']),
546  srcShifted = cms.InputTag(shiftedParticleCollections['lastJetCollection'])
547  ))
548  smearedPatPFMetSequence += getattr(process, "patPFMETcorrJetSmearing"+postfix)
549  getattr(process, "producePatPFMETCorrections"+postfix).replace(getattr(process, "patPFMet"+postfix), smearedPatPFMetSequence)
550  setattr(process, "patPFMet"+postfix, getattr(process, "patType1CorrectedPFMet"+postfix).clone(
551  src = cms.InputTag('patPFMetForMEtUncertainty'+postfix),
552  srcType1Corrections = cms.VInputTag(
553  cms.InputTag('patPFMETcorrJetSmearing'+postfix)
554  )
555  ))
556  smearedPatPFMetSequence += getattr(process, "patPFMet"+postfix)
557  metUncertaintySequence += smearedPatPFMetSequence
558 
559  # propagate shifts in jet energy to "raw" (uncorrected) and Type 1 corrected MET
560  metCollectionsUp_DownForRawMEt = \
562  process, shiftedParticleCollections['lastJetCollection'], "Jet", "En",
563  shiftedParticleCollections['jetCollectionEnUpForRawMEt'], shiftedParticleCollections['jetCollectionEnDownForRawMEt'],
564  getattr(process, "patPFMet"+postfix), metUncertaintySequence, postfix)
565  collectionsToKeep.extend(metCollectionsUp_DownForRawMEt)
566 
567  metCollectionsUp_DownForCorrMEt = \
569  process, shiftedParticleCollections['lastJetCollection'], "Jet", "En",
570  shiftedParticleCollections['jetCollectionEnUpForCorrMEt'], shiftedParticleCollections['jetCollectionEnDownForCorrMEt'],
571  getattr(process, "patType1CorrectedPFMet"+postfix), metUncertaintySequence, postfix)
572  collectionsToKeep.extend(metCollectionsUp_DownForCorrMEt)
573 
574  # propagate shifts in jet energy to Type 1 + 2 corrected MET
575  if makeType1p2corrPFMEt:
576  setattr(process, "patPFJetMETtype1p2CorrEnUp"+postfix, getattr(process, "patPFJetMETtype1p2Corr"+postfix).clone(
577  src = cms.InputTag(getattr(process, "selectedPatJetsForMETtype1p2CorrEnUp"+postfix).label()),
578  jetCorrLabel = cms.string(jetCorrLabel)
579  ))
580  metUncertaintySequence += getattr(process, "patPFJetMETtype1p2CorrEnUp"+postfix)
581  setattr(process, "patPFJetMETtype1p2CorrEnDown"+postfix, getattr(process, "patPFJetMETtype1p2CorrEnUp"+postfix).clone(
582  src = cms.InputTag(getattr(process, "selectedPatJetsForMETtype1p2CorrEnDown"+postfix).label())
583  ))
584  metUncertaintySequence += getattr(process, "patPFJetMETtype1p2CorrEnDown"+postfix)
585  setattr(process, "patPFJetMETtype2CorrEnUp"+postfix, getattr(process, "patPFJetMETtype2Corr"+postfix).clone(
586  src = cms.InputTag('selectedPatJetsForMETtype2CorrEnUp'+postfix)
587  ))
588  metUncertaintySequence += getattr(process, "patPFJetMETtype2CorrEnUp"+postfix)
589  setattr(process, "patPFJetMETtype2CorrEnDown"+postfix, getattr(process, "patPFJetMETtype2Corr"+postfix).clone(
590  src = cms.InputTag('selectedPatJetsForMETtype2CorrEnDown'+postfix)
591  ))
592  metUncertaintySequence += getattr(process, "patPFJetMETtype2CorrEnDown"+postfix)
593 
594  patType1correctionsJetEnUp = [ cms.InputTag('patPFJetMETtype1p2CorrEnUp'+postfix, 'type1') ]
595  if doApplyType0corr:
596  patType1correctionsJetEnUp.extend([ cms.InputTag('patPFMETtype0Corr'+postfix) ])
597  if doApplySysShiftCorr:
598  patType1correctionsJetEnUp.extend([ cms.InputTag('pfMEtSysShiftCorr'+postfix) ])
599  setattr(process, "patType1p2CorrectedPFMetJetEnUp"+postfix, getattr(process, "patType1p2CorrectedPFMet"+postfix).clone(
600  srcType1Corrections = cms.VInputTag(patType1correctionsJetEnUp),
601  srcUnclEnergySums = cms.VInputTag(
602  cms.InputTag('patPFJetMETtype1p2CorrEnUp'+postfix, 'type2' ),
603  cms.InputTag('patPFJetMETtype2CorrEnUp'+postfix, 'type2' ),
604  cms.InputTag('patPFJetMETtype1p2CorrEnUp'+postfix, 'offset'),
605  cms.InputTag('pfCandMETcorr'+postfix)
606  )
607  ))
608  metUncertaintySequence += getattr(process, "patType1p2CorrectedPFMetJetEnUp"+postfix)
609  collectionsToKeep.append('patType1p2CorrectedPFMetJetEnUp'+postfix)
610  patType1correctionsJetEnDown = [ cms.InputTag('patPFJetMETtype1p2CorrEnDown'+postfix, 'type1') ]
611  if doApplyType0corr:
612  patType1correctionsJetEnDown.extend([ cms.InputTag('patPFMETtype0Corr'+postfix) ])
613  if doApplySysShiftCorr:
614  patType1correctionsJetEnDown.extend([ cms.InputTag('pfMEtSysShiftCorr'+postfix) ])
615  setattr(process, "patType1p2CorrectedPFMetJetEnDown"+postfix, getattr(process, "patType1p2CorrectedPFMetJetEnUp"+postfix).clone(
616  srcType1Corrections = cms.VInputTag(patType1correctionsJetEnDown),
617  srcUnclEnergySums = cms.VInputTag(
618  cms.InputTag('patPFJetMETtype1p2CorrEnDown'+postfix, 'type2' ),
619  cms.InputTag('patPFJetMETtype2CorrEnDown'+postfix, 'type2' ),
620  cms.InputTag('patPFJetMETtype1p2CorrEnDown'+postfix, 'offset'),
621  cms.InputTag('pfCandMETcorr'+postfix)
622  )
623  ))
624  metUncertaintySequence += getattr(process, "patType1p2CorrectedPFMetJetEnDown"+postfix)
625  collectionsToKeep.append('patType1p2CorrectedPFMetJetEnDown'+postfix)
626 
627  if doSmearJets:
628  # propagate shifts in jet resolution to "raw" (uncorrected) MET and Type 1 corrected MET
629  for metProducer in [ getattr(process, "patPFMet"+postfix),
630  getattr(process, "patType1CorrectedPFMet"+postfix) ]:
631 
632  metCollectionsUp_Down = \
634  process, shiftedParticleCollections['lastJetCollection'], "Jet", "Res",
635  shiftedParticleCollections['jetCollectionResUp'], shiftedParticleCollections['jetCollectionResDown'],
636  metProducer, metUncertaintySequence, postfix)
637  collectionsToKeep.extend(metCollectionsUp_Down)
638 
639  # propagate shifts in jet resolution to Type 1 + 2 corrected MET
640  if makeType1p2corrPFMEt:
641  setattr(process, "patPFJetMETtype1p2CorrResUp"+postfix, getattr(process, "patPFJetMETtype1p2Corr"+postfix).clone(
642  src = cms.InputTag(getattr(process, "selectedPatJetsForMETtype1p2CorrResUp"+postfix).label()),
643  jetCorrLabel = cms.string(jetCorrLabel)
644  ))
645  metUncertaintySequence += getattr(process, "patPFJetMETtype1p2CorrResUp"+postfix)
646  setattr(process, "patPFJetMETtype1p2CorrResDown"+postfix, getattr(process, "patPFJetMETtype1p2CorrResUp"+postfix).clone(
647  src = cms.InputTag(getattr(process, "selectedPatJetsForMETtype1p2CorrResDown"+postfix).label())
648  ))
649  metUncertaintySequence += getattr(process, "patPFJetMETtype1p2CorrResDown"+postfix)
650  setattr(process, "patPFJetMETtype2CorrResUp"+postfix, getattr(process, "patPFJetMETtype2Corr"+postfix).clone(
651  src = cms.InputTag('selectedPatJetsForMETtype2CorrResUp'+postfix)
652  ))
653  metUncertaintySequence += getattr(process, "patPFJetMETtype2CorrResUp"+postfix)
654  setattr(process, "patPFJetMETtype2CorrResDown"+postfix, getattr(process, "patPFJetMETtype2Corr"+postfix).clone(
655  src = cms.InputTag('selectedPatJetsForMETtype2CorrResDown'+postfix)
656  ))
657  metUncertaintySequence += getattr(process, "patPFJetMETtype2CorrResDown"+postfix)
658 
659  patType1correctionsJetResUp = [ cms.InputTag('patPFJetMETtype1p2CorrResUp'+postfix, 'type1') ]
660  if doApplyType0corr:
661  patType1correctionsJetResUp.extend([ cms.InputTag('patPFMETtype0Corr'+postfix) ])
662  if doApplySysShiftCorr:
663  patType1correctionsJetResUp.extend([ cms.InputTag('pfMEtSysShiftCorr'+postfix) ])
664  setattr(process, "patType1p2CorrectedPFMetJetResUp"+postfix, getattr(process, "patType1p2CorrectedPFMet"+postfix).clone(
665  srcType1Corrections = cms.VInputTag(patType1correctionsJetResUp),
666  srcUnclEnergySums = cms.VInputTag(
667  cms.InputTag('patPFJetMETtype1p2CorrResUp'+postfix, 'type2' ),
668  cms.InputTag('patPFJetMETtype2CorrResUp'+postfix, 'type2' ),
669  cms.InputTag('patPFJetMETtype1p2CorrResUp'+postfix, 'offset'),
670  cms.InputTag('pfCandMETcorr'+postfix)
671  )
672  ))
673  metUncertaintySequence += getattr(process, "patType1p2CorrectedPFMetJetResUp"+postfix)
674  collectionsToKeep.append('patType1p2CorrectedPFMetJetResUp'+postfix)
675  patType1correctionsJetResDown = [ cms.InputTag('patPFJetMETtype1p2CorrResDown'+postfix, 'type1') ]
676  if doApplyType0corr:
677  patType1correctionsJetResDown.extend([ cms.InputTag('patPFMETtype0Corr'+postfix) ])
678  if doApplySysShiftCorr:
679  patType1correctionsJetResDown.extend([ cms.InputTag('pfMEtSysShiftCorr'+postfix) ])
680  setattr(process, "patType1p2CorrectedPFMetJetResDown"+postfix, getattr(process, "patType1p2CorrectedPFMetJetResUp"+postfix).clone(
681  srcType1Corrections = cms.VInputTag(patType1correctionsJetResDown),
682  srcUnclEnergySums = cms.VInputTag(
683  cms.InputTag('patPFJetMETtype1p2CorrResDown'+postfix, 'type2' ),
684  cms.InputTag('patPFJetMETtype2CorrResDown'+postfix, 'type2' ),
685  cms.InputTag('patPFJetMETtype1p2CorrResDown'+postfix, 'offset'),
686  cms.InputTag('pfCandMETcorr'+postfix)
687  )
688  ))
689  metUncertaintySequence += getattr(process, "patType1p2CorrectedPFMetJetResDown"+postfix)
690  collectionsToKeep.append('patType1p2CorrectedPFMetJetResDown'+postfix)
691 
692  #--------------------------------------------------------------------------------------------
693  # shift "unclustered energy" (PFJets of Pt < 10 GeV plus PFCandidates not within jets)
694  # and propagate effect of shift to (Type 1 as well as Type 1 + 2 corrected) MET
695  #--------------------------------------------------------------------------------------------
696 
697  unclEnMETcorrections = [
698  [ 'pfCandMETcorr'+postfix, [ '' ] ],
699  [ 'patPFJetMETtype1p2Corr'+postfix, [ 'type2', 'offset' ] ],
700  [ 'patPFJetMETtype2Corr'+postfix, [ 'type2' ] ],
701  ]
702  unclEnMETcorrectionsUp = []
703  unclEnMETcorrectionsDown = []
704  for srcUnclEnMETcorr in unclEnMETcorrections:
705  moduleUnclEnMETcorrUp = cms.EDProducer("ShiftedMETcorrInputProducer",
706  src = cms.VInputTag(
707  [ cms.InputTag(srcUnclEnMETcorr[0], instanceLabel) for instanceLabel in srcUnclEnMETcorr[1] ]
708  ),
709  uncertainty = cms.double(0.10),
710  shiftBy = cms.double(+1.*varyByNsigmas)
711  )
712  baseName = srcUnclEnMETcorr[0]
713  if postfix != "":
714  if baseName[-len(postfix):] == postfix:
715  baseName = baseName[0:-len(postfix)]
716  else:
717  raise StandardError("Tried to remove postfix %s from label %s, but it wasn't there" % (postfix, baseName))
718  moduleUnclEnMETcorrUpName = "%sUnclusteredEnUp" % baseName
719  moduleUnclEnMETcorrUpName += postfix
720  setattr(process, moduleUnclEnMETcorrUpName, moduleUnclEnMETcorrUp)
721  metUncertaintySequence += moduleUnclEnMETcorrUp
722  unclEnMETcorrectionsUp.extend([ cms.InputTag(moduleUnclEnMETcorrUpName, instanceLabel)
723  for instanceLabel in srcUnclEnMETcorr[1] ] )
724  moduleUnclEnMETcorrDown = moduleUnclEnMETcorrUp.clone(
725  shiftBy = cms.double(-1.*varyByNsigmas)
726  )
727  moduleUnclEnMETcorrDownName = "%sUnclusteredEnDown" % baseName
728  moduleUnclEnMETcorrDownName += postfix
729  setattr(process, moduleUnclEnMETcorrDownName, moduleUnclEnMETcorrDown)
730  metUncertaintySequence += moduleUnclEnMETcorrDown
731  unclEnMETcorrectionsDown.extend([ cms.InputTag(moduleUnclEnMETcorrDownName, instanceLabel)
732  for instanceLabel in srcUnclEnMETcorr[1] ] )
733 
734  # propagate shifts in jet energy/resolution to "raw" (uncorrected) MET
735  setattr(process, "patPFMetUnclusteredEnUp"+postfix, getattr(process, "patType1CorrectedPFMet"+postfix).clone(
736  src = cms.InputTag('patPFMet'+postfix),
737  srcType1Corrections = cms.VInputTag(unclEnMETcorrectionsUp)
738  ))
739  metUncertaintySequence += getattr(process, "patPFMetUnclusteredEnUp"+postfix)
740  collectionsToKeep.append('patPFMetUnclusteredEnUp'+postfix)
741  setattr(process, "patPFMetUnclusteredEnDown"+postfix, getattr(process, "patPFMetUnclusteredEnUp"+postfix).clone(
742  srcType1Corrections = cms.VInputTag(unclEnMETcorrectionsDown)
743  ))
744  metUncertaintySequence += getattr(process, "patPFMetUnclusteredEnDown"+postfix)
745  collectionsToKeep.append('patPFMetUnclusteredEnDown'+postfix)
746 
747  # propagate shifts in jet energy/resolution to Type 1 corrected MET
748  setattr(process, "patType1CorrectedPFMetUnclusteredEnUp"+postfix, getattr(process, "patType1CorrectedPFMet"+postfix).clone(
749  src = cms.InputTag('patType1CorrectedPFMet'+postfix),
750  srcType1Corrections = cms.VInputTag(unclEnMETcorrectionsUp)
751  ))
752  metUncertaintySequence += getattr(process, "patType1CorrectedPFMetUnclusteredEnUp"+postfix)
753  collectionsToKeep.append('patType1CorrectedPFMetUnclusteredEnUp'+postfix)
754  setattr(process, "patType1CorrectedPFMetUnclusteredEnDown"+postfix, getattr(process, "patType1CorrectedPFMetUnclusteredEnUp"+postfix).clone(
755  srcType1Corrections = cms.VInputTag(unclEnMETcorrectionsDown)
756  ))
757  metUncertaintySequence += getattr(process, "patType1CorrectedPFMetUnclusteredEnDown"+postfix)
758  collectionsToKeep.append('patType1CorrectedPFMetUnclusteredEnDown'+postfix)
759 
760  # propagate shifts in jet energy/resolution to Type 1 + 2 corrected MET
761  if makeType1p2corrPFMEt:
762  setattr(process, "patType1p2CorrectedPFMetUnclusteredEnUp"+postfix, getattr(process, "patType1p2CorrectedPFMet"+postfix).clone(
763  srcUnclEnergySums = cms.VInputTag(
764  cms.InputTag('patPFJetMETtype1p2Corr'+postfix, 'type2' ),
765  cms.InputTag('patPFJetMETtype1p2CorrUnclusteredEnUp'+postfix, 'type2' ),
766  cms.InputTag('patPFJetMETtype2Corr'+postfix, 'type2' ),
767  cms.InputTag('patPFJetMETtype2CorrUnclusteredEnUp'+postfix, 'type2' ),
768  cms.InputTag('patPFJetMETtype1p2Corr'+postfix, 'offset'),
769  cms.InputTag('patPFJetMETtype1p2CorrUnclusteredEnUp'+postfix, 'offset'),
770  cms.InputTag('pfCandMETcorr'+postfix),
771  cms.InputTag('pfCandMETcorrUnclusteredEnUp'+postfix)
772  )
773  ))
774  metUncertaintySequence += getattr(process, "patType1p2CorrectedPFMetUnclusteredEnUp"+postfix)
775  collectionsToKeep.append('patType1p2CorrectedPFMetUnclusteredEnUp'+postfix)
776  setattr(process, "patType1p2CorrectedPFMetUnclusteredEnDown"+postfix, getattr(process, "patType1p2CorrectedPFMetUnclusteredEnUp"+postfix).clone(
777  srcUnclEnergySums = cms.VInputTag(
778  cms.InputTag('patPFJetMETtype1p2Corr'+postfix, 'type2' ),
779  cms.InputTag('patPFJetMETtype1p2CorrUnclusteredEnDown'+postfix, 'type2' ),
780  cms.InputTag('patPFJetMETtype2Corr'+postfix, 'type2' ),
781  cms.InputTag('patPFJetMETtype2CorrUnclusteredEnDown'+postfix, 'type2' ),
782  cms.InputTag('patPFJetMETtype1p2Corr'+postfix, 'offset'),
783  cms.InputTag('patPFJetMETtype1p2CorrUnclusteredEnDown'+postfix, 'offset'),
784  cms.InputTag('pfCandMETcorr'+postfix),
785  cms.InputTag('pfCandMETcorrUnclusteredEnDown'+postfix)
786  )
787  ))
788  metUncertaintySequence += getattr(process, "patType1p2CorrectedPFMetUnclusteredEnDown"+postfix)
789  collectionsToKeep.append('patType1p2CorrectedPFMetUnclusteredEnDown'+postfix)
790 
791  #--------------------------------------------------------------------------------------------
792  # propagate shifted electron/photon, muon and tau-jet energies to MET
793  #--------------------------------------------------------------------------------------------
794 
795  metProducers = [ getattr(process, "patPFMet"+postfix),
796  getattr(process, "patType1CorrectedPFMet"+postfix) ]
797  if makeType1p2corrPFMEt:
798  metProducers.append( getattr(process, "patType1p2CorrectedPFMet"+postfix) )
799  for metProducer in metProducers:
800 
801  if self._isValidInputTag(shiftedParticleCollections['electronCollection']):
802  metCollectionsUp_Down = \
804  process, shiftedParticleCollections['electronCollection'].value(), "Electron", "En",
805  shiftedParticleCollections['electronCollectionEnUp'], shiftedParticleCollections['electronCollectionEnDown'],
806  metProducer, metUncertaintySequence, postfix)
807  collectionsToKeep.extend(metCollectionsUp_Down)
808 
809  if self._isValidInputTag(shiftedParticleCollections['photonCollection']):
810  metCollectionsUp_Down = \
812  process, shiftedParticleCollections['photonCollection'].value(), "Photon", "En",
813  shiftedParticleCollections['photonCollectionEnUp'], shiftedParticleCollections['photonCollectionEnDown'],
814  metProducer, metUncertaintySequence, postfix)
815  collectionsToKeep.extend(metCollectionsUp_Down)
816 
817  if self._isValidInputTag(shiftedParticleCollections['muonCollection']):
818  metCollectionsUp_Down = \
820  process, shiftedParticleCollections['muonCollection'].value(), "Muon", "En",
821  shiftedParticleCollections['muonCollectionEnUp'], shiftedParticleCollections['muonCollectionEnDown'],
822  metProducer, metUncertaintySequence, postfix)
823  collectionsToKeep.extend(metCollectionsUp_Down)
824 
825  if self._isValidInputTag(shiftedParticleCollections['tauCollection']):
826  metCollectionsUp_Down = \
828  process, shiftedParticleCollections['tauCollection'].value(), "Tau", "En",
829  shiftedParticleCollections['tauCollectionEnUp'], shiftedParticleCollections['tauCollectionEnDown'],
830  metProducer, metUncertaintySequence, postfix)
831  collectionsToKeep.extend(metCollectionsUp_Down)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def metUncertaintyTools.RunMEtUncertainties._addModuleToSequence (   self,
  process,
  module,
  moduleName_parts,
  sequence,
  postfix 
)
private

Definition at line 74 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addSmearedJets().

Referenced by metUncertaintyTools.RunMEtUncertainties._addShiftedParticleCollections(), metUncertaintyTools.RunMEtUncertainties._addSmearedJets(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

74 
75  def _addModuleToSequence(self, process, module, moduleName_parts, sequence, postfix):
76 
77  if not len(moduleName_parts) > 0:
78  raise ValueError("Empty list !!")
79 
80  moduleName = ""
81 
82  lastPart = None
83  for part in moduleName_parts:
84  if part is None or part == "":
85  continue
86 
87  part = part.replace("selected", "")
88  part = part.replace("clean", "")
89 
90  if lastPart is None:
91  moduleName += part[0].lower() + part[1:]
92  lastPart = part
93  else:
94  if lastPart[-1].islower() or lastPart[-1].isdigit():
95  moduleName += part[0].capitalize() + part[1:]
96  else:
97  moduleName += part[0].lower() + part[1:]
98  lastPart = part
99 
100  moduleName += postfix
101  setattr(process, moduleName, module)
102 
103  sequence += module
104 
105  return moduleName
def metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt (   self,
  process,
  metUncertaintySequence,
  shiftedParticleCollections,
  pfCandCollection,
  collectionsToKeep,
  doSmearJets,
  makeNoPileUpPFMEt,
  varyByNsigmas,
  postfix 
)
private

Definition at line 1112 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties.__call__(), metUncertaintyTools.RunMEtUncertainties._addPATMEtProducer(), metUncertaintyTools.RunMEtUncertainties._addPFCandidatesForPFMEtInput(), metUncertaintyTools.RunMEtUncertainties._getLeptonsForPFMEtInput(), metUncertaintyTools.RunMEtUncertainties._isValidInputTag(), and clone().

Referenced by metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

1113  postfix):
1114 
1115  if not makeNoPileUpPFMEt:
1116  return
1117 
1118  if not hasattr(process, "noPileUpPFMEt"):
1119  process.load("JetMETCorrections.METPUSubtraction.noPileUpPFMET_cff")
1120 
1121  lastUncorrectedJetCollectionForNoPileUpPFMEt = 'ak4PFJets'
1122  lastCorrectedJetCollectionForNoPileUpPFMEt = 'calibratedAK5PFJetsForNoPileUpPFMEt'
1123  if postfix != "":
1124  configtools.cloneProcessingSnippet(process, process.noPileUpPFMEtSequence, postfix)
1125  lastCorrectedJetCollectionForNoPileUpPFMEt+= postfix
1126 
1127 
1128  if doSmearJets:
1129  process.load("RecoJets.Configuration.GenJetParticles_cff")
1130  metUncertaintySequence += process.genParticlesForJetsNoNu
1131  process.load("RecoJets.Configuration.RecoGenJets_cff")
1132  metUncertaintySequence += process.ak4GenJetsNoNu
1133  setattr(process, "smearedUncorrectedJetsForNoPileUpPFMEt"+postfix, cms.EDProducer("SmearedPFJetProducer",
1134  src = cms.InputTag('ak4PFJets'),
1135  jetCorrLabel = cms.string("ak4PFL1FastL2L3"),
1136  dRmaxGenJetMatch = cms.string('TMath::Min(0.5, 0.1 + 0.3*TMath::Exp(-0.05*(genJetPt - 10.)))'),
1137  sigmaMaxGenJetMatch = cms.double(5.),
1138  inputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/pfJetResolutionMCtoDataCorrLUT.root'),
1139  lutName = cms.string('pfJetResolutionMCtoDataCorrLUT'),
1140  jetResolutions = jetResolutions.METSignificance_params,
1141  skipRawJetPtThreshold = cms.double(10.), # GeV
1142  skipCorrJetPtThreshold = cms.double(1.e-2),
1143  srcGenJets = cms.InputTag('ak4GenJetsNoNu'),
1144  ##verbosity = cms.int32(1)
1145  ))
1146  metUncertaintySequence += getattr(process, "smearedUncorrectedJetsForNoPileUpPFMEt"+postfix)
1147  getattr(process, "calibratedAK5PFJetsForNoPileUpPFMEt"+postfix).src = cms.InputTag('smearedUncorrectedJetsForNoPileUpPFMEt'+postfix)
1148  metUncertaintySequence += getattr(process, "noPileUpPFMEtSequence"+postfix)
1149  self._addPATMEtProducer(process, metUncertaintySequence,
1150  'noPileUpPFMEt'+postfix, 'patPFMetNoPileUp', collectionsToKeep, postfix)
1151 
1152  for leptonCollection in [ [ 'Electron', 'En', 'electronCollection', 0.3 ],
1153  [ 'Photon', 'En', 'photonCollection', 0.3 ],
1154  [ 'Muon', 'En', 'muonCollection', 0.3 ],
1155  [ 'Tau', 'En', 'tauCollection', 0.3 ] ]:
1156  if self._isValidInputTag(shiftedParticleCollections[leptonCollection[2]]):
1157  pfCandCollectionLeptonShiftUp, pfCandCollectionLeptonShiftDown = \
1159  process, metUncertaintySequence,
1160  shiftedParticleCollections['%s' % leptonCollection[2]], leptonCollection[0], leptonCollection[1],
1161  shiftedParticleCollections['%s%sUp' % (leptonCollection[2], leptonCollection[1])], shiftedParticleCollections['%s%sDown' % (leptonCollection[2], leptonCollection[1])],
1162  leptonCollection[3],
1163  pfCandCollection, postfix)
1164  modulePFCandidateToVertexAssociationShiftUp = process.pfCandidateToVertexAssociation.clone(
1165  PFCandidateCollection = cms.InputTag(pfCandCollectionLeptonShiftUp)
1166  )
1167  modulePFCandidateToVertexAssociationShiftUpName = "pfCandidateToVertexAssociation%s%sUp" % (leptonCollection[0], leptonCollection[1])
1168  modulePFCandidateToVertexAssociationShiftUpName += postfix
1169  setattr(process, modulePFCandidateToVertexAssociationShiftUpName, modulePFCandidateToVertexAssociationShiftUp)
1170  metUncertaintySequence += modulePFCandidateToVertexAssociationShiftUp
1171  modulePFMEtDataLeptonShiftUp = getattr(process, "noPileUpPFMEtData"+postfix).clone(
1172  srcPFCandidates = cms.InputTag(pfCandCollectionLeptonShiftUp),
1173  srcPFCandToVertexAssociations = cms.InputTag(modulePFCandidateToVertexAssociationShiftUpName)
1174  )
1175  modulePFMEtDataLeptonShiftUpName = "noPileUpPFMEtData%s%sUp" % (leptonCollection[0], leptonCollection[1])
1176  modulePFMEtDataLeptonShiftUpName += postfix
1177  setattr(process, modulePFMEtDataLeptonShiftUpName, modulePFMEtDataLeptonShiftUp)
1178  metUncertaintySequence += modulePFMEtDataLeptonShiftUp
1179  modulePFMEtLeptonShiftUp = getattr(process, "noPileUpPFMEt"+postfix).clone(
1180  srcMVAMEtData = cms.InputTag(modulePFMEtDataLeptonShiftUpName),
1181  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(
1182  shiftedParticleCollections, leptonCollection[2], '%s%sUp' % (leptonCollection[2], leptonCollection[1]), postfix=postfix))
1183  )
1184  modulePFMEtLeptonShiftUpName = "noPileUpPFMEt%s%sUp" % (leptonCollection[0], leptonCollection[1])
1185  modulePFMEtLeptonShiftUpName += postfix
1186  setattr(process, modulePFMEtLeptonShiftUpName, modulePFMEtLeptonShiftUp)
1187  metUncertaintySequence += modulePFMEtLeptonShiftUp
1188  self._addPATMEtProducer(process, metUncertaintySequence,
1189  modulePFMEtLeptonShiftUpName, 'patPFMetNoPileUp%s%sUp' % (leptonCollection[0], leptonCollection[1]), collectionsToKeep, postfix)
1190  modulePFCandidateToVertexAssociationShiftDown = modulePFCandidateToVertexAssociationShiftUp.clone(
1191  PFCandidateCollection = cms.InputTag(pfCandCollectionLeptonShiftDown)
1192  )
1193  modulePFCandidateToVertexAssociationShiftDownName = "pfCandidateToVertexAssociation%s%sDown" % (leptonCollection[0], leptonCollection[1])
1194  modulePFCandidateToVertexAssociationShiftDownName += postfix
1195  setattr(process, modulePFCandidateToVertexAssociationShiftDownName, modulePFCandidateToVertexAssociationShiftDown)
1196  metUncertaintySequence += modulePFCandidateToVertexAssociationShiftDown
1197  modulePFMEtDataLeptonShiftDown = getattr(process, "noPileUpPFMEtData"+postfix).clone(
1198  srcPFCandidates = cms.InputTag(pfCandCollectionLeptonShiftDown),
1199  srcPFCandToVertexAssociations = cms.InputTag(modulePFCandidateToVertexAssociationShiftDownName)
1200  )
1201  modulePFMEtDataLeptonShiftDownName = "noPileUpPFMEtData%s%sDown" % (leptonCollection[0], leptonCollection[1])
1202  modulePFMEtDataLeptonShiftDownName += postfix
1203  setattr(process, modulePFMEtDataLeptonShiftDownName, modulePFMEtDataLeptonShiftDown)
1204  metUncertaintySequence += modulePFMEtDataLeptonShiftDown
1205  modulePFMEtLeptonShiftDown = getattr(process, "noPileUpPFMEt"+postfix).clone(
1206  srcMVAMEtData = cms.InputTag(modulePFMEtDataLeptonShiftDownName),
1207  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(
1208  shiftedParticleCollections, leptonCollection[2], '%s%sDown' % (leptonCollection[2], leptonCollection[1]), postfix=postfix))
1209  )
1210  modulePFMEtLeptonShiftDownName = "noPileUpPFMEt%s%sDown" % (leptonCollection[0], leptonCollection[1])
1211  modulePFMEtLeptonShiftDownName += postfix
1212  setattr(process, modulePFMEtLeptonShiftDownName, modulePFMEtLeptonShiftDown)
1213  metUncertaintySequence += modulePFMEtLeptonShiftDown
1214  self._addPATMEtProducer(process, metUncertaintySequence,
1215  modulePFMEtLeptonShiftDownName, 'patPFMetNoPileUp%s%sDown' % (leptonCollection[0], leptonCollection[1]), collectionsToKeep, postfix)
1216 
1217  if self._isValidInputTag(shiftedParticleCollections['jetCollection']):
1218  setattr(process, "uncorrectedJetsEnUpForNoPileUpPFMEt"+postfix, cms.EDProducer("ShiftedPFJetProducer",
1219  src = cms.InputTag(lastUncorrectedJetCollectionForNoPileUpPFMEt),
1220  jetCorrInputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/Summer12_V2_DATA_AK5PF_UncertaintySources.txt'),
1221  jetCorrUncertaintyTag = cms.string("SubTotalDataMC"),
1222  addResidualJES = cms.bool(False),
1223  jetCorrLabelUpToL3 = cms.string("ak4PFL1FastL2L3"),
1224  jetCorrLabelUpToL3Res = cms.string("ak4PFL1FastL2L3Residual"),
1225  shiftBy = cms.double(+1.*varyByNsigmas),
1226  ##verbosity = cms.int32(1)
1227  ))
1228  metUncertaintySequence += getattr(process, "uncorrectedJetsEnUpForNoPileUpPFMEt"+postfix)
1229  setattr(process, "correctedJetsEnUpForNoPileUpPFMEt"+postfix, getattr(process, "uncorrectedJetsEnUpForNoPileUpPFMEt"+postfix).clone(
1230  src = cms.InputTag(lastCorrectedJetCollectionForNoPileUpPFMEt),
1231  addResidualJES = cms.bool(False),
1232  shiftBy = cms.double(+1.*varyByNsigmas)
1233  ))
1234  metUncertaintySequence += getattr(process, "correctedJetsEnUpForNoPileUpPFMEt"+postfix)
1235  setattr(process, "puJetIdForNoPileUpPFMEtJetEnUp"+postfix, getattr(process, "puJetIdForNoPileUpPFMEt"+postfix).clone(
1236  jets = cms.InputTag('correctedJetsEnUpForNoPileUpPFMEt'+postfix)
1237  ))
1238  metUncertaintySequence += getattr(process, "puJetIdForNoPileUpPFMEtJetEnUp"+postfix)
1239  setattr(process, "noPileUpPFMEtDataJetEnUp"+postfix, getattr(process, "noPileUpPFMEtData"+postfix).clone(
1240  srcJets = cms.InputTag('correctedJetsEnUpForNoPileUpPFMEt'+postfix),
1241  srcJetIds = cms.InputTag('puJetIdForNoPileUpPFMEtJetEnUp'+postfix, 'fullId')
1242  ))
1243  metUncertaintySequence += getattr(process, "noPileUpPFMEtDataJetEnUp"+postfix)
1244  setattr(process, "noPileUpPFMEtJetEnUp"+postfix, getattr(process, "noPileUpPFMEt"+postfix).clone(
1245  srcMVAMEtData = cms.InputTag('noPileUpPFMEtDataJetEnUp'+postfix),
1246  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1247  ))
1248  metUncertaintySequence += getattr(process, "noPileUpPFMEtJetEnUp"+postfix)
1249  self._addPATMEtProducer(process, metUncertaintySequence,
1250  'noPileUpPFMEtJetEnUp'+postfix, 'patPFMetNoPileUpJetEnUp', collectionsToKeep, postfix)
1251  setattr(process, "uncorrectedJetsEnDownForNoPileUpPFMEt"+postfix, getattr(process, "uncorrectedJetsEnUpForNoPileUpPFMEt"+postfix).clone(
1252  shiftBy = cms.double(-1.*varyByNsigmas)
1253  ))
1254  metUncertaintySequence += getattr(process, "uncorrectedJetsEnDownForNoPileUpPFMEt"+postfix)
1255  setattr(process, "correctedJetsEnDownForNoPileUpPFMEt"+postfix, getattr(process, "correctedJetsEnUpForNoPileUpPFMEt"+postfix).clone(
1256  shiftBy = cms.double(-1.*varyByNsigmas)
1257  ))
1258  metUncertaintySequence += getattr(process, "correctedJetsEnDownForNoPileUpPFMEt"+postfix)
1259  setattr(process, "puJetIdForNoPileUpPFMEtJetEnDown"+postfix, getattr(process, "puJetIdForNoPileUpPFMEt"+postfix).clone(
1260  jets = cms.InputTag('correctedJetsEnDownForNoPileUpPFMEt'+postfix)
1261  ))
1262  metUncertaintySequence += getattr(process, "puJetIdForNoPileUpPFMEtJetEnDown"+postfix)
1263  setattr(process, "noPileUpPFMEtDataJetEnDown"+postfix, getattr(process, "noPileUpPFMEtData"+postfix).clone(
1264  srcJets = cms.InputTag('correctedJetsEnDownForNoPileUpPFMEt'+postfix),
1265  srcJetIds = cms.InputTag('puJetIdForNoPileUpPFMEtJetEnDown'+postfix, 'fullId')
1266  ))
1267  metUncertaintySequence += getattr(process, "noPileUpPFMEtDataJetEnDown"+postfix)
1268  setattr(process, "noPileUpPFMEtJetEnDown"+postfix, getattr(process, "noPileUpPFMEt"+postfix).clone(
1269  srcMVAMEtData = cms.InputTag('noPileUpPFMEtDataJetEnDown'+postfix),
1270  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1271  ))
1272  metUncertaintySequence += getattr(process, "noPileUpPFMEtJetEnDown"+postfix)
1273  self._addPATMEtProducer(process, metUncertaintySequence,
1274  'noPileUpPFMEtJetEnDown'+postfix, 'patPFMetNoPileUpJetEnDown', collectionsToKeep, postfix)
1275 
1276  if hasattr(process, "smearedUncorrectedJetsForNoPileUpPFMEt"+postfix):
1277  setattr(process, "smearedCorrectedJetsForNoPileUpPFMEt"+postfix, getattr(process, "smearedUncorrectedJetsForNoPileUpPFMEt"+postfix).clone(
1278  src = cms.InputTag('calibratedAK5PFJetsForNoPileUpPFMEt'+postfix),
1279  jetCorrLabel = cms.string("")
1280  ))
1281  setattr(process, "correctedJetsResUpForNoPileUpPFMEt"+postfix, getattr(process, "smearedCorrectedJetsForNoPileUpPFMEt"+postfix).clone(
1282  shiftBy = cms.double(-1.*varyByNsigmas)
1283  ))
1284  metUncertaintySequence += getattr(process, "correctedJetsResUpForNoPileUpPFMEt"+postfix)
1285  setattr(process, "correctedJetsResDownForNoPileUpPFMEt"+postfix, getattr(process, "smearedCorrectedJetsForNoPileUpPFMEt"+postfix).clone(
1286  shiftBy = cms.double(+1.*varyByNsigmas)
1287  ))
1288  metUncertaintySequence += getattr(process, "correctedJetsResDownForNoPileUpPFMEt"+postfix)
1289  setattr(process, "puJetIdForNoPileUpPFMEtJetResUp"+postfix, getattr(process, "puJetIdForNoPileUpPFMEt"+postfix).clone(
1290  jets = cms.InputTag('correctedJetsResUpForNoPileUpPFMEt'+postfix)
1291  ))
1292  metUncertaintySequence += getattr(process, "puJetIdForNoPileUpPFMEtJetResUp"+postfix)
1293  setattr(process, "noPileUpPFMEtDataJetResUp"+postfix, getattr(process, "noPileUpPFMEtData"+postfix).clone(
1294  srcJets = cms.InputTag('correctedJetsResUpForNoPileUpPFMEt'+postfix),
1295  srcJetIds = cms.InputTag('puJetIdForNoPileUpPFMEtJetResUp'+postfix, 'fullId')
1296  ))
1297  metUncertaintySequence += getattr(process, "noPileUpPFMEtDataJetResUp"+postfix)
1298  setattr(process, "noPileUpPFMEtJetResUp"+postfix, getattr(process, "noPileUpPFMEt"+postfix).clone(
1299  srcMVAMEtData = cms.InputTag('noPileUpPFMEtDataJetResUp'+postfix),
1300  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1301  ))
1302  metUncertaintySequence += getattr(process, "noPileUpPFMEtJetResUp"+postfix)
1303  self._addPATMEtProducer(process, metUncertaintySequence,
1304  'noPileUpPFMEtJetResUp'+postfix, 'patPFMetNoPileUpJetResUp', collectionsToKeep, postfix)
1305  setattr(process, "puJetIdForNoPileUpPFMEtJetResDown"+postfix, getattr(process, "puJetIdForNoPileUpPFMEt"+postfix).clone(
1306  jets = cms.InputTag('correctedJetsResDownForNoPileUpPFMEt'+postfix)
1307  ))
1308  metUncertaintySequence += getattr(process, "puJetIdForNoPileUpPFMEtJetResDown"+postfix)
1309  setattr(process, "noPileUpPFMEtDataJetResDown"+postfix, getattr(process, "noPileUpPFMEtData"+postfix).clone(
1310  srcJets = cms.InputTag('correctedJetsResDownForNoPileUpPFMEt'+postfix),
1311  srcJetIds = cms.InputTag('puJetIdForNoPileUpPFMEtJetResDown'+postfix, 'fullId')
1312  ))
1313  metUncertaintySequence += getattr(process, "noPileUpPFMEtDataJetResDown"+postfix)
1314  setattr(process, "noPileUpPFMEtJetResDown"+postfix, getattr(process, "noPileUpPFMEt"+postfix).clone(
1315  srcMVAMEtData = cms.InputTag('noPileUpPFMEtDataJetResDown'+postfix),
1316  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1317  ))
1318  metUncertaintySequence += getattr(process, "noPileUpPFMEtJetResDown"+postfix)
1319  self._addPATMEtProducer(process, metUncertaintySequence,
1320  'noPileUpPFMEtJetResDown'+postfix, 'patPFMetNoPileUpJetResDown', collectionsToKeep, postfix)
1321 
1322  setattr(process, "pfCandsUnclusteredEnUpForNoPileUpPFMEt"+postfix, cms.EDProducer("ShiftedPFCandidateProducerForNoPileUpPFMEt",
1323  srcPFCandidates = cms.InputTag('particleFlow'),
1324  srcJets = cms.InputTag('calibratedAK5PFJetsForNoPileUpPFMEt'+postfix),
1325  jetCorrInputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/Summer12_V2_DATA_AK5PF_UncertaintySources.txt'),
1326  jetCorrUncertaintyTag = cms.string("SubTotalDataMC"),
1327  minJetPt = cms.double(10.0),
1328  shiftBy = cms.double(+1.*varyByNsigmas),
1329  unclEnUncertainty = cms.double(0.10)
1330  ))
1331  metUncertaintySequence += getattr(process, "pfCandsUnclusteredEnUpForNoPileUpPFMEt"+postfix)
1332  setattr(process, "pfCandidateToVertexAssociationUnclusteredEnUpForNoPileUpPFMEt"+postfix, process.pfCandidateToVertexAssociation.clone(
1333  PFCandidateCollection = cms.InputTag('pfCandsUnclusteredEnUpForNoPileUpPFMEt'+postfix)
1334  ))
1335  metUncertaintySequence += getattr(process, "pfCandidateToVertexAssociationUnclusteredEnUpForNoPileUpPFMEt"+postfix)
1336  setattr(process, "noPileUpPFMEtDataUnclusteredEnUp"+postfix, getattr(process, "noPileUpPFMEtData"+postfix).clone(
1337  srcPFCandidates = cms.InputTag('pfCandsUnclusteredEnUpForNoPileUpPFMEt'+postfix),
1338  srcPFCandToVertexAssociations = cms.InputTag('pfCandidateToVertexAssociationUnclusteredEnUpForNoPileUpPFMEt'+postfix),
1339  ))
1340  metUncertaintySequence += getattr(process, "noPileUpPFMEtDataUnclusteredEnUp"+postfix)
1341  setattr(process, "noPileUpPFMEtUnclusteredEnUp"+postfix, getattr(process, "noPileUpPFMEt"+postfix).clone(
1342  srcMVAMEtData = cms.InputTag('noPileUpPFMEtDataUnclusteredEnUp'+postfix),
1343  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1344  ))
1345  metUncertaintySequence += getattr(process, "noPileUpPFMEtUnclusteredEnUp"+postfix)
1346  self._addPATMEtProducer(process, metUncertaintySequence,
1347  'noPileUpPFMEtUnclusteredEnUp'+postfix, 'patPFMetNoPileUpUnclusteredEnUp', collectionsToKeep, postfix)
1348  setattr(process, "pfCandsUnclusteredEnDownForNoPileUpPFMEt"+postfix, getattr(process, "pfCandsUnclusteredEnUpForNoPileUpPFMEt"+postfix).clone(
1349  shiftBy = cms.double(-1.*varyByNsigmas),
1350  ))
1351  metUncertaintySequence += getattr(process, "pfCandsUnclusteredEnDownForNoPileUpPFMEt"+postfix)
1352  setattr(process, "pfCandidateToVertexAssociationUnclusteredEnDownForNoPileUpPFMEt"+postfix, process.pfCandidateToVertexAssociation.clone(
1353  PFCandidateCollection = cms.InputTag('pfCandsUnclusteredEnDownForNoPileUpPFMEt'+postfix)
1354  ))
1355  metUncertaintySequence += getattr(process, "pfCandidateToVertexAssociationUnclusteredEnDownForNoPileUpPFMEt"+postfix)
1356  setattr(process, "noPileUpPFMEtDataUnclusteredEnDown"+postfix, getattr(process, "noPileUpPFMEtData"+postfix).clone(
1357  srcPFCandidates = cms.InputTag('pfCandsUnclusteredEnDownForNoPileUpPFMEt'+postfix),
1358  srcPFCandToVertexAssociations = cms.InputTag('pfCandidateToVertexAssociationUnclusteredEnDownForNoPileUpPFMEt'+postfix),
1359  ))
1360  metUncertaintySequence += getattr(process, "noPileUpPFMEtDataUnclusteredEnDown"+postfix)
1361  setattr(process, "noPileUpPFMEtUnclusteredEnDown"+postfix, getattr(process, "noPileUpPFMEt"+postfix).clone(
1362  srcMVAMEtData = cms.InputTag('noPileUpPFMEtDataUnclusteredEnDown'+postfix),
1363  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1364  ))
1365  metUncertaintySequence += getattr(process, "noPileUpPFMEtUnclusteredEnDown"+postfix)
1366  self._addPATMEtProducer(process, metUncertaintySequence,
1367  'noPileUpPFMEtUnclusteredEnDown'+postfix, 'patPFMetNoPileUpUnclusteredEnDown', collectionsToKeep, postfix)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def metUncertaintyTools.RunMEtUncertainties._addPATMEtProducer (   self,
  process,
  metUncertaintySequence,
  pfMEtCollection,
  patMEtCollection,
  collectionsToKeep,
  postfix 
)
private

Definition at line 878 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA().

Referenced by metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt(), metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA(), and metUncertaintyTools.RunMEtUncertainties._getLeptonsForPFMEtInput().

879  collectionsToKeep, postfix):
880 
881  module = patMETs.clone(
882  metSource = cms.InputTag(pfMEtCollection),
883  addMuonCorrections = cms.bool(False),
884  genMETSource = cms.InputTag('genMetTrue')
885  )
886  patMEtCollectionName = patMEtCollection+postfix
887  setattr(process, patMEtCollectionName, module)
888  metUncertaintySequence += module
889  collectionsToKeep.append(patMEtCollectionName)
def metUncertaintyTools.RunMEtUncertainties._addPFCandidatesForPFMEtInput (   self,
  process,
  metUncertaintySequence,
  particleCollection,
  particleType,
  shiftType,
  particleCollectionShiftUp,
  particleCollectionShiftDown,
  dRmatch,
  pfCandCollection,
  postfix 
)
private

Definition at line 835 of file metUncertaintyTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties._addCorrPFMEt(), metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt(), and metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA().

836  pfCandCollection, postfix):
837 
838  srcUnshiftedObjects = particleCollection
839  if isinstance(srcUnshiftedObjects, cms.InputTag):
840  srcUnshiftedObjects = srcUnshiftedObjects.value()
841  moduleShiftUp = cms.EDProducer("ShiftedPFCandidateProducerForPFMEtMVA",
842  srcPFCandidates = pfCandCollection,
843  srcUnshiftedObjects = cms.InputTag(srcUnshiftedObjects),
844  srcShiftedObjects = cms.InputTag(particleCollectionShiftUp),
845  dRmatch_PFCandidate = cms.double(dRmatch)
846  )
847  moduleNameShiftUp = "pfCandidates%s%sUpForMEtUncertainties" % (particleType, shiftType)
848  moduleNameShiftUp += postfix
849  setattr(process, moduleNameShiftUp, moduleShiftUp)
850  metUncertaintySequence += moduleShiftUp
851 
852  moduleShiftDown = moduleShiftUp.clone(
853  srcShiftedObjects = cms.InputTag(particleCollectionShiftDown)
854  )
855  moduleNameShiftDown = "pfCandidates%s%sDownForMEtUncertainties" % (particleType, shiftType)
856  moduleNameShiftDown += postfix
857  setattr(process, moduleNameShiftDown, moduleShiftDown)
858  metUncertaintySequence += moduleShiftDown
859 
860  return ( moduleNameShiftUp, moduleNameShiftDown )
def metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA (   self,
  process,
  metUncertaintySequence,
  shiftedParticleCollections,
  pfCandCollection,
  collectionsToKeep,
  doSmearJets,
  makePFMEtByMVA,
  varyByNsigmas,
  postfix 
)
private

Definition at line 896 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt(), metUncertaintyTools.RunMEtUncertainties._addPATMEtProducer(), metUncertaintyTools.RunMEtUncertainties._addPFCandidatesForPFMEtInput(), metUncertaintyTools.RunMEtUncertainties._getLeptonsForPFMEtInput(), metUncertaintyTools.RunMEtUncertainties._isValidInputTag(), and clone().

Referenced by metUncertaintyTools.RunMEtUncertainties._addPATMEtProducer(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

897  postfix):
898 
899  if not makePFMEtByMVA:
900  return
901 
902  if not hasattr(process, "pfMEtMVA"):
903  process.load("JetMETCorrections.METPUSubtraction.mvaPFMET_cff")
904 
905  lastUncorrectedJetCollectionForPFMEtByMVA = 'ak4PFJets'
906  lastCorrectedJetCollectionForPFMEtByMVA = 'calibratedAK5PFJetsForPFMEtMVA'
907  if postfix != "":
908  configtools.cloneProcessingSnippet(process, process.pfMEtMVAsequence, postfix)
909  lastCorrectedJetCollectionForPFMEtByMVA += postfix
910 
911  if doSmearJets:
912  process.load("RecoJets.Configuration.GenJetParticles_cff")
913  metUncertaintySequence += process.genParticlesForJetsNoNu
914  process.load("RecoJets.Configuration.RecoGenJets_cff")
915  metUncertaintySequence += process.ak4GenJetsNoNu
916  setattr(process, "smearedUncorrectedJetsForPFMEtByMVA"+postfix, cms.EDProducer("SmearedPFJetProducer",
917  src = cms.InputTag('ak4PFJets'),
918  jetCorrLabel = cms.string("ak4PFL1FastL2L3"),
919  dRmaxGenJetMatch = cms.string('TMath::Min(0.5, 0.1 + 0.3*TMath::Exp(-0.05*(genJetPt - 10.)))'),
920  sigmaMaxGenJetMatch = cms.double(5.),
921  inputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/pfJetResolutionMCtoDataCorrLUT.root'),
922  lutName = cms.string('pfJetResolutionMCtoDataCorrLUT'),
923  jetResolutions = jetResolutions.METSignificance_params,
924  skipRawJetPtThreshold = cms.double(10.), # GeV
925  skipCorrJetPtThreshold = cms.double(1.e-2),
926  srcGenJets = cms.InputTag('ak4GenJetsNoNu')
927  ))
928  metUncertaintySequence += getattr(process, "smearedUncorrectedJetsForPFMEtByMVA"+postfix)
929  getattr(process, "calibratedAK5PFJetsForPFMEtMVA"+postfix).src = cms.InputTag('smearedUncorrectedJetsForPFMEtByMVA'+postfix)
930  getattr(process, "pfMEtMVA"+postfix).srcUncorrJets = cms.InputTag('smearedUncorrectedJetsForPFMEtByMVA'+postfix)
931  metUncertaintySequence += getattr(process, "calibratedAK5PFJetsForPFMEtMVA"+postfix)
932  setattr(process, "smearedCorrectedJetsForPFMEtByMVA"+postfix, getattr(process, "smearedUncorrectedJetsForPFMEtByMVA"+postfix).clone(
933  src = cms.InputTag('calibratedAK5PFJetsForPFMEtMVA'+postfix),
934  jetCorrLabel = cms.string("")
935  ))
936  metUncertaintySequence += getattr(process, "smearedCorrectedJetsForPFMEtByMVA"+postfix)
937  getattr(process, "pfMEtMVA"+postfix).srcCorrJets = cms.InputTag('smearedCorrectedJetsForPFMEtByMVA'+postfix)
938  metUncertaintySequence += getattr(process, "pfMEtMVA"+postfix)
939  else:
940  metUncertaintySequence += getattr(process, "pfMEtMVAsequence"+postfix)
941  self._addPATMEtProducer(process, metUncertaintySequence,
942  'pfMEtMVA'+postfix, 'patPFMetMVA', collectionsToKeep, postfix)
943 
944  for leptonCollection in [ [ 'Electron', 'En', 'electronCollection', 0.3 ],
945  [ 'Photon', 'En', 'photonCollection', 0.3 ],
946  [ 'Muon', 'En', 'muonCollection', 0.3 ],
947  [ 'Tau', 'En', 'tauCollection', 0.3 ] ]:
948  if self._isValidInputTag(shiftedParticleCollections[leptonCollection[2]]):
949  pfCandCollectionLeptonShiftUp, pfCandCollectionLeptonShiftDown = \
951  process, metUncertaintySequence,
952  shiftedParticleCollections['%s' % leptonCollection[2]], leptonCollection[0], leptonCollection[1],
953  shiftedParticleCollections['%s%sUp' % (leptonCollection[2], leptonCollection[1])],
954  shiftedParticleCollections['%s%sDown' % (leptonCollection[2], leptonCollection[1])],
955  leptonCollection[3],
956  pfCandCollection, postfix)
957  modulePFMEtLeptonShiftUp = getattr(process, "pfMEtMVA"+postfix).clone(
958  srcPFCandidates = cms.InputTag(pfCandCollectionLeptonShiftUp),
959  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(
960  shiftedParticleCollections, leptonCollection[2], '%s%sUp' % (leptonCollection[2], leptonCollection[1]), postfix=postfix))
961  )
962  modulePFMEtLeptonShiftUpName = "pfMEtMVA%s%sUp" % (leptonCollection[0], leptonCollection[1])
963  modulePFMEtLeptonShiftUpName += postfix
964  setattr(process, modulePFMEtLeptonShiftUpName, modulePFMEtLeptonShiftUp)
965  metUncertaintySequence += modulePFMEtLeptonShiftUp
966  self._addPATMEtProducer(process, metUncertaintySequence,
967  modulePFMEtLeptonShiftUpName, 'patPFMetMVA%s%sUp' % (leptonCollection[0], leptonCollection[1]), collectionsToKeep, postfix)
968  modulePFMEtLeptonShiftDown = getattr(process, "pfMEtMVA"+postfix).clone(
969  srcPFCandidates = cms.InputTag(pfCandCollectionLeptonShiftDown),
970  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(
971  shiftedParticleCollections, leptonCollection[2], '%s%sDown' % (leptonCollection[2], leptonCollection[1]), postfix=postfix))
972  )
973  modulePFMEtLeptonShiftDownName = "pfMEtMVA%s%sDown" % (leptonCollection[0], leptonCollection[1])
974  modulePFMEtLeptonShiftDownName += postfix
975  setattr(process, modulePFMEtLeptonShiftDownName, modulePFMEtLeptonShiftDown)
976  metUncertaintySequence += modulePFMEtLeptonShiftDown
977  self._addPATMEtProducer(process, metUncertaintySequence,
978  modulePFMEtLeptonShiftDownName, 'patPFMetMVA%s%sDown' % (leptonCollection[0], leptonCollection[1]), collectionsToKeep, postfix)
979 
980  if self._isValidInputTag(shiftedParticleCollections['jetCollection']):
981  setattr(process, "uncorrectedJetsEnUpForPFMEtByMVA"+postfix, cms.EDProducer("ShiftedPFJetProducer",
982  src = cms.InputTag(lastUncorrectedJetCollectionForPFMEtByMVA),
983  jetCorrInputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/Summer12_V2_DATA_AK5PF_UncertaintySources.txt'),
984  jetCorrUncertaintyTag = cms.string("SubTotalDataMC"),
985  addResidualJES = cms.bool(True),
986  jetCorrLabelUpToL3 = cms.string("ak4PFL1FastL2L3"),
987  jetCorrLabelUpToL3Res = cms.string("ak4PFL1FastL2L3Residual"),
988  shiftBy = cms.double(+1.*varyByNsigmas)
989  ))
990  metUncertaintySequence += getattr(process, "uncorrectedJetsEnUpForPFMEtByMVA"+postfix)
991  setattr(process, "uncorrectedJetsEnDownForPFMEtByMVA"+postfix, getattr(process, "uncorrectedJetsEnUpForPFMEtByMVA"+postfix).clone(
992  shiftBy = cms.double(-1.*varyByNsigmas)
993  ))
994  metUncertaintySequence += getattr(process, "uncorrectedJetsEnDownForPFMEtByMVA"+postfix)
995  setattr(process, "correctedJetsEnUpForPFMEtByMVA"+postfix, getattr(process, "uncorrectedJetsEnUpForPFMEtByMVA"+postfix).clone(
996  src = cms.InputTag(lastCorrectedJetCollectionForPFMEtByMVA),
997  addResidualJES = cms.bool(False),
998  shiftBy = cms.double(+1.*varyByNsigmas)
999  ))
1000  metUncertaintySequence += getattr(process, "correctedJetsEnUpForPFMEtByMVA"+postfix)
1001  setattr(process, "correctedJetsEnDownForPFMEtByMVA"+postfix, getattr(process, "correctedJetsEnUpForPFMEtByMVA"+postfix).clone(
1002  shiftBy = cms.double(-1.*varyByNsigmas)
1003  ))
1004  metUncertaintySequence += getattr(process, "correctedJetsEnDownForPFMEtByMVA"+postfix)
1005  pfCandCollectionJetEnUp, pfCandCollectionJetEnDown = \
1007  process, metUncertaintySequence,
1008  shiftedParticleCollections['lastJetCollection'], "Jet", "En",
1009  shiftedParticleCollections['jetCollectionEnUpForCorrMEt'], shiftedParticleCollections['jetCollectionEnDownForCorrMEt'],
1010  0.5,
1011  pfCandCollection, postfix)
1012  setattr(process, "pfMEtMVAJetEnUp"+postfix, getattr(process, "pfMEtMVA").clone(
1013  srcCorrJets = cms.InputTag('correctedJetsEnUpForPFMEtByMVA'+postfix),
1014  srcUncorrJets = cms.InputTag('uncorrectedJetsEnUpForPFMEtByMVA'+postfix),
1015  srcPFCandidates = cms.InputTag(pfCandCollectionJetEnUp),
1016  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1017  ))
1018  metUncertaintySequence += getattr(process, "pfMEtMVAJetEnUp"+postfix)
1019  self._addPATMEtProducer(process, metUncertaintySequence,
1020  'pfMEtMVAJetEnUp'+postfix, 'patPFMetMVAJetEnUp', collectionsToKeep, postfix)
1021  setattr(process, "pfMEtMVAJetEnDown"+postfix, getattr(process, "pfMEtMVA"+postfix).clone(
1022  srcCorrJets = cms.InputTag('correctedJetsEnDownForPFMEtByMVA'+postfix),
1023  srcUncorrJets = cms.InputTag('uncorrectedJetsEnDownForPFMEtByMVA'+postfix),
1024  srcPFCandidates = cms.InputTag(pfCandCollectionJetEnDown),
1025  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1026  ))
1027  metUncertaintySequence += getattr(process, "pfMEtMVAJetEnDown"+postfix)
1028  self._addPATMEtProducer(process, metUncertaintySequence,
1029  'pfMEtMVAJetEnDown'+postfix, 'patPFMetMVAJetEnDown', collectionsToKeep, postfix)
1030 
1031  if hasattr(process, "smearedUncorrectedJetsForPFMEtByMVA"+postfix):
1032  setattr(process, "uncorrectedJetsResUpForPFMEtByMVA"+postfix, getattr(process, "smearedUncorrectedJetsForPFMEtByMVA"+postfix).clone(
1033  shiftBy = cms.double(-1.*varyByNsigmas)
1034  ))
1035  metUncertaintySequence += getattr(process, "uncorrectedJetsResUpForPFMEtByMVA"+postfix)
1036  setattr(process, "uncorrectedJetsResDownForPFMEtByMVA"+postfix, getattr(process, "smearedUncorrectedJetsForPFMEtByMVA"+postfix).clone(
1037  shiftBy = cms.double(+1.*varyByNsigmas)
1038  ))
1039  metUncertaintySequence += getattr(process, "uncorrectedJetsResDownForPFMEtByMVA"+postfix)
1040  setattr(process, "correctedJetsResUpForPFMEtByMVA"+postfix, getattr(process, "smearedCorrectedJetsForPFMEtByMVA"+postfix).clone(
1041  shiftBy = cms.double(-1.*varyByNsigmas)
1042  ))
1043  metUncertaintySequence += getattr(process, "correctedJetsResUpForPFMEtByMVA"+postfix)
1044  setattr(process, "correctedJetsResDownForPFMEtByMVA"+postfix, getattr(process, "smearedCorrectedJetsForPFMEtByMVA"+postfix).clone(
1045  shiftBy = cms.double(+1.*varyByNsigmas)
1046  ))
1047  metUncertaintySequence += getattr(process, "correctedJetsResDownForPFMEtByMVA"+postfix)
1048  pfCandCollectionJetResUp, pfCandCollectionJetResDown = \
1050  process, metUncertaintySequence,
1051  shiftedParticleCollections['jetCollection'], "Jet", "Res",
1052  shiftedParticleCollections['jetCollectionResUp'], shiftedParticleCollections['jetCollectionResDown'],
1053  0.5,
1054  pfCandCollection, postfix)
1055  setattr(process, "pfMEtMVAJetResUp"+postfix, getattr(process, "pfMEtMVA"+postfix).clone(
1056  srcCorrJets = cms.InputTag('correctedJetsResUpForPFMEtByMVA'+postfix),
1057  srcUncorrJets = cms.InputTag('uncorrectedJetsResUpForPFMEtByMVA'+postfix),
1058  srcPFCandidates = cms.InputTag(pfCandCollectionJetResUp),
1059  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1060  ))
1061  metUncertaintySequence += getattr(process, "pfMEtMVAJetResUp"+postfix)
1062  self._addPATMEtProducer(process, metUncertaintySequence,
1063  'pfMEtMVAJetResUp'+postfix, 'patPFMetMVAJetResUp', collectionsToKeep, postfix)
1064  setattr(process, "pfMEtMVAJetResDown"+postfix, getattr(process, "pfMEtMVA"+postfix).clone(
1065  srcCorrJets = cms.InputTag('correctedJetsResDownForPFMEtByMVA'+postfix),
1066  srcUncorrJets = cms.InputTag('uncorrectedJetsResDownForPFMEtByMVA'+postfix),
1067  srcPFCandidates = cms.InputTag(pfCandCollectionJetResDown),
1068  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1069  ))
1070  metUncertaintySequence += getattr(process, "pfMEtMVAJetResDown"+postfix)
1071  self._addPATMEtProducer(process, metUncertaintySequence,
1072  'pfMEtMVAJetResDown'+postfix, 'patPFMetMVAJetResDown', collectionsToKeep, postfix)
1073 
1074  setattr(process, "pfCandsNotInJetUnclusteredEnUpForPFMEtByMVA"+postfix, cms.EDProducer("ShiftedPFCandidateProducer",
1075  src = cms.InputTag('pfCandsNotInJet'),
1076  shiftBy = cms.double(+1.*varyByNsigmas),
1077  uncertainty = cms.double(0.10)
1078  ))
1079  metUncertaintySequence += getattr(process, "pfCandsNotInJetUnclusteredEnUpForPFMEtByMVA"+postfix)
1080  setattr(process, "pfCandsNotInJetUnclusteredEnDownForPFMEtByMVA"+postfix, getattr(process, "pfCandsNotInJetUnclusteredEnUpForPFMEtByMVA"+postfix).clone(
1081  shiftBy = cms.double(-1.*varyByNsigmas)
1082  ))
1083  metUncertaintySequence += getattr(process, "pfCandsNotInJetUnclusteredEnDownForPFMEtByMVA"+postfix)
1084  pfCandCollectionUnclusteredEnUp, pfCandCollectionUnclusteredEnDown = \
1086  process, metUncertaintySequence,
1087  pfCandCollection, "Unclustered", "En",
1088  'pfCandsNotInJetUnclusteredEnUpForPFMEtByMVA'+postfix, 'pfCandsNotInJetUnclusteredEnDownForPFMEtByMVA'+postfix, #fixme MM
1089  0.01,
1090  pfCandCollection, postfix)
1091  setattr(process, "pfMEtMVAUnclusteredEnUp"+postfix, getattr(process, "pfMEtMVA"+postfix).clone(
1092  srcPFCandidates = cms.InputTag(pfCandCollectionUnclusteredEnUp),
1093  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1094  ))
1095  metUncertaintySequence += getattr(process, "pfMEtMVAUnclusteredEnUp"+postfix)
1096  self._addPATMEtProducer(process, metUncertaintySequence,
1097  'pfMEtMVAUnclusteredEnUp'+postfix, 'patPFMetMVAUnclusteredEnUp', collectionsToKeep, postfix)
1098  setattr(process, "pfMEtMVAUnclusteredEnDown"+postfix, getattr(process, "pfMEtMVA"+postfix).clone(
1099  srcPFCandidates = cms.InputTag(pfCandCollectionUnclusteredEnDown),
1100  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix=postfix))
1101  ))
1102  metUncertaintySequence += getattr(process, "pfMEtMVAUnclusteredEnDown"+postfix)
1103  self._addPATMEtProducer(process, metUncertaintySequence,
1104  'pfMEtMVAUnclusteredEnDown'+postfix, 'patPFMetMVAUnclusteredEnDown', collectionsToKeep, postfix)
1105 
# IN HERE
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def metUncertaintyTools.RunMEtUncertainties._addShiftedParticleCollections (   self,
  process,
  electronCollection,
  photonCollection,
  muonCollection,
  tauCollection,
  jetCollection,
  cleanedJetCollection,
  lastJetCollection,
  jetCollectionResUp,
  jetCollectionResDown,
  varyByNsigmas,
  postfix 
)
private

Definition at line 227 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addCorrPFMEt(), metUncertaintyTools.RunMEtUncertainties._addModuleToSequence(), and metUncertaintyTools.RunMEtUncertainties._isValidInputTag().

Referenced by metUncertaintyTools.RunMEtUncertainties._isValidInputTag(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

228  postfix):
229 
230  shiftedParticlesForMEtUncertainties = cms.Sequence()
231  setattr(process, "shiftedParticlesForMEtUncertainties"+postfix, shiftedParticlesForMEtUncertainties)
232 
233  shiftedParticleCollections = {}
234  shiftedParticleCollections['electronCollection'] = electronCollection
235  shiftedParticleCollections['photonCollection'] = photonCollection
236  shiftedParticleCollections['muonCollection'] = muonCollection
237  shiftedParticleCollections['tauCollection'] = tauCollection
238  shiftedParticleCollections['jetCollection'] = jetCollection
239  shiftedParticleCollections['cleanedJetCollection'] = cleanedJetCollection
240  shiftedParticleCollections['lastJetCollection'] = lastJetCollection
241  shiftedParticleCollections['jetCollectionResUp'] = jetCollectionResUp
242  shiftedParticleCollections['jetCollectionResDown'] = jetCollectionResDown
243  collectionsToKeep = []
244 
245  #--------------------------------------------------------------------------------------------
246  # produce collection of jets shifted up/down in energy
247  #--------------------------------------------------------------------------------------------
248 
249  # in case of "raw" (uncorrected) MET,
250  # add residual jet energy corrections in quadrature to jet energy uncertainties:
251  # cf. https://twiki.cern.ch/twiki/bin/view/CMS/MissingETUncertaintyPrescription
252  jetsEnUpForRawMEt = cms.EDProducer("ShiftedPATJetProducer",
253  src = cms.InputTag(lastJetCollection),
254  #jetCorrPayloadName = cms.string(jetCorrPayloadName),
255  #jetCorrUncertaintyTag = cms.string('Uncertainty'),
256  jetCorrInputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/Summer12_V2_DATA_AK5PF_UncertaintySources.txt'),
257  jetCorrUncertaintyTag = cms.string("SubTotalDataMC"),
258  addResidualJES = cms.bool(True),
259  jetCorrLabelUpToL3 = cms.string("ak4PFL1FastL2L3"),
260  jetCorrLabelUpToL3Res = cms.string("ak4PFL1FastL2L3Residual"),
261  shiftBy = cms.double(+1.*varyByNsigmas)
262  )
263  jetCollectionEnUpForRawMEt = \
264  self._addModuleToSequence(process, jetsEnUpForRawMEt,
265  [ "shifted", jetCollection.value(), "EnUpForRawMEt" ],
266  shiftedParticlesForMEtUncertainties, postfix)
267  shiftedParticleCollections['jetCollectionEnUpForRawMEt'] = jetCollectionEnUpForRawMEt
268  collectionsToKeep.append(jetCollectionEnUpForRawMEt)
269  jetsEnDownForRawMEt = jetsEnUpForRawMEt.clone(
270  shiftBy = cms.double(-1.*varyByNsigmas)
271  )
272  jetCollectionEnDownForRawMEt = \
273  self._addModuleToSequence(process, jetsEnDownForRawMEt,
274  [ "shifted", jetCollection.value(), "EnDownForRawMEt" ],
275  shiftedParticlesForMEtUncertainties, postfix)
276  shiftedParticleCollections['jetCollectionEnDownForRawMEt'] = jetCollectionEnDownForRawMEt
277  collectionsToKeep.append(jetCollectionEnDownForRawMEt)
278 
279  jetsEnUpForCorrMEt = jetsEnUpForRawMEt.clone(
280  addResidualJES = cms.bool(False)
281  )
282  jetCollectionEnUpForCorrMEt = \
283  self._addModuleToSequence(process, jetsEnUpForCorrMEt,
284  [ "shifted", jetCollection.value(), "EnUpForCorrMEt" ],
285  shiftedParticlesForMEtUncertainties, postfix)
286  shiftedParticleCollections['jetCollectionEnUpForCorrMEt'] = jetCollectionEnUpForCorrMEt
287  collectionsToKeep.append(jetCollectionEnUpForCorrMEt)
288  jetsEnDownForCorrMEt = jetsEnUpForCorrMEt.clone(
289  shiftBy = cms.double(-1.*varyByNsigmas)
290  )
291  jetCollectionEnDownForCorrMEt = \
292  self._addModuleToSequence(process, jetsEnDownForCorrMEt,
293  [ "shifted", jetCollection.value(), "EnDownForCorrMEt" ],
294  shiftedParticlesForMEtUncertainties, postfix)
295  shiftedParticleCollections['jetCollectionEnDownForCorrMEt'] = jetCollectionEnDownForCorrMEt
296  collectionsToKeep.append(jetCollectionEnDownForCorrMEt)
297 
298  #--------------------------------------------------------------------------------------------
299  # produce collection of electrons shifted up/down in energy
300  #--------------------------------------------------------------------------------------------
301 
302  electronCollectionEnUp = None
303  electronCollectionEnDown = None
304  if self._isValidInputTag(electronCollection):
305  electronsEnUp = cms.EDProducer("ShiftedPATElectronProducer",
306  src = electronCollection,
307  binning = cms.VPSet(
308  cms.PSet(
309  binSelection = cms.string('isEB'),
310  binUncertainty = cms.double(0.006)
311  ),
312  cms.PSet(
313  binSelection = cms.string('!isEB'),
314  binUncertainty = cms.double(0.015)
315  ),
316  ),
317  shiftBy = cms.double(+1.*varyByNsigmas)
318  )
319  electronCollectionEnUp = \
320  self._addModuleToSequence(process, electronsEnUp,
321  [ "shifted", electronCollection.value(), "EnUp" ],
322  shiftedParticlesForMEtUncertainties, postfix)
323  shiftedParticleCollections['electronCollectionEnUp'] = electronCollectionEnUp
324  collectionsToKeep.append(electronCollectionEnUp)
325  electronsEnDown = electronsEnUp.clone(
326  shiftBy = cms.double(-1.*varyByNsigmas)
327  )
328  electronCollectionEnDown = \
329  self._addModuleToSequence(process, electronsEnDown,
330  [ "shifted", electronCollection.value(), "EnDown" ],
331  shiftedParticlesForMEtUncertainties, postfix)
332  shiftedParticleCollections['electronCollectionEnDown'] = electronCollectionEnDown
333  collectionsToKeep.append(electronCollectionEnDown)
334 
335  #--------------------------------------------------------------------------------------------
336  # produce collection of (high Pt) photon candidates shifted up/down in energy
337  #--------------------------------------------------------------------------------------------
338 
339  photonCollectionEnUp = None
340  photonCollectionEnDown = None
341  if self._isValidInputTag(photonCollection):
342  photonsEnUp = cms.EDProducer("ShiftedPATPhotonProducer",
343  src = photonCollection,
344  binning = cms.VPSet(
345  cms.PSet(
346  binSelection = cms.string('isEB = true'),
347  binUncertainty = cms.double(0.01)
348  ),
349  cms.PSet(
350  binSelection = cms.string('isEB = false'),
351  binUncertainty = cms.double(0.025)
352  ),
353  ),
354  shiftBy = cms.double(+1.*varyByNsigmas)
355  )
356  photonCollectionEnUp = \
357  self._addModuleToSequence(process, photonsEnUp,
358  [ "shifted", photonCollection.value(), "EnUp" ],
359  shiftedParticlesForMEtUncertainties, postfix)
360  shiftedParticleCollections['photonCollectionEnUp'] = photonCollectionEnUp
361  collectionsToKeep.append(photonCollectionEnUp)
362  photonsEnDown = photonsEnUp.clone(
363  shiftBy = cms.double(-1.*varyByNsigmas)
364  )
365  photonCollectionEnDown = \
366  self._addModuleToSequence(process, photonsEnDown,
367  [ "shifted", photonCollection.value(), "EnDown" ],
368  shiftedParticlesForMEtUncertainties, postfix)
369  shiftedParticleCollections['photonCollectionEnDown'] = photonCollectionEnDown
370  collectionsToKeep.append(photonCollectionEnDown)
371 
372  #--------------------------------------------------------------------------------------------
373  # produce collection of muons shifted up/down in energy/momentum
374  #--------------------------------------------------------------------------------------------
375 
376  muonCollectionEnUp = None
377  muonCollectionEnDown = None
378  if self._isValidInputTag(muonCollection):
379  muonsEnUp = cms.EDProducer("ShiftedPATMuonProducer",
380  src = muonCollection,
381  uncertainty = cms.double(0.002),
382  shiftBy = cms.double(+1.*varyByNsigmas)
383  )
384  muonCollectionEnUp = \
385  self._addModuleToSequence(process, muonsEnUp,
386  [ "shifted", muonCollection.value(), "EnUp" ],
387  shiftedParticlesForMEtUncertainties, postfix)
388  shiftedParticleCollections['muonCollectionEnUp'] = muonCollectionEnUp
389  collectionsToKeep.append(muonCollectionEnUp)
390  muonsEnDown = muonsEnUp.clone(
391  shiftBy = cms.double(-1.*varyByNsigmas)
392  )
393  muonCollectionEnDown = \
394  self._addModuleToSequence(process, muonsEnDown,
395  [ "shifted", muonCollection.value(), "EnDown" ],
396  shiftedParticlesForMEtUncertainties, postfix)
397  shiftedParticleCollections['muonCollectionEnDown'] = muonCollectionEnDown
398  collectionsToKeep.append(muonCollectionEnDown)
399 
400  #--------------------------------------------------------------------------------------------
401  # produce collection of tau-jets shifted up/down in energy
402  #--------------------------------------------------------------------------------------------
403 
404  tauCollectionEnUp = None
405  tauCollectionEnDown = None
406  if self._isValidInputTag(tauCollection):
407  tausEnUp = cms.EDProducer("ShiftedPATTauProducer",
408  src = tauCollection,
409  uncertainty = cms.double(0.03),
410  shiftBy = cms.double(+1.*varyByNsigmas)
411  )
412  tauCollectionEnUp = \
413  self._addModuleToSequence(process, tausEnUp,
414  [ "shifted", tauCollection.value(), "EnUp" ],
415  shiftedParticlesForMEtUncertainties, postfix)
416  shiftedParticleCollections['tauCollectionEnUp'] = tauCollectionEnUp
417  collectionsToKeep.append(tauCollectionEnUp)
418  tausEnDown = tausEnUp.clone(
419  shiftBy = cms.double(-1.*varyByNsigmas)
420  )
421  tauCollectionEnDown = \
422  self._addModuleToSequence(process, tausEnDown,
423  [ "shifted", tauCollection.value(), "EnDown" ],
424  shiftedParticlesForMEtUncertainties, postfix)
425  shiftedParticleCollections['tauCollectionEnDown'] = tauCollectionEnDown
426  collectionsToKeep.append(tauCollectionEnDown)
427 
428  return ( shiftedParticleCollections, collectionsToKeep )
def metUncertaintyTools.RunMEtUncertainties._addSmearedJets (   self,
  process,
  jetCollection,
  smearedJetCollectionName_parts,
  jetSmearFileName,
  jetSmearHistogram,
  varyByNsigmas,
  shiftBy = None,
  postfix = "" 
)
private

Definition at line 108 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addModuleToSequence(), and metUncertaintyTools.RunMEtUncertainties._propagateMEtUncertainties().

Referenced by metUncertaintyTools.RunMEtUncertainties._addModuleToSequence(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

109  shiftBy = None, postfix = ""):
110 
111  smearedJets = cms.EDProducer("SmearedPATJetProducer",
112  src = cms.InputTag(jetCollection),
113  dRmaxGenJetMatch = cms.string('TMath::Min(0.5, 0.1 + 0.3*TMath::Exp(-0.05*(genJetPt - 10.)))'),
114  sigmaMaxGenJetMatch = cms.double(5.),
115  inputFileName = cms.FileInPath(jetSmearFileName),
116  lutName = cms.string(jetSmearHistogram),
117  jetResolutions = jetResolutions.METSignificance_params,
118  # CV: skip jet smearing for pat::Jets for which the jet-energy correction (JEC) factors are either very large or negative
119  # since both cases produce unphysically large tails in the Type 1 corrected MET distribution after the smearing,
120  #
121  # e.g. raw jet: energy = 50 GeV, eta = 2.86, pt = 1 GeV
122  # corr. jet: energy = -3 GeV , pt = -0.1 GeV (JEC factor L1fastjet*L2*L3 = -17)
123  # energy = 10 GeV for corrected jet after smearing
124  # --> smeared raw jet energy = -170 GeV !!
125  #
126  # --> (corr. - raw) jet contribution to MET = -1 (-10) GeV before (after) smearing,
127  # even though jet energy got smeared by merely 1 GeV
128  #
129  skipJetSelection = cms.string(
130  'jecSetsAvailable & abs(energy - correctedP4("Uncorrected").energy) > (5.*min(energy, correctedP4("Uncorrected").energy))'
131  ),
132  skipRawJetPtThreshold = cms.double(10.), # GeV
133  skipCorrJetPtThreshold = cms.double(1.e-2)
134  )
135  if shiftBy is not None:
136  setattr(smearedJets, "shiftBy", cms.double(shiftBy*varyByNsigmas))
137  smearedJetCollection = \
138  self._addModuleToSequence(process, smearedJets,
139  smearedJetCollectionName_parts,
140  getattr(process, "metUncertaintySequence"+postfix), postfix)
141 
142  return smearedJetCollection
def metUncertaintyTools.RunMEtUncertainties._getLeptonsForPFMEtInput (   self,
  shiftedParticleCollections,
  substituteKeyUnshifted = None,
  substituteKeyShifted = None,
  postfix = "" 
)
private

Definition at line 861 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addPATMEtProducer(), and metUncertaintyTools.RunMEtUncertainties._isValidInputTag().

Referenced by metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt(), and metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA().

862  def _getLeptonsForPFMEtInput(self, shiftedParticleCollections, substituteKeyUnshifted = None, substituteKeyShifted = None, postfix=""):
863  retVal = []
864  for collectionName in [ 'electronCollection',
865  'photonCollection',
866  'muonCollection',
867  'tauCollection' ]:
868  if self._isValidInputTag(shiftedParticleCollections[collectionName]):
869  if substituteKeyUnshifted is not None and substituteKeyUnshifted in shiftedParticleCollections.keys() and \
870  substituteKeyShifted is not None and substituteKeyShifted in shiftedParticleCollections.keys() and \
871  shiftedParticleCollections[collectionName] == shiftedParticleCollections[substituteKeyUnshifted]:
872  retVal.append(cms.InputTag(shiftedParticleCollections[substituteKeyShifted]))
873  else:
874  retVal.append(shiftedParticleCollections[collectionName])
875  return retVal
def metUncertaintyTools.RunMEtUncertainties._initializeInputTag (   self,
  input,
  default 
)
private

Definition at line 199 of file metUncertaintyTools.py.

References metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, metUncertaintyTools.RunMEtUncertainties._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

Referenced by metUncertaintyTools.RunMEtUncertainties.__call__().

200  def _initializeInputTag(self, input, default):
201  retVal = None
202  if input is None:
203  retVal = self._defaultParameters[default].value
204  elif type(input) == str:
205  retVal = cms.InputTag(input)
206  else:
207  retVal = input
208  return retVal
def metUncertaintyTools.RunMEtUncertainties._isValidInputTag (   input)
staticprivate

Definition at line 210 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addShiftedParticleCollections().

Referenced by metUncertaintyTools.RunMEtUncertainties._addCorrPFMEt(), metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt(), metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA(), metUncertaintyTools.RunMEtUncertainties._addShiftedParticleCollections(), metUncertaintyTools.RunMEtUncertainties._getLeptonsForPFMEtInput(), and metUncertaintyTools.RunMEtUncertainties.toolCode().

211  def _isValidInputTag(input):
212  input_str = input
213  if isinstance(input, cms.InputTag):
214  input_str = input.value()
215  if input is None or input_str == '""':
216  return False
217  else:
218  return True
def metUncertaintyTools.RunMEtUncertainties._propagateMEtUncertainties (   self,
  process,
  particleCollection,
  particleType,
  shiftType,
  particleCollectionShiftUp,
  particleCollectionShiftDown,
  metProducer,
  sequence,
  postfix 
)
private

Definition at line 145 of file metUncertaintyTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties._addCorrPFMEt(), and metUncertaintyTools.RunMEtUncertainties._addSmearedJets().

146  metProducer, sequence, postfix):
147 
148  # produce MET correction objects
149  # (sum of differences in four-momentum between original and up/down shifted particle collection)
150  moduleMETcorrShiftUp = cms.EDProducer("ShiftedParticleMETcorrInputProducer",
151  srcOriginal = cms.InputTag(particleCollection),
152  srcShifted = cms.InputTag(particleCollectionShiftUp)
153  )
154  moduleMETcorrShiftUpName = "patPFMETcorr%s%sUp" % (particleType, shiftType)
155  moduleMETcorrShiftUpName += postfix
156  setattr(process, moduleMETcorrShiftUpName, moduleMETcorrShiftUp)
157  sequence += moduleMETcorrShiftUp
158  moduleMETcorrShiftDown = moduleMETcorrShiftUp.clone(
159  srcShifted = cms.InputTag(particleCollectionShiftDown)
160  )
161  moduleMETcorrShiftDownName = "patPFMETcorr%s%sDown" % (particleType, shiftType)
162  moduleMETcorrShiftDownName += postfix
163  setattr(process, moduleMETcorrShiftDownName, moduleMETcorrShiftDown)
164  sequence += moduleMETcorrShiftDown
165 
166  # propagate effects of up/down shifts to MET
167  moduleMETshiftUp = metProducer.clone(
168  src = cms.InputTag(metProducer.label()),
169  srcType1Corrections = cms.VInputTag(
170  cms.InputTag(moduleMETcorrShiftUpName)
171  )
172  )
173  metProducerLabel = metProducer.label()
174  if postfix != "":
175  if metProducerLabel[-len(postfix):] == postfix:
176  metProducerLabel = metProducerLabel[0:-len(postfix)]
177  else:
178  raise StandardError("Tried to remove postfix %s from label %s, but it wasn't there" % (postfix, metProducerLabel))
179  moduleMETshiftUpName = "%s%s%sUp" % (metProducerLabel, particleType, shiftType)
180  moduleMETshiftUpName += postfix
181  setattr(process, moduleMETshiftUpName, moduleMETshiftUp)
182  sequence += moduleMETshiftUp
183  moduleMETshiftDown = moduleMETshiftUp.clone(
184  srcType1Corrections = cms.VInputTag(
185  cms.InputTag(moduleMETcorrShiftDownName)
186  )
187  )
188  moduleMETshiftDownName = "%s%s%sDown" % (metProducerLabel, particleType, shiftType)
189  moduleMETshiftDownName += postfix
190  setattr(process, moduleMETshiftDownName, moduleMETshiftDown)
191  sequence += moduleMETshiftDown
192 
193  metCollectionsUp_Down = [
194  moduleMETshiftUpName,
195  moduleMETshiftDownName
196  ]
197 
198  return metCollectionsUp_Down
def metUncertaintyTools.RunMEtUncertainties.getDefaultParameters (   self)

Definition at line 71 of file metUncertaintyTools.py.

References metTools.AddMETCollection._defaultParameters, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, metUncertaintyTools.RunMEtUncertainties._defaultParameters, jetTools.AddJetCollection._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, trackTools.MakePATTrackCandidates._defaultParameters, trigTools.SwitchOnTrigger._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, trigTools.SwitchOnTriggerStandAlone._defaultParameters, trackTools.MakeTrackCandidates._defaultParameters, tauTools.AddTauCollection._defaultParameters, trigTools.SwitchOnTriggerMatching._defaultParameters, trigTools.SwitchOnTriggerMatchingStandAlone._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.AddJetID._defaultParameters, and jetTools.SetTagInfos._defaultParameters.

71 
72  def getDefaultParameters(self):
73  return self._defaultParameters
def metUncertaintyTools.RunMEtUncertainties.toolCode (   self,
  process 
)

Definition at line 1463 of file metUncertaintyTools.py.

References metUncertaintyTools.RunMEtUncertainties._addCorrPFMEt(), trigTools._addEventContent(), metUncertaintyTools.RunMEtUncertainties._addModuleToSequence(), metUncertaintyTools.RunMEtUncertainties._addNoPileUpPFMEt(), metUncertaintyTools.RunMEtUncertainties._addPFMEtByMVA(), metUncertaintyTools.RunMEtUncertainties._addShiftedParticleCollections(), metUncertaintyTools.RunMEtUncertainties._addSmearedJets(), metUncertaintyTools.RunMEtUncertainties._isValidInputTag(), editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, HiCoreTools.RestrictInputToAOD._parameters, coreTools.RunOnData._parameters, trackTools.MakeAODTrackCandidates._parameters, metTools.AddMETCollection._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, HiCoreTools.RemoveMCMatching._parameters, jetTools.AddJetCollection._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, trackTools.MakePATTrackCandidates._parameters, trigTools.SwitchOnTrigger._parameters, heavyIonTools.SelectionDefaults._parameters, HiCoreTools.RemoveAllPATObjectsBut._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, HiCoreTools.RemoveSpecificPATObjects._parameters, trigTools.SwitchOnTriggerStandAlone._parameters, trackTools.MakeTrackCandidates._parameters, tauTools.AddTauCollection._parameters, trigTools.SwitchOnTriggerMatching._parameters, HiCoreTools.RemoveCleaning._parameters, HiCoreTools.AddCleaning._parameters, trigTools.SwitchOnTriggerMatchingStandAlone._parameters, trigTools.SwitchOnTriggerMatchEmbedding._parameters, jetTools.SwitchJetCollection._parameters, jetTools.AddJetID._parameters, and jetTools.SetTagInfos._parameters.

1464  def toolCode(self, process):
1465  electronCollection = self._parameters['electronCollection'].value
1466  photonCollection = self._parameters['photonCollection'].value
1467  muonCollection = self._parameters['muonCollection'].value
1468  tauCollection = self._parameters['tauCollection'].value
1469  jetCollection = self._parameters['jetCollection'].value
1470  jetCorrLabel = self._parameters['jetCorrLabel'].value
1471  dRjetCleaning = self._parameters['dRjetCleaning'].value
1472  doSmearJets = self._parameters['doSmearJets'].value
1473  makeType1corrPFMEt = self._parameters['makeType1corrPFMEt'].value
1474  makeType1p2corrPFMEt = self._parameters['makeType1p2corrPFMEt'].value
1475  makePFMEtByMVA = self._parameters['makePFMEtByMVA'].value
1476  makeNoPileUpPFMEt = self._parameters['makeNoPileUpPFMEt'].value
1477  doApplyType0corr = self._parameters['doApplyType0corr'].value
1478  sysShiftCorrParameter = self._parameters['sysShiftCorrParameter'].value
1479  doApplySysShiftCorr = self._parameters['doApplySysShiftCorr'].value
1480  jetSmearFileName = self._parameters['jetSmearFileName'].value
1481  jetSmearHistogram = self._parameters['jetSmearHistogram'].value
1482  pfCandCollection = self._parameters['pfCandCollection'].value
1483  jetCorrPayloadName = self._parameters['jetCorrPayloadName'].value
1484  varyByNsigmas = self._parameters['varyByNsigmas'].value
1485  addToPatDefaultSequence = self._parameters['addToPatDefaultSequence'].value
1486  outputModule = self._parameters['outputModule'].value
1487  postfix = self._parameters['postfix'].value
1488 
1489  metUncertaintySequence = cms.Sequence()
1490  setattr(process, "metUncertaintySequence"+postfix, metUncertaintySequence)
1491 
1492  collectionsToKeep = []
1493 
1494  # produce collection of jets not overlapping with reconstructed
1495  # electrons/photons, muons and tau-jet candidates
1496  jetsNotOverlappingWithLeptonsForMEtUncertainty = cms.EDProducer("PATJetCleaner",
1497  src = jetCollection,
1498  preselection = cms.string(''),
1499  checkOverlaps = cms.PSet(),
1500  finalCut = cms.string('')
1501  )
1502  numOverlapCollections = 0
1503  for collection in [
1504  [ 'electrons', electronCollection ],
1505  [ 'photons', photonCollection ],
1506  [ 'muons', muonCollection ],
1507  [ 'taus', tauCollection ] ]:
1508  if self._isValidInputTag(collection[1]):
1509  setattr(jetsNotOverlappingWithLeptonsForMEtUncertainty.checkOverlaps, collection[0], cms.PSet(
1510  src = collection[1],
1511  algorithm = cms.string("byDeltaR"),
1512  preselection = cms.string(""),
1513  deltaR = cms.double(0.5),
1514  checkRecoComponents = cms.bool(False),
1515  pairCut = cms.string(""),
1516  requireNoOverlaps = cms.bool(True),
1517  ))
1518  numOverlapCollections = numOverlapCollections + 1
1519  lastJetCollection = jetCollection.value()
1520  if numOverlapCollections >= 1:
1521  lastJetCollection = \
1522  self._addModuleToSequence(process, jetsNotOverlappingWithLeptonsForMEtUncertainty,
1523  [ jetCollection.value(), "NotOverlappingWithLeptonsForMEtUncertainty" ],
1524  metUncertaintySequence, postfix)
1525  cleanedJetCollection = lastJetCollection
1526 
1527  # smear jet energies to account for difference in jet resolutions between MC and Data
1528  # (cf. JME-10-014 PAS)
1529  jetCollectionResUp = None
1530  jetCollectionResDown = None
1531  if doSmearJets:
1532  lastJetCollection = \
1533  self._addSmearedJets(process, cleanedJetCollection, [ "smeared", jetCollection.value() ],
1534  jetSmearFileName, jetSmearHistogram, varyByNsigmas, postfix=postfix)
1535 
1536  jetCollectionResUp = \
1537  self._addSmearedJets(process, cleanedJetCollection, [ "smeared", jetCollection.value(), "ResUp" ],
1538  jetSmearFileName, jetSmearHistogram, varyByNsigmas,
1539  -1., postfix=postfix)
1540  collectionsToKeep.append(jetCollectionResUp)
1541  jetCollectionResDown = \
1542  self._addSmearedJets(process, cleanedJetCollection, [ "smeared", jetCollection.value(), "ResDown" ],
1543  jetSmearFileName, jetSmearHistogram, varyByNsigmas,
1544  +1., postfix=postfix)
1545  collectionsToKeep.append(jetCollectionResDown)
1546 
1547  collectionsToKeep.append(lastJetCollection)
1548 
1549  #--------------------------------------------------------------------------------------------
1550  # produce collection of electrons/photons, muons, tau-jet candidates and jets
1551  # shifted up/down in energy by their respective energy uncertainties
1552  #--------------------------------------------------------------------------------------------
1553 
1554  shiftedParticleCollections, addCollectionsToKeep = \
1555  self._addShiftedParticleCollections(process,
1556  electronCollection,
1557  photonCollection,
1558  muonCollection,
1559  tauCollection,
1560  jetCollection, cleanedJetCollection, lastJetCollection,
1561  jetCollectionResUp, jetCollectionResDown,
1562  varyByNsigmas,
1563  postfix)
1564  metUncertaintySequence += getattr(process, "shiftedParticlesForMEtUncertainties"+postfix)
1565  collectionsToKeep.extend(addCollectionsToKeep)
1566 
1567  #--------------------------------------------------------------------------------------------
1568  # propagate shifted particle energies to Type 1 and Type 1 + 2 corrected PFMET
1569  #--------------------------------------------------------------------------------------------
1570 
1571  self._addCorrPFMEt(process, metUncertaintySequence,
1572  shiftedParticleCollections, pfCandCollection,
1573  collectionsToKeep,
1574  doSmearJets,
1575  makeType1corrPFMEt,
1576  makeType1p2corrPFMEt,
1577  doApplyType0corr,
1578  sysShiftCorrParameter,
1579  doApplySysShiftCorr,
1580  jetCorrLabel,
1581  varyByNsigmas,
1582  postfix)
1583 
1584  #--------------------------------------------------------------------------------------------
1585  # propagate shifted particle energies to MVA-based PFMET
1586  #--------------------------------------------------------------------------------------------
1587 
1588  self._addPFMEtByMVA(process, metUncertaintySequence,
1589  shiftedParticleCollections, pfCandCollection,
1590  collectionsToKeep,
1591  doSmearJets,
1592  makePFMEtByMVA,
1593  varyByNsigmas,
1594  postfix)
1595 
1596  #--------------------------------------------------------------------------------------------
1597  # propagate shifted particle energies to no-PU PFMET
1598  #--------------------------------------------------------------------------------------------
1599 
1600  self._addNoPileUpPFMEt(process, metUncertaintySequence,
1601  shiftedParticleCollections, pfCandCollection,
1602  collectionsToKeep,
1603  doSmearJets,
1604  makeNoPileUpPFMEt,
1605  varyByNsigmas,
1606  postfix)
1607 
1608  # insert metUncertaintySequence into patDefaultSequence
1609  if hasattr(process,'options') and hasattr(process.options,'allowUnscheduled') and process.options.allowUnscheduled == True:
1610  addToPatDefaultSequence = False
1611  if addToPatDefaultSequence:
1612  if not hasattr(process, "patDefaultSequence"):
1613  raise ValueError("PAT default sequence is not defined !!")
1614  process.patDefaultSequence += metUncertaintySequence
1615 
1616  # add shifted + unshifted collections pf pat::Electrons/Photons,
1617  # Muons, Taus, Jets and MET to PAT-tuple event content
1618  if outputModule is not None and hasattr(process, outputModule):
1619  getattr(process, outputModule).outputCommands = _addEventContent(
1620  getattr(process, outputModule).outputCommands,
1621  [ 'keep *_%s_*_%s' % (collectionToKeep, process.name_()) for collectionToKeep in collectionsToKeep ])
1622 
1623 runMEtUncertainties=RunMEtUncertainties()
def _addEventContent
Definition: trigTools.py:29

Member Data Documentation

tuple metUncertaintyTools.RunMEtUncertainties._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 19 of file metUncertaintyTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), HiCoreTools.RemoveMCMatching.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), metUncertaintyTools.RunMEtUncertainties.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), metUncertaintyTools.RunMEtUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), metUncertaintyTools.RunMEtUncertainties._initializeInputTag(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), metUncertaintyTools.RunMEtUncertainties.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string metUncertaintyTools.RunMEtUncertainties._label = 'runMEtUncertainties'
staticprivate

Definition at line 18 of file metUncertaintyTools.py.