Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into OSCAR
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Verbytskyi committed Jan 17, 2024
2 parents ea8f1a1 + 45c45c5 commit 093259a
Show file tree
Hide file tree
Showing 28 changed files with 257 additions and 245 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ if (HEPMC3_INSTALL_EXAMPLES)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/examples/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples COMPONENT doc
FILES_MATCHING PATTERN "*"
PATTERN "*CMakeFiles*" EXCLUDE
PATTERN "*myclass_Classes.cxx" EXCLUDE
PATTERN "*pcm" EXCLUDE
PATTERN "*rootmap" EXCLUDE
PATTERN "*Dict.cxx" EXCLUDE
PATTERN "Makefile" EXCLUDE
PATTERN "*cmake_install.cmake*" EXCLUDE
PATTERN "*libAnalysis*" EXCLUDE )
Expand Down
51 changes: 0 additions & 51 deletions doc/doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -974,12 +974,6 @@ HTML_COLORSTYLE_SAT = 100

HTML_COLORSTYLE_GAMMA = 80

# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting
# this to NO can help when comparing the output of multiple runs.

HTML_TIMESTAMP = YES

# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
Expand Down Expand Up @@ -1194,14 +1188,6 @@ EXT_LINKS_IN_WINDOW = NO

FORMULA_FONTSIZE = 10

# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are
# not supported properly for IE 6.0, but are supported on all modern browsers.
# Note that when changing this option you need to delete any form_*.png files
# in the HTML output before the changes have effect.

FORMULA_TRANSPARENT = YES

# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
# (see http://www.mathjax.org) which uses client side Javascript for the
# rendering instead of using prerendered bitmaps. Use this if you do not
Expand Down Expand Up @@ -1381,13 +1367,6 @@ LATEX_BATCHMODE = NO

LATEX_HIDE_INDICES = NO

# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.

LATEX_SOURCE_CODE = NO

# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
# http://en.wikipedia.org/wiki/BibTeX for more info.
Expand Down Expand Up @@ -1657,14 +1636,6 @@ EXTERNAL_GROUPS = YES
# Configuration options related to the dot tool
#---------------------------------------------------------------------------

# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
# or super classes. Setting the tag to NO turns the diagrams off. Note that
# this option also works with HAVE_DOT disabled, but it is recommended to
# install and use dot, since it yields more powerful graphs.

CLASS_DIAGRAMS = YES

# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
Expand Down Expand Up @@ -1695,20 +1666,6 @@ HAVE_DOT = YES

DOT_NUM_THREADS = 0

# By default doxygen will use the Helvetica font for all dot files that
# doxygen generates. When you want a differently looking font you can specify
# the font name using DOT_FONTNAME. You need to make sure dot is able to find
# the font, which can be done by putting it in a standard location or by setting
# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
# directory containing the font.

DOT_FONTNAME = Helvetica

# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.

DOT_FONTSIZE = 10

# By default doxygen will tell dot to use the Helvetica font.
# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
# set the path where dot can find it.
Expand Down Expand Up @@ -1850,14 +1807,6 @@ DOT_GRAPH_MAX_NODES = 150

MAX_DOT_GRAPH_DEPTH = 0

# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not
# seem to support this out of the box. Warning: Depending on the platform used,
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).

DOT_TRANSPARENT = NO

# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10)
Expand Down
2 changes: 1 addition & 1 deletion doc/doxygen/differences.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
// Replace with:
HepMC3::FourVector position(pos[1],pos[2],pos[3],pos[0]);
HepMC3::GenVertexPtr vertex = std::make_shared<HepMC3::GenVertex>(position);
vertex->set_id(1);
vertex->set_status(1);
@endcode

