CMS 3D CMS Logo

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

Public Member Functions

def __call__
 
def __init__
 
def toolCode
 

Static Public Attributes

 pfCandCollectionJetEnShift = \
 
 pfCandCollectionUnclusteredEnShift = \
 
tuple shiftBy = cms.double(varDir[var]*varyByNsigmas)
 
tuple src = cms.InputTag("uncorrectedJetsRes%sForPFMVAMEt%s" % (var, postfix) )
 
tuple srcCorrJets = cms.InputTag('correctedJetsEn%sForPFMVAMEt%s' % (var, postfix) )
 
tuple srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix = postfix))
 
tuple srcPFCandidates = cms.InputTag("smearedPFCandidatesJetRes%sForPFMVAMEt%s" %(var, postfix) )
 srcPFCandidates = cms.InputTag(pfCandCollectionJetResShift[ var ]), More...
 
tuple srcShiftedObjects = cms.InputTag("uncorrectedJetsRes%sForPFMVAMEt%s" % (var, postfix) )
 
tuple srcUncorrJets = cms.InputTag('uncorrectedJetsEn%sForPFMVAMEt%s' %(var, postfix) )
 
tuple uncertainty = cms.double(0.10)
 

Private Member Functions

def _addPFMVAMEt
 
def _createUncorrectedJetsModules
 

Static Private Attributes

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

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 MVA MET

Definition at line 14 of file runMVAMEtUncertainties.py.

Constructor & Destructor Documentation

def runMVAMEtUncertainties.RunMVAMEtUncertainties.__init__ (   self)

Definition at line 22 of file runMVAMEtUncertainties.py.

References runMVAMEtUncertainties.RunMVAMEtUncertainties._addPFMVAMEt(), editorTools.UserCodeTool._comment, heavyIonTools.ConfigureHeavyIons._comment, HiCoreTools.RestrictInputToAOD._comment, coreTools.RunOnData._comment, trackTools.MakeAODTrackCandidates._comment, metTools.AddMETCollection._comment, heavyIonTools.ProductionDefaults._comment, ConfigToolBase.ConfigToolBase._comment, editorTools.ChangeSource._comment, HiCoreTools.RemoveMCMatching._comment, coreTools.RemoveMCMatching._comment, cmsswVersionTools.PickRelValInputFiles._comment, trackTools.MakePATTrackCandidates._comment, jetTools.AddJetCollection._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, trackTools.MakeAODTrackCandidates._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, runJetUncertainties.RunJetUncertainties._defaultParameters, jmeUncertaintyTools.JetMEtUncertaintyTools._defaultParameters, runMVAMEtUncertainties.RunMVAMEtUncertainties._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, jetTools.AddJetCollection._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, trigTools.SwitchOnTriggerMatchEmbedding._defaultParameters, jetTools.SwitchJetCollection._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, TAbsFitParticle._parameters, HiCoreTools.RemoveMCMatching._parameters, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, jetTools.AddJetCollection._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().

22 
23  def __init__(self):
JetMEtUncertaintyTools.__init__(self)

Member Function Documentation

def runMVAMEtUncertainties.RunMVAMEtUncertainties.__call__ (   self,
  process,
  electronCollection = None,
  photonCollection = None,
  muonCollection = None,
  tauCollection = None,
  jetCollection = None,
  dRjetCleaning = None,
  jetCorrLabel = None,
  doSmearJets = None,
  jetSmearFileName = None,
  jetSmearHistogram = None,
  pfCandCollection = None,
  jetCorrPayloadName = None,
  jetCorrLabelUpToL3 = None,
  jetCorrLabelUpToL3Res = None,
  jecUncertaintyFile = None,
  jecUncertaintyTag = None,
  varyByNsigmas = None,
  addToPatDefaultSequence = None,
  outputModule = None,
  postfix = None 
)

Definition at line 280 of file runMVAMEtUncertainties.py.

