CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
vid_id_tools Namespace Reference

Functions

def addVIDSelectionToPATProducer
 
def setupAllVIDIdsInModule
 
def setupVIDElectronSelection
 
def setupVIDSelection
 
def switchOnVIDElectronIdProducer
 Electrons. More...
 

Function Documentation

def vid_id_tools.addVIDSelectionToPATProducer (   patProducer,
  idProducer,
  idName 
)

Definition at line 21 of file vid_id_tools.py.

Referenced by setupVIDElectronSelection().

21 
22 def addVIDSelectionToPATProducer(patProducer,idProducer,idName):
23  patProducerIDs = None
24  for key in patProducer.__dict__.keys():
25  if 'IDSources' in key:
26  patProducerIDs = getattr(patProducer,key)
27  if patProducerIDs is None:
28  raise Exception('StrangePatModule','%s does not have ID sources!'%patProducer.label())
29  setattr(patProducerIDs,idName,cms.InputTag('%s:%s'%(idProducer,idName)))
30  print '\t--- %s:%s added to %s'%(idProducer,idName,patProducer.label())
def addVIDSelectionToPATProducer
Definition: vid_id_tools.py:21
def vid_id_tools.setupAllVIDIdsInModule (   process,
  id_module_name,
  setupFunction,
  patProducer = None 
)

Definition at line 31 of file vid_id_tools.py.

References dir.

Referenced by miniAOD_tools.miniAOD_customizeCommon().

31 
32 def setupAllVIDIdsInModule(process,id_module_name,setupFunction,patProducer=None):
33 # idmod = importlib.import_module(id_module_name)
34  idmod= __import__(id_module_name, globals(), locals(), ['idName','cutFlow'])
35  for name in dir(idmod):
36  item = getattr(idmod,name)
37  if hasattr(item,'idName') and hasattr(item,'cutFlow'):
38  setupFunction(process,item,patProducer)
def setupAllVIDIdsInModule
Definition: vid_id_tools.py:31
dbl *** dir
Definition: mlp_gen.cc:35
def vid_id_tools.setupVIDElectronSelection (   process,
  cutflow,
  patProducer = None 
)

Definition at line 49 of file vid_id_tools.py.

References addVIDSelectionToPATProducer(), and setupVIDSelection().

49 
50 def setupVIDElectronSelection(process,cutflow,patProducer=None):
51  if not hasattr(process,'egmGsfElectronIDs'):
52  raise Exception('VIDProducerNotAvailable','egmGsfElectronIDs producer not available in process!')
53  setupVIDSelection(process.egmGsfElectronIDs,cutflow)
54  #add to PAT electron producer if available or specified
55  if hasattr(process,'patElectrons') or patProducer is not None:
56  if patProducer is None:
57  patProducer = process.patElectrons
58  idName = cutflow.idName.value()
59  addVIDSelectionToPATProducer(patProducer,'egmGsfElectronIDs',idName)
60 
def addVIDSelectionToPATProducer
Definition: vid_id_tools.py:21
def setupVIDElectronSelection
Definition: vid_id_tools.py:49
def setupVIDSelection
Definition: vid_id_tools.py:9
def vid_id_tools.setupVIDSelection (   vidproducer,
  cutflow 
)

Definition at line 9 of file vid_id_tools.py.

Referenced by setupVIDElectronSelection().

9 
10 def setupVIDSelection(vidproducer,cutflow):
11  if not hasattr(cutflow,'idName'):
12  raise Exception('InvalidVIDCutFlow', 'The cutflow configuation provided is malformed and does not have a specified name!')
13  if not hasattr(cutflow,'cutFlow'):
14  raise Exception('InvalidVIDCutFlow', 'The cutflow configuration provided is malformed and does not have a specific cutflow!')
15  cutflow_md5 = central_id_registry.getMD5FromName(cutflow.idName)
16  vidproducer.physicsObjectIDs.append(
17  cms.PSet( idDefinition = cutflow,
18  idMD5 = cms.string(cutflow_md5) )
19  )
20  print 'Added ID \'%s\' to %s'%(cutflow.idName.value(),vidproducer.label())
def setupVIDSelection
Definition: vid_id_tools.py:9
def vid_id_tools.switchOnVIDElectronIdProducer (   process)

Electrons.

Definition at line 45 of file vid_id_tools.py.

Referenced by miniAOD_tools.miniAOD_customizeCommon().

45 
47  process.load('RecoEgamma.ElectronIdentification.egmGsfElectronIDs_cff')
48  print 'Added \'egmGsfElectronIDs\' to process definition!'
def switchOnVIDElectronIdProducer
Electrons.
Definition: vid_id_tools.py:45