CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
miniAOD_tools Namespace Reference

Functions

def miniAOD_customizeAllData
 
def miniAOD_customizeAllMC
 
def miniAOD_customizeCommon
 
def miniAOD_customizeData
 
def miniAOD_customizeMC
 
def miniAOD_customizeOutput
 

Function Documentation

def miniAOD_tools.miniAOD_customizeAllData (   process)

Definition at line 261 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), and miniAOD_customizeData().

262 def miniAOD_customizeAllData(process):
263  miniAOD_customizeCommon(process)
264  miniAOD_customizeData(process)
265  return process
def miniAOD_customizeCommon
Definition: miniAOD_tools.py:5
def miniAOD_customizeAllData
def miniAOD_customizeData
def miniAOD_tools.miniAOD_customizeAllMC (   process)

Definition at line 266 of file miniAOD_tools.py.

References miniAOD_customizeCommon(), and miniAOD_customizeMC().

267 def miniAOD_customizeAllMC(process):
268  miniAOD_customizeCommon(process)
269  miniAOD_customizeMC(process)
270  return process
def miniAOD_customizeAllMC
def miniAOD_customizeCommon
Definition: miniAOD_tools.py:5
def miniAOD_tools.miniAOD_customizeCommon (   process)

Definition at line 5 of file miniAOD_tools.py.

References applySubstructure_cff.applySubstructure(), python.multivaluedict.map(), vid_id_tools.setupAllVIDIdsInModule(), trigTools.switchOnTriggerStandAlone, and vid_id_tools.switchOnVIDElectronIdProducer().

Referenced by miniAOD_customizeAllData(), and miniAOD_customizeAllMC().