@code{.cpp}
Expand Down
1 change: 0 additions & 1 deletion examples/ConvertExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ configure_file(
if (USE_INSTALLED_HEPMC3)
install(TARGETS convert_example.exe DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS Analysis DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_BINDIR} FILES_MATCHING PATTERN "*.pcm" PATTERN "*config" PATTERN "CMakeFiles" PATTERN "*.ilk" EXCLUDE)
install(DIRECTORY ${PROJECT_BINARY_DIR}/outputs/${CMAKE_INSTALL_BINDIR}/ DESTINATION ${CMAKE_INSTALL_BINDIR} FILES_MATCHING PATTERN "*env.sh*" )
endif()

Expand Down
3 changes: 1 addition & 2 deletions examples/RootIOExample2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/class_example_env.sh.in
# installs
if (USE_INSTALLED_HEPMC3)
install(TARGETS class_example_write.exe class_example_read.exe DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_BINDIR} FILES_MATCHING PATTERN "*.pcm" PATTERN "*config" PATTERN "CMakeFiles" EXCLUDE )
install(FILES example.hepmc3 DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/example.hepmc3 ${CMAKE_CURRENT_BINARY_DIR}/libmyclass_Classes_rdict.pcm ${CMAKE_CURRENT_BINARY_DIR}/libmyclass_Classes.rootmap DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/outputs/${CMAKE_INSTALL_BINDIR}/ DESTINATION ${CMAKE_INSTALL_BINDIR}
FILES_MATCHING PATTERN "*env.sh*")
endif()
14 changes: 4 additions & 10 deletions examples/ViewerExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,16 @@ endforeach()
find_package(Graphviz)
find_package(ROOT REQUIRED COMPONENTS Core RIO Tree Gui Graf Hist Gpad )
if(Graphviz_FOUND AND ROOT_FOUND)
message(STATUS "HepMC3 ViewerExample: GrpahViz and ROOT found. GUI Browser example enabled. ${ROOT_LIBRARIES} ${Graphviz_GRAPH_LIBRARY} ${Graphviz_CGRAPH_LIBRARY} ${Graphviz_GVC_LIBRARY} ${Graphviz_INCLUDE_DIRS}")
include_directories(${PROJECT_SOURCE_DIR}/rootIO/include ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} ${ROOT_INCLUDE_DIRS} ${Graphviz_INCLUDE_DIRS} ./)
message(STATUS "HepMC3 ViewerExample: GraphViz and ROOT found. GUI Browser example enabled. ${ROOT_LIBRARIES} ${Graphviz_GRAPH_LIBRARY} ${Graphviz_CGRAPH_LIBRARY} ${Graphviz_GVC_LIBRARY} ${Graphviz_INCLUDE_DIRS}")
include_directories(${PROJECT_SOURCE_DIR}/rootIO/include ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} ./)
ROOT_GENERATE_DICTIONARY(HepMC3ViewerFrameDict include/HepMC3ViewerFrame.h LINKDEF include/LinkDef.h OPTIONS -inlineInputHeader)
ADD_EXECUTABLE(HepMC3Viewer.exe src/main.cc src/HepMC3ViewerFrame.cc HepMC3ViewerFrameDict.cxx )
set_target_properties(HepMC3Viewer.exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/outputs/${CMAKE_INSTALL_BINDIR})
target_compile_definitions(HepMC3Viewer.exe PRIVATE ${Graphviz_DEFINES} )
include_directories( include )

