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 pfJetsLegacyHPSPiZeros.jetSrc = cms.InputTag("ak4PFJets")
33 
34 pfTauPFJetsRecoTauChargedHadrons = ak4PFJetsRecoTauChargedHadrons.clone()
35 
36 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
37 pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
38 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
39 
40 # Clone tau producer
41 pfTausProducer = hpsPFTauProducer.clone()
42 pfTausCombiner = combinatoricRecoTaus.clone(
43  jetSrc = "ak4PFJets",
44  piZeroSrc = "pfJetsLegacyHPSPiZeros",
45  chargedHadronSrc = "pfTauPFJetsRecoTauChargedHadrons"
46 )
47 for mod in pfTausCombiner.modifiers:
48  if mod.name == "TTIworkaround": mod.pfTauTagInfoSrc = "pfTauTagInfoProducer"
49 
50 pfTausSelectionDiscriminator = hpsSelectionDiscriminator.clone()
51 pfTausSelectionDiscriminator.PFTauProducer = cms.InputTag("pfTausCombiner")
52 pfTausProducerSansRefs = hpsPFTauProducerSansRefs.clone()
53 pfTausProducerSansRefs = cms.EDProducer(
54  "RecoTauCleaner",
55  src = cms.InputTag("pfTausCombiner"),
56  outputSelection = cms.string(""),
57  verbosity = cms.int32(0),
58  cleaners = cms.VPSet(
59  cleaners.unitCharge,
60  cms.PSet(
61  name = cms.string("leadStripPtLt2_5"),
62  plugin = cms.string("RecoTauStringCleanerPlugin"),
63  tolerance = cleaners.tolerance_default,
64  selection = cms.string("signalPiZeroCandidates().size() = 0 | signalPiZeroCandidates()[0].pt > 2.5"),
65  selectionPassFunction = cms.string("0"),
66  selectionFailValue = cms.double(1e3)
67  ),
68  cms.PSet(
69  name = cms.string("HPS_Select"),
70  plugin = cms.string("RecoTauDiscriminantCleanerPlugin"),
71  tolerance = cleaners.tolerance_default,
72  src = cms.InputTag("pfTausSelectionDiscriminator"),
73  ),
74  cleaners.combinedIsolation
75  )
76 )
77 
78 
79 
80 pfTausProducerSansRefs.src=cms.InputTag("pfTausCombiner")
81 pfTausProducer.src = cms.InputTag("pfTausProducerSansRefs")
82 
83 #cloning discriminants
84 
85 pfTausDiscriminationByDecayModeFinding = hpsPFTauDiscriminationByDecayModeFinding.clone()
86 pfTausDiscriminationByDecayModeFinding.PFTauProducer="pfTausProducer"
87 
88 pfTausDiscriminationByIsolation= hpsPFTauBasicDiscriminators.clone()
89 pfTausDiscriminationByIsolation.PFTauProducer="pfTausProducer"
90 
91 pfTausrequireDecayMode = cms.PSet(
92  BooleanOperator = cms.string("and"),
93  decayMode = cms.PSet(
94  Producer = cms.InputTag('pfTausDiscriminationByDecayModeFinding'),
95  cut = cms.double(0.5)
96  )
97 )
98 
99 pfTausDiscriminationByIsolation.Prediscriminants=pfTausrequireDecayMode.clone()
100 
101 # Sequence to reproduce taus and compute our cloned discriminants
102 pfTausBaseSequence = cms.Sequence(
103  pfJetsLegacyHPSPiZeros +
104  pfTauPFJetsRecoTauChargedHadrons +
105  pfTausCombiner +
106  pfTausSelectionDiscriminator +
107  pfTausProducerSansRefs +
108  pfTausProducer +
109  pfTausDiscriminationByDecayModeFinding *
110  pfTausDiscriminationByIsolation
111  )
112 
113 # Associate track to pfJets
114 pfJetTracksAssociatorAtVertex = ak4PFJetTracksAssociatorAtVertex.clone()
115 pfJetTracksAssociatorAtVertex.jets= cms.InputTag("ak4PFJets")
116 
117 pfTauPileUpVertices = cms.EDFilter(
118  "RecoTauPileUpVertexSelector",
119  src = cms.InputTag("offlinePrimaryVertices"),
120  minTrackSumPt = cms.double(5),
121  filter = cms.bool(False),
122 )
123 
124 
125 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
126 pfTauTagInfoProducer.PFCandidateProducer = jetConfig.ak4PFJets.src
127 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
128 
129 pfTausPreSequence = cms.Sequence(
130  pfJetTracksAssociatorAtVertex +
131  recoTauAK4PFJets08Region +
132  pfTauPileUpVertices +
133  pfTauTagInfoProducer
134 )
135 
136 # Select taus from given collection that pass cloned discriminants
137 pfTaus = pfTauSelector.clone()
138 pfTaus.src = cms.InputTag("pfTausProducer")
139 pfTaus.discriminators = cms.VPSet(
140  cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByDecayModeFinding"),selectionCut=cms.double(0.5) ),
141  )
142 
143 pfTausPtrs = cms.EDProducer("PFTauFwdPtrProducer",
144  src=cms.InputTag("pfTaus")
145  )
146 
147 pfTauSequence = cms.Sequence(
148  pfTausPreSequence +
149  pfTausBaseSequence +
150  pfTaus +
151  pfTausPtrs
152  )
153 
154 
ak4PFJets_cfi
RecoPFTauTag_cff