Version: SMASH-2.0
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.");

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;

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.

Namespaces

 smash::LogArea
 The namespace where log areas are declared.
 

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::Sampling
 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::HadronGasEos
 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::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 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, Sampling, Pythia, GrandcanThermalizer, CrossSections, Output, HadronGasEos, HyperSurfaceCrossing, InitialConditions, ScatterActionMulti >
 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
 
std::ostream & smash::operator<< (std::ostream &out, const ActionPtr &action)
 
std::ostream & smash::operator<< (std::ostream &out, const ActionList &actions)
 
std::ostream & smash::operator<< (std::ostream &out, const Angles &a)
 
void smash::DecayAction::format_debug_output (std::ostream &out) const override
 
std::ostream & smash::operator<< (std::ostream &, const EnergyMomentumTensor &)
 
std::ostream & smash::operator<< (std::ostream &os, const FourVector &vec)
 
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)
 
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...
 
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)
 
std::ostream & smash::operator<< (std::ostream &out, const ParticleList &particle_list)
 
PrintParticleListDetailed smash::detailed (const ParticleList &list)
 
std::ostream & smash::operator<< (std::ostream &out, const PrintParticleListDetailed &particle_list)
 
std::ostream & smash::operator<< (std::ostream &is, const PdgCode &code)
 
std::ostream & smash::operator<< (std::ostream &os, ProcessType process_type)
 
std::ostream & smash::operator<< (std::ostream &os, const CollisionBranch &cbranch)
 
void smash::ScatterAction::format_debug_output (std::ostream &out) const override
 
std::ostream & smash::operator<< (std::ostream &, const ThreeVector &)
 

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
 An array that stores all pre-configured Logger objects. More...
 

Friends

std::ostream & smash::Action::operator<< (std::ostream &out, const Action &action)
 
std::ostream & smash::BoxModus::operator<< (std::ostream &out, const BoxModus &m)
 
std::ostream & smash::ColliderModus::operator<< (std::ostream &, const ColliderModus &)
 
std::ostream & smash::Experiment< Modus >::operator<< (std::ostream &out, const Experiment &e)
 Creates a verbose textual description of the setup of the Experiment. More...
 
std::ostream & smash::ListModus::operator<< (std::ostream &, const ListModus &)
 
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 &)
 
std::ostream & smash::Particles::operator<< (std::ostream &out, const Particles &particles)
 
std::ostream & smash::ParticleType::operator<< (std::ostream &out, const ParticleType &type)
 
std::ostream & smash::SphereModus::operator<< (std::ostream &, const SphereModus &)
 

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 168 of file logging.h.

◆ source_location

#define 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 243 of file logging.h.

Typedef Documentation

◆ AreaTuple

This type collects all existing log areas so they will be created with the correct log level automatically.

Definition at line 226 of file logging.h.

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::ScatterAction, smash::DecayAction, smash::ScatterActionMulti, smash::HypersurfacecrossingAction, smash::WallcrossingAction, and smash::ThermalizationAction.

◆ operator<<() [1/12]

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

Convenience: dereferences the ActionPtr to Action.

Definition at line 518 of file action.h.

518  {
519  return out << *action;
520 }

◆ operator<<() [2/12]

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

Writes multiple actions to the out stream.

Definition at line 375 of file action.cc.

375  {
376  out << "ActionList {\n";
377  for (const auto &a : actions) {
378  out << "- " << a << '\n';
379  }
380  return out << '}';
381 }

◆ 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 184 of file angles.h.

184  {
185  return out << "φ:" << field << a.phi() << ", cos ϑ:" << field << a.costheta();
186 }
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 110 of file decayaction.cc.

110  {
111  out << "Decay of " << incoming_particles_ << " to " << outgoing_particles_
112  << ", sqrt(s)=" << format(sqrt_s(), "GeV", 11, 9);
113 }
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 144 of file energymomentumtensor.cc.

144  {
145  out.width(12);
146  for (size_t mu = 0; mu < 4; mu++) {
147  for (size_t nu = 0; nu < 4; nu++) {
148  out << std::setprecision(3) << std::setw(12) << std::fixed
149  << Tmn[EnergyMomentumTensor::tmn_index(mu, nu)];
150  }
151  out << std::endl;
152  }
153  return out;
154 }
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 36 of file fourvector.cc.

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

◆ 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 118 of file logging.cc.

118  {
119  create_all_loggers_impl<std::tuple_size<LogArea::AreaTuple>::value>(config);
120 }
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 22 of file logging.cc.

