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