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