References jmeUncertaintyTools.JetMEtUncertaintyTools._initializeInputTag(), SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), MatrixReader.MatrixReader.apply, HcalDeterministicFit.apply(), DummyOOTPileupCorrection.apply(), gen::PhotosppInterface.apply(), gen::PhotosInterface.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), RigidBodyAlignmentParameters.apply(), BeamSpotAlignmentParameters.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(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), PulseShapeFitOOTPileupCorrection.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(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), ArrayND< Accumulator >.apply(), ArrayND< Numeric, Len2, Dim2 >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), ArrayND< Num2, Len2, Dim2 >.apply(), npstat::ArrayND< Numeric >.apply(), ArrayND< Numeric, Len, Dim >.apply(), Config.ProcessModifier.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), PedeReader.setParameter(), ora::PoolMainTable.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by runMVAMEtUncertainties.RunMVAMEtUncertainties._createUncorrectedJetsModules().

281  postfix = None):
282  JetMEtUncertaintyTools.__call__(
283  self, process,
284  electronCollection = electronCollection,
285  photonCollection = photonCollection,
286  muonCollection = muonCollection,
287  tauCollection = tauCollection,
288  jetCollection = jetCollection,
289  jetCorrLabel = jetCorrLabel,
290  doSmearJets = doSmearJets,
291  jetSmearFileName = jetSmearFileName,
292  jetSmearHistogram = jetSmearHistogram,
293  jetCorrPayloadName = jetCorrPayloadName,
294  jetCorrLabelUpToL3 = jetCorrLabelUpToL3,
295  jetCorrLabelUpToL3Res = jetCorrLabelUpToL3Res,
296  jecUncertaintyFile = jecUncertaintyFile,
297  jecUncertaintyTag = jecUncertaintyTag,
298  varyByNsigmas = varyByNsigmas,
299  addToPatDefaultSequence = addToPatDefaultSequence,
300  outputModule = outputModule,
301  postfix = postfix)
302  pfCandCollection = self._initializeInputTag(pfCandCollection, 'pfCandCollection')
303 
304  self.setParameter('pfCandCollection', pfCandCollection)
305 
306  self.apply(process)
def runMVAMEtUncertainties.RunMVAMEtUncertainties._addPFMVAMEt (   self,
  process,
  metUncertaintySequence,
  shiftedParticleCollections,
  pfCandCollection,
  collectionsToKeep,
  doSmearJets,
  jecUncertaintyFile,
  jecUncertaintyTag,
  varyByNsigmas,
  postfix 
)
private

Definition at line 35 of file runMVAMEtUncertainties.py.

References jmeUncertaintyTools.JetMEtUncertaintyTools._addPATMEtProducer(), jmeUncertaintyTools.JetMEtUncertaintyTools._addPFCandidatesForPFMEtInput(), runMVAMEtUncertainties.RunMVAMEtUncertainties._createUncorrectedJetsModules(), jmeUncertaintyTools.JetMEtUncertaintyTools._getLeptonsForPFMEtInput(), clone(), and objectsUncertaintyTools.isValidInputTag().

Referenced by runMVAMEtUncertainties.RunMVAMEtUncertainties.__init__(), and runMVAMEtUncertainties.RunMVAMEtUncertainties.toolCode().

