41 fLogPrimEnergyVector.clear();
42 fLogCrossSectionVector.clear();
44 for (
auto p : fLogSecondEnergyMatrix) {
49 fLogSecondEnergyMatrix.clear();
51 for (
auto p : fLogProbMatrix) {
56 fLogProbMatrix.clear();
58 for (
auto p : fLogProbMatrixIndex) {
65 fLogProbMatrixIndex.clear();
71 fLogPrimEnergyVector.clear();
72 fLogCrossSectionVector.clear();
73 fLogSecondEnergyMatrix.clear();
74 fLogProbMatrix.clear();
75 fLogProbMatrixIndex.clear();
82 std::vector<double>* aLogSecondEnergyVector,
83 std::vector<double>* aLogProbVector,
89 fLogPrimEnergyVector.push_back(aLogPrimEnergy);
90 fLogCrossSectionVector.push_back(aLogCS);
91 fLogSecondEnergyMatrix.push_back(aLogSecondEnergyVector);
92 fLogProbMatrix.push_back(aLogProbVector);
94 std::vector<size_t>* aLogProbVectorIndex =
nullptr;
96 if(n_pro_decade > 0 && !aLogProbVector->empty())
98 aLogProbVectorIndex =
new std::vector<size_t>();
99 G4double dlog = std::log(10.) / n_pro_decade;
101 int(std::min((*aLogProbVector)[0], aLogProbVector->back()) / dlog) * dlog;
102 fLog0Vector.push_back(log_val);
107 aLogProbVectorIndex->push_back(
108 theInterpolator->
FindPosition(log_val, (*aLogProbVector)));
114 fLog0Vector.push_back(0.);
116 fLogProbMatrixIndex.push_back(aLogProbVectorIndex);
124 std::vector<double>*& aLogSecondEnergyVector,
125 std::vector<double>*& aLogProbVector,
126 std::vector<size_t>*& aLogProbVectorIndex)
128 if(i >= fNbPrimEnergy)
130 aLogPrimEnergy = fLogPrimEnergyVector[i];
131 aLogCS = fLogCrossSectionVector[i];
132 aLogSecondEnergyVector = fLogSecondEnergyMatrix[i];
133 aLogProbVector = fLogProbMatrix[i];
134 aLogProbVectorIndex = fLogProbMatrixIndex[i];
135 log0 = fLog0Vector[i];
142 std::fstream FileOutput(file_name, std::ios::out);
143 FileOutput << std::setiosflags(std::ios::scientific);
144 FileOutput << std::setprecision(6);
145 FileOutput << fLogPrimEnergyVector.size() <<
G4endl;
146 for(
size_t i = 0; i < fLogPrimEnergyVector.size(); ++i)
148 FileOutput << std::exp(fLogPrimEnergyVector[i]) / MeV <<
'\t'
149 << std::exp(fLogCrossSectionVector[i]) <<
G4endl;
151 FileOutput << fLogSecondEnergyMatrix[i]->size() <<
G4endl;
152 for(
size_t j = 0; j < fLogSecondEnergyMatrix[i]->size(); ++j)
154 FileOutput << std::exp((*fLogSecondEnergyMatrix[i])[j]);
167 FileOutput << fLogProbMatrix[i]->size() <<
G4endl;
168 for(
size_t j = 0; j < fLogProbMatrix[i]->size(); ++j)
170 FileOutput << std::exp((*fLogProbMatrix[i])[j]);
188 std::fstream FileOutput(file_name, std::ios::in);
191 fLogPrimEnergyVector.clear();
192 fLogCrossSectionVector.clear();
193 fLogSecondEnergyMatrix.clear();
194 fLogProbMatrix.clear();
196 for(
size_t i = 0; i < n1; ++i)
199 FileOutput >> E >> CS;
200 fLogPrimEnergyVector.push_back(E);
201 fLogCrossSectionVector.push_back(CS);
203 fLogSecondEnergyMatrix.push_back(
new std::vector<G4double>());
204 fLogProbMatrix.push_back(
new std::vector<G4double>());
206 for(
size_t j = 0; j < n2; ++j)
210 fLogSecondEnergyMatrix[i]->push_back(E1);
213 for(
size_t j = 0; j < n2; ++j)
217 fLogProbMatrix[i]->push_back(prob);
void Write(G4String file_name)
G4bool GetData(unsigned int i, G4double &aPrimEnergy, G4double &aCS, G4double &log0, std::vector< double > *&aLogSecondEnergyVector, std::vector< double > *&aLogProbVector, std::vector< size_t > *&aLogProbVectorIndex)
void AddData(G4double aPrimEnergy, G4double aCS, std::vector< double > *aLogSecondEnergyVector, std::vector< double > *aLogProbVector, size_t n_pro_decade=0)
G4AdjointCSMatrix(G4bool aBool)
void Read(G4String file_name)
static G4AdjointInterpolator * GetInstance()
size_t FindPosition(G4double &x, std::vector< G4double > &x_vec, size_t ind_min=0, size_t ind_max=0)