22 { return global_default_loglevel; }

◆ 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 24 of file logging.cc.

24  {
26 }
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 307 of file logging.h.

308  {
309  return {value, width, precision, unit};
310 }
Here is the caller graph for this function:

◆ 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 333 of file logging.h.

333  {
334  return Node{einhard::getLogLevelString(x)};
335  }
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 345 of file logging.h.

345  {
346  if (!node.IsScalar()) {
347  return false;
348  } else {
349  x = einhard::getLogLevel(node.Scalar());
350  return true;
351  }
352  }
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 114 of file particledata.cc.

114  {
115  out.fill(' ');
116  return out << p.type().name() << " (" << std::setw(5) << p.type().pdgcode()
117  << ")" << std::right << "{id:" << field<6> << p.id()
118  << ", process:" << field<4> << p.id_process()
119  << ", pos [fm]:" << p.position() << ", mom [GeV]:" << p.momentum()
120  << ", formation time [fm]:" << p.formation_time()
121  << ", cross section scaling factor:" << p.xsec_scaling_factor()
122  << "}";
123 }

◆ 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 125 of file particledata.cc.

125  {
126  auto column = out.tellp();
127  out << '[';
128  for (const auto &p : particle_list) {
129  if (out.tellp() - column >= 201) {
130  out << '\n';
131  column = out.tellp();
132  out << ' ';
133  }
134  out << std::setw(5) << std::setprecision(3) << p.momentum().abs3()
135  << p.type().name();
136  }
137  return out << ']';
138 }

◆ 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 486 of file particledata.h.

486  {
487  return {list};
488 }

◆ 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 140 of file particledata.cc.

141  {
142  bool first = true;
143  out << '[';
144  for (const auto &p : particle_list.list) {
145  if (first) {
146  first = false;
147  } else {
148  out << "\n ";
149  }
150  out << p;
151  }
152  return out << ']';
153 }

◆ 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 88 of file pdgcode.cc.

88  {
89  return s << code.string();
90 }
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 86 of file processbranch.cc.

86  {
87  switch (process_type) {
88  case ProcessType::None:
89  os << "None";
90  break;
92  os << "Elastic";
93  break;
94  case ProcessType::TwoToOne:
95  os << "TwoToOne";
96  break;
97  case ProcessType::TwoToTwo:
98  os << "TwoToTwo";
99  break;
100  case ProcessType::StringSoftSingleDiffractiveAX:
101  case ProcessType::StringSoftSingleDiffractiveXB:
102  case ProcessType::StringSoftDoubleDiffractive:
103  case ProcessType::StringSoftAnnihilation:
104  case ProcessType::StringSoftNonDiffractive:
105  os << "Soft String Excitation";
106  break;
107  case ProcessType::StringHard:
108  os << "Hard String via Pythia";
109  break;
110  case ProcessType::Decay:
111  os << "Decay";
112  break;
113  case ProcessType::Wall:
114  os << "Wall";
115  break;
117  os << "Hypersurface crossing";
118  break;
119  case ProcessType::MultiParticleThreeMesonsToOne:
120  os << "3MesonsToOne";
121  break;
122  default:
123  os.setstate(std::ios_base::failbit);
124  }
125  return os;
126 }

◆ 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 55 of file processbranch.cc.

55  {
56  ProcessType ptype = cbranch.get_type();
57  if (ptype == ProcessType::StringSoftSingleDiffractiveAX ||
58  ptype == ProcessType::StringSoftSingleDiffractiveXB) {
59  os << "1-diff";
60  } else if (ptype == ProcessType::StringSoftDoubleDiffractive) {
61  os << "2-diff";
62  } else if (ptype == ProcessType::StringSoftAnnihilation) {
63  os << "BBbar";
64  } else if (ptype == ProcessType::StringSoftNonDiffractive) {
65  os << "non-diff";
66  } else if (ptype == ProcessType::StringHard) {
67  os << "hard";
68  } else if (ptype == ProcessType::TwoToOne || ptype == ProcessType::TwoToTwo ||
69  ptype == ProcessType::Elastic || ptype == ProcessType::Decay ||
70  ptype == ProcessType::MultiParticleThreeMesonsToOne) {
71  ParticleTypePtrList ptype_list = cbranch.particle_types();
72  /* Sorting ensures unique name for every channel
73  * It avoids duplicates, such as Δ⁰Δ⁺⁺ and Δ⁺⁺Δ⁰,
74  * which actually occur in SMASH, because of the way channels are added:
75  * for example one channel can be added twice with halved cross-section. */
76  std::sort(ptype_list.begin(), ptype_list.end());
77  for (const auto& type : ptype_list) {
78  os << type->name();
79  }
80  } else {
81  os << ptype;
82  }
83  return os;
84 }
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 538 of file scatteraction.cc.

