1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
import os
import FWCore.ParameterSet.Config as cms
##
## Setup command line options
##
import FWCore.ParameterSet.VarParsing as VarParsing
import sys
options = VarParsing.VarParsing ('standard')
options.register('sample', 'data1', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Input sample")
# get and parse the command line arguments
options.parseArguments()
print("Input sample: ", options.sample)
##
## Process definition
##
process = cms.Process("ApeSkim")
##
## Message Logger
##
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.AlignmentTrackSelector=dict()
process.MessageLogger.cerr.INFO.limit = 0
process.MessageLogger.cerr.default.limit = -1
process.MessageLogger.cerr.AlignmentTrackSelector = cms.untracked.PSet(limit = cms.untracked.int32(-1))
process.MessageLogger.cerr.FwkReport.reportEvery = 1000 ## really show only every 1000th
##
## Process options
##
process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(True),
)
##
## Start of Configuration
##
maxEvents = -1
outputName = "defaultOutputName.root"
outputPath = None
outputFileSize = 350000
##
## TrackSelection can be SingleMu, DoubleMu, MinBias, Cosmics
## The choice affects which AlignmentTrackSelector is used.
## Currently, DoubleMu means ZToMuMu, so if there is the need
## for UpsilonToMuMu or JPsiToMuMu, these have to be added first
##
trackSelection = "SingleMu"
globalTag = None
outputPath = None # can also be specified. If that is done, files are copied to this path afterwards
if "iov" in options.sample:
## Configure here for campaigns with many different datasets (such as multi-IOV)
iovNo = options.sample.split("iov")[1]
process.load("Alignment.APEEstimation.samples.")
outputName = ".root"
outputPath = None
trackSelection = "SingleMu"
if options.sample == 'data1':
process.load("Alignment.APEEstimation.samples.Data_TkAlMinBias_Run2018C_PromptReco_v3_cff")
outputName = 'MinBias.root'
#outputPath = "workingArea"
trackSelection = "MinBias"
if options.sample == 'data3':
process.load("Alignment.APEEstimation.samples.Data_TkAlMuonIsolated_22Jan2013C_v1_cff")
outputName = 'Data_TkAlMuonIsolated_22Jan2013C.root'
trackSelection = "SingleMu"
if options.sample == 'data4':
process.load("Alignment.APEEstimation.samples.Data_TkAlMuonIsolated_22Jan2013D_v1_cff")
outputName = 'Data_TkAlMuonIsolated_22Jan2013D.root'
trackSelection = "SingleMu"
# The following options are used for MC samples
if options.sample == 'qcd':
globalTag = "auto:run2_mc"
process.load("Alignment.APEEstimation.samples.MC_UL16_ttbar_cff")
outputPath = '/eos/cms/store/caf/user/mteroerd/Skims/MC/UL16'
outputName = 'MC_UL16_ttbar.root'
trackSelection = "GenSim"
if options.sample == 'wlnu':
process.load("Alignment.APEEstimation.samples.Mc_TkAlMuonIsolated_2016UL_cff")
outputPath = '/eos/cms/store/caf/user/jschulz/Skims/MC/UL2016ReRecoRealistic'
outputName = 'Mc_TkAlMuonIsolated_WJetsToLNu_2016.root'
trackSelection = "SingleMu"
# For unit tests
if options.sample == 'UnitTest':
process.load("Alignment.APEEstimation.samples.MC_UnitTest_TkAlMuonIsolated_cff")
outputName = 'MC_UnitTest_TkAlMuonIsolated.root'
maxEvents = 1000
globalTag = "auto:phase1_2022_design"
trackSelection = "SingleMu"
print("Using output name %s"%(outputName))
if outputPath:
print("Using output path %s"%(outputPath))
##
## Choice of GlobalTag
##
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
if globalTag == None:
print("No global tag specified, is this intended?")
else:
process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
print("Using global tag "+process.GlobalTag.globaltag._value)
process.load("Configuration.StandardSequences.Services_cff")
process.load("Configuration.Geometry.GeometryRecoDB_cff")
process.load("Configuration.StandardSequences.MagneticField_cff")
process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
##
## Number of Events (should be after input file)
##
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(maxEvents) )
##
## Skim tracks
##
import Alignment.APEEstimation.AlignmentTrackSelector_cff as AlignmentTrackSelector
# Determination of which AlignmentTrackSelector to use
if trackSelection == "SingleMu":
trackSelector = AlignmentTrackSelector.MuSkimSelector
elif trackSelection == "GenSim":
trackSelector = AlignmentTrackSelector.genSimSkimSelector
elif trackSelection == "DoubleMu":
trackSelector = AlignmentTrackSelector.DoubleMuSkimSelector
elif trackSelection == "MinBias":
trackSelector = AlignmentTrackSelector.MinBiasSkimSelector
elif trackSelection == "Cosmics":
trackSelector = AlignmentTrackSelector.CosmicsSkimSelector
else: # Extend list here with custom track selectors
print("Unknown trackSelection %s, exiting"%(trackSelection))
exit(1)
process.MuSkim = trackSelector
import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(process, trackSelector.src.getModuleLabel())
##
## Path
##
process.path = cms.Path(
process.offlineBeamSpot*
process.seqTrackselRefit*
process.MuSkim
)
##
## Define event selection from path
##
EventSelection = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('path')
)
)
##
## configure output module
##
process.out = cms.OutputModule("PoolOutputModule",
## Parameters directly for PoolOutputModule
fileName = cms.untracked.string(outputName),
# Maximum size per file before a new one is created
maxSize = cms.untracked.int32(outputFileSize),
dropMetaData = cms.untracked.string("DROPPED"),
## Parameters for inherited OutputModule
SelectEvents = EventSelection.SelectEvents,
outputCommands = cms.untracked.vstring(
'drop *',
),
)
process.load("Alignment.APEEstimation.PrivateSkim_EventContent_cff")
process.out.outputCommands.extend(process.ApeSkimEventContent.outputCommands)
##
## Outpath
##
process.outpath = cms.EndPath(process.out)
|