Commit bd7cd715 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Merge branch 'RecalEnergy' into 'preprod'

add an option in recalenergy to use only maximum instead of fitting the peaks

See merge request IPNL_GAMMA/narval_emulator!75
parents a67e4224 d8a67984
...@@ -101,6 +101,7 @@ bool doPoly1 = false; // linear ...@@ -101,6 +101,7 @@ bool doPoly1 = false; // linear
bool doPoly2 = false; // cubic bool doPoly2 = false; // cubic
int numZero = 0; // number of fake peaks at (0,0) int numZero = 0; // number of fake peaks at (0,0)
int modXtalk = 0; int modXtalk = 0;
bool MaxMode = false; // Dont fit peaks, only use max position
bool useErrors = false; // fit using position and energy errors bool useErrors = false; // fit using position and energy errors
double errE = 0.01; double errE = 0.01;
...@@ -609,6 +610,9 @@ getparams(int argc, char *argv[]) ...@@ -609,6 +610,9 @@ getparams(int argc, char *argv[])
else if(!strcmp(cmd, "-zero")) { else if(!strcmp(cmd, "-zero")) {
numZero++; numZero++;
} }
else if(!strcmp(cmd, "-max")) {
MaxMode = true;
}
else if(!strcmp(cmd, "-errors")) { else if(!strcmp(cmd, "-errors")) {
numparams(cmd, argc-argn-1); numparams(cmd, argc-argn-1);
errE = float(atof(argv[argn++])); errE = float(atof(argv[argn++]));
...@@ -1359,6 +1363,7 @@ int FitPeaks(int verbose) ...@@ -1359,6 +1363,7 @@ int FitPeaks(int verbose)
chanA = max(1,chanA); chanA = max(1,chanA);
chanB = min(chanB, specLength-2); chanB = min(chanB, specLength-2);
nmult = 0; nmult = 0;
if(nn < numpk-2) { if(nn < numpk-2) {
// check if the next peaks are in the same region // check if the next peaks are in the same region
for(size_t jj = nn+1; jj < specPeaks.size(); jj++) { for(size_t jj = nn+1; jj < specPeaks.size(); jj++) {
...@@ -1377,6 +1382,7 @@ int FitPeaks(int verbose) ...@@ -1377,6 +1382,7 @@ int FitPeaks(int verbose)
res.area = m_pCFit->Area(jj); res.area = m_pCFit->Area(jj);
res.ampli = m_pCFit->Amplitude(jj); res.ampli = m_pCFit->Amplitude(jj);
res.posi = m_pCFit->Position(jj); res.posi = m_pCFit->Position(jj);
if(MaxMode) res.posi = specPeaks[nn+jj];
res.fw05 = m_pCFit->Fw05(jj); res.fw05 = m_pCFit->Fw05(jj);
res.fw01 = m_pCFit->Fw01(jj); res.fw01 = m_pCFit->Fw01(jj);
res.fwhm = m_pCFit->Fwhm(jj); res.fwhm = m_pCFit->Fwhm(jj);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment