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 
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 # Clone tau producer
27 pfTausProducer = shrinkingConePFTauProducer.clone()
28 
29 # The isolation discriminator requires this as prediscriminant,
30 # as all sensical taus must have at least one track
31 pfTausDiscriminationByLeadingTrackFinding = \
32  shrinkingConePFTauDiscriminationByLeadingTrackFinding.clone()
33 pfTausDiscriminationByLeadingTrackFinding.PFTauProducer = "pfTausProducer"
34 
35 # The actual selections on pfTaus
36 pfTausDiscriminationByLeadingPionPtCut = \
37  shrinkingConePFTauDiscriminationByLeadingPionPtCut.clone()
38 pfTausDiscriminationByLeadingPionPtCut.PFTauProducer = "pfTausProducer"
39 
40 pfTausDiscriminationByIsolation = \
41  shrinkingConePFTauDiscriminationByIsolation.clone()
42 pfTausDiscriminationByIsolation.Prediscriminants.leadTrack.Producer = \
43  "pfTausDiscriminationByLeadingTrackFinding"
44 pfTausDiscriminationByIsolation.PFTauProducer = "pfTausProducer"
45 
46 # Sequence to reproduce taus and compute our cloned discriminants
47 pfTausBaseSequence = cms.Sequence(
48  pfTausProducer +
49  pfTausDiscriminationByLeadingTrackFinding +
50  pfTausDiscriminationByLeadingPionPtCut +
51  pfTausDiscriminationByIsolation
52  )
53 
54 # Associate track to pfJets
56 pfJetTracksAssociatorAtVertex = cms.EDProducer(
57  "JetTracksAssociatorAtVertex",
58  j2tParametersVX,
59  jets = cms.InputTag("pfJets")
60  )
61 pfTausProducer.jetSrc = pfJetTracksAssociatorAtVertex.jets
62 # is it correct collection w/o good leptons
63 pfTausProducer.builders[0].pfCandSrc = pfJets.src
64 
65 pfTauPileUpVertices = cms.EDFilter(
66  "RecoTauPileUpVertexSelector",
67  src = cms.InputTag("offlinePrimaryVertices"),
68  minTrackSumPt = cms.double(5),
69  filter = cms.bool(False),
70 )
71 
72 # PiZeroProducers
73 pfJetsPiZeros = ak5PFJetsRecoTauPiZeros.clone()
74 pfJetsLegacyTaNCPiZeros = ak5PFJetsLegacyTaNCPiZeros.clone()
75 pfJetsLegacyHPSPiZeros = ak5PFJetsLegacyHPSPiZeros.clone()
76 
77 pfJetsPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
78 pfJetsLegacyTaNCPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
79 pfJetsLegacyHPSPiZeros.jetSrc = pfJetTracksAssociatorAtVertex.jets
80 
81 pfTauPFJets08Region = recoTauAK5PFJets08Region.clone()
82 pfTauPFJets08Region.src = pfJetTracksAssociatorAtVertex.jets
83 pfTauPFJets08Region.pfSrc = pfJets.src
84 pfJetsPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
85 pfJetsLegacyTaNCPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
86 pfJetsLegacyHPSPiZeros.jetRegionSrc = 'pfTauPFJets08Region'
87 pfTausProducer.piZeroSrc = "pfJetsLegacyTaNCPiZeros"
88 pfTausProducer.jetRegionSrc = pfJetsLegacyTaNCPiZeros.jetRegionSrc
89 
90 pfTauTagInfoProducer = pfRecoTauTagInfoProducer.clone()
91 pfTauTagInfoProducer.PFCandidateProducer = pfJets.src
92 pfTauTagInfoProducer.PFJetTracksAssociatorProducer = 'pfJetTracksAssociatorAtVertex'
93 
94 pfTausProducer.modifiers[1] = cms.PSet(
95  name = cms.string("pfTauTTIworkaround"),
96  plugin = cms.string("RecoTauTagInfoWorkaroundModifer"),
97  pfTauTagInfoSrc = cms.InputTag("pfTauTagInfoProducer"),
98 )
99 
100 pfTausPreSequence = cms.Sequence(
101  pfJetTracksAssociatorAtVertex +
102  pfTauPFJets08Region +
103  pfTauPileUpVertices +
104  pfTauTagInfoProducer +
105  pfJetsPiZeros +
106  pfJetsLegacyTaNCPiZeros +
107  pfJetsLegacyHPSPiZeros
108 )
109 
110 # Select taus from given collection that pass cloned discriminants
111 pfTaus = pfTauSelector.clone()
112 pfTaus.src = cms.InputTag("pfTausProducer")
113 pfTaus.discriminators = cms.VPSet(
114  cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByLeadingPionPtCut"),selectionCut=cms.double(0.5) ),
115  cms.PSet( discriminator=cms.InputTag("pfTausDiscriminationByIsolation"),selectionCut=cms.double(0.5) )
116  )
117 
118 pfTauSequence = cms.Sequence(
119  pfTausPreSequence +
120  pfTausBaseSequence +
121  pfTaus
122  )
123 
124