Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-23 02:25:18

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