CMS 3D CMS Logo

Functions | Variables

pfIsolation Namespace Reference

Functions

def _getattrGenerator
def _loadPFBRECO
def setupPFElectronIso
def setupPFIso
def setupPFMuonIso

Variables

 _PFBRECO_loaded = False

Function Documentation

def pfIsolation::_getattrGenerator (   process,
  postfix 
) [private]
A function generator to simplify the getattr syntax

Definition at line 6 of file pfIsolation.py.

00007                                          :
00008     '''A function generator to simplify the getattr syntax'''
00009     def fun(name):
00010         return getattr(process, name+postfix)
00011     return fun
00012 

def pfIsolation::_loadPFBRECO (   process) [private]
The particle-flow based reconstruction sequence should be loaded once in the process.
Not optimal, should load it only if it is not detected (hasattr)

Definition at line 15 of file pfIsolation.py.

00016                          :
00017     '''The particle-flow based reconstruction sequence should be loaded once in the process.
00018     Not optimal, should load it only if it is not detected (hasattr)'''
00019     global _PFBRECO_loaded
00020     if _PFBRECO_loaded is False: 
00021         _PFBRECO_loaded = True
00022         process.load("CommonTools.ParticleFlow.PFBRECO_cff")
00023 

def pfIsolation::setupPFElectronIso (   process,
  electronCollection,
  postfix = 'PFIso' 
)
Set up particle-based isolation for the electrons in electronCollection.

Calls setupPFIso.

Definition at line 79 of file pfIsolation.py.

00080                                                                      :
00081     '''Set up particle-based isolation for the electrons in electronCollection.
00082 
00083     Calls setupPFIso.
00084     '''
00085     #    print 'WARNING!!! the vetoes are the ones defined for the PF e-s (no veto...).'
00086     #    print 'Vetoes should be applied in the endcaps when doing particle-based isolation on gsfElectrons.'
00087     #    print 'Need a volunteer to implement that.'
00088     return setupPFIso( process, electronCollection, 'Electron', postfix)
00089 
00090     
00091 
def pfIsolation::setupPFIso (   process,
  leptonCollection,
  particleName,
  newpostfix = 'PFIso' 
)
Generic function to setup particle-based isolation for a given lepton collection.
Returns the isolation sequence.
You are responsible for adding it to your path.

leptonCollection could e.g. be "gsfElectrons" or "muons"
particleName must be either "Electron" or "Muon".
newpostfix can be specified to define several particle-flow isolation sequences

Definition at line 24 of file pfIsolation.py.

00025                                                                            :
00026     '''Generic function to setup particle-based isolation for a given lepton collection.
00027     Returns the isolation sequence.
00028     You are responsible for adding it to your path.
00029 
00030     leptonCollection could e.g. be "gsfElectrons" or "muons"
00031     particleName must be either "Electron" or "Muon".
00032     newpostfix can be specified to define several particle-flow isolation sequences
00033     '''
00034     lepshort = None
00035     if particleName=='Electron':
00036         lepshort='el'
00037     elif particleName=='Muon':
00038         lepshort='mu'
00039     else:
00040         raise ValueError('particleName should be equal to "Electron" or "Muon"')
00041     
00042     _loadPFBRECO(process)
00043 
00044     postfix = ''
00045     # ADD VETOES IN ENDCAPS!
00046     fullpostfix = postfix+newpostfix
00047     ga = _getattrGenerator( process, postfix )
00048     ganew = _getattrGenerator( process, fullpostfix )
00049 
00050     leptonSeq = cms.Sequence(
00051         ga('pf{lepton}IsolationSequence'.format(lepton=particleName))  
00052         )
00053     setattr( process, 'std{lepton}Sequence{postfix}'.format(lepton=particleName,
00054                                                    postfix=postfix), leptonSeq)
00055 
00056     leptonSource = leptonCollection
00057     cloneProcessingSnippet(process,
00058                            ga('std{lepton}Sequence'.format(lepton=particleName)),
00059                            newpostfix)
00060 
00061     ganew("{lepshort}PFIsoDepositCharged".format(lepshort=lepshort) ).src = leptonSource
00062     ganew("{lepshort}PFIsoDepositChargedAll".format(lepshort=lepshort)).src = leptonSource
00063     ganew("{lepshort}PFIsoDepositNeutral".format(lepshort=lepshort)).src = leptonSource
00064     ganew("{lepshort}PFIsoDepositGamma".format(lepshort=lepshort)).src = leptonSource
00065     ganew("{lepshort}PFIsoDepositPU".format(lepshort=lepshort)).src = leptonSource
00066 
00067     return ganew('std{lepton}Sequence'.format(lepton=particleName))
00068 
00069 

def pfIsolation::setupPFMuonIso (   process,
  muonCollection,
  postfix = 'PFIso' 
)
Set up particle-based isolation for the muons in muonCollection.

Calls setupPFIso.

Definition at line 70 of file pfIsolation.py.

00071                                                              :
00072     '''Set up particle-based isolation for the muons in muonCollection.
00073 
00074     Calls setupPFIso.
00075     '''
00076     return setupPFIso( process, muonCollection, 'Muon', postfix)
00077 
00078 


Variable Documentation

Definition at line 13 of file pfIsolation.py.