Skip to content

Commit f7ce6d8

Browse files
author
Arthur Glowacki
committed
Fix bug not avg us_fm properly. Added update weight if greater. Basically for nbs 1832 1833 have an issue with Fe
1 parent f380f3d commit f7ce6d8

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/data_struct/detector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void Detector<T_real>::append_element(Fitting_Routines routine, std::string quan
112112
if (element != nullptr)
113113
{
114114
Electron_Shell shell = get_shell_by_name(name);
115-
fitting_quant_map.at(routine).update_weight(shell, element->number, weight);
115+
fitting_quant_map.at(routine).update_weight_if_greater(shell, element->number, weight);
116116

117117
if (fitting_quant_map.at(routine).quant_scaler_map.count(quant_scaler) > 0)
118118
{
@@ -274,7 +274,7 @@ void Detector<T_real>::generage_avg_quantification_scalers()
274274
if (itr.second.US_FM > 0.0)
275275
{
276276
avg_US_FM += itr.second.US_FM;
277-
us_cnt += 1.0;
277+
us_fm_cnt += 1.0;
278278
}
279279
if (itr.second.DS_IC > 0.0)
280280
{

src/data_struct/quantification_standard.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ struct DLL_EXPORT Fitting_Quantification_Struct
124124
}
125125
}
126126

127+
void update_weight_if_greater(Electron_Shell shell, unsigned int Z, T_real weight)
128+
{
129+
for (auto& itr : quant_scaler_map)
130+
{
131+
if(weight > itr.second.curve_quant_map.at(shell).at(Z - 1).weight)
132+
{
133+
itr.second.curve_quant_map.at(shell).at(Z - 1).weight = weight;
134+
}
135+
}
136+
}
137+
127138
// Quantifier {SR_Current, US_IC, DS_IC}
128139
std::unordered_map<std::string, Quantification_Scaler_Struct<T_real>> quant_scaler_map;
129140
// saved value from optimizer, {SR_Current, US_IC, DS_IC}

0 commit comments

Comments
 (0)