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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
# documentation: https://twiki.cern.ch/twiki/bin/view/CMS/AlCaDBPCL#Drop_box_metadata_management
import FWCore.ParameterSet.Config as cms
process = cms.Process("myprocess")
process.load("CondCore.CondDB.CondDB_cfi")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.CondDB.connect = 'sqlite_file:DropBoxMetadata.db'
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.source = cms.Source("EmptySource",
firstRun = cms.untracked.uint32(300000)
)
# process.PoolDBOutputService.DBParameters.messageLevel = 3
import json, os
def encodeJsonInString(filename):
"""This function open the json file and encodes it in a string replacing probelamtic characters"""
thefile = open(os.path.join(os.path.dirname(__file__), "..", "data", filename))
thejson = json.load(thefile)
thefile.close()
return json.JSONEncoder().encode(thejson).replace('"',""")
# beamspot by run
BeamSpotObjectsRcdByRun_prod_str = encodeJsonInString("BeamSpotObjectsRcdByRun_prod.json")
BeamSpotObjectsRcdByRun_prep_str = encodeJsonInString("BeamSpotObjectsRcdByRun_prep.json")
# beamspot by lumi
BeamSpotObjectsRcdByLumi_prod_str = encodeJsonInString("BeamSpotObjectsRcdByLumi_prod.json")
BeamSpotObjectsRcdByLumi_prep_str = encodeJsonInString("BeamSpotObjectsRcdByLumi_prep.json")
# beamspot High Perf by lumi
BeamSpotObjectsRcdHPByLumi_prod_str = encodeJsonInString("BeamSpotObjectsRcdHPbyLumi_prod.json")
BeamSpotObjectsRcdHPByLumi_prep_str = encodeJsonInString("BeamSpotObjectsRcdHPbyLumi_prep.json")
# beamspot High Perf by run
BeamSpotObjectsRcdHPByRun_prod_str = encodeJsonInString("BeamSpotObjectsRcdHPbyRun_prod.json")
BeamSpotObjectsRcdHPByRun_prep_str = encodeJsonInString("BeamSpotObjectsRcdHPbyRun_prep.json")
#SiStripBadStripRcd
SiStripBadStripRcd_prod_str = encodeJsonInString("SiStripBadStripRcd_prod.json")
SiStripBadStripRcd_prep_str = encodeJsonInString("SiStripBadStripRcd_prep.json")
#SiStripBadStripRcd from Hit Efficiency
SiStripBadStripRcdHitEff_prod_str = encodeJsonInString("SiStripBadStripFromHitEffRcd_prod.json")
SiStripBadStripRcdHitEff_prep_str = encodeJsonInString("SiStripBadStripFromHitEffRcd_prep.json")
#SiStripApvGainRcd
SiStripApvGainRcd_prod_str = encodeJsonInString("SiStripApvGainRcd_prod.json")
SiStripApvGainRcd_multirun_prod_str = encodeJsonInString("SiStripApvGainRcd_multirun_prod.json")
SiStripApvGainRcdAAG_prod_str = encodeJsonInString("SiStripApvGainRcdAAG_prod.json")
SiStripApvGainRcdAAG_multirun_prod_str = encodeJsonInString("SiStripApvGainRcdAAG_multirun_prod.json")
SiStripApvGainRcd_prep_str = encodeJsonInString("SiStripApvGainRcd_prep.json")
SiStripApvGainRcd_multirun_prep_str = encodeJsonInString("SiStripApvGainRcd_multirun_prep.json")
SiStripApvGainRcdAAG_prep_str = encodeJsonInString("SiStripApvGainRcdAAG_prep.json")
SiStripApvGainRcdAAG_multirun_prep_str = encodeJsonInString("SiStripApvGainRcdAAG_multirun_prep.json")
#SiPixelAli
SiPixelAliRcd_prod_str = encodeJsonInString("SiPixelAliRcd_prod.json")
SiPixelAliRcd_prep_str = encodeJsonInString("SiPixelAliRcd_prep.json")
#SiPixelAliHG
SiPixelAliHGRcd_prod_str = encodeJsonInString("SiPixelAliHGRcd_prod.json")
SiPixelAliHGRcd_prep_str = encodeJsonInString("SiPixelAliHGRcd_prep.json")
#SiPixelAliHGComb
SiPixelAliHGCombRcd_prod_str = encodeJsonInString("SiPixelAliHGCombRcd_prod.json")
SiPixelAliHGCombRcd_prep_str = encodeJsonInString("SiPixelAliHGCombRcd_prep.json")
#SiPixelAliHLTHGComb
SiPixelAliHLTHGCombRcd_prod_str = encodeJsonInString("SiPixelAliHLTHGCombRcd_prod.json")
SiPixelAliHLTHGCombRcd_prep_str = encodeJsonInString("SiPixelAliHLTHGCombRcd_prep.json")
#EcalPedestalsRcd
EcalPedestalsRcd_prod_str = encodeJsonInString("EcalPedestal_prod.json")
EcalPedestalsRcd_prep_str = encodeJsonInString("EcalPedestal_prep.json")
#LumiCorrectionsRcd
LumiCorrectionsRcd_prod_str = encodeJsonInString("LumiCorrections_prod.json")
LumiCorrectionsRcd_prep_str = encodeJsonInString("LumiCorrections_prep.json")
#SiPixelQuality
SiPixelQualityFromDbRcd_prompt_prod_str = encodeJsonInString("SiPixelQualityFromDbRcd_prompt_prod.json")
SiPixelQualityFromDbRcd_prompt_prep_str = encodeJsonInString("SiPixelQualityFromDbRcd_prompt_prep.json")
SiPixelQualityFromDbRcd_stuckTBM_prod_str = encodeJsonInString("SiPixelQualityFromDbRcd_stuckTBM_prod.json")
SiPixelQualityFromDbRcd_stuckTBM_prep_str = encodeJsonInString("SiPixelQualityFromDbRcd_stuckTBM_prep.json")
SiPixelQualityFromDbRcd_other_prod_str = encodeJsonInString("SiPixelQualityFromDbRcd_other_prod.json")
SiPixelQualityFromDbRcd_other_prep_str = encodeJsonInString("SiPixelQualityFromDbRcd_other_prep.json")
#SiPixelLorenzAngle
SiPixelLorentzAngleRcd_prod_str = encodeJsonInString("SiPixelLorentzAngleRcd_prod.json")
SiPixelLorentzAngleRcd_multirun_prod_str = encodeJsonInString("SiPixelLorentzAngleRcd_multirun_prod.json")
SiPixelLorentzAngleRcd_prep_str = encodeJsonInString("SiPixelLorentzAngleRcd_prep.json")
SiPixelLorentzAngleRcd_multirun_prep_str = encodeJsonInString("SiPixelLorentzAngleRcd_multirun_prep.json")
#SiPixelLorenzAngle, FPix
SiPixelLorentzAngleRcd_MCS_prod_str = encodeJsonInString("SiPixelLorentzAngleRcd_MCS_prod.json")
SiPixelLorentzAngleRcd_MCS_multirun_prod_str = encodeJsonInString("SiPixelLorentzAngleRcd_MCS_multirun_prod.json")
SiPixelLorentzAngleRcd_MCS_prep_str = encodeJsonInString("SiPixelLorentzAngleRcd_MCS_prep.json")
SiPixelLorentzAngleRcd_MCS_multirun_prep_str = encodeJsonInString("SiPixelLorentzAngleRcd_MCS_multirun_prep.json")
#CT-PPS alignment and timing
CTPPSRPAlignmentCorrectionsDataRcd_prod_str = encodeJsonInString("CTPPSRPAlignmentCorrectionsDataRcd_prod.json")
CTPPSRPAlignmentCorrectionsDataRcd_prep_str = encodeJsonInString("CTPPSRPAlignmentCorrectionsDataRcd_prep.json")
PPSTimingCalibrationRcd_prod_str = encodeJsonInString("PPSTimingCalibrationRcd_prod.json")
PPSTimingCalibrationRcd_prep_str = encodeJsonInString("PPSTimingCalibrationRcd_prep.json")
PPSTimingCalibrationRcd_Sampic_prod_str = encodeJsonInString("PPSTimingCalibrationRcd_Sampic_prod.json")
PPSTimingCalibrationRcd_Sampic_prep_str = encodeJsonInString("PPSTimingCalibrationRcd_Sampic_prep.json")
#SiStripLorenzAngle
SiStripLorentzAngleRcd_prod_str = encodeJsonInString("SiStripLorentzAngleRcd_prod.json")
SiStripLorentzAngleRcd_multirun_prod_str = encodeJsonInString("SiStripLorentzAngleRcd_multirun_prod.json")
SiStripLorentzAngleRcd_prep_str = encodeJsonInString("SiStripLorentzAngleRcd_prep.json")
SiStripLorentzAngleRcd_multirun_prep_str = encodeJsonInString("SiStripLorentzAngleRcd_multirun_prep.json")
# given a set of .json files in the current dir, ProduceDropBoxMetadata produces a sqlite containign the payload with the prod/and/prep metadata
process.mywriter = cms.EDAnalyzer("ProduceDropBoxMetadata",
# set to True if you want to write out a sqlite.db translating the json's into a payload
write = cms.untracked.bool(True),
# toWrite holds a list of Pset's, one for each workflow you want to produce DropBoxMetadata for;
# you need to have 2 .json files for each PSet
toWrite = cms.VPSet(cms.PSet(record = cms.untracked.string("BeamSpotObjectsRcdByRun"),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(BeamSpotObjectsRcdByRun_prod_str),
prepMetaData = cms.untracked.string(BeamSpotObjectsRcdByRun_prep_str),
),
cms.PSet(record = cms.untracked.string('BeamSpotObjectsRcdByLumi'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(BeamSpotObjectsRcdByLumi_prod_str),
prepMetaData = cms.untracked.string(BeamSpotObjectsRcdByLumi_prep_str),
),
cms.PSet(record = cms.untracked.string('BeamSpotObjectsRcdHPByLumi'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(BeamSpotObjectsRcdHPByLumi_prod_str),
prepMetaData = cms.untracked.string(BeamSpotObjectsRcdHPByLumi_prep_str),
),
cms.PSet(record = cms.untracked.string('BeamSpotObjectsRcdHPByRun'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(BeamSpotObjectsRcdHPByRun_prod_str),
prepMetaData = cms.untracked.string(BeamSpotObjectsRcdHPByRun_prep_str),
),
cms.PSet(record = cms.untracked.string('SiStripBadStripRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiStripBadStripRcd_prod_str),
prepMetaData = cms.untracked.string(SiStripBadStripRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('SiStripBadStripFromHitEffRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiStripBadStripRcdHitEff_prod_str),
prepMetaData = cms.untracked.string(SiStripBadStripRcdHitEff_prep_str),
),
cms.PSet(record = cms.untracked.string('SiStripApvGainRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiStripApvGainRcd_prod_str),
prodMetaDataMultiRun = cms.untracked.string(SiStripApvGainRcd_multirun_prod_str),
prepMetaData = cms.untracked.string(SiStripApvGainRcd_prep_str),
prepMetaDataMultiRun = cms.untracked.string(SiStripApvGainRcd_multirun_prep_str),
),
cms.PSet(record = cms.untracked.string('TrackerAlignmentRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelAliRcd_prod_str),
prepMetaData = cms.untracked.string(SiPixelAliRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('TrackerAlignmentHGRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelAliHGRcd_prod_str),
prepMetaData = cms.untracked.string(SiPixelAliHGRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('TrackerAlignmentHGCombinedRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelAliHGCombRcd_prod_str),
prepMetaData = cms.untracked.string(SiPixelAliHGCombRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('TrackerAlignmentHLTHGCombinedRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelAliHLTHGCombRcd_prod_str),
prepMetaData = cms.untracked.string(SiPixelAliHLTHGCombRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('SiStripApvGainRcdAAG'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiStripApvGainRcdAAG_prod_str),
prodMetaDataMultiRun = cms.untracked.string(SiStripApvGainRcdAAG_multirun_prod_str),
prepMetaData = cms.untracked.string(SiStripApvGainRcdAAG_prep_str),
prepMetaDataMultiRun = cms.untracked.string(SiStripApvGainRcdAAG_multirun_prep_str)
),
cms.PSet(record = cms.untracked.string('EcalPedestalsRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(EcalPedestalsRcd_prod_str),
prepMetaData = cms.untracked.string(EcalPedestalsRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('LumiCorrectionsRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(LumiCorrectionsRcd_prod_str),
prepMetaData = cms.untracked.string(LumiCorrectionsRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('SiPixelQualityFromDbRcd_prompt'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_prompt_prod_str),
prepMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_prompt_prep_str),
),
cms.PSet(record = cms.untracked.string('SiPixelQualityFromDbRcd_stuckTBM'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_stuckTBM_prod_str),
prepMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_stuckTBM_prep_str),
),
cms.PSet(record = cms.untracked.string('SiPixelQualityFromDbRcd_other'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_other_prod_str),
prepMetaData = cms.untracked.string(SiPixelQualityFromDbRcd_other_prep_str),
),
cms.PSet(record = cms.untracked.string('SiPixelLorentzAngleRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelLorentzAngleRcd_prod_str),
prodMetaDataMultiRun = cms.untracked.string(SiPixelLorentzAngleRcd_multirun_prod_str),
prepMetaData = cms.untracked.string(SiPixelLorentzAngleRcd_prep_str),
prepMetaDataMultiRun = cms.untracked.string(SiPixelLorentzAngleRcd_multirun_prep_str),
),
cms.PSet(record = cms.untracked.string('SiPixelLorentzAngleRcdMCS'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiPixelLorentzAngleRcd_MCS_prod_str),
prodMetaDataMultiRun = cms.untracked.string(SiPixelLorentzAngleRcd_MCS_multirun_prod_str),
prepMetaData = cms.untracked.string(SiPixelLorentzAngleRcd_MCS_prep_str),
prepMetaDataMultiRun = cms.untracked.string(SiPixelLorentzAngleRcd_MCS_multirun_prep_str),
),
cms.PSet(record = cms.untracked.string('CTPPSRPAlignmentCorrectionsDataRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(CTPPSRPAlignmentCorrectionsDataRcd_prod_str),
prepMetaData = cms.untracked.string(CTPPSRPAlignmentCorrectionsDataRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd_HPTDC'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(PPSTimingCalibrationRcd_prod_str),
prepMetaData = cms.untracked.string(PPSTimingCalibrationRcd_prep_str),
),
cms.PSet(record = cms.untracked.string('PPSTimingCalibrationRcd_SAMPIC'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(PPSTimingCalibrationRcd_Sampic_prod_str),
prepMetaData = cms.untracked.string(PPSTimingCalibrationRcd_Sampic_prep_str),
),
cms.PSet(record = cms.untracked.string('SiStripLorentzAngleRcd'),
Source = cms.untracked.string("AlcaHarvesting"),
FileClass = cms.untracked.string("ALCA"),
prodMetaData = cms.untracked.string(SiStripLorentzAngleRcd_prod_str),
prodMetaDataMultiRun = cms.untracked.string(SiStripLorentzAngleRcd_multirun_prod_str),
prepMetaData = cms.untracked.string(SiStripLorentzAngleRcd_prep_str),
prepMetaDataMultiRun = cms.untracked.string(SiStripLorentzAngleRcd_multirun_prep_str),
),
),
# this boolean will read the content of whichever payload is available and print its content to stoutput
# set this to false if you write out a sqlite.db translating the json's into a payload
read = cms.untracked.bool(False),
toRead = cms.untracked.vstring()
)
process.p = cms.Path(process.mywriter)
if process.mywriter.write:
from CondCore.CondDB.CondDB_cfi import CondDB
CondDB.connect = "sqlite_file:DropBoxMetadata.db"
process.PoolDBOutputService = cms.Service("PoolDBOutputService",
CondDB,
toPut = cms.VPSet(cms.PSet(record = cms.string('DropBoxMetadataRcd'),
tag = cms.string('DropBoxMetadata'),
timetype = cms.untracked.string('runnumber')
)
),
loadBlobStreamer = cms.untracked.bool(False),
# timetype = cms.untracked.string('lumiid')
# timetype = cms.untracked.string('runnumber')
)
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
process.GlobalTag.globaltag = '124X_dataRun3_Express_Queue'
|