- Added individul operators for species and better selecting process. - Switched to C arrays for main loop operations and calculating array indizes using knowledge of binning instead of doing sorted search - Added Recombination - Reworked elastic scattering kinematics - Added inelastic scattering kinematics
71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
//
|
|
// population3_container.cpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 24.05.19.
|
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#include "population3_container.hpp"
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
|
|
|
|
Pop3_Container::~Pop3_Container() {
|
|
|
|
};
|
|
|
|
Pop3_Container::Pop3_Container(int num_z_bins, int num_r_bins, int num_phi_bins) {
|
|
z_scale = Lin_Scale(Katrin_Geo::get_z_RW_m(), Katrin_Geo::get_z_WGTSend_m(), num_z_bins);
|
|
r_scale = Lin_Scale(0,Katrin_Geo::get_radius_m(), num_r_bins);
|
|
phi_scale = Lin_Scale(0, 180, num_phi_bins);
|
|
|
|
data = new double **[num_z_bins+1];
|
|
for (int i = 0; i <= num_z_bins; i++)
|
|
{
|
|
data[i] = new double *[num_r_bins+1];
|
|
for(int j = 0; j<=num_r_bins; j++)
|
|
data[i][j] = new double[num_phi_bins+1];
|
|
}
|
|
for (int i = 0; i<=num_z_bins; i++) {
|
|
for (int j = 0; j<=num_r_bins; j++) {
|
|
for (int k = 0; k<=num_phi_bins; k++) {
|
|
data[i][j][k] = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void Pop3_Container::increase_value(const double &value, const vec3 &loc_m) {
|
|
int zbin = z_scale.calc_index(get_z_m(loc_m));
|
|
int rbin = r_scale.calc_index(get_r_m(loc_m));
|
|
int phibin = phi_scale.calc_index(get_phi(loc_m));
|
|
data[zbin][rbin][phibin] += value;
|
|
}
|
|
|
|
void Pop3_Container::increase_value(const double &value, const vec3 &loc1_m, const vec3 &loc2_m) {
|
|
double z_min_m = get_z_m(loc1_m);
|
|
double z_max_m = get_z_m(loc2_m);
|
|
if (z_max_m < z_min_m) {
|
|
swap(z_min_m, z_max_m);
|
|
}
|
|
int min_z_index = z_scale.calc_index(z_min_m);
|
|
int max_z_index = z_scale.calc_index(z_max_m);
|
|
// No r/phi movement, else need to calculate more exactly
|
|
int rbin = r_scale.calc_index(get_r_m(loc1_m));
|
|
int phibin = phi_scale.calc_index(get_phi(loc1_m));
|
|
|
|
for (int i = min_z_index; i<max_z_index; i++) {
|
|
data[i][rbin][phibin] += value;
|
|
}
|
|
}
|
|
|
|
double Pop3_Container::get_value (vec3 loc_m) {
|
|
int zbin = z_scale.calc_index(get_z_m(loc_m));
|
|
int rbin = r_scale.calc_index(get_r_m(loc_m));
|
|
int phibin = phi_scale.calc_index(get_phi(loc_m));
|
|
return (data[zbin][rbin][phibin]);
|
|
}
|
|
|