Skip to content

Commit

Permalink
Added a new AsciiParticles output mode for HepMC v2
Browse files Browse the repository at this point in the history
  • Loading branch information
forthommel committed Jul 25, 2019
1 parent 43fcf89 commit 7f982e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CepGen/IO/HepMCEventInterface.cpp
Expand Up @@ -5,6 +5,7 @@

#include "CepGen/Event/Event.h"
#include "CepGen/Physics/Constants.h"
#include "CepGen/Physics/PDG.h"

#ifdef HEPMC3
# include "HepMC3/Version.h"
Expand Down Expand Up @@ -73,6 +74,7 @@ namespace HepMC
auto part = new GenParticle( pmom, part_orig.integerPdgId(), (int)part_orig.status() );
part->suggest_barcode( idx++ );
#endif
part->set_generated_mass( cepgen::PDG::get().mass( part_orig.pdgId() ) );

switch ( part_orig.role() ) {
case cepgen::Particle::IncomingBeam1:
Expand Down
8 changes: 6 additions & 2 deletions CepGen/IO/HepMCHandler.cpp
Expand Up @@ -23,6 +23,7 @@
# include "HepMC/Version.h"
# if !defined( HEPMC_VERSION_CODE ) // HepMC v2
# include "HepMC/IO_GenEvent.h"
# include "HepMC/IO_AsciiParticles.h"
# else
# include "HepMC/WriterAscii.h"
# include "HepMC/WriterHEPEVT.h"
Expand Down Expand Up @@ -71,7 +72,7 @@ namespace cepgen
template<typename T>
HepMCHandler<T>::HepMCHandler( const ParametersList& params ) :
GenericExportHandler( "hepmc" ),
output_( new T( params.get<std::string>( "filename", "output.hepmc" ) ) ),
output_( new T( params.get<std::string>( "filename", "output.hepmc" ).c_str() ) ),
xs_( new GenCrossSection ),
#ifdef HEPMC3
runinfo_( new GenRunInfo ),
Expand All @@ -90,7 +91,9 @@ namespace cepgen
template<typename T>
HepMCHandler<T>::~HepMCHandler()
{
#ifdef HEPMC3
output_->close();
#endif
}

template<typename T> void
Expand Down Expand Up @@ -131,7 +134,8 @@ REGISTER_IO_MODULE( hepmc2, HepMCHandler<WriterAsciiHepMC2> )
REGISTER_IO_MODULE( hepmc_root, HepMCHandler<WriterRoot> )
REGISTER_IO_MODULE( hepmc_root_tree, HepMCHandler<WriterRootTree> )
# endif
#else
#else // HepMC version 2 and below
REGISTER_IO_MODULE( hepmc, HepMCHandler<IO_GenEvent> )
REGISTER_IO_MODULE( hepmc_ascii, HepMCHandler<IO_AsciiParticles> )
#endif

0 comments on commit 7f982e3

Please sign in to comment.