Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
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
Container registry
Model registry
Operate
Environments
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
jlab
hallc
analyzer_software
hcana
Commits
4a11312f
Commit
4a11312f
authored
5 years ago
by
Chao1009
Browse files
Options
Downloads
Patches
Plain Diff
Add progress report in OnlineMonitor
parent
d729e41b
No related branches found
No related tags found
No related merge requests found
Pipeline
#2006
passed
5 years ago
Stage: build
Stage: build_sing_img
Stage: data_replays
Stage: data_tests
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/OnlineMonitor.cxx
+16
-7
16 additions, 7 deletions
src/OnlineMonitor.cxx
src/OnlineMonitor.h
+3
-1
3 additions, 1 deletion
src/OnlineMonitor.h
tools/monitor_hms.cpp
+18
-4
18 additions, 4 deletions
tools/monitor_hms.cpp
with
37 additions
and
12 deletions
src/OnlineMonitor.cxx
+
16
−
7
View file @
4a11312f
#include
"OnlineMonitor.h"
#include
"OnlineMonitor.h"
#include
"PRadETChannel.h"
#include
"PRadETChannel.h"
#include
<csignal>
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
volatile
std
::
sig_atomic_t
gSignalStatus
;
void
signal_handler
(
int
signal
)
{
gSignalStatus
=
signal
;
}
namespace
hcana
{
namespace
hcana
{
Int_t
OnlineMonitor
::
Monitor
(
PRadETChannel
*
ch
,
std
::
chrono
::
seconds
interval
)
Int_t
OnlineMonitor
::
Monitor
(
PRadETChannel
*
ch
,
std
::
chrono
::
seconds
interval
,
int
progress
)
{
{
Int_t
total
=
0
;
Int_t
total
=
0
;
fMonitor
=
true
;
fMonitor
=
true
;
...
@@ -14,18 +21,20 @@ Int_t OnlineMonitor::Monitor(PRadETChannel *ch, std::chrono::seconds interval)
...
@@ -14,18 +21,20 @@ Int_t OnlineMonitor::Monitor(PRadETChannel *ch, std::chrono::seconds interval)
fBench
->
Begin
(
"Total"
);
fBench
->
Begin
(
"Total"
);
void
(
*
prev_handler
)(
int
);
std
::
signal
(
SIGINT
,
signal_handler
);
prev_handler
=
signal
(
SIGINT
,
handle_sig
);
while
(
!
fMonitor
)
{
while
(
fMonitor
)
{
system_clock
::
time_point
start
(
system_clock
::
now
());
system_clock
::
time_point
start
(
system_clock
::
now
());
system_clock
::
time_point
next
(
start
+
interval
);
system_clock
::
time_point
next
(
start
+
interval
);
std
::
cout
<<
total
<<
"events monitor"
<<
std
::
endl
;
if
(
total
%
progress
==
0
)
{
std
::
cout
<<
"Received "
<<
total
<<
" events...
\r
"
<<
std
::
flush
;
}
total
+=
ReadOnce
(
ch
);
total
+=
ReadOnce
(
ch
);
if
(
gSignalStatus
==
SIGINT
)
break
;
std
::
this_thread
::
sleep_until
(
next
);
std
::
this_thread
::
sleep_until
(
next
);
}
}
std
::
cout
<<
"Received "
<<
total
<<
" events..."
<<
std
::
endl
;
signal
(
SIGINT
,
prev_handler
);
if
(
fDoBench
)
if
(
fDoBench
)
fBench
->
Begin
(
"Output"
);
fBench
->
Begin
(
"Output"
);
...
...
This diff is collapsed.
Click to expand it.
src/OnlineMonitor.h
+
3
−
1
View file @
4a11312f
...
@@ -17,7 +17,9 @@ namespace hcana {
...
@@ -17,7 +17,9 @@ namespace hcana {
OnlineMonitor
()
:
THcAnalyzer
()
{}
OnlineMonitor
()
:
THcAnalyzer
()
{}
virtual
~
OnlineMonitor
()
{}
virtual
~
OnlineMonitor
()
{}
virtual
Int_t
Monitor
(
PRadETChannel
*
ch
,
std
::
chrono
::
seconds
interval
=
std
::
chrono
::
seconds
(
10
));
virtual
Int_t
Monitor
(
PRadETChannel
*
ch
,
std
::
chrono
::
seconds
interval
=
std
::
chrono
::
seconds
(
10
),
int
progress
=
10
);
virtual
Int_t
ReadOnce
(
PRadETChannel
*
ch
,
size_t
max_events
=
10000
);
virtual
Int_t
ReadOnce
(
PRadETChannel
*
ch
,
size_t
max_events
=
10000
);
Int_t
ReadBuffer
(
uint32_t
*
buf
);
Int_t
ReadBuffer
(
uint32_t
*
buf
);
Int_t
ProcOneEvent
();
Int_t
ProcOneEvent
();
...
...
This diff is collapsed.
Click to expand it.
tools/monitor_hms.cpp
+
18
−
4
View file @
4a11312f
...
@@ -40,6 +40,8 @@ using namespace std;
...
@@ -40,6 +40,8 @@ using namespace std;
#include
"ConfigOption.h"
#include
"ConfigOption.h"
#include
"PRadETChannel.h"
#include
"PRadETChannel.h"
#define DBASE "/u/home/cpeng/ANL/hallc_replay"
int
monitor
(
PRadETChannel
*
ch
,
int
interval
,
const
bool
do_all
=
false
,
const
bool
do_coin
=
false
);
int
monitor
(
PRadETChannel
*
ch
,
int
interval
,
const
bool
do_all
=
false
,
const
bool
do_coin
=
false
);
...
@@ -124,18 +126,18 @@ int monitor(PRadETChannel *ch, int interval, const bool do_all, const bool do_co
...
@@ -124,18 +126,18 @@ int monitor(PRadETChannel *ch, int interval, const bool do_all, const bool do_co
// Load global parameters
// Load global parameters
gHcParms
->
Define
(
"gen_run_number"
,
"Run Number"
,
RunNumber
);
gHcParms
->
Define
(
"gen_run_number"
,
"Run Number"
,
RunNumber
);
gHcParms
->
AddString
(
"g_ctp_database_filename"
,
gHcParms
->
AddString
(
"g_ctp_database_filename"
,
do_coin
?
"DBASE/COIN/standard.database"
:
"DBASE/HMS/standard.database"
);
do_coin
?
DBASE
"DBASE/COIN/standard.database"
:
DBASE
"DBASE/HMS/standard.database"
);
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_database_filename"
),
RunNumber
);
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_database_filename"
),
RunNumber
);
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_parm_filename"
));
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_parm_filename"
));
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_kinematics_filename"
),
RunNumber
);
gHcParms
->
Load
(
gHcParms
->
GetString
(
"g_ctp_kinematics_filename"
),
RunNumber
);
// Load parameters for HMS trigger configuration
// Load parameters for HMS trigger configuration
gHcParms
->
Load
(
"PARAM/TRIG/thms.param"
);
gHcParms
->
Load
(
DBASE
"PARAM/TRIG/thms.param"
);
// Load fadc debug parameters
// Load fadc debug parameters
gHcParms
->
Load
(
"PARAM/HMS/GEN/p_fadc_debug.param"
);
gHcParms
->
Load
(
DBASE
"PARAM/HMS/GEN/p_fadc_debug.param"
);
// Load the Hall C detector map
// Load the Hall C detector map
gHcDetectorMap
=
new
THcDetectorMap
();
gHcDetectorMap
=
new
THcDetectorMap
();
gHcDetectorMap
->
Load
(
"MAPS/HMS/DETEC/STACK/hms_stack.map"
);
gHcDetectorMap
->
Load
(
DBASE
"MAPS/HMS/DETEC/STACK/hms_stack.map"
);
// ===========================================================================
// ===========================================================================
// Experimental apparatus
// Experimental apparatus
...
@@ -249,6 +251,18 @@ int monitor(PRadETChannel *ch, int interval, const bool do_all, const bool do_co
...
@@ -249,6 +251,18 @@ int monitor(PRadETChannel *ch, int interval, const bool do_all, const bool do_co
analyzer
->
SetCountMode
(
2
);
// 0 = counter is # of physics triggers
analyzer
->
SetCountMode
(
2
);
// 0 = counter is # of physics triggers
// 1 = counter is # of all decode reads
// 1 = counter is # of all decode reads
// 2 = counter is event number
// 2 = counter is event number
// Define the run(s) that we want to analyze.
// We just set up one, but this could be many.
THcRun
*
run
=
new
THcRun
;
// Set to read in Hall C run database parameters
run
->
SetRunParamClass
(
"THcRunParameters"
);
// Eventually need to learn to skip over, or properly analyze the pedestal events
run
->
SetEventRange
(
0
,
-
1
);
// Physics Event number, does not include scaler or control events.
run
->
SetNscan
(
1
);
run
->
SetDataRequired
(
0x7
);
run
->
Print
();
analyzer
->
SetEvent
(
event
);
analyzer
->
SetEvent
(
event
);
// Set EPICS event type
// Set EPICS event type
...
...
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