@@ -76,23 +76,35 @@ Fit_Element_Map<T_real>::Fit_Element_Map(std::string name, Element_Info<T_real>*
7676 int idx = _full_name.find_last_of (" _" ) + 1 ;
7777 if (idx == 0 )
7878 {
79- _shell_type = " K " ;
79+ _shell_type = Electron_Shell::K_SHELL ;
8080 }
8181 else
8282 {
83- _shell_type = _full_name.substr (idx);
83+ std::string str_shell = _full_name.substr (idx);
84+ if (str_shell == " L" )
85+ {
86+ _shell_type = Electron_Shell::L_SHELL;
87+ }
88+ else if (str_shell == " L" )
89+ {
90+ _shell_type = Electron_Shell::L_SHELL;
91+ }
92+ else // default to K shell
93+ {
94+ _shell_type = Electron_Shell::K_SHELL;
95+ }
8496 }
8597
8698
87- if (_shell_type == " K " ) // K line
99+ if (_shell_type == Electron_Shell::K_SHELL ) // K line
88100 {
89101 num_ratios = 4 ;
90102 }
91- else if (_shell_type == " L " )
103+ else if (_shell_type == Electron_Shell::L_SHELL )
92104 {
93105 num_ratios = 12 ;
94106 }
95- else if (_shell_type == " M " )
107+ else if (_shell_type == Electron_Shell::M_SHELL )
96108 {
97109 num_ratios = 4 ;
98110 }
@@ -131,7 +143,7 @@ void Fit_Element_Map<T_real>::init_energy_ratio_for_detector_element(const Eleme
131143
132144 _energy_ratios.clear ();
133145
134- if (_shell_type == " K " ) // K line
146+ if (_shell_type == Electron_Shell::K_SHELL ) // K line
135147 {
136148 if (_pileup_element_info != nullptr ) // pileup's
137149 {
@@ -163,7 +175,7 @@ void Fit_Element_Map<T_real>::init_energy_ratio_for_detector_element(const Eleme
163175
164176
165177 }
166- else if (_shell_type == " L " )
178+ else if (_shell_type == Electron_Shell::L_SHELL )
167179 {
168180 _center = _element_info->xrf [" la1" ];
169181 if (false == disable_La)
@@ -182,7 +194,7 @@ void Fit_Element_Map<T_real>::init_energy_ratio_for_detector_element(const Eleme
182194 generate_energy_ratio (_element_info->xrf [" ll" ], (_element_info->xrf_abs_yield [" ll" ] / _element_info->xrf_abs_yield [" la1" ]) * _energy_ratio_custom_multipliers[10 ], Element_Param_Type::Ll_Line, detector_element);
183195 generate_energy_ratio (_element_info->xrf [" ln" ], (_element_info->xrf_abs_yield [" ln" ] / _element_info->xrf_abs_yield [" la1" ]) * _energy_ratio_custom_multipliers[11 ], Element_Param_Type::Ln_Line, detector_element);
184196 }
185- else if (_shell_type == " M " )
197+ else if (_shell_type == Electron_Shell::M_SHELL )
186198 {
187199 // M5 - N7
188200 T_real ratio = 1.0 ;
@@ -357,7 +369,7 @@ bool Fit_Element_Map<T_real>::check_binding_energy(T_real incident_energy, int e
357369 {
358370 if ( _pileup_element_info != nullptr )
359371 {
360- if (_shell_type == " K " )
372+ if (_shell_type == Electron_Shell::K_SHELL )
361373 {
362374 if (_center < incident_energy)
363375 {
@@ -367,14 +379,14 @@ bool Fit_Element_Map<T_real>::check_binding_energy(T_real incident_energy, int e
367379 }
368380 else
369381 {
370- if (_shell_type == " K " )
382+ if (_shell_type == Electron_Shell::K_SHELL )
371383 {
372384 if (_element_info->bindingE [" K" ] < incident_energy)
373385 {
374386 return true ;
375387 }
376388 }
377- else if (_shell_type == " L " )
389+ else if (_shell_type == Electron_Shell::L_SHELL )
378390 {
379391 switch (energy_ratio_idx)
380392 {
@@ -409,7 +421,7 @@ bool Fit_Element_Map<T_real>::check_binding_energy(T_real incident_energy, int e
409421 break ;
410422 }
411423 }
412- else if (_shell_type == " M " )
424+ else if (_shell_type == Electron_Shell::M_SHELL )
413425 {
414426 if (_element_info->bindingE [" M1" ] < incident_energy)
415427 {
@@ -425,6 +437,43 @@ bool Fit_Element_Map<T_real>::check_binding_energy(T_real incident_energy, int e
425437 return false ;
426438}
427439
440+ // -----------------------------------------------------------------------------
441+
442+ template <typename T_real>
443+ std::unordered_map<std::string, T_real> Fit_Element_Map<T_real>::generate_roi_centers_per_shell()
444+ {
445+ std::unordered_map<std::string, T_real> map;
446+ if (_shell_type == Electron_Shell::K_SHELL)
447+ {
448+ map[" ka1" ] = _element_info->xrf [" ka1" ];
449+ map[" ka2" ] = _element_info->xrf [" ka2" ];
450+ map[" kb1" ] = _element_info->xrf [" kb1" ];
451+ map[" kb2" ] = _element_info->xrf [" kb2" ];
452+ }
453+ else if (_shell_type == Electron_Shell::L_SHELL)
454+ {
455+ map[" la2" ] = _element_info->xrf [" la2" ];
456+ map[" lb1" ] = _element_info->xrf [" lb1" ];
457+ map[" lb2" ] = _element_info->xrf [" lb2" ];
458+ map[" lb3" ] = _element_info->xrf [" lb3" ];
459+ map[" lb4" ] = _element_info->xrf [" lb4" ];
460+ map[" lg1" ] = _element_info->xrf [" lg1" ];
461+ map[" lg2" ] = _element_info->xrf [" lg2" ];
462+ map[" lg3" ] = _element_info->xrf [" lg3" ];
463+ map[" lg4" ] = _element_info->xrf [" lg4" ];
464+ map[" ll" ] = _element_info->xrf [" ll" ];
465+ map[" ln" ] = _element_info->xrf [" ln" ];
466+ }
467+ else if (_shell_type == Electron_Shell::M_SHELL)
468+ {
469+ map[" ma1" ] = _element_info->xrf [" ma1" ];
470+ map[" ma2" ] = _element_info->xrf [" ma2" ];
471+ map[" mb" ] = _element_info->xrf [" mb" ];
472+ map[" mg" ] = _element_info->xrf [" mg" ];
473+ }
474+ return map;
475+ }
476+
428477// -----------------------------------------------------------------------------
429478// -----------------------------------------------------------------------------
430479
0 commit comments