CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
miniAOD_tools.py
Go to the documentation of this file.
2 
4 
6  process.patMuons.isoDeposits = cms.PSet()
7  process.patElectrons.isoDeposits = cms.PSet()
8  process.patTaus.isoDeposits = cms.PSet()
9  process.patPhotons.isoDeposits = cms.PSet()
10  #
11  process.patMuons.embedTrack = True # used for IDs
12  process.patMuons.embedCombinedMuon = True # used for IDs
13  process.patMuons.embedMuonBestTrack = True # used for IDs
14  process.patMuons.embedStandAloneMuon = True # maybe?
15  process.patMuons.embedPickyMuon = False # no, use best track
16  process.patMuons.embedTpfmsMuon = False # no, use best track
17  process.patMuons.embedDytMuon = False # no, use best track
18  #
19  # disable embedding of electron and photon associated objects already stored by the ReducedEGProducer
20  process.patElectrons.embedGsfElectronCore = False ## process.patElectrons.embed in AOD externally stored gsf electron core
21  process.patElectrons.embedSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
22  process.patElectrons.embedPflowSuperCluster = False ## process.patElectrons.embed in AOD externally stored supercluster
23  process.patElectrons.embedSeedCluster = False ## process.patElectrons.embed in AOD externally stored the electron's seedcluster
24  process.patElectrons.embedBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's basic clusters
25  process.patElectrons.embedPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's preshower clusters
26  process.patElectrons.embedPflowBasicClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow basic clusters
27  process.patElectrons.embedPflowPreshowerClusters = False ## process.patElectrons.embed in AOD externally stored the electron's pflow preshower clusters
28  process.patElectrons.embedRecHits = False ## process.patElectrons.embed in AOD externally stored the RecHits - can be called from the PATElectronProducer
29  process.patElectrons.electronSource = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
30  process.patElectrons.electronIDSources = cms.PSet(
31  # configure many IDs as InputTag <someName> = <someTag> you
32  # can comment out those you don't want to save some disk space
33  eidRobustLoose = cms.InputTag("reducedEgamma","eidRobustLoose"),
34  eidRobustTight = cms.InputTag("reducedEgamma","eidRobustTight"),
35  eidLoose = cms.InputTag("reducedEgamma","eidLoose"),
36  eidTight = cms.InputTag("reducedEgamma","eidTight"),
37  eidRobustHighEnergy = cms.InputTag("reducedEgamma","eidRobustHighEnergy"),
38  )
39  process.elPFIsoDepositCharged.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
40  process.elPFIsoDepositChargedAll.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
41  process.elPFIsoDepositNeutral.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
42  process.elPFIsoDepositGamma.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
43  process.elPFIsoDepositPU.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
44  #
45  process.patPhotons.embedSuperCluster = False ## whether to process.patPhotons.embed in AOD externally stored supercluster
46  process.patPhotons.embedSeedCluster = False ## process.patPhotons.embed in AOD externally stored the photon's seedcluster
47  process.patPhotons.embedBasicClusters = False ## process.patPhotons.embed in AOD externally stored the photon's basic clusters
48  process.patPhotons.embedPreshowerClusters = False ## process.patPhotons.embed in AOD externally stored the photon's preshower clusters
49  process.patPhotons.embedRecHits = False ## process.patPhotons.embed in AOD externally stored the RecHits - can be called from the PATPhotonProducer
50  process.patPhotons.photonSource = cms.InputTag("reducedEgamma","reducedGedPhotons")
51  process.patPhotons.photonIDSources = cms.PSet(
52  PhotonCutBasedIDLoose = cms.InputTag('reducedEgamma',
53  'PhotonCutBasedIDLoose'),
54  PhotonCutBasedIDTight = cms.InputTag('reducedEgamma',
55  'PhotonCutBasedIDTight')
56  )
57 
58  process.phPFIsoDepositCharged.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
59  process.phPFIsoDepositChargedAll.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
60  process.phPFIsoDepositNeutral.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
61  process.phPFIsoDepositGamma.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
62  process.phPFIsoDepositPU.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
63  #
64  process.selectedPatJets.cut = cms.string("pt > 10")
65  process.selectedPatMuons.cut = cms.string("pt > 5 || isPFMuon || (pt > 3 && (isGlobalMuon || isStandAloneMuon || numberOfMatches > 0 || muonID('RPCMuLoose')))")
66  process.selectedPatElectrons.cut = cms.string("")
67  process.selectedPatTaus.cut = cms.string("pt > 18. && tauID('decayModeFinding')> 0.5")
68  process.selectedPatPhotons.cut = cms.string("")
69 
70  # add CMS top tagger
71  from RecoJets.JetProducers.caTopTaggers_cff import caTopTagInfos as toptag
72  process.cmsttRaw = toptag.clone()
73  process.caTopTagInfos = cms.EDProducer("RecoJetDeltaRTagInfoValueMapProducer",
74  src = cms.InputTag("ak8PFJetsCHS"),
75  matched = cms.InputTag("cmsTopTagPFJetsCHS"),
76  matchedTagInfos = cms.InputTag("cmsttRaw"),
77  distMax = cms.double(0.8)
78  )
79 
80  #add AK8
81  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
82  addJetCollection(process, labelName = 'AK8',
83  jetSource = cms.InputTag('ak8PFJetsCHS'),
84  algo= 'AK', rParam = 0.8,
85  jetCorrections = ('AK8PFchs', cms.vstring(['L1FastJet', 'L2Relative', 'L3Absolute']), 'None'),
86  btagInfos = ['caTopTagInfos']
87  )
88  process.patJetsAK8.userData.userFloats.src = [] # start with empty list of user floats
89  process.selectedPatJetsAK8.cut = cms.string("pt > 100")
90  process.patJetGenJetMatchAK8.matched = 'slimmedGenJets'
91  ## AK8 groomed masses
92  from RecoJets.Configuration.RecoPFJets_cff import ak8PFJetsCHSPruned, ak8PFJetsCHSFiltered, ak8PFJetsCHSTrimmed
93  process.ak8PFJetsCHSPruned = ak8PFJetsCHSPruned.clone()
94  process.ak8PFJetsCHSTrimmed = ak8PFJetsCHSTrimmed.clone()
95  process.ak8PFJetsCHSFiltered = ak8PFJetsCHSFiltered.clone()
96  process.load("RecoJets.JetProducers.ak8PFJetsCHS_groomingValueMaps_cfi")
97  process.patJetsAK8.userData.userFloats.src += ['ak8PFJetsCHSPrunedLinks','ak8PFJetsCHSTrimmedLinks','ak8PFJetsCHSFilteredLinks']
98 
99  # Add AK8 top tagging variables
100  process.patJetsAK8.tagInfoSources = cms.VInputTag(cms.InputTag("caTopTagInfos"))
101  process.patJetsAK8.addTagInfos = cms.bool(True)
102 
103 
104 
105  # add Njetiness
106  process.load('RecoJets.JetProducers.nJettinessAdder_cfi')
107  process.NjettinessAK8 = process.Njettiness.clone()
108  process.NjettinessAK8.src = cms.InputTag("ak8PFJetsCHS")
109  process.NjettinessAK8.cone = cms.double(0.8)
110  process.patJetsAK8.userData.userFloats.src += ['NjettinessAK8:tau1','NjettinessAK8:tau2','NjettinessAK8:tau3']
111 
112 
113 
114  #
115  from PhysicsTools.PatAlgos.tools.trigTools import switchOnTriggerStandAlone
116  switchOnTriggerStandAlone( process, outputModule = '' )
117  process.patTrigger.packTriggerPathNames = cms.bool(True)
118  #
119  # apply type I/type I + II PFMEt corrections to pat::MET object
120  # and estimate systematic uncertainties on MET
121  # FIXME: this and the typeI MET should become AK4 once we have the proper JEC?
122  from PhysicsTools.PatUtils.tools.runType1PFMEtUncertainties import runType1PFMEtUncertainties
123  addJetCollection(process, postfix = "ForMetUnc", labelName = 'AK4PF', jetSource = cms.InputTag('ak4PFJets'), jetCorrections = ('AK4PF', ['L1FastJet', 'L2Relative', 'L3Absolute'], ''))
124  process.patJetsAK4PFForMetUnc.getJetMCFlavour = False
126  addToPatDefaultSequence=False,
127  jetCollection="selectedPatJetsAK4PFForMetUnc",
128  electronCollection="selectedPatElectrons",
129  muonCollection="selectedPatMuons",
130  tauCollection="selectedPatTaus",
131  makeType1p2corrPFMEt=True,
132  outputModule=None)
133 
134 
135  #keep this after all addJetCollections otherwise it will attempt computing them also for stuf with no taginfos
136  #Some useful BTAG vars
137  process.patJets.userData.userFunctions = cms.vstring(
138  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).p4.M):(0)',
139  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).nTracks):(0)',
140  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().flightDistance(0).value):(0)',
141  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().flightDistance(0).significance):(0)',
142  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).p4.x):(0)',
143  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).p4.y):(0)',
144  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).p4.z):(0)',
145  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).position.x):(0)',
146  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).position.y):(0)',
147  '?(tagInfoSecondaryVertex().nVertices()>0)?(tagInfoSecondaryVertex().secondaryVertex(0).position.z):(0)',
148  )
149  process.patJets.userData.userFunctionLabels = cms.vstring('vtxMass','vtxNtracks','vtx3DVal','vtx3DSig','vtxPx','vtxPy','vtxPz','vtxPosX','vtxPosY','vtxPosZ')
150  process.patJets.tagInfoSources = cms.VInputTag(cms.InputTag("secondaryVertexTagInfos"))
151  process.patJets.addTagInfos = cms.bool(True)
152  #
153  ## PU JetID
154  process.load("PhysicsTools.PatAlgos.slimming.pileupJetId_cfi")
155  process.patJets.userData.userFloats.src = [ cms.InputTag("pileupJetId:fullDiscriminant"), ]
156 
157  #VID Electron IDs
158  electron_ids = ['RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_CSA14_50ns_V1_cff',
159  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_CSA14_PU20bx25_V0_cff',
160  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV50_CSA14_25ns_cff',
161  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV50_CSA14_startup_cff']
163  process.egmGsfElectronIDs.physicsObjectSrc = \
164  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
165  process.electronIDValueMapProducer.src = \
166  cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
167  process.electronIDValueMapProducer.ebReducedRecHitCollection = \
168  cms.InputTag("reducedEgamma","reducedEBRecHits")
169  process.electronIDValueMapProducer.eeReducedRecHitCollection = \
170  cms.InputTag("reducedEgamma","reducedEERecHits")
171  process.electronIDValueMapProducer.esReducedRecHitCollection = \
172  cms.InputTag("reducedEgamma","reducedESRecHits")
173  for idmod in electron_ids:
174  setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection)
175 
176 
177 
178 def miniAOD_customizeMC(process):
179  process.muonMatch.matched = "prunedGenParticles"
180  process.electronMatch.matched = "prunedGenParticles"
181  process.electronMatch.src = cms.InputTag("reducedEgamma","reducedGedGsfElectrons")
182  process.photonMatch.matched = "prunedGenParticles"
183  process.photonMatch.src = cms.InputTag("reducedEgamma","reducedGedPhotons")
184  process.tauMatch.matched = "prunedGenParticles"
185  process.tauGenJets.GenParticles = "prunedGenParticles"
186  process.patJetPartonMatch.matched = "prunedGenParticles"
187  process.patJetPartonMatch.mcStatus = [ 3, 23 ]
188  process.patJetGenJetMatch.matched = "slimmedGenJets"
189  process.patMuons.embedGenMatch = False
190  process.patElectrons.embedGenMatch = False
191  process.patPhotons.embedGenMatch = False
192  process.patTaus.embedGenMatch = False
193  process.patJets.embedGenPartonMatch = False
194  #also jet flavour must be switched to ak4
195  process.patJetFlavourAssociation.rParam = 0.4
196 
198  out.dropMetaData = cms.untracked.string('ALL')
199  out.fastCloning= cms.untracked.bool(False)
200  out.overrideInputFileSplitLevels = cms.untracked.bool(True)
201  out.compressionAlgorithm = cms.untracked.string('LZMA')
202 
204  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
205  runOnData( process, outputModules = [] )
206 
208  miniAOD_customizeCommon(process)
209  miniAOD_customizeData(process)
210  return process
211 
213  miniAOD_customizeCommon(process)
214  miniAOD_customizeMC(process)
215  return process
def setupAllVIDIdsInModule
Definition: vid_id_tools.py:31
def switchOnVIDElectronIdProducer
Electrons.
Definition: vid_id_tools.py:45
def miniAOD_customizeAllMC
def miniAOD_customizeCommon
Definition: miniAOD_tools.py:5
def miniAOD_customizeAllData
def miniAOD_customizeOutput
tuple switchOnTriggerStandAlone
Definition: trigTools.py:276
def miniAOD_customizeData