Skip to content

Commit 5d39b61

Browse files
committed
Fix bug in which samples to correct peaks for energy calibration.
Previously, for multi-record files, was checking if all the affected sample numbers were in the peaks samples numbers. But now checks for all the peaks sample numbers, that they are being energy adjusted (an inversion of check).
1 parent 79374bf commit 5d39b61

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

InterSpec/EnergyCalTool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ enum class MoreActionsIndex : int
146146
NumMoreActionsIndex
147147
};//enum MoreActionsIndex
148148

149-
/** A struct that indicates what SpecUtils::Measurement's to apply a coefficent change to.
150-
\TODO: if (or hopefully when) the InterSpec class allows selecting detectors seperately for
149+
/** A struct that indicates what SpecUtils::Measurement's to apply a coefficient change to.
150+
\TODO: if (or hopefully when) the InterSpec class allows selecting detectors separately for
151151
foreground/back/sec., we will need to consider upgrading how we indicate things \
152152
because there is an edge-case where detectors wanted will differ by sample number
153153
@@ -251,7 +251,7 @@ class EnergyCalTool : public Wt::WContainerWidget
251251
std::string applyToSummaryTxt() const;
252252

253253
/** Returns which SpecUtils::Measurement need to be updated, based on what files are loaded and
254-
what options the user has choosen.
254+
what options the user has chosen.
255255
*/
256256
std::vector<MeasToApplyCoefChangeTo> measurementsToApplyCoeffChangeTo();
257257

src/EnergyCalTool.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,8 +2600,14 @@ void EnergyCalTool::applyCalChange( std::shared_ptr<const SpecUtils::EnergyCalib
26002600
for( const set<int> &samples : samples_with_peaks )
26012601
{
26022602
bool all_samples = true;
2603-
for( const int sample : change.sample_numbers )
2604-
all_samples = (all_samples && samples.count(sample));
2603+
2604+
// Check if the peaks sample numbers are all getting re-calibrated
2605+
for( auto sample_num_iter = begin(samples);
2606+
all_samples && (sample_num_iter != end(samples));
2607+
++sample_num_iter )
2608+
{
2609+
all_samples = (change.sample_numbers.count(*sample_num_iter) != 0u);
2610+
}
26052611

26062612
if( all_samples )
26072613
peaksamples.insert( samples );
@@ -2610,8 +2616,14 @@ void EnergyCalTool::applyCalChange( std::shared_ptr<const SpecUtils::EnergyCalib
26102616
for( const set<int> &samples : samples_with_hint_peaks )
26112617
{
26122618
bool all_samples = true;
2613-
for( const int sample : change.sample_numbers )
2614-
all_samples = (all_samples && samples.count(sample));
2619+
2620+
// Check if the peaks sample numbers are all getting re-calibrated
2621+
for( auto sample_num_iter = begin(samples);
2622+
all_samples && (sample_num_iter != end(samples));
2623+
++sample_num_iter )
2624+
{
2625+
all_samples = (change.sample_numbers.count(*sample_num_iter) != 0u);
2626+
}
26152627

26162628
if( all_samples )
26172629
hintPeakSamples.insert( samples );

0 commit comments

Comments
 (0)