87 lines
1.9 KiB
C++
87 lines
1.9 KiB
C++
//
|
|
// population_container.hpp
|
|
// mc_electron
|
|
//
|
|
// Created by Christian Reiling on 02.08.19.
|
|
// Copyright © 2019 Christian Reiling. All rights reserved.
|
|
//
|
|
|
|
#ifndef population_container_hpp
|
|
#define population_container_hpp
|
|
|
|
#include "log_scale.h"
|
|
#include "random_operations.h"
|
|
#include "katrin_geo.h"
|
|
|
|
|
|
struct Bins {
|
|
int z;
|
|
int r;
|
|
int phi;
|
|
inline bool operator==(Bins other) {
|
|
return z == other.z && r == other.r && phi == other.phi;
|
|
}
|
|
};
|
|
|
|
struct Scales {
|
|
Lin_Scale z;
|
|
Lin_Scale r;
|
|
Lin_Scale phi;
|
|
};
|
|
|
|
struct Sum_bounds {
|
|
Bins loc_bins;
|
|
int num_E_bins;
|
|
};
|
|
|
|
struct Content {
|
|
double E_eV;
|
|
double n_m3;
|
|
};
|
|
|
|
class Population_Container {
|
|
friend class Simulation;
|
|
friend class Population_Logger;
|
|
friend class Population_Load_Saver;
|
|
|
|
Scales scales;
|
|
Log_Scale E_scale;
|
|
|
|
double *cum_times_s;
|
|
double *offsets;
|
|
Bins bin_offsets;
|
|
int data_size;
|
|
|
|
double *size_data_m3;
|
|
|
|
public:
|
|
Population_Container(int num_z_bins, int num_r_bins, int num_phi_bins, int num_E_bins);
|
|
~Population_Container();
|
|
Population_Container(const Population_Container& other);
|
|
Population_Container& operator=(const Population_Container& other);
|
|
private:
|
|
void init_scales(int num_z_bins, int num_r_bins, int num_phi_bins, int num_E_bins);
|
|
void init_bin_offsets();
|
|
void init_content_arrays();
|
|
void init_size_array();
|
|
|
|
public:
|
|
void increase_cum_time_s(const vec3 &loc1_m, const vec3 &loc2_m, const double &v_ms, const double &E_eV);
|
|
void increase_offset(const vec3 &loc_m, const double &E_eV);
|
|
|
|
public:
|
|
double get_density_m3(const vec3 &loc_m, const double &E_eV, const double &time_s);
|
|
Content get_density_m3(const int &E_bin, const Bins &loc_bins, const double &time_s);
|
|
Sum_bounds get_sumation_bounds(const vec3 &loc_m);
|
|
|
|
double get_E_eV (const int &E_bin);
|
|
double roll_E_eV_in_bin(const int &E_bin, UniRNG *rngUni);
|
|
|
|
private:
|
|
Bins calc_loc_bin(const vec3 &loc_m);
|
|
int calc_data_bin(const Bins &loc_bin, const double &E_bin);
|
|
};
|
|
|
|
|
|
#endif /* population_container_hpp */
|