Belle II Software
release-05-02-19
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
h
i
l
m
n
p
r
s
t
v
w
Enumerations
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
SetMetaTimeModule.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
from
basf2
import
Module
5
from
ROOT
import
Belle2
6
from
basf2
import
B2FATAL, B2ERROR, B2WARNING, B2INFO, B2DEBUG
7
8
9
class
SetMetaTimeModule
(Module):
10
11
"""
12
module which sets time in EventMetaData from detector raw data
13
14
Author: bjoern.spruck@belle2.org
15
"""
16
17
18
detectorlist =
"SVD CDC ECL TOP"
19
20
21
meta =
None
22
23
24
raws = []
25
26
def
initialize
(self):
27
"""initialize"""
28
self.
meta
=
Belle2.PyStoreObj
(
'EventMetaData'
)
29
if
not
self.
meta
:
30
B2FATAL(
"no EventMetaData object"
)
31
return
32
self.
raws
= [
Belle2.PyStoreArray
(f
"Raw{e}s"
)
for
e
in
self.
detectorlist
.split()]
33
34
def
calc_time
(self, it):
35
"""Calculate the time in ns since epoch from UnixTime and Accelerator Clock count"""
36
# t = it.GetTTTimeNs(0)
37
return
it.GetTTUtime(0) * 1000000000 + int(round(it.GetTTCtime(0) / 0.127216))
38
39
def
event
(self):
40
"""event"""
41
if
not
self.
meta
.isValid():
42
B2FATAL(
"no valid EventMetaData object in this event"
)
43
return
44
45
t = self.
meta
.getTime()
# Check if it already set, t=0 means not set
46
if
t != 0:
47
return
# No need to update
48
49
for
det
in
self.
raws
:
50
if
det:
51
for
it
in
det:
52
t = self.
calc_time
(it)
53
self.
meta
.setTime(t)
54
return
55
56
B2DEBUG(1,
"No time for EventMetaData extracted as no raw data entries were available from selected detectors"
)
SetMetaTimeModule.SetMetaTimeModule.calc_time
def calc_time(self, it)
Definition:
SetMetaTimeModule.py:34
SetMetaTimeModule.SetMetaTimeModule.raws
list raws
array of pointers to the detector raw data arrays
Definition:
SetMetaTimeModule.py:24
SetMetaTimeModule.SetMetaTimeModule.detectorlist
string detectorlist
List of detector names to check in that order (for fallback)
Definition:
SetMetaTimeModule.py:18
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition:
PyStoreObj.h:69
SetMetaTimeModule.SetMetaTimeModule.initialize
def initialize(self)
Definition:
SetMetaTimeModule.py:26
SetMetaTimeModule.SetMetaTimeModule
Definition:
SetMetaTimeModule.py:9
SetMetaTimeModule.SetMetaTimeModule.event
def event(self)
Definition:
SetMetaTimeModule.py:39
SetMetaTimeModule.SetMetaTimeModule.meta
meta
pointer to event meta data
Definition:
SetMetaTimeModule.py:21
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition:
PyStoreArray.h:58
rawdata
modules
scripts
SetMetaTimeModule.py
Generated on Tue Jan 4 2022 03:01:34 for Belle II Software by
1.8.17