CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

metTools::AddMETCollection Class Reference

Inherits FWCore::GuiBrowsers::ConfigToolBase::ConfigToolBase.

List of all members.

Public Member Functions

def __call__
def __init__
def getDefaultParameters
def toolCode

Private Attributes

 _comment
 add comments
 _parameters
 initialization of the base class

Static Private Attributes

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

Detailed Description

Tool to add alternative MET collection(s) to your PAT Tuple

Definition at line 3 of file metTools.py.


Constructor & Destructor Documentation

def metTools::AddMETCollection::__init__ (   self)
Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase
to be usable in the configEditor.

Definition at line 10 of file metTools.py.

00011                       :
00012         """
00013         Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase
00014         to be usable in the configEditor.
00015         """
00016         ## initialization of the base class
00017         ConfigToolBase.__init__(self)
00018         ## add all parameters that should be known to the class
00019         self.addParameter(self._defaultParameters,'labelName',self._defaultValue, "Label name of the new patMET collection.", str)
00020         self.addParameter(self._defaultParameters,'metSource',self._defaultValue, "Label of the input collection from which the new patMet collection should be created.", str)
00021         ## set defaults
00022         self._parameters=copy.deepcopy(self._defaultParameters)
00023         ## add comments
00024         self._comment = "Add alternative MET collections as PAT object to your PAT Tuple"
        

Member Function Documentation

def metTools::AddMETCollection::__call__ (   self,
  process,
  labelName = None,
  metSource = None 
)
Function call wrapper. This will check the parameters and call the actual implementation that
can be found in toolCode via the base class function apply.

Definition at line 31 of file metTools.py.

00032                                                             :
00033         """
00034         Function call wrapper. This will check the parameters and call the actual implementation that
00035         can be found in toolCode via the base class function apply.
00036         """
00037         if labelName is None:
00038             labelName=self._defaultParameters['labelName'].value
00039         self.setParameter('labelName', labelName)
00040         if metSource is None:
00041             metSource=self._defaultParameters['metSource'].value             
00042         self.setParameter('metSource', metSource)
00043         self.apply(process) 

def metTools::AddMETCollection::getDefaultParameters (   self)
Return default parameters of the class

Definition at line 25 of file metTools.py.

00026                                   :
00027         """
00028         Return default parameters of the class
00029         """
00030         return self._defaultParameters
        
def metTools::AddMETCollection::toolCode (   self,
  process 
)
Tool code implementation

Definition at line 44 of file metTools.py.

00045                                :
00046         """
00047         Tool code implementation
00048         """
00049         ## initialize parameters
00050         labelName=self._parameters['labelName'].value
00051         metSource=self._parameters['metSource'].value
00052         ## do necessary imports
00053         from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs
00054         ## add module to the process
00055         setattr(process, labelName, patMETs.clone(metSource = metSource, addMuonCorrections=False))
00056         ## add module to output 
00057         if hasattr(process, "out"):
00058             process.out.outputCommands+=["keep *_{LABEL_NAME}_*_*".format(LABEL_NAME=labelName)]
00059        
00060 addMETCollection=AddMETCollection()

Member Data Documentation

add comments

Definition at line 17 of file metTools.py.

tuple metTools::AddMETCollection::_defaultParameters = dicttypes.SortedKeysDict() [static, private]

Definition at line 8 of file metTools.py.

string metTools::AddMETCollection::_label = 'addMETCollection' [static, private]

Definition at line 7 of file metTools.py.

initialization of the base class

add all parameters that should be known to the class set defaults

Definition at line 16 of file metTools.py.