Staggered movement and longer tube
This commit is contained in:
@@ -94,9 +94,9 @@ bool Ion_Mover_Boris::doBoris_WallInteraction(Particle *movePart) {
|
||||
newLoc_m[2] = z_m;
|
||||
return true;
|
||||
}
|
||||
if (loc_m[2]>=z_WGTS_end_m) { // DPS Absorption
|
||||
if (loc_m[2]>=z_DPS_m) { // DPS Absorption
|
||||
vec3 newLoc_m = movePart->get_x_m();
|
||||
newLoc_m[2] = z_WGTS_end_m;
|
||||
newLoc_m[2] = z_DPS_m;
|
||||
movePart->set_x_m(newLoc_m);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "LongitudinalBins.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Discrete {
|
||||
|
||||
std::vector<double> createBins(
|
||||
double z_min, double z_max,
|
||||
int num_bins)
|
||||
{
|
||||
std::vector<double> bins;
|
||||
const double dz = (z_max - z_min)/num_bins;
|
||||
for(int bin = 0; bin <= num_bins; ++bin){
|
||||
bins.push_back(z_min + bin*dz);
|
||||
}
|
||||
return bins;
|
||||
}
|
||||
|
||||
|
||||
Longitudinal::Longitudinal(
|
||||
double z_min,
|
||||
double z_max,
|
||||
int num_bins):
|
||||
bins_(createBins(z_min, z_max, num_bins))
|
||||
{
|
||||
}
|
||||
|
||||
bool Longitudinal::changedBin(double z_start, double z_end) const
|
||||
{
|
||||
return !(findBin(z_start) == findBin(z_end));
|
||||
}
|
||||
|
||||
int Longitudinal::findBin(double z) const
|
||||
{
|
||||
auto const it = std::lower_bound(bins_.begin(), bins_.end(), z);
|
||||
return (it-bins_.begin())-1;
|
||||
}
|
||||
|
||||
std::vector<double> Longitudinal::bins() const
|
||||
{
|
||||
return bins_;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef LONGITUDINALBINS_H
|
||||
#define LONGITUDINALBINS_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Discrete {
|
||||
class Longitudinal {
|
||||
public:
|
||||
Longitudinal(
|
||||
double z_min,
|
||||
double z_max,
|
||||
int num_bins);
|
||||
|
||||
bool changedBin(double z_start, double z_end) const;
|
||||
int findBin(double z) const;
|
||||
std::vector<double> bins() const;
|
||||
|
||||
private:
|
||||
const std::vector<double> bins_;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* LONGITUDINALBINS_H */
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "LongitudinalBins.h"
|
||||
#include <vector>
|
||||
|
||||
TEST_CASE("Longitudinal Bins", "[LongitudinalBins]"){
|
||||
SECTION("Bins are filled correctly"){
|
||||
int num_bins = 14;
|
||||
const double z_min = 0.;
|
||||
const double z_max = 14.;
|
||||
|
||||
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
|
||||
|
||||
std::vector<double> bins = longitudinal.bins();
|
||||
|
||||
REQUIRE(bins.front() == 0.);
|
||||
REQUIRE(bins.back() == 14.);
|
||||
REQUIRE(bins[1] == 1.);
|
||||
}
|
||||
|
||||
SECTION("Bin is calculated correctly"){
|
||||
int num_bins = 14;
|
||||
const double z_min = 0.;
|
||||
const double z_max = 14.;
|
||||
|
||||
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
|
||||
|
||||
|
||||
SECTION("in bin"){
|
||||
REQUIRE(longitudinal.findBin(0.5) == 0);
|
||||
REQUIRE(longitudinal.findBin(1.2) == 1);
|
||||
REQUIRE(longitudinal.findBin(13.5) == 13);
|
||||
}
|
||||
SECTION("at bin borders"){
|
||||
REQUIRE(longitudinal.findBin(0.0) == -1);
|
||||
REQUIRE(longitudinal.findBin(1.0) == 0);
|
||||
REQUIRE(longitudinal.findBin(2.0) == 1);
|
||||
REQUIRE(longitudinal.findBin(14.0) == 13);
|
||||
}
|
||||
SECTION("Outside of bins"){
|
||||
REQUIRE(longitudinal.findBin(-0.5) == -1);
|
||||
REQUIRE(longitudinal.findBin(-14.5) == -1);
|
||||
REQUIRE(longitudinal.findBin(14.5) == 14);
|
||||
REQUIRE(longitudinal.findBin(20.3) == 14);
|
||||
}
|
||||
}
|
||||
SECTION("Bin changes are found"){
|
||||
int num_bins = 14;
|
||||
const double z_min = 0.;
|
||||
const double z_max = 14.;
|
||||
|
||||
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
|
||||
|
||||
SECTION("Same bin"){
|
||||
REQUIRE(!longitudinal.changedBin(0.5, 0.5));
|
||||
REQUIRE(!longitudinal.changedBin(0.7, 0.5));
|
||||
REQUIRE(!longitudinal.changedBin(0.5, 0.7));
|
||||
REQUIRE(!longitudinal.changedBin(1.5, 1.7));
|
||||
REQUIRE(!longitudinal.changedBin(0.5, 1.0));
|
||||
}
|
||||
|
||||
SECTION("Bin change"){
|
||||
REQUIRE(longitudinal.changedBin(0.5, 1.5));
|
||||
REQUIRE(longitudinal.changedBin(1.5, 0.5));
|
||||
|
||||
REQUIRE(longitudinal.changedBin(0.5, -0.5));
|
||||
REQUIRE(longitudinal.changedBin(13.5, 14.5));
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("Constructor"){
|
||||
int num_bins = 14;
|
||||
const double z_min = 0.;
|
||||
const double z_max = 14.;
|
||||
|
||||
Discrete::Longitudinal longitudinal(z_min, z_max, num_bins);
|
||||
|
||||
Discrete::Longitudinal copy_longitudinal(longitudinal);
|
||||
REQUIRE(copy_longitudinal.bins()[0] == longitudinal.bins()[0]);
|
||||
REQUIRE(copy_longitudinal.bins()[3] == longitudinal.bins()[3]);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ void ASCI_Logger::set_zLogValues() {
|
||||
zLogValues.clear();
|
||||
if (logging) {
|
||||
double start_m = z_RW_m;
|
||||
double length_m = z_WGTS_end_m - start_m;
|
||||
double length_m = z_DPS_m - start_m;
|
||||
double stepLength_m = length_m/(numberZBins-1);
|
||||
double z_m;
|
||||
for (int i = 0;i<numberZBins;i++) {
|
||||
|
||||
+20
-12
@@ -39,21 +39,27 @@ constant BetaDecayConst = 1.2072343416696292e-47;
|
||||
constant TritiumDecayEndpoint_eV = 18.574e3;
|
||||
|
||||
// WGTS
|
||||
constant z_RW_m = -3;
|
||||
constant z_rear_m = -1.57;
|
||||
constant z_WGTS_start_m = 0;
|
||||
constant z_WGTS_end_m = 10;
|
||||
constant z_DPS_end_m = 13;
|
||||
constant r_WGTS_m = 0.045;
|
||||
constant l_WGTS_m = z_WGTS_end_m - z_WGTS_start_m;
|
||||
constant z_WGTS_mid_m = (z_WGTS_end_m+z_WGTS_start_m)/2;
|
||||
constant z_RW_m = 0;
|
||||
constant z_rear_pp1 = 1.43;
|
||||
constant z_rear_pp2 = 3;
|
||||
constant z_front_pp1 = 13;
|
||||
constant z_front_pp2 = 14.57;
|
||||
constant z_DPS_m = 16;
|
||||
constant z_inlet_m = 8;
|
||||
constant l_WGTS_m = z_DPS_m - z_RW_m;
|
||||
|
||||
|
||||
// from Kuckert:2018aa
|
||||
constant reduction_WGTS_front = 0.02;
|
||||
constant reduction_WGTS_rear = 0.02;
|
||||
constant reduction_rear_wgts = 0.002;
|
||||
constant reduction_tot_front = 5e-4;
|
||||
constant reduction_tot_rear = 5e-4;
|
||||
constant reduction_RW = 5e-4;
|
||||
constant reduction_rear_pp1 = 0.002;
|
||||
constant reduction_rear_pp2 = 0.02;
|
||||
constant reduction_inlet = 1.0;
|
||||
constant reduction_front_pp1 = 0.02;
|
||||
constant reduction_front_pp2 = 0.002;
|
||||
constant reduction_DPS = 5e-4;
|
||||
|
||||
|
||||
|
||||
// For interaction integration
|
||||
const int INT_N = load_parameter("INT_N"); // Number of points for theta integration
|
||||
@@ -61,4 +67,6 @@ const double INT_PRE_START = load_parameter("INT_PRE_START"); // Start energy fo
|
||||
const double INT_PRE_END = load_parameter("INT_PRE_END"); // End energy for precomputed cross sections
|
||||
const int INT_PRE_N = load_parameter("INT_PRE_N"); //Number of points for precomputed cross sections
|
||||
|
||||
const int long_move_num_bins = load_parameter("LONG_MOVE_NUM_BINS");
|
||||
|
||||
#endif /* constants_h */
|
||||
|
||||
@@ -20,7 +20,7 @@ TEST_CASE("Current Logger", "[CurrentLogger]"){
|
||||
|
||||
CurrentLogger logger(
|
||||
electron,
|
||||
numberZBins, z_RW_m, z_WGTS_end_m,
|
||||
numberZBins, z_RW_m, z_DPS_m,
|
||||
numberRBins, r_WGTS_m,
|
||||
energy_decade_min, energy_decade_max,
|
||||
"/home/jonas/new_workspace/Coding/Output/KARL/test/output");
|
||||
|
||||
+28
-9
@@ -3,11 +3,20 @@
|
||||
#include <cmath>
|
||||
#include "constants.h"
|
||||
|
||||
Drift_Base::Drift_Base(
|
||||
species this_species,
|
||||
Particle_Logger_Base *Logger,
|
||||
Population_Base *Population) :
|
||||
Mover_Base(this_species, Logger, Population),
|
||||
longitudinal_bins(Discrete::Longitudinal(z_RW_m, z_DPS_m, long_move_num_bins))
|
||||
{};
|
||||
|
||||
|
||||
bool leftSimulation(const vec3& position)
|
||||
{
|
||||
return (position(2) <= z_RW_m)
|
||||
|| (position(2) >= z_WGTS_end_m)
|
||||
|| (position(0)*position(0)+position(1)*position(1) >= r_WGTS_m);
|
||||
|| (position(2) >= z_DPS_m)
|
||||
|| (position(0)*position(0)+position(1)*position(1) >= r_WGTS_m*r_WGTS_m);
|
||||
}
|
||||
|
||||
void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
@@ -21,25 +30,35 @@ void Drift_Base::move(Particle *movePart, const double ¯o_sigma_m) {
|
||||
const int n = std::floor(distance/dz);
|
||||
|
||||
bool left_simulation = false;
|
||||
bool changed_longitudinal_bin = false;
|
||||
|
||||
const double part_macro_sigma_m = 1./dz;
|
||||
for(int step = 0; step < n; ++step){
|
||||
// move particle to new position
|
||||
double znew_m = get_zNew_m(movePart, part_macro_sigma_m);
|
||||
doWallInteraction(movePart, &oldLoc_m, &znew_m);
|
||||
newLoc_m[2] = znew_m;
|
||||
|
||||
movePart->set_x_m(newLoc_m);
|
||||
|
||||
// calculate additional movement through E/B field
|
||||
do_E_calculus(movePart, oldLoc_m, part_macro_sigma_m);
|
||||
Logger->log(*movePart, oldLoc_m);
|
||||
Population->increase_density(*movePart, oldLoc_m);
|
||||
oldLoc_m = newLoc_m;
|
||||
newLoc_m = movePart->get_x_m();
|
||||
|
||||
left_simulation = leftSimulation(oldLoc_m);
|
||||
if(left_simulation){
|
||||
// stop movement conditions
|
||||
changed_longitudinal_bin = longitudinal_bins.changedBin(
|
||||
calc_z_m(oldLoc_m), calc_z_m(newLoc_m));
|
||||
left_simulation = leftSimulation(newLoc_m);
|
||||
|
||||
if(left_simulation || changed_longitudinal_bin){
|
||||
break;
|
||||
}
|
||||
|
||||
// prepare new loop iteration
|
||||
oldLoc_m = newLoc_m;
|
||||
}
|
||||
if(!left_simulation){
|
||||
if((!left_simulation) && (!changed_longitudinal_bin)){
|
||||
const double rest = std::fmod(distance,dz);
|
||||
const double rest_macro_sigma = 1./rest;
|
||||
|
||||
@@ -66,9 +85,9 @@ double Drift_Base::get_zNew_m(Particle *movePart, const double ¯o_sigma_m) {
|
||||
double znew_m;
|
||||
if (macro_sigma_m == 0) {
|
||||
if (zDir == -1) {
|
||||
znew_m = z_RW_m - 2*l_WGTS_m;
|
||||
znew_m = z_RW_m;
|
||||
} else {
|
||||
znew_m = z_WGTS_end_m + 2*l_WGTS_m;
|
||||
znew_m = z_DPS_m;
|
||||
}
|
||||
} else {
|
||||
double distance_m = 1/macro_sigma_m;
|
||||
|
||||
+7
-10
@@ -1,21 +1,17 @@
|
||||
//
|
||||
// drift_base.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 16.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef drift_base_h
|
||||
#define drift_base_h
|
||||
|
||||
#include "mover_base.h"
|
||||
#include "LongitudinalBins.h"
|
||||
|
||||
|
||||
// Drift Approximation: Assume constant B and only movement out in z=0, z=wgtsLength_m...
|
||||
class Drift_Base : public Mover_Base {
|
||||
public:
|
||||
Drift_Base(species this_species, Particle_Logger_Base *Logger, Population_Base *Population) : Mover_Base(this_species, Logger, Population) {};
|
||||
Drift_Base(
|
||||
species this_species,
|
||||
Particle_Logger_Base *Logger,
|
||||
Population_Base *Population);
|
||||
|
||||
void move(Particle *movePart, const double ¯o_sigma_m);
|
||||
|
||||
@@ -23,7 +19,8 @@ protected:
|
||||
double get_zNew_m(Particle *movePart, const double ¯o_sigma_m);
|
||||
virtual void doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) = 0;
|
||||
virtual void do_E_calculus(Particle *movePart, const vec3 &oldLoc_m, const double ¯o_sigma_m) = 0;
|
||||
|
||||
|
||||
Discrete::Longitudinal longitudinal_bins;
|
||||
};
|
||||
|
||||
#endif /* drift_base_h */
|
||||
|
||||
@@ -101,7 +101,7 @@ bool E_Mover_Boris::doBoris_WallInteraction(Particle *movePart) {
|
||||
newLoc_m[2] = z_m;
|
||||
return true;
|
||||
}
|
||||
if (loc_m[2]>=z_WGTS_end_m) { // Spectrometer Reflection
|
||||
if (loc_m[2]>=z_DPS_m) { // Spectrometer Reflection
|
||||
movePart->set_v_ms( -1*(movePart->get_v_ms()) );
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
//
|
||||
// electron_drift.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 16.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef electron_drift_h
|
||||
#define electron_drift_h
|
||||
#ifndef ELECTRON_DRIFT_H
|
||||
#define ELECTRON_DRIFT_H
|
||||
|
||||
#include "drift_base.h"
|
||||
|
||||
@@ -22,18 +14,18 @@ protected:
|
||||
|
||||
inline void E_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) {
|
||||
|
||||
if (*znew_m >= z_WGTS_end_m) { // Moveing into Spectrometer and reversing Speed.
|
||||
if (*znew_m >= z_DPS_m) { // Moveing into Spectrometer and reversing Speed.
|
||||
vec3 reverseLoc_m = *oldLoc_m;
|
||||
|
||||
// Log Movement before Reflection
|
||||
reverseLoc_m[2] = z_WGTS_end_m ;
|
||||
reverseLoc_m[2] = z_DPS_m ;
|
||||
movePart->set_x_m(reverseLoc_m);
|
||||
Logger->log(*movePart, *oldLoc_m);
|
||||
Population->increase_density(*movePart, *oldLoc_m);
|
||||
|
||||
// Final Movement
|
||||
*oldLoc_m = reverseLoc_m;
|
||||
*znew_m = z_WGTS_end_m - (*znew_m - z_WGTS_end_m);
|
||||
*znew_m = z_DPS_m - (*znew_m - z_DPS_m);
|
||||
movePart->set_v_ms( -1*(movePart->get_v_ms()) );
|
||||
}
|
||||
if (*znew_m <= z_RW_m) {
|
||||
@@ -45,4 +37,4 @@ inline void E_Mover_Drift::do_E_calculus(Particle *movePart, const vec3 &oldLoc_
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* electron_drift_h */
|
||||
#endif /* ELECTRON_DRIFT_H */
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
//
|
||||
// E_Terminator.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 19.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef E_Terminator_h
|
||||
#define E_Terminator_h
|
||||
#ifndef ELECTRON_TERMINATOR_H
|
||||
#define ELECTRON_TERMINATOR_H
|
||||
|
||||
#include "terminator_base.h"
|
||||
|
||||
@@ -33,7 +25,7 @@ inline bool Negative_Terminator::check_walls(const Particle &movePart) {
|
||||
stats.n_rw += 1;
|
||||
return true;
|
||||
}
|
||||
if (z_m >= z_WGTS_end_m && E_eV <= dipole_cutoffE_eV) {
|
||||
if (z_m >= z_DPS_m && E_eV <= dipole_cutoffE_eV) {
|
||||
stats.n_dipole += 1;
|
||||
return true;
|
||||
}
|
||||
@@ -45,4 +37,4 @@ inline bool Negative_Terminator::check_walls(const Particle &movePart) {
|
||||
}
|
||||
|
||||
|
||||
#endif /* E_Terminator_h */
|
||||
#endif /* ELECTRON_TERMINATOR_H */
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// logger_builder.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 18.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "logger_builder.hpp"
|
||||
|
||||
#include "multiz_particle_logger.h"
|
||||
@@ -57,33 +49,30 @@ void Particle_Logger_Builder::build_histogram(
|
||||
const int energy_decade_min = load_parameter("LOG_BARS_ENERGY_DECADE_MIN");
|
||||
const int energy_decade_max = load_parameter("LOG_BARS_ENERGY_DECADE_MAX");
|
||||
|
||||
//std::cout << "Logging: \n";
|
||||
//std::cout << "numberRBins: " << numberRBins << std::endl;
|
||||
//std::cout << "LOG_BARS: " << numberZBins << std::endl;
|
||||
|
||||
double zmin = z_RW_m;
|
||||
const double zmin = z_RW_m;
|
||||
const double zmax = z_DPS_m;
|
||||
|
||||
ParticleLogger->add(new CurrentLogger(
|
||||
electron,
|
||||
numberZBins, zmin, z_WGTS_end_m,
|
||||
numberZBins, zmin, zmax,
|
||||
numberRBins, r_WGTS_m,
|
||||
energy_decade_min, energy_decade_max,
|
||||
filename));
|
||||
ParticleLogger->add(new CurrentLogger(
|
||||
tritiumI,
|
||||
numberZBins, zmin, z_WGTS_end_m,
|
||||
numberZBins, zmin, zmax,
|
||||
numberRBins, r_WGTS_m,
|
||||
energy_decade_min, energy_decade_max,
|
||||
filename));
|
||||
ParticleLogger->add(new CurrentLogger(
|
||||
tritium2I,
|
||||
numberZBins, zmin, z_WGTS_end_m,
|
||||
numberZBins, zmin, zmax,
|
||||
numberRBins, r_WGTS_m,
|
||||
energy_decade_min, energy_decade_max,
|
||||
filename));
|
||||
ParticleLogger->add(new CurrentLogger(
|
||||
tritium3I,
|
||||
numberZBins, zmin, z_WGTS_end_m,
|
||||
numberZBins, zmin, zmax,
|
||||
numberRBins, r_WGTS_m,
|
||||
energy_decade_min, energy_decade_max,
|
||||
filename));
|
||||
@@ -93,7 +82,7 @@ void Particle_Logger_Builder::build_histogram(
|
||||
void Particle_Logger_Builder::build_MultiZ(Particle_Logger_Manager *ParticleLogger, H5_File *h5f) {
|
||||
double *zValues = new double[numberZBins];
|
||||
double start_m = z_RW_m;
|
||||
double length_m = z_WGTS_end_m - start_m;
|
||||
double length_m = z_DPS_m - start_m;
|
||||
double stepLength_m = length_m/(numberZBins-1);
|
||||
|
||||
double z_m;
|
||||
|
||||
@@ -33,6 +33,8 @@ OBJS := particle_looper.o \
|
||||
postive_E_drift.o \
|
||||
recombination_counter.o \
|
||||
T2IT2_cx.o \
|
||||
tritium2_population.o \
|
||||
LongitudinalBins.o \
|
||||
|
||||
|
||||
CXXFLAGS = $(X_OFLAGS) -I.. $(X_INC) -std=c++11
|
||||
@@ -71,6 +73,8 @@ OBJECTS_TEST = electric_field_test.o \
|
||||
CurrentLogger.o\
|
||||
current_logger_test.o\
|
||||
particle.o\
|
||||
LongitudinalBins.o \
|
||||
LongitudinalBins_test.o \
|
||||
|
||||
catch: test_main.o $(OBJECTS_TEST)
|
||||
$(MPICXX) -o $@ $^ $(LDFLAGS) $(LOADLIBES)
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// neutral_mover.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 04.07.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef neutral_mover_h
|
||||
#define neutral_mover_h
|
||||
|
||||
@@ -38,8 +30,8 @@ inline void Neutral_Mover::wall_correction(vec3 *newLoc_m, const vec3 &oldLoc_m)
|
||||
if (*newLoc_m[2] < z_RW_m) {
|
||||
newLoc_m[2] = z_RW_m;
|
||||
}
|
||||
if (*newLoc_m[2] > z_WGTS_end_m) {
|
||||
newLoc_m[2] = z_WGTS_end_m;
|
||||
if (*newLoc_m[2] > z_DPS_m) {
|
||||
newLoc_m[2] = z_DPS_m;
|
||||
}
|
||||
if (calc_r_m(*newLoc_m) > r_WGTS_m) {
|
||||
double phi = calc_phi(*newLoc_m);
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
Particle_Looper::Particle_Looper():
|
||||
longitudinal_bins(
|
||||
Discrete::Longitudinal(z_RW_m, z_DPS_m, long_move_num_bins))
|
||||
{}
|
||||
|
||||
|
||||
void Particle_Looper::init(
|
||||
long int seed, long int ID_offset, std::string output_path)
|
||||
{
|
||||
@@ -72,6 +79,7 @@ void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
||||
vec3 oldLoc_m;
|
||||
while (!terminatorPtr->check_terminlization(curPart)) {
|
||||
oldLoc_m = curPart.get_x_m();
|
||||
|
||||
macro_sigma_m = interactionPtr->get_macro_sigma_m(curPart);
|
||||
double rnd_number = rngUni.random();
|
||||
rnd_number = (rnd_number == 0.) ? 1E-15 : rnd_number;
|
||||
@@ -79,9 +87,13 @@ void Particle_Looper::process_one(std::vector<Particle> *particle_queue) {
|
||||
rolled_macro_sigma_m = (rolled_macro_sigma_m <= 0.)? 1E-15 : rolled_macro_sigma_m;
|
||||
|
||||
moverPtr->move(&curPart, rolled_macro_sigma_m);
|
||||
|
||||
if (terminatorPtr->check_terminlization(curPart)) {
|
||||
break; // Don't double check terminlization, else n_double.
|
||||
} else {
|
||||
}
|
||||
|
||||
const double z_new = calc_z_m(curPart.get_x_m());
|
||||
if(!longitudinal_bins.changedBin(calc_z_m(oldLoc_m), z_new)){
|
||||
oldLoc_m = curPart.get_x_m();
|
||||
IntOut = interactionPtr->do_Interaction(&curPart);
|
||||
logger->log(curPart, oldLoc_m);
|
||||
@@ -141,3 +153,24 @@ void Particle_Looper::flush() {
|
||||
pop_loggers.flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long int Particle_Looper::get_number_total_particles()
|
||||
{
|
||||
return ID_counter;
|
||||
}
|
||||
|
||||
void Particle_Looper::set_global_decays(long int global_decays)
|
||||
{
|
||||
this->global_decays = global_decays;
|
||||
}
|
||||
|
||||
Population_Manager *Particle_Looper::get_populations()
|
||||
{
|
||||
return &populations;
|
||||
}
|
||||
|
||||
Terminator_Manager *Particle_Looper::get_terminators()
|
||||
{
|
||||
return &terminators;
|
||||
}
|
||||
@@ -1,13 +1,5 @@
|
||||
//
|
||||
// particle_looper.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 16.07.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef particle_looper_hpp
|
||||
#define particle_looper_hpp
|
||||
#ifndef PARTICLE_LOOPER_H
|
||||
#define PARTICLE_LOOPER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -23,9 +15,33 @@
|
||||
#include "terminator_builder.hpp"
|
||||
|
||||
#include "population_load_saver.hpp"
|
||||
#include "LongitudinalBins.h"
|
||||
|
||||
|
||||
class Particle_Looper {
|
||||
|
||||
public:
|
||||
Particle_Looper();
|
||||
void init(long int seed, long int ID_offset, std::string output_path);
|
||||
|
||||
void do_loops(int target_decays);
|
||||
void do_logging_off_loops(int target_decays);
|
||||
long int get_number_total_particles();
|
||||
void set_global_decays(long int global_decays);
|
||||
Population_Manager *get_populations();
|
||||
Terminator_Manager *get_terminators();
|
||||
|
||||
void flush();
|
||||
|
||||
private:
|
||||
void init_managers();
|
||||
|
||||
void process_one(std::vector<Particle> *particle_queue);
|
||||
long int get_new_id();
|
||||
long int get_last_id();
|
||||
|
||||
void set_logging(bool logging);
|
||||
|
||||
UniRNG rngUni;
|
||||
NormalRNG rngNormal;
|
||||
|
||||
@@ -48,48 +64,10 @@ class Particle_Looper {
|
||||
long int local_decays = 0;
|
||||
long int global_decays = 0;
|
||||
std::string output_filename_without_type_ending;
|
||||
|
||||
public:
|
||||
Particle_Looper() {};
|
||||
void init(long int seed, long int ID_offset, std::string output_path);
|
||||
~Particle_Looper() {
|
||||
//pop_load_saver.save();
|
||||
}
|
||||
private:
|
||||
void init_managers();
|
||||
|
||||
public:
|
||||
void do_loops(int target_decays);
|
||||
private:
|
||||
void process_one(std::vector<Particle> *particle_queue);
|
||||
long int get_new_id();
|
||||
long int get_last_id();
|
||||
|
||||
public:
|
||||
void do_logging_off_loops(int target_decays);
|
||||
private:
|
||||
void set_logging(bool logging);
|
||||
|
||||
public:
|
||||
long int get_number_total_particles() {
|
||||
return ID_counter;
|
||||
}
|
||||
|
||||
void set_global_decays(long int global_decays) {
|
||||
this->global_decays = global_decays;
|
||||
}
|
||||
|
||||
Population_Manager *get_populations() {
|
||||
return &populations;
|
||||
}
|
||||
|
||||
Terminator_Manager *get_terminators() {
|
||||
return &terminators;
|
||||
}
|
||||
|
||||
void flush();
|
||||
|
||||
Discrete::Longitudinal longitudinal_bins;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* particle_looper_hpp */
|
||||
#endif /* PARTICLE_LOOPER_H */
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// population_container.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 02.08.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "population_container.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -53,7 +45,7 @@ Population_Container &Population_Container::operator=(const Population_Container
|
||||
}
|
||||
|
||||
void Population_Container::init_scales(int num_z_bins, int num_r_bins, int num_phi_bins, int num_E_bins, double E_min_eV, double E_max_eV) {
|
||||
scales.z = Lin_Scale(z_RW_m, z_WGTS_end_m, num_z_bins);
|
||||
scales.z = Lin_Scale(z_RW_m, z_DPS_m, num_z_bins);
|
||||
scales.r = Lin_Scale(0,r_WGTS_m, num_r_bins);
|
||||
scales.phi = Lin_Scale(0, 2*pi, num_phi_bins);
|
||||
E_scale = Log_Scale(E_min_eV, E_max_eV, num_E_bins);
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// population_load_saver.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 11.06.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "population_load_saver.hpp"
|
||||
|
||||
using namespace std;
|
||||
@@ -49,8 +41,8 @@ void Population_Load_Saver::write_overhead(ofstream *save_stream) {
|
||||
*save_stream<<timer->get_time_s()<<"\t # Offset Time in seconds \n";
|
||||
|
||||
*save_stream<<z_RW_m<<"\t";
|
||||
*save_stream<<z_WGTS_start_m<<"\t";
|
||||
*save_stream<<z_WGTS_end_m<<"\t";
|
||||
*save_stream<<z_rear_pp2<<"\t";
|
||||
*save_stream<<z_DPS_m<<"\t";
|
||||
*save_stream<<r_WGTS_m<<"\t";
|
||||
*save_stream<<" # 1. rear wall pos 2. WGTS start pos 3. WGTS end pos 4. WGTS radius all pos in m \n";
|
||||
|
||||
@@ -170,13 +162,13 @@ void Population_Load_Saver::check_katrin_geo_line(ifstream *load_stream) {
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
*load_stream>>z_WGTSstart_m;
|
||||
if ( z_WGTSstart_m != z_WGTS_start_m) {
|
||||
if ( z_WGTSstart_m != z_rear_pp2) {
|
||||
stringstream ss;
|
||||
ss<<"Population_Load_Saver::check_katrin_geo_line: z_WGTSstart missmatch.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
*load_stream>>z_WGTSend_m;
|
||||
if ( z_WGTSend_m != z_WGTS_end_m) {
|
||||
if ( z_WGTSend_m != z_DPS_m) {
|
||||
stringstream ss;
|
||||
ss<<"Population_Load_Saver::check_katrin_geo_line: z_WGTSend missmatch.\n";
|
||||
throw MyException(ss.str());
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
//
|
||||
// positive_terminator.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 04.07.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef positive_terminator_h
|
||||
#define positive_terminator_h
|
||||
|
||||
@@ -28,7 +20,7 @@ inline bool PosNeu_Terminator::check_walls(const Particle &movePart) {
|
||||
stats.n_rw += 1;
|
||||
return true;
|
||||
}
|
||||
if (z_m >= z_WGTS_end_m) {
|
||||
if (z_m >= z_DPS_m) {
|
||||
stats.n_dipole += 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
//
|
||||
// postive_drift.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 04.07.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef postive_drift_h
|
||||
#define postive_drift_h
|
||||
#ifndef POSTIVE_DRIFT_H
|
||||
#define POSTIVE_DRIFT_H
|
||||
|
||||
#include "drift_base.h"
|
||||
|
||||
@@ -23,8 +15,8 @@ protected:
|
||||
|
||||
|
||||
inline void Positive_Mover_Drift::doWallInteraction(Particle *movePart, vec3 *oldLoc_m, double *znew_m) {
|
||||
if (*znew_m >= z_WGTS_end_m) {
|
||||
*znew_m = z_WGTS_end_m+0.001;
|
||||
if (*znew_m >= z_DPS_m) {
|
||||
*znew_m = z_DPS_m+0.001;
|
||||
}
|
||||
if (*znew_m <= z_RW_m) {
|
||||
*znew_m = z_RW_m-0.001;
|
||||
@@ -35,4 +27,4 @@ inline void Positive_Mover_Drift::do_E_calculus(Particle *movePart, const vec3 &
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* postive_drift_h */
|
||||
#endif /* POSTIVE_DRIFT_H */
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
#include "tritium2_population.h"
|
||||
|
||||
T2_Population::T2_Population(
|
||||
Base_Kinematics *kinematics,
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal) :
|
||||
Population_Base(tritium2),
|
||||
RNG_Base(rngUni, rngNormal)
|
||||
{
|
||||
set_regimes();
|
||||
this->kinematics = kinematics;
|
||||
}
|
||||
|
||||
const double T2_Population::wgtsT2MaxDensity_m3 = load_parameter("T2_MAXDENS");
|
||||
|
||||
void T2_Population::increase_density (
|
||||
const Particle &upPart, const vec3 &oldLoc_m)
|
||||
{}
|
||||
|
||||
void T2_Population::decrease_denisty (
|
||||
const vec3 &loc_m, const double &E_eV)
|
||||
{}
|
||||
|
||||
|
||||
double T2_Population::get_density_m3(
|
||||
const int &E_bin, const Bins &loc_bins)
|
||||
{
|
||||
throw MyException("Should not be called.\n.");
|
||||
}
|
||||
|
||||
int T2_Population::get_number_E_bins()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bins T2_Population::get_loc_bin(
|
||||
const vec3 & loc_m)
|
||||
{
|
||||
throw MyException("Should not be called.\n.");
|
||||
}
|
||||
|
||||
double T2_Population::get_E_bin_mid_eV(
|
||||
const int &E_bin)
|
||||
{
|
||||
throw MyException("Should not be called.\n.");
|
||||
}
|
||||
|
||||
vec3 T2_Population::roll_v_ms (
|
||||
const vec3 &loc_m)
|
||||
{
|
||||
return kinematics->get_v_ms(loc_m);
|
||||
}
|
||||
|
||||
vec3 T2_Population::get_drift_v_ms(
|
||||
const vec3 &loc_m)
|
||||
{
|
||||
return kinematics->get_v_offset_ms(loc_m);
|
||||
}
|
||||
|
||||
double T2_Population::get_thermal_v_ms()
|
||||
{
|
||||
return kinematics->get_thermal_v_ms();
|
||||
}
|
||||
|
||||
double T2_Population::get_v_pdf(
|
||||
const double &v_ms)
|
||||
{
|
||||
return kinematics->get_v_pdf(v_ms);
|
||||
}
|
||||
|
||||
Population_Container *T2_Population::access_container()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void T2_Population::set_regimes() {
|
||||
|
||||
std::vector<double> reductions = {
|
||||
reduction_RW,
|
||||
reduction_rear_pp1,
|
||||
reduction_rear_pp2,
|
||||
reduction_inlet,
|
||||
reduction_front_pp1,
|
||||
reduction_front_pp2,
|
||||
reduction_DPS
|
||||
};
|
||||
|
||||
std::vector<double> zs = {
|
||||
z_RW_m,
|
||||
z_rear_pp1,
|
||||
z_rear_pp2,
|
||||
z_inlet_m,
|
||||
z_front_pp1,
|
||||
z_front_pp2,
|
||||
z_DPS_m
|
||||
};
|
||||
|
||||
n_regimes = reductions.size()-1;
|
||||
|
||||
for (int i = 0; i<n_regimes; i++) {
|
||||
reduction_min.push_back(reductions[i]);
|
||||
z_min_m.push_back(zs[i]);
|
||||
|
||||
const double reduction_max = reductions[i+1];
|
||||
const double reduction_min_loc = reductions[i];
|
||||
const double z_max_m = zs[i+1];
|
||||
const double z_min_loc_m = zs[i];
|
||||
|
||||
slopes.push_back((reduction_max-reduction_min_loc)/(z_max_m-z_min_loc_m));
|
||||
}
|
||||
}
|
||||
|
||||
double T2_Population::get_density_m3(const vec3 &loc_m) {
|
||||
double z_m = calc_z_m(loc_m);
|
||||
for (int i = (n_regimes-1); i>=0; i--) {
|
||||
if (z_m>z_min_m[i]) {
|
||||
double reduction_factor = reduction_min[i] + (z_m-z_min_m[i])*slopes[i];
|
||||
return reduction_factor * wgtsT2MaxDensity_m3;
|
||||
}
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss<<"T2_Population::calc_DensityTriangle: z_m outside of Katrin.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec3 T2_Population::roll_x_ms() {
|
||||
double r_m = r_WGTS_m*sqrt(rngUni->random());
|
||||
double phi = rngUni->random()*2*pi;
|
||||
|
||||
double eta1, eta2, z_can_m;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
z_can_m = z_RW_m + eta1*(z_DPS_m - z_RW_m);
|
||||
} while(eta2*wgtsT2MaxDensity_m3 > get_density_m3(vec3(0,0, z_can_m)));
|
||||
return vec3 (r_m*cos(phi) ,r_m*sin(phi) ,z_can_m);
|
||||
}
|
||||
|
||||
@@ -1,106 +1,48 @@
|
||||
//
|
||||
// tritium2_population.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 17.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef tritium2_population_h
|
||||
#define tritium2_population_h
|
||||
#ifndef TRITIUM2_POPULATION_H
|
||||
#define TRITIUM2_POPULATION_H
|
||||
|
||||
#include "wgts_kinematics.h"
|
||||
#include "population_base.h"
|
||||
#include "random_operations.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class T2_Population : public Population_Base, private RNG_Base {
|
||||
public:
|
||||
T2_Population(
|
||||
Base_Kinematics *kinematics,
|
||||
UniRNG *rngUni,
|
||||
NormalRNG *rngNormal);
|
||||
|
||||
void increase_density (const Particle &upPart, const vec3 &oldLoc_m);
|
||||
void decrease_denisty (const vec3 &loc_m, const double &E_eV);
|
||||
|
||||
double get_density_m3(const vec3 &loc_m);
|
||||
|
||||
double get_density_m3(const int &E_bin, const Bins &loc_bins);
|
||||
int get_number_E_bins();
|
||||
Bins get_loc_bin(const vec3 & loc_m);
|
||||
double get_E_bin_mid_eV(const int &E_bin);
|
||||
|
||||
vec3 roll_x_ms();
|
||||
vec3 roll_v_ms (const vec3 &loc_m);
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m);
|
||||
double get_thermal_v_ms();
|
||||
double get_v_pdf(const double &v_ms);
|
||||
|
||||
Population_Container *access_container();
|
||||
|
||||
private:
|
||||
void set_regimes();
|
||||
|
||||
class T2_Population : public Population_Base, private RNG_Base {
|
||||
static const double wgtsT2MaxDensity_m3;
|
||||
|
||||
Base_Kinematics *kinematics;
|
||||
int n_regimes;
|
||||
double *reduction_min;
|
||||
double *z_min_m;
|
||||
double *slopes;
|
||||
|
||||
public:
|
||||
T2_Population(Base_Kinematics *kinematics, UniRNG *rngUni, NormalRNG *rngNormal) : Population_Base(tritium2), RNG_Base(rngUni, rngNormal) {
|
||||
set_regimes();
|
||||
this->kinematics = kinematics;
|
||||
};
|
||||
~T2_Population() {
|
||||
delete[] reduction_min;
|
||||
delete[] z_min_m;
|
||||
delete[] slopes;
|
||||
};
|
||||
private:
|
||||
void set_regimes();
|
||||
|
||||
public:
|
||||
void increase_density (const Particle &upPart, const vec3 &oldLoc_m) {}
|
||||
void decrease_denisty (const vec3 &loc_m, const double &E_eV) {}
|
||||
|
||||
double get_density_m3(const vec3 &loc_m);
|
||||
|
||||
double get_density_m3(const int &E_bin, const Bins &loc_bins) {throw MyException("Should not be called.\n.");}
|
||||
int get_number_E_bins() {return 1;}
|
||||
Bins get_loc_bin(const vec3 & loc_m) {throw MyException("Should not be called.\n.");}
|
||||
double get_E_bin_mid_eV(const int &E_bin) {throw MyException("Should not be called.\n.");}
|
||||
|
||||
vec3 roll_x_ms();
|
||||
vec3 roll_v_ms (const vec3 &loc_m) {return kinematics->get_v_ms(loc_m);}
|
||||
vec3 get_drift_v_ms(const vec3 &loc_m) {return kinematics->get_v_offset_ms(loc_m);}
|
||||
double get_thermal_v_ms() {return kinematics->get_thermal_v_ms();}
|
||||
double get_v_pdf(const double &v_ms) {return kinematics->get_v_pdf(v_ms);}
|
||||
|
||||
Population_Container *access_container() {return nullptr;};
|
||||
|
||||
std::vector<double> slopes;
|
||||
std::vector<double> z_min_m;
|
||||
std::vector<double> reduction_min;
|
||||
};
|
||||
|
||||
const double T2_Population::wgtsT2MaxDensity_m3 = load_parameter("T2_MAXDENS");
|
||||
|
||||
inline void T2_Population::set_regimes() {
|
||||
n_regimes = 5;
|
||||
double reds[6] = {reduction_tot_rear, reduction_rear_wgts, reduction_WGTS_rear, 1, reduction_WGTS_front, reduction_tot_front};
|
||||
double zs[6] = {z_RW_m, z_rear_m, z_WGTS_start_m, z_WGTS_mid_m, z_WGTS_end_m, z_DPS_end_m};
|
||||
reduction_min = new double[n_regimes];
|
||||
double reduction_max;
|
||||
z_min_m = new double[n_regimes];
|
||||
double z_max_m;
|
||||
slopes = new double[n_regimes];
|
||||
for (int i = 0; i<n_regimes; i++) {
|
||||
reduction_min[i] = reds[i];
|
||||
reduction_max = reds[i+1];
|
||||
z_min_m[i] = zs[i];
|
||||
z_max_m = zs[i+1];
|
||||
slopes[i] = (reduction_max-reduction_min[i])/(z_max_m-z_min_m[i]);
|
||||
}
|
||||
}
|
||||
|
||||
inline double T2_Population::get_density_m3(const vec3 &loc_m) {
|
||||
double z_m = calc_z_m(loc_m);
|
||||
for (int i = (n_regimes-1); i>=0; i--) {
|
||||
if (z_m>z_min_m[i]) {
|
||||
double reduction_factor = reduction_min[i] + (z_m-z_min_m[i])*slopes[i];
|
||||
return reduction_factor * wgtsT2MaxDensity_m3;
|
||||
}
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss<<"T2_Population::calc_DensityTriangle: z_m outside of Katrin.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline vec3 T2_Population::roll_x_ms() {
|
||||
double r_m = r_WGTS_m*sqrt(rngUni->random());
|
||||
double phi = rngUni->random()*2*pi;
|
||||
|
||||
double eta1, eta2, z_can_m;
|
||||
do {
|
||||
eta1 = rngUni->random();
|
||||
eta2 = rngUni->random();
|
||||
z_can_m = z_RW_m + eta1*(z_WGTS_end_m - z_RW_m);
|
||||
} while(eta2*wgtsT2MaxDensity_m3 > get_density_m3(vec3(0,0, z_can_m)));
|
||||
return vec3 (r_m*cos(phi) ,r_m*sin(phi) ,z_can_m);
|
||||
}
|
||||
|
||||
|
||||
#endif /* tritium2_population_h */
|
||||
#endif /* TRITIUM2_POPULATION_H */
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
//
|
||||
// vec3_container.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 02.09.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "vec3_container.hpp"
|
||||
|
||||
|
||||
#include "read_system.h"
|
||||
|
||||
Vec3_Container::Vec3_Container(int num_z_bins, int num_r_bins, int num_phi_bins, std::string load_path) {
|
||||
z_scale = Lin_Scale(z_WGTS_start_m, z_WGTS_end_m, num_z_bins);
|
||||
z_scale = Lin_Scale(z_RW_m, z_DPS_m, num_z_bins);
|
||||
r_scale = Lin_Scale(0, r_WGTS_m, num_r_bins);
|
||||
phi_scale = Lin_Scale(0, 180, num_phi_bins);
|
||||
int num_tot_bins = num_z_bins * num_r_bins * num_phi_bins;
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
//
|
||||
// velocity_container.cpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 30.07.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#include "velocity_container.hpp"
|
||||
|
||||
#include "read_system.h"
|
||||
|
||||
Velocity_Container::Velocity_Container(std::string load_path) {
|
||||
z_scale = Lin_Scale(z_WGTS_start_m, z_WGTS_end_m, num_z_bins);
|
||||
z_scale = Lin_Scale(z_rear_pp2, z_front_pp1, num_z_bins);
|
||||
r_scale = Lin_Scale(0, r_WGTS_m, num_r_bins);
|
||||
int num_tot_bins = num_z_bins * num_r_bins;
|
||||
vz_data = new double[num_tot_bins];
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef wgts_kinematics_h
|
||||
#define wgts_kinematics_h
|
||||
#ifndef WGTS_KINEMATICS_H
|
||||
#define WGTS_KINEMATICS_H
|
||||
|
||||
#include "velocity_container.hpp"
|
||||
|
||||
#include "random_operations.h"
|
||||
|
||||
class Base_Kinematics {
|
||||
UniRNG *rngUni;
|
||||
@@ -48,9 +48,14 @@ public:
|
||||
WGTS_Kinematics(double m_eV, double wgtsTemp_K, UniRNG *rngUni, NormalRNG *rngNormal) : Base_Kinematics(m_eV, wgtsTemp_K, rngUni, rngNormal), v_data(get_data_path() + "velocity.dat") {}
|
||||
|
||||
vec3 get_v_offset_ms(const vec3 &loc_m) {
|
||||
if (calc_z_m(loc_m)<z_WGTS_start_m) {
|
||||
const double z = calc_z_m(loc_m);
|
||||
if (z < z_rear_pp2) {
|
||||
return vec3(0,0,0);
|
||||
} else {
|
||||
}
|
||||
else if(z >= z_front_pp1){
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
else {
|
||||
return v_data.get_v_ms (loc_m);
|
||||
}
|
||||
}
|
||||
@@ -68,4 +73,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif /* wgts_kinematics_h */
|
||||
#endif /* WGTS_KINEMATICS_H */
|
||||
|
||||
@@ -73,7 +73,7 @@ inline Zylindric_Cords::Zylindric_Cords(double z_min_m, double z_max_m, double r
|
||||
|
||||
inline void Zylindric_Cords::set_fromKatrinGeo() {
|
||||
this->z_min_m = z_RW_m;
|
||||
this->z_max_m = z_WGTS_end_m;
|
||||
this->z_max_m = z_DPS_m;
|
||||
this->r_max_m = r_WGTS_m;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user