SET(linklibraties ${Graphviz_CGRAPH_LIBRARY} ${Graphviz_GVC_LIBRARY} HepMC3::HepMC3 HepMC3::rootIO )
if (Graphviz_GRAPH_LIBRARY)
list(APPEND linklibraties ${Graphviz_GRAPH_LIBRARY} )
endif()
TARGET_LINK_LIBRARIES(HepMC3Viewer.exe ${linklibraties} ROOT::Core ROOT::RIO ROOT::Tree ROOT::Gui ROOT::Graf ROOT::Hist ROOT::Gpad)
TARGET_LINK_LIBRARIES(HepMC3Viewer.exe Graphviz::CGRAPH Graphviz::GVC HepMC3::HepMC3 HepMC3::rootIO ROOT::Core ROOT::RIO ROOT::Tree ROOT::Gui ROOT::Graf ROOT::Hist ROOT::Gpad)
if (USE_INSTALLED_HEPMC3)
install(TARGETS HepMC3Viewer.exe DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_BINDIR} FILES_MATCHING PATTERN "*.pcm" PATTERN "*config" PATTERN "CMakeFiles" EXCLUDE )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libHepMC3ViewerFrameDict_rdict.pcm ${CMAKE_CURRENT_BINARY_DIR}/libHepMC3ViewerFrameDict.rootmap DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY ${PROJECT_BINARY_DIR}/outputs/${CMAKE_INSTALL_BINDIR}/ DESTINATION ${CMAKE_INSTALL_BINDIR}
FILES_MATCHING PATTERN "*env.sh*")
endif()
Expand Down
35 changes: 28 additions & 7 deletions examples/ViewerExample/cmake/Modules/FindGraphviz.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
# Graphviz_INCLUDE_DIRS (not cached)
# Graphviz_CGRAPH_LIBRARY
# Graphviz_GVC_LIBRARY
if (Graphviz_DIR OR Graphviz_DIR OR (DEFINED ENV{Graphviz_DIR}) OR (DEFINED ENV{Graphviz_DIR}) )
if (Graphviz_DIR OR GRAPHVIZ_DIR OR (DEFINED ENV{Graphviz_DIR}) OR (DEFINED ENV{GRAPHVIZ_DIR}) )
set(Graphviz_SEARCH_DIRS "" CACHE STRING "" FORCE)
if (Graphviz_DIR)
list (APPEND Graphviz_SEARCH_DIRS "${Graphviz_DIR}" )
endif()
if (Graphviz_DIR)
list (APPEND Graphviz_SEARCH_DIRS "${Graphviz_DIR}" )
if (GRAPHVIZ_DIR)
list (APPEND Graphviz_SEARCH_DIRS "${GRAPHVIZ_DIR}" )
endif()
if (DEFINED ENV{Graphviz_DIR})
list (APPEND Graphviz_SEARCH_DIRS "$ENV{Graphviz_DIR}" )
endif()
if (DEFINED ENV{Graphviz_DIR})
list (APPEND Graphviz_SEARCH_DIRS "ENV{Graphviz_DIR}" )
if (DEFINED ENV{GRAPHVIZ_DIR})
list (APPEND Graphviz_SEARCH_DIRS "ENV{GRAPHVIZ_DIR}" )
endif()
endif()

Expand All @@ -36,16 +36,37 @@ endif()
set(Graphviz_INCLUDE_DIRS ${Graphviz_INCLUDE_DIR} ${Graphviz_INCLUDE_DIR}/graphviz)
get_filename_component(Graphviz_LIBRARY_DIR ${Graphviz_GVC_LIBRARY} PATH)
set ( TEST_SOURCE "#include <graphviz/gvc.h>\n#include <string>\n #include <graphviz/cdt.h>\n int main(){\nreturn strcmp(\"XX\",\"XXY\");\n}\n")
if (Graphviz_INCLUDE_DIR)
set(CMAKE_REQUIRED_INCLUDES ${Graphviz_INCLUDE_DIRS})
endif()
check_cxx_source_compiles("${TEST_SOURCE}" TEST_SOURCE_NOAST_COMPILES )
check_cxx_source_compiles("#define _PACKAGE_ast 1\n${TEST_SOURCE}" TEST_SOURCE_AST_COMPILES )
if (TEST_SOURCE_AST_COMPILES AND (NOT TEST_SOURCE_NOAST_COMPILES))
set(Graphviz_DEFINES "-D_PACKAGE_ast=1")
set(Graphviz_DEFINES "_PACKAGE_ast=1")
else()
set(Graphviz_DEFINES "-D_UNUSED_DUMMY_DEFINE")
set(Graphviz_DEFINES "_UNUSED_DUMMY_DEFINE")
endif()

