4 def CompactSkim(process,inFileNames,outFileName,Global_Tag='auto:run2_mc
',MC=True,Filter=True):
7 process.load('Configuration.StandardSequences.Services_cff')
8 process.load(
'SimGeneral.HepPDTESSource.pythiapdt_cfi')
9 process.load(
'FWCore.MessageService.MessageLogger_cfi')
10 process.load(
'Configuration.EventContent.EventContent_cff')
11 process.load(
'Configuration.StandardSequences.GeometryRecoDB_cff')
12 process.load(
'Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
13 process.load(
'Configuration.StandardSequences.EndOfProcess_cff')
14 patAlgosToolsTask.add(process.MEtoEDMConverter)
15 process.load(
'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
17 process.MessageLogger.cerr.FwkReport.reportEvery = 100
18 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(
False) )
19 process.source = cms.Source(
'PoolSource', fileNames = cms.untracked.vstring(inFileNames))
20 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
22 from Configuration.AlCa.GlobalTag
import GlobalTag
23 process.GlobalTag =
GlobalTag(process.GlobalTag, Global_Tag,
'')
26 process.load(
'PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff')
27 patAlgosToolsTask.add(process.patCandidatesTask)
28 process.load(
'PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff')
29 patAlgosToolsTask.add(process.selectedPatCandidatesTask)
30 process.load(
'PhysicsTools.PatAlgos.cleaningLayer1.cleanPatCandidates_cff')
31 patAlgosToolsTask.add(process.cleanPatCandidatesTask)
32 process.patMuons.embedTrack =
True
34 process.selectedPatMuons.cut = cms.string(
'muonID(\"TMOneStationTight\")'
35 ' && abs(innerTrack.dxy) < 0.3'
36 ' && abs(innerTrack.dz) < 20.'
37 ' && innerTrack.hitPattern.trackerLayersWithMeasurement > 5'
38 ' && innerTrack.hitPattern.pixelLayersWithMeasurement > 0'
39 ' && innerTrack.quality(\"highPurity\")'
43 from PhysicsTools.PatAlgos.tools.trackTools
import makeTrackCandidates
44 makeTrackCandidates(process,
46 tracks = cms.InputTag(
'generalTracks'),
48 preselection =
'pt > 0.7',
49 selection =
'pt > 0.7',
54 process.patTrackCands.embedTrack =
True
57 process.load(
'HeavyFlavorAnalysis.Onia2MuMu.onia2MuMuPAT_cfi')
58 patAlgosToolsTask.add(process.onia2MuMuPAT)
59 process.onia2MuMuPAT.muons=cms.InputTag(
'cleanPatMuons')
60 process.onia2MuMuPAT.primaryVertexTag=cms.InputTag(
'offlinePrimaryVertices')
61 process.onia2MuMuPAT.beamSpotTag=cms.InputTag(
'offlineBeamSpot')
63 process.onia2MuMuPATCounter = cms.EDFilter(
'CandViewCountFilter',
64 src = cms.InputTag(
'onia2MuMuPAT'),
65 minNumber = cms.uint32(1),
69 process.load(
'PhysicsTools.PatAlgos.slimming.genParticles_cff')
70 patAlgosToolsTask.add(process.genParticlesTask)
71 process.packedGenParticles.inputVertices = cms.InputTag(
'offlinePrimaryVertices')
74 process.load(
'HeavyFlavorAnalysis.Onia2MuMu.OniaPhotonConversionProducer_cfi')
75 patAlgosToolsTask.add(process.PhotonCandidates)
78 process.load(
'HeavyFlavorAnalysis.Onia2MuMu.OniaAddV0TracksProducer_cfi')
79 patAlgosToolsTask.add(process.oniaV0Tracks)
82 SlimmedEventContent = [
83 'keep recoVertexs_offlinePrimaryVertices_*_*',
84 'keep *_inclusiveSecondaryVertices_*_*',
85 'keep *_offlineBeamSpot_*_*',
86 'keep *_TriggerResults_*_HLT',
87 'keep *_gtDigis_*_RECO',
88 'keep *_cleanPatTrackCands_*_*',
89 'keep *_PhotonCandidates_*_*',
90 'keep *_onia2MuMuPAT_*_*',
91 'keep *_generalV0Candidates_*_*',
92 'keep *_oniaV0Tracks_*_*',
93 'keep PileupSummaryInfos_*_*_*'
98 runOnData( process, outputModules = [] )
100 SlimmedEventContent += [
101 'keep patPackedGenParticles_packedGenParticles_*_*',
102 'keep recoGenParticles_prunedGenParticles_*_*',
103 'keep GenFilterInfo_*_*_*',
104 'keep GenEventInfoProduct_generator_*_*',
105 'keep GenRunInfoProduct_*_*_*'
108 process.FilterOutput = cms.Path(process.onia2MuMuPATCounter)
110 process.out = cms.OutputModule(
'PoolOutputModule',
111 fileName = cms.untracked.string(outFileName),
112 outputCommands = cms.untracked.vstring(
'drop *', *SlimmedEventContent),
113 SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring(
'FilterOutput'))
if Filter
else cms.untracked.PSet()
116 process.outpath = cms.EndPath(process.out, patAlgosToolsTask)