Commit 20643c72 authored by Andrii Verbytskyi's avatar Andrii Verbytskyi

Initial commit

parent 65c724f1
Andy Buckley
David Grellscheid
Dmitri Konstantinov
Leif Lonnblad
James Monk
Tomasz Przedzinski
Witold Pokorski
Andrii Verbytskyi
Lynn Garren
Andy Buckley
Matt Dobbs
Jorgen Beck Hansen
This diff is collapsed.
This diff is collapsed.
-------------------------- HepMC3.1.0 --------------------------
2019-02-08 Andrii Verbytskyi for HepMC
* Multiple changes for3.1 release
* Renaming the namespace, header directory and library name to HepMC3
* SmartPointer is repaced with shared_ptr from C++11, so C++11 is always required now
* Split library into HepMC3(core) and HepMC3search (search engine)
* New Search engine with highly abstract search capabilities
* New readers and writers: WriterAsciiHepMC2, ReaderLHEF
* Ascii files now have own string in header: Asciiv3
* Deduction of input file format in ReaderFactory
* Improved consistency of interface
* Removal of most deprecated functions and multiple bugfixes
* Implemented test suite
* Improved examples and documentation
-------------------------- HepMC3.0.0 --------------------------
2017-03-20 Witek Pokorski
* tagging HepMC3.0.0
2017-01-31 Andy Buckley <>
* Add a GenVertex::particles(range) method (as in HepMC 2.07).
2017-01-30 Andy Buckley <>
* Add ancestors() and descendants() methods to GenParticle, and make parents() and children() accessors const.
* Add stream constructors to IO_GenEvent wrapper, and an ostream implementation to WriterAscii.
2017-01-27 Andy Buckley <>
* Add unbound accessor functions in FindParticles.
* Add unisex 'children' and 'parents' accessors in FindParticles.
* Make FindParticles available from HepMC.h convenience header.
2016-07-05 Dmitri Konstantinov
* making installation of interfaces optional
2016-06-30 Witek Pokorski
* changing ROOTIO_LIB define to HEPMC_ROOTIO_LIB
2016-06-10 Witek Pokorski
* removing warnings, adding README, updating documentation
2016-04-29 Andrii Verbyskyi
* fixing Fortran flags
2016-04-27 Witek Pokorski
* moving GenEvent and GenRunInfo root streamers to a separate file
-------------------------- HepMC3-beta2.0 --------------------------
2016-01-18 Andrii Verbytskyi
*Builds of Debian packages
2016-01-12 Andrii Verbytskyi
*Update of cmake files to allow proper RedHatx86_64 directory structure
*Add section to build rpms and debs with cpack
*ROOT IO is enabled if ROOTConfig.cmake or FindROOT.cmake set ROOT_FOUND
2016-01-06 Andrii Verbytskyi
* Compilation with gcc 4.4
2016-01-06 Dmitri Konstantinov
* Missing cross-section parsing added to HepMC2 reader
2015-12-07 Witek Pokorski
* adding tree-based version of ROOT reader/writer
2015-05-24 Tomasz Przedzinski <>
* Few missing I/O features added
* Documentation updated. Added previously missing 'examples' section
2015-05-08 Andy Buckley <>
* Make sure that all macros in Config.h have a numerical value
(thanks to Marek Schoenherr for the heads-up).
2015-04-21 Witek Pokorski
* ROOT reader and writer inherit now from Reader and Writer base classes
2015-04-03 Witek Pokorski
* optimisations in read_data method
2015-03-27 Andy Buckley <>
* Reduce/add HepMCDefs.h and SimpleVector.h to stubs for backward
compatibility, which include the modern equivalent headers and
produce preprocessor warnings. These should be conditionally
installed only when building in compatibility mode.
* Adding, removing, and tweaking feature detection macros.
* Adding backward compatibility typedefs to CrossSection,
HeavyIon, PdfInfo (i.e. without the Gen prefixes)
2015-03-26 Andy Buckley <>
* Overhaul of FourVector class and removal of FourVector.icc
* Differentiate between SmartPointer const and non-const
dereferencing and arrow operators, to pass on the constness
semantics to the contained type. This blocks accidents like
calling non-const modifying functions on a const GenVertexPtr or
const GenParticlePtr, which is not protected against by
e.g. shared_ptr<GenParticle>. Plus adding an operator for bool
comparisons to SmartPointer and (many) updates through the main
object classes to respect the newly invigorated constness
rules. Good!
* Changing GenEvent::event_pos() to return a FourVector ref rather
than the root vertex itself, and changing
GenEvent::offset_event(v) to two explicitly named
shift_event_by(v) and shift_event_to(v) methods.
2015-03-23 Tomasz Przedzinski <>
* ReaderAscii and WriterAscii finished. IO_GenEvent is now only
backward-compatibility header file
* IO_Root divided into WriterRoot and ReaderRoot
* Other I/O cleanup. include/HepMC/IO and src/IO removed
IO_FileBase and IO_Base removed. Examples updated.
2015-03-09 Witek Pokorski
* implemented ROOT I/O custom streamer for GenEvent
2015-02-19 Leif Lonnblad
* implemented the LHEF attributes classes
2015-02-15 Andy Buckley <>
* Adding new Reader and Writer I/O base classes and first draft ASCII I/o interfaces (to be finished).
* Adding new GenWeights container (from HepMC2 update, to be cleaned).
2014-12-12 Witold Pokorski
* Updating example event file
* Fixes for ROOT6 dictionary
2014-07-25 Tomasz Przedzinski <>
* Added beam particles
* Added backward-compatibility iterators
* Added Attributes mechanism. Currently used only for event and
keys (strings) are stored in GenEvent (which will change)
* Updated ASCII file I/O to work with Attributes. ROOT I/O will follow
* Modified GenPdfInfo, GenHeavyIon and GenCrossSection to work as
2014-11-25 Andy Buckley <>
* Add HEPMC_DEPRECATED macro in Setup.h
2014-11-25 Witold Pokorski
* Adding first version of CMake for validation
2014-11-18 Witold Pokorski
* fix in cmake for rootIO library to work with ROOT6
* made DHEPMC_ENABLE_CPP11 option ON by default
2014-11-07 Witold Pokorski
* fixes in cmake to export also rootIO library, removed obsolete forcing of .so on Mac
2014-11-05 Witold Pokorski
* redesign of ROOT I/O, moved to a separate library
* added .exe in examples executables names
* improvement in Pythia8 example; possibility of setting number of events and passing conf and output file names as arguments
2014-10-22 Tomasz Przedzinski & Witold Pokorski
* Added ROOT I/O
* Added ROOT I/O examples
* CMake updated for use with ROOT
* Added check for C++11 to CMake. Now #ifndef BUILD_WITH_11 can be used in code
* GenPdfInfo, GenHeavyIon, GenCrossSection are now stored by shared_ptr not raw pointer
* GenPdfInfo, GenHeavyIon, GenCrossSection added to ROOT I/O and IO_GenEvent
Now they're properly written and read from/to text files and root files
2014-09-19 Tomasz Przedzinski <>
* Changed naming convention from HepMC3 to HepMC (namespaces, comments, defines, etc.)
* Changed PdfInfo to GenPdfInfo and changed names of the fields
* Changed HeavyIon to GenHeavyIon
* Added 'examples' directory. Currently only with pythia8 example
and with rushed Makefile that should be rewritten
2014-09-10 Tomasz Przedzinski <>
* Added README with coding standards for HepMC developers
* Added HEPEVT wrapper and sample test for it
2014-07-25 Tomasz Przedzinski <>
* Added cross-section sctruct
* Added prototype for Rivet interface on branch 'rivet'
2014-07-13 Andy Buckley <>
* Adding HepMC.h and Version.h headers.
* Use CXX and CXXFLAGS in place of CC,CFLAGS
* Adding ChangeLog and TODO to track developments.
2014-07-04 Tomasz Przedzinski <>
* Added PDFinfo and HeavyIon structs
2014-06-20 Tomasz Przedzinski <>
* Added Units class
2014-05-20 Tomasz Przedzinski <>
* Added serialization module for future ROOT interface
2014-05-13 Tomasz Przedzinski <>
* Improved and optimized in-memory representation prototype
2014-05-06 Tomasz Przedzinski <>
* Tested new in-memory representation prototype based on smart_ptr
2014-04-29 Tomasz Przedzinski <>
* Changed validation framework. Now it can be configured through config
files and can be used with selected with any (or none) of the tools
for which interface to HepMC3 is prepared
* Tested new in-memory representation prototype based on classes
acting like smart pointers
2014-04-22 Tomasz Przedzinski <>
* Added vertex position. Position accessor checks all vertices down the
decay tree for first vertex that has position set
* I/O classes updated to read and store vertex positions
2014-04-22 Tomasz Przedzinski <>
* Added vertex position. Position accessor checks all vertices down the
decay tree for first vertex that has position set
2014-04-15 Tomasz Przedzinski <>
* Tested new in-memory representation prototype prioritizing serialization
2014-04-08 Tomasz Przedzinski <>
* Validation framework expanded
* Added first version of search engine
2014-04-01 Tomasz Przedzinski <>
* Added validation framework prototype
* Added versioning prototype
2014-03-25 Tomasz Przedzinski <>
* Project started
* Added first prototype for HepMC3 in-memory representation
* Added first version of HepMC2 plain text input file reader
* Added first version of HepMC3 plain text output file writer
@page design Design
HEPMC3 interface design
This document is for recording the motivations for (re)design features in the
HepMC3 API. It should be written in Markdown notation so we can embed it into
the Doxygen code documentation.
Naming convention
Previous inconsistency, e.g. Gen prefixes on several core objects, but then
WeightContainer, PdfInfo, HeavyIon, etc. which did not have it. All API objects
in HepMC3 have a Gen prefix. This is useful because "Event", "Particle",
"Vertex", etc. are very common concepts in HEP code, and it is often nice to be able to drop the explicit HepMC::
Code standard
The decision was made to base HepMC3 on the C++11 standard. This provides
powerful smart pointers, improved iteration machinery (the range-based for
loop), and constructs such as lambda functions which may be useful for compact
testing of event constituent properties. A fallback to the Boost library is
available, at the cost of incomplete syntactic integration and an external
dependency on Boost.
Memory management and ownership
@TODO Tomasz! Explain issues with HepMC object ownership, motivation for the
shared pointer design, veiled pointer nature of new GenParticle, GenEvent's
holding of the canonical particle & vertex lists as simple vectors, etc.
@TODO Closed directed cycles are forbidden and may produce undefined behaviour.
@TODO Links between particles and iteration. "Parents", "children" links and
"all" iteration (from the event) are efficient. "Descendents" and "ancestors"
are not -- they will explicitly return a whole list, rather than allowing early
exit. If efficient access to such sets is needed, e.g. "test each descendent
until a photon is found", write a recursive function, perhaps a C++11 lambda.
Search engine
@TODO Tomasz
Generalised attributes
@TODO describe system. Leif?
Compatibility with HepMC2
Avoid changes to the _bulk_ of user code. This typically means event
interrogation, as opposed to event building and modification; the former
occupies thousands of lines of LHC code, while building and reading truth
events occurs only in a relatively few places.
The result is that the naming has generally been kept the same as in HepMC2, and
where changes to the canonical names have been made for improved consistency or
otherwise, backward compatibility aliases are provided. This includes the
iterator design of HepMC2, whose use is strongly discouraged in HepMC3, and the
STL-like IO_* classes of HepMC2 which have been replaced by the Reader/Writer
hierarchy. The aliases are provided if the HEPMC_NO_DEPRECATION preprocessor
macro is not defined; this is the default in version 3.0.x, but we anticipate
that in future releases (perhaps 3.1.x) the use of HepMC2 features will by
default first produce compilation warnings, and will eventually be disabled
Forward compatibility aliases and features will be added to final releases of
HepMC2 to ease transition to version 3.
Removal of 'barcode'
The "barcode" integer in HepMC2 was an uncomfortable object, simultaneously
declared in the code documentation to be a meaningless unique identifier for
vertex and particle objects, and set to specific ranges by experiments'
production systems to encode information about a particle's origins. It proved
impossible to satisfactorily reconcile these twin uses, and experiments' demands
for particle provenance information have exceeded the capacity of an int (or
even a long int).
Hence in HepMC3, the two concepts have been separated. Particles and vertices
have a unique identifier, the ID, and arbitrary provenance information may be
encoded in attached attributes. Since analysis procedures are accustomed to the
concept of a barcode which encodes e.g. primary vs. secondary physical
particles, the name has been entirely removed from HepMC3 such that it may be
used without fear of clashes in constructing analysis data formats -- in this
context the barcode will be defined by the user, perhaps combining the ID and
the provenance attributes in a scheme to meet the specific analysis needs.
Removal of 'Flow'
The Flow class has been removed, since it was unused by any widespread event
generator, and to our knowledge the only active use-case is an abuse of it to
provide more ints in which to encode provenance information. As this is now done
via attributes, there is no case for Flow's continued existence. No backward
compatibility Flow class is provided since this usage is extremely localised in
one piece of user code and migration to the newer scheme should be simple.
Status schemes
We continue with the standard status scheme for particles, and adopt the vertex
'id' scheme as a new vertex status, so named for consistency with the particles.
0 = null particle, do not use
1 = a stable physical particle, according to the latest stage of processing
2 = a decayed physical particle, post-hadronization
3 = documentation particle, typically meaning a hard process particle but not guaranteed physical
4 = a beam particle
1 = TODO
2 = TODO
3 = TODO
4 = TODO
5 = hadronization vertex, with incoming final partons and outgoing hadrons
#! /usr/bin/env bash
#Adopted from
#Docs from
## @configure_input@
#The line below assures at least some relocation.
if [ "$(uname)" == "Darwin" ]; then
prefix=$(dirname $(dirname $(greadlink -f $0)))
prefix=$(dirname $(dirname $(readlink -f $0)))
tmp=$(echo $* | egrep -- '--\<help\>|-\<h\>')
if test $# -eq 0 || test -n "$tmp"; then
echo "${PROJECT_NAME}-config: configuration tool for the ${PROJECT_NAME} library"
echo "Usage: $( basename $0 ) [--help|-h] | "
echo " [--{prefix,libdir,includedir}] | "
echo " [--{cxxflags,ldflags,libs}] | "
echo " [--version]"
echo "Options:"
echo " --help | -h : show this help message"
echo " --prefix : show the installation prefix"
echo " --includedir : show the path to the directory containing the ${PROJECT_NAME} headers"
echo " --libdir : show the path to the directory containing the ${PROJECT_NAME} libraries"
echo " --cflags|--cppflags : returns a '-I' string for insertion into CPPFLAGS or CXXFLAGS"
echo " --ldflags|libs : returns a '-L/-l' string for insertion into LIBS or LIBADD"
echo " --rootIO : returns a '-L/-l' string for insertion into LIBS or LIBADD with rootIO support"
echo " --search : returns a '-L/-l' string for insertion into LIBS or LIBADD with search support"
echo " --static : returns a string for insertion into LIBS or LIBADD"
echo " --version : returns the ${PROJECT_NAME} release version number"
exit 0
tmp=$( echo "$*" | egrep -- '--\<prefix\>')
test -n "$tmp" && OUT="$OUT $prefix"
tmp=$( echo "$*" | egrep -- '--\<includedir\>')
test -n "$tmp" && OUT="$OUT $prefix/${CMAKE_INSTALL_INCLUDEDIR}"
tmp=$( echo "$*" | egrep -- '--\<libdir\>')
test -n "$tmp" && OUT="$OUT $prefix/${CMAKE_INSTALL_LIBDIR}"
tmp=$( echo "$*" | egrep -- '--\<cflags|cppflags|cxxflags\>')
test -n "$tmp" && OUT="$OUT -I$prefix/${CMAKE_INSTALL_INCLUDEDIR}"
tmp=$( echo "$*" | egrep -- '--\<static\>')
if test -n "$tmp"; then
tmp=$( echo "$*" | egrep -- '--\<ldflags|libs\>')
OUT="$OUT $prefix/${CMAKE_INSTALL_LIBDIR}/libHepMC3_static.a -lHepMC3"
tmp=$( echo "$*" | egrep -- '--\<search\>')
test -n "$tmp" && OUT="$OUT -L$prefix/${CMAKE_INSTALL_LIBDIR}/libHepMC3search_static.a -lHepMC3search"
tmp=$( echo "$*" | egrep -- '--\<ldflags|libs\>')
test -n "$tmp" && OUT="$OUT -L$prefix/${CMAKE_INSTALL_LIBDIR} -lHepMC3"
tmp=$( echo "$*" | egrep -- '--\<search\>')
test -n "$tmp" && OUT="$OUT -L$prefix/${CMAKE_INSTALL_LIBDIR} -lHepMC3search"
tmp=$( echo "$*" | egrep -- '--\<rootIO\>')
test -n "$tmp" && OUT="$OUT -L$prefix/${CMAKE_INSTALL_LIBDIR} ${HEPMC3_ROOTIO_LIBRARY}"
tmp=$( echo "$*" | egrep -- '--\<version\>')
test -n "$tmp" && echo ${PROJECT_VERSION}&& exit 0
echo $OUT
This software is released under Version 3 of the GNU Public Licence (see COPYING) or any later version.
Copyright (C) 2014-2017 The Authors
\ No newline at end of file
This will help keep the code uniform and will greatly improve readability
of the code for new developers or old ones going back into the code after
several years.
1) We follow HepMC 2 naming conventions:
- "snake_case" style of function and variable naming
- "CamelCase" style of class naming
- class/struct variables start from m_
- enum values are ALL-CAPS
- getters do not use 'get_' prefix
- setters use 'set_' prefix
2) Remember to mark 'const' functions accordingly
3) HepMC follows no-throw policy, as in: no part of the code
should throw an exception or use 'exit', etc. to end the program.
All critical cases should be checked and when needed,
an error should be printed.
4) Declare use of each std class separately.
'using std::vector' instead of 'using namespace std'
5) Use pre-defined macros for any text output outside of print() functions.
Precede any text with class and function name:
ERROR( "GenEvent::test: No particles in the event!" )
WARNING( "GenEvent::test: Only one particle present!" )
DEBUG( 3, "GenEvent::test: Has end vertex: " << (bool)end_vertex() )
int x = 10*10;
DEBUG( 3, "GenEvent::test: This should be 100: " << x )
6) Whenever you need an output for debugging, always use appropriately
commented DEBUG( 10, "info" ) block. This would make things easier if you
later decide it's worth to leave the debug info in the code.
7) DEBUG and DEBUG_CODE_BLOCK statements are not compile in release mode
so use them at will. To avoid information flooding use appropriate
debug levels for specific types of debug information:
- level 1 - critical, short info
- level 10 - less important, longer info
1) We use 4-spaces indentation. Do not use TABs to indent code.
2) Keep your code clean of trailing spaces
3) Keep in mind vertical code alignment. Especially in header files and
in variable initialization. Makes these sections much easier to quickly
glance over.
4) We use One True Brace Style, as in:
void function_name() {
// ...
5) In terms of braces, spaces etc., we try to follow Python PEP8 style
1) When writing a comment that goes into documentation, use
doxygen-style comments with keywords starting from '@', e.g.:
Comment block:
* @file GenEvent.h
* @brief Definition of \b class GenEvent
* @class HepMC3::GenEvent
* @brief Stores event-related information
* Manages GenParticle and GenVertex objects
One-line comment:
int variable; //!< @todo This variable is probably useless
Parts that do not go into documentation (e.g. steps of an algorithm)
can be commented using usual // or /* */ comments.
2) Keep all of your code documented. Running: "cd doc/doxygen; make"
should give no warnings about missing documentation
3) Use @bug @todo keywords to mark problems found in the code. They go
on separate lists in the documentation so we can keep track of them
at any time. Remove these keywords after fixing the issue.
# hepmc3
# Introduction
HepMC3 is a new rewrite of HepMC event record. It uses shared pointers for in-memory navigation and the POD concept for the persistency.
# A Quick Start:
1. Checkout the HepMC from GIT repository:
git clone h
2. Create a workspace area on which to perform the builds
mkdir hepmc3-build
cd hepmc3-build