538  {
539  out << "Scatter of " << incoming_particles_;
540  if (outgoing_particles_.empty()) {
541  out << " (not performed)";
542  } else {
543  out << " to " << outgoing_particles_;
544  }
545 }

◆ 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 267 of file logging.h.

◆ width

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

Output width.

Definition at line 269 of file logging.h.

◆ precision

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

Precision that value is being formatted with.

Definition at line 271 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 273 of file logging.h.

◆ logg

std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > smash::logg

An array that stores all pre-configured Logger objects.

The objects can be accessed via the logger function.

To access its elements use logg[LAreaName] where AreaName is the respective areas name declared in loggin.h. 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;

For further documentation see logging.h.

Definition at line 39 of file logging.cc.

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 468 of file action.h.

468  {
469  action.format_debug_output(out);
470  return out;
471  }

◆ 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 31 of file boxmodus.cc.

31  {
32  out << "-- Box Modus:\nSize of the box: (" << m.length_ << " fm)³\n";
33  if (m.use_thermal_) {
34  out << "Thermal multiplicities "
35  << "(T = " << m.temperature_ << " GeV, muB = " << m.mub_
36  << " GeV, muS = " << m.mus_ << " GeV, muQ = " << m.muq_ << " GeV)\n";
37  } else {
38  for (const auto &p : m.init_multipl_) {
39  ParticleTypePtr ptype = &ParticleType::find(p.first);
40  out << ptype->name() << " initial multiplicity " << p.second << '\n';
41  }
42  }
43  switch (m.initial_condition_) {
45  out << "All initial momenta = 3T = " << 3 * m.temperature_ << " GeV\n";
46  break;
48  out << "Boltzmann momentum distribution with T = " << m.temperature_
49  << " GeV.\n";
50  break;
52  out << "Fermi/Bose momentum distribution with T = " << m.temperature_
53  << " GeV.\n";
54  break;
55  }
56  if (m.insert_jet_) {
57  ParticleTypePtr ptype = &ParticleType::find(m.jet_pdg_);
58  out << "Adding a " << ptype->name() << " as a jet in the middle "
59  << "of the box with " << m.jet_mom_ << " GeV initial momentum.\n";
60  }
61  return out;
62 }

◆ 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 443 of file collidermodus.cc.

443  {
444  return out << "-- Collider Modus:\n"
445  << "sqrt(S) (nucleus-nucleus) = "
446  << format(std::sqrt(m.total_s_), "GeV\n")
447  << "sqrt(S) (nucleon-nucleon) = " << format(m.sqrt_s_NN_, "GeV\n")
448  << "Projectile:\n"
449  << *m.projectile_ << "\nTarget:\n"
450  << *m.target_;
451 }

◆ operator<< [4/10]

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

Creates a verbose textual description of the setup of the Experiment.

Writes the initial state for the Experiment to the output stream. It automatically appends the output of the current Modus.

Definition at line 580 of file experiment.h.

580  {
581  out << "End time: " << e.end_time_ << " fm/c\n";
582  out << e.modus_;
583  return out;
584 }

◆ 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 129 of file listmodus.cc.

129  {
130  out << "-- List Modus\nInput directory for external particle lists:\n"
131  << m.particle_list_file_directory_ << "\n";
132  return out;
133 }

◆ 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 279 of file logging.h.

280  {
281  if (h.width > 0) {
282  out << std::setfill(' ') << std::setw(h.width);
283  }
284  if (h.precision >= 0) {
285  out << std::setprecision(h.precision);
286  }
287  out << h.value;
288  if (h.unit) {
289  out << ' ' << h.unit;
290  }
291  return out;
292  }

◆ 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 509 of file nucleus.cc.

509  {
510  return out << " #particles #testparticles mass [GeV] "
511  "radius [fm] diffusiveness [fm]\n"
512  << format(n.number_of_particles(), nullptr, 12)
513  << format(n.size(), nullptr, 17) << format(n.mass(), nullptr, 13)
514  << format(n.get_nuclear_radius(), nullptr, 14)
515  << format(n.get_diffusiveness(), nullptr, 20);
516 }

