File indexing completed on 2024-04-06 11:59:28
0001 from __future__ import print_function
0002 import calendar
0003 import CondCore.Utilities.conddblib as conddb
0004
0005
0006 def findRunStopTime(run_number):
0007 con = conddb.connect(url = conddb.make_url("pro"))
0008 session = con.session()
0009 RunInfo = session.get_dbtype(conddb.RunInfo)
0010 bestRun = session.query(RunInfo.run_number,RunInfo.start_time, RunInfo.end_time).filter(RunInfo.run_number >= run_number).first()
0011 if bestRun is None:
0012 raise Exception("Run %s can't be matched with an existing run in the database." % run_number)
0013
0014 start= bestRun[1]
0015 stop = bestRun[2]
0016
0017 bestRunStartTime = calendar.timegm( bestRun[1].utctimetuple() ) << 32
0018 bestRunStopTime = calendar.timegm( bestRun[2].utctimetuple() ) << 32
0019
0020 print("run start time:",start,"(",bestRunStartTime,")")
0021 print("run stop time: ",stop,"(",bestRunStopTime,")")
0022
0023 return bestRunStopTime
0024
0025 import optparse
0026 parser = optparse.OptionParser(usage = 'Usage: %prog [options] <file> [<file> ...]\n')
0027 parser.add_option('-G', '--inputGT',
0028 dest = 'inputGT',
0029 default = 'auto:run2_data',
0030 help = 'Global Tag to get conditions')
0031
0032 parser.add_option('-r', '--inputRun',
0033 dest = 'inputRun',
0034 default = 325022,
0035 help = 'run to be used')
0036
0037 parser.add_option('-t', '--inputTime',
0038 dest = 'inputTime',
0039 default = 6614916085915320320,
0040 help = 'time to be used')
0041
0042 parser.add_option('-e', '--enableJobReport',
0043 dest = 'empty',
0044 default = None,
0045 help = 'unused')
0046
0047 (options, arguments) = parser.parse_args()
0048
0049 import FWCore.ParameterSet.Config as cms
0050 process = cms.Process('ALCAHARVEST')
0051
0052
0053 process.load('Configuration.StandardSequences.Services_cff')
0054 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0055 process.load('FWCore.MessageService.MessageLogger_cfi')
0056 process.load('Configuration.EventContent.EventContent_cff')
0057 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0058 process.load('Configuration.StandardSequences.MagneticField_cff')
0059 process.load('Configuration.StandardSequences.AlCaHarvesting_cff')
0060 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0061
0062
0063
0064
0065 process.source = cms.Source("EmptySource",
0066 firstRun = cms.untracked.uint32(options.inputRun),
0067 numberEventsInRun = cms.untracked.uint32(1),
0068 numberEventsInLuminosityBlock = cms.untracked.uint32(1),
0069 firstTime = cms.untracked.uint64(options.inputTime),
0070 timeBetweenEvents = cms.untracked.uint64(1)
0071 )
0072
0073 process.maxEvents = cms.untracked.PSet(
0074 input = cms.untracked.int32(1)
0075 )
0076
0077
0078
0079
0080 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripQuality_dbOutput)
0081 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripGains_dbOutput)
0082 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripGainsAAG_dbOutput )
0083 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripHitEff_dbOutput)
0084 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAli_dbOutput)
0085 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAliHG_dbOutput)
0086 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelAliHGCombined_dbOutput)
0087 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelLA_dbOutput)
0088 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiPixelLAMCS_dbOutput)
0089 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTSiStripLA_dbOutput)
0090 process.PoolDBOutputService.toPut.extend(process.ALCAHARVESTSiPixelQuality_dbOutput)
0091 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByRun_dbOutput)
0092 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByLumi_dbOutput)
0093 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotHPByRun_dbOutput)
0094 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotHPByLumi_dbOutput)
0095
0096
0097
0098
0099 process.PoolDBOutputService.connect = cms.string('sqlite_file:testPCLAlCaHarvesting.db')
0100
0101
0102
0103
0104 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripQuality_metadata)
0105 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGains_metadata )
0106 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGainsAAG_metadata)
0107 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripHitEff_metadata)
0108 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAli_metadata)
0109 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAliHG_metadata)
0110 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAliHGCombined_metadata)
0111 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelLA_metadata)
0112 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelLAMCS_metadata)
0113 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripLA_metadata)
0114 process.pclMetadataWriter.recordsToMap.extend(process.ALCAHARVESTSiPixelQuality_metadata)
0115 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByRun_metadata)
0116 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByLumi_metadata)
0117 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotHPByRun_metadata)
0118 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotHPByLumi_metadata)
0119
0120
0121 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0122 from Configuration.AlCa.GlobalTag import GlobalTag
0123 process.GlobalTag = GlobalTag(process.GlobalTag, options.inputGT, '')
0124
0125 process.SiStripQuality = cms.Path(process.ALCAHARVESTSiStripQuality)
0126 process.alcaSiStripQualityHarvester.CalibrationThreshold = cms.untracked.uint32(0)
0127
0128 process.SiStripGains = cms.Path(process.ALCAHARVESTSiStripGains)
0129 process.alcaSiStripGainsHarvester.DQMdir=''
0130 process.alcaSiStripGainsHarvester.minNrEntries=0
0131 process.alcaSiStripGainsHarvester.GoodFracForTagProd=0
0132 process.alcaSiStripGainsHarvester.NClustersForTagProd=0
0133
0134 process.SiStripGainsAAG = cms.Path(process.ALCAHARVESTSiStripGainsAAG)
0135 process.alcaSiStripGainsAAGHarvester.minNrEntries=0
0136 process.alcaSiStripGainsAAGHarvester.minNrEntries=0
0137 process.alcaSiStripGainsAAGHarvester.GoodFracForTagProd=0
0138 process.alcaSiStripGainsAAGHarvester.NClustersForTagProd=0
0139
0140 process.SiStripHitEff = cms.Path(process.ALCAHARVESTSiStripHitEfficiency)
0141
0142 process.SiPixelAli = cms.Path(process.ALCAHARVESTSiPixelAli)
0143 process.SiPixelAliMilleFileExtractor.outputBinaryFile = cms.string('')
0144 process.SiPixelAliPedeAlignmentProducer.algoConfig.mergeBinaryFiles=[]
0145
0146 process.SiPixelAliHG = cms.Path(process.ALCAHARVESTSiPixelAliHG)
0147 process.SiPixelAliMilleFileExtractorHG.outputBinaryFile = cms.string('')
0148 process.SiPixelAliPedeAlignmentProducerHG.algoConfig.mergeBinaryFiles=[]
0149
0150 process.SiPixelLA = cms.Path(process.ALCAHARVESTSiPixelLorentzAngle)
0151 process.SiPixelLAMCS = cms.Path(process.ALCAHARVESTSiPixelLorentzAngleMCS)
0152 process.SiPixelQuality = cms.Path(process.ALCAHARVESTSiPixelQuality)
0153
0154 process.SiStripLA = cms.Path(process.ALCAHARVESTSiStripLorentzAngle)
0155
0156 process.ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(process.dqmSaver+process.pclMetadataWriter)
0157
0158 process.BeamSpotByRun = cms.Path(process.ALCAHARVESTBeamSpotByRun)
0159 process.BeamSpotByLumi = cms.Path(process.ALCAHARVESTBeamSpotByLumi)
0160 process.BeamSpotHPByRun = cms.Path(process.ALCAHARVESTBeamSpotHPByRun)
0161 process.BeamSpotHPByLumi = cms.Path(process.ALCAHARVESTBeamSpotHPByLumi)
0162
0163 process.schedule = cms.Schedule(process.SiStripQuality,
0164 process.SiStripGains,
0165 process.SiStripGainsAAG,
0166 process.SiStripHitEff,
0167 process.SiPixelAli,
0168 process.SiPixelAliHG,
0169 process.SiPixelAliHGCombined,
0170 process.SiPixelLA,
0171 process.SiPixelLAMCS,
0172 process.SiStripLA,
0173 process.SiPixelQuality,
0174 process.BeamSpotByRun,
0175 process.BeamSpotByLumi,
0176 process.BeamSpotHPByRun,
0177 process.BeamSpotHPByLumi,
0178 process.ALCAHARVESTDQMSaveAndMetadataWriter)
0179
0180 from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
0181 associatePatAlgosToolsTask(process)
0182
0183
0184
0185
0186 from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
0187 process = customiseEarlyDelete(process)
0188