CMS 3D CMS Logo

Functions
applySubstructure_cff Namespace Reference

Functions

def applySubstructure (process, postfix="")
 

Function Documentation

def applySubstructure_cff.applySubstructure (   process,
  postfix = "" 
)

Definition at line 5 of file applySubstructure_cff.py.

References helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

Referenced by miniAOD_tools.miniAOD_customizeCommon().

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