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 20 of file vid_id_tools.py.

Referenced by setupVIDElectronSelection().

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

Definition at line 30 of file vid_id_tools.py.

References dir.

Referenced by miniAOD_tools.miniAOD_customizeCommon().

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

Definition at line 47 of file vid_id_tools.py.

References addVIDSelectionToPATProducer(), and setupVIDSelection().

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

Definition at line 8 of file vid_id_tools.py.

Referenced by setupVIDElectronSelection().

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

Electrons.

Definition at line 43 of file vid_id_tools.py.

Referenced by miniAOD_tools.miniAOD_customizeCommon().

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