CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
applySubstructure_cff Namespace Reference

Functions

def applySubstructure
 

Function Documentation

def applySubstructure_cff.applySubstructure (   process)

Definition at line 3 of file applySubstructure_cff.py.

Referenced by miniAOD_tools.miniAOD_customizeCommon().

3 
4 def applySubstructure( process ) :
5 
6  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
7 
8 
9  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets as patJetsDefault
10 
11  #add AK8
12  addJetCollection(process, labelName = 'AK8',
13  jetSource = cms.InputTag('ak8PFJetsCHS'),
14  algo= 'AK', rParam = 0.8,
15  jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
16  btagDiscriminators = ([x.getModuleLabel() for x in patJetsDefault.discriminatorSources] + ['pfBoostedDoubleSecondaryVertexAK8BJetTags']),
17  genJetCollection = cms.InputTag('slimmedGenJetsAK8')
18  )
19  process.patJetsAK8.userData.userFloats.src = [] # start with empty list of user floats
20  process.selectedPatJetsAK8.cut = cms.string("pt > 170")
21 
22 
23  process.load('RecoJets.JetProducers.ak8PFJetsPuppi_cfi')
24  process.ak8PFJetsPuppi.doAreaFastjet = True # even for standard ak8PFJets this is overwritten in RecoJets/Configuration/python/RecoPFJets_cff
25 
27  process.ak8PFJetsPuppiTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
28  j2tParametersVX,
29  jets = cms.InputTag("ak8PFJetsPuppi")
30  )
31  process.patJetPuppiCharge = cms.EDProducer("JetChargeProducer",
32  src = cms.InputTag("ak8PFJetsPuppiTracksAssociatorAtVertex"),
33  var = cms.string('Pt'),
34  exp = cms.double(1.0)
35  )
36 
37  ## AK8 groomed masses
38  from RecoJets.Configuration.RecoPFJets_cff import ak8PFJetsCHSPruned, ak8PFJetsCHSSoftDrop, ak8PFJetsPuppiSoftDrop
39  process.ak8PFJetsCHSPruned = ak8PFJetsCHSPruned.clone()
40  process.ak8PFJetsCHSSoftDrop = ak8PFJetsCHSSoftDrop.clone()
41  process.ak8PFJetsPuppiSoftDrop = ak8PFJetsPuppiSoftDrop.clone()
42  process.load("RecoJets.JetProducers.ak8PFJetsCHS_groomingValueMaps_cfi")
43  process.patJetsAK8.userData.userFloats.src += ['ak8PFJetsCHSPrunedMass','ak8PFJetsCHSSoftDropMass']
44  process.patJetsAK8.addTagInfos = cms.bool(False)
45 
46 
47 
48  # add Njetiness
49  process.load('RecoJets.JetProducers.nJettinessAdder_cfi')
50  process.NjettinessAK8 = process.Njettiness.clone()
51  process.NjettinessAK8.src = cms.InputTag("ak8PFJetsCHS")
52  process.NjettinessAK8.cone = cms.double(0.8)
53  process.patJetsAK8.userData.userFloats.src += ['NjettinessAK8:tau1','NjettinessAK8:tau2','NjettinessAK8:tau3']
54 
55 
56 
57 
58  #add AK8 from PUPPI
59 
60  process.load('RecoJets.JetProducers.ak8PFJetsPuppi_cfi')
61  process.ak8PFJetsPuppi.doAreaFastjet = True # even for standard ak8PFJets this is overwritten in RecoJets/Configuration/python/RecoPFJets_cff
62 
63 
64  addJetCollection(process, labelName = 'AK8Puppi',
65  jetSource = cms.InputTag('ak8PFJetsPuppi'),
66  algo= 'AK', rParam = 0.8,
67  jetCorrections = ('AK8PFPuppi', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
68  genJetCollection = cms.InputTag('slimmedGenJetsAK8')
69  )
70  process.patJetsAK8Puppi.userData.userFloats.src = [] # start with empty list of user floats
71  process.selectedPatJetsAK8Puppi.cut = cms.string("pt > 170")
72 
73 
75  process.ak8PFJetsPuppiTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
76  j2tParametersVX,
77  jets = cms.InputTag("ak8PFJetsPuppi")
78  )
79  process.patJetAK8PuppiCharge = cms.EDProducer("JetChargeProducer",
80  src = cms.InputTag("ak8PFJetsPuppiTracksAssociatorAtVertex"),
81  var = cms.string('Pt'),
82  exp = cms.double(1.0)
83  )
84 
85  ## AK8 groomed masses
86  from RecoJets.Configuration.RecoPFJets_cff import ak8PFJetsPuppiSoftDrop
87  process.ak8PFJetsPuppiSoftDrop = ak8PFJetsPuppiSoftDrop.clone()
88  process.load("RecoJets.JetProducers.ak8PFJetsPuppi_groomingValueMaps_cfi")
89  process.patJetsAK8Puppi.userData.userFloats.src += ['ak8PFJetsPuppiSoftDropMass']
90  process.patJetsAK8Puppi.addTagInfos = cms.bool(False)
91 
92 
93 
94  # add Njetiness
95  process.NjettinessAK8Puppi = process.Njettiness.clone()
96  process.NjettinessAK8Puppi.src = cms.InputTag("ak8PFJetsPuppi")
97  process.NjettinessAK8Puppi.cone = cms.double(0.8)
98  process.patJetsAK8Puppi.userData.userFloats.src += ['NjettinessAK8Puppi:tau1','NjettinessAK8Puppi:tau2','NjettinessAK8Puppi:tau3']
99 
100 
101 
102 
103  process.ak8PFJetsPuppiValueMap = cms.EDProducer("RecoJetToPatJetDeltaRValueMapProducer",
104  src = cms.InputTag("ak8PFJetsCHS"),
105  matched = cms.InputTag("patJetsAK8Puppi"),
106  distMax = cms.double(0.8),
107  values = cms.vstring([
108  'userFloat("NjettinessAK8Puppi:tau1")',
109  'userFloat("NjettinessAK8Puppi:tau2")',
110  'userFloat("NjettinessAK8Puppi:tau3")',
111  'pt','eta','phi','mass'
112  ]),
113  valueLabels = cms.vstring( [
114  'NjettinessAK8PuppiTau1',
115  'NjettinessAK8PuppiTau2',
116  'NjettinessAK8PuppiTau3',
117  'pt','eta','phi','mass'
118  ])
119  )
120  #process.patJetsAK8.userData.userFloats.src += ['NjettinessAK8:tau1','NjettinessAK8:tau2','NjettinessAK8:tau3']
121 
122  process.patJetsAK8.userData.userFloats.src += [cms.InputTag('ak8PFJetsPuppiValueMap','NjettinessAK8PuppiTau1'),
123  cms.InputTag('ak8PFJetsPuppiValueMap','NjettinessAK8PuppiTau2'),
124  cms.InputTag('ak8PFJetsPuppiValueMap','NjettinessAK8PuppiTau3'),
125  cms.InputTag('ak8PFJetsPuppiValueMap','pt'),
126  cms.InputTag('ak8PFJetsPuppiValueMap','eta'),
127  cms.InputTag('ak8PFJetsPuppiValueMap','phi'),
128  cms.InputTag('ak8PFJetsPuppiValueMap','mass'),
129  ]
130 
131 
132  ## PATify pruned fat jets
133  addJetCollection(
134  process,
135  labelName = 'AK8PFCHSSoftDrop',
136  jetSource = cms.InputTag('ak8PFJetsCHSSoftDrop'),
137  btagDiscriminators = ['None'],
138  jetCorrections = ('AK8PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
139  getJetMCFlavour = False # jet flavor disabled
140  )
141 
142  ## PATify soft drop subjets
143  addJetCollection(
144  process,
145  labelName = 'AK8PFCHSSoftDropSubjets',
146  jetSource = cms.InputTag('ak8PFJetsCHSSoftDrop','SubJets'),
147  algo = 'ak', # needed for subjet flavor clustering
148  rParam = 0.8, # needed for subjet flavor clustering
149  btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags'],
150  jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
151  explicitJTA = True, # needed for subjet b tagging
152  svClustering = True, # needed for subjet b tagging
153  genJetCollection = cms.InputTag('slimmedGenJets'),
154  fatJets=cms.InputTag('ak8PFJetsCHS'), # needed for subjet flavor clustering
155  groomedFatJets=cms.InputTag('ak8PFJetsCHSSoftDrop') # needed for subjet flavor clustering
156  )
157  process.selectedPatJetsAK8PFCHSSoftDrop.cut = cms.string("pt > 170")
158 
159  process.slimmedJetsAK8PFCHSSoftDropSubjets = cms.EDProducer("PATJetSlimmer",
160  src = cms.InputTag("selectedPatJetsAK8PFCHSSoftDropSubjets"),
161  packedPFCandidates = cms.InputTag("packedPFCandidates"),
162  dropJetVars = cms.string("1"),
163  dropDaughters = cms.string("0"),
164  rekeyDaughters = cms.string("1"),
165  dropTrackRefs = cms.string("1"),
166  dropSpecific = cms.string("1"),
167  dropTagInfos = cms.string("1"),
168  modifyJets = cms.bool(True),
169  modifierConfig = cms.PSet( modifications = cms.VPSet() )
170  )
171 
172 
173  ## Establish references between PATified fat jets and subjets using the BoostedJetMerger
174  process.slimmedJetsAK8PFCHSSoftDropPacked = cms.EDProducer("BoostedJetMerger",
175  jetSrc=cms.InputTag("selectedPatJetsAK8PFCHSSoftDrop"),
176  subjetSrc=cms.InputTag("slimmedJetsAK8PFCHSSoftDropSubjets")
177  )
178 
179 
180 
181 
182  ## PATify pruned fat jets
183  addJetCollection(
184  process,
185  labelName = 'AK8PFPuppiSoftDrop',
186  jetSource = cms.InputTag('ak8PFJetsPuppiSoftDrop'),
187  btagDiscriminators = ['None'],
188  jetCorrections = ('AK8PFPuppi', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
189  getJetMCFlavour = False # jet flavor disabled
190  )
191 
192  ## PATify soft drop subjets
193  addJetCollection(
194  process,
195  labelName = 'AK8PFPuppiSoftDropSubjets',
196  jetSource = cms.InputTag('ak8PFJetsPuppiSoftDrop','SubJets'),
197  algo = 'ak', # needed for subjet flavor clustering
198  rParam = 0.8, # needed for subjet flavor clustering
199  btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags'],
200  jetCorrections = ('AK4PFPuppi', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
201  explicitJTA = True, # needed for subjet b tagging
202  svClustering = True, # needed for subjet b tagging
203  genJetCollection = cms.InputTag('slimmedGenJets'),
204  fatJets=cms.InputTag('ak8PFJetsPuppi'), # needed for subjet flavor clustering
205  groomedFatJets=cms.InputTag('ak8PFJetsPuppiSoftDrop') # needed for subjet flavor clustering
206  )
207  process.selectedPatJetsAK8PFPuppiSoftDrop.cut = cms.string("pt > 170")
208 
209  process.slimmedJetsAK8PFPuppiSoftDropSubjets = cms.EDProducer("PATJetSlimmer",
210  src = cms.InputTag("selectedPatJetsAK8PFPuppiSoftDropSubjets"),
211  packedPFCandidates = cms.InputTag("packedPFCandidates"),
212  dropJetVars = cms.string("1"),
213  dropDaughters = cms.string("0"),
214  rekeyDaughters = cms.string("1"),
215  dropTrackRefs = cms.string("1"),
216  dropSpecific = cms.string("1"),
217  dropTagInfos = cms.string("1"),
218  modifyJets = cms.bool(True),
219  modifierConfig = cms.PSet( modifications = cms.VPSet() )
220  )
221 
222 
223  ## Establish references between PATified fat jets and subjets using the BoostedJetMerger
224  process.slimmedJetsAK8PFPuppiSoftDropPacked = cms.EDProducer("BoostedJetMerger",
225  jetSrc=cms.InputTag("selectedPatJetsAK8PFPuppiSoftDrop"),
226  subjetSrc=cms.InputTag("slimmedJetsAK8PFPuppiSoftDropSubjets")
227  )
228 
229 
230  process.packedPatJetsAK8 = cms.EDProducer("JetSubstructurePacker",
231  jetSrc = cms.InputTag("selectedPatJetsAK8"),
232  distMax = cms.double(0.8),
233  algoTags = cms.VInputTag(
234  # NOTE: For an optimal storage of the AK8 jet daughters, the first subjet collection listed here should be
235  # derived from AK8 jets, i.e., subjets should contain either all or a subset of AK8 constituents.
236  # The PUPPI collection has its own pointers to its own PUPPI constituents.
237  cms.InputTag("slimmedJetsAK8PFCHSSoftDropPacked"),
238  cms.InputTag("slimmedJetsAK8PFPuppiSoftDropPacked")
239  ),
240  algoLabels = cms.vstring(
241  'SoftDrop',
242  'SoftDropPuppi'
243  ),
244  fixDaughters = cms.bool(True),
245  packedPFCandidates = cms.InputTag("packedPFCandidates"),
246  )
247 
248  # switch off daughter re-keying since it's done in the JetSubstructurePacker (and can't be done afterwards)
249  process.slimmedJetsAK8.rekeyDaughters = "0"
250