forked from jan-kaspar/proton_reconstruction_validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template_cfg.py
234 lines (193 loc) · 8.03 KB
/
template_cfg.py
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
import FWCore.ParameterSet.Config as cms
from Configuration.StandardSequences.Eras import eras
from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
process = cms.Process("CTPPSTestProtonReconstruction", $era_modifiers)
# minimum of logs
process.MessageLogger = cms.Service("MessageLogger",
statistics = cms.untracked.vstring(),
destinations = cms.untracked.vstring("cout"),
cout = cms.untracked.PSet(
threshold = cms.untracked.string("WARNING")
)
)
# raw data source
from input_files import input_files
process.source = cms.Source("PoolSource",
fileNames = input_files
)
# apply JSON file
import FWCore.PythonUtilities.LumiList as LumiList
import FWCore.ParameterSet.Types as CfgTypes
process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange())
JSONfile = '$json_file'
myLumis = LumiList.LumiList(filename = JSONfile).getCMSSWString().split(',')
process.source.lumisToProcess.extend(myLumis)
# number of events to process
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(int($max_events))
)
# declare global tag
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, "106X_dataRun2_v29")
# get alignment from a DB tag
#from CondCore.CondDB.CondDB_cfi import *
#process.CondDBAlignment = CondDB.clone(connect = "frontier://FrontierProd/CMS_CONDITIONS")
#process.PoolDBESSourceAlignment = cms.ESSource("PoolDBESSource",
# process.CondDBAlignment,
# toGet = cms.VPSet(cms.PSet(
# record = cms.string("RPRealAlignmentRecord"),
# tag = cms.string("CTPPSRPAlignment_real_offline_v8")
# ))
#)
#
#process.esPreferDBFileAlignment = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceAlignment")
# get optics from a DB tag
#from CondCore.CondDB.CondDB_cfi import *
#process.CondDBOptics = CondDB.clone(connect = "frontier://FrontierProd/CMS_CONDITIONS")
#process.PoolDBESSourceOptics = cms.ESSource("PoolDBESSource",
# process.CondDBOptics,
# toGet = cms.VPSet(cms.PSet(
# record = cms.string("CTPPSOpticsRcd"),
# tag = cms.string("PPSOpticalFunctions_offline_v7")
# )),
#)
#
#process.esPreferDBFileOptics = cms.ESPrefer("PoolDBESSource", "PoolDBESSourceOptics")
# local RP reconstruction chain with standard settings
process.load("RecoCTPPS.Configuration.recoCTPPS_cff")
if ($year == 2016):
process.ctppsLocalTrackLiteProducer.includeDiamonds = False
process.ctppsLocalTrackLiteProducer.includePixels = False
# define RP ids
process.rpIds = cms.PSet()
if ($year == 2016):
process.rpIds.rp_45_F = cms.uint32(3)
process.rpIds.rp_45_N = cms.uint32(2)
process.rpIds.rp_56_N = cms.uint32(102)
process.rpIds.rp_56_F = cms.uint32(103)
else:
process.rpIds.rp_45_F = cms.uint32(23)
process.rpIds.rp_45_N = cms.uint32(3)
process.rpIds.rp_56_N = cms.uint32(103)
process.rpIds.rp_56_F = cms.uint32(123)
# reconstruction validator
process.ctppsProtonReconstructionValidator = cms.EDAnalyzer("CTPPSProtonReconstructionValidator",
tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"),
tagRecoProtons = cms.InputTag("ctppsProtons", "multiRP"),
chiSqCut = cms.double(2.),
outputFile = cms.string("output_validation.root")
)
# reconstruction plotter
process.ctppsProtonReconstructionPlotter = cms.EDAnalyzer("CTPPSProtonReconstructionPlotter",
tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"),
tagRecoProtonsSingleRP = cms.InputTag("ctppsProtons", "singleRP"),
tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP"),
rpId_45_F = process.rpIds.rp_45_F,
rpId_45_N = process.rpIds.rp_45_N,
rpId_56_N = process.rpIds.rp_56_N,
rpId_56_F = process.rpIds.rp_56_F,
association_cuts_45 = process.ctppsProtons.association_cuts_45,
association_cuts_56 = process.ctppsProtons.association_cuts_56,
outputFile = cms.string("output.root")
)
# track distribution plotter
process.ctppsTrackDistributionPlotter = cms.EDAnalyzer("CTPPSTrackDistributionPlotter",
tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"),
rpId_45_F = process.rpIds.rp_45_F,
rpId_45_N = process.rpIds.rp_45_N,
rpId_56_N = process.rpIds.rp_56_N,
rpId_56_F = process.rpIds.rp_56_F,
outputFile = cms.string("output_tracks.root")
)
# xangle and beta* plotter
process.ctppsLHCInfoPlotter = cms.EDAnalyzer("CTPPSLHCInfoPlotter",
lhcInfoLabel = cms.string(""),
outputFile = cms.string("output_lhcInfo.root"),
)
# optics plotter
process.ctppsOpticsPlotter = cms.EDAnalyzer("CTPPSOpticsPlotter",
opticsLabel = cms.string(""),
rpId_45_F = process.rpIds.rp_45_F,
rpId_45_N = process.rpIds.rp_45_N,
rpId_56_N = process.rpIds.rp_56_N,
rpId_56_F = process.rpIds.rp_56_F,
outputFile = cms.string("output_optics.root")
)
# event category plotter
### process.ctppsEventCategoryPlotter = cms.EDAnalyzer("CTPPSEventCategoryPlotter",
### tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"),
### tagStripHits = cms.InputTag("totemRPRecHitProducer"),
### tagStripPatterns = cms.InputTag("totemRPUVPatternFinder"),
### tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP"),
###
### rpId_45_F = process.rpIds.rp_45_F,
### rpId_45_N = process.rpIds.rp_45_N,
### rpId_56_N = process.rpIds.rp_56_N,
### rpId_56_F = process.rpIds.rp_56_F,
###
### outputFile = cms.string("output_categories.root")
### )
# efficiency estimation
process.load("Validation.CTPPS.ctppsProtonReconstructionEfficiencyEstimatorData_cfi")
process.ctppsProtonReconstructionEfficiencyEstimatorData.tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer")
process.ctppsProtonReconstructionEfficiencyEstimatorData.tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP")
process.ctppsProtonReconstructionEfficiencyEstimatorData.pixelDiscardBXShiftedTracks = process.ctppsProtons.pixelDiscardBXShiftedTracks
process.ctppsProtonReconstructionEfficiencyEstimatorData.localAngleXMin = process.ctppsProtons.localAngleXMin
process.ctppsProtonReconstructionEfficiencyEstimatorData.localAngleXMax = process.ctppsProtons.localAngleXMax
process.ctppsProtonReconstructionEfficiencyEstimatorData.localAngleYMin = process.ctppsProtons.localAngleYMin
process.ctppsProtonReconstructionEfficiencyEstimatorData.localAngleYMax = process.ctppsProtons.localAngleYMax
process.ctppsProtonReconstructionEfficiencyEstimatorData.rpId_45_F = process.rpIds.rp_45_F
process.ctppsProtonReconstructionEfficiencyEstimatorData.rpId_45_N = process.rpIds.rp_45_N
process.ctppsProtonReconstructionEfficiencyEstimatorData.rpId_56_N = process.rpIds.rp_56_N
process.ctppsProtonReconstructionEfficiencyEstimatorData.rpId_56_F = process.rpIds.rp_56_F
process.ctppsProtonReconstructionEfficiencyEstimatorData.outputFile = "output_efficiency.root"
# processing sequences
if ($year == 2016):
process.seq_reco_loc = cms.Sequence(
process.totemRPUVPatternFinder
* process.totemRPLocalTrackFitter
)
else:
process.seq_reco_loc = cms.Sequence(
process.totemRPUVPatternFinder
* process.totemRPLocalTrackFitter
* process.ctppsDiamondRecHits
* process.ctppsDiamondLocalTracks
* process.ctppsPixelLocalTracks
)
process.seq_reco_glb = cms.Sequence(
process.ctppsLocalTrackLiteProducer
* process.ctppsProtons
#* process.ctppsEventCategoryPlotter
)
process.seq_anal = cms.Sequence(
process.ctppsLHCInfoPlotter
* process.ctppsOpticsPlotter
* process.ctppsTrackDistributionPlotter
* process.ctppsProtonReconstructionValidator
* process.ctppsProtonReconstructionPlotter
* process.ctppsProtonReconstructionEfficiencyEstimatorData
)
if ($run_reco):
process.path = cms.Path(
process.seq_reco_loc
* process.seq_reco_glb
* process.seq_anal
)
else:
process.path = cms.Path(
process.seq_anal
)
# output configuration
### process.maxEvents.input = cms.untracked.int32(10000)
###
### process.output = cms.OutputModule("PoolOutputModule",
### fileName = cms.untracked.string("output_edm.root"),
### outputCommands = cms.untracked.vstring(
### "drop *",
### 'keep recoForwardProtons_*_*_*'
### )
### )
###
### process.outpath = cms.EndPath(process.output)