Screenshot with working ionization function.
Ionization will be changed to BED model.
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// parameter.hpp
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 20.09.18.
|
||||
// Copyright © 2018 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef parameter_hpp
|
||||
#define parameter_hpp
|
||||
|
||||
#include "constants.hpp"
|
||||
#include "functions.hpp"
|
||||
|
||||
|
||||
class Parameter: protected Constants {
|
||||
public:
|
||||
virtual ~Parameter(){};
|
||||
|
||||
Parameter() {
|
||||
// Simulation Specs
|
||||
seed = (int)getValue("seed");
|
||||
numTotalElectrons = (long int)getValue("numTotalElectrons");
|
||||
dt_s = getValue("dt_s");
|
||||
injectionMethod = (int)getValue("injectionMethod");
|
||||
deltaKinEnergy_eV = getValue("deltaKinEnergy_eV");
|
||||
MBTemp_K = getValue("MBTemp_K");
|
||||
elaOn = (int)getValue("elaOn");
|
||||
ionOn = (int)getValue("ionOn");
|
||||
propagationMethod = (int)getValue("propagationMethod");
|
||||
|
||||
// Cutoff
|
||||
cutoffMode = (int)getValue("cutoffMode");
|
||||
cutoffEnergySet_eV = getValue("cutoffEnergySet_eV");
|
||||
cutoffFactor = getValue("cutoffFactor");
|
||||
|
||||
// Katrin Specs
|
||||
wgtsMagField_T = getValue("wgtsMagField_T");
|
||||
wgtsLength_m = getValue("wgtsLength_m");
|
||||
wgtsRadius_m = getValue("wgtsRadius_m");
|
||||
wgtsT2Density_m3 = getValue("wgtsT2Density_m3");
|
||||
wgtsTemp_K = getValue("wgtsTemp_K");
|
||||
wgtsT2FlowSpeed_ms = getValue("wgtsT2FlowSpeed_ms");
|
||||
|
||||
// Output
|
||||
numberZBins = getValue ("numberZBins");
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
//Simulation Specs
|
||||
int seed;
|
||||
long int numTotalElectrons;
|
||||
double dt_s;
|
||||
int injectionMethod; // 0 = Beta Decay, 1 = Delta, 2 = Maxwell Boltzmann
|
||||
double deltaKinEnergy_eV;
|
||||
double MBTemp_K;
|
||||
int elaOn;
|
||||
int ionOn;
|
||||
int propagationMethod; // 0 = Drift Approximation, 1 = Borispush
|
||||
|
||||
// Cutoff
|
||||
int cutoffMode; // 0 = Energy from Parameter, 1 = WGTSTemperature*cutoffFactor
|
||||
double cutoffEnergySet_eV;
|
||||
double cutoffFactor;
|
||||
|
||||
//KATRIN Specs
|
||||
double wgtsMagField_T;
|
||||
double wgtsLength_m;
|
||||
double wgtsRadius_m;
|
||||
double wgtsT2Density_m3;
|
||||
double wgtsTemp_K;
|
||||
double wgtsT2FlowSpeed_ms;
|
||||
|
||||
// Output
|
||||
int numberZBins;
|
||||
|
||||
private:
|
||||
double getValue(string varName, char* ext = (char*)("cat")) {
|
||||
char* str = strdup(varName.c_str());
|
||||
double temp;
|
||||
char dummy[256];
|
||||
char fname[256],*pname;
|
||||
FILE *fcat;
|
||||
|
||||
if (getenv("poub") == NULL)
|
||||
{
|
||||
throw ("Parameter::value: Environment variable poub not defined.");
|
||||
}
|
||||
strcpy(fname, getenv("poub"));
|
||||
pname = getenv("pname");
|
||||
if (pname == NULL)
|
||||
{
|
||||
throw ("Parameter::value: Environment variable pname not defined.");
|
||||
}
|
||||
if (!ext)
|
||||
{
|
||||
ext = (char*)("cat");
|
||||
}
|
||||
sprintf(fname,"%s/%s.%s",getenv("poub"),getenv("pname"), ext);
|
||||
if (!(fcat = fopen(fname, "r")))
|
||||
{
|
||||
stringstream ss;
|
||||
ss<<"Parameter::value: Can not open file " <<fname<<".";
|
||||
throw (ss.str());
|
||||
}
|
||||
while (!feof(fcat))
|
||||
{
|
||||
// fscanf(fcat, "'%s%*[^']'%F%*[^']",dummy,&temp); 1
|
||||
fscanf(fcat, "%s = %lf", dummy, &temp);
|
||||
// if (strncmp(dummy, str,strlen(str)) == 0) {
|
||||
if (strcmp(dummy, str) == 0)
|
||||
{
|
||||
fclose(fcat);
|
||||
return(temp);
|
||||
}
|
||||
}
|
||||
fclose(fcat);
|
||||
|
||||
stringstream ss;
|
||||
ss<<"Parameter::value: Variable "<<str<<" not found.";
|
||||
throw (ss.str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user