Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fadc_decoder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zhiwen Zhao
fadc_decoder
Commits
1206b192
Commit
1206b192
authored
5 years ago
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
update analysis script, add timing info for the data
parent
5b7cc571
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/json/esb_timing.json
+82
-0
82 additions, 0 deletions
config/json/esb_timing.json
scripts/analyze_waveform.py
+20
-24
20 additions, 24 deletions
scripts/analyze_waveform.py
with
102 additions
and
24 deletions
config/json/esb_timing.json
0 → 100644
+
82
−
0
View file @
1206b192
{
"Cer11_1"
:
[
-18.5
,
-14.5
],
"Cer11_2"
:
[
-18.5
,
-14.5
],
"Cer11_3"
:
[
-18.5
,
-14.5
],
"Cer11_4"
:
[
-18.5
,
-14.5
],
"Cer11_5"
:
[
-16.5
,
-12.5
],
"Cer12_1"
:
[
-19.5
,
-15.5
],
"Cer12_2"
:
[
-19.5
,
-15.5
],
"Cer12_3"
:
[
-19.5
,
-15.5
],
"Cer12_4"
:
[
-18.5
,
-14.5
],
"Cer12_5"
:
[
-16.5
,
-12.5
],
"Cer13_1"
:
[
-18.5
,
-14.5
],
"Cer13_2"
:
[
-18.5
,
-14.5
],
"Cer13_3"
:
[
-18.5
,
-14.5
],
"Cer13_4"
:
[
-18.5
,
-14.5
],
"Cer13_5"
:
[
-16.5
,
-12.5
],
"Cer14_1"
:
[
-18.5
,
-14.5
],
"Cer14_2"
:
[
-18.5
,
-14.5
],
"Cer14_3"
:
[
-18.5
,
-14.5
],
"Cer14_4"
:
[
-18.5
,
-14.5
],
"Cer14_5"
:
[
-17.5
,
-13.5
],
"Cer21_1"
:
[
-13.5
,
-9.5
],
"Cer21_2"
:
[
-13.5
,
-9.5
],
"Cer21_3"
:
[
-13.5
,
-9.5
],
"Cer21_4"
:
[
-13.5
,
-9.5
],
"Cer21_5"
:
[
-12.5
,
-8.5
],
"Cer22_1"
:
[
-13.5
,
-9.5
],
"Cer22_2"
:
[
-62
,
62
],
"Cer22_3"
:
[
-18.5
,
-14.5
],
"Cer22_4"
:
[
-18.5
,
-14.5
],
"Cer22_5"
:
[
-11.5
,
-7.5
],
"Cer23_1"
:
[
-14.5
,
-10.5
],
"Cer23_2"
:
[
-13.5
,
-9.5
],
"Cer23_3"
:
[
-13.5
,
-9.5
],
"Cer23_4"
:
[
-14.5
,
-10.5
],
"Cer23_5"
:
[
-12.5
,
-8.5
],
"Cer24_1"
:
[
-14.5
,
-10.5
],
"Cer24_2"
:
[
-13.5
,
-9.5
],
"Cer24_3"
:
[
-13.5
,
-9.5
],
"Cer24_4"
:
[
-18.5
,
-14.5
],
"Cer24_5"
:
[
-16.5
,
-12.5
],
"Cer31_1"
:
[
-18.5
,
-14.5
],
"Cer31_2"
:
[
-18.5
,
-14.5
],
"Cer31_3"
:
[
-18.5
,
-14.5
],
"Cer31_4"
:
[
-18.5
,
-14.5
],
"Cer31_5"
:
[
-16.5
,
-12.5
],
"Cer32_1"
:
[
-18.5
,
-14.5
],
"Cer32_2"
:
[
-18.5
,
-14.5
],
"Cer32_3"
:
[
-18.5
,
-14.5
],
"Cer32_4"
:
[
-18.5
,
-14.5
],
"Cer32_5"
:
[
-16.5
,
-12.5
],
"Cer33_1"
:
[
-18.5
,
-14.5
],
"Cer33_2"
:
[
-18.5
,
-14.5
],
"Cer33_3"
:
[
-18.5
,
-14.5
],
"Cer33_4"
:
[
-18.5
,
-14.5
],
"Cer33_5"
:
[
-16.5
,
-12.5
],
"Cer34_1"
:
[
-18.5
,
-14.5
],
"Cer34_2"
:
[
-18.5
,
-14.5
],
"Cer34_3"
:
[
-18.5
,
-14.5
],
"Cer34_4"
:
[
-18.5
,
-14.5
],
"Cer34_5"
:
[
-16.5
,
-12.5
],
"Cer41_1"
:
[
-18.5
,
-14.5
],
"Cer41_2"
:
[
-18.5
,
-14.5
],
"Cer41_3"
:
[
-18.5
,
-14.5
],
"Cer41_4"
:
[
-18.5
,
-14.5
],
"Cer41_5"
:
[
-16.5
,
-12.5
],
"Cer42_1"
:
[
-18.5
,
-14.5
],
"Cer42_2"
:
[
-18.5
,
-14.5
],
"Cer42_3"
:
[
-18.5
,
-14.5
],
"Cer42_4"
:
[
-18.5
,
-14.5
],
"Cer42_5"
:
[
-16.5
,
-12.5
],
"Cer43_1"
:
[
-25.5
,
-21.5
],
"Cer43_2"
:
[
-62
,
62
],
"Cer43_3"
:
[
-25.5
,
-21.5
],
"Cer43_4"
:
[
-25.5
,
-21.5
],
"Cer43_5"
:
[
-23.5
,
-19.5
],
"Cer44_1"
:
[
-25.5
,
-21.5
],
"Cer44_2"
:
[
-25.5
,
-21.5
],
"Cer44_3"
:
[
-25.5
,
-21.5
],
"Cer44_4"
:
[
-13.5
,
-9.5
],
"Cer44_5"
:
[
-11.5
,
-7.5
]
}
This diff is collapsed.
Click to expand it.
scripts/analyze_waveform.py
+
20
−
24
View file @
1206b192
...
@@ -27,25 +27,18 @@ parser = argparse.ArgumentParser('Raw waveform analysis')
...
@@ -27,25 +27,18 @@ parser = argparse.ArgumentParser('Raw waveform analysis')
parser
.
add_argument
(
'
root_file
'
,
help
=
'
a root file of waveform data
'
)
parser
.
add_argument
(
'
root_file
'
,
help
=
'
a root file of waveform data
'
)
parser
.
add_argument
(
'
output
'
,
help
=
'
path to the output csv file
'
)
parser
.
add_argument
(
'
output
'
,
help
=
'
path to the output csv file
'
)
parser
.
add_argument
(
'
-n
'
,
'
--number-events
'
,
type
=
int
,
default
=
0
,
dest
=
'
nev
'
,
help
=
'
number of events to process, <= 0 means all
'
)
parser
.
add_argument
(
'
--timing-config
'
,
type
=
str
,
default
=
'
config/json/esb_timing.json
'
,
dest
=
'
tconfig
'
,
help
=
'
path to the json file for channel timings
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
figsize
=
(
16
,
16
)
figsize
=
(
16
,
16
)
nrows
,
ncols
=
4
,
4
nrows
,
ncols
=
4
,
4
ch
=
[
'
Cer11_5
'
,
'
Cer12_5
'
,
'
Cer13_5
'
,
'
Cer14_5
'
,
dbf
=
open
(
args
.
tconfig
)
'
Cer21_5
'
,
'
Cer22_5
'
,
'
Cer23_5
'
,
'
Cer24_5
'
,
ch_pos
=
json
.
load
(
dbf
)
'
Cer31_5
'
,
'
Cer32_5
'
,
'
Cer33_5
'
,
'
Cer34_5
'
,
'
Cer41_5
'
,
'
Cer42_5
'
,
'
Cer43_5
'
,
'
Cer44_5
'
,
]
ch_pos
=
[
-
15.5
,
-
14.5
,
-
15.5
,
-
15.5
,
-
10.5
,
-
9.5
,
-
10.5
,
-
14.5
,
-
14.5
,
-
14.5
,
-
14.5
,
-
14.5
,
-
14.5
,
-
14.5
,
-
21.5
,
-
9.5
]
pos_width
=
3
# trigger channels
# trigger channels
# tr = ['S2_1', 'S2_2', 'S2_3', 'S2_4', 'S2_5', 'S2_6', 'S2_7', 'S2_8', 'S2_9', 'S2_10', 'S2_11']
# tr = ['S2_1', 'S2_2', 'S2_3', 'S2_4', 'S2_5', 'S2_6', 'S2_7', 'S2_8', 'S2_9', 'S2_10', 'S2_11']
...
@@ -59,7 +52,7 @@ tree = f.EvTree
...
@@ -59,7 +52,7 @@ tree = f.EvTree
trg_ch
=
np
.
ndarray
(
shape
=
(
tree
.
GetEntries
(),
),
dtype
=
object
)
trg_ch
=
np
.
ndarray
(
shape
=
(
tree
.
GetEntries
(),
),
dtype
=
object
)
trg_val
=
np
.
ndarray
(
shape
=
(
tree
.
GetEntries
(),
3
),
dtype
=
'
float64
'
)
trg_val
=
np
.
ndarray
(
shape
=
(
tree
.
GetEntries
(),
3
),
dtype
=
'
float64
'
)
ch_val
=
np
.
ndarray
(
shape
=
(
tree
.
GetEntries
(),
len
(
ch
)
*
2
),
dtype
=
'
float64
'
)
ch_val
=
np
.
ndarray
(
shape
=
(
tree
.
GetEntries
(),
len
(
ch
_pos
)
*
2
),
dtype
=
'
float64
'
)
for
iev
in
np
.
arange
(
0
,
tree
.
GetEntries
()):
for
iev
in
np
.
arange
(
0
,
tree
.
GetEntries
()):
tree
.
GetEntry
(
iev
)
tree
.
GetEntry
(
iev
)
...
@@ -89,25 +82,28 @@ for iev in np.arange(0, tree.GetEntries()):
...
@@ -89,25 +82,28 @@ for iev in np.arange(0, tree.GetEntries()):
trg_val
[
iev
]
=
(
ev_trg_peaks
[
ich
],
ev_trg_poses
[
ich
],
len
(
ev_trg_peaks
))
trg_val
[
iev
]
=
(
ev_trg_peaks
[
ich
],
ev_trg_poses
[
ich
],
len
(
ev_trg_peaks
))
# channels
# channels
for
i
,
c
in
enumerate
(
ch
):
for
i
,
(
c
,
twin
)
in
enumerate
(
ch
_pos
.
items
()
):
peaks
=
branch_to_array1d
(
tree
.
__getattr__
(
c
+
'
_Ppeak
'
),
np
.
float32
)
peaks
=
branch_to_array1d
(
tree
.
__getattr__
(
c
+
'
_Ppeak
'
),
np
.
float32
)
poses
=
branch_to_array1d
(
tree
.
__getattr__
(
c
+
'
_Ptime
'
),
np
.
float32
)
poses
=
branch_to_array1d
(
tree
.
__getattr__
(
c
+
'
_Ptime
'
),
np
.
float32
)
# check timing
# check timing
, maximum peak inside the time window
cpeak
,
cpos
=
0
,
0
cpeak
,
cpos
=
0
,
0
for
peak
,
pos
in
zip
(
peaks
,
poses
):
for
peak
,
pos
in
zip
(
peaks
,
poses
):
pos
-=
ev_trg_poses
[
ich
]
pos
-=
ev_trg_poses
[
ich
]
if
pos
<
=
(
ch_pos
[
i
]
+
pos_width
)
and
pos
>
=
(
ch_pos
[
i
]
-
pos_width
)
and
peak
>
cpeak
:
if
pos
>
=
twin
[
0
]
and
pos
<
=
twin
[
1
]
and
peak
>
cpeak
:
cpeak
=
peak
cpeak
=
peak
cpos
=
pos
cpos
=
pos
ch_val
[
iev
][[
i
,
len
(
ch
)
+
i
]]
=
(
cpeak
,
cpos
)
ch_val
[
iev
][[
i
,
len
(
ch
_pos
)
+
i
]]
=
(
cpeak
,
cpos
)
print
(
'
processed {}
'
.
format
(
iev
))
if
args
.
nev
>
0
and
iev
>=
args
.
nev
:
break
print
(
'
processed {}
'
.
format
(
iev
))
result
=
pd
.
DataFrame
(
index
=
np
.
arange
(
0
,
tree
.
GetEntries
()),
cols
=
[
'
trg_peak
'
,
'
trg_pos
'
,
'
trg_nhits
'
]
\
columns
=
[
'
trg_peak
'
,
'
trg_pos
'
,
'
trg_nhits
'
]
+
[
c
+
'
_peak
'
for
c
in
ch
]
+
[
c
+
'
_pos
'
for
c
in
ch
],
+
[
c
+
'
_peak
'
for
c
,
_
in
ch_pos
.
items
()]
\
data
=
np
.
concatenate
((
trg_val
,
ch_val
),
axis
=
1
))
+
[
c
+
'
_pos
'
for
c
,
_
in
ch_pos
.
items
()]
result
.
loc
[:,
'
trg_ch
'
]
=
trg_ch
result
=
pd
.
DataFrame
(
index
=
np
.
arange
(
iev
+
1
),
columns
=
cols
,
data
=
np
.
concatenate
((
trg_val
[
0
:
iev
+
1
],
ch_val
[
0
:
iev
+
1
]),
axis
=
1
))
result
.
loc
[:,
'
trg_ch
'
]
=
trg_ch
[
0
:
iev
+
1
]
result
.
to_csv
(
args
.
output
)
result
.
to_csv
(
args
.
output
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment