Skip to content

Commit

Permalink
Allow using annihilation gammas for "Isotopics from peaks" tool.
Browse files Browse the repository at this point in the history
I cant think of a reason why this wouldnt be valid; looks to work well for Na22.
  • Loading branch information
wcjohns committed Feb 24, 2024
1 parent d83d000 commit b9b2da3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion InterSpec/PeakDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1216,10 +1216,10 @@ bool PeakDef::useForManualRelEff() const
switch( m_sourceGammaType )
{
case PeakDef::NormalGamma:
case PeakDef::AnnihilationGamma:
return m_useForManualRelEff;

case PeakDef::XrayGamma:
case PeakDef::AnnihilationGamma:
case PeakDef::SingleEscapeGamma:
case PeakDef::DoubleEscapeGamma:
break;
Expand Down
37 changes: 28 additions & 9 deletions src/PeakModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,11 +2076,23 @@ boost::any PeakModel::data( const WModelIndex &index, int role ) const

case kUseForManualRelEff:
{
if( (!peak->parentNuclide() && !peak->reaction())
|| (peak->sourceGammaType() != PeakDef::SourceGammaType::NormalGamma) )
return boost::any();
switch( peak->sourceGammaType() )
{
case PeakDef::NormalGamma:
case PeakDef::AnnihilationGamma:
if( !peak->parentNuclide() && !peak->reaction() )
return boost::any();
break;

case PeakDef::XrayGamma:
case PeakDef::SingleEscapeGamma:
case PeakDef::DoubleEscapeGamma:
return boost::any();
break;
}//switch( peak->sourceGammaType() )

return peak->useForManualRelEff();
}
}//case kUseForManualRelEff:

case kPeakLineColor:
{
Expand Down Expand Up @@ -2924,10 +2936,17 @@ bool PeakModel::setData( const WModelIndex &index,
try
{
const bool use = boost::any_cast<bool>( value );
if( use && ((!new_peak.parentNuclide() && !new_peak.reaction())
|| (new_peak.sourceGammaType() != PeakDef::SourceGammaType::NormalGamma) ) )
passMessage( "Only peaks associated with a nuclides gamma can be used for relative"
" activity analysis.", WarningWidget::WarningMsgHigh );

if( use )
{
const bool has_parent = (new_peak.parentNuclide() || new_peak.reaction());
const bool is_gamma = ((new_peak.sourceGammaType() == PeakDef::SourceGammaType::NormalGamma)
|| (new_peak.sourceGammaType() == PeakDef::SourceGammaType::AnnihilationGamma) );

if( !has_parent || !is_gamma )
passMessage( "Only peaks associated with a nuclides gamma can be used for relative"
" activity analysis.", WarningWidget::WarningMsgHigh );
}//if( use )

if( use == new_peak.useForManualRelEff() )
return false;
Expand Down Expand Up @@ -3095,7 +3114,7 @@ boost::any PeakModel::headerData( int section, Orientation orientation, int role
case kUseForShieldingSourceFit: return boost::any();
case kCandidateIsotopes: return boost::any();
case kUseForCalibration: return boost::any();
case kUseForManualRelEff: return boost::any( WString("Use for &quot;Isotopics from peaks&quot; analysis.") );
case kUseForManualRelEff: return boost::any( WString("Use for \"Isotopics from peaks\" analysis.") );
case kPeakLineColor: return boost::any( WString("Peak color") );
case kUserLabel: return boost::any( WString("User specified label") );
case kRoiCounts: return boost::any( WString("Integral of gamma counts over the region of interest") );
Expand Down

0 comments on commit b9b2da3

Please sign in to comment.