10 import FWCore.ParameterSet.Config
as cms
11 import FWCore.ParameterSet.VarParsing
as VarParsing
12 from xml.etree.ElementTree
import parse
20 print "Usage: cmsRun loadConditions.py file=FILENAME record=RECORD db=CONNECTSTRING"
22 print " specify xml file to load to DB"
24 print " record=RECORD"
25 print " specify record to be loaded (EcalChannelStatus, etc)"
27 print " db=CONNECTSTRING"
28 print " specify connection string, e.g. sqlite_file=file.db"
36 options.register (
'file',
38 VarParsing.VarParsing.multiplicity.singleton,
39 VarParsing.VarParsing.varType.string,
42 options.register (
'record',
44 VarParsing.VarParsing.multiplicity.singleton,
45 VarParsing.VarParsing.varType.string,
46 "record type to load")
48 options.register (
'db',
50 VarParsing.VarParsing.multiplicity.singleton,
51 VarParsing.VarParsing.varType.string,
52 "db connection string")
54 options.parseArguments()
58 '''Read tag and since from EcalCondHeader in XML file '''
59 root =
parse(filename).getroot()
60 header = root.find(headertag)
61 since = header.findtext(
'since')
62 tag = header.findtext(
'tag')
70 analyzer_ = {
'EcalGainRatios':
'EcalGainRatiosAnalyzer', \
71 'EcalADCToGeVConstant':
'EcalADCToGeVConstantAnalyzer', \
72 'EcalWeightXtalGroups':
'EcalWeightGroupAnalyzer', \
73 'EcalChannelStatus':
'EcalChannelStatusHandler', \
74 'EcalChannelStatus':
'EcalChannelStatusAnalyzer', \
75 'EcalTBWeights':
'EcalTBWeightsAnalyzer', \
76 'EcalIntercalibConstants':
'EcalIntercalibConstantsAnalyzer', \
77 'EcalIntercalibConstantsMC':
'EcalIntercalibConstantsMCAnalyzer', \
78 'EcalIntercalibErrors':
'EcalIntercalibErrorsAnalyzer'
83 process = cms.Process(
"LoadEcalConditions")
85 process.source = cms.Source(
"EmptyIOVSource",
86 timetype = cms.string(
'runnumber'),
87 firstValue = cms.uint64(1),
88 lastValue = cms.uint64(1),
89 interval = cms.uint64(1)
93 process.load(
"CondCore.DBCommon.CondDBCommon_cfi")
94 process.CondDBCommon.connect = cms.string(options.db)
95 process.CondDBCommon.DBParameters.authenticationPath = cms.untracked.string(
'/afs/cern.ch/cms/DB/conddb')
97 process.PoolDBOutputService = cms.Service(
"PoolDBOutputService",
99 timetype = cms.untracked.string(
'runnumber'),
100 toPut = cms.VPSet(cms.PSet(
101 record = cms.string(options.record+
'Rcd'),
102 tag = cms.string(tag_)
104 logconnect= cms.untracked.string(
'sqlite_file:log.db')
108 process.popconAnalyzer = cms.EDAnalyzer(analyzer_[options.record],
109 record = cms.string(options.record+
'Rcd'),
110 loggingOn= cms.untracked.bool(
True),
111 SinceAppendMode=cms.bool(
True),
113 xmlFile = cms.untracked.string(options.file),
114 since = cms.untracked.int64(int(since_))
120 process.p = cms.Path(process.popconAnalyzer)
Evaluator * parse(const T &text)