Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
1
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
dfb590c3
Commit
dfb590c3
authored
5 years ago
by
Chao1009
Browse files
Options
Downloads
Patches
Plain Diff
Update et_feeder, it now reads a datafile and write the events to the ET system
parent
8e9a4f85
No related branches found
No related tags found
No related merge requests found
Pipeline
#1996
passed with stages
in 5 minutes and 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+3
-0
3 additions, 0 deletions
CMakeLists.txt
tools/CMakeLists.txt
+2
-0
2 additions, 0 deletions
tools/CMakeLists.txt
tools/et_feeder.cpp
+31
-11
31 additions, 11 deletions
tools/et_feeder.cpp
with
36 additions
and
11 deletions
CMakeLists.txt
+
3
−
0
View file @
dfb590c3
...
...
@@ -27,6 +27,9 @@ endif()
find_package
(
coda_et REQUIRED
)
get_target_property
(
CODA_ET_INCLUDE_DIR coda_et::coda_et INTERFACE_INCLUDE_DIRECTORIES
)
find_package
(
EVIO REQUIRED
)
get_target_property
(
EVIO_INCLUDE_DIR EVIO::EVIO INTERFACE_INCLUDE_DIRECTORIES
)
#----------------------------------------------------------------------------
# Set up Podd and ROOT dependencies
if
(
HCANA_BUILTIN_PODD
)
...
...
This diff is collapsed.
Click to expand it.
tools/CMakeLists.txt
+
2
−
0
View file @
dfb590c3
...
...
@@ -16,6 +16,7 @@ foreach(exe_src ${APP_SOURCES})
$<INSTALL_INTERFACE:
${
SPDLOG_INCLUDE_DIR
}
>
$<BUILD_INTERFACE:
${
FMT_INCLUDE_DIR
}
>
$<BUILD_INTERFACE:
${
CODA_ET_INCLUDE_DIR
}
>
$<BUILD_INTERFACE:
${
EVIO_INCLUDE_DIR
}
>
)
target_link_libraries
(
${
exe
}
...
...
@@ -24,6 +25,7 @@ foreach(exe_src ${APP_SOURCES})
Podd::Podd
Podd::Decode
coda_et::coda_et
EVIO::evioxx
)
install
(
TARGETS
${
exe
}
DESTINATION
${
CMAKE_INSTALL_BINDIR
}
)
endforeach
(
exe_src
${
APP_SOURCES
}
)
...
...
This diff is collapsed.
Click to expand it.
tools/et_feeder.cpp
+
31
−
11
View file @
dfb590c3
#include
"ConfigOption.h"
#include
"PRadETChannel.h"
#include
"et.h"
#include
"evio.h"
#include
"evio/evioUtil.hxx"
#include
"evio/evioFileChannel.hxx"
#include
<csignal>
#include
<thread>
#include
<chrono>
#include
<iostream>
#define PROGRESS_COUNT 100
using
namespace
std
::
chrono
;
...
...
@@ -19,7 +21,7 @@ void signal_handler(int signal) {
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
try
{
// setup input arguments
ConfigOption
conf_opt
;
...
...
@@ -65,19 +67,20 @@ int main(int argc, char* argv[])
}
}
// attach to ET system
auto
ch
=
new
PRadETChannel
();
try
{
ch
->
Open
(
host
.
c_str
(),
port
,
etf
.
c_str
());
ch
->
NewStation
(
"Data Feeder"
);
ch
->
AttachStation
();
}
catch
(
PRadException
e
)
{
std
::
cerr
<<
e
.
FailureType
()
<<
": "
<<
e
.
FailureDesc
()
<<
std
::
endl
;
return
-
1
;
}
ch
->
Open
(
host
.
c_str
(),
port
,
etf
.
c_str
());
ch
->
NewStation
(
"Data Feeder"
);
ch
->
AttachStation
();
// evio file reader
evio
::
evioFileChannel
*
chan
=
new
evio
::
evioFileChannel
(
conf_opt
.
GetArgument
(
0
).
c_str
(),
"r"
);
chan
->
open
();
// install signal handler
std
::
signal
(
SIGINT
,
signal_handler
);
while
(
true
)
{
int
count
=
0
;
while
(
chan
->
read
())
{
if
(
gSignalStatus
==
SIGINT
)
{
std
::
cout
<<
"Received control-C, exiting..."
<<
std
::
endl
;
ch
->
ForceClose
();
...
...
@@ -86,9 +89,26 @@ int main(int argc, char* argv[])
system_clock
::
time_point
start
(
system_clock
::
now
());
system_clock
::
time_point
next
(
start
+
std
::
chrono
::
milliseconds
(
interval
));
if
(
++
count
%
PROGRESS_COUNT
==
0
)
{
std
::
cout
<<
"Read and feed "
<<
count
<<
" events to ET, rate is 1 event per "
<<
interval
<<
" ms.
\r
"
<<
std
::
flush
;
}
ch
->
Write
((
void
*
)
chan
->
getBuffer
(),
chan
->
getBufSize
()
*
sizeof
(
uint32_t
));
std
::
this_thread
::
sleep_until
(
next
);
}
std
::
cout
<<
"Read and feed "
<<
count
<<
" events to ET, rate is 1 event per "
<<
interval
<<
" ms."
<<
std
::
endl
;
chan
->
close
();
return
0
;
}
catch
(
PRadException
e
)
{
std
::
cerr
<<
e
.
FailureType
()
<<
": "
<<
e
.
FailureDesc
()
<<
std
::
endl
;
return
-
1
;
}
catch
(
evio
::
evioException
e
)
{
std
::
cerr
<<
e
.
toString
()
<<
endl
;
}
catch
(...)
{
std
::
cerr
<<
"?unknown exception"
<<
endl
;
}
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