File indexing completed on 2025-01-31 09:22:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "ParametersParser.hh"
0031
0032 #include <fstream>
0033 #include <iostream>
0034 #include <sstream>
0035
0036
0037
0038 ParametersParser* ParametersParser::fInstance = nullptr;
0039
0040
0041
0042 ParametersParser* ParametersParser::Instance()
0043 {
0044 if (fInstance == nullptr) {
0045 static ParametersParser parParser;
0046 fInstance = &parParser;
0047 }
0048 return fInstance;
0049 }
0050
0051
0052
0053 ParametersParser::ParametersParser()
0054 {
0055 fSDDfileName = "SDDformat_"+fOutputName;
0056 }
0057
0058
0059
0060 void ParametersParser::LoadParameters(const std::string &fileName)
0061 {
0062 std::ifstream file;
0063 file.open(fileName.c_str());
0064 if (!file.is_open()) {
0065 std::cout<<"ParametersParser::LoadParameters Error in openning file!!!"<<std::endl;
0066 } else {
0067 std::string line;
0068 while(std::getline(file, line))
0069 {
0070 std::istringstream iss(line);
0071 std::string flag;
0072 iss >> flag;
0073 std::string tvalue;
0074 iss >> tvalue;
0075 if (flag == "/ana/thresholdFordirectSBSelection") fThresholdE = (tvalue);
0076 if (flag == "/ana/probForIndirectSBSelection") fProbabilityForIndirectSB = (tvalue);
0077 if (flag == "/ana/BpForDSB") BpForDSB = std::stoi(tvalue);
0078 if (flag == "/ana/TLK/lambda1") TLKLambda1 = (tvalue);
0079 if (flag == "/ana/TLK/lambda2") TLKLambda2 = (tvalue);
0080 if (flag == "/ana/TLK/beta1") TLKBeta1 = (tvalue);
0081 if (flag == "/ana/TLK/beta2") TLKBeta2 = (tvalue);
0082 if (flag == "/ana/TLK/eta") TLKEta = (tvalue);
0083 if (flag == "/ana/TLK/doseMax") TLKdoseMax = (tvalue);
0084 if (flag == "/ana/TLK/deltaDose") TLKdeltaDose = (tvalue);
0085 if (flag == "/ana/LEMIV/loopLength") LEMIVLoopLength = tvalue;
0086 if (flag == "/ana/LEMIV/Ni") LEMIVNi = tvalue;
0087 if (flag == "/ana/LEMIV/Nc") LEMIVNc = tvalue;
0088 if (flag == "/ana/LEMIV/NDSB") LEMIVNDSB = tvalue;
0089 if (flag == "/ana/LEMIV/Funrej") LEMIVFunrej = tvalue;
0090 if (flag == "/ana/LEMIV/Tfast") LEMIVTfast = tvalue;
0091 if (flag == "/ana/LEMIV/Tslow") LEMIVTslow = tvalue;
0092 if (flag == "/ana/LEMIV/timeMax") LEMIVtimeMax = tvalue;
0093 if (flag == "/ana/LEMIV/deltaTime") LEMIVdeltaTime = tvalue;
0094 if (flag == "/ana/BELOV/Nirrep") BELOVNirrep = tvalue;
0095 if (flag == "/ana/BELOV/Dz") BELOVDz = tvalue;
0096
0097 if (flag == "/ana/TLK/used") useTLK = tvalue;
0098 if (flag == "/ana/LEMIV/used") useLEMIV = tvalue;
0099 if (flag == "/ana/BELOV/used") useBELOV = tvalue;
0100
0101 if (flag == "/ana/ouputName") fOutputName = tvalue;
0102 if (flag == "/ana/cellNucleusName") fCellNucleusName = tvalue;
0103 if (flag == "/ana/loadDamagesFromSDD") {
0104 fSDDfileName = tvalue;
0105 fLoadDamagesFromSDD = true;
0106 }
0107 if (flag == "/ana/unitOfNormalization") fUnitOfNormalization = std::stoi(tvalue);
0108
0109 if (flag == "/ana/skipIndirectDamages") fSkipScanningIndirectDamage = true;
0110
0111 if (flag == "/gps/particle") fParticleName = (tvalue);
0112 if (flag == "/gps/energy") {
0113 fParticleEnergy = std::stof(tvalue);
0114 iss >> tvalue;
0115 fEnergyUnit = tvalue;
0116 }
0117 if (flag == "/run/beamOn") fNumberOfParticles = std::stoi(tvalue);
0118 if (flag == "/scheduler/endTime") {
0119 fEndTimeForChemReactions = tvalue;
0120 iss >> tvalue;
0121 fEndTimeForChemReactions += tvalue;
0122 }
0123 }
0124 }
0125 }
0126
0127
0128
0129 bool ParametersParser::UseTLK()
0130 {
0131 bool used = false;
0132 if (useTLK == "true" || useTLK == "TRUE" || useTLK == "True" || useTLK == "1" ||
0133 useTLK == "yes" || useTLK == "YES" || useTLK == "Yes") used = true;
0134 return used;
0135 }
0136
0137
0138
0139 bool ParametersParser::UseLEMIV()
0140 {
0141 bool used = false;
0142 if (useLEMIV == "true" || useLEMIV == "TRUE" || useLEMIV== "True" || useLEMIV == "1" ||
0143 useLEMIV == "yes" || useLEMIV == "YES"|| useLEMIV == "Yes") used = true;
0144 return used;
0145 }
0146
0147
0148
0149 bool ParametersParser::UseBelov()
0150 {
0151 bool used = false;
0152 if (useBELOV == "true" || useBELOV == "TRUE" || useBELOV == "True" || useBELOV == "1" ||
0153 useBELOV == "yes" || useBELOV == "YES"|| useBELOV == "Yes") used = true;
0154 return used;
0155 }