File indexing completed on 2023-03-17 10:48:51
0001 import datetime
0002 import os
0003 import FWCore.ParameterSet.Config as cms
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005
0006 options = VarParsing.VarParsing()
0007 options.register('delay'
0008 , 1
0009 , VarParsing.VarParsing.multiplicity.singleton
0010 , VarParsing.VarParsing.varType.int
0011 , "Time delay (in hours) for the O2O. The O2O then queries the PVSS DB from last IOV until (current hour - delay), ignoring minutes and seconds."
0012 )
0013 options.register('sourceConnection'
0014 , 'oracle://cms_omds_adg/CMS_TRK_R'
0015 , VarParsing.VarParsing.multiplicity.singleton
0016 , VarParsing.VarParsing.varType.string
0017 , "Connection string to the PVSS DB."
0018 )
0019 options.register('destinationConnection'
0020 , 'sqlite_file:SiStripDetVOff.db'
0021 , VarParsing.VarParsing.multiplicity.singleton
0022 , VarParsing.VarParsing.varType.string
0023 , "Connection string to the DB where payloads will be possibly written."
0024 )
0025 options.register('conddbConnection'
0026 , 'oracle://cms_orcon_adg/CMS_CONDITIONS'
0027 , VarParsing.VarParsing.multiplicity.singleton
0028 , VarParsing.VarParsing.varType.string
0029 , "Connection string to the DB from which the last IOV is read."
0030 )
0031 options.register('tag'
0032 , 'SiStripDetVOff_test'
0033 , VarParsing.VarParsing.multiplicity.singleton
0034 , VarParsing.VarParsing.varType.string
0035 , "Tag written in destinationConnection and finally appended in targetConnection."
0036 )
0037 options.parseArguments()
0038
0039
0040 dt = datetime.datetime.utcnow() - datetime.timedelta(hours=options.delay)
0041 tmax = [dt.year, dt.month, dt.day, dt.hour, 0, 0, 0]
0042
0043
0044 authPath = os.environ['COND_AUTH_PATH'] if 'COND_AUTH_PATH' in os.environ else os.environ["HOME"]
0045
0046 process = cms.Process("SiStripDCSO2O")
0047
0048 process.MessageLogger = cms.Service( "MessageLogger",
0049 debugModules = cms.untracked.vstring( "*" ),
0050 cout = cms.untracked.PSet( threshold = cms.untracked.string( "DEBUG" ) ),
0051 destinations = cms.untracked.vstring( "cout" )
0052 )
0053
0054 process.maxEvents = cms.untracked.PSet(
0055 input = cms.untracked.int32(1)
0056 )
0057 process.source = cms.Source("EmptySource",
0058 numberEventsInRun = cms.untracked.uint32(1),
0059 firstRun = cms.untracked.uint32(1)
0060 )
0061
0062
0063 process.SiStripDetVOffBuilder = cms.Service(
0064 "SiStripDetVOffBuilder",
0065 onlineDB=cms.string(options.sourceConnection),
0066 authPath=cms.string(authPath),
0067
0068
0069 Tmin = cms.vint32(2016, 1, 1, 0, 0, 0, 0),
0070 Tmax = cms.vint32(tmax),
0071
0072
0073 TSetMin = cms.vint32(2007, 11, 26, 0, 0, 0, 0),
0074
0075
0076 queryType = cms.string('STATUSCHANGE'),
0077
0078
0079 DeltaTmin = cms.uint32(2),
0080
0081
0082 MaxIOVlength = cms.uint32(90),
0083
0084
0085 lastValueFile = cms.string(''),
0086
0087
0088 lastValueFromFile = cms.bool(False),
0089
0090
0091 debugModeOn = cms.bool(False),
0092
0093
0094 DetIdListFile = cms.string('CalibTracker/SiStripCommon/data/SiStripDetInfo.dat'),
0095
0096
0097 HighVoltageOnThreshold = cms.double(0.97),
0098
0099
0100 PsuDetIdMapFile = cms.string("CalibTracker/SiStripDCS/data/StripPSUDetIDMap_FromFeb2016.dat"),
0101
0102
0103 ExcludedDetIdListFile = cms.string('')
0104 )
0105
0106
0107 process.load("CondCore.CondDB.CondDB_cfi")
0108 process.siStripPopConDetVOff = cms.EDAnalyzer( "SiStripO2ODetVOff",
0109 process.CondDB,
0110
0111
0112 conditionDatabase = cms.string(options.conddbConnection),
0113 condDbFile = cms.string(options.destinationConnection),
0114 targetTag = cms.string(options.tag),
0115
0116 maxTimeBeforeNewIOV=cms.untracked.int32(168)
0117 )
0118
0119 process.p = cms.Path(process.siStripPopConDetVOff)