CMS 3D CMS Logo

Functions
CompactSkim_cff Namespace Reference

Functions

def CompactSkim (process, inFileNames, outFileName, Global_Tag='auto:run2_mc', MC=True, Filter=True)
 

Function Documentation

def CompactSkim_cff.CompactSkim (   process,
  inFileNames,
  outFileName,
  Global_Tag = 'auto:run2_mc',
  MC = True,
  Filter = True 
)

Definition at line 4 of file CompactSkim_cff.py.

References helpers.getPatAlgosToolsTask().

4 def CompactSkim(process,inFileNames,outFileName,Global_Tag='auto:run2_mc',MC=True,Filter=True):
5 
6  patAlgosToolsTask = getPatAlgosToolsTask(process)
7 
8  process.load('Configuration.StandardSequences.Services_cff')
9  process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
10  process.load('FWCore.MessageService.MessageLogger_cfi')
11  process.load('Configuration.EventContent.EventContent_cff')
12  process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
13  process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
14  process.load('Configuration.StandardSequences.EndOfProcess_cff')
15  patAlgosToolsTask.add(process.MEtoEDMConverter)
16  process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')
17 
18  process.MessageLogger.cerr.FwkReport.reportEvery = 100
19  process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )
20  process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring(inFileNames))
21  process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
22 
23  from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
24  process.GlobalTag = GlobalTag(process.GlobalTag, Global_Tag, '')
25 
26  # make patCandidates, select and clean them
27  process.load('PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff')
28  patAlgosToolsTask.add(process.patCandidatesTask)
29  process.load('PhysicsTools.PatAlgos.selectionLayer1.selectedPatCandidates_cff')
30  patAlgosToolsTask.add(process.selectedPatCandidatesTask)
31  process.load('PhysicsTools.PatAlgos.cleaningLayer1.cleanPatCandidates_cff')
32  patAlgosToolsTask.add(process.cleanPatCandidatesTask)
33  process.patMuons.embedTrack = True
34 
35  process.selectedPatMuons.cut = cms.string('muonID(\"TMOneStationTight\")'
36  ' && abs(innerTrack.dxy) < 0.3'
37  ' && abs(innerTrack.dz) < 20.'
38  ' && innerTrack.hitPattern.trackerLayersWithMeasurement > 5'
39  ' && innerTrack.hitPattern.pixelLayersWithMeasurement > 0'
40  ' && innerTrack.quality(\"highPurity\")'
41  )
42 
43  #make patTracks
44  from PhysicsTools.PatAlgos.tools.trackTools import makeTrackCandidates
45  makeTrackCandidates(process,
46  label = 'TrackCands', # output collection
47  tracks = cms.InputTag('generalTracks'), # input track collection
48  particleType = 'pi+', # particle type (for assigning a mass)
49  preselection = 'pt > 0.7', # preselection cut on candidates
50  selection = 'pt > 0.7', # selection on PAT Layer 1 objects
51  isolation = {}, # isolations to use (set to {} for None)
52  isoDeposits = [],
53  mcAs = None # replicate MC match as the one used for Muons
54  )
55  process.patTrackCands.embedTrack = True
56 
57  # dimuon = Onia2MUMU
58  process.load('HeavyFlavorAnalysis.Onia2MuMu.onia2MuMuPAT_cfi')
59  patAlgosToolsTask.add(process.onia2MuMuPAT)
60  process.onia2MuMuPAT.muons=cms.InputTag('cleanPatMuons')
61  process.onia2MuMuPAT.primaryVertexTag=cms.InputTag('offlinePrimaryVertices')
62  process.onia2MuMuPAT.beamSpotTag=cms.InputTag('offlineBeamSpot')
63 
64  process.onia2MuMuPATCounter = cms.EDFilter('CandViewCountFilter',
65  src = cms.InputTag('onia2MuMuPAT'),
66  minNumber = cms.uint32(1),
67  filter = cms.bool(True)
68  )
69 
70  # reduce MC genParticles a la miniAOD
71  process.load('PhysicsTools.PatAlgos.slimming.genParticles_cff')
72  patAlgosToolsTask.add(process.genParticlesTask)
73  process.packedGenParticles.inputVertices = cms.InputTag('offlinePrimaryVertices')
74 
75  # make photon candidate conversions for P-wave studies
76  process.load('HeavyFlavorAnalysis.Onia2MuMu.OniaPhotonConversionProducer_cfi')
77  patAlgosToolsTask.add(process.PhotonCandidates)
78 
79  # add v0 with tracks embed
80  process.load('HeavyFlavorAnalysis.Onia2MuMu.OniaAddV0TracksProducer_cfi')
81  patAlgosToolsTask.add(process.oniaV0Tracks)
82 
83  # Pick branches you want to keep
84  SlimmedEventContent = [
85  'keep recoVertexs_offlinePrimaryVertices_*_*',
86  'keep *_inclusiveSecondaryVertices_*_*',
87  'keep *_offlineBeamSpot_*_*',
88  'keep *_TriggerResults_*_HLT',
89  'keep *_gtDigis_*_RECO',
90  'keep *_cleanPatTrackCands_*_*',
91  'keep *_PhotonCandidates_*_*',
92  'keep *_onia2MuMuPAT_*_*',
93  'keep *_generalV0Candidates_*_*',
94  'keep *_oniaV0Tracks_*_*',
95  'keep PileupSummaryInfos_*_*_*'
96  ]
97 
98  if not MC:
99  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
100  runOnData( process, outputModules = [] )
101  else :
102  SlimmedEventContent += [
103  'keep patPackedGenParticles_packedGenParticles_*_*',
104  'keep recoGenParticles_prunedGenParticles_*_*',
105  'keep GenFilterInfo_*_*_*',
106  'keep GenEventInfoProduct_generator_*_*',
107  'keep GenRunInfoProduct_*_*_*'
108  ]
109 
110  process.FilterOutput = cms.Path(process.onia2MuMuPATCounter)
111 
112  process.out = cms.OutputModule('PoolOutputModule',
113  fileName = cms.untracked.string(outFileName),
114  outputCommands = cms.untracked.vstring('drop *', *SlimmedEventContent),
115  SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('FilterOutput')) if Filter else cms.untracked.PSet()
116  )
117 
118  process.outpath = cms.EndPath(process.out, patAlgosToolsTask)
119 
def CompactSkim(process, inFileNames, outFileName, Global_Tag='auto:run2_mc', MC=True, Filter=True)
def getPatAlgosToolsTask(process)
Definition: helpers.py:12