Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-16 23:25:23

0001 
0002 from __future__ import print_function
0003 import time
0004 
0005 import FWCore.ParameterSet.Config as cms
0006 import FWCore.ParameterSet.VarParsing as VarParsing
0007 from Configuration.AlCa.autoCond import autoCond
0008 
0009 options = VarParsing.VarParsing()
0010 options.register('processId',
0011                  '0',
0012                  VarParsing.VarParsing.multiplicity.singleton,
0013                  VarParsing.VarParsing.varType.string,
0014                  "Process Id")
0015 options.register('connectionString',
0016                  'frontier://FrontierPrep/CMS_CONDITIONS',
0017                  VarParsing.VarParsing.multiplicity.singleton,
0018                  VarParsing.VarParsing.varType.string,
0019                  "CondDB Connection string")
0020 options.register('tag',
0021                  'BeamSpot_test_updateByLumi_00',
0022                  VarParsing.VarParsing.multiplicity.singleton,
0023                  VarParsing.VarParsing.varType.string,
0024                  "tag for record BeamSpotObjectsRcd")
0025 options.register('snapshotTime',
0026                  '', #default value
0027                  VarParsing.VarParsing.multiplicity.singleton,
0028                  VarParsing.VarParsing.varType.string,
0029                  "GlobalTag snapshot time")
0030 options.register('refresh',
0031                  0, #default value
0032                  VarParsing.VarParsing.multiplicity.singleton,
0033                  VarParsing.VarParsing.varType.int,
0034                  "Refresh type: default no refresh")
0035 options.register('runNumber',
0036                  120013, #default value, int limit -3
0037                  VarParsing.VarParsing.multiplicity.singleton,
0038                  VarParsing.VarParsing.varType.int,
0039                  "Run number; default gives latest IOV")
0040 options.register('eventsPerLumi',
0041                  20, #default value
0042                  VarParsing.VarParsing.multiplicity.singleton,
0043                  VarParsing.VarParsing.varType.int,
0044                  "number of events per lumi")
0045 options.register('numberOfLumis',
0046                  20, #default value
0047                  VarParsing.VarParsing.multiplicity.singleton,
0048                  VarParsing.VarParsing.varType.int,
0049                  "number of lumisections per run")
0050 options.register('numberOfRuns',
0051                  1, #default value
0052                  VarParsing.VarParsing.multiplicity.singleton,
0053                  VarParsing.VarParsing.varType.int,
0054                  "number of runs in the job")
0055 options.register('messageLevel',
0056                  0, #default value
0057                  VarParsing.VarParsing.multiplicity.singleton,
0058                  VarParsing.VarParsing.varType.int,
0059                  "Message level; default to 0")
0060 options.register('security',
0061                  '', #default value
0062                  VarParsing.VarParsing.multiplicity.singleton,
0063                  VarParsing.VarParsing.varType.string,
0064                  "FroNTier connection security: activate it with 'sig'")
0065 
0066 options.parseArguments()
0067 
0068 process = cms.Process("TEST")
0069 
0070 process.MessageLogger = cms.Service("MessageLogger",
0071                                     cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
0072                                     destinations = cms.untracked.vstring('cout')
0073                                     )
0074 
0075 CondDBParameters = cms.PSet( authenticationPath = cms.untracked.string( '' ),
0076                              authenticationSystem = cms.untracked.int32( 0 ),
0077                              messageLevel = cms.untracked.int32( 3 ),
0078                              security = cms.untracked.string( options.security ),
0079                              )
0080 
0081 refreshAlways, refreshOpenIOVs, refreshEachRun, reconnectEachRun = False, False, False, False
0082 if options.refresh == 0:
0083     refreshAlways, refreshOpenIOVs, refreshEachRun, reconnectEachRun = False, False, False, False
0084 elif options.refresh == 1:
0085     refreshAlways = True
0086     refreshOpenIOVs, refreshEachRun, reconnectEachRun = False, False, False
0087 elif options.refresh == 2:
0088     refreshAlways = False
0089     refreshOpenIOVs = True
0090     refreshEachRun, reconnectEachRun = False, False
0091 elif options.refresh == 3:
0092     refreshAlways, refreshOpenIOVs = False, False
0093     refreshEachRun = True
0094     reconnectEachRun = False
0095 elif options.refresh == 4:
0096     refreshAlways, refreshOpenIOVs, refreshEachRun = False, False, False
0097     reconnectEachRun = True
0098 
0099 process.GlobalTag = cms.ESSource( "PoolDBESSource",
0100                                   DBParameters = CondDBParameters,
0101                                   connect = cms.string( options.connectionString ),
0102                                   snapshotTime = cms.string( options.snapshotTime ),
0103                                   frontierKey = cms.untracked.string('abcdefghijklmnopqrstuvwxyz0123456789'),
0104                                   toGet = cms.VPSet(cms.PSet(
0105                                       record = cms.string('BeamSpotObjectsRcd'),
0106                                       tag = cms.string( options.tag ),
0107                                       refreshTime = cms.uint64( 2 )
0108                                   )),
0109                                   RefreshAlways = cms.untracked.bool( refreshAlways ),
0110                                   RefreshOpenIOVs = cms.untracked.bool( refreshOpenIOVs ),
0111                                   RefreshEachRun = cms.untracked.bool( refreshEachRun ),
0112                                   ReconnectEachRun = cms.untracked.bool( reconnectEachRun ),
0113                                   DumpStat = cms.untracked.bool( True ),
0114                                   )
0115 
0116 process.source = cms.Source( "EmptySource",
0117                              firstRun = cms.untracked.uint32( options.runNumber ),
0118                              firstLuminosityBlock = cms.untracked.uint32( 1 ),
0119                              numberEventsInRun = cms.untracked.uint32( options.eventsPerLumi *  options.numberOfLumis ), # options.numberOfLumis lumi sections per run
0120                              numberEventsInLuminosityBlock = cms.untracked.uint32( options.eventsPerLumi )
0121                              )
0122 
0123 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32( options.eventsPerLumi *  options.numberOfLumis * options.numberOfRuns ) ) #options.numberOfRuns runs per job
0124 
0125 process.prod = cms.EDAnalyzer("LumiTestReadAnalyzer",
0126                               processId = cms.untracked.string( options.processId ),
0127                               pathForLastLumiFile = cms.untracked.string("last_lumi.txt"),
0128                               pathForAllLumiFile = cms.untracked.string("./all_time.txt" ),
0129                               pathForErrorFile = cms.untracked.string("./lumi_read_errors")
0130 )
0131 
0132 process.p = cms.Path( process.prod )
0133 
0134 for name, module in process.es_sources_().items():
0135     print("ESModules> provider:%s '%s'" % ( name, module.type_() ))
0136 for name, module in process.es_producers_().items():
0137     print("ESModules> provider:%s '%s'" % ( name, module.type_() ))