The following is a list of the new features available in HepMC3
Cmake build system
HepMC3 is built using CMake and is fully compatible with c++11. Following options are available:
cmake -DHEPMC_ENABLE_CPP11=ON
-DHEPMC_BUILD_EXAMPLES=ON
-DPYTHIA8_ROOT_DIR=<path_to_pythia8180_or_later>
-DROOT_DIR=<path_to_root_bin_dir>
- Note
- Path to pythia8 is used for examples only
-
Path to ROOT is optional. If not provided, CMake will attempt to find default ROOT installation. If no installation is present, ROOT I/O will not be available
-
cmake is set to detect c++11 support by default. If c++11 is not supported CMake will attempt to use c++0x.
New modules
See modules section for descriptions of new modules, such as ROOT I/O, Search Engine and Attributes.
GenRunInfo class
A new class has been provided to store run-level informations, such as weight names, names and description of tools used to generate the event, global attributes such as LHE run information or any other run information provided by user. See HepMC::GenRunInfo class description for details.
- Note
- This class can be serialized and parsed using ASCII I/O or ROOT I/O.
LHEF interface and new header-only HEPEVT wrapper
See examples section for examples of their use.
Small enchantments
Check if generated mass is set
To determine if field HepMC3::GenParticle::generated_mass() is set use:
bool is_set = particle.is_generated_mass_set();
if(!is_set) particle.set_generated_mass(m);
cout<<particle.generated_mass()<<endl;
Note that if HepMC3::GenParticle::generated_mass() is not set, call to this function will return mass calculated from 4-momentum using HepMC3::FourVector.m()
Iterators
GenEvent and GenVertex containers are now of std::vector type. This greatly simplifies iteration over them
e.g. (c++11):
foreach( const GenParticlePtr &p : event.particles() ) { {
...
}
foreach( const GenParticlePtr &p : vertex.particles_in() ) { {
...
}
- Note
- one can use macro FOREACH defined in HepMC/Common.h which uses c++11 or tries to mimic it depending on the installation options
#include "HepMC/Common.h"
...
FOREACH( const GenParticlePtr &p, event.particles() ) { {
...
}
FOREACH( const GenParticlePtr &p, vertex.particles_in() ) { {
...
}
###########################################################################
Links to project-related webpages
The relations between vertices and particles in GenEventData are encoded via members links1 and links2, wich are std::vector<int> containing object ids. Direct manipulations with links1 and links2 can be useful. For instance, when the events are saved in ROOT format, one can extract the information from links1 and links2 without reading whole event. In case links1[i] is particle, links2[i] is end vertex. In case links1[i] is vertex, links2[i] is outgoing particle. An example of usage is given below.
GenEventData* A=...
...
int i;
int j;
int current_l=0;
int vertex_l=0;
bool found_next_vertex=true;
while(found_next_vertex)
{
found_next_vertex=false;
for (i=0; i<A->links1.size(); i++)
if (A->links1[i]>0&&
A->links1[i]==current_l+1)
{
vertex_l=A->links2[i];
found_next_vertex=true;
}
std::vector<int> out;
if (found_next_vertex)
{
for (j=0; j<A->links1.size(); j++)
if (A->links1[j]<0
&&A->links1[j]==vertex_l)
if (std::abs(A->particles_pid[A->links2[j]-1])==11)
out.push_back(A->links2[j]);
if (out.size()==0) {
printf("Warning: no electron in the new vertex.\n");
break;
}
else
{
if (out.size()>1) printf("Warning: more than one electron in the new vertex.\n");
current_l=out.at(0)-1;
}
}
if (A->particles_status[current_l]==1) break;
}
...
Last update 6 Apr 2016