Functions | |
def | _getattrGenerator |
def | _loadPFBRECO |
def | setupPFElectronIso |
def | setupPFIso |
def | setupPFIsoPhoton |
def | setupPFMuonIso |
def | setupPFPhotonIso |
Variables | |
_PFBRECO_loaded = False |
def pfIsolation::_getattrGenerator | ( | process, | |
postfix | |||
) | [private] |
A function generator to simplify the getattr syntax
Definition at line 6 of file pfIsolation.py.
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, | |||
newpostfix = 'PFIso' , |
|||
postfix = '' , |
|||
runPF2PAT = False |
|||
) |
Set up particle-based isolation for the electrons in electronCollection. Calls setupPFIso.
Definition at line 121 of file pfIsolation.py.
00122 : 00123 '''Set up particle-based isolation for the electrons in electronCollection. 00124 00125 Calls setupPFIso. 00126 ''' 00127 # print 'WARNING!!! the vetoes are the ones defined for the PF e-s (no veto...).' 00128 # print 'Vetoes should be applied in the endcaps when doing particle-based isolation on gsfElectrons.' 00129 # print 'Need a volunteer to implement that.' 00130 return setupPFIso( process, electronCollection, 'Electron', newpostfix, postfix, runPF2PAT) 00131
def pfIsolation::setupPFIso | ( | process, | |
leptonCollection, | |||
particleName, | |||
newpostfix = 'PFIso' , |
|||
postfix = '' , |
|||
runPF2PAT = False |
|||
) |
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 if runPF2PAT != True : 00043 _loadPFBRECO(process) 00044 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))
def pfIsolation::setupPFIsoPhoton | ( | process, | |
photonCollection, | |||
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 68 of file pfIsolation.py.
00069 : 00070 '''Generic function to setup particle-based isolation for a given lepton collection. 00071 Returns the isolation sequence. 00072 You are responsible for adding it to your path. 00073 00074 leptonCollection could e.g. be "gsfElectrons" or "muons" 00075 particleName must be either "Electron" or "Muon". 00076 newpostfix can be specified to define several particle-flow isolation sequences 00077 ''' 00078 phoshort = None 00079 if particleName=='Photon': 00080 phoshort='ph' 00081 else: 00082 raise ValueError('particleName should be equal to "Photon"') 00083 00084 _loadPFBRECO(process) 00085 00086 postfix = '' 00087 # ADD VETOES IN ENDCAPS! 00088 fullpostfix = postfix+newpostfix 00089 #fullpostfix = '' 00090 ga = _getattrGenerator( process, postfix ) 00091 ganew = _getattrGenerator( process, fullpostfix ) 00092 00093 photonSeq = cms.Sequence( 00094 ga('pf{photon}IsolationSequence'.format(photon=particleName)) 00095 ) 00096 setattr( process, 'std{photon}Sequence{postfix}'.format(photon=particleName, 00097 postfix=postfix), photonSeq) 00098 00099 photonSource = photonCollection 00100 cloneProcessingSnippet(process, 00101 ga('std{photon}Sequence'.format(photon=particleName)), 00102 newpostfix) 00103 00104 ganew("{phoshort}PFIsoDepositCharged".format(phoshort=phoshort) ).src = photonSource 00105 ganew("{phoshort}PFIsoDepositChargedAll".format(phoshort=phoshort)).src = photonSource 00106 ganew("{phoshort}PFIsoDepositNeutral".format(phoshort=phoshort)).src = photonSource 00107 ganew("{phoshort}PFIsoDepositGamma".format(phoshort=phoshort)).src = photonSource 00108 ganew("{phoshort}PFIsoDepositPU".format(phoshort=phoshort)).src = photonSource 00109 00110 return ganew('std{photon}Sequence'.format(photon=particleName)) 00111
def pfIsolation::setupPFMuonIso | ( | process, | |
muonCollection, | |||
postfix = 'PFIso' |
|||
) |
Set up particle-based isolation for the muons in muonCollection. Calls setupPFIso.
Definition at line 112 of file pfIsolation.py.
def pfIsolation::setupPFPhotonIso | ( | process, | |
photonCollection, | |||
postfix = 'PFIso' |
|||
) |
Set up particle-based isolation for the electrons in electronCollection. Calls setupPFIsoPhoton.
Definition at line 132 of file pfIsolation.py.
00133 : 00134 '''Set up particle-based isolation for the electrons in electronCollection. 00135 00136 Calls setupPFIsoPhoton. 00137 ''' 00138 # print 'WARNING!!! the vetoes are the ones defined for the PF e-s (no veto...).' 00139 # print 'Please make sure that your file with vetoes is up to date' 00140 return setupPFIsoPhoton( process, photonCollection, 'Photon', postfix) 00141
pfIsolation::_PFBRECO_loaded = False |
Definition at line 13 of file pfIsolation.py.