Version: SMASH-3.4
Logging Classes and Functions

The interfaces in this group are used for debug and informational console output.

SMASH uses the einhard logging library for debug and info/warn/error output to stdout. This library builds upon the C++ ostream classes and thus uses stream operators for converting objects into a text representation.

The einhard library supports named output streams (which simply means they automatically add the name to the prefix string). We use this feature to define log areas in SMASH that can be configured independently. The einhard::Logger class supports two options: colorization and verbosity. For colorization we stay with the default of auto-detecting a color-terminal. For verbosity we use a Configuration object to set the verbosity of each area independently. This way we have control over the amount of debug output at runtime and without the need to touch the code/recompile.

To output something from your code do the following:

logg[LAreaName].trace(source_location);
logg[LAreaName].debug("particle", p);
logg[LAreaName].warn("Something happened.");
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & logg
An array that stores all pre-configured Logger objects.
Definition: logging.h:245
constexpr int p
Proton.

Note that LAreaName needs to be declared within the smash namespace of the respective file in a form of (using PauliBlocking as an example area):

static constexpr int LPauliBlocking = LogArea::PauliBlocking::id;
static constexpr int LPauliBlocking
Definition: action.cc:30

The einhard::Logger class supports two ways of writing to an output stream: Use stream operators or pass the list of objects for output as parameters. Thus

log.debug("particle: ", p);

and

log.debug() << "particle: " << p;

are equivalent (except for a small optimization opportunity in the former variant, that could make it slightly more efficient). You can see, though, that the former variant is more concise and often much easier to type than the stream operators.

Classes

struct  smash::LogArea::Main
 Log area tag type. More...
 
struct  smash::LogArea::Experiment
 Log area tag type. More...
 
struct  smash::LogArea::Box
 Log area tag type. More...
 
struct  smash::LogArea::Collider
 Log area tag type. More...
 
struct  smash::LogArea::Sphere
 Log area tag type. More...
 
struct  smash::LogArea::Action
 Log area tag type. More...
 
struct  smash::LogArea::InputParser
 Log area tag type. More...
 
struct  smash::LogArea::ParticleType
 Log area tag type. More...
 
struct  smash::LogArea::FindScatter
 Log area tag type. More...
 
struct  smash::LogArea::Clock
 Log area tag type. More...
 
struct  smash::LogArea::DecayModes
 Log area tag type. More...
 
struct  smash::LogArea::Resonances
 Log area tag type. More...
 
struct  smash::LogArea::ScatterAction
 Log area tag type. More...
 
struct  smash::LogArea::Distributions
 Log area tag type. More...
 
struct  smash::LogArea::Propagation
 Log area tag type. More...
 
struct  smash::LogArea::Grid
 Log area tag type. More...
 
struct  smash::LogArea::List
 Log area tag type. More...
 
struct  smash::LogArea::Nucleus
 Log area tag type. More...
 
struct  smash::LogArea::Density
 Log area tag type. More...
 
struct  smash::LogArea::PauliBlocking
 Log area tag type. More...
 
struct  smash::LogArea::Tmn
 Log area tag type. More...
 
struct  smash::LogArea::Fpe
 Log area tag type. More...
 
struct  smash::LogArea::Lattice
 Log area tag type. More...
 
struct  smash::LogArea::Pythia
 Log area tag type. More...
 
struct  smash::LogArea::GrandcanThermalizer
 Log area tag type. More...
 
struct  smash::LogArea::CrossSections
 Log area tag type. More...
 
struct  smash::LogArea::Output
 Log area tag type. More...
 
struct  smash::LogArea::HyperSurfaceCrossing
 Log area tag type. More...
 
struct  smash::LogArea::InitialConditions
 Log area tag type. More...
 
struct  smash::LogArea::ScatterActionMulti
 Log area tag type. More...
 
struct  smash::LogArea::Configuration
 Log area tag type. More...
 
struct  smash::LogArea::Potentials
 Log area tag type. More...
 
struct  smash::LogArea::RootSolver
 Log area tag type. More...
 
struct  smash::FormattingHelper< T >
 
struct  YAML::convert< einhard::LogLevel >
 
struct  smash::PrintParticleListDetailed
 

Macros

#define DECLARE_LOGAREA(id__, name__)
 Declares the necessary interface to identify a new log area. More...
 
#define SMASH_SOURCE_LOCATION    __FILE__ ":" + std::to_string(__LINE__) + " (" + __func__ + ')'
 Hackery that is required to output the location in the source code where the log statement occurs. More...
 

Typedefs

using smash::LogArea::AreaTuple = std::tuple< Main, Experiment, Box, Collider, Sphere, Action, InputParser, ParticleType, FindScatter, Clock, DecayModes, Resonances, ScatterAction, Distributions, Propagation, Grid, List, Nucleus, Density, PauliBlocking, Tmn, Fpe, Lattice, Pythia, GrandcanThermalizer, CrossSections, Output, HyperSurfaceCrossing, InitialConditions, ScatterActionMulti, Configuration, Potentials, RootSolver >
 This type collects all existing log areas so they will be created with the correct log level automatically. More...
 

