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