Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CEPCSW_OTE_development
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
yudian2002@sjtu.edu.cn
CEPCSW_OTE_development
Commits
fcd6ddd1
Commit
fcd6ddd1
authored
5 years ago
by
zoujh@ihep.ac.cn
Browse files
Options
Downloads
Patches
Plain Diff
add writing test
parent
d348512f
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
Event/CMakeLists.txt
+16
-7
16 additions, 7 deletions
Event/CMakeLists.txt
Event/tests/write.cpp
+41
-0
41 additions, 0 deletions
Event/tests/write.cpp
with
57 additions
and
7 deletions
Event/CMakeLists.txt
+
16
−
7
View file @
fcd6ddd1
...
...
@@ -30,13 +30,15 @@ file(GLOB headers Event/*.h)
include_directories
(
Event
)
# Dictionary and Modules
add_library
(
Event SHARED
${
sources
}
${
headers
}
)
target_link_libraries
(
Event podio
)
install
(
TARGETS Event DESTINATION lib
)
REFLEX_GENERATE_DICTIONARY
(
Event
${
headers
}
SELECTION src/selection.xml
)
add_library
(
EventDict SHARED Event.cxx
)
add_dependencies
(
EventDict Event-dictgen
)
target_link_libraries
(
EventDict Event ROOT::Core
)
add_library
(
Event SHARED
${
sources
}
${
headers
}
)
target_link_libraries
(
Event podio ROOT::RIO ROOT::Tree
)
target_link_libraries
(
EventDict Event
)
install
(
TARGETS EventDict DESTINATION lib
)
# Headers and Libraries
gaudi_install_headers
(
Event
)
...
...
@@ -44,6 +46,13 @@ gaudi_install_headers(Event)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/EventDict.rootmap DESTINATION lib
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/Event_rdict.pcm DESTINATION lib
)
# Unit tests
#gaudi_add_test(HelloAlg
# FRAMEWORK options/helloalg.py)
# tests
add_executable
(
write tests/write.cpp
)
target_link_libraries
(
write EventDict
)
install
(
TARGETS write DESTINATION tests
)
add_test
(
NAME write COMMAND write
)
set_property
(
TEST write PROPERTY ENVIRONMENT LD_LIBRARY_PATH=
${
CMAKE_INSTALL_PREFIX
}
/lib:$ENV{LD_LIBRARY_PATH}
)
#add_test(NAME read COMMAND read)
#set_property(TEST read PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:$ENV{LD_LIBRARY_PATH})
#set_property(TEST read PROPERTY DEPENDS write)
This diff is collapsed.
Click to expand it.
Event/tests/write.cpp
0 → 100644
+
41
−
0
View file @
fcd6ddd1
#include
"EventHeaderCollection.h"
#include
"MCParticleCollection.h"
#include
"podio/EventStore.h"
#include
"podio/ROOTWriter.h"
#include
<vector>
#include
<iostream>
int
main
(
int
argc
,
char
*
argv
[])
{
std
::
cout
<<
"start writing test"
<<
std
::
endl
;
auto
store
=
podio
::
EventStore
();
auto
writer
=
podio
::
ROOTWriter
(
"test.root"
,
&
store
);
auto
&
ehc
=
store
.
create
<
plcio
::
EventHeaderCollection
>
(
"EvtHeaders"
);
auto
&
mcc
=
store
.
create
<
plcio
::
MCParticleCollection
>
(
"MCParticles"
);
writer
.
registerForWrite
(
"EvtHeaders"
);
writer
.
registerForWrite
(
"MCParticles"
);
const
unsigned
int
nEvt
=
100
;
for
(
unsigned
int
i
=
0
;
i
<
nEvt
;
++
i
)
{
if
(
i
%
10
==
0
)
{
std
::
cout
<<
"processing event "
<<
i
<<
std
::
endl
;
}
auto
header
=
plcio
::
EventHeader
(
i
,
-
99
,
9999
,
"SimDet"
);
ehc
.
push_back
(
header
);
//////////
writer
.
writeEvent
();
store
.
clearCollections
();
}
writer
.
finish
();
return
0
;
}
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