Classes | |
class | AddTauCollection |
Functions | |
def | _buildIDSourcePSet |
def | _switchToPFTau |
def | applyPostfix |
def | switchToCaloTau |
def | switchToPFTauByType |
def | switchToPFTauFixedCone |
def | switchToPFTauHPS |
def | switchToPFTauShrinkingCone |
Variables | |
list | classicPFTauIDSources |
list | classicTauIDSources |
list | hpsTauIDSources |
def tauTools::_buildIDSourcePSet | ( | tauType, | |
idSources, | |||
postfix = "" |
|||
) | [private] |
Build a PSet defining the tau ID sources to embed into the pat::Tau
Definition at line 41 of file tauTools.py.
00042 : 00043 """ Build a PSet defining the tau ID sources to embed into the pat::Tau """ 00044 output = cms.PSet() 00045 for label, discriminator in idSources: 00046 if ":" in discriminator: 00047 discr = discriminator.split(":") 00048 setattr(output, label, cms.InputTag(tauType + discr[0] + postfix + ":" + discr[1])) 00049 else: 00050 setattr(output, label, cms.InputTag(tauType + discriminator + postfix)) 00051 return output
def tauTools::_switchToPFTau | ( | process, | |
tauSource, | |||
pfTauType, | |||
idSources, | |||
patTauLabel = "" , |
|||
postfix = "" |
|||
) | [private] |
internal auxiliary function to switch to **any** PFTau collection
Definition at line 52 of file tauTools.py.
00058 : 00059 """internal auxiliary function to switch to **any** PFTau collection""" 00060 print ' switching PAT Tau input to: ', tauSource 00061 00062 applyPostfix(process, "tauMatch" + patTauLabel, postfix).src = tauSource 00063 applyPostfix(process, "tauGenJetMatch" + patTauLabel, postfix).src = tauSource 00064 00065 applyPostfix(process, "tauIsoDepositPFCandidates" + patTauLabel, postfix).src = tauSource 00066 applyPostfix(process, "tauIsoDepositPFCandidates" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource 00067 applyPostfix(process, "tauIsoDepositPFChargedHadrons" + patTauLabel, postfix).src = tauSource 00068 applyPostfix(process, "tauIsoDepositPFChargedHadrons" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource 00069 applyPostfix(process, "tauIsoDepositPFNeutralHadrons" + patTauLabel, postfix).src = tauSource 00070 applyPostfix(process, "tauIsoDepositPFNeutralHadrons" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource 00071 applyPostfix(process, "tauIsoDepositPFGammas" + patTauLabel, postfix).src = tauSource 00072 applyPostfix(process, "tauIsoDepositPFGammas" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource 00073 00074 applyPostfix(process, "patTaus" + patTauLabel, postfix).tauSource = tauSource 00075 applyPostfix(process, "patTaus" + patTauLabel, postfix).tauIDSources = _buildIDSourcePSet(pfTauType, idSources, postfix) 00076 00077 if hasattr(process, "cleanPatTaus" + patTauLabel + postfix): 00078 getattr(process, "cleanPatTaus" + patTauLabel + postfix).preselection = \ 00079 'tauID("leadingTrackFinding") > 0.5 & tauID("leadingPionPtCut") > 0.5 & tauID("byIsolationUsingLeadingPion") > 0.5' \ 00080 + ' & tauID("againstMuon") > 0.5 & tauID("againstElectron") > 0.5' \ 00081 + ' & (signalPFChargedHadrCands.size() = 1 | signalPFChargedHadrCands.size() = 3)' 00082 # Name mapping for classic tau ID sources (present for fixed and shrinkingCones)
def tauTools::applyPostfix | ( | process, | |
label, | |||
postfix | |||
) |
Definition at line 8 of file tauTools.py.
00009 : 00010 result = None 00011 if hasattr(process, label+postfix): 00012 result = getattr(process, label + postfix) 00013 else: 00014 raise ValueError("Error in <applyPostfix>: No module of name = %s attached to process !!" % (label + postfix)) 00015 return result 00016 # switch to CaloTau collection
def tauTools::switchToCaloTau | ( | process, | |
tauSource = cms.InputTag('caloRecoTauProducer') , |
|||
patTauLabel = "" , |
|||
postfix = "" |
|||
) |
Definition at line 17 of file tauTools.py.
00021 : 00022 print ' switching PAT Tau input to: ', tauSource 00023 00024 applyPostfix(process, "tauMatch" + patTauLabel, postfix).src = tauSource 00025 applyPostfix(process, "tauGenJetMatch"+ patTauLabel, postfix).src = tauSource 00026 00027 applyPostfix(process, "patTaus" + patTauLabel, postfix).tauSource = tauSource 00028 applyPostfix(process, "patTaus" + patTauLabel, postfix).tauIDSources = _buildIDSourcePSet('caloRecoTau', classicTauIDSources, postfix) 00029 00030 ## Isolation is somewhat an issue, so we start just by turning it off 00031 print "NO PF Isolation will be computed for CaloTau (this could be improved later)" 00032 applyPostfix(process, "patTaus" + patTauLabel, postfix).isolation = cms.PSet() 00033 applyPostfix(process, "patTaus" + patTauLabel, postfix).isoDeposits = cms.PSet() 00034 applyPostfix(process, "patTaus" + patTauLabel, postfix).userIsolation = cms.PSet() 00035 00036 ## adapt cleanPatTaus 00037 if hasattr(process, "cleanPatTaus" + patTauLabel + postfix): 00038 getattr(process, "cleanPatTaus" + patTauLabel + postfix).preselection = \ 00039 'tauID("leadingTrackFinding") > 0.5 & tauID("leadingTrackPtCut") > 0.5' \ 00040 + ' & tauID("byIsolation") > 0.5 & tauID("againstElectron") > 0.5 & (signalTracks.size() = 1 | signalTracks.size() = 3)'
def tauTools::switchToPFTauByType | ( | process, | |
pfTauType = None , |
|||
tauSource = cms.InputTag('hpsPFTauProducer') , |
|||
patTauLabel = "" , |
|||
postfix = "" |
|||
) |
Definition at line 173 of file tauTools.py.
00178 : 00179 mapping = { 00180 'shrinkingConePFTau' : switchToPFTauShrinkingCone, 00181 'fixedConePFTau' : switchToPFTauFixedCone, 00182 'hpsPFTau' : switchToPFTauHPS, 00183 'caloRecoTau' : switchToCaloTau 00184 } 00185 if not pfTauType in mapping.keys(): 00186 raise ValueError("Error in <switchToPFTauByType>: Undefined pfTauType = %s !!" % pfTauType) 00187 00188 mapping[pfTauType](process, tauSource = tauSource, 00189 patTauLabel = patTauLabel, postfix = postfix)
def tauTools::switchToPFTauFixedCone | ( | process, | |
tauSource = cms.InputTag('fixedConePFTauProducer') , |
|||
patTauLabel = "" , |
|||
postfix = "" |
|||
) |
Definition at line 135 of file tauTools.py.
00139 : 00140 fixedConeIDSources = copy.copy(classicTauIDSources) 00141 fixedConeIDSources.extend(classicPFTauIDSources) 00142 00143 _switchToPFTau(process, tauSource, 'fixedConePFTau', fixedConeIDSources, 00144 patTauLabel = patTauLabel, postfix = postfix) 00145 # switch to PFTau collection produced for shrinking signal cone of size dR = 5.0/Et(PFTau)
def tauTools::switchToPFTauHPS | ( | process, | |
tauSource = cms.InputTag('hpsPFTauProducer') , |
|||
patTauLabel = "" , |
|||
jecLevels = [] , |
|||
postfix = "" |
|||
) |
Definition at line 157 of file tauTools.py.
00162 : 00163 00164 _switchToPFTau(process, tauSource, 'hpsPFTau', hpsTauIDSources, 00165 patTauLabel = patTauLabel, postfix = postfix) 00166 00167 ## adapt cleanPatTaus 00168 if hasattr(process, "cleanPatTaus" + patTauLabel + postfix): 00169 getattr(process, "cleanPatTaus" + patTauLabel + postfix).preselection = \ 00170 'pt > 15 & abs(eta) < 2.3 & tauID("decayModeFinding") > 0.5 & tauID("byLooseIsolation") > 0.5' \ 00171 + ' & tauID("againstMuonTight") > 0.5 & tauID("againstElectronLoose") > 0.5' 00172 # Select switcher by string
def tauTools::switchToPFTauShrinkingCone | ( | process, | |
tauSource = cms.InputTag('shrinkingConePFTauProducer') , |
|||
patTauLabel = "" , |
|||
postfix = "" |
|||
) |
Definition at line 146 of file tauTools.py.
00150 : 00151 shrinkingIDSources = copy.copy(classicTauIDSources) 00152 shrinkingIDSources.extend(classicPFTauIDSources) 00153 00154 _switchToPFTau(process, tauSource, 'shrinkingConePFTau', shrinkingIDSources, 00155 patTauLabel = patTauLabel, postfix = postfix) 00156 # switch to hadron-plus-strip(s) (HPS) PFTau collection
00001 [ 00002 ("leadingPionPtCut", "DiscriminationByLeadingPionPtCut"), 00003 ("trackIsolationUsingLeadingPion", "DiscriminationByTrackIsolationUsingLeadingPion"), 00004 ("ecalIsolationUsingLeadingPion", "DiscriminationByECALIsolationUsingLeadingPion"), 00005 ("byIsolationUsingLeadingPion", "DiscriminationByIsolationUsingLeadingPion")]
Definition at line 92 of file tauTools.py.
00001 [ 00002 ("leadingTrackFinding", "DiscriminationByLeadingTrackFinding"), 00003 ("leadingTrackPtCut", "DiscriminationByLeadingTrackPtCut"), 00004 ("trackIsolation", "DiscriminationByTrackIsolation"), 00005 ("ecalIsolation", "DiscriminationByECALIsolation"), 00006 ("byIsolation", "DiscriminationByIsolation"), 00007 ("againstElectron", "DiscriminationAgainstElectron"), 00008 ("againstMuon", "DiscriminationAgainstMuon") ]
Definition at line 83 of file tauTools.py.
Definition at line 99 of file tauTools.py.