Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-24 22:51:38

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 # import of standard configurations
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 ## configure the source with an random run
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 ## Define the tags to write
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.ALCAHARVESTSiPixelLA_dbOutput)
0087 process.PoolDBOutputService.toPut.extend(process.ALCAHARVESTSiPixelQuality_dbOutput)
0088 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByRun_dbOutput)
0089 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotByLumi_dbOutput)
0090 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotHPByRun_dbOutput)
0091 process.PoolDBOutputService.toPut.append(process.ALCAHARVESTBeamSpotHPByLumi_dbOutput)
0092 
0093 ##
0094 ## change the output sqlite file in order to avoid concurrent writing from other unit tests
0095 ##
0096 process.PoolDBOutputService.connect = cms.string('sqlite_file:testPCLAlCaHarvesting.db')
0097 
0098 ##
0099 ## Define the file metadatas
0100 ##
0101 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripQuality_metadata)
0102 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGains_metadata )
0103 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripGainsAAG_metadata)
0104 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiStripHitEff_metadata)
0105 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAli_metadata)
0106 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelAliHG_metadata)
0107 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTSiPixelLA_metadata)
0108 process.pclMetadataWriter.recordsToMap.extend(process.ALCAHARVESTSiPixelQuality_metadata)
0109 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByRun_metadata)
0110 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotByLumi_metadata)
0111 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotHPByRun_metadata)
0112 process.pclMetadataWriter.recordsToMap.append(process.ALCAHARVESTBeamSpotHPByLumi_metadata)
0113 
0114 
0115 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0116 from Configuration.AlCa.GlobalTag import GlobalTag
0117 process.GlobalTag = GlobalTag(process.GlobalTag, options.inputGT, '')
0118 
0119 process.SiStripQuality  = cms.Path(process.ALCAHARVESTSiStripQuality)
0120 process.alcaSiStripQualityHarvester.CalibrationThreshold = cms.untracked.uint32(0)
0121 
0122 process.SiStripGains    = cms.Path(process.ALCAHARVESTSiStripGains)
0123 process.alcaSiStripGainsHarvester.DQMdir=''
0124 process.alcaSiStripGainsHarvester.minNrEntries=0
0125 process.alcaSiStripGainsHarvester.GoodFracForTagProd=0
0126 process.alcaSiStripGainsHarvester.NClustersForTagProd=0
0127 
0128 process.SiStripGainsAAG = cms.Path(process.ALCAHARVESTSiStripGainsAAG)
0129 process.alcaSiStripGainsAAGHarvester.minNrEntries=0
0130 process.alcaSiStripGainsAAGHarvester.minNrEntries=0
0131 process.alcaSiStripGainsAAGHarvester.GoodFracForTagProd=0
0132 process.alcaSiStripGainsAAGHarvester.NClustersForTagProd=0
0133 
0134 process.SiStripHitEff = cms.Path(process.ALCAHARVESTSiStripHitEfficiency)
0135 
0136 process.SiPixelAli      = cms.Path(process.ALCAHARVESTSiPixelAli)
0137 process.SiPixelAliMilleFileExtractor.outputBinaryFile = cms.string('')
0138 process.SiPixelAliPedeAlignmentProducer.algoConfig.mergeBinaryFiles=[]
0139 
0140 process.SiPixelAliHG      = cms.Path(process.ALCAHARVESTSiPixelAliHG)
0141 process.SiPixelAliMilleFileExtractorHG.outputBinaryFile = cms.string('')
0142 process.SiPixelAliPedeAlignmentProducerHG.algoConfig.mergeBinaryFiles=[]
0143 
0144 process.SiPixelLA      = cms.Path(process.ALCAHARVESTSiPixelLorentzAngle)
0145 
0146 process.SiPixelQuality  = cms.Path(process.ALCAHARVESTSiPixelQuality)
0147 
0148 process.ALCAHARVESTDQMSaveAndMetadataWriter = cms.Path(process.dqmSaver+process.pclMetadataWriter)
0149 
0150 process.BeamSpotByRun  = cms.Path(process.ALCAHARVESTBeamSpotByRun)
0151 process.BeamSpotByLumi = cms.Path(process.ALCAHARVESTBeamSpotByLumi)
0152 process.BeamSpotHPByRun  = cms.Path(process.ALCAHARVESTBeamSpotHPByRun)
0153 process.BeamSpotHPByLumi = cms.Path(process.ALCAHARVESTBeamSpotHPByLumi)
0154 
0155 process.schedule = cms.Schedule(process.SiStripQuality,
0156                                 process.SiStripGains,    
0157                                 process.SiStripGainsAAG, 
0158                                 process.SiStripHitEff,
0159                                 process.SiPixelAli,
0160                                 process.SiPixelAliHG,
0161                                 process.SiPixelLA,
0162                                 process.SiPixelQuality,
0163                                 process.BeamSpotByRun,
0164                                 process.BeamSpotByLumi,
0165                                 process.BeamSpotHPByRun,
0166                                 process.BeamSpotHPByLumi,
0167                                 process.ALCAHARVESTDQMSaveAndMetadataWriter)
0168 
0169 from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
0170 associatePatAlgosToolsTask(process)
0171 
0172 # Customisation from command line
0173 
0174 # Add early deletion of temporary data products to reduce peak memory need
0175 from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete
0176 process = customiseEarlyDelete(process)
0177 # End adding early deletion