5 
6 def miniAOD_customizeCommon(process):
7  process.patMuons.isoDeposits = cms.PSet()
8  process.patElectrons.isoDeposits = cms.PSet()
9  process.patTaus.isoDeposits = cms.PSet()
10  process.patPhotons.isoDeposits = cms.PSet()
11  #
12  process.patMuons.embedTrack = True # used for IDs
13  process.patMuons.embedCombinedMuon = True # used for IDs
14  process.patMuons.embedMuonBestTrack = True # used for IDs
15  process.patMuons.embedStandAloneMuon = True # maybe?
16  process.patMuons.embedPickyMuon = False # no, use best track
17  process.patMuons.embedTpfmsMuon = False # no, use best track
18  process.patMuons.embedDytMuon = False # no, use best track
19  #
20  # disable embedding of electron and photon associated objects already stored by the ReducedEGProducer
21  process.patElectrons.embedGsfElectronCore = False ## process.patElectrons.embed in AOD externally stored gsf electron core
22  process.patElectrons.embedSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
23  process.patElectrons.embedPflowSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
24  process.patElectrons.embedSeedCluster = False ## process.patElectrons.embed in AOD externally stored the electron's seedcluster
25  process.patElectrons.embedBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's basic clusters
26  process.patElectrons.embedPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's preshower clusters
27  process.patElectrons.embedPflowBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow basic clusters
28  process.patElectrons.embedPflowPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow preshower clusters
29  process.patElectrons.embedRecHits = False ## process.patElectrons.embed in AOD externally stored the RecHits - can be called from the PATElectronProducer
30  process.patElectrons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
31  process.patElectrons.electronIDSources = cms.PSet(
32  # configure many IDs as InputTag <someName> = <someTag> you
33  # can comment out those you don't want to save some disk space
34  eidRobustLoose = cms.InputTag("reducedEgamma","eidRobustLoose"),
35  eidRobustTight = cms.InputTag("reducedEgamma","eidRobustTight"),
36  eidLoose = cms.InputTag("reducedEgamma","eidLoose"),
37  eidTight = cms.InputTag("reducedEgamma","eidTight"),
38  eidRobustHighEnergy = cms.InputTag("reducedEgamma","eidRobustHighEnergy"),
39  )
40  process.patElectrons.addPFClusterIso = cms.bool(True)
41  process.patElectrons.ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleEcalPFClusIso")
42  process.patElectrons.hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "eleHcalPFClusIso")
43 
44  process.elPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
45  process.elPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
46  process.elPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
47  process.elPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
48  process.elPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
49  #
50  process.patPhotons.embedSuperCluster = False ## whether to process.patPhotons.embed in AOD externally stored supercluster
51  process.patPhotons.embedSeedCluster = False ## process.patPhotons.embed in AOD externally stored the photon's seedcluster
52  process.patPhotons.embedBasicClusters = False ## process.patPhotons.embed in AOD externally stored the photon's basic clusters
53  process.patPhotons.embedPreshowerClusters = False ## process.patPhotons.embed in AOD externally stored the photon's preshower clusters
54  process.patPhotons.embedRecHits = False ## process.patPhotons.embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer
55  process.patPhotons.addPFClusterIso = cms.bool(True)
56  process.patPhotons.ecalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoEcalPFClusIso")
57  process.patPhotons.hcalPFClusterIsoMap = cms.InputTag("reducedEgamma", "phoHcalPFClusIso")
58  process.patPhotons.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons")
59  process.patPhotons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
60  process.patPhotons.photonIDSources = cms.PSet(
61  PhotonCutBasedIDLoose = cms.InputTag('reducedEgamma',
62  'PhotonCutBasedIDLoose'),
63  PhotonCutBasedIDTight = cms.InputTag('reducedEgamma',
64  'PhotonCutBasedIDTight')
65  )
66 
67  process.phPFIsoDepositChargedPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
68  process.phPFIsoDepositChargedAllPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
69  process.phPFIsoDepositNeutralPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
70  process.phPFIsoDepositGammaPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
71  process.phPFIsoDepositPUPAT.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
72  #
73  process.selectedPatJets.cut = cms.string("pt > 10")
74  process.selectedPatMuons.cut = cms.string("pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose')))")
75  process.selectedPatElectrons.cut = cms.string("")
76  process.selectedPatTaus.cut = cms.string("pt > 18. && tauID('decayModeFindingNewDMs')> 0.5")
77  process.selectedPatPhotons.cut = cms.string("")
78 
79  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
80 
81  from PhysicsTools.PatAlgos.slimming.applySubstructure_cff import applySubstructure
82  applySubstructure( process )
83 
84 
85  #
86  from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerStandAlone
87  switchOnTriggerStandAlone( process, outputModule = '' )
88  process.patTrigger.packTriggerPathNames = cms.bool(True)
89  #
90  # apply type I/type I + II PFMEt corrections to pat::MET object
91  # and estimate systematic uncertainties on MET
92  # FIXME: are we 100% sure this should still be PF and not PFchs?
93  from PhysicsTools.PatUtils.tools.runType1PFMEtUncertainties import runType1PFMEtUncertainties
94  addJetCollection(process, postfix = "ForMetUnc", labelName = 'AK4PF', jetSource = cms.InputTag('ak4PFJets'), jetCorrections = ('AK4PF', ['L1FastJet', 'L2Relative', 'L3Absolute'], ''))
95  process.patJetsAK4PFForMetUnc.getJetMCFlavour = False
97  addToPatDefaultSequence=False,
98  jetCollectionUnskimmed="patJetsAK4PFForMetUnc",
99  jetCollection="selectedPatJetsAK4PFForMetUnc",
100  electronCollection="selectedPatElectrons",
101  muonCollection="selectedPatMuons",
102  tauCollection="selectedPatTaus",
103  makeType1p2corrPFMEt=True,
104  doSmearJets=False,
105  outputModule=None)
106 
107  from PhysicsTools.PatAlgos.tools.metTools import addMETCollection
108  addMETCollection(process,
109  labelName = "patCaloMet",
110  metSource = "caloMetM"
111  )
112 
113 
114  #keep this after all addJetCollections otherwise it will attempt computing them also for stuf with no taginfos
115  #Some useful BTAG vars
116  process.patJets.userData.userFunctions = cms.vstring(
117  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).p4.M):(0)',
118  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).numberOfSourceCandidatePtrs):(0)',
119  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").flightDistance(0).value):(0)',
120  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").flightDistance(0).significance):(0)',
121  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).p4.x):(0)',
122  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).p4.y):(0)',
123  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).p4.z):(0)',
124  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).vertex.x):(0)',
125  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).vertex.y):(0)',
126  '?(tagInfoCandSecondaryVertex("pfSecondaryVertex").nVertices()>0)?(tagInfoCandSecondaryVertex("pfSecondaryVertex").secondaryVertex(0).vertex.z):(0)',
127  )
128  process.patJets.userData.userFunctionLabels = cms.vstring('vtxMass','vtxNtracks','vtx3DVal','vtx3DSig','vtxPx','vtxPy','vtxPz','vtxPosX','vtxPosY','vtxPosZ')
129  process.patJets.tagInfoSources = cms.VInputTag(cms.InputTag("pfSecondaryVertexTagInfos"))
130  process.patJets.addTagInfos = cms.bool(True)
131  #
132  ## PU JetID
133  process.load("PhysicsTools.PatAlgos.slimming.pileupJetId_cfi")
134  process.patJets.userData.userFloats.src = [ cms.InputTag("pileupJetId:fullDiscriminant"), ]
135 
136  ## CaloJets
137  process.caloJetMap = cms.EDProducer("RecoJetDeltaRValueMapProducer",
138  src = process.patJets.jetSource,
139  matched = cms.InputTag("ak4CaloJets"),
140  distMax = cms.double(0.4),
141  values = cms.vstring('pt','emEnergyFraction'),
142  valueLabels = cms.vstring('pt','emEnergyFraction'),
143  lazyParser = cms.bool(True) )
144  process.patJets.userData.userFloats.src += [ cms.InputTag("caloJetMap:pt"), cms.InputTag("caloJetMap:emEnergyFraction") ]
145 
146  #EGM object modifications
147  from RecoEgamma.EgammaTools.egammaObjectModificationsInMiniAOD_cff import egamma_modifications
148  process.slimmedElectrons.modifierConfig.modifications = egamma_modifications
149  process.slimmedPhotons.modifierConfig.modifications = egamma_modifications
150 
151  #VID Electron IDs
152  electron_ids = ['RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_CSA14_50ns_V1_cff',
153  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_CSA14_PU20bx25_V0_cff',
154  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV50_CSA14_25ns_cff',
155  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV50_CSA14_startup_cff']
156  switchOnVIDElectronIdProducer(process, DataFormat.MiniAOD)
157  process.egmGsfElectronIDs.physicsObjectSrc = \
158  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
159  process.electronIDValueMapProducer.src = \
160  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
161  process.electronIDValueMapProducer.ebReducedRecHitCollection = \
162  cms.InputTag("reducedEgamma","reducedEBRecHits")
163  process.electronIDValueMapProducer.eeReducedRecHitCollection = \
164  cms.InputTag("reducedEgamma","reducedEERecHits")
165  process.electronIDValueMapProducer.esReducedRecHitCollection = \
166  cms.InputTag("reducedEgamma","reducedESRecHits")
167  for idmod in electron_ids:
168  setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection,None,False)
169 
170  # Adding puppi jets
171  process.load('CommonTools.PileupAlgos.Puppi_cff')
172  process.load('RecoJets.JetProducers.ak4PFJetsPuppi_cfi')
173  process.ak4PFJetsPuppi.doAreaFastjet = True # even for standard ak4PFJets this is overwritten in RecoJets/Configuration/python/RecoPFJets_cff
174  #process.puppi.candName = cms.InputTag('packedPFCandidates')
175  #process.puppi.vertexName = cms.InputTag('offlineSlimmedPrimaryVertices')
176 
177  from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import j2tParametersVX
178  process.ak4PFJetsPuppiTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
179  j2tParametersVX,
180  jets = cms.InputTag("ak4PFJetsPuppi")
181  )
182  process.patJetPuppiCharge = cms.EDProducer("JetChargeProducer",
183  src = cms.InputTag("ak4PFJetsPuppiTracksAssociatorAtVertex"),
184  var = cms.string('Pt'),
185  exp = cms.double(1.0)
186  )
187 
188  addJetCollection(process, postfix = "", labelName = 'Puppi', jetSource = cms.InputTag('ak4PFJetsPuppi'),
189  jetCorrections = ('AK4PFchs', ['L2Relative', 'L3Absolute'], ''),
190  algo= 'AK', rParam = 0.4, btagDiscriminators = map(lambda x: x.value() ,process.patJets.discriminatorSources)
191  )
192 
193  process.patJetGenJetMatchPuppi.matched = 'slimmedGenJets'
194 
195  process.patJetsPuppi.userData.userFloats.src = cms.VInputTag(cms.InputTag(""))
196  process.patJetsPuppi.jetChargeSource = cms.InputTag("patJetPuppiCharge")
197 
198  process.selectedPatJetsPuppi.cut = cms.string("pt > 20")
199 
200  process.load('PhysicsTools.PatAlgos.slimming.slimmedJets_cfi')
201  process.slimmedJetsPuppi = process.slimmedJets.clone()
202  process.slimmedJetsPuppi.src = cms.InputTag("selectedPatJetsPuppi")
203  process.slimmedJetsPuppi.packedPFCandidates = cms.InputTag("packedPFCandidates")
204 
205  ## puppi met
206  process.load('RecoMET.METProducers.PFMET_cfi')
207  process.pfMetPuppi = process.pfMet.clone()
208  process.pfMetPuppi.src = cms.InputTag("puppi")
209  process.pfMetPuppi.alias = cms.string('pfMetPuppi')
210  ## type1 correction, from puppi jets
211  process.corrPfMetType1Puppi = process.corrPfMetType1.clone(
212  src = 'ak4PFJetsPuppi',
213  jetCorrLabel = 'ak4PFCHSL2L3Corrector',
214  )
215  del process.corrPfMetType1Puppi.offsetCorrLabel # no L1 for PUPPI jets
216  process.pfMetT1Puppi = process.pfMetT1.clone(
217  src = 'pfMetPuppi',
218  srcCorrections = [ cms.InputTag("corrPfMetType1Puppi","type1") ]
219  )
220 
221  from PhysicsTools.PatAlgos.tools.metTools import addMETCollection
222  addMETCollection(process, labelName='patMETPuppi', metSource='pfMetT1Puppi') # T1
223  addMETCollection(process, labelName='patPFMetPuppi', metSource='pfMetPuppi') # RAW
224 
225  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
226  process.slimmedMETsPuppi = process.slimmedMETs.clone()
227  process.slimmedMETsPuppi.src = cms.InputTag("patMETPuppi")
228  process.slimmedMETsPuppi.rawUncertainties = cms.InputTag("patPFMetPuppi") # only central value
229  process.slimmedMETsPuppi.type1Uncertainties = cms.InputTag("patPFMetT1") # only central value for now
230  del process.slimmedMETsPuppi.type1p2Uncertainties # not available
def setupAllVIDIdsInModule
Definition: vid_id_tools.py:50
def switchOnVIDElectronIdProducer
Definition: vid_id_tools.py:69
def miniAOD_customizeCommon
Definition: miniAOD_tools.py:5
tuple switchOnTriggerStandAlone
Definition: trigTools.py:276
def miniAOD_tools.miniAOD_customizeData (   process)

Definition at line 257 of file miniAOD_tools.py.

Referenced by miniAOD_customizeAllData().

258 def miniAOD_customizeData(process):
259  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
260  runOnData( process, outputModules = [] )
def miniAOD_customizeData
def miniAOD_tools.miniAOD_customizeMC (   process)

Definition at line 231 of file miniAOD_tools.py.

Referenced by miniAOD_customizeAllMC().

232 def miniAOD_customizeMC(process):
233  process.muonMatch.matched = "prunedGenParticles"
234  process.electronMatch.matched = "prunedGenParticles"
235  process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
236  process.photonMatch.matched = "prunedGenParticles"
237  process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
238  process.tauMatch.matched = "prunedGenParticles"
239  process.tauGenJets.GenParticles = "prunedGenParticles"
240  process.patJetPartonMatch.matched = "prunedGenParticles"
241  process.patJetPartonMatch.mcStatus = [ 3, 23 ]
242  process.patJetGenJetMatch.matched = "slimmedGenJets"
243  process.patJetGenJetMatchAK8.matched = "slimmedGenJetsAK8"
244  process.patMuons.embedGenMatch = False
245  process.patElectrons.embedGenMatch = False
246  process.patPhotons.embedGenMatch = False
247  process.patTaus.embedGenMatch = False
248  process.patJets.embedGenPartonMatch = False
249  #also jet flavour must be switched to ak4
250  process.patJetFlavourAssociation.rParam = 0.4
def miniAOD_tools.miniAOD_customizeOutput (   out)

Definition at line 251 of file miniAOD_tools.py.

252 def miniAOD_customizeOutput(out):
253  out.dropMetaData = cms.untracked.string('ALL')
254  out.fastCloning= cms.untracked.bool(False)
255  out.overrideInputFileSplitLevels = cms.untracked.bool(True)
256  out.compressionAlgorithm = cms.untracked.string('LZMA')
def miniAOD_customizeOutput