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