INCLUDE(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(Graphviz FOUND_VAR Graphviz_FOUND REQUIRED_VARS Graphviz_DEFINES Graphviz_INCLUDE_DIR Graphviz_CGRAPH_LIBRARY Graphviz_GVC_LIBRARY HANDLE_COMPONENTS)


if(Graphviz_FOUND AND NOT TARGET Graphviz::CGRAPH)
add_library(Graphviz::CGRAPH UNKNOWN IMPORTED)
set_target_properties(Graphviz::CGRAPH PROPERTIES
IMPORTED_LOCATION "${Graphviz_CGRAPH_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Graphviz_INCLUDE_DIRS}"
INTERFACE_COMPILE_DEFINITIONS "${Graphviz_DEFINES}"
)
endif()
if(Graphviz_FOUND AND NOT TARGET Graphviz::GVC)
add_library(Graphviz::GVC UNKNOWN IMPORTED)
set_target_properties(Graphviz::GVC PROPERTIES
IMPORTED_LOCATION "${Graphviz_GVC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Graphviz_INCLUDE_DIRS}"
INTERFACE_COMPILE_DEFINITIONS "${Graphviz_DEFINES}"
)
endif()

mark_as_advanced(Graphviz_FOUND Graphviz_INCLUDE_DIRS Graphviz_CGRAPH_LIBRARY Graphviz_GVC_LIBRARY Graphviz_DEFINES)
10 changes: 8 additions & 2 deletions include/HepMC3/GenCrossSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ class GenCrossSection : public Attribute {
bool to_string(std::string &att) const override;
/// @name Deprecated functionality
/// @{
/// @brief Set all fields
/// @deprecated Use set_cross_section(const std::vector<double>& xs, const std::vector<double>& xs_err instead
/** @brief Set all fields
@deprecated Use set_cross_section(const std::vector<double>& xs, const std::vector<double>& xs_err instead
@param xs Cross section
@param xs_err Uncertainty on cross-section
@param n_acc Number of accepted events
@param n_att Number of attempted events
*/
void set_cross_section(const double& xs, const double& xs_err,const long& n_acc = -1, const long& n_att = -1);

/// @}
Expand Down
9 changes: 5 additions & 4 deletions include/HepMC3/GenEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@ class GenEvent {

/// @name Particle and vertex access
/// @{
/// Particles size, HepMC2 compatibility

/// @brief Particles size, HepMC2 compatibility
inline int particles_size() const { return m_particles.size(); }
/// Particles empty, HepMC2 compatibility
/// @brief Particles empty, HepMC2 compatibility
inline bool particles_empty() const { return m_particles.empty(); }
/// Vertices size, HepMC2 compatibility
/// @brief Vertices size, HepMC2 compatibility
inline int vertices_size() const { return m_vertices.size(); }
/// Vertices empty, HepMC2 compatibility
/// @brief Vertices empty, HepMC2 compatibility
inline bool vertices_empty() const { return m_vertices.empty(); }
/// @}

Expand Down
4 changes: 0 additions & 4 deletions include/HepMC3/GenVertex.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class GenVertex : public std::enable_shared_from_this<GenVertex> {

/// @}

public:

/// @name Accessors
/// @{
Expand All @@ -57,9 +56,6 @@ class GenVertex : public std::enable_shared_from_this<GenVertex> {
/// @note This is not the same as id() in HepMC v2, which is now @c status()
int id() const { return m_id; }

/// @brief set the vertex identifier
void set_id(int id);

/// Get vertex status code
int status() const { return m_data.status; }
/// Set vertex status code
Expand Down
47 changes: 21 additions & 26 deletions include/HepMC3/ReaderAscii.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
#include <fstream>
#include <istream>
#include <iterator>
#include <unordered_map>
#include "HepMC3/Reader.h"
#include "HepMC3/GenEvent.h"
#include "HepMC3/Data/GenEventData.h"


namespace HepMC3 {
Expand Down Expand Up @@ -67,69 +69,61 @@ class ReaderAscii : public Reader {
/// @brief Parse event
///
/// Helper routine for parsing event information
/// @param[out] evt Event that will be filled with new data
/// @param[in] buf Line of text that needs to be parsed
/// @return vertices count and particles count for verification
std::pair<int,int> parse_event_information(GenEvent &evt, const char *buf);
std::pair<int,int> parse_event_information(const char *buf);

/// @brief Parse weight value lines
///
/// Helper routine for parsing weight value information
/// @param[out] evt Event whose GenWeights will be filled with weight values
/// @param[in] buf Line of text that needs to be parsed
///
bool parse_weight_values(GenEvent &evt, const char *buf);
bool parse_weight_values(const char *buf);

/// @brief Parse units
///
/// Helper routine for parsing units information
/// @param[out] evt Event that will be filled with unit information
/// @param[in] buf Line of text that needs to be parsed
///
bool parse_units(GenEvent &evt, const char *buf);
bool parse_units(const char *buf);

/// @brief Parse struct GenPdfInfo information
///
/// Helper routine for parsing PDF information
/// @param[out] evt Event that will be filled with unit information
/// @param[in] buf Line of text that needs to be parsed
bool parse_pdf_info(GenEvent &evt, const char *buf);
bool parse_pdf_info(const char *buf);

/// @brief Parse struct GenHeavyIon information
///
/// Helper routine for parsing heavy ion information
/// @param[out] evt Event that will be filled with unit information
/// @param[in] buf Line of text that needs to be parsed
bool parse_heavy_ion(GenEvent &evt, const char *buf);
bool parse_heavy_ion(const char *buf);

/// @brief Parse struct GenCrossSection information
///
/// Helper routine for parsing cross-section information
/// @param[out] evt Event that will be filled with unit information
/// @param[in] buf Line of text that needs to be parsed
bool parse_cross_section(GenEvent &evt, const char *buf);
bool parse_cross_section( const char *buf);

/// @brief Parse vertex
///
/// Helper routine for parsing single event information
/// @param[out] evt Event that will contain parsed vertex
/// @param[in] buf Line of text that needs to be parsed
///
bool parse_vertex_information(GenEvent &evt, const char *buf);
bool parse_vertex_information(const char *buf);

/// @brief Parse particle
///
/// Helper routine for parsing single particle information
/// @param[out] evt Event that will contain parsed particle
/// @param[in] buf Line of text that needs to be parsed
bool parse_particle_information(GenEvent &evt, const char *buf);
bool parse_particle_information(const char *buf);

/// @brief Parse attribute
///
/// Helper routine for parsing single attribute information
/// @param[out] evt Event that will contain parsed attribute
/// @param[in] buf Line of text that needs to be parsed
bool parse_attribute(GenEvent &evt, const char *buf);
bool parse_attribute( const char *buf);

/// @brief Parse run-level attribute.
///
Expand Down Expand Up @@ -160,15 +154,16 @@ class ReaderAscii : public Reader {
std::istream* m_stream; ///< For ctor when reading from stream
bool m_isstream; ///< toggles usage of m_file or m_stream


/** @brief Store attributes global to the run being written/read. */
std::map< std::string, std::shared_ptr<Attribute> > m_global_attributes;

/** @brief Temp storage for outgoing particle ids */
std::map<GenVertexPtr, std::set<int> > m_forward_mothers;
/** @brief Temp storage for prod vertex ids */
std::map<GenParticlePtr, int > m_forward_daughters;

/** @brief Temp storage for sets of incoming/outgoing ids for explicit vertices.*/
std::map<int, std::pair< std::set<int>, std::set<int> > > m_io_explicit;
/** @brief Temp storage for sets of incoming/outgoing ids for implicit vertices.*/
std::unordered_map<int, std::pair< std::set<int>, std::set<int> > > m_io_implicit;
/** @brief Temp storage to keep the order of implicit vertices.*/
std::vector<int> m_io_implicit_ids;
/** @brief Temp storage to keep the order of explicit vertices.*/
std::set<int> m_io_explicit_ids;

GenEventData m_data;
};


Expand Down
Loading

0 comments on commit 093259a

Please sign in to comment.