Go to the documentation of this file.00001 from FWCore.GuiBrowsers.ConfigToolBase import *
00002
00003
00004 class AddTcMET(ConfigToolBase):
00005
00006 """ Add track corrected MET collection to patEventContent
00007 """
00008 _label='addTcMET'
00009 _defaultParameters=dicttypes.SortedKeysDict()
00010
00011 def __init__(self):
00012 ConfigToolBase.__init__(self)
00013 self.addParameter(self._defaultParameters,'postfixLabel','TC', '')
00014 self._parameters=copy.deepcopy(self._defaultParameters)
00015 self._comment = ''
00016
00017 def getDefaultParameters(self):
00018 return self._defaultParameters
00019
00020 def __call__(self,process,postfixLabel=None) :
00021 if postfixLabel is None:
00022 postfixLabel=self._defaultParameters['postfixLabel'].value
00023 self.setParameter('postfixLabel',postfixLabel)
00024 self.apply(process)
00025
00026 def toolCode(self, process):
00027 postfixLabel=self._parameters['postfixLabel'].value
00028
00029
00030
00031 def addAlso (label,value):
00032 existing = getattr(process, label)
00033 setattr( process, label+postfixLabel, value)
00034 process.patDefaultSequence.replace( existing, existing*value )
00035
00036
00037
00038 def addClone(label,**replaceStatements):
00039 new = getattr(process, label).clone(**replaceStatements)
00040 addAlso(label, new)
00041
00042
00043 addClone('patMETs', metSource = cms.InputTag("tcMet"))
00044
00045
00046 process.patCandidateSummary.candidates += [ cms.InputTag('patMETs'+postfixLabel) ]
00047
00048
00049 addTcMET=AddTcMET()
00050
00051 class AddPfMET(ConfigToolBase):
00052
00053 """ Add pflow MET collection to patEventContent
00054 """
00055 _label='addPfMET'
00056 _defaultParameters=dicttypes.SortedKeysDict()
00057
00058 def __init__(self):
00059 ConfigToolBase.__init__(self)
00060 self.addParameter(self._defaultParameters,'postfixLabel','PF', '')
00061 self._parameters=copy.deepcopy(self._defaultParameters)
00062 self._comment = ''
00063
00064 def getDefaultParameters(self):
00065 return self._defaultParameters
00066
00067 def __call__(self,process,postfixLabel=None):
00068 if postfixLabel is None:
00069 postfixLabel=self._defaultParameters['postfixLabel'].value
00070 self.setParameter('postfixLabel',postfixLabel)
00071 self.apply(process)
00072
00073 def toolCode(self, process):
00074 postfixLabel=self._parameters['postfixLabel'].value
00075
00076
00077
00078 def addAlso (label,value):
00079 existing = getattr(process, label)
00080 setattr( process, label+postfixLabel, value)
00081 process.patDefaultSequence.replace( existing, existing*value )
00082
00083
00084
00085 def addClone(label,**replaceStatements):
00086 new = getattr(process, label).clone(**replaceStatements)
00087 addAlso(label, new)
00088
00089
00090 addClone('patMETs', metSource = cms.InputTag("pfType1CorrectedMet"), addMuonCorrections = False)
00091
00092
00093 process.patCandidateSummary.candidates += [ cms.InputTag('patMETs'+postfixLabel) ]
00094
00095
00096 addPfMET=AddPfMET()