Constructor.
Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).
262 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"})) {
272 Configuration proj_cfg = modus_cfg[
"Projectile"];
273 Configuration targ_cfg = modus_cfg[
"Target"];
276 bool same_file =
false;
278 if (proj_cfg.has_value({
"Deformed"})) {
281 }
else if (proj_cfg.has_value({
"Custom"})) {
284 make_unique<CustomNucleus>(proj_cfg, params.testparticles, same_file);
286 projectile_ = make_unique<Nucleus>(proj_cfg, params.testparticles);
289 throw ColliderEmpty(
"Input Error: Projectile nucleus is empty.");
293 if (targ_cfg.has_value({
"Deformed"})) {
295 }
else if (targ_cfg.has_value({
"Custom"})) {
297 make_unique<CustomNucleus>(targ_cfg, params.testparticles, same_file);
299 target_ = make_unique<Nucleus>(targ_cfg, params.testparticles);
302 throw ColliderEmpty(
"Input Error: Target nucleus is empty.");
306 if (modus_cfg.has_value({
"Fermi_Motion"})) {
315 int energy_input = 0;
317 const double mass_target =
target_->mass();
319 const double mass_a =
321 const double mass_b =
target_->mass() /
target_->number_of_particles();
323 if (modus_cfg.has_value({
"Sqrtsnn"})) {
327 throw ModusDefault::InvalidEnergy(
328 "Input Error: sqrt(s_NN) is not larger than masses:\n" +
329 std::to_string(
sqrt_s_NN_) +
" GeV <= " + std::to_string(mass_a) +
330 " GeV + " + std::to_string(mass_b) +
" GeV.");
334 mass_projec * mass_target / (mass_a * mass_b) +
335 mass_projec * mass_projec + mass_target * mass_target;
340 if (modus_cfg.has_value({
"E_Kin"})) {
341 const double e_kin = modus_cfg.take({
"E_Kin"});
343 throw ModusDefault::InvalidEnergy(
345 "E_Kin must be nonnegative.");
349 mass_projec, mass_target);
354 if (modus_cfg.has_value({
"P_Lab"})) {
355 const double p_lab = modus_cfg.take({
"P_Lab"});
357 throw ModusDefault::InvalidEnergy(
359 "P_Lab must be nonnegative.");
363 mass_projec, mass_target);
364 sqrt_s_NN_ = std::sqrt(
s_from_plab(p_lab, mass_a, mass_b));
367 if (energy_input == 0) {
368 throw std::domain_error(
369 "Input Error: Non-existent collision energy. " 370 "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
372 if (energy_input > 1) {
373 throw std::domain_error(
374 "Input Error: Redundant collision energy. " 375 "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
380 if (modus_cfg.has_value({
"Impact",
"Value"})) {
381 impact_ = modus_cfg.take({
"Impact",
"Value"});
386 if (modus_cfg.has_value({
"Impact",
"Sample"})) {
387 sampling_ = modus_cfg.take({
"Impact",
"Sample"});
389 if (!(modus_cfg.has_value({
"Impact",
"Values"}) ||
390 modus_cfg.has_value({
"Impact",
"Yields"}))) {
391 throw std::domain_error(
392 "Input Error: Need impact parameter spectrum for custom " 394 "Please provide Values and Yields.");
396 const std::vector<double> impacts =
397 modus_cfg.take({
"Impact",
"Values"});
398 const std::vector<double> yields = modus_cfg.take({
"Impact",
"Yields"});
399 if (impacts.size() != yields.size()) {
400 throw std::domain_error(
401 "Input Error: Need as many impact parameter values as yields. " 402 "Please make sure that Values and Yields have the same length.");
405 InterpolateDataLinear<double>(impacts, yields));
407 const auto imp_minmax =
408 std::minmax_element(impacts.begin(), impacts.end());
411 yield_max_ = *std::max_element(yields.begin(), yields.end());
414 if (modus_cfg.has_value({
"Impact",
"Range"})) {
415 const std::array<double, 2> range = modus_cfg.take({
"Impact",
"Range"});
419 if (modus_cfg.has_value({
"Impact",
"Max"})) {
421 imp_max_ = modus_cfg.take({
"Impact",
"Max"});
427 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.
bool same_inputfile(Configuration &proj_config, Configuration &targ_config)
Checks if target and projectile are read from the same external file if they are both initialized as ...
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...