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
9528fde6
Commit
9528fde6
authored
4 years ago
by
Cdaq User
Browse files
Options
Downloads
Patches
Plain Diff
add waveform canvas
parent
a357aa7d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/online_monitor.conf
+3
-1
3 additions, 1 deletion
config/online_monitor.conf
online/monitor.cxx
+65
-2
65 additions, 2 deletions
online/monitor.cxx
with
68 additions
and
3 deletions
config/online_monitor.conf
+
3
−
1
View file @
9528fde6
...
...
@@ -3,8 +3,10 @@
host
=
clrlpc
.
jlab
.
org
port
=
11111
etfile
= /
tmp
/
et_test
modules
= ${
THIS_DIR
}/
esb_module
.
conf
output
= ${
THIS_DIR
}/../
processed_data
/
online
.
root
update_interval
=
2000
# ms
number_events
= -
1
# all events
update_interval
=
2000
# ms
This diff is collapsed.
Click to expand it.
online/monitor.cxx
+
65
−
2
View file @
9528fde6
...
...
@@ -308,6 +308,67 @@ void processEvent(const uint32_t *buf, int &count, TTree *tree, bool &init_tree,
}
}
static
std
::
vector
<
std
::
string
>
ec_channels
=
{
// "C4", "C6_1", "C7_1",
// "C5_1", "C9_1", "C8_1",
// "C1", "C2", "C3",
"C1"
,
"C2"
,
"C3"
,
"C4"
,
"C5_1"
,
"C5_2"
,
"C5_3"
,
"C5_4"
,
"C6_1"
,
"C6_2"
,
"C6_3"
,
"C6_4"
,
"C7_1"
,
"C7_2"
,
"C7_3"
,
"C7_4"
,
"C8_1"
,
"C8_2"
,
"C8_3"
,
"C8_4"
,
"C9_1"
,
"C9_2"
,
"C9_3"
,
"C9_4"
,
};
inline
void
set_graph
(
TGraph
*
gr
,
int
npt
,
double
value
=
0.
)
{
for
(
int
i
=
0
;
i
<
npt
;
++
i
)
{
gr
->
SetPoint
(
i
,
i
,
value
);
}
}
void
AddWaveformDisplay
(
hallc
::
MonitoringDisplay
*
dply
,
std
::
unordered_map
<
std
::
string
,
BranchData
>
&
brdata
,
int
&
mode
)
{
dply
->
CreateDisplayPlot
(
"raw/"
,
"waveform"
,
[]
(
hallc
::
DisplayPlot
&
plt
)
{
plt
.
_plot_data
.
_canvas
=
new
TCanvas
(
"ec_waveform"
,
"EC Waveform"
,
1200
,
700
);
plt
.
_plot_data
.
_canvas
->
Divide
(
5
,
5
);
for
(
size_t
i
=
0
;
i
<
ec_channels
.
size
();
++
i
)
{
auto
gr
=
new
TGraph
();
set_graph
(
gr
,
64
);
gr
->
SetLineColor
(
kRed
);
gr
->
SetLineWidth
(
2
);
plt
.
_plot_data
.
_graphs1
.
push_back
(
gr
);
gr
->
SetTitle
(
ec_channels
[
i
].
c_str
());
plt
.
_plot_data
.
_canvas
->
cd
(
i
+
1
);
gr
->
Draw
(
"L"
);
}
return
0
;
},
[
&
brdata
,
&
mode
]
(
hallc
::
DisplayPlot
&
plt
)
{
if
(
mode
!=
1
)
{
std
::
cout
<<
"Skip raw waveform plot because data mode = "
<<
mode
<<
std
::
endl
;
return
0
;
}
for
(
size_t
i
=
0
;
i
<
plt
.
_plot_data
.
_graphs1
.
size
();
++
i
)
{
plt
.
_plot_data
.
_canvas
->
cd
(
i
+
1
);
auto
gr
=
plt
.
_plot_data
.
_graphs1
[
i
];
set_graph
(
gr
,
64
);
auto
it
=
brdata
.
find
(
gr
->
GetTitle
());
if
(
it
!=
brdata
.
end
())
{
auto
data
=
it
->
second
;
for
(
int
k
=
0
;
k
<
64
&&
k
<
data
.
nraw
;
++
k
)
{
gr
->
SetPoint
(
k
,
k
,
data
.
raw
[
k
]);
}
}
else
{
std
::
cout
<<
"Warning: cannot find raw data for "
<<
gr
->
GetTitle
()
<<
std
::
endl
;
}
gr
->
Draw
(
"L"
);
gr
->
GetYaxis
()
->
SetRangeUser
(
300
,
1000
);
gr
->
GetXaxis
()
->
SetRangeUser
(
0
,
64
);
}
return
0
;
});
}
void
monitor
(
const
std
::
string
&
cpath
=
"config/online_monitor.conf"
)
{
// read configuration
...
...
@@ -346,9 +407,13 @@ void monitor(const std::string &cpath = "config/online_monitor.conf")
// root file and event tree
auto
*
hfile
=
new
TFile
(
outfile
.
c_str
(),
"RECREATE"
,
"MAPMT test results"
);
auto
tree
=
new
TTree
(
"EvTree"
,
"Cherenkov Test Events"
);
int
data_mode
=
-
1
;
bool
init_tree
=
false
;
// display plots
auto
dply
=
CreateMonitorDisplay
(
"/online/latest/"
,
9100
,
tree
);
// monitor display for raw waveform
AddWaveformDisplay
(
dply
,
brdata
,
data_mode
);
dply
->
InitAll
();
...
...
@@ -357,8 +422,6 @@ void monitor(const std::string &cpath = "config/online_monitor.conf")
// start monitoring
int
count
=
0
;
int
data_mode
=
-
1
;
bool
init_tree
=
false
;
signal
(
SIGINT
,
handle_sig
);
while
(
true
)
{
if
(
term
>
0
||
(
nev
>
0
&&
nev
<
count
))
{
break
;
}
...
...
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