#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 81 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, const int total_N, const int proj_N) | |
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... | |
![]() | |
OutputInterface (std::string name) | |
Construct output interface. More... | |
virtual | ~OutputInterface ()=default |
virtual void | at_eventend (const Particles &particles, const int event_number, const EventInfo &info)=0 |
Output launched at event end. More... | |
virtual void | at_intermediate_time (const Particles &particles, const std::unique_ptr< Clock > &clock, const DensityParameters &dens_param, const EventInfo &info) |
Output launched after every N'th timestep. More... | |
virtual void | thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< DensityOnLattice > &lattice) |
Output to write thermodynamics from the lattice. More... | |
virtual void | thermodynamics_output (const ThermodynamicQuantity tq, const DensityType dt, RectangularLattice< EnergyMomentumTensor > &lattice) |
Output to write energy-momentum tensor and related quantities from the lattice. More... | |
virtual void | thermodynamics_output (const GrandCanThermalizer &gct) |
Output to write energy-momentum tensor and related quantities from the thermalizer class. 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... | |
const int | total_N_ |
Total number of nucleons in projectile and target, needed for converting nuclei to single particles. More... | |
const int | proj_N_ |
Total number of nucleons in projectile, needed for converting nuclei to single particles. More... | |
bool | full_event_ |
Whether the full event or only final-state particles are in the output. More... | |
![]() | |
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 84 of file hepmcinterface.h.
|
protected |
Type of mapping from SMASH ID to HepMC ID.
Definition at line 137 of file hepmcinterface.h.
|
protected |
Counter of collitions per incoming particle.
Definition at line 139 of file hepmcinterface.h.
|
protected |
smash::HepMcInterface::HepMcInterface | ( | const std::string & | name, |
const bool | full_event, | ||
const int | total_N, | ||
const int | proj_N | ||
) |
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 |
[in] | total_N | Total number of particles in both nuclei. |
[in] | proj_N | Number of particles in projectile. |
Definition at line 18 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 |
Implements smash::OutputInterface.
Definition at line 38 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 106 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 142 of file hepmcinterface.cc.
|
protected |
Clear before an event.
Definition at line 177 of file hepmcinterface.cc.
|
protected |
Convert SMASH process type to HepMC status.
Definition at line 186 of file hepmcinterface.cc.
|
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 194 of file hepmcinterface.cc.
|
protected |
Find particle in mapping or generate it.
[in] | p | ParticleData object |
[in] | status | HepMC status code |
Definition at line 204 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 214 of file hepmcinterface.cc.
|
protected |
Encode ion PDG.
[in] | az | Pair of Atomic weight and number |
Definition at line 228 of file hepmcinterface.cc.
|
protected |
The event.
Definition at line 188 of file hepmcinterface.h.
|
protected |
The heavy-ion structure.
Definition at line 190 of file hepmcinterface.h.
|
protected |
Dummy cross-section.
Definition at line 192 of file hepmcinterface.h.
|
protected |
The interaction point.
Definition at line 194 of file hepmcinterface.h.
|
protected |
Mapping from ID to particle.
Definition at line 196 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 217 of file hepmcinterface.h.
|
protected |
counter of binary collisions (e.g., where both incoming particles are from the beams.
Definition at line 220 of file hepmcinterface.h.
|
protected |
counter of hard binary collisions (e.g., where both incoming particles are from the beams.
Definition at line 223 of file hepmcinterface.h.
|
protected |
Total number of nucleons in projectile and target, needed for converting nuclei to single particles.
Definition at line 228 of file hepmcinterface.h.
|
protected |
Total number of nucleons in projectile, needed for converting nuclei to single particles.
Definition at line 233 of file hepmcinterface.h.
|
protected |
Whether the full event or only final-state particles are in the output.
Definition at line 235 of file hepmcinterface.h.