File indexing completed on 2024-04-06 11:59:53
0001 from __future__ import print_function
0002 def pack(high,low):
0003 """pack high,low 32bit unsigned int to one unsigned 64bit long long
0004 Note:the print value of result number may appear signed, if the sign bit is used.
0005 """
0006 h=high<<32
0007 return (h|low)
0008
0009 def secondsFromString(i):
0010 """convert from a string in the format output from timeStamptoDate to a 32bit seconds from the epoch.
0011 The format accepted is \"DD/MM/YYYY HH:MM:SS\". The year must be the full number.
0012 """
0013 import time
0014 return int(time.mktime(time.strptime(i, "%d/%m/%Y %H:%M:%S")))
0015
0016 def packFromString(i):
0017 """pack from a string in the format output from timeStamptoUTC to a 64bit timestamp
0018 the format accepted is \"DD/MM/YYYY HH:MM:SS\" . The year must be the full number.
0019 """
0020 return pack(secondsFromString(i), 0)
0021
0022 def intervalSinceEpoch(i):
0023 """ compute the interval of time is seconds since the Epoch and return the packed 64bit value.
0024 """
0025 return( packFromString(i) - packFromString("01/01/1970 00:00:00") )
0026
0027 import FWCore.ParameterSet.Config as cms
0028
0029 process = cms.Process("Reader")
0030
0031 process.MessageLogger = cms.Service("MessageLogger",
0032 debugModules = cms.untracked.vstring("*"),
0033 DetVOffReaderSummary_DATE = cms.untracked.PSet(
0034 threshold = cms.untracked.string('INFO')
0035 ),
0036 DetVOffReaderDebug_DATE = cms.untracked.PSet(
0037 threshold = cms.untracked.string('DEBUG')
0038 ),
0039 destinations = cms.untracked.vstring('DetVOffReaderSummary_DATE', 'DetVOffReaderDebug_DATE')
0040 )
0041
0042 process.maxEvents = cms.untracked.PSet(
0043 input = cms.untracked.int32(1)
0044 )
0045
0046
0047
0048
0049
0050
0051 print("using an interval of 1 second = ", end=' ')
0052 print(intervalSinceEpoch("01/01/1970 00:00:01"))
0053
0054 process.source = cms.Source("EmptyIOVSource",
0055 timetype = cms.string('timestamp'),
0056
0057
0058 firstValue = cms.uint64(STARTTIME),
0059 lastValue = cms.uint64(ENDTIME),
0060
0061
0062 interval = cms.uint64(intervalSinceEpoch("01/01/1970 00:00:01"))
0063 )
0064
0065 process.poolDBESSource = cms.ESSource("PoolDBESSource",
0066 BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
0067 DBParameters = cms.PSet(
0068 messageLevel = cms.untracked.int32(2),
0069 authenticationPath = cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
0070 ),
0071 connect = cms.string('DATABASE'),
0072 toGet = cms.VPSet(cms.PSet(
0073 timetype = cms.untracked.string('timestamp'),
0074 record = cms.string('SiStripDetVOffRcd'),
0075 tag = cms.string('SiStripDetVOff_Fake_31X')
0076 ))
0077 )
0078
0079 process.reader = cms.EDFilter("SiStripDetVOffDummyPrinter")
0080
0081 process.p1 = cms.Path(process.reader)
0082
0083