@@ -858,6 +858,7 @@ void RefLineDynamic::startUpdateLines()
858858 return static_cast <const ReactionGamma *>(nullptr ); }
859859 )();
860860
861+ char buffer[64 ] = { ' \0 ' };
861862
862863 SpecUtilsAsync::ThreadPool pool;
863864
@@ -1476,7 +1477,8 @@ void RefLineDynamic::startUpdateLines()
14761477 ReferenceLineInfo::RefLine se_line;
14771478 se_line.m_energy = se_energy;
14781479 se_line.m_normalized_intensity = se_amplitude;
1479- se_line.m_decaystr = " S.E." ;
1480+ snprintf ( buffer, sizeof (buffer), " S.E. of %.1f keV" , peak_energy );
1481+ se_line.m_decaystr = buffer;
14801482 se_line.m_parent_nuclide = peak->parentNuclide ();
14811483 se_line.m_transition = peak->nuclearTransition ();
14821484 se_line.m_reaction = peak->reaction ();
@@ -1493,7 +1495,8 @@ void RefLineDynamic::startUpdateLines()
14931495 ReferenceLineInfo::RefLine de_line;
14941496 de_line.m_energy = de_energy;
14951497 de_line.m_normalized_intensity = de_amplitude;
1496- de_line.m_decaystr = " D.E." ;
1498+ snprintf ( buffer, sizeof (buffer), " D.E. of %.1f keV" , peak_energy );
1499+ de_line.m_decaystr = buffer;
14971500 de_line.m_parent_nuclide = peak->parentNuclide ();
14981501 de_line.m_transition = peak->nuclearTransition ();
14991502 de_line.m_reaction = peak->reaction ();
@@ -1884,7 +1887,7 @@ void RefLineDynamic::startUpdateLines()
18841887 }
18851888
18861889 // If the deadtime is over 15% (low resolution) or 25% (HPGe), add in lines for random sum peaks of largest peaks
1887- const double max_live_time_frac = 1.0 ; // highres ? 0.75 : 0.85;
1890+ const double max_live_time_frac = highres ? 0.75 : 0.85 ;
18881891 const double rt = foreground ? foreground->real_time () : 0.0 ;
18891892 const double lt = foreground ? foreground->live_time () : 0.0 ;
18901893 if ( (lt > 0.0 ) && (rt > 0.0 ) && (lt < max_live_time_frac*rt) )
@@ -1912,7 +1915,7 @@ void RefLineDynamic::startUpdateLines()
19121915 if ( !summing_candidates.empty () )
19131916 {
19141917 // Calculate random-summing probabilities for all pairs
1915- vector<tuple<double ,double ,double , double >> sum_peaks; // energy, rel probability, energy_i, energy_j
1918+ vector<tuple<double ,double ,shared_ptr< const PeakDef>,shared_ptr< const PeakDef>>> sum_peaks; // energy, rel probability, peak_i, peak_j
19161919
19171920 // Calculate maximum possible probability (highest peak with itself)
19181921 const double max_sum_prob = summing_candidates[0 ]->amplitude () * summing_candidates[0 ]->amplitude ();
@@ -1928,7 +1931,7 @@ void RefLineDynamic::startUpdateLines()
19281931 const double sum_prob = peak_i->amplitude () * peak_j->amplitude ();
19291932 const double rel_intensity = (sum_prob / max_sum_prob);
19301933 if ( rel_intensity >= rel_sum_prob_min )
1931- sum_peaks.emplace_back ( sum_energy, rel_intensity, peak_i-> mean () , peak_j-> mean () );
1934+ sum_peaks.emplace_back ( sum_energy, rel_intensity, peak_i, peak_j );
19321935 }// for( size_t j = i; j < summing_candidates.size(); ++j )
19331936 }// for( size_t i = 0; i < summing_candidates.size(); ++i )
19341937
@@ -1945,6 +1948,10 @@ void RefLineDynamic::startUpdateLines()
19451948 {
19461949 const double energy = std::get<0 >( sum_peak );
19471950 const double rel_intensity = std::get<1 >( sum_peak );
1951+ const shared_ptr<const PeakDef> &peak_i = std::get<2 >( sum_peak );
1952+ const shared_ptr<const PeakDef> &peak_j = std::get<3 >( sum_peak );
1953+ const double peak_i_energy = peak_i->mean ();
1954+ const double peak_j_energy = peak_j->mean ();
19481955
19491956 ReferenceLineInfo::RefLine ref_line;
19501957 ref_line.m_energy = energy;
@@ -1953,10 +1960,23 @@ void RefLineDynamic::startUpdateLines()
19531960 ref_line.m_particle_type = ReferenceLineInfo::RefLine::Particle::Gamma;
19541961 ref_line.m_source_type = ReferenceLineInfo::RefLine::RefGammaType::SumGammaPeak;
19551962 ref_line.m_attenuation_applies = false ;
1956- char buffer[64 ] = { ' \0 ' };
1957- snprintf ( buffer, sizeof (buffer), " Random sum %.1f + %.1f keV" , get<2 >(sum_peak), get<3 >(sum_peak) );
1963+ snprintf ( buffer, sizeof (buffer), " Random sum %.1f + %.1f keV" , peak_i_energy, peak_j_energy );
19581964 ref_line.m_decaystr = buffer;
19591965
1966+ if ( peak_i->hasSourceGammaAssigned () || peak_j->hasSourceGammaAssigned () )
1967+ {
1968+ const string name_i = peak_i->sourceName ();
1969+ const string name_j = peak_j->sourceName ();
1970+ if ( name_i == name_j )
1971+ {
1972+ ref_line.m_decaystr += " (" + name_i + " )" ;
1973+ }else
1974+ {
1975+ ref_line.m_decaystr += " (" + (name_i.empty () ? string (" ?" ) : name_i)
1976+ + " + " + (name_j.empty () ? string (" ?" ) : name_j) + " )" ;
1977+ }//
1978+ }// if( peak_i->hasSourceGammaAssigned() || peak_j->hasSourceGammaAssigned() )
1979+
19601980 sum_ref_info.m_ref_lines .push_back ( ref_line );
19611981 }// for( const auto &sum_peak : sum_peaks )
19621982
0 commit comments