35 
36  postfix):
37 
38  # loading default files
39 
40  if not hasattr(process, "pfMEtMVA"):
41  process.load("RecoMET.METPUSubtraction.mvaPFMET_cff")
42 
43  pfCandCollectionUnsmeared = pfCandCollection
44  lastUncorrectedJetCollection = 'ak4PFJets'
45  lastCorrectedJetCollection = 'calibratedAK4PFJetsForPFMVAMEt'
46 
47  #set postfix if not empty value
48  if postfix != "":
49  configtools.cloneProcessingSnippet(process, process.pfMVAMEtSequence, postfix)
50  lastCorrectedJetCollection += postfix
51 
52  if doSmearJets:
53  self._createUncorrectedJetsModules(process, jetResolutions, pfCandCollection, metUncertaintySequence, postfix)
54  else:
55  metUncertaintySequence += getattr(process, "pfMVAMEtSequence" + postfix)
56  self._addPATMEtProducer(process, metUncertaintySequence,
57  'pfMVAMEt' + postfix, 'patPFMVAMEt', collectionsToKeep, postfix)
58 
59 
60  variations=['Up','Down']
61  varDir= { 'Up':1., 'Down':-1. }
62 
63  #=====================================================
64  # Leptons
65  #=====================================================
66  for leptonCollection in [ [ 'Electron', 'En', 'electronCollection', 0.3 ],
67  [ 'Photon', 'En', 'photonCollection', 0.3 ],
68  [ 'Muon', 'En', 'muonCollection', 0.3 ],
69  [ 'Tau', 'En', 'tauCollection', 0.3 ] ]:
70 
71 
72 
73  # pfCandCollectionLeptonShift= { 'Up':None, 'Down':None }
74 
75  if ( leptonCollection[2] in shiftedParticleCollections ) and isValidInputTag(shiftedParticleCollections[leptonCollection[2]]):
76  pfCandCollectionLeptonShift = \
77  self._addPFCandidatesForPFMEtInput(
78  process, metUncertaintySequence,
79  shiftedParticleCollections['%s' % leptonCollection[2]], leptonCollection[0], leptonCollection[1],
80  shiftedParticleCollections['%s%sUp' % (leptonCollection[2], leptonCollection[1])],
81  shiftedParticleCollections['%s%sDown' % (leptonCollection[2], leptonCollection[1])],
82  leptonCollection[3],
83  pfCandCollection, postfix)
84 
85 
86  for var in variations:
87 
88  modulePFMEtLeptonShift = getattr(process, "pfMVAMEt" + postfix).clone(
89  srcPFCandidates = cms.InputTag(pfCandCollectionLeptonShift[var]),
90  srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(
91  shiftedParticleCollections, leptonCollection[2], '%s%s%s' % (leptonCollection[2], leptonCollection[1], var), postfix = postfix))
92  )
93  modulePFMEtLeptonShiftName = "pfMVAMEt%s%s%s" % (leptonCollection[0], leptonCollection[1],var)
94  modulePFMEtLeptonShiftName += postfix
95  setattr(process, modulePFMEtLeptonShiftName, modulePFMEtLeptonShift)
96  metUncertaintySequence += modulePFMEtLeptonShift
97  self._addPATMEtProducer(process, metUncertaintySequence,
98  modulePFMEtLeptonShiftName, 'patPFMVAMet%s%s%s' % (leptonCollection[0], leptonCollection[1],var), collectionsToKeep, postfix)
99 
100  #=====================================================
101  # Jets
102  #=====================================================
103 
104  # energy shift =======================
105  for var in variations:
106 
107  if isValidInputTag(shiftedParticleCollections['jetCollection']):
108  setattr(process, "uncorrectedJetsEn%sForPFMVAMEt%s" % (var, postfix), cms.EDProducer("ShiftedPFJetProducer",
109  src = cms.InputTag(lastUncorrectedJetCollection),
110  jetCorrInputFileName = cms.FileInPath(jecUncertaintyFile),
111  jetCorrUncertaintyTag = cms.string(jecUncertaintyTag),
112  addResidualJES = cms.bool(False),
113  jetCorrLabelUpToL3 = cms.InputTag("ak4PFL1FastL2L3Corrector"),
114  jetCorrLabelUpToL3Res = cms.InputTag("ak4PFL1FastL2L3ResidualCorrector"),
115  shiftBy = cms.double( varDir[var] *varyByNsigmas)
116  ))
117  metUncertaintySequence += getattr(process, "uncorrectedJetsEn%sForPFMVAMEt%s" % (var, postfix) )
118 
119  setattr(process, "correctedJetsEn%sForPFMVAMEt%s" %(var, postfix), getattr(process, "uncorrectedJetsEn%sForPFMVAMEt%s" % (var, postfix) ).clone(
120  src = cms.InputTag(lastCorrectedJetCollection),
121  ))
122  metUncertaintySequence += getattr(process, "correctedJetsEn%sForPFMVAMEt%s" % (var, postfix) )
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def runMVAMEtUncertainties.RunMVAMEtUncertainties._createUncorrectedJetsModules (   self,
  process,
  jetResolutions,
  pfCandCollection,
  metUncertaintySequence,
  postfix 
)
private

