Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
CondCore
Utilities
python
timeUnitHelper.py
Go to the documentation of this file.
1
"""Some helper classes to convert conditions time units back and forth
2
"""
3
def
pack
(high,low):
4
"""pack high,low 32bit unsigned int to one unsigned 64bit long long
5
Note:the print value of result number may appear signed, if the sign bit is used.
6
"""
7
h=high<<32
8
return
(h|low)
9
10
def
packToString
(high,low):
11
"""pack high,low 32bit unsigned int to one unsigned 64bit long long in string format
12
Note:the print value of result number may appear signed, if the sign bit is used.
13
"""
14
fmt=
"%u"
15
return
fmt%
pack
(high,low)
16
17
def
unpack
(i):
18
"""unpack 64bit unsigned long long into 2 32bit unsigned int, return tuple (high,low)
19
"""
20
high=i>>32
21
low=i&0xFFFFFFFF
22
return
(high,low)
23
24
def
unpackFromString
(i):
25
"""unpack 64bit unsigned long long in string format into 2 32bit unsigned int, return tuple(high,low)
26
"""
27
return
unpack
(int(i))
28
29
def
timeStamptoDate
(i):
30
"""convert 64bit timestamp to local date in string format
31
"""
32
import
time
33
return
time.ctime(
unpack
(i)[0])
34
35
def
timeStamptoUTC
(i):
36
"""convert 64bit timestamp to Universal Time in string format
37
"""
38
t=
unpack
(i)[0]
39
import
time
40
return
time.strftime(
"%a, %d %b %Y %H:%M:%S +0000"
,time.gmtime(t))
41
42
def
unpackLumiid
(i):
43
"""unpack 64bit lumiid to dictionary {'run','lumisection'}
44
"""
45
j=
unpack
(i)
46
return
{
'run'
:j[0],
'lumisection'
:j[1]}
timeUnitHelper.unpack
def unpack
Definition:
timeUnitHelper.py:17
timeUnitHelper.unpackLumiid
def unpackLumiid
Definition:
timeUnitHelper.py:42
timeUnitHelper.timeStamptoUTC
def timeStamptoUTC
Definition:
timeUnitHelper.py:35
timeUnitHelper.timeStamptoDate
def timeStamptoDate
Definition:
timeUnitHelper.py:29
timeUnitHelper.pack
def pack
Definition:
timeUnitHelper.py:3
reco::return
return(e1-e2)*(e1-e2)+dp *dp
timeUnitHelper.packToString
def packToString
Definition:
timeUnitHelper.py:10
timeUnitHelper.unpackFromString
def unpackFromString
Definition:
timeUnitHelper.py:24
Generated for CMSSW Reference Manual by
1.8.5