File indexing completed on 2024-11-25 02:29:19
0001 import time
0002
0003 import FWCore.ParameterSet.Config as cms
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 from Configuration.AlCa.autoCond import autoCond
0006
0007 options = VarParsing.VarParsing()
0008 options.register('connectionString',
0009 'frontier://FrontierProd/CMS_CONDITIONS',
0010 VarParsing.VarParsing.multiplicity.singleton,
0011 VarParsing.VarParsing.varType.string,
0012 "GlobalTag Connection string")
0013 options.register('globalTag',
0014 autoCond['run2_data'],
0015 VarParsing.VarParsing.multiplicity.singleton,
0016 VarParsing.VarParsing.varType.string,
0017 "GlobalTag")
0018 options.register('snapshotTime',
0019 '',
0020 VarParsing.VarParsing.multiplicity.singleton,
0021 VarParsing.VarParsing.varType.string,
0022 "GlobalTag snapshot time")
0023 options.register('refresh',
0024 0,
0025 VarParsing.VarParsing.multiplicity.singleton,
0026 VarParsing.VarParsing.varType.int,
0027 "Refresh type: default no refresh")
0028 options.register('pfnPostfix',
0029 '',
0030 VarParsing.VarParsing.multiplicity.singleton,
0031 VarParsing.VarParsing.varType.string,
0032 "PFN postfix in GlobalTag connection strings")
0033 options.register('pfnPrefix',
0034 '',
0035 VarParsing.VarParsing.multiplicity.singleton,
0036 VarParsing.VarParsing.varType.string,
0037 "PFN prefix in GlobalTag connection strings")
0038 options.register('runNumber',
0039 4294967292,
0040 VarParsing.VarParsing.multiplicity.singleton,
0041 VarParsing.VarParsing.varType.int,
0042 "Run number; default gives latest IOV")
0043 options.register('eventsPerLumi',
0044 3,
0045 VarParsing.VarParsing.multiplicity.singleton,
0046 VarParsing.VarParsing.varType.int,
0047 "number of events per lumi")
0048 options.register('numberOfLumis',
0049 3,
0050 VarParsing.VarParsing.multiplicity.singleton,
0051 VarParsing.VarParsing.varType.int,
0052 "number of lumisections per run")
0053 options.register('numberOfRuns',
0054 3,
0055 VarParsing.VarParsing.multiplicity.singleton,
0056 VarParsing.VarParsing.varType.int,
0057 "number of runs in the job")
0058 options.register('messageLevel',
0059 0,
0060 VarParsing.VarParsing.multiplicity.singleton,
0061 VarParsing.VarParsing.varType.int,
0062 "Message level; default to 0")
0063 options.register('security',
0064 '',
0065 VarParsing.VarParsing.multiplicity.singleton,
0066 VarParsing.VarParsing.varType.string,
0067 "FroNTier connection security: activate it with 'sig'")
0068
0069 options.parseArguments()
0070
0071 process = cms.Process("TEST")
0072
0073 process.MessageLogger = cms.Service( "MessageLogger",
0074 destinations = cms.untracked.vstring( 'detailedInfo' ),
0075 detailedInfo = cms.untracked.PSet( threshold = cms.untracked.string( 'INFO' ) ),
0076 )
0077
0078 CondDBParameters = cms.PSet( authenticationPath = cms.untracked.string( '' ),
0079 authenticationSystem = cms.untracked.int32( 0 ),
0080 messageLevel = cms.untracked.int32( options.messageLevel ),
0081 security = cms.untracked.string( options.security ),
0082 )
0083
0084 refreshAlways, refreshOpenIOVs, refreshEachRun, reconnectEachRun = False, False, False, False
0085 if options.refresh == 0:
0086 refreshAlways, refreshOpenIOVs, refreshEachRun, reconnectEachRun = False, False, False, False
0087 elif options.refresh == 1:
0088 refreshAlways = True
0089 refreshOpenIOVs, refreshEachRun, reconnectEachRun = False, False, False
0090 elif options.refresh == 2:
0091 refreshAlways = False
0092 refreshOpenIOVs = True
0093 refreshEachRun, reconnectEachRun = False, False
0094 elif options.refresh == 3:
0095 refreshAlways, refreshOpenIOVs = False, False
0096 refreshEachRun = True
0097 reconnectEachRun = False
0098 elif options.refresh == 4:
0099 refreshAlways, refreshOpenIOVs, refreshEachRun = False, False, False
0100 reconnectEachRun = True
0101
0102 process.GlobalTag = cms.ESSource( "PoolDBESSource",
0103 DBParameters = CondDBParameters,
0104 connect = cms.string( options.connectionString ),
0105 globaltag = cms.string( options.globalTag ),
0106 snapshotTime = cms.string( options.snapshotTime ),
0107 toGet = cms.VPSet(),
0108 RefreshAlways = cms.untracked.bool( refreshAlways ),
0109 RefreshOpenIOVs = cms.untracked.bool( refreshOpenIOVs ),
0110 RefreshEachRun = cms.untracked.bool( refreshEachRun ),
0111 ReconnectEachRun = cms.untracked.bool( reconnectEachRun ),
0112 DumpStat = cms.untracked.bool( True ),
0113 pfnPrefix = cms.untracked.string( '' ),
0114 pfnPostfix = cms.untracked.string( '' )
0115 )
0116
0117 if options.pfnPrefix:
0118 process.GlobalTag.pfnPrefix = options.pfnPrefix
0119 if options.pfnPostfix:
0120 process.GlobalTag.pfnPostfix = options.pfnPostfix
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130 process.source = cms.Source( "EmptySource",
0131 firstRun = cms.untracked.uint32( options.runNumber ),
0132 firstTime = cms.untracked.uint64( ( int( time.time() ) - 24 * 3600 ) << 32 ),
0133 numberEventsInRun = cms.untracked.uint32( options.eventsPerLumi * options.numberOfLumis ),
0134 numberEventsInLuminosityBlock = cms.untracked.uint32( options.eventsPerLumi )
0135 )
0136
0137 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32( options.eventsPerLumi * options.numberOfLumis * options.numberOfRuns ) )
0138
0139 process.get = cms.EDAnalyzer( "EventSetupRecordDataGetter",
0140 toGet = cms.VPSet(),
0141 verbose = cms.untracked.bool( True )
0142 )
0143
0144 process.escontent = cms.EDAnalyzer( "PrintEventSetupContent",
0145 compact = cms.untracked.bool( True ),
0146 printProviders = cms.untracked.bool( True )
0147 )
0148
0149 process.esretrieval = cms.EDAnalyzer( "PrintEventSetupDataRetrieval",
0150 printProviders = cms.untracked.bool( True )
0151 )
0152
0153 process.p = cms.Path( process.get )
0154 process.esout = cms.EndPath( process.escontent + process.esretrieval )
0155 if process.schedule_() is not None:
0156 process.schedule_().append( process.esout )
0157
0158 for name, module in process.es_sources_().items():
0159 print("ESModules> provider:%s '%s'" % ( name, module.type_() ))
0160 for name, module in process.es_producers_().items():
0161 print("ESModules> provider:%s '%s'" % ( name, module.type_() ))