Definition at line 224 of file runMVAMEtUncertainties.py.

References runMVAMEtUncertainties.RunMVAMEtUncertainties.__call__().

Referenced by runMVAMEtUncertainties.RunMVAMEtUncertainties._addPFMVAMEt().

225  def _createUncorrectedJetsModules(self,process, jetResolutions, pfCandCollection, metUncertaintySequence, postfix):
226 
227  process.load("RecoJets.Configuration.GenJetParticles_cff")
228  metUncertaintySequence += process.genParticlesForJetsNoNu
229  process.load("RecoJets.Configuration.RecoGenJets_cff")
230  metUncertaintySequence += process.ak4GenJetsNoNu
231  setattr(process, "smearedUncorrectedJetsForPFMVAMEt" + postfix, cms.EDProducer("SmearedPFJetProducer",
232  src = cms.InputTag('ak4PFJets'),
233  jetCorrLabel = cms.InputTag("ak4PFL1FastL2L3Corrector"),
234  dRmaxGenJetMatch = cms.string('min(0.5, 0.1 + 0.3*exp(-0.05*(genJetPt - 10.)))'),
235  sigmaMaxGenJetMatch = cms.double(3.),
236  inputFileName = cms.FileInPath('PhysicsTools/PatUtils/data/pfJetResolutionMCtoDataCorrLUT.root'),
237  lutName = cms.string('pfJetResolutionMCtoDataCorrLUT'),
238  jetResolutions = jetResolutions.METSignificance_params,
239  skipRawJetPtThreshold = cms.double(10.), # GeV
240  skipCorrJetPtThreshold = cms.double(1.e-2),
241  srcGenJets = cms.InputTag('ak4GenJetsNoNu'),
242  #verbosity = cms.int32(1)
243  ))
244  setattr(process, "smearedPFCandidatesForPFMVAMEt" + postfix, cms.EDProducer("ShiftedPFCandidateProducerForPFMVAMEt",
245  srcPFCandidates = pfCandCollection,
246  srcUnshiftedObjects = cms.InputTag("ak4PFJets"),
247  srcShiftedObjects = cms.InputTag("smearedUncorrectedJetsForPFMVAMEt" + postfix),
248  dRmatch_PFCandidate = cms.double(0.5)
249  ))
250  pfCandCollection = cms.InputTag("smearedPFCandidatesForPFMVAMEt" + postfix)
251  metUncertaintySequence += getattr(process, "smearedUncorrectedJetsForPFMVAMEt" + postfix)
252  metUncertaintySequence += getattr(process, "smearedPFCandidatesForPFMVAMEt" + postfix)
253  getattr(process, "calibratedAK4PFJetsForPFMVAMEt" + postfix).src = cms.InputTag('smearedUncorrectedJetsForPFMVAMEt' + postfix)
254  getattr(process, "pfMVAMEt" + postfix).srcUncorrJets = cms.InputTag('smearedUncorrectedJetsForPFMVAMEt' + postfix)
255  getattr(process, "pfMVAMEt" + postfix).srcPFCandidates = cms.InputTag('smearedPFCandidatesForPFMVAMEt' + postfix)
256  metUncertaintySequence += getattr(process, "calibratedAK4PFJetsForPFMVAMEt" + postfix)
257  metUncertaintySequence += getattr(process, "pfMVAMEt" + postfix)
258  lastUncorrectedJetCollection = 'smearedUncorrectedJetsForPFMVAMEt' + postfix
259 
def runMVAMEtUncertainties.RunMVAMEtUncertainties.toolCode (   self,
  process 
)

Definition at line 307 of file runMVAMEtUncertainties.py.

References trigTools._addEventContent(), runMVAMEtUncertainties.RunMVAMEtUncertainties._addPFMVAMEt(), jmeUncertaintyTools.JetMEtUncertaintyTools._addShiftedParticleCollections(), 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, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, jetTools.AddJetCollection._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, objectsUncertaintyTools.addSmearedJets(), and objectsUncertaintyTools.isValidInputTag().

