Skip to content

Commit

Permalink
Add dumpmctree tool (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudarboh committed May 8, 2024
1 parent 416d7b6 commit e8c5032
Show file tree
Hide file tree
Showing 3 changed files with 846 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ ADD_LCIO_EXAMPLE( simjob )
ADD_LCIO_EXAMPLE( anajob )
ADD_LCIO_EXAMPLE( recjob )
ADD_LCIO_EXAMPLE( dumpevent )
ADD_LCIO_EXAMPLE( dumpmctree-dot )
ADD_LCIO_EXAMPLE( copyfix )
ADD_LCIO_EXAMPLE( stdhepjob )
ADD_LCIO_EXAMPLE( stdhepjob_new )
Expand All @@ -466,6 +467,8 @@ ADD_LCIO_EXAMPLE( lcio_performance )
ADD_LCIO_EXAMPLE( lcio_parallel_read )
ADD_LCIO_EXAMPLE( lcio_parallel_processing )

INSTALL(PROGRAMS ${CMAKE_CURRENT_LIST_DIR}/src/EXAMPLE/dumpmctree DESTINATION ${CMAKE_INSTALL_BINDIR})

IF( BUILD_ROOTDICT )
ADD_LCIO_EXAMPLE( lcio_io_benchmark )
TARGET_LINK_LIBRARIES( bin_lcio_io_benchmark PRIVATE ${ROOT_LIBRARIES} )
Expand Down
31 changes: 31 additions & 0 deletions src/cpp/src/EXAMPLE/dumpmctree
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

if ! dumpmctree-dot -h > /dev/null 2>&1; then
echo "dumpmctree-dot executable not found. Make sure it's on PATH"
exit 1
fi

# Store the full argument list to pass it on after we have sorted out the help
ARGS=("$@")

while [ $# != 0 ]; do
case "$1" in
-h|--help)
dumpmctree-dot -h
exit 0
;;
*)
shift
;;
esac
done

if dumpmctree-dot "${ARGS[@]}"; then
if [ -f dumpmctree.svg ]; then
mv -f dumpmctree.svg dumpmctree.svg.bkp
fi
dot -Tsvg dumpmctree_tmp.dot > dumpmctree.svg
xdg-open dumpmctree.svg
else
exit 1
fi

0 comments on commit e8c5032

Please sign in to comment.