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
|
import calendar
import CondCore.Utilities.conddblib as conddb
#___________________________________________________________________
def findRunStopTime(run_number):
con = conddb.connect(url = conddb.make_url("pro"))
session = con.session()
RunInfo = session.get_dbtype(conddb.RunInfo)
bestRun = session.query(RunInfo.run_number,RunInfo.start_time, RunInfo.end_time).filter(RunInfo.run_number >= run_number).first()
if bestRun is None:
raise Exception("Run %s can't be matched with an existing run in the database." % run_number)
start= bestRun[1]
stop = bestRun[2]
bestRunStartTime = calendar.timegm( bestRun[1].utctimetuple() ) << 32
bestRunStopTime = calendar.timegm( bestRun[2].utctimetuple() ) << 32
print("run start time:",start,"(",bestRunStartTime,")")
print("run stop time: ",stop,"(",bestRunStopTime,")")
return bestRunStopTime
import optparse
parser = optparse.OptionParser(usage = 'Usage: %prog [options] <file> [<file> ...]\n')
parser.add_option('-G', '--inputGT',
dest = 'inputGT',
default = 'auto:run2_data',
help = 'Global Tag to get conditions')
parser.add_option('-r', '--inputRun',
dest = 'inputRun',
default = 325022,
help = 'run to be used')
parser.add_option('-t', '--inputTime',
dest = 'inputTime',
default = 6614916085915320320,
help = 'time to be used')
parser.add_option('-e', '--enableJobReport',
dest = 'empty',
default = None,
help = 'unused')
(options, arguments) = parser.parse_args()
import FWCore.ParameterSet.Config as cms
process = cms.Process('ALCAHARVEST')
# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.AlCaHarvesting_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
##
## configure the source with an random run
##
process.source = cms.Source("EmptySource",
firstRun = cms.untracked.uint32(options.inputRun),
numberEventsInRun = cms.untracked.uint32(1),
numberEventsInLuminosityBlock = cms.untracked.uint32(1),
firstTime = cms.untracked.uint64(options.inputTime),
timeBetweenEvents = cms.untracked.uint64(1)
)
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
##
## Define the tags to write
##
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripQuality_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripGains_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripGainsAAG_dbOutput )
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripHitEff_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAli_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAliHG_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAliHGCombined_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAliHLTHGCombined_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelLA_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelLAMCS_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripLA_dbOutput)
process.PoolDBOutputService.toPut.extend(process.ALCAHARVESTSiPixelQuality_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByRun_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByLumi_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotHPByRun_dbOutput)
process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotHPByLumi_dbOutput)
##
## change the output sqlite file in order to avoid concurrent writing from other unit tests
##
process.PoolDBOutputService.connect = cms.string('sqlite_file:testPCLAlCaHarvesting.db')
##
## Define the file metadatas
##
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripQuality_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGains_metadata )
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGainsAAG_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripHitEff_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAli_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAliHG_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAliHGCombined_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAliHLTHGCombined_metadata )
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelLA_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelLAMCS_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripLA_metadata)
process.pclMetadataWriter.recordsToMap.extend(process.ALCAHARVESTSiPixelQuality_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByRun_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByLumi_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotHPByRun_metadata)
process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotHPByLumi_metadata)
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, options.inputGT, '')
process.SiStripQuality = cms.Path(process.ALCAHARVESTSiStripQuality)
process.alcaSiStripQualityHarvester.CalibrationThreshold = cms.untracked.uint32(0)
process.SiStripGains = cms.Path(process.ALCAHARVESTSiStripGains)
process.alcaSiStripGainsHarvester.DQMdir=''
process.alcaSiStripGainsHarvester.minNrEntries=0
process.alcaSiStripGainsHarvester.GoodFracForTagProd=0
process.alcaSiStripGainsHarvester.NClustersForTagProd=0
process.SiStripGainsAAG = cms.Path(process.ALCAHARVESTSiStripGainsAAG)
process.alcaSiStripGainsAAGHarvester.minNrEntries=0
process.alcaSiStripGainsAAGHarvester.minNrEntries=0
process.alcaSiStripGainsAAGHarvester.GoodFracForTagProd=0
process.alcaSiStripGainsAAGHarvester.NClustersForTagProd=0
process.SiStripHitEff = cms.Path(process.ALCAHARVESTSiStripHitEfficiency)
process.SiPixelAli = cms.Path(process.ALCAHARVESTSiPixelAli)
process.SiPixelAliMilleFileExtractor.outputBinaryFile = cms.string('')
process.SiPixelAliPedeAlignmentProducer.algoConfig.mergeBinaryFiles=[]
process.SiPixelAliHG = cms.Path(process.ALCAHARVESTSiPixelAliHG)
process.SiPixelAliMilleFileExtractorHG.outputBinaryFile = cms.string('')
process.SiPixelAliPedeAlignmentProducerHG.algoConfig.mergeBinaryFiles=[]
process.SiPixelAliHGCombined = cms.Path(process.ALCAHARVESTSiPixelAliHGCombined)
process.SiPixelAliMilleFileExtractorHGMinBias.outputBinaryFile = cms.string('')
process.SiPixelAliMilleFileExtractorHGZMuMu.outputBinaryFile = cms.string('')
process.SiPixelAliPedeAlignmentProducerHGCombined.algoConfig.mergeBinaryFiles=[]
process.SiPixelAliHLTHGCombined = cms.Path(process.ALCAHARVESTSiPixelAliHLTHGCombined)
process.SiPixelAliMilleFileExtractorHLTHGMinBias.outputBinaryFile = cms.string('')
process.SiPixelAliMilleFileExtractorHLTHGZMuMu.outputBinaryFile = cms.string('')
process.SiPixelAliPedeAlignmentProducerHLTHGCombined.algoConfig.mergeBinaryFiles=[]
process.SiPixelLA = cms.Path(process.ALCAHARVESTSiPixelLorentzAngle)
process.SiPixelLAMCS = cms.Path(process.ALCAHARVESTSiPixelLorentzAngleMCS)
process.SiPixelQuality = cms.Path(process.ALCAHARVESTSiPixelQuality)
process.SiStripLA = cms.Path(process.ALCAHARVESTSiStripLorentzAngle)
process.ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(process.dqmSaver+process.pclMetadataWriter)
process.BeamSpotByRun = cms.Path(process.ALCAHARVESTBeamSpotByRun)
process.BeamSpotByLumi = cms.Path(process.ALCAHARVESTBeamSpotByLumi)
process.BeamSpotHPByRun = cms.Path(process.ALCAHARVESTBeamSpotHPByRun)
process.BeamSpotHPByLumi = cms.Path(process.ALCAHARVESTBeamSpotHPByLumi)
process.schedule = cms.Schedule(process.SiStripQuality,
process.SiStripGains,
process.SiStripGainsAAG,
process.SiStripHitEff,
process.SiPixelAli,
process.SiPixelAliHG,
process.SiPixelAliHGCombined,
process.SiPixelAliHLTHGCombined,
process.SiPixelLA,
process.SiPixelLAMCS,
process.SiStripLA,
process.SiPixelQuality,
process.BeamSpotByRun,
process.BeamSpotByLumi,
process.BeamSpotHPByRun,
process.BeamSpotHPByLumi,
process.ALCAHARVESTDQMSaveAndMetadataWriter)
from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
associatePatAlgosToolsTask(process)
# Customisation from command line
# Add early deletion of temporary data products to reduce peak memory need
from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
process = customiseEarlyDelete(process)
# End adding early deletion
|