 |
Version: SMASH-1.8
|
|
Go to the documentation of this file.
22 static constexpr
int LCollider = LogArea::Collider::id;
95 std::string particle_list_file_directory =
96 config.
take({
"Custom",
"File_Directory"});
98 std::string particle_list_file_name = config.
take({
"Custom",
"File_Name"});
101 throw std::runtime_error(
102 "Your Particle List is already filled before reading in from the "
104 "Something went wrong. Please check your config.");
113 std::map<PdgCode, int> particle_list = config.
take({
"Particles"});
114 for (
const auto& particle : particle_list)
120 const std::string path =
121 file_path(particle_list_file_directory, particle_list_file_name);
125 }
else if (!same_file) {
142 for (
const auto& it : vec) {
144 if (it.isospin == 1) {
146 }
else if (it.isospin == 0) {
149 throw std::runtime_error(
150 "Your particles charges are not 1 = proton or 0 = neutron."
151 "Check whether your list is correct or there is an error.");
155 double current_mass = current_type.
mass();
157 particles_.back().set_4momentum(current_mass, 0.0, 0.0, 0.0);
179 return nucleon_position;
189 for (
auto i =
begin(); i !=
end(); i++) {
191 i->set_4momentum(i->pole_mass(), 0.0, 0.0, 0.0);
204 logg[
LCollider].warn() <<
"Fermi motion activated with a custom nucleus.\n";
205 logg[
LCollider].warn() <<
"Be aware that generating the Fermi momenta\n"
206 <<
"assumes nucleons distributed according to a\n"
207 <<
"Woods-Saxon distribution.";
211 const std::string& file_name) {
212 if (file_directory.back() ==
'/') {
213 return file_directory + file_name;
215 return file_directory +
'/' + file_name;
220 int particle_number)
const {
221 int A = particle_number;
223 std::vector<Nucleoncustom> custom_nucleus;
225 for (
int i = 0; i < A; ++i) {
226 std::getline(infile, line);
230 infile.seekg(0, infile.beg);
231 std::getline(infile, line);
234 std::istringstream iss(line);
235 if (!(iss >> nucleon.
x >> nucleon.
y >> nucleon.
z >>
237 throw std::runtime_error(
238 "SMASH could not read in a line from your initial nuclei input file."
239 "Check if your file has the following format: x y z spinprojection "
243 custom_nucleus.push_back(nucleon);
245 return custom_nucleus;
ThreeVector distribute_nucleon() override
Returns position of a nucleon as given in the external file.
void random_euler_angles()
Randomly generate Euler angles.
void arrange_nucleons() override
Sets the positions of the nucleons inside a nucleus.
virtual void generate_fermi_momenta()
Generates momenta according to Fermi motion for the nucleons.
CustomNucleus(Configuration &config, int testparticles, bool same_file)
Constructor that needs configuration parameters from input file and the number of testparticles.
void rotate(double phi, double theta, double psi)
Rotate vector by the given Euler angles phi, theta, psi.
std::vector< ParticleData >::iterator begin()
For iterators over the particle list:
double euler_theta_
Euler angel theta.
void align_center()
Shifts the nucleus so that its center is at (0,0,0)
std::vector< Nucleoncustom > readfile(std::ifstream &infile, int particle_number) const
The returned vector contains Data for one nucleus given in the particlelist.
bool isospin
to differentiate between protons isospin=1 and neutrons isospin=0
void generate_fermi_momenta() override
Generates Fermi momenta as it is done in the mother class but in addition prints a warning that the F...
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
virtual void set_parameters_automatic()
Sets the deformation parameters of the Woods-Saxon distribution according to the current mass number.
size_t index
Index needed to read out vector in distribute nucleon.
std::vector< ParticleData > particles_
Particles associated with this nucleus.
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
Interface to the SMASH configuration files.
std::unique_ptr< std::ifstream > filestream_
Filestream variable used if projectile and target are read in from different files and they therefore...
double euler_psi_
Euler angel psi.
std::vector< Nucleoncustom > custom_nucleus_
Vector contianing Data for one nucleus given in the particlelist.
int number_of_nucleons_
Number of Nucleons per Nucleus Set initally to zero to be modified in the constructor.
std::vector< ParticleData >::iterator end()
For iterators over the particle list:
static constexpr int LCollider
std::unique_ptr< std::ifstream > * used_filestream_
Pointer to the used filestream pointer.
std::string file_path(const std::string &file_directory, const std::string &file_name)
Generates the name of the stream file.
double euler_phi_
Euler angel phi.
Contains data for one nucleon that is read in from the list.
static std::unique_ptr< std::ifstream > filestream_shared_
Filestream variable used if projectile and target are read in from the same file and they use the sam...
bool spinprojection
spinprojection of the nucleon
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
void fill_from_list(const std::vector< Nucleoncustom > &vec)
Fills Particlelist from vector containing data for one nucleus.