Functions

virtual void smash::Action::format_debug_output (std::ostream &out) const =0
 Writes information about this action to the out stream. More...
 
std::ostream & smash::operator<< (std::ostream &out, const ActionPtr &action)
 Convenience: dereferences the ActionPtr to Action. More...
 
std::ostream & smash::operator<< (std::ostream &out, const ActionList &actions)
 Writes multiple actions to the out stream. More...
 
std::ostream & smash::operator<< (std::ostream &out, const Angles &a)
 Creates output for an Angles object in the form "φ: 0.1294, cos ϑ: 0.423". More...
 
void smash::DecayAction::format_debug_output (std::ostream &out) const override
 Writes information about this decay action to the out stream. More...
 
std::ostream & smash::operator<< (std::ostream &out, const EnergyMomentumTensor &Tmn)
 Prints out 4x4 tensor to the output stream. More...
 
std::ostream & smash::operator<< (std::ostream &os, const FourVector &vec)
 Writes the four components of the vector to the output stream. More...
 
template<int w = 9, int p = w - 3, typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & smash::field (std::basic_ostream< CharT, Traits > &s)
 Stream modifier to align the next object to a specific width w. More...
 
void smash::create_all_loggers (Configuration config)
 Called from main() right after the Configuration object is fully set up to create all logger objects (as defined by LogArea::AreaTuple) with the correct area names and log levels. More...
 
einhard::LogLevel smash::default_loglevel ()
 
void smash::set_default_loglevel (einhard::LogLevel level)
 Set the default log level (what will be returned from subsequent default_loglevel calls). More...
 
template<typename T >
FormattingHelper< T > smash::format (const T &value, const char *unit, int width=-1, int precision=-1)
 Acts as a stream modifier for std::ostream to output an object with an optional suffix string and with a given field width and precision. More...
 
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & smash::get_loggers ()
 Return the globally shared logger array. More...
 
static Node YAML::convert< einhard::LogLevel >::encode (const einhard::LogLevel &x)
 Convert from einhard::LogLevel to YAML::Node. More...
 
static bool YAML::convert< einhard::LogLevel >::decode (const Node &node, einhard::LogLevel &x)
 Convert from YAML::Node to einhard::LogLevel. More...
 
std::ostream & smash::operator<< (std::ostream &s, const ParticleData &p)
 Writes the state of the particle to the output stream. More...
 
std::ostream & smash::operator<< (std::ostream &out, const ParticleList &particle_list)
 Writes a compact overview over the particles in the particle_list argument to the stream. More...
 