◆ 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 761 of file particletype.cc.

761  {
762  const PdgCode &pdg = type.pdgcode();
763  return out << type.name() << std::setfill(' ') << std::right
764  << "[ mass:" << field<6> << type.mass()
765  << ", width:" << field<6> << type.width_at_pole()
766  << ", PDG:" << field<6> << pdg
767  << ", charge:" << field<3> << pdg.charge()
768  << ", spin:" << field<2> << pdg.spin() << "/2 ]";
769 }

◆ 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 189 of file spheremodus.cc.

189  {
190  out << "-- Sphere Modus:\nRadius of the sphere: " << m.radius_ << " fm\n";
191  if (m.use_thermal_) {
192  out << "Thermal multiplicities (T = " << m.sphere_temperature_
193  << " GeV, muB = " << m.mub_ << " GeV, muS = " << m.mus_ << " GeV)\n";
194  } else {
195  for (const auto &p : m.init_multipl_) {
196  ParticleTypePtr ptype = &ParticleType::find(p.first);
197  out << ptype->name() << " initial multiplicity " << p.second << '\n';
198  }
199  }
200  switch (m.init_distr_) {
202  out << "Boltzmann momentum distribution with T = "
203  << m.sphere_temperature_ << " GeV.\n";
204  break;
206  out << "Fermi/Bose momentum distribution with T = "
207  << m.sphere_temperature_ << " GeV.\n";
208  break;
210  out << "Sphere Initial Condition is IC_ES";
211  break;
213  out << "Sphere Initial Condition is IC_1M";
214  break;
216  out << "Sphere Initial Condition is IC_2M";
217  break;
219  out << "Sphere Initial Condition is IC_Massive";
220  break;
221  }
222  if (m.insert_jet_) {
223  ParticleTypePtr ptype = &ParticleType::find(m.jet_pdg_);
224  out << "Adding a " << ptype->name() << " as a jet in the middle "
225  << "of the sphere with " << m.jet_mom_ << " GeV initial momentum.\n";
226  }
227  return out;
228 }
SphereInitialCondition::IC_Massive
smash::Action::incoming_particles_
ParticleList incoming_particles_
List with data of incoming particles.
Definition: action.h:326
SphereInitialCondition::IC_2M
smash::LPauliBlocking
static constexpr int LPauliBlocking
Definition: action.cc:26
SphereInitialCondition::ThermalMomentaBoltzmann
smash::field
std::basic_ostream< CharT, Traits > & field(std::basic_ostream< CharT, Traits > &s)
Definition: iomanipulators.h:30
Elastic
Definition: forwarddeclarations.h:218
smash::logg
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
Definition: logging.cc:39
smash::ParticleType::find
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
Definition: particletype.cc:99
smash::global_default_loglevel
static einhard::LogLevel global_default_loglevel
The default logging level is ALL.
Definition: logging.cc:20
source_location
#define source_location
Hackery that is required to output the location in the source code where the log statement occurs.
Definition: logging.h:243
smash::format
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:307
SphereInitialCondition::ThermalMomentaQuantum
ThermodynamicQuantity::Tmn
SphereInitialCondition::IC_1M
BoxInitialCondition::ThermalMomentaQuantum
einhard::getLogLevelString
const char * getLogLevelString() noexcept
Retrieve a human readable representation of the given log level value.
smash::HyperSurfaceCrossing
static constexpr int HyperSurfaceCrossing
Definition: binaryoutput.cc:22
SphereInitialCondition::IC_ES
BoxInitialCondition::ThermalMomentaBoltzmann
smash::Action::outgoing_particles_
ParticleList outgoing_particles_
Initially this stores only the PDG codes of final-state particles.
Definition: action.h:334
smash::Action::sqrt_s
double sqrt_s() const
Determine the total energy in the center-of-mass frame [GeV].
Definition: action.h:266
BoxInitialCondition::PeakedMomenta
smash::pdg::p
constexpr int p
Proton.
Definition: pdgcode_constants.h:28
smash::pdg::n
constexpr int n
Neutron.
Definition: pdgcode_constants.h:30
einhard::getLogLevel
LogLevel getLogLevel(const std::string &level)
Compares the string level against the strings for LogLevel and returns the one it matches.
smash::ProcessType
ProcessType
Process Types are used to identify the type of the process.
Definition: processbranch.h:25