Constructor.
Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).
258 Configuration modus_cfg = modus_config[
"Collider"];
261 if (modus_cfg.has_value({
"Calculation_Frame"})) {
262 frame_ = modus_cfg.take({
"Calculation_Frame"});
266 if (modus_cfg.has_value({
"Collisions_Within_Nucleus"})) {
271 Configuration proj_cfg = modus_cfg[
"Projectile"];
272 if (proj_cfg.has_value({
"Deformed"})) {
276 projectile_ = make_unique<Nucleus>(proj_cfg, params.testparticles);
279 throw ColliderEmpty(
"Input Error: Projectile nucleus is empty.");
283 Configuration targ_cfg = modus_cfg[
"Target"];
284 if (targ_cfg.has_value({
"Deformed"})) {
287 target_ = make_unique<Nucleus>(targ_cfg, params.testparticles);
290 throw ColliderEmpty(
"Input Error: Target nucleus is empty.");
294 if (modus_cfg.has_value({
"Fermi_Motion"})) {
303 int energy_input = 0;
305 const double mass_target =
target_->mass();
307 const double mass_a =
309 const double mass_b =
target_->mass() /
target_->number_of_particles();
311 if (modus_cfg.has_value({
"Sqrtsnn"})) {
315 throw ModusDefault::InvalidEnergy(
316 "Input Error: sqrt(s_NN) is not larger than masses:\n" +
317 std::to_string(
sqrt_s_NN_) +
" GeV <= " + std::to_string(mass_a) +
318 " GeV + " + std::to_string(mass_b) +
" GeV.");
322 mass_projec * mass_target / (mass_a * mass_b) +
323 mass_projec * mass_projec + mass_target * mass_target;
328 if (modus_cfg.has_value({
"E_Kin"})) {
329 const double e_kin = modus_cfg.take({
"E_Kin"});
331 throw ModusDefault::InvalidEnergy(
333 "E_Kin must be nonnegative.");
337 mass_projec, mass_target);
342 if (modus_cfg.has_value({
"P_Lab"})) {
343 const double p_lab = modus_cfg.take({
"P_Lab"});
345 throw ModusDefault::InvalidEnergy(
347 "P_Lab must be nonnegative.");
351 mass_projec, mass_target);
355 if (energy_input == 0) {
356 throw std::domain_error(
357 "Input Error: Non-existent collision energy. " 358 "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
360 if (energy_input > 1) {
361 throw std::domain_error(
362 "Input Error: Redundant collision energy. " 363 "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
368 if (modus_cfg.has_value({
"Impact",
"Value"})) {
369 impact_ = modus_cfg.take({
"Impact",
"Value"});
374 if (modus_cfg.has_value({
"Impact",
"Sample"})) {
375 sampling_ = modus_cfg.take({
"Impact",
"Sample"});
377 if (!(modus_cfg.has_value({
"Impact",
"Values"}) ||
378 modus_cfg.has_value({
"Impact",
"Yields"}))) {
379 throw std::domain_error(
380 "Input Error: Need impact parameter spectrum for custom " 382 "Please provide Values and Yields.");
384 const std::vector<double> impacts =
385 modus_cfg.take({
"Impact",
"Values"});
386 const std::vector<double> yields = modus_cfg.take({
"Impact",
"Yields"});
387 if (impacts.size() != yields.size()) {
388 throw std::domain_error(
389 "Input Error: Need as many impact parameter values as yields. " 390 "Please make sure that Values and Yields have the same length.");
393 InterpolateDataLinear<double>(impacts, yields));
395 const auto imp_minmax =
396 std::minmax_element(impacts.begin(), impacts.end());
399 yield_max_ = *std::max_element(yields.begin(), yields.end());
402 if (modus_cfg.has_value({
"Impact",
"Range"})) {
403 const std::array<double, 2> range = modus_cfg.take({
"Impact",
"Range"});
407 if (modus_cfg.has_value({
"Impact",
"Max"})) {
409 imp_max_ = modus_cfg.take({
"Impact",
"Max"});
415 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...