CMS 3D CMS Logo

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