10 if hasattr(process, label+postfix):
11 result = getattr(process, label + postfix)
13 raise ValueError(
"Error in <applyPostfix>: No module of name = %s attached to process !!" % (label + postfix))
18 tauSource = cms.InputTag(
'caloRecoTauProducer'),
21 print ' switching PAT Tau input to: ', tauSource
23 applyPostfix(process,
"tauMatch" + patTauLabel, postfix).src = tauSource
24 applyPostfix(process,
"tauGenJetMatch"+ patTauLabel, postfix).src = tauSource
26 applyPostfix(process,
"patTaus" + patTauLabel, postfix).tauSource = tauSource
28 applyPostfix(process,
"patTaus" + patTauLabel, postfix).tauTransverseImpactParameterSource =
""
32 print "NO PF Isolation will be computed for CaloTau (this could be improved later)"
33 applyPostfix(process,
"patTaus" + patTauLabel, postfix).isolation = cms.PSet()
34 applyPostfix(process,
"patTaus" + patTauLabel, postfix).isoDeposits = cms.PSet()
35 applyPostfix(process,
"patTaus" + patTauLabel, postfix).userIsolation = cms.PSet()
38 if hasattr(process,
"cleanPatTaus" + patTauLabel + postfix):
39 getattr(process,
"cleanPatTaus" + patTauLabel + postfix).preselection = \
40 'tauID("leadingTrackFinding") > 0.5 & tauID("leadingTrackPtCut") > 0.5' \
41 +
' & tauID("byIsolation") > 0.5 & tauID("againstElectron") > 0.5 & (signalTracks.size() = 1 | signalTracks.size() = 3)'
44 """ Build a PSet defining the tau ID sources to embed into the pat::Tau """
46 for label, discriminator
in idSources:
47 if ":" in discriminator:
48 discr = discriminator.split(
":")
49 setattr(output, label, cms.InputTag(tauType + discr[0] + postfix +
":" + discr[1]))
51 setattr(output, label, cms.InputTag(tauType + discriminator + postfix))
60 """internal auxiliary function to switch to **any** PFTau collection"""
61 print ' switching PAT Tau input to: ', tauSource
63 applyPostfix(process,
"tauMatch" + patTauLabel, postfix).src = tauSource
64 applyPostfix(process,
"tauGenJetMatch" + patTauLabel, postfix).src = tauSource
66 applyPostfix(process,
"tauIsoDepositPFCandidates" + patTauLabel, postfix).src = tauSource
67 applyPostfix(process,
"tauIsoDepositPFCandidates" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
68 applyPostfix(process,
"tauIsoDepositPFChargedHadrons" + patTauLabel, postfix).src = tauSource
69 applyPostfix(process,
"tauIsoDepositPFChargedHadrons" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
70 applyPostfix(process,
"tauIsoDepositPFNeutralHadrons" + patTauLabel, postfix).src = tauSource
71 applyPostfix(process,
"tauIsoDepositPFNeutralHadrons" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
72 applyPostfix(process,
"tauIsoDepositPFGammas" + patTauLabel, postfix).src = tauSource
73 applyPostfix(process,
"tauIsoDepositPFGammas" + patTauLabel, postfix).ExtractorPSet.tauSource = tauSource
75 applyPostfix(process,
"patTaus" + patTauLabel, postfix).tauSource = tauSource
77 applyPostfix(process,
"patTaus" + patTauLabel, postfix).tauTransverseImpactParameterSource =
""
80 if hasattr(process,
"cleanPatTaus" + patTauLabel + postfix):
81 getattr(process,
"cleanPatTaus" + patTauLabel + postfix).preselection = \
82 'tauID("leadingTrackFinding") > 0.5 & tauID("leadingPionPtCut") > 0.5 & tauID("byIsolationUsingLeadingPion") > 0.5' \
83 +
' & tauID("againstMuon") > 0.5 & tauID("againstElectron") > 0.5' \
84 +
' & (signalPFChargedHadrCands.size() = 1 | signalPFChargedHadrCands.size() = 3)'
87 classicTauIDSources = [
88 (
"leadingTrackFinding",
"DiscriminationByLeadingTrackFinding"),
89 (
"leadingTrackPtCut",
"DiscriminationByLeadingTrackPtCut"),
90 (
"trackIsolation",
"DiscriminationByTrackIsolation"),
91 (
"ecalIsolation",
"DiscriminationByECALIsolation"),
92 (
"byIsolation",
"DiscriminationByIsolation"),
93 (
"againstElectron",
"DiscriminationAgainstElectron"),
94 (
"againstMuon",
"DiscriminationAgainstMuon") ]
96 classicPFTauIDSources = [
97 (
"leadingPionPtCut",
"DiscriminationByLeadingPionPtCut"),
98 (
"trackIsolationUsingLeadingPion",
"DiscriminationByTrackIsolationUsingLeadingPion"),
99 (
"ecalIsolationUsingLeadingPion",
"DiscriminationByECALIsolationUsingLeadingPion"),
100 (
"byIsolationUsingLeadingPion",
"DiscriminationByIsolationUsingLeadingPion")]
104 (
"decayModeFindingNewDMs",
"DiscriminationByDecayModeFindingNewDMs"),
105 (
"decayModeFinding",
"DiscriminationByDecayModeFinding"),
106 (
"byLooseCombinedIsolationDeltaBetaCorr3Hits",
"DiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"),
107 (
"byMediumCombinedIsolationDeltaBetaCorr3Hits",
"DiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits"),
108 (
"byTightCombinedIsolationDeltaBetaCorr3Hits",
"DiscriminationByTightCombinedIsolationDBSumPtCorr3Hits"),
109 (
"byCombinedIsolationDeltaBetaCorrRaw3Hits",
"DiscriminationByRawCombinedIsolationDBSumPtCorr3Hits"),
110 (
"byLoosePileupWeightedIsolation3Hits",
"DiscriminationByLoosePileupWeightedIsolation3Hits"),
111 (
"byMediumPileupWeightedIsolation3Hits",
"DiscriminationByMediumPileupWeightedIsolation3Hits"),
112 (
"byTightPileupWeightedIsolation3Hits",
"DiscriminationByTightPileupWeightedIsolation3Hits"),
113 (
"byPhotonPtSumOutsideSignalCone",
"DiscriminationByPhotonPtSumOutsideSignalCone"),
114 (
"byPileupWeightedIsolationRaw3Hits",
"DiscriminationByRawPileupWeightedIsolation3Hits"),
115 (
"chargedIsoPtSum",
"ChargedIsoPtSum"),
116 (
"neutralIsoPtSum",
"NeutralIsoPtSum"),
117 (
"puCorrPtSum",
"PUcorrPtSum"),
118 (
"neutralIsoPtSumWeight",
"NeutralIsoPtSumWeight"),
119 (
"footprintCorrection",
"FootprintCorrection"),
120 (
"photonPtSumOutsideSignalCone",
"PhotonPtSumOutsideSignalCone"),
128 (
"byIsolationMVA3oldDMwLTraw",
"DiscriminationByIsolationMVA3oldDMwLTraw"),
129 (
"byVLooseIsolationMVA3oldDMwLT",
"DiscriminationByVLooseIsolationMVA3oldDMwLT"),
130 (
"byLooseIsolationMVA3oldDMwLT",
"DiscriminationByLooseIsolationMVA3oldDMwLT"),
131 (
"byMediumIsolationMVA3oldDMwLT",
"DiscriminationByMediumIsolationMVA3oldDMwLT"),
132 (
"byTightIsolationMVA3oldDMwLT",
"DiscriminationByTightIsolationMVA3oldDMwLT"),
133 (
"byVTightIsolationMVA3oldDMwLT",
"DiscriminationByVTightIsolationMVA3oldDMwLT"),
134 (
"byVVTightIsolationMVA3oldDMwLT",
"DiscriminationByVVTightIsolationMVA3oldDMwLT"),
135 (
"byIsolationMVA3newDMwoLTraw",
"DiscriminationByIsolationMVA3newDMwoLTraw"),
142 (
"byIsolationMVA3newDMwLTraw",
"DiscriminationByIsolationMVA3newDMwLTraw"),
143 (
"byVLooseIsolationMVA3newDMwLT",
"DiscriminationByVLooseIsolationMVA3newDMwLT"),
144 (
"byLooseIsolationMVA3newDMwLT",
"DiscriminationByLooseIsolationMVA3newDMwLT"),
145 (
"byMediumIsolationMVA3newDMwLT",
"DiscriminationByMediumIsolationMVA3newDMwLT"),
146 (
"byTightIsolationMVA3newDMwLT",
"DiscriminationByTightIsolationMVA3newDMwLT"),
147 (
"byVTightIsolationMVA3newDMwLT",
"DiscriminationByVTightIsolationMVA3newDMwLT"),
148 (
"byVVTightIsolationMVA3newDMwLT",
"DiscriminationByVVTightIsolationMVA3newDMwLT"),
152 (
"againstElectronMVA5raw",
"DiscriminationByMVA5rawElectronRejection"),
153 (
"againstElectronMVA5category",
"DiscriminationByMVA5rawElectronRejection:category"),
154 (
"againstElectronVLooseMVA5",
"DiscriminationByMVA5VLooseElectronRejection"),
155 (
"againstElectronLooseMVA5",
"DiscriminationByMVA5LooseElectronRejection"),
156 (
"againstElectronMediumMVA5",
"DiscriminationByMVA5MediumElectronRejection"),
157 (
"againstElectronTightMVA5",
"DiscriminationByMVA5TightElectronRejection"),
158 (
"againstElectronVTightMVA5",
"DiscriminationByMVA5VTightElectronRejection"),
166 (
"againstMuonLoose3",
"DiscriminationByLooseMuonRejection3"),
167 (
"againstMuonTight3",
"DiscriminationByTightMuonRejection3"),
176 tauSource = cms.InputTag(
'fixedConePFTauProducer'),
179 fixedConeIDSources = copy.copy(classicTauIDSources)
180 fixedConeIDSources.extend(classicPFTauIDSources)
182 _switchToPFTau(process, tauSource,
'fixedConePFTau', fixedConeIDSources,
183 patTauLabel = patTauLabel, postfix = postfix)
187 tauSource = cms.InputTag(
'shrinkingConePFTauProducer'),
190 shrinkingIDSources = copy.copy(classicTauIDSources)
191 shrinkingIDSources.extend(classicPFTauIDSources)
193 _switchToPFTau(process, tauSource,
'shrinkingConePFTau', shrinkingIDSources,
194 patTauLabel = patTauLabel, postfix = postfix)
198 tauSource = cms.InputTag(
'hpsPFTauProducer'),
204 patTauLabel = patTauLabel, postfix = postfix)
207 applyPostfix(process,
"patTaus" + patTauLabel, postfix).tauTransverseImpactParameterSource = tauSource.value().
replace(
"Producer",
"TransverseImpactParameters")
210 if hasattr(process,
"cleanPatTaus" + patTauLabel + postfix):
211 getattr(process,
"cleanPatTaus" + patTauLabel + postfix).preselection = \
212 'pt > 18 & abs(eta) < 2.3 & tauID("decayModeFinding") > 0.5 & tauID("byLooseCombinedIsolationDeltaBetaCorr3Hits") > 0.5' \
213 +
' & tauID("againstMuonTight3") > 0.5 & tauID("againstElectronVLooseMVA5") > 0.5'
218 tauSource = cms.InputTag(
'hpsPFTauProducer'),
222 'shrinkingConePFTau' : switchToPFTauShrinkingCone,
223 'fixedConePFTau' : switchToPFTauFixedCone,
224 'hpsPFTau' : switchToPFTauHPS,
225 'caloRecoTau' : switchToCaloTau
227 if not pfTauType
in mapping.keys():
228 raise ValueError(
"Error in <switchToPFTauByType>: Undefined pfTauType = %s !!" % pfTauType)
230 mapping[pfTauType](process, tauSource = tauSource,
231 patTauLabel = patTauLabel, postfix = postfix)
235 """ Add a new collection of taus. Takes the configuration from the
236 already configured standard tau collection as starting point;
237 replaces before calling addTauCollection will also affect the
240 _label=
'addTauCollection'
241 _defaultParameters=dicttypes.SortedKeysDict()
243 ConfigToolBase.__init__(self)
245 self._defaultValue,
'Input tau collection', cms.InputTag)
247 self._defaultValue,
"label to indicate the tau algorithm (e.g.'hps')", str)
249 self._defaultValue,
"label to indicate the type of constituents (either 'PFTau' or 'Tau')", str)
251 True,
"run sequence for computing particle-flow based IsoDeposits")
253 "hps",
"standard algorithm label of the collection from which the clones " \
254 +
"for the new tau collection will be taken from " \
255 +
"(note that this tau collection has to be available in the event before hand)")
257 "PFTau",
"standard constituent type label of the collection from which the clones " \
258 +
" for the new tau collection will be taken from "\
259 +
"(note that this tau collection has to be available in the event before hand)")
268 tauCollection =
None,
271 doPFIsoDeposits =
None,
274 standardType =
None):
276 if tauCollection
is None:
278 if algoLabel
is None:
280 if typeLabel
is None:
282 if doPFIsoDeposits
is None:
284 if standardAlgo
is None:
286 if standardType
is None:
289 self.setParameter(
'tauCollection', tauCollection)
290 self.setParameter(
'algoLabel', algoLabel)
291 self.setParameter(
'typeLabel', typeLabel)
292 self.setParameter(
'doPFIsoDeposits', doPFIsoDeposits)
293 self.setParameter(
'standardAlgo', standardAlgo)
294 self.setParameter(
'standardType', standardType)
299 tauCollection = self.
_parameters[
'tauCollection'].value
302 doPFIsoDeposits = self.
_parameters[
'doPFIsoDeposits'].value
303 standardAlgo = self.
_parameters[
'standardAlgo'].value
304 standardType = self.
_parameters[
'standardType'].value
308 if typeLabel ==
'Tau':
309 print "NO PF Isolation will be computed for CaloTau (this could be improved later)"
310 doPFIsoDeposits =
False
314 def oldLabel(prefix = ''):
318 return prefix +
"PatTaus"
323 def capitalize(label):
324 return label[0].capitalize() + label[1:]
328 def newLabel(oldLabel):
330 if ( oldLabel.find(standardAlgo) >= 0
and oldLabel.find(standardType) >= 0 ):
331 oldLabel = oldLabel.replace(standardAlgo, algoLabel).
replace(standardType, typeLabel)
333 oldLabel = oldLabel + capitalize(algoLabel + typeLabel)
337 def addClone(hook, **replaceStatements):
340 newModule = getattr(process, hook).
clone(**replaceStatements)
343 def addPFIsoDepositClone(hook, **replaceStatements):
344 newModule = getattr(process, hook).
clone(**replaceStatements)
345 newModuleIsoDepositExtractor = getattr(newModule,
"ExtractorPSet")
346 setattr(newModuleIsoDepositExtractor,
"tauSource", getattr(newModule,
"src"))
349 addClone(oldLabel(), tauSource = tauCollection)
352 addClone(oldLabel(
'selected'), src = cms.InputTag(newLabel(oldLabel())))
355 addClone(oldLabel(
'clean'), src=cms.InputTag(newLabel(oldLabel(
'selected'))))
358 newTaus = getattr(process, newLabel(oldLabel()))
361 addClone(
'tauMatch', src = tauCollection)
362 addClone(
'tauGenJetMatch', src = tauCollection)
366 addPFIsoDepositClone(
'tauIsoDepositPFCandidates', src = tauCollection)
367 addPFIsoDepositClone(
'tauIsoDepositPFChargedHadrons', src = tauCollection)
368 addPFIsoDepositClone(
'tauIsoDepositPFNeutralHadrons', src = tauCollection)
369 addPFIsoDepositClone(
'tauIsoDepositPFGammas', src = tauCollection)
373 x.setModuleLabel(newLabel(x.moduleLabel))
376 fixInputTag(newTaus.genParticleMatch)
377 fixInputTag(newTaus.genJetMatch)
378 fixInputTag(newTaus.isoDeposits.pfAllParticles)
379 fixInputTag(newTaus.isoDeposits.pfNeutralHadron)
380 fixInputTag(newTaus.isoDeposits.pfChargedHadron)
381 fixInputTag(newTaus.isoDeposits.pfGamma)
382 fixInputTag(newTaus.userIsolation.pfAllParticles.src)
383 fixInputTag(newTaus.userIsolation.pfNeutralHadron.src)
384 fixInputTag(newTaus.userIsolation.pfChargedHadron.src)
385 fixInputTag(newTaus.userIsolation.pfGamma.src)
389 oldTaus = getattr(process, oldLabel())
390 if typeLabel ==
'Tau':
392 tauSource = getattr(newTaus,
"tauSource"),
393 patTauLabel = capitalize(algoLabel + typeLabel))
396 tauSource = getattr(newTaus,
"tauSource"),
397 patTauLabel = capitalize(algoLabel + typeLabel))
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)