File indexing completed on 2023-03-17 10:41:45
0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003
0004
0005
0006
0007
0008
0009
0010
0011 options = VarParsing.VarParsing()
0012
0013 default_file_format = 'hdf'
0014 defaults = {
0015 'verbosity': 5,
0016 'mode': '%s_file_to_db' % default_file_format,
0017 'connect': 'sqlite:///output.sqlite',
0018 'authenticationPath': '/nfshome0/popcondev/conddb',
0019 'inputFiles': 'input.%s' % default_file_format,
0020 'tag': 'test',
0021 'gtag': '',
0022 'start': 0,
0023 'stop': 10,
0024 'firstTime': -1,
0025 'timeBetweenEvents': 1,
0026 'lastTime': -1,
0027 'maxEvents': 1,
0028 }
0029
0030 options.register('verbosity',
0031 defaults['verbosity'],
0032 VarParsing.VarParsing.multiplicity.singleton,
0033 VarParsing.VarParsing.varType.int,
0034 "Vebosity level")
0035
0036 options.register('mode',
0037 defaults['mode'],
0038 VarParsing.VarParsing.multiplicity.singleton,
0039 VarParsing.VarParsing.varType.string,
0040 "Running mode: db_to_ascii_file, ascii_file_to_db, or hdf_file_to_db (default: %s)" % defaults["mode"]);
0041
0042 options.register('connect',
0043 defaults['connect'],
0044 VarParsing.VarParsing.multiplicity.singleton,
0045 VarParsing.VarParsing.varType.string,
0046 "Database connection string (default: %s)" % defaults["connect"]);
0047
0048 options.register('authenticationPath',
0049 defaults['authenticationPath'],
0050 VarParsing.VarParsing.multiplicity.singleton,
0051 VarParsing.VarParsing.varType.string,
0052 "Path to the file with the database authentication credentials")
0053
0054 options.register('gtag',
0055 defaults['gtag'],
0056 VarParsing.VarParsing.multiplicity.singleton,
0057 VarParsing.VarParsing.varType.string,
0058 "Global condition tag used when reading the database. Use empty string to use the default tag.")
0059
0060
0061 options.register('tag',
0062 defaults['tag'],
0063 VarParsing.VarParsing.multiplicity.singleton,
0064 VarParsing.VarParsing.varType.string,
0065 "Condition tag to use when filling the database")
0066
0067 options.register('inputFiles',
0068 defaults['inputFiles'],
0069 VarParsing.VarParsing.multiplicity.list,
0070 VarParsing.VarParsing.varType.string,
0071 "List of input files for file-to-database modes")
0072
0073 options.register('firstTime',
0074 defaults['firstTime'],
0075 VarParsing.VarParsing.multiplicity.singleton,
0076 VarParsing.VarParsing.varType.int,
0077 "Time in nanoseconds of the first event generated to extract the IOVs (see EmptySource parameters).")
0078
0079 options.register('timeBetween',
0080 defaults['timeBetweenEvents'],
0081 VarParsing.VarParsing.multiplicity.singleton,
0082 VarParsing.VarParsing.varType.int,
0083 "Time in nanoseconds between two events generated to extract the IOVs (see EmptySource parameters).")
0084
0085 options.register('maxEvents',
0086 defaults['maxEvents'],
0087 VarParsing.VarParsing.multiplicity.singleton,
0088 VarParsing.VarParsing.varType.int,
0089 "Number of events to generated. Use 1 for file-to-database mode")
0090
0091
0092
0093 options.parseArguments()
0094
0095 process = cms.Process("EcalLaserDB")
0096
0097 process.source = cms.Source("EmptySource",
0098 firstTime = cms.untracked.uint64(1),
0099 timeBetweenEvents = cms.untracked.uint64(1))
0100
0101 process.maxEvents = cms.untracked.PSet(
0102 input = cms.untracked.int32(options.maxEvents)
0103
0104 )
0105 process.load("CondCore.CondDB.CondDB_cfi")
0106 process.CondDB.connect = options.connect
0107 process.CondDB.DBParameters.authenticationPath = options.authenticationPath
0108
0109 if options.mode in [ 'hdf_file_to_db', 'ascii_file_to_db']:
0110 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0111 process.CondDB,
0112 toPut = cms.VPSet(cms.PSet(
0113 record = cms.string('EcalLaserAPDPNRatiosRcd'),
0114 tag = cms.string(options.tag),
0115 timetype = cms.untracked.string('runnumber')
0116
0117 )))
0118
0119 if options.mode in ['db_to_ascii_file']:
0120 process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
0121 if options.gtag:
0122 process.GlobalTag.globaltag = option.gtag
0123
0124 process.ecalConditions = cms.ESSource("PoolDBESSource",
0125 process.CondDB,
0126
0127 toGet = cms.VPSet(
0128 cms.PSet(
0129 record = cms.string('EcalLaserAPDPNRatiosRcd'),
0130 tag = cms.string(options.tag),
0131 )))
0132
0133
0134 process.load("CalibCalorimetry.EcalTrivialCondModules.EcalLaserCondTools_cfi")
0135
0136 process.ecalLaserCondTools.mode = options.mode
0137 process.ecalLaserCondTools.inputFiles = options.inputFiles
0138 process.ecalLaserCondTools.verbosity = options.verbosity
0139
0140 process.path = cms.Path(process.ecalLaserCondTools)