Constructor.
Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).
261 Configuration modus_cfg = modus_config[
"Collider"];
264 if (modus_cfg.has_value({
"Calculation_Frame"})) {
265 frame_ = modus_cfg.take({
"Calculation_Frame"});
269 if (modus_cfg.has_value({
"Collisions_Within_Nucleus"})) {
274 Configuration proj_cfg = modus_cfg[
"Projectile"];
275 if (proj_cfg.has_value({
"Deformed"})) {
278 }
else if (proj_cfg.has_value({
"Custom"})) {
279 projectile_ = make_unique<CustomNucleus>(proj_cfg, params.testparticles);
281 projectile_ = make_unique<Nucleus>(proj_cfg, params.testparticles);
284 throw ColliderEmpty(
"Input Error: Projectile nucleus is empty.");
288 Configuration targ_cfg = modus_cfg[
"Target"];
289 if (targ_cfg.has_value({
"Deformed"})) {
291 }
else if (targ_cfg.has_value({
"Custom"})) {
292 target_ = make_unique<CustomNucleus>(targ_cfg, params.testparticles);
294 target_ = make_unique<Nucleus>(targ_cfg, params.testparticles);
297 throw ColliderEmpty(
"Input Error: Target nucleus is empty.");
301 if (modus_cfg.has_value({
"Fermi_Motion"})) {
310 int energy_input = 0;
312 const double mass_target =
target_->mass();
314 const double mass_a =
316 const double mass_b =
target_->mass() /
target_->number_of_particles();
318 if (modus_cfg.has_value({
"Sqrtsnn"})) {
322 throw ModusDefault::InvalidEnergy(
323 "Input Error: sqrt(s_NN) is not larger than masses:\n" +
324 std::to_string(
sqrt_s_NN_) +
" GeV <= " + std::to_string(mass_a) +
325 " GeV + " + std::to_string(mass_b) +
" GeV.");
329 mass_projec * mass_target / (mass_a * mass_b) +
330 mass_projec * mass_projec + mass_target * mass_target;
335 if (modus_cfg.has_value({
"E_Kin"})) {
336 const double e_kin = modus_cfg.take({
"E_Kin"});
338 throw ModusDefault::InvalidEnergy(
340 "E_Kin must be nonnegative.");
344 mass_projec, mass_target);
349 if (modus_cfg.has_value({
"P_Lab"})) {
350 const double p_lab = modus_cfg.take({
"P_Lab"});
352 throw ModusDefault::InvalidEnergy(
354 "P_Lab must be nonnegative.");
358 mass_projec, mass_target);
359 sqrt_s_NN_ = std::sqrt(
s_from_plab(p_lab, mass_a, mass_b));
362 if (energy_input == 0) {
363 throw std::domain_error(
364 "Input Error: Non-existent collision energy. " 365 "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
367 if (energy_input > 1) {
368 throw std::domain_error(
369 "Input Error: Redundant collision energy. " 370 "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
375 if (modus_cfg.has_value({
"Impact",
"Value"})) {
376 impact_ = modus_cfg.take({
"Impact",
"Value"});
381 if (modus_cfg.has_value({
"Impact",
"Sample"})) {
382 sampling_ = modus_cfg.take({
"Impact",
"Sample"});
384 if (!(modus_cfg.has_value({
"Impact",
"Values"}) ||
385 modus_cfg.has_value({
"Impact",
"Yields"}))) {
386 throw std::domain_error(
387 "Input Error: Need impact parameter spectrum for custom " 389 "Please provide Values and Yields.");
391 const std::vector<double> impacts =
392 modus_cfg.take({
"Impact",
"Values"});
393 const std::vector<double> yields = modus_cfg.take({
"Impact",
"Yields"});
394 if (impacts.size() != yields.size()) {
395 throw std::domain_error(
396 "Input Error: Need as many impact parameter values as yields. " 397 "Please make sure that Values and Yields have the same length.");
400 InterpolateDataLinear<double>(impacts, yields));
402 const auto imp_minmax =
403 std::minmax_element(impacts.begin(), impacts.end());
406 yield_max_ = *std::max_element(yields.begin(), yields.end());
409 if (modus_cfg.has_value({
"Impact",
"Range"})) {
410 const std::array<double, 2> range = modus_cfg.take({
"Impact",
"Range"});
414 if (modus_cfg.has_value({
"Impact",
"Max"})) {
416 imp_max_ = modus_cfg.take({
"Impact",
"Max"});
422 if (modus_cfg.has_value({
"Initial_Distance"})) {
double yield_max_
Maximum value of yield. Needed for custom impact parameter sampling.
static std::unique_ptr< DeformedNucleus > create_deformed_nucleus(Configuration &nucleus_cfg, const int ntest, const std::string &nucleus_type)
Configure Deformed Nucleus.
double impact_
Impact parameter.
std::unique_ptr< InterpolateDataLinear< double > > impact_interpolation_
Pointer to the impact parameter interpolation.
double imp_min_
Minimum value of impact parameter.
std::unique_ptr< Nucleus > projectile_
Projectile.
Sampling sampling_
Method used for sampling of impact parameter.
double s_from_plab(double plab, double m_P, double m_T)
Convert p_lab to Mandelstam-s for a fixed-target setup, with a projectile of mass m_P and momentum pl...
Sample from custom, user-defined distribution.
FermiMotion fermi_motion_
An option to include Fermi motion ("off", "on", "frozen")
double initial_z_displacement_
Initial z-displacement of nuclei.
double sqrt_s_NN_
Center-of-mass energy of a nucleon-nucleon collision.
bool cll_in_nucleus_
An option to accept first collisions within the same nucleus.
std::unique_ptr< Nucleus > target_
Target.
double imp_max_
Maximum value of impact parameter.
CalculationFrame frame_
Reference frame for the system, as specified from config.
double total_s_
Center-of-mass energy squared of the nucleus-nucleus collision.
double s_from_Ekin(double e_kin, double m_P, double m_T)
Convert E_kin to Mandelstam-s for a fixed-target setup, with a projectile of mass m_P and a kinetic e...