CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
applySubstructure_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 def applySubstructure( process ) :
4 
5  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
6 
7  # add CMS top tagger
8  from RecoJets.JetProducers.caTopTaggers_cff import caTopTagInfos
9  process.caTopTagInfos = caTopTagInfos.clone()
10  process.caTopTagInfosPAT = cms.EDProducer("RecoJetDeltaRTagInfoValueMapProducer",
11  src = cms.InputTag("ak8PFJetsCHS"),
12  matched = cms.InputTag("cmsTopTagPFJetsCHS"),
13  matchedTagInfos = cms.InputTag("caTopTagInfos"),
14  distMax = cms.double(0.8)
15  )
16 
17  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import patJets as patJetsDefault
18 
19  #add AK8
20  addJetCollection(process, labelName = 'AK8',
21  jetSource = cms.InputTag('ak8PFJetsCHS'),
22  algo= 'AK', rParam = 0.8,
23  jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
24  btagDiscriminators = ([x.getModuleLabel() for x in patJetsDefault.discriminatorSources] + ['pfBoostedDoubleSecondaryVertexAK8BJetTags']),
25  genJetCollection = cms.InputTag('slimmedGenJetsAK8')
26  )
27  process.patJetsAK8.userData.userFloats.src = [] # start with empty list of user floats
28  process.selectedPatJetsAK8.cut = cms.string("pt > 170")
29 
30 
31 
32  ## AK8 groomed masses
33  from RecoJets.Configuration.RecoPFJets_cff import ak8PFJetsCHSPruned, ak8PFJetsCHSSoftDrop, ak8PFJetsCHSFiltered, ak8PFJetsCHSTrimmed
34  process.ak8PFJetsCHSPruned = ak8PFJetsCHSPruned.clone()
35  process.ak8PFJetsCHSSoftDrop = ak8PFJetsCHSSoftDrop.clone()
36  process.ak8PFJetsCHSTrimmed = ak8PFJetsCHSTrimmed.clone()
37  process.ak8PFJetsCHSFiltered = ak8PFJetsCHSFiltered.clone()
38  process.load("RecoJets.JetProducers.ak8PFJetsCHS_groomingValueMaps_cfi")
39  process.patJetsAK8.userData.userFloats.src += ['ak8PFJetsCHSPrunedMass','ak8PFJetsCHSSoftDropMass','ak8PFJetsCHSTrimmedMass','ak8PFJetsCHSFilteredMass']
40 
41  # Add AK8 top tagging variables
42  process.patJetsAK8.tagInfoSources = cms.VInputTag(cms.InputTag("caTopTagInfosPAT"))
43  process.patJetsAK8.addTagInfos = cms.bool(True)
44 
45 
46 
47  # add Njetiness
48  process.load('RecoJets.JetProducers.nJettinessAdder_cfi')
49  process.NjettinessAK8 = process.Njettiness.clone()
50  process.NjettinessAK8.src = cms.InputTag("ak8PFJetsCHS")
51  process.NjettinessAK8.cone = cms.double(0.8)
52  process.patJetsAK8.userData.userFloats.src += ['NjettinessAK8:tau1','NjettinessAK8:tau2','NjettinessAK8:tau3']
53 
54 
55  ## PATify pruned fat jets
56  addJetCollection(
57  process,
58  labelName = 'AK8PFCHSSoftDrop',
59  jetSource = cms.InputTag('ak8PFJetsCHSSoftDrop'),
60  btagDiscriminators = ['None'],
61  jetCorrections = ('AK8PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
62  getJetMCFlavour = False # jet flavor disabled
63  )
64 
65  ## PATify soft drop subjets
66  addJetCollection(
67  process,
68  labelName = 'AK8PFCHSSoftDropSubjets',
69  jetSource = cms.InputTag('ak8PFJetsCHSSoftDrop','SubJets'),
70  algo = 'ak', # needed for subjet flavor clustering
71  rParam = 0.8, # needed for subjet flavor clustering
72  btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags'],
73  jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
74  explicitJTA = True, # needed for subjet b tagging
75  svClustering = True, # needed for subjet b tagging
76  genJetCollection = cms.InputTag('slimmedGenJets'),
77  fatJets=cms.InputTag('ak8PFJetsCHS'), # needed for subjet flavor clustering
78  groomedFatJets=cms.InputTag('ak8PFJetsCHSSoftDrop') # needed for subjet flavor clustering
79  )
80  process.selectedPatJetsAK8PFCHSSoftDrop.cut = cms.string("pt > 170")
81 
82  process.slimmedJetsAK8PFCHSSoftDropSubjets = cms.EDProducer("PATJetSlimmer",
83  src = cms.InputTag("selectedPatJetsAK8PFCHSSoftDropSubjets"),
84  packedPFCandidates = cms.InputTag("packedPFCandidates"),
85  dropJetVars = cms.string("1"),
86  dropDaughters = cms.string("0"),
87  rekeyDaughters = cms.string("1"),
88  dropTrackRefs = cms.string("1"),
89  dropSpecific = cms.string("1"),
90  dropTagInfos = cms.string("1"),
91  modifyJets = cms.bool(True),
92  modifierConfig = cms.PSet( modifications = cms.VPSet() )
93  )
94 
95 
96  ## Establish references between PATified fat jets and subjets using the BoostedJetMerger
97  process.slimmedJetsAK8PFCHSSoftDropPacked = cms.EDProducer("BoostedJetMerger",
98  jetSrc=cms.InputTag("selectedPatJetsAK8PFCHSSoftDrop"),
99  subjetSrc=cms.InputTag("slimmedJetsAK8PFCHSSoftDropSubjets")
100  )
101 
102  addJetCollection(
103  process,
104  labelName = 'CMSTopTagCHS',
105  jetSource = cms.InputTag('cmsTopTagPFJetsCHS'),
106  jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
107  btagDiscriminators = ['None'],
108  genJetCollection = cms.InputTag('slimmedGenJetsAK8'),
109  getJetMCFlavour = False #
110  )
111  process.selectedPatJetsCMSTopTagCHS.cut = cms.string("pt > 200")
112 
113  addJetCollection(
114  process,
115  labelName = 'CMSTopTagCHSSubjets',
116  jetSource = cms.InputTag('cmsTopTagPFJetsCHS','caTopSubJets'),
117  algo = 'AK', # needed for subjet flavor clustering
118  rParam = 0.8, # needed for subjet flavor clustering
119  btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags'],
120  jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
121  genJetCollection = cms.InputTag('slimmedGenJets'), # Using ak4GenJets for matching which is not entirely appropriate
122  explicitJTA = True, # needed for subjet b tagging
123  svClustering = True, # needed for subjet b tagging
124  fatJets=cms.InputTag('ak8PFJetsCHS'), # needed for subjet flavor clustering
125  groomedFatJets=cms.InputTag('cmsTopTagPFJetsCHS') # needed for subjet flavor clustering
126 
127  )
128 
129  process.slimmedJetsCMSTopTagCHSSubjets = cms.EDProducer("PATJetSlimmer",
130  src = cms.InputTag("selectedPatJetsCMSTopTagCHSSubjets"),
131  packedPFCandidates = cms.InputTag("packedPFCandidates"),
132  dropJetVars = cms.string("1"),
133  dropDaughters = cms.string("0"),
134  rekeyDaughters = cms.string("1"),
135  dropTrackRefs = cms.string("1"),
136  dropSpecific = cms.string("1"),
137  dropTagInfos = cms.string("1"),
138  modifyJets = cms.bool(True),
139  modifierConfig = cms.PSet( modifications = cms.VPSet() )
140  )
141 
142  ## Establish references between PATified fat jets and subjets using the BoostedJetMerger
143  process.slimmedJetsCMSTopTagCHSPacked = cms.EDProducer("BoostedJetMerger",
144  jetSrc=cms.InputTag("selectedPatJetsCMSTopTagCHS"),
145  subjetSrc=cms.InputTag("slimmedJetsCMSTopTagCHSSubjets")
146  )
147 
148 
149  process.packedPatJetsAK8 = cms.EDProducer("JetSubstructurePacker",
150  jetSrc = cms.InputTag("selectedPatJetsAK8"),
151  distMax = cms.double(0.8),
152  algoTags = cms.VInputTag(
153  # NOTE: For an optimal storage of the AK8 jet daughters, the first subjet collection listed here should be
154  # derived from AK8 jets, i.e., subjets should contain either all or a subset of AK8 constituents.
155  # The CMSTopTag subjets are derived from CA8 jets later matched to AK8 jets and could in principle
156  # contain extra constituents not clustered inside AK8 jets.
157  cms.InputTag("slimmedJetsAK8PFCHSSoftDropPacked"),
158  cms.InputTag("slimmedJetsCMSTopTagCHSPacked")
159  ),
160  algoLabels = cms.vstring(
161  'SoftDrop',
162  'CMSTopTag'
163  ),
164  fixDaughters = cms.bool(True),
165  packedPFCandidates = cms.InputTag("packedPFCandidates"),
166  )
167 
168  # switch off daughter re-keying since it's done in the JetSubstructurePacker (and can't be done afterwards)
169  process.slimmedJetsAK8.rekeyDaughters = "0"
170