CMS 3D CMS Logo

pfTaus_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4 from RecoTauTag.RecoTau.pfTauSelector_cfi import pfTauSelector
5 import RecoTauTag.RecoTau.RecoTauCleanerPlugins as cleaners
6 import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
7 
8 '''
9 
10 pfTaus_cff
11 
12 Specify the prototype/default configuration of 'pfTaus', which is a selected
13 collection of taus that is used as an input to the 'patTaus'. The pf2pat tau
14 selection is constructed by:
15  * Rerunning a tau algorithm (fixedConePFTaus, shrinkingConePFTaus, etc)
16  * Cloning and running a set of discriminants for this algorithm so they are
17  independent of other cfis
18  * Constructing pfTaus via a PFTauSelector using the cloned discriminants
19  * In PhysicsTools.PatAlgos.tools.pfTools the regular discriminants are
20  modified to take the pfTaus as input. The original discriminant
21  labels are kept (i.e. fixedConePFTauDiscriminationByIsolation) but the Tau
22  source is defined as pfTaus
23 
24 '''
25 
26 
27 
28 
29 # PiZeroProducers
30 
31 pfJetsLegacyHPSPiZeros = ak4PFJetsLegacyHPSPiZeros.clone(
32  jetSrc = "ak4PFJets"
33 )
34 pfTauPFJetsRecoTauChargedHadrons = ak4PFJetsRecoTauChargedHadrons.clone()
35 
36 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone(
37  PFCandidateProducer = jetConfig.ak4PFJets.src ,
38  PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
39 )
40 # Clone tau producer
41 pfTausProducer = hpsPFTauProducer.clone(
42  src = "pfTausProducerSansRefs"
43 )
44 pfTausCombiner = combinatoricRecoTaus.clone(
45  jetSrc = "ak4PFJets",
46  piZeroSrc = "pfJetsLegacyHPSPiZeros",
47  chargedHadronSrc = "pfTauPFJetsRecoTauChargedHadrons"
48 )
49 for mod in pfTausCombiner.modifiers:
50  if mod.name == "TTIworkaround": mod.pfTauTagInfoSrc = "pfTauTagInfoProducer"
51 
52 pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone(
53  PFTauProducer = "pfTausCombiner"
54 )
55 pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone(
56  src = "pfTausCombiner",
57  outputSelection = "",
58  verbosity = 0,
59  cleaners = [
60  cleaners.unitCharge,
61  cms.PSet(
62  name = cms.string("leadStripPtLt2_5"),
63  plugin = cms.string("RecoTauStringCleanerPlugin"),
64  tolerance = cleaners.tolerance_default,
65  selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
66  selectionPassFunction = cms.string("0"),
67  selectionFailValue = cms.double(1e3)
68  ),
69  cms.PSet(
70  name = cms.string("HPS_Select"),
71  plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
72  tolerance = cleaners.tolerance_default,
73  src = cms.InputTag("pfTausSelectionDiscriminator"),
74  ),
75  cleaners.combinedIsolation
76  ]
77 )
78 
79 #cloning discriminants
80 
81 pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone(
82  PFTauProducer = "pfTausProducer"
83 )
84 
85 pfTausrequireDecayMode = cms.PSet(
86  BooleanOperator = cms.string("and"),
87  decayMode = cms.PSet(
88  Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
89  cut = cms.double(0.5)
90  )
91 )
92 
93 pfTausDiscriminationByIsolation= hpsPFTauBasicDiscriminators.clone(
94  PFTauProducer = "pfTausProducer",
95  Prediscriminants = pfTausrequireDecayMode.clone()
96 )
97 
98 # Task to reproduce taus and compute our cloned discriminants
99 pfTausBaseTask = cms.Task(
100  pfJetsLegacyHPSPiZeros ,
101  pfTauPFJetsRecoTauChargedHadrons ,
102  pfTausCombiner ,
103  pfTausSelectionDiscriminator ,
104  pfTausProducerSansRefs ,
105  pfTausProducer ,
106  pfTausDiscriminationByDecayModeFinding ,
107  pfTausDiscriminationByIsolation
108 )
109 
110 # Associate track to pfJets
111 pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone(
112  jets = "ak4PFJets"
113 )
114 
115 pfTauPileUpVertices = cms.EDFilter(
116  "RecoTauPileUpVertexSelector",
117  src = cms.InputTag("offlinePrimaryVertices"),
118  minTrackSumPt = cms.double(5),
119  filter = cms.bool(False),
120 )
121 
122 
123 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone(
124  PFCandidateProducer = jetConfig.ak4PFJets.src ,
125  PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
126 )
127 pfTausPreTask = cms.Task(
128  pfJetTracksAssociatorAtVertex ,
129  recoTauAK4PFJets08Region ,
130  pfTauPileUpVertices ,
131  pfTauTagInfoProducer
132 )
133 
134 # Select taus from given collection that pass cloned discriminants
135 pfTaus = pfTauSelector.clone(
136  src = "pfTausProducer",
137  discriminators = cms.VPSet(
138  cms.PSet(
139  discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),
140  selectionCut=cms.double(0.5)
141  ),
142  )
143 )
144 pfTausPtrs = cms.EDProducer("PFTauFwdPtrProducer",
145  src=cms.InputTag("pfTaus")
146 )
147 
148 pfTauTask = cms.Task(
149  pfTausPreTask ,
150  pfTausBaseTask ,
151  pfTaus ,
152  pfTausPtrs
153 )
154 pfTauSequence = cms.Sequence(pfTauTask)