#include <rivetoutput.h>
SMASH output to Rivet analyses.
This class passes HepMC events to Rivet for analysis. The event is kept in-memory which significantly speeds up processing (at last a factor 10) as compared to writing the HepMC event to disk or pipe and then decoding in Rivet.
More details of the output format can be found in the User Guide.
Definition at line 37 of file rivetoutput.h.
Classes | |
struct | Proxy |
A proxy object that wraps all Rivet::AnalysisHandler calls in an environment where FP errors are disabled. More... | |
Public Member Functions | |
RivetOutput (const std::filesystem::path &path, std::string name, const bool full_event, const RivetOutputParameters &rivet_par) | |
Create Rivet output. More... | |
~RivetOutput () | |
Destructor. More... | |
void | at_eventend (const Particles &particles, const int32_t event_number, const EventInfo &event) override |
Add the final particles information of an event to the central vertex. More... | |
void | add_analysis (const std::string &name) |
Add an analysis or analyses to Rivet. More... | |
void | add_path (const std::string &path) |
Add a load path to the Rivet handler. More... | |
void | add_preload (const std::string &file) |
Add preload to Rivet handler. More... | |
void | set_ignore_beams (bool ignore=true) |
Do not insist on appropriate beams for analyses. More... | |
void | set_log_level (const std::string &name, const std::string &level) |
Set log level in Rivet. More... | |
void | set_cross_section (double xs, double xserr) |
Set X-section. More... | |
Public Member Functions inherited from smash::HepMcInterface | |
HepMcInterface (const std::string &name, const bool full_event) | |
Create HepMC particle event in memory. More... | |
void | at_eventstart (const Particles &particles, const int event_number, const EventInfo &event) override |
Add the initial particles information of an event to the central vertex. More... | |
void | at_interaction (const Action &action, const double density) override |
Writes collisions to event. More... | |
void | at_eventend (const Particles &particles, const int32_t event_number, const EventInfo &event) override |
Add the final particles information of an event to the central vertex. More... | |
Public Member Functions inherited from smash::OutputInterface | |
OutputInterface (std::string name) | |
Construct output interface. More... | |
virtual | ~OutputInterface ()=0 |
Pure virtual destructor to make class abstract and prevent its instantiation. More... | |
virtual void | at_eventstart (const std::vector< Particles > &, int) |
Output launched at event start after initialization, when particles are generated but not yet propagated. More... | |
virtual void | at_eventstart (const int, const ThermodynamicQuantity, const DensityType, RectangularLattice< DensityOnLattice >) |
Output launched at event start after initialization, when particles are generated but not yet propagated. More... | |
virtual void | at_eventstart (const int, const ThermodynamicQuantity, const DensityType, RectangularLattice< EnergyMomentumTensor >) |
Output launched at event start after initialization, when particles are generated but not yet propagated. More... | |
virtual void | at_eventend (const int, const ThermodynamicQuantity, const DensityType) |
Output launched at event end. More... | |
virtual void | at_eventend (const ThermodynamicQuantity) |
Output launched at event end. More... | |
virtual void | at_eventend (const Particles &, const int, const EventInfo &) |
Output launched at event end. More... | |
virtual void | at_eventend (const std::vector< Particles > &, const int) |
Output launched at event end. More... | |
virtual void | at_intermediate_time (const Particles &, const std::unique_ptr< Clock > &, const DensityParameters &, const EventInfo &) |
Output launched after every N'th time-step. More... | |
virtual void | at_intermediate_time (const std::vector< Particles > &, const std::unique_ptr< Clock > &, const DensityParameters &) |
Output launched after every N'th timestep. More... | |
virtual void | thermodynamics_output (const ThermodynamicQuantity, const DensityType, RectangularLattice< DensityOnLattice > &) |
Output to write thermodynamics from the lattice. More... | |
virtual void | thermodynamics_output (const ThermodynamicQuantity, const DensityType, RectangularLattice< EnergyMomentumTensor > &) |
Output to write energy-momentum tensor and related quantities from the lattice. More... | |
virtual void | thermodynamics_lattice_output (RectangularLattice< DensityOnLattice > &, const double) |
Output to write thermodynamics from the lattice. More... | |
virtual void | thermodynamics_lattice_output (RectangularLattice< DensityOnLattice > &, const double, const std::vector< Particles > &, const DensityParameters &) |
Output to write thermodynamics from the lattice. More... | |
virtual void | thermodynamics_lattice_output (const ThermodynamicQuantity, RectangularLattice< EnergyMomentumTensor > &, const double) |
Output to write energy-momentum tensor and related quantities from the lattice. More... | |
virtual void | thermodynamics_output (const GrandCanThermalizer &) |
Output to write energy-momentum tensor and related quantities from the thermalizer class. More... | |
virtual void | fields_output (const std::string, const std::string, RectangularLattice< std::pair< ThreeVector, ThreeVector >> &) |
Write fields in vtk output Fields are a pair of threevectors for example electric and magnetic field. More... | |
bool | is_dilepton_output () const |
Get, whether this is the dilepton output? More... | |
bool | is_photon_output () const |
Get, whether this is the photon output? More... | |
bool | is_IC_output () const |
Get, whether this is the IC output? More... | |
const char * | to_string (const ThermodynamicQuantity tq) |
Convert thermodynamic quantities to strings. More... | |
const char * | to_string (const DensityType dens_type) |
Convert density types to strings. More... | |
Private Member Functions | |
void | setup (const RivetOutputParameters ¶ms) |
Setup Rivet using SMASH configuration parameters. More... | |
Proxy | analysis_handler_proxy () |
Return a proxy that temporarily disables FP exceptions. More... | |
Private Attributes | |
std::shared_ptr< Rivet::AnalysisHandler > | handler_ |
Rivet analysis handler. More... | |
std::filesystem::path | filename_ |
Output file. More... | |
bool | need_init_ |
Whether we need initialisation. More... | |
Additional Inherited Members | |
Public Types inherited from smash::HepMcInterface | |
using | AZ = std::pair< int, int > |
Pair of Atomic weight and number. More... | |
Protected Types inherited from smash::HepMcInterface | |
enum | Status { beam = 4 , fnal = 1 , dcy = 2 , off = 100 } |
HepMC status codes. More... | |
using | IdMap = std::map< int, HepMC3::GenParticlePtr > |
Type of mapping from SMASH ID to HepMC ID. More... | |
using | CollCounter = std::valarray< int > |
Counter of collitions per incoming particle. More... | |
Protected Member Functions inherited from smash::HepMcInterface | |
void | clear () |
Clear before an event. More... | |
int | get_status (const ProcessType &t) const |
Convert SMASH process type to HepMC status. More... | |
HepMC3::GenParticlePtr | make_gen (int pid, int status, const smash::FourVector &mom, double mass=-1) |
Make an HepMC particle. More... | |
HepMC3::GenParticlePtr | make_register (const ParticleData &p, int status=Status::fnal) |
Find particle in mapping or generate it. More... | |
HepMC3::GenParticlePtr | find_or_make (const ParticleData &p, int status=Status::fnal, bool force_new=false) |
Find particle in mapping or generate it. More... | |
int | ion_pdg (const AZ &az) const |
Encode ion PDG. More... | |
Protected Attributes inherited from smash::HepMcInterface | |
HepMC3::GenEvent | event_ |
The event. More... | |
HepMC3::GenHeavyIonPtr | ion_ |
The heavy-ion structure. More... | |
HepMC3::GenCrossSectionPtr | xs_ |
Dummy cross-section. More... | |
HepMC3::GenVertexPtr | ip_ |
The interaction point. More... | |
IdMap | map_ |
Mapping from ID to particle. More... | |
CollCounter | coll_ |
Collision counter. More... | |
int | ncoll_ |
counter of binary collisions (e.g., where both incoming particles are from the beams. More... | |
int | ncoll_hard_ |
counter of hard binary collisions (e.g., where both incoming particles are from the beams. More... | |
bool | full_event_ |
Whether the full event or only final-state particles are in the output. More... | |
Protected Attributes inherited from smash::OutputInterface | |
const bool | is_dilepton_output_ |
Is this the dilepton output? More... | |
const bool | is_photon_output_ |
Is this the photon output? More... | |
const bool | is_IC_output_ |
Is this the IC output? More... | |
smash::RivetOutput::RivetOutput | ( | const std::filesystem::path & | path, |
std::string | name, | ||
const bool | full_event, | ||
const RivetOutputParameters & | rivet_par | ||
) |
Create Rivet output.
[in] | path | Output path. |
[in] | name | Name of the output. |
[in] | full_event | Whether the full event or only final-state particles are printed in the output |
[in] | rivet_par | Rivet parameters from SMASH configuration |
Definition at line 91 of file rivetoutput.cc.
smash::RivetOutput::~RivetOutput | ( | ) |
Destructor.
Finalises the analzyses and writes out results to file
Definition at line 102 of file rivetoutput.cc.
|
override |
Add the final particles information of an event to the central vertex.
Store impact parameter and write event.
[in] | particles | Current list of particles. |
[in] | event_number | Number of event. |
[in] | event | Event info, see event_info |
Definition at line 109 of file rivetoutput.cc.
void smash::RivetOutput::add_analysis | ( | const std::string & | name | ) |
Add an analysis or analyses to Rivet.
[in] | name | Name of analysis |
Definition at line 126 of file rivetoutput.cc.
void smash::RivetOutput::add_path | ( | const std::string & | path | ) |
Add a load path to the Rivet handler.
Definition at line 130 of file rivetoutput.cc.
void smash::RivetOutput::add_preload | ( | const std::string & | file | ) |
Add preload to Rivet handler.
Definition at line 135 of file rivetoutput.cc.
void smash::RivetOutput::set_ignore_beams | ( | bool | ignore = true | ) |
void smash::RivetOutput::set_log_level | ( | const std::string & | name, |
const std::string & | level | ||
) |
void smash::RivetOutput::set_cross_section | ( | double | xs, |
double | xserr | ||
) |
Set X-section.
[in] | xs | Cross-section value in pb |
[in] | xserr | Uncertainty on cross-section in pb |
Definition at line 165 of file rivetoutput.cc.
|
private |
Setup Rivet using SMASH configuration parameters.
[in] | params | The SMASH parameters already extracted from the input configuration |
Definition at line 169 of file rivetoutput.cc.
|
inlineprivate |
Return a proxy that temporarily disables FP exceptions.
Definition at line 122 of file rivetoutput.h.
|
private |
Rivet analysis handler.
Definition at line 125 of file rivetoutput.h.
|
private |
Output file.
Definition at line 127 of file rivetoutput.h.
|
private |
Whether we need initialisation.
Definition at line 129 of file rivetoutput.h.