308  def toolCode(self, process):
309  electronCollection = self._parameters['electronCollection'].value
310  photonCollection = self._parameters['photonCollection'].value
311  muonCollection = self._parameters['muonCollection'].value
312  tauCollection = self._parameters['tauCollection'].value
313  jetCollection = self._parameters['jetCollection'].value
314  jetCorrLabel = self._parameters['jetCorrLabel'].value
315  doSmearJets = self._parameters['doSmearJets'].value
316  jetSmearFileName = self._parameters['jetSmearFileName'].value
317  jetSmearHistogram = self._parameters['jetSmearHistogram'].value
318  pfCandCollection = self._parameters['pfCandCollection'].value
319  jetCorrPayloadName = self._parameters['jetCorrPayloadName'].value
320  jetCorrLabelUpToL3 = self._parameters['jetCorrLabelUpToL3'].value
321  jetCorrLabelUpToL3Res = self._parameters['jetCorrLabelUpToL3Res'].value
322  jecUncertaintyFile = self._parameters['jecUncertaintyFile'].value
323  jecUncertaintyTag = self._parameters['jecUncertaintyTag'].value
324  varyByNsigmas = self._parameters['varyByNsigmas'].value
325  addToPatDefaultSequence = self._parameters['addToPatDefaultSequence'].value
326  outputModule = self._parameters['outputModule'].value
327  postfix = self._parameters['postfix'].value
328 
329  if not hasattr(process, "pfMVAMEtUncertaintySequence" + postfix):
330  metUncertaintySequence = cms.Sequence()
331  setattr(process, "pfMVAMEtUncertaintySequence" + postfix, metUncertaintySequence)
332  metUncertaintySequence = getattr(process, "pfMVAMEtUncertaintySequence" + postfix)
333 
334  collectionsToKeep = []
335 
336  lastJetCollection = jetCollection.value()
337 
338  # smear jet energies to account for difference in jet resolutions between MC and Data
339  # (cf. JME-10-014 PAS)
340  if isValidInputTag(jetCollection):
341  if doSmearJets:
342  lastJetCollection = \
343  addSmearedJets(process, lastJetCollection, [ "smeared", jetCollection.value(), "ForPFMVAMEt" ],
344  jetSmearFileName, jetSmearHistogram, jetResolutions, varyByNsigmas, None,
345  sequence = metUncertaintySequence, postfix = postfix)
346 # jetCollectionResUp = \
347 # self._addSmearedJets(process, lastJetCollection, [ "smeared", jetCollection.value(), "ForPFMVAMEtResUp" ],
348 # jetSmearFileName, jetSmearHistogram, varyByNsigmas, -1.,
349 # uncertaintySequence = metUncertaintySequence, postfix = postfix)
350 # collectionsToKeep.append(jetCollectionResUp)
351 # jetCollectionResDown = \
352 # self._addSmearedJets(process, lastJetCollection, [ "smeared", jetCollection.value(), "ForPFMVAMEtResDown" ],
353 # jetSmearFileName, jetSmearHistogram, varyByNsigmas, +1.,
354 # uncertaintySequence = metUncertaintySequence, postfix = postfix)
355 # collectionsToKeep.append(jetCollectionResDown)
356 
357  collectionsToKeep.append(lastJetCollection)
358 
359  #--------------------------------------------------------------------------------------------
360  # produce collection of electrons/photons, muons, tau-jet candidates and jets
361  # shifted up/down in energy by their respective energy uncertainties
362  #--------------------------------------------------------------------------------------------
363  shiftedParticleSequence, shiftedParticleCollections, addCollectionsToKeep = \
364  self._addShiftedParticleCollections(process,
365  electronCollection.value(),
366  photonCollection.value(),
367  muonCollection.value(),
368  tauCollection.value(),
369  jetCollection.value(), lastJetCollection, lastJetCollection,
370  doSmearJets,
371  jetCorrLabelUpToL3, jetCorrLabelUpToL3Res,
372  jecUncertaintyFile, jecUncertaintyTag,
373  jetSmearFileName, jetSmearHistogram,
374  varyByNsigmas,
375  "ForPFMVAMEt" + postfix)
376  setattr(process, "shiftedParticlesForPFMVAMEtUncertainties" + postfix, shiftedParticleSequence)
377  metUncertaintySequence += getattr(process, "shiftedParticlesForPFMVAMEtUncertainties" + postfix)
378  collectionsToKeep.extend(addCollectionsToKeep)
379 
380  #--------------------------------------------------------------------------------------------
381  # propagate shifted particle energies to MVA MET
382  #--------------------------------------------------------------------------------------------
383 
384  self._addPFMVAMEt(process, metUncertaintySequence,
385  shiftedParticleCollections, pfCandCollection,
386  collectionsToKeep,
387  doSmearJets,
388  jecUncertaintyFile, jecUncertaintyTag,
389  varyByNsigmas,
390  postfix)
391 
392  # insert metUncertaintySequence into patDefaultSequence
393  if addToPatDefaultSequence:
394  if not hasattr(process, "patDefaultSequence"):
395  raise ValueError("PAT default sequence is not defined !!")
396  process.patDefaultSequence += metUncertaintySequence
397 
398  # add shifted + unshifted collections pf pat::Electrons/Photons,
399  # Muons, Taus, Jets and MET to PAT-tuple event content
400  if outputModule is not None and hasattr(process, outputModule):
401  getattr(process, outputModule).outputCommands = _addEventContent(
402  getattr(process, outputModule).outputCommands,
403  [ 'keep *_%s_*_%s' % (collectionToKeep, process.name_()) for collectionToKeep in collectionsToKeep ])
def _addEventContent
Definition: trigTools.py:29

Member Data Documentation

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 21 of file runMVAMEtUncertainties.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), HiCoreTools.RemoveMCMatching.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), HiCoreTools.RemoveCleaning.__call__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties.__call__(), HiCoreTools.AddCleaning.__call__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.__call__(), HiCoreTools.RestrictInputToAOD.__init__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties.__init__(), runNoPileUpMEtUncertainties.RunNoPileUpMEtUncertainties.__init__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties.__init__(), runMVAMEtUncertainties.RunMVAMEtUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string runMVAMEtUncertainties.RunMVAMEtUncertainties._label = 'runMVAMEtUncertainties'
staticprivate

Definition at line 20 of file runMVAMEtUncertainties.py.

runMVAMEtUncertainties.RunMVAMEtUncertainties.pfCandCollectionJetEnShift = \
static

Definition at line 125 of file runMVAMEtUncertainties.py.

runMVAMEtUncertainties.RunMVAMEtUncertainties.pfCandCollectionUnclusteredEnShift = \
static

Definition at line 203 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.shiftBy = cms.double(varDir[var]*varyByNsigmas)
static

Definition at line 156 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.src = cms.InputTag("uncorrectedJetsRes%sForPFMVAMEt%s" % (var, postfix) )
static

Definition at line 165 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.srcCorrJets = cms.InputTag('correctedJetsEn%sForPFMVAMEt%s' % (var, postfix) )
static

Definition at line 146 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.srcLeptons = cms.VInputTag(self._getLeptonsForPFMEtInput(shiftedParticleCollections, postfix = postfix))
static

Definition at line 148 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.srcPFCandidates = cms.InputTag("smearedPFCandidatesJetRes%sForPFMVAMEt%s" %(var, postfix) )
static

srcPFCandidates = cms.InputTag(pfCandCollectionJetResShift[ var ]),

Definition at line 174 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.srcShiftedObjects = cms.InputTag("uncorrectedJetsRes%sForPFMVAMEt%s" % (var, postfix) )
static

Definition at line 160 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.srcUncorrJets = cms.InputTag('uncorrectedJetsEn%sForPFMVAMEt%s' %(var, postfix) )
static

Definition at line 147 of file runMVAMEtUncertainties.py.

tuple runMVAMEtUncertainties.RunMVAMEtUncertainties.uncertainty = cms.double(0.10)
static

Definition at line 199 of file runMVAMEtUncertainties.py.

Referenced by average.Average.average().