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

◆ CompactSkim()

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.

4 def CompactSkim(process,inFileNames,outFileName,Global_Tag='auto:run2_mc',MC=True,Filter=True):
5  patAlgosToolsTask = getPatAlgosToolsTask(process)
6 
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')
16 
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) )
21 
22  from Configuration.AlCa.GlobalTag import GlobalTag
23  process.GlobalTag = GlobalTag(process.GlobalTag, Global_Tag, '')
24 
25  # make patCandidates, select and clean them
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
33 
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\")'
40  )
41 
42  #make patTracks
43  from PhysicsTools.PatAlgos.tools.trackTools import makeTrackCandidates
44  makeTrackCandidates(process,
45  label = 'TrackCands', # output collection
46  tracks = cms.InputTag('generalTracks'), # input track collection
47  particleType = 'pi+', # particle type (for assigning a mass)
48  preselection = 'pt > 0.7', # preselection cut on candidates
49  selection = 'pt > 0.7', # selection on PAT Layer 1 objects
50  isolation = {}, # isolations to use (set to {} for None)
51  isoDeposits = [],
52  mcAs = None # replicate MC match as the one used for Muons
53  )
54  process.patTrackCands.embedTrack = True
55 
56  # dimuon = Onia2MUMU
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')
62 
63  process.onia2MuMuPATCounter = cms.EDFilter('CandViewCountFilter',
64  src = cms.InputTag('onia2MuMuPAT'),
65  minNumber = cms.uint32(1),
66  )
67 
68  # reduce MC genParticles a la miniAOD
69  process.load('PhysicsTools.PatAlgos.slimming.genParticles_cff')
70  patAlgosToolsTask.add(process.genParticlesTask)
71  process.packedGenParticles.inputVertices = cms.InputTag('offlinePrimaryVertices')
72 
73  # make photon candidate conversions for P-wave studies
74  process.load('HeavyFlavorAnalysis.Onia2MuMu.OniaPhotonConversionProducer_cfi')
75  patAlgosToolsTask.add(process.PhotonCandidates)
76 
77  # add v0 with tracks embed
78  process.load('HeavyFlavorAnalysis.Onia2MuMu.OniaAddV0TracksProducer_cfi')
79  patAlgosToolsTask.add(process.oniaV0Tracks)
80 
81  # Pick branches you want to keep
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_*_*_*'
94  ]
95 
96  if not MC:
97  from PhysicsTools.PatAlgos.tools.coreTools import runOnData
98  runOnData( process, outputModules = [] )
99  else :
100  SlimmedEventContent += [
101  'keep patPackedGenParticles_packedGenParticles_*_*',
102  'keep recoGenParticles_prunedGenParticles_*_*',
103  'keep GenFilterInfo_*_*_*',
104  'keep GenEventInfoProduct_generator_*_*',
105  'keep GenRunInfoProduct_*_*_*'
106  ]
107 
108  process.FilterOutput = cms.Path(process.onia2MuMuPATCounter)
109 
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()
114  )
115 
116  process.outpath = cms.EndPath(process.out, patAlgosToolsTask)
117 

References helpers.getPatAlgosToolsTask().

helpers.getPatAlgosToolsTask
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
CompactSkim_cff.CompactSkim
def CompactSkim(process, inFileNames, outFileName, Global_Tag='auto:run2_mc', MC=True, Filter=True)
Definition: CompactSkim_cff.py:4
GlobalTag
Definition: GlobalTag.h:4
coreTools