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