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