Constructor.
Takes all there is to take from the (truncated!) configuration object (only contains configuration for this modus).
33 Configuration modus_cfg =
34 modus_config.extract_sub_configuration({
"Collider"});
36 if (modus_cfg.has_value({
"Calculation_Frame"})) {
37 frame_ = modus_cfg.take({
"Calculation_Frame"});
40 Configuration proj_cfg = modus_cfg.extract_sub_configuration({
"Projectile"});
41 Configuration targ_cfg = modus_cfg.extract_sub_configuration({
"Target"});
44 bool same_file =
false;
46 if (proj_cfg.has_value({
"Deformed"})) {
49 }
else if (proj_cfg.has_value({
"Custom"})) {
52 proj_cfg, params.testparticles, same_file);
54 projectile_ = std::make_unique<Nucleus>(proj_cfg, params.testparticles);
57 throw ColliderEmpty(
"Input Error: Projectile nucleus is empty.");
62 if (targ_cfg.has_value({
"Deformed"})) {
64 }
else if (targ_cfg.has_value({
"Custom"})) {
65 target_ = std::make_unique<CustomNucleus>(targ_cfg, params.testparticles,
68 target_ = std::make_unique<Nucleus>(targ_cfg, params.testparticles);
71 throw ColliderEmpty(
"Input Error: Target nucleus is empty.");
76 if (modus_cfg.has_value({
"Fermi_Motion"})) {
85 const double mass_target =
target_->mass();
89 const double mass_b =
target_->mass() /
target_->number_of_particles();
91 if (modus_cfg.has_value({
"Sqrtsnn"})) {
95 throw ModusDefault::InvalidEnergy(
96 "Input Error: sqrt(s_NN) is not larger than masses:\n" +
97 std::to_string(
sqrt_s_NN_) +
" GeV <= " + std::to_string(mass_a) +
98 " GeV + " + std::to_string(mass_b) +
" GeV.");
102 mass_projec * mass_target / (mass_a * mass_b) +
103 mass_projec * mass_projec + mass_target * mass_target;
108 if (modus_cfg.has_value({
"E_Tot"})) {
109 const double e_tot = modus_cfg.take({
"E_Tot"});
111 throw ModusDefault::InvalidEnergy(
113 "E_Tot must be nonnegative.");
117 mass_projec, mass_target);
123 if (modus_cfg.has_value({
"E_Kin"})) {
124 const double e_kin = modus_cfg.take({
"E_Kin"});
126 throw ModusDefault::InvalidEnergy(
128 "E_Kin must be nonnegative.");
132 mass_projec, mass_target);
137 if (modus_cfg.has_value({
"P_Lab"})) {
138 const double p_lab = modus_cfg.take({
"P_Lab"});
140 throw ModusDefault::InvalidEnergy(
142 "P_Lab must be nonnegative.");
146 mass_projec, mass_target);
151 if (proj_cfg.has_value({
"E_Tot"}) && targ_cfg.has_value({
"E_Tot"})) {
152 const double e_tot_p = proj_cfg.take({
"E_Tot"});
153 const double e_tot_t = targ_cfg.take({
"E_Tot"});
154 if (e_tot_p < 0 || e_tot_t < 0) {
155 throw ModusDefault::InvalidEnergy(
157 "E_Tot must be nonnegative.");
160 e_tot_t *
target_->number_of_particles(),
161 mass_projec, mass_target);
166 if (proj_cfg.has_value({
"E_Kin"}) && targ_cfg.has_value({
"E_Kin"})) {
167 const double e_kin_p = proj_cfg.take({
"E_Kin"});
168 const double e_kin_t = targ_cfg.take({
"E_Kin"});
169 if (e_kin_p < 0 || e_kin_t < 0) {
170 throw ModusDefault::InvalidEnergy(
172 "E_Kin must be nonnegative.");
175 e_kin_t *
target_->number_of_particles(),
176 mass_projec, mass_target);
181 if (proj_cfg.has_value({
"P_Lab"}) && targ_cfg.has_value({
"P_Lab"})) {
182 const double p_lab_p = proj_cfg.take({
"P_Lab"});
183 const double p_lab_t = targ_cfg.take({
"P_Lab"});
184 if (p_lab_p < 0 || p_lab_t < 0) {
185 throw ModusDefault::InvalidEnergy(
187 "P_Lab must be nonnegative.");
190 p_lab_t *
target_->number_of_particles(),
191 mass_projec, mass_target);
195 if (energy_input == 0) {
196 throw std::domain_error(
197 "Input Error: Non-existent collision energy. "
198 "Please provide one of Sqrtsnn/E_Kin/P_Lab.");
200 if (energy_input > 1) {
201 throw std::domain_error(
202 "Input Error: Redundant collision energy. "
203 "Please provide only one of Sqrtsnn/E_Kin/P_Lab.");
208 if (modus_cfg.has_value({
"Impact",
"Value"})) {
209 impact_ = modus_cfg.take({
"Impact",
"Value"});
214 if (modus_cfg.has_value({
"Impact",
"Sample"})) {
215 sampling_ = modus_cfg.take({
"Impact",
"Sample"});
217 if (!(modus_cfg.has_value({
"Impact",
"Values"}) ||
218 modus_cfg.has_value({
"Impact",
"Yields"}))) {
219 throw std::domain_error(
220 "Input Error: Need impact parameter spectrum for custom "
222 "Please provide Values and Yields.");
224 const std::vector<double> impacts =
225 modus_cfg.take({
"Impact",
"Values"});
226 const std::vector<double> yields = modus_cfg.take({
"Impact",
"Yields"});
227 if (impacts.size() != yields.size()) {
228 throw std::domain_error(
229 "Input Error: Need as many impact parameter values as yields. "
230 "Please make sure that Values and Yields have the same length.");
233 InterpolateDataLinear<double>(impacts, yields));
235 const auto imp_minmax =
236 std::minmax_element(impacts.begin(), impacts.end());
239 yield_max_ = *std::max_element(yields.begin(), yields.end());
242 if (modus_cfg.has_value({
"Impact",
"Range"})) {
243 const std::array<double, 2> range = modus_cfg.take({
"Impact",
"Range"});
247 if (modus_cfg.has_value({
"Impact",
"Max"})) {
249 imp_max_ = modus_cfg.take({
"Impact",
"Max"});
255 modus_cfg.take({
"Impact",
"Random_Reaction_Plane"},
false);
257 if (modus_cfg.has_value({
"Initial_Distance"})) {
CalculationFrame frame_
Reference frame for the system, as specified from config.
double imp_min_
Minimum value of impact parameter.
double initial_z_displacement_
Initial z-displacement of nuclei.
double yield_max_
Maximum value of yield. Needed for custom impact parameter sampling.
bool random_reaction_plane_
Whether the reaction plane should be randomized.
std::unique_ptr< Nucleus > projectile_
Projectile.
std::unique_ptr< InterpolateDataLinear< double > > impact_interpolation_
Pointer to the impact parameter interpolation.
FermiMotion fermi_motion_
An option to include Fermi motion ("off", "on", "frozen")
Sampling sampling_
Method used for sampling of impact parameter.
double total_s_
Center-of-mass energy squared of the nucleus-nucleus collision.
std::unique_ptr< Nucleus > target_
Target.
double impact_
Impact parameter.
double sqrt_s_NN_
Center-of-mass energy of a nucleon-nucleon collision.
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 ...
static std::unique_ptr< DeformedNucleus > create_deformed_nucleus(Configuration &nucleus_cfg, const int ntest, const std::string &nucleus_type)
Configure Deformed Nucleus.
double imp_max_
Maximum value of impact parameter.
@ On
Use fermi motion in combination with potentials.
@ Frozen
Use fermi motion without potentials.
@ Off
Don't use fermi motion.
@ Custom
Sample from custom, user-defined distribution.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
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...
static constexpr int LCollider
double s_from_Etot(double e_tot, double m_P, double m_T)
Convert E_tot to Mandelstam-s for a fixed-target setup, with a projectile of mass m_P and a total ene...
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...