#include <hepmcinterface.h>
Base class for output handlers that need the HepMC3 structure.
This class can write the full event info or just the initial state (i.e., beam particles) and final state (i.e., final state particle).
The class serves as a base class for output routines that utilizes the HepMC event format (currently HepMcOutput and RivetOutput).
A techincal point: We need to generate HepMC::GenParticle objects, and we need to keep track of which HepMC::GenParticle corresponds to which smash::ParticleData. We therefor set up a map from the smash::ParticleData identifier (integer) to HepMC::GenParticlePtr. We use that map to keep track of the particles and interaction points.
In case full event history:
At each interaction we create a new vertex, and add the incoming particles as "in" particles to that vertex. We also set the appropriate "state" of the incoming particles. That is, if the interaction corresponded to a decay, then the HepMC state is set to two (2). All other interactions are set to one hundred (100) plus the SMASH interaction code (since there is no standard for these codes other than 1: final state, 2: particle has decayed, 4: particle is beam particle).
For outgoing particles this is a bit different. In case of elastic scatterings, SMASH will keep the incoming particle around as an outgoing particle. This is not how the HepMC event record is invisioned. Indeed, the particle has changed momentum and that should be recorded in the event record. In that case, we therefore generate a new particle which we add as outgoing particle.
All outgoing particles of a vertex have their initial status set to one (1 - final state), but it can be changed later due to other interactions.
If the outgoing particle corresponds to an incoming particle, and in particular if the incoming particle is a beam particle (or later fragment thereof), we need to fragment the ion so that the outgoing particle is dissociated from the incoming particle. To that end, we check if the outgoing particle was part of the beam particles. If so, we remove the outgoing particle from the register of identifiers that make up the beam particle, and create a new beam particle. This ensures that the HepMC event record is sound (in most cases).
Definition at line 83 of file hepmcinterface.h.
Public Types | |
using | AZ = std::pair< int, int > |
Pair of Atomic weight and number. More... | |
Public Member Functions | |
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... | |
Protected Types | |
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 | |
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 | |
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... | |
using smash::HepMcInterface::AZ = std::pair<int, int> |
Pair of Atomic weight and number.
Definition at line 86 of file hepmcinterface.h.
|
protected |
Type of mapping from SMASH ID to HepMC ID.
Definition at line 136 of file hepmcinterface.h.
|
protected |
Counter of collitions per incoming particle.
Definition at line 138 of file hepmcinterface.h.
|
protected |
smash::HepMcInterface::HepMcInterface | ( | const std::string & | name, |
const bool | full_event | ||
) |
Create HepMC particle event in memory.
[in] | name | Name of output |
[in] | full_event | Whether the full event or only final-state particles are printed in the output |
Definition at line 23 of file hepmcinterface.cc.
|
overridevirtual |
Add the initial particles information of an event to the central vertex.
Construct projectile and target particles with nuclear pdg code if collider.
[in] | particles | Current list of all particles. |
[in] | event_number | Current event number |
[in] | event | Event information |
std::runtime_error | if nuclei with non-nucleon particle (like hypernuclei) are tried to be constructed |
Reimplemented from smash::OutputInterface.
Definition at line 57 of file hepmcinterface.cc.
|
overridevirtual |
Writes collisions to event.
[in] | action | an Action object containing incoming, outgoing particles and type of interactions. |
[in] | density | Unused, needed since inherited. |
Reimplemented from smash::OutputInterface.
Definition at line 129 of file hepmcinterface.cc.
|
override |
Add the final particles information of an event to the central vertex.
Store impact paramter 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 165 of file hepmcinterface.cc.
|
protected |
Clear before an event.
Definition at line 204 of file hepmcinterface.cc.
|
protected |
|
protected |
Make an HepMC particle.
[in] | pid | Particle type identifier |
[in] | status | Status code of particle |
[in] | mom | Four momentum of particle |
[in] | mass | Generator mass of particle |
Definition at line 221 of file hepmcinterface.cc.
|
protected |
Find particle in mapping or generate it.
[in] | p | ParticleData object |
[in] | status | HepMC status code |
Definition at line 231 of file hepmcinterface.cc.
|
protected |
Find particle in mapping or generate it.
[in] | p | ParticleData object |
[in] | status | HepMC status code |
[in] | force_new | Create new particle even if could found |
Definition at line 241 of file hepmcinterface.cc.
|
protected |
Encode ion PDG.
[in] | az | Pair of Atomic weight and number |
Definition at line 255 of file hepmcinterface.cc.
|
protected |
The event.
Definition at line 187 of file hepmcinterface.h.
|
protected |
The heavy-ion structure.
Definition at line 189 of file hepmcinterface.h.
|
protected |
Dummy cross-section.
Definition at line 191 of file hepmcinterface.h.
|
protected |
The interaction point.
Definition at line 193 of file hepmcinterface.h.
|
protected |
Mapping from ID to particle.
Definition at line 195 of file hepmcinterface.h.
|
protected |
Collision counter.
For each \(i_{th}\) incoming nucleon we keep track of how many collisions that particle took in \( c_i\), classifying it as a participant if it had at least one collision. So, the total number of participants is:
\[ N_{\mathrm{part}} = \sum_i \begin{cases} 1 & c_i>0\\ 0 &c_i=0\end{cases} \]
The total number of collisions is given by the sum of the collisions of the nucleons of the incoming ion, the so called "projectile". Since we are considering the collisions between the nucleons of both ions, those of the "target" are already included in the sum.
\[ N_{\mathrm{coll}} = \sum_i^{N_{\mathrm{projectile}}} c_i\\ \]
Definition at line 216 of file hepmcinterface.h.
|
protected |
counter of binary collisions (e.g., where both incoming particles are from the beams.
Definition at line 219 of file hepmcinterface.h.
|
protected |
counter of hard binary collisions (e.g., where both incoming particles are from the beams.
Definition at line 222 of file hepmcinterface.h.
|
protected |
Whether the full event or only final-state particles are in the output.
Definition at line 224 of file hepmcinterface.h.