CMS 3D CMS Logo

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

Functions

def CompactSkim
 

Function Documentation

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

Definition at line 3 of file CompactSkim_cff.py.

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