CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
metTools.py
Go to the documentation of this file.
2 
3 
5 
6  """ Add track corrected MET collection to patEventContent
7  """
8  _label='addTcMET'
9  _defaultParameters=dicttypes.SortedKeysDict()
10 
11  def __init__(self):
12  ConfigToolBase.__init__(self)
13  self.addParameter(self._defaultParameters,'postfixLabel','TC', '')
14  self._parameters=copy.deepcopy(self._defaultParameters)
15  self._comment = ''
16 
18  return self._defaultParameters
19 
20  def __call__(self,process,postfixLabel=None) :
21  if postfixLabel is None:
22  postfixLabel=self._defaultParameters['postfixLabel'].value
23  self.setParameter('postfixLabel',postfixLabel)
24  self.apply(process)
25 
26  def toolCode(self, process):
27  postfixLabel=self._parameters['postfixLabel'].value
28 
29 
30  ## add module as process to the default sequence
31  def addAlso (label,value):
32  existing = getattr(process, label)
33  setattr( process, label+postfixLabel, value)
34  process.patDefaultSequence.replace( existing, existing*value )
35 
36  ## clone and add a module as process to the
37  ## default sequence
38  def addClone(label,**replaceStatements):
39  new = getattr(process, label).clone(**replaceStatements)
40  addAlso(label, new)
41 
42  ## addClone('corMetType1Icone5Muons', uncorMETInputTag = cms.InputTag("tcMet"))
43  addClone('patMETs', metSource = cms.InputTag("tcMet"))
44 
45  ## add new met collections output to the pat summary
46  process.patCandidateSummary.candidates += [ cms.InputTag('patMETs'+postfixLabel) ]
47 
48 
49 addTcMET=AddTcMET()
50 
52 
53  """ Add pflow MET collection to patEventContent
54  """
55  _label='addPfMET'
56  _defaultParameters=dicttypes.SortedKeysDict()
57 
58  def __init__(self):
59  ConfigToolBase.__init__(self)
60  self.addParameter(self._defaultParameters,'postfixLabel','PF', '')
61  self._parameters=copy.deepcopy(self._defaultParameters)
62  self._comment = ''
63 
65  return self._defaultParameters
66 
67  def __call__(self,process,postfixLabel=None):
68  if postfixLabel is None:
69  postfixLabel=self._defaultParameters['postfixLabel'].value
70  self.setParameter('postfixLabel',postfixLabel)
71  self.apply(process)
72 
73  def toolCode(self, process):
74  postfixLabel=self._parameters['postfixLabel'].value
75 
76 
77  ## add module as process to the default sequence
78  def addAlso (label,value):
79  existing = getattr(process, label)
80  setattr( process, label+postfixLabel, value)
81  process.patDefaultSequence.replace( existing, existing*value )
82 
83  ## clone and add a module as process to the
84  ## default sequence
85  def addClone(label,**replaceStatements):
86  new = getattr(process, label).clone(**replaceStatements)
87  addAlso(label, new)
88 
89  ## addClone('corMetType1Icone5Muons', uncorMETInputTag = cms.InputTag("tcMet"))
90  addClone('patMETs', metSource = cms.InputTag("pfType1CorrectedMet"), addMuonCorrections = False)
91 
92  ## add new met collections output to the pat summary
93  process.patCandidateSummary.candidates += [ cms.InputTag('patMETs'+postfixLabel) ]
94 
95 
96 addPfMET=AddPfMET()
def getDefaultParameters
Definition: metTools.py:64
def getDefaultParameters
Definition: metTools.py:17
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple _defaultParameters
Definition: metTools.py:56
tuple _defaultParameters
Definition: metTools.py:9