File indexing completed on 2024-11-25 02:29:25
0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003
0004 process = cms.Process("Demo")
0005
0006
0007
0008
0009 options = VarParsing.VarParsing("analysis")
0010
0011 options.register ('globalTag',
0012 "103X_dataRun2_HLT_relval_v8",VarParsing.VarParsing.multiplicity.singleton,
0013 VarParsing.VarParsing.varType.string,
0014 "GlobalTag")
0015
0016 options.register ('forHLT',
0017 True,VarParsing.VarParsing.multiplicity.singleton,
0018 VarParsing.VarParsing.varType.bool,
0019 "is for SiPixelGainCalibrationForHLT")
0020
0021 options.register ('firstRun',
0022 1,VarParsing.VarParsing.multiplicity.singleton,
0023 VarParsing.VarParsing.varType.int,
0024 "first run to be processed")
0025
0026 options.parseArguments()
0027
0028
0029
0030
0031 process.load('FWCore.MessageService.MessageLogger_cfi')
0032 process.MessageLogger.cerr.enable = False
0033 process.MessageLogger.SiPixelGainCalibScaler=dict()
0034 process.MessageLogger.cout = cms.untracked.PSet(
0035 enable = cms.untracked.bool(True),
0036 enableStatistics = cms.untracked.bool(True),
0037 threshold = cms.untracked.string("INFO"),
0038 default = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0039 FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0040 reportEvery = cms.untracked.int32(100000)
0041 ),
0042 SiPixelGainCalibScaler = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0043 )
0044
0045 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0046 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0047 from Configuration.AlCa.GlobalTag import GlobalTag
0048 process.GlobalTag = GlobalTag(process.GlobalTag,options.globalTag, '')
0049
0050
0051 process.trackerGeometryDB.applyAlignment = False
0052
0053
0054
0055
0056 MyRecord=""
0057 if options.forHLT:
0058 MyRecord="SiPixelGainCalibrationForHLTRcd"
0059 else:
0060 MyRecord="SiPixelGainCalibrationOfflineRcd"
0061
0062
0063
0064
0065 print("Using Global Tag:", process.GlobalTag.globaltag._value)
0066 print("first run to be processed:",options.firstRun)
0067 print("is for HLT? ","yes" if options.forHLT else "no!")
0068 print("outputing on record: ",MyRecord)
0069
0070
0071
0072
0073 print("running over",options.maxEvents, "events")
0074 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents))
0075
0076
0077
0078
0079 process.source = cms.Source("EmptySource",
0080 firstRun = cms.untracked.uint32(options.firstRun),
0081 numberEventsInRun = cms.untracked.uint32(1),
0082 )
0083
0084
0085
0086
0087 process.demo = cms.EDAnalyzer('SiPixelGainCalibScaler',
0088 isForHLT = cms.bool(options.forHLT),
0089 record = cms.string(MyRecord),
0090 parameters = cms.VPSet(
0091 cms.PSet(
0092 conversionFactor = cms.double(65.),
0093 conversionFactorL1 = cms.double(65.),
0094 offset = cms.double(-414.),
0095 offsetL1 = cms.double(-414.),
0096 phase = cms.uint32(0)
0097 ),
0098 cms.PSet(
0099 conversionFactor = cms.double(47.),
0100 conversionFactorL1 = cms.double(50.),
0101 offset = cms.double(-60.),
0102 offsetL1 = cms.double(-670.),
0103 phase = cms.uint32(1)
0104 )
0105 )
0106 )
0107
0108
0109
0110 process.load("CondCore.CondDB.CondDB_cfi")
0111
0112
0113
0114
0115 process.CondDB.connect = 'sqlite_file:TEST_modifiedGains_'+process.GlobalTag.globaltag._value+("_HLTGain" if options.forHLT else "_offlineGain")+".db"
0116 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
0117 process.CondDB,
0118 timetype = cms.untracked.string('runnumber'),
0119 toPut = cms.VPSet(cms.PSet(record = cms.string(MyRecord),
0120 tag = cms.string('scaledGains')
0121 )
0122 )
0123 )
0124
0125 process.p = cms.Path(process.demo)