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.
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],
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 > 200")
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 > 200")
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  )
92 
93 
94  ## Establish references between PATified fat jets and subjets using the BoostedJetMerger
95  process.slimmedJetsAK8PFCHSSoftDropPacked = cms.EDProducer("BoostedJetMerger",
96  jetSrc=cms.InputTag("selectedPatJetsAK8PFCHSSoftDrop"),
97  subjetSrc=cms.InputTag("slimmedJetsAK8PFCHSSoftDropSubjets")
98  )
99 
100  addJetCollection(
101  process,
102  labelName = 'CMSTopTagCHS',
103  jetSource = cms.InputTag('cmsTopTagPFJetsCHS'),
104  jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
105  btagDiscriminators = ['None'],
106  genJetCollection = cms.InputTag('slimmedGenJetsAK8'),
107  getJetMCFlavour = False #
108  )
109  process.selectedPatJetsCMSTopTagCHS.cut = cms.string("pt > 200")
110 
111  addJetCollection(
112  process,
113  labelName = 'CMSTopTagCHSSubjets',
114  jetSource = cms.InputTag('cmsTopTagPFJetsCHS','caTopSubJets'),
115  algo = 'AK', # needed for subjet flavor clustering
116  rParam = 0.8, # needed for subjet flavor clustering
117  btagDiscriminators = ['pfCombinedSecondaryVertexV2BJetTags', 'pfCombinedInclusiveSecondaryVertexV2BJetTags'],
118  jetCorrections = ('AK4PFchs', ['L1FastJet', 'L2Relative', 'L3Absolute'], 'None'),
119  genJetCollection = cms.InputTag('slimmedGenJets'), # Using ak4GenJets for matching which is not entirely appropriate
120  explicitJTA = True, # needed for subjet b tagging
121  svClustering = True, # needed for subjet b tagging
122  fatJets=cms.InputTag('ak8PFJetsCHS'), # needed for subjet flavor clustering
123  groomedFatJets=cms.InputTag('cmsTopTagPFJetsCHS') # needed for subjet flavor clustering
124 
125  )
126 
127  process.slimmedJetsCMSTopTagCHSSubjets = cms.EDProducer("PATJetSlimmer",
128  src = cms.InputTag("selectedPatJetsCMSTopTagCHSSubjets"),
129  packedPFCandidates = cms.InputTag("packedPFCandidates"),
130  dropJetVars = cms.string("1"),
131  dropDaughters = cms.string("0"),
132  rekeyDaughters = cms.string("1"),
133  dropTrackRefs = cms.string("1"),
134  dropSpecific = cms.string("1"),
135  dropTagInfos = cms.string("1"),
136  )
137 
138  ## Establish references between PATified fat jets and subjets using the BoostedJetMerger
139  process.slimmedJetsCMSTopTagCHSPacked = cms.EDProducer("BoostedJetMerger",
140  jetSrc=cms.InputTag("selectedPatJetsCMSTopTagCHS"),
141  subjetSrc=cms.InputTag("slimmedJetsCMSTopTagCHSSubjets")
142  )
143 
144 
145  process.packedPatJetsAK8 = cms.EDProducer("JetSubstructurePacker",
146  jetSrc = cms.InputTag("selectedPatJetsAK8"),
147  distMax = cms.double(0.8),
148  algoTags = cms.VInputTag(
149  # NOTE: For an optimal storage of the AK8 jet daughters, the first subjet collection listed here should be
150  # derived from AK8 jets, i.e., subjets should contain either all or a subset of AK8 constituents.
151  # The CMSTopTag subjets are derived from CA8 jets later matched to AK8 jets and could in principle
152  # contain extra constituents not clustered inside AK8 jets.
153  cms.InputTag("slimmedJetsAK8PFCHSSoftDropPacked"),
154  cms.InputTag("slimmedJetsCMSTopTagCHSPacked")
155  ),
156  algoLabels = cms.vstring(
157  'SoftDrop',
158  'CMSTopTag'
159  ),
160  fixDaughters = cms.bool(True),
161  packedPFCandidates = cms.InputTag("packedPFCandidates"),
162  )
163 
164  # switch off daughter re-keying since it's done in the JetSubstructurePacker (and can't be done afterwards)
165  process.slimmedJetsAK8.rekeyDaughters = "0"
166