PrintParticleListDetailed smash::detailed (const ParticleList &list)
 Request the ParticleList to be printed in full detail (i.e. More...
 
std::ostream & smash::operator<< (std::ostream &out, const PrintParticleListDetailed &particle_list)
 Writes a detailed overview over the particles in the particle_list argument to the stream. More...
 
std::ostream & smash::operator<< (std::ostream &is, const PdgCode &code)
 Writes the textual representation of the PDG code to the output stream. More...
 
std::ostream & smash::operator<< (std::ostream &os, ProcessType process_type)
 Writes the textual representation of the process_type to the output stream os. More...
 
std::ostream & smash::operator<< (std::ostream &os, const CollisionBranch &cbranch)
 Writes the textual representation of the Collision Branch cbranch to the output stream os. More...
 
void smash::ScatterAction::format_debug_output (std::ostream &out) const override
 Writes information about this scatter action to the out stream. More...
 
std::ostream & smash::operator<< (std::ostream &, const ThreeVector &)
 Writes the three components of the vector to the output stream. More...
 

Variables

const T & smash::FormattingHelper< T >::value
 Value that is being formatted. More...
 
const int smash::FormattingHelper< T >::width
 Output width. More...
 
const int smash::FormattingHelper< T >::precision
 Precision that value is being formatted with. More...
 
const char *const smash::FormattingHelper< T >::unit
 Unit that is attached at the end of value. More...
 
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & smash::logg = get_loggers()
 An array that stores all pre-configured Logger objects. More...
 

Friends

std::ostream & smash::Action::operator<< (std::ostream &out, const Action &action)
 Dispatches formatting to the virtual Action::format_debug_output function. More...
 
std::ostream & smash::BoxModus::operator<< (std::ostream &out, const BoxModus &m)
 Console output on startup of box specific parameters; writes the initial state for the box to the output stream. More...
 
std::ostream & smash::ColliderModus::operator<< (std::ostream &, const ColliderModus &)
 Writes the initial state for the ColliderModus to the output stream. More...
 
std::ostream & smash::Experiment< Modus >::operator<< (std::ostream &out, const Experiment &e)
 Writes the initial state for the Experiment to the output stream. More...
 
std::ostream & smash::ListModus::operator<< (std::ostream &out, const ListModus &m)
 Writes the initial state for the List to the output stream. More...
 
std::ostream & smash::FormattingHelper< T >::operator<< (std::ostream &out, const FormattingHelper &h)
 Nicely formatted output. More...
 
std::ostream & smash::Nucleus::operator<< (std::ostream &, const Nucleus &)
 Writes the state of the Nucleus object to the output stream. More...
 
std::ostream & smash::Particles::operator<< (std::ostream &out, const Particles &particles)
 Print effective mass and type name for all particles to the stream. More...
 
std::ostream & smash::ParticleType::operator<< (std::ostream &out, const ParticleType &type)
 Writes all information about the particle type to the output stream. More...
 
std::ostream & smash::SphereModus::operator<< (std::ostream &out, const SphereModus &m)
 Writes the initial state for the Sphere to the output stream. More...
 

Macro Definition Documentation

◆ DECLARE_LOGAREA

#define DECLARE_LOGAREA (   id__,
  name__ 
)
Value:
struct name__ { \
static constexpr int id = id__; \
static constexpr const char *textual() { return #name__; } \
static constexpr int textual_length() { return sizeof(#name__) - 1; } \
}

Declares the necessary interface to identify a new log area.

Definition at line 75 of file logging.h.

◆ SMASH_SOURCE_LOCATION

#define SMASH_SOURCE_LOCATION    __FILE__ ":" + std::to_string(__LINE__) + " (" + __func__ + ')'

Hackery that is required to output the location in the source code where the log statement occurs.

Definition at line 153 of file logging.h.

Typedef Documentation

◆ AreaTuple

Function Documentation

◆ format_debug_output() [1/3]

virtual void smash::Action::format_debug_output ( std::ostream &  out) const
protectedpure virtual

Writes information about this action to the out stream.

Parameters
[out]outout stream to be written to

Implemented in smash::WallcrossingAction, smash::ThermalizationAction, smash::ScatterActionMulti, smash::ScatterAction, smash::FreeforallAction, smash::FluidizationAction, and smash::DecayAction.

◆ operator<<() [1/12]

std::ostream& smash::operator<< ( std::ostream &  out,
const ActionPtr &  action 
)
inline

Convenience: dereferences the ActionPtr to Action.

Definition at line 546 of file action.h.

546  {
547  return out << *action;
548 }

◆ operator<<() [2/12]

std::ostream & smash::operator<< ( std::ostream &  out,
const ActionList &  actions 
)

Writes multiple actions to the out stream.

Definition at line 400 of file action.cc.

400  {
401  out << "ActionList {\n";
402  for (const auto &a : actions) {
403  out << "- " << a << '\n';
404  }
405  return out << '}';
406 }

◆ operator<<() [3/12]

std::ostream& smash::operator<< ( std::ostream &  out,
const Angles a 
)
inline

Creates output for an Angles object in the form "φ: 0.1294, cos ϑ: 0.423".

Definition at line 195 of file angles.h.

195  {
196  return out << "φ:" << field << a.phi() << ", cos ϑ:" << field << a.costheta();
197 }
std::basic_ostream< CharT, Traits > & field(std::basic_ostream< CharT, Traits > &s)
Stream modifier to align the next object to a specific width w.
Here is the call graph for this function:

◆ format_debug_output() [2/3]

void smash::DecayAction::format_debug_output ( std::ostream &  out) const
overrideprotectedvirtual

Writes information about this decay action to the out stream.

Implements smash::Action.

Definition at line 202 of file decayaction.cc.

202  {
203  out << "Decay of " << incoming_particles_ << " to " << outgoing_particles_
204  << ", sqrt(s)=" << format(sqrt_s(), "GeV", 11, 9);
205 }
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
Definition: action.h:363
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
Definition: action.h:271
ParticleList incoming_particles_
List with data of incoming particles.
Definition: action.h:355
FormattingHelper< T > format(const T &value, const char *unit, int width=-1, int precision=-1)
Acts as a stream modifier for std::ostream to output an object with an optional suffix string and wit...
Definition: logging.h:217
Here is the call graph for this function:

◆ operator<<() [4/12]

std::ostream & smash::operator<< ( std::ostream &  out,
const EnergyMomentumTensor Tmn 
)

Prints out 4x4 tensor to the output stream.

Parameters
[in]outLocation of output
[in]TmnEnergy-momentum tensor

Definition at line 162 of file energymomentumtensor.cc.

162  {
163  out.width(12);
164  for (size_t mu = 0; mu < 4; mu++) {
165  for (size_t nu = 0; nu < 4; nu++) {
166  out << std::setprecision(3) << std::setw(12) << std::fixed
167  << Tmn[EnergyMomentumTensor::tmn_index(mu, nu)];
168  }
169  out << std::endl;
170  }
171  return out;
172 }
@ Tmn
Energy-momentum tensor in lab frame.
Here is the call graph for this function:

◆ operator<<() [5/12]

std::ostream & smash::operator<< ( std::ostream &  os,
const FourVector vec 
)

Writes the four components of the vector to the output stream.

Parameters
[in]osThe ostream into which to output
[in]vecThe FourVector to write into os

Definition at line 37 of file fourvector.cc.

37  {
38  out.put('(');
39  out.fill(' ');
40  for (auto x : vec) {
41  out << field<8> << x;
42  }
43  return out << ')';
44 }

◆ field()

template<int w = 9, int p = w - 3, typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& smash::field ( std::basic_ostream< CharT, Traits > &  s)
inline

Stream modifier to align the next object to a specific width w.

Template Parameters
wThe number of characters the field should have in the output.
pThe floating precision.
CharTCharacter type of the output stream.
TraitsTraits of the output stream.
Parameters
[in,out]sThe output stream.
Returns
The output stream.

Definition at line 30 of file iomanipulators.h.

31  {
32  s.put(s.widen(' '));
33  s.setf(std::ios_base::fixed, std::ios_base::floatfield);
34  s.width(w);
35  s.precision(p);
36  return s;
37 }
Here is the caller graph for this function:

◆ create_all_loggers()

void smash::create_all_loggers ( Configuration  config)

Called from main() right after the Configuration object is fully set up to create all logger objects (as defined by LogArea::AreaTuple) with the correct area names and log levels.

Parameters
configA configuration object with the log area names as toplevel keys.

Definition at line 115 of file logging.cc.

115  {
116  create_all_loggers_impl<std::tuple_size<LogArea::AreaTuple>::value>(config);
117 }
Here is the caller graph for this function:

◆ default_loglevel()

einhard::LogLevel smash::default_loglevel ( )
Returns
The default log level to use if no specific level is configured.

Definition at line 23 of file logging.cc.

23 { return global_default_loglevel; }
static einhard::LogLevel global_default_loglevel
The default logging level is ALL.
Definition: logging.cc:21

◆ set_default_loglevel()

void smash::set_default_loglevel ( einhard::LogLevel  level)

Set the default log level (what will be returned from subsequent default_loglevel calls).

Parameters
levelThe new log level. See einhard::LogLevel.

Definition at line 25 of file logging.cc.

25  {
27 }
Here is the caller graph for this function:

◆ format()

template<typename T >
FormattingHelper<T> smash::format ( const T &  value,
const char *  unit,
int  width = -1,
int  precision = -1 
)

Acts as a stream modifier for std::ostream to output an object with an optional suffix string and with a given field width and precision.

Template Parameters
TValue that is being formatted.
Parameters
valueThe object to be written to the stream.
unitAn optional suffix string, typically used for a unit. May be nullptr.
widthThe field width to use for value.
precisionThe precision to use for value.

Definition at line 217 of file logging.h.

218  {
219  return {value, width, precision, unit};
220 }
Here is the caller graph for this function:

◆ get_loggers()

std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > & smash::get_loggers ( )

Return the globally shared logger array.

The array is initialized on first use to avoid static initialization order issues across translation units.

Definition at line 30 of file logging.cc.

30  {
31  static std::array<einhard::Logger<>,
32  std::tuple_size<LogArea::AreaTuple>::value>
33  logg_instance;
34  return logg_instance;
35 }

◆ encode()

static Node YAML::convert< einhard::LogLevel >::encode ( const einhard::LogLevel x)
inlinestatic

Convert from einhard::LogLevel to YAML::Node.

Parameters
xLog level.
Returns
Corresponding YAML node.

Definition at line 262 of file logging.h.

262  {
263  return Node{einhard::getLogLevelString(x)};
264  }
const char * getLogLevelString() noexcept
Retrieve a human readable representation of the given log level value.
Here is the call graph for this function:

◆ decode()

static bool YAML::convert< einhard::LogLevel >::decode ( const Node &  node,
einhard::LogLevel x 
)
inlinestatic

Convert from YAML::Node to einhard::LogLevel.

Parameters
[in]nodeYAML node.
[out]xWhere the corresponding log level will be stored if the conversion was successful.
Returns
Whether the conversion was successful.

Definition at line 274 of file logging.h.

274  {
275  if (!node.IsScalar()) {
276  return false;
277  } else {
278  x = einhard::getLogLevel(node.Scalar());
279  return true;
280  }
281  }
LogLevel getLogLevel(const std::string &level)
Compares the string level against the strings for LogLevel and returns the one it matches.
Here is the call graph for this function:

◆ operator<<() [6/12]

std::ostream & smash::operator<< ( std::ostream &  s,
const ParticleData p 
)

Writes the state of the particle to the output stream.

Definition at line 171 of file particledata.cc.

171  {
172  out.fill(' ');
173  return out << p.type().name() << " (" << std::setw(5) << p.type().pdgcode()
174  << ")" << std::right << "{id:" << field<6> << p.id()
175  << ", process:" << field<4> << p.id_process()
176  << ", pos [fm]:" << p.position() << ", mom [GeV]:" << p.momentum()
177  << ", formation time [fm]:" << p.formation_time()
178  << ", cross section scaling factor:" << p.xsec_scaling_factor()
179  << "}";
180 }

◆ operator<<() [7/12]

std::ostream & smash::operator<< ( std::ostream &  out,
const ParticleList &  particle_list 
)

Writes a compact overview over the particles in the particle_list argument to the stream.

Definition at line 182 of file particledata.cc.

182  {
183  auto column = out.tellp();
184  out << '[';
185  for (const auto &p : particle_list) {
186  if (out.tellp() - column >= 201) {
187  out << '\n';
188  column = out.tellp();
189  out << ' ';
190  }
191  out << std::setw(5) << std::setprecision(3) << p.momentum().abs3()
192  << p.type().name();
193  }
194  return out << ']';
195 }

◆ detailed()

PrintParticleListDetailed smash::detailed ( const ParticleList &  list)
inline

Request the ParticleList to be printed in full detail (i.e.

one full ParticleData printout per line).

Definition at line 599 of file particledata.h.

599  {
600  return {list};
601 }

◆ operator<<() [8/12]

std::ostream & smash::operator<< ( std::ostream &  out,
const PrintParticleListDetailed particle_list 
)

Writes a detailed overview over the particles in the particle_list argument to the stream.

This overload is selected via the function detailed.

Definition at line 197 of file particledata.cc.

198  {
199  bool first = true;
200  out << '[';
201  for (const auto &p : particle_list.list) {
202  if (first) {
203  first = false;
204  } else {
205  out << "\n ";
206  }
207  out << p;
208  }
209  return out << ']';
210 }

◆ operator<<() [9/12]

std::ostream & smash::operator<< ( std::ostream &  is,
const PdgCode code 
)

Writes the textual representation of the PDG code to the output stream.

Definition at line 119 of file pdgcode.cc.

119  {
120  return s << code.string();
121 }
Here is the call graph for this function:

◆ operator<<() [10/12]

std::ostream & smash::operator<< ( std::ostream &  os,
ProcessType  process_type 
)

Writes the textual representation of the process_type to the output stream os.

Definition at line 106 of file processbranch.cc.

106  {
107  switch (process_type) {
108  case ProcessType::None:
109  os << "None";
110  break;
112  os << "Elastic";
113  break;
114  case ProcessType::TwoToOne:
115  os << "TwoToOne";
116  break;
117  case ProcessType::TwoToTwo:
118  os << "TwoToTwo";
119  break;
120  case ProcessType::TwoToThree:
121  os << "TwoToThree";
122  break;
123  case ProcessType::TwoToFour:
124  os << "TwoToFour";
125  break;
126  case ProcessType::TwoToFive:
127  os << "TwoToFive";
128  break;
129  case ProcessType::StringSoftSingleDiffractiveAX:
130  case ProcessType::StringSoftSingleDiffractiveXB:
131  case ProcessType::StringSoftDoubleDiffractive:
132  case ProcessType::StringSoftAnnihilation:
133  case ProcessType::StringSoftNonDiffractive:
134  os << "SoftStringExcitation";
135  break;
136  case ProcessType::StringHardNonDiffractive:
137  case ProcessType::StringHardSingleDiffractiveAX:
138  case ProcessType::StringHardSingleDiffractiveXB:
139  case ProcessType::StringHardDoubleDiffractive:
140  os << "HardStringExcitation";
141  break;
142  case ProcessType::Decay:
143  os << "Decay";
144  break;
145  case ProcessType::Wall:
146  os << "Wall";
147  break;
148  case ProcessType::Thermalization:
149  os << "Thermalization";
150  break;
151  case ProcessType::Fluidization:
152  case ProcessType::FluidizationNoRemoval:
153  os << "Fluidization";
154  break;
155  case ProcessType::MultiParticleThreeMesonsToOne:
156  os << "ThreeMesonsToOne";
157  break;
158  case ProcessType::MultiParticleThreeToTwo:
159  os << "ThreeToTwo";
160  break;
161  case ProcessType::MultiParticleFourToTwo:
162  os << "FourToTwo";
163  break;
164  case ProcessType::MultiParticleFiveToTwo:
165  os << "FiveToTwo";
166  break;
167  case ProcessType::Freeforall:
168  os << "Freeforall";
169  break;
170  default:
171  os.setstate(std::ios_base::failbit);
172  }
173  return os;
174 }

◆ operator<<() [11/12]

std::ostream & smash::operator<< ( std::ostream &  os,
const CollisionBranch cbranch 
)

Writes the textual representation of the Collision Branch cbranch to the output stream os.

Definition at line 64 of file processbranch.cc.

64  {
65  ProcessType ptype = cbranch.get_type();
66  if (ptype == ProcessType::StringSoftSingleDiffractiveAX ||
67  ptype == ProcessType::StringSoftSingleDiffractiveXB) {
68  os << "soft-1-diff";
69  } else if (ptype == ProcessType::StringSoftDoubleDiffractive) {
70  os << "soft-2-diff";
71  } else if (ptype == ProcessType::StringSoftAnnihilation) {
72  os << "soft-BBbar";
73  } else if (ptype == ProcessType::StringSoftNonDiffractive) {
74  os << "soft-non-diff";
75  } else if (ptype == ProcessType::StringHardNonDiffractive) {
76  os << "hard-non-diff";
77  } else if (ptype == ProcessType::StringHardSingleDiffractiveXB ||
78  ptype == ProcessType::StringHardSingleDiffractiveAX) {
79  os << "hard-1-diff";
80  } else if (ptype == ProcessType::StringHardDoubleDiffractive) {
81  os << "hard-2-diff";
82  } else if (ptype == ProcessType::TwoToOne || ptype == ProcessType::TwoToTwo ||
83  ptype == ProcessType::TwoToThree ||
84  ptype == ProcessType::TwoToFour ||
85  ptype == ProcessType::TwoToFive || ptype == ProcessType::Elastic ||
86  ptype == ProcessType::Decay ||
87  ptype == ProcessType::MultiParticleThreeMesonsToOne ||
88  ptype == ProcessType::MultiParticleThreeToTwo ||
89  ptype == ProcessType::MultiParticleFourToTwo ||
90  ptype == ProcessType::MultiParticleFiveToTwo) {
91  ParticleTypePtrList ptype_list = cbranch.particle_types();
92  /* Sorting ensures unique name for every channel
93  * It avoids duplicates, such as Δ⁰Δ⁺⁺ and Δ⁺⁺Δ⁰,
94  * which actually occur in SMASH, because of the way channels are added:
95  * for example one channel can be added twice with halved cross-section. */
96  std::sort(ptype_list.begin(), ptype_list.end());
97  for (const auto& type : ptype_list) {
98  os << type->name();
99  }
100  } else {
101  os << ptype;
102  }
103  return os;
104 }
ProcessType
ProcessTypes are used to identify the type of the process.
Definition: processbranch.h:39
Here is the call graph for this function:

◆ format_debug_output() [3/3]

void smash::ScatterAction::format_debug_output ( std::ostream &  out) const
overrideprotectedvirtual

Writes information about this scatter action to the out stream.

Implements smash::Action.

Definition at line 897 of file scatteraction.cc.

897  {
898  out << "Scatter of " << incoming_particles_;
899  if (outgoing_particles_.empty()) {
900  out << " (not performed)";
901  } else {
902  out << " to " << outgoing_particles_;
903  }
904 }

◆ operator<<() [12/12]

std::ostream & smash::operator<< ( std::ostream &  out,
const ThreeVector v 
)

Writes the three components of the vector to the output stream.

Definition at line 16 of file threevector.cc.

16  {
17  out.put('(');
18  out.fill(' ');
19  for (auto x : v) {
20  out << field<8> << x;
21  }
22  return out << ')';
23 }

Variable Documentation

◆ value

template<typename T >
const T& smash::FormattingHelper< T >::value

Value that is being formatted.

Definition at line 177 of file logging.h.

◆ width

template<typename T >
const int smash::FormattingHelper< T >::width

Output width.

Definition at line 179 of file logging.h.

◆ precision

template<typename T >
const int smash::FormattingHelper< T >::precision

Precision that value is being formatted with.

Definition at line 181 of file logging.h.

◆ unit

template<typename T >
const char* const smash::FormattingHelper< T >::unit

Unit that is attached at the end of value.

Definition at line 183 of file logging.h.

◆ logg

std::array<einhard::Logger<>, std::tuple_size<LogArea::AreaTuple>::value>& smash::logg = get_loggers()
inline

An array that stores all pre-configured Logger objects.

To access its elements use logg[LAreaName] where LAreaName is the respective area identifier declared in the smash namespace of the file containing the log statement.

Note that LAreaName needs to be declared within the smash namespace of the respective file in a form of (using PauliBlocking as an example area):

static constexpr int LPauliBlocking = LogArea::PauliBlocking::id;

Definition at line 245 of file logging.h.

Friends

◆ operator<< [1/10]

std::ostream& operator<< ( std::ostream &  out,
const Action action 
)
friend

Dispatches formatting to the virtual Action::format_debug_output function.

Definition at line 496 of file action.h.

496  {
497  action.format_debug_output(out);
498  return out;
499  }

◆ operator<< [2/10]

std::ostream& operator<< ( std::ostream &  out,
const BoxModus m 
)
friend

Console output on startup of box specific parameters; writes the initial state for the box to the output stream.

Parameters
[in]outThe ostream into which to output
[in]mThe BoxModus object to write into out

Definition at line 33 of file boxmodus.cc.

33  {
34  out << "-- Box Modus:\nSize of the box: (" << m.length_ << " fm)³\n";
35  if (m.use_thermal_) {
36  out << "Thermal multiplicities "
37  << "(T = " << m.temperature_ << " GeV, muB = " << m.mub_
38  << " GeV, muS = " << m.mus_ << " GeV, muQ = " << m.muq_ << " GeV)\n";
39  } else {
40  for (const auto &p : m.init_multipl_) {
41  ParticleTypePtr ptype = &ParticleType::find(p.first);
42  out << ptype->name() << " initial multiplicity " << p.second << '\n';
43  }
44  }
45  switch (m.initial_condition_) {
47  out << "All initial momenta = 3T = " << 3 * m.temperature_ << " GeV\n";
48  break;
50  out << "Boltzmann momentum distribution with T = " << m.temperature_
51  << " GeV.\n";
52  break;
54  out << "Fermi/Bose momentum distribution with T = " << m.temperature_
55  << " GeV.\n";
56  break;
57  }
58  if (m.jet_pdg_) {
59  ParticleTypePtr ptype = &ParticleType::find(m.jet_pdg_.value());
60  out << "Adding a " << ptype->name() << " as a jet in the middle "
61  << "of the box with " << m.jet_mom_ << " GeV initial momentum.\n";
62  }
63  return out;
64 }
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
Definition: particletype.cc:99
@ ThermalMomentaBoltzmann
A thermalized ensemble is generated, with momenta sampled from a Maxwell-Boltzmann distribution.
@ ThermalMomentaQuantum
A thermalized ensemble is generated, with momenta of baryons(mesons) sampled from a Fermi(Bose) distr...
@ PeakedMomenta
All particles have the same momentum with T being the temperature.

◆ operator<< [3/10]

std::ostream& operator<< ( std::ostream &  out,
const ColliderModus m 
)
friend

Writes the initial state for the ColliderModus to the output stream.

Parameters
[in]outThe ostream into which to output
[in]mThe ColliderModus object to write into out

Definition at line 352 of file collidermodus.cc.

352  {
353  return out << "-- Collider Modus:\n"
354  << "sqrt(S) (nucleus-nucleus) = "
355  << format(std::sqrt(m.total_s_), "GeV\n")
356  << "sqrt(S) (nucleon-nucleon) = " << format(m.sqrt_s_NN_, "GeV\n")
357  << "Projectile:\n"
358  << *m.projectile_ << "\nTarget:\n"
359  << *m.target_;
360 }

◆ operator<< [4/10]

template<typename Modus >
std::ostream& operator<< ( std::ostream &  out,
const Experiment< Modus > &  e 
)
friend

Writes the initial state for the Experiment to the output stream.

It automatically appends the output of the current Modus.

Definition at line 727 of file experiment.h.

727  {
728  out << "End time: " << e.end_time_ << " fm\n";
729  out << e.modus_;
730  return out;
731 }

◆ operator<< [5/10]

std::ostream& operator<< ( std::ostream &  out,
const ListModus m 
)
friend

Writes the initial state for the List to the output stream.

Parameters
[in]outThe ostream into which to output
[in]mThe ListModus object to write into out

Definition at line 101 of file listmodus.cc.

101  {
102  out << "-- List Modus\nInput directory for external particle lists:\n"
103  << m.particle_list_file_directory_ << "\n";
104  return out;
105 }

◆ operator<< [6/10]

template<typename T >
std::ostream& operator<< ( std::ostream &  out,
const FormattingHelper< T > &  h 
)
friend

Nicely formatted output.

Parameters
outOutput stream
hFormattingHelper with given output parameters.

Definition at line 189 of file logging.h.

190  {
191  if (h.width > 0) {
192  out << std::setfill(' ') << std::setw(h.width);
193  }
194  if (h.precision >= 0) {
195  out << std::setprecision(h.precision);
196  }
197  out << h.value;
198  if (h.unit) {
199  out << ' ' << h.unit;
200  }
201  return out;
202  }

◆ operator<< [7/10]

std::ostream& operator<< ( std::ostream &  out,
const Nucleus n 
)
friend

Writes the state of the Nucleus object to the output stream.

Definition at line 579 of file nucleus.cc.

579  {
580  return out << " #particles #testparticles mass [GeV] "
581  "radius [fm] diffusiveness [fm]\n"
582  << format(n.number_of_particles(), nullptr, 12)
583  << format(n.size(), nullptr, 17) << format(n.mass(), nullptr, 13)
584  << format(n.get_nuclear_radius(), nullptr, 14)
585  << format(n.get_diffusiveness(), nullptr, 20);
586 }
constexpr int n
Neutron.

◆ operator<< [8/10]

std::ostream& operator<< ( std::ostream &  out,
const Particles particles 
)
friend

Print effective mass and type name for all particles to the stream.

Parameters
[in]outThe ostream into which to output
[in]particlesThe Particles object to write into out

Definition at line 148 of file particles.cc.

148  {
149  out << particles.size() << " Particles:\n";
150  for (unsigned i = 0; i < particles.data_size_; ++i) {
151  const auto &p = particles.data_[i];
152  if (p.id() < 0) {
153  out << "------ ";
154  } else {
155  out << std::setw(5) << std::setprecision(3) << p.momentum().abs3()
156  << p.type().name();
157  }
158  if ((i & 15) == 0) {
159  out << '\n';
160  }
161  }
162  return out;
163 }

◆ operator<< [9/10]

std::ostream& operator<< ( std::ostream &  out,
const ParticleType type 
)
friend

Writes all information about the particle type to the output stream.

Parameters
[out]outThe ostream into which to output
[in]typeThe ParticleType object to write into out

Definition at line 827 of file particletype.cc.

827  {
828  const PdgCode &pdg = type.pdgcode();
829  return out << type.name() << std::setfill(' ') << std::right
830  << "[ mass:" << field<6> << type.mass()
831  << ", width:" << field<6> << type.width_at_pole()
832  << ", PDG:" << field<6> << pdg
833  << ", charge:" << field<3> << pdg.charge()
834  << ", spin:" << field<2> << pdg.spin() << "/2 ]";
835 }

◆ operator<< [10/10]

std::ostream& operator<< ( std::ostream &  out,
const SphereModus m 
)
friend

Writes the initial state for the Sphere to the output stream.

Parameters
[in]outThe ostream into which to output
[in]mThe SphereModus object to write into out

Definition at line 89 of file spheremodus.cc.

89  {
90  out << "-- Sphere Modus:\nRadius of the sphere: " << m.radius_ << " fm\n";
91  if (m.use_thermal_) {
92  out << "Thermal multiplicities (T = " << m.sphere_temperature_
93  << " GeV, muB = " << m.mub_ << " GeV, muS = " << m.mus_
94  << " GeV, muQ = " << m.muq_ << " GeV)\n";
95  } else {
96  for (const auto &p : m.init_multipl_) {
97  ParticleTypePtr ptype = &ParticleType::find(p.first);
98  out << ptype->name() << " initial multiplicity " << p.second << '\n';
99  }
100  }
101  switch (m.init_distr_) {
103  out << "Boltzmann momentum distribution with T = "
104  << m.sphere_temperature_ << " GeV.\n";
105  break;
107  out << "Fermi/Bose momentum distribution with T = "
108  << m.sphere_temperature_ << " GeV.\n";
109  break;
111  out << "Sphere Initial Condition is IC_ES";
112  break;
114  out << "Sphere Initial Condition is IC_1M";
115  break;
117  out << "Sphere Initial Condition is IC_2M";
118  break;
120  out << "Sphere Initial Condition is IC_Massive";
121  break;
122  }
123  if (m.jet_pdg_) {
124  ParticleTypePtr ptype = &ParticleType::find(m.jet_pdg_.value());
125  const auto pos = m.jet_pos_;
126  if (m.jet_back_) {
127  ParticleTypePtr anti =
128  ptype->has_antiparticle() ? ptype->get_antiparticle() : ptype;
129  out << "Adding a dijet " << ptype->name() << anti->name()
130  << " centered at (" << pos.x1() << ", " << pos.x2() << ", "
131  << pos.x3() << ") separated by " << m.jet_back_separation_
132  << " fm,\neach with " << m.jet_mom_ << " GeV of initial momentum.\n";
133  } else {
134  out << "Adding a " << ptype->name() << " as a jet at (" << pos.x1()
135  << ", " << pos.x2() << ", " << pos.x3() << ") fm with " << m.jet_mom_
136  << " GeV of initial momentum.\n";
137  }
138  }
139  return out;
140 }
@ ThermalMomentaBoltzmann
A thermalized ensemble is generated, with momenta sampled from a Maxwell-Boltzmann distribution.
@ IC_ES
Off-equilibrium distribution used in massless comparisons of SMASH to the extended universe metric.
@ ThermalMomentaQuantum
A thermalized ensemble is generated, with momenta of baryons(mesons) sampled from a Fermi(Bose) distr...
@ IC_Massive
A generalization of IC_ES for the non-zero mass case; note that there is currently no analytical comp...
@ IC_2M
Off-equilibrium distribution used in massless comparisons of SMASH to the extended universe metric.
@ IC_1M
Off-equilibrium distribution used in massless comparisons of SMASH to the extended universe metric.