19 fSpectraFolderName(
""),
37 fCurrentspecFWHMdef(0),
38 fCurrentspecAMPLdef(0),
70 xP_0(0), xP_1(0), xP_2(0), xP_3(0), xP_4(0), xP_5(0), xP_6(0),
106 for(
int nspe = 0; nspe <
specNN; nspe++) {
137 cout<<Form(
"#1 %5d %6d %4d", nspe, ispec, np);
148 for(
size_t np_ = 0; np_ <
Peaks.size(); np_++) {
155 for(
size_t np_ = 0; np_ <
Peaks.size(); np_++) {
156 if(
Peaks[np_].good )
174 double refPeakPosi=0, refPeakEner=0;
178 for(
size_t irp = 0; irp <
Peaks.size(); irp++) {
181 refPeakPosi =
Peaks[irp].posi;
182 refPeakEner =
slope*refPeakPosi;
187 cout<<Form(
"%6d %6d %4d %3d", nspe, ispec, np, ngood);
189 cout<<Form(
"%6d %6d %4d %3d", nspe%
modXtalk, ispec/modXtalk, np, ngood);
192 for(
size_t np_ = 0; np_ <
Peaks.size(); np_++) {
193 if(
Peaks[np_].good) {
199 chi2 = (nused-1) ? chi2/(nused-1) : 0;
202 cout<<Form(
" %9.2f %8.3f %8.3f %9.0f %9.2f %6.1f %7.0f %7.3f %7.3f",
207 cout<<Form(
" %9.2f %8.3f %8.3f %9.0f %9.2f %6.1f %7.0f %7.3f %7.3f",
208 refPeakEner,
Peaks[iref].fw05,
Peaks[iref].fw01,
213 cout<<Form(
" %9.2f %8.3f %8.3f %9.0f %9.2f %6.1f %7.0f %7.3f %7.3f", 0., 0., 0., 0., 0., 0., 0., 0., 0.);
216 cout<<Form(
" %10.6f %6.2f",
slope*
hGain, min(999.99, chi2*100));
219 cout<<Form(
" %12.7f", 1./(
slope*hGain));
221 cout<<Form(
" %12.7f", 0.);
226 for(
size_t np_ = 0; np_ <
Peaks.size(); np_++) {
227 if(
Peaks[np_].good) {
233 chi2 = (nused-2)>0 ? chi2/(nused-2) : 0;
234 cout<<Form(
" %9.3f %10.6f %6.2f",
offset1,
slope1*hGain, min(999.99, chi2*100));
239 for(
size_t np_ = 0; np_ <
Peaks.size(); np_++) {
240 if(
Peaks[np_].good) {
246 chi2 = (nused-3)>0 ? chi2/(nused-3) : 0;
247 cout<<Form(
" %9.3f %10.6f % 10.4e %6.2f",
offset2,
slope2*hGain,
curv2*hGain*hGain, min(999.99, chi2*100));
251 cout<<Form(
"%6d %6d %4d %3d", nspe, ispec, np, ngood);
253 cout<<Form(
" %9.2f %8.3f %8.3f %9.0f %9.2f %6.1f %7.0f %7.3f %7.3f %11.3f",
257 cout<<Form(
" %9.2f %8.3f %8.3f %9.0f %9.2f %6.1f %7.0f %7.3f %7.3f %11.3f", 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.);
283 int* vpars = (
int *)
new int [npars];
306 for(
int nn = 0; nn <
specNN; nn++) {
310 for(
size_t nn = 0; nn <
nlim.size(); nn++) {
311 int ii =
nlim[nn].index;
317 else if(ii >= 0 && ii < specNN) {
324 cout <<
"# ***********************************"<<
endl;
325 cout <<
"# ***** *****"<<
endl;
326 cout <<
"# *** GWRecal Fit results ***"<<
endl;
327 cout <<
"# ***** *****"<<
endl;
328 cout <<
"# ***********************************"<<
endl;
329 cout <<
"# " <<
endl;
334 if(
nlim.size()) cout<<
"# Specific channel ranges:"<<endl;
335 for(
size_t i=0 ; i<
nlim.size() ; i++)
338 int LibNumber = lim.
index/38;
339 int HistNbr = lim.
index%38;
340 cout<<
"# ==> Seg nbr "<<Form(
"%2.0d in library %d",HistNbr,LibNumber)<<
": [ "<<lim.
from<<
" ; "<<lim.
to<<
" ]"<<
endl;
342 cout <<
"# " <<
endl;
345 if(
nwa.size()) cout<<
"# Specific peak limits:"<<endl;
346 for(
size_t i=0 ; i<
nwa.size() ; i++)
349 int LibNumber = tnwa.
index/38;
350 int HistNbr = tnwa.
index%38;
351 cout<<
"# ==> Seg nbr "<<Form(
"%2.0d in library %d",HistNbr,LibNumber)<<
": FWHM < "<<tnwa.
width<<
" ; Amplitude > "<<tnwa.
ampli<<
endl;
353 cout <<
"# " <<
endl;
360 cout <<
"# Flat Background estimation " <<
endl;
367 cout <<
"# Affine Background estimation " <<
endl;
375 cout <<
"# No Background estimation " <<
endl;
379 if(
Dmode==1) cout <<
"# Using 1st-derivative search"<<
endl;
380 else if(
Dmode==2) cout <<
"# Using 2nd-derivative search"<<
endl;
381 cout <<
"# " <<
endl;
383 if(!
useTL) cout <<
"# Left Tail in peak fit disabled"<<endl<<
"# " <<
endl;
384 if(!
useTR) cout <<
"# Right Tail in peak fit disabled"<<endl<<
"# " <<
endl;
386 if(
numZero) cout <<
"# Linear calibration enabled (no offset)"<<
endl;
387 else if(
doPoly1 &&
doPoly2)cout <<
"# Parabolic calibration enabled (y = offset + slope*x + curv*x*x)"<<
endl;
388 else if(
doPoly1) cout <<
"# Affine calibration enabled (y = offset + slope*x)"<<
endl;
389 cout<<
"# Scaling factor for the slope = "<<
hGain<<
endl;
393 cout <<
"# " <<
endl;
396 useTL ? vpars[6] |= 1 : vpars[6] &= ~1;
397 useTR ? vpars[7] |= 1 : vpars[7] &= ~1;
404 for(
int nn = 0; nn <
specNN; nn++) {
408 for(
size_t nn = 0; nn <
nwa.size(); nn++) {
409 int ii =
nwa[nn].index;
415 else if(ii >= 0 && ii < specNN) {
421 for(
int nn = 0; nn <
eBnumb; nn++)
429 for(
size_t dd = 0; dd <
Delendae.size(); dd++) {
432 for (
size_t nn = 1; nn <
Energies.size(); nn++) {
467 cout <<
"# " <<
"Energies used for the calibration " <<
endl;
469 cout <<
"# " <<
"Position used for the calibration " <<
endl;
470 for (
size_t nn = 0; nn <
Energies.size(); nn++)
472 cout <<
"# " << setw(3) << nn << fixed << setprecision(3) << setw(10) <<
Energies[nn];
473 if(
refEner==Energies[nn]) cout<<
" ==> Reference peak for extended printouts";
490 cout <<
"# " <<
endl;
491 cout <<
"# " <<
"Spectra taken from file : " <<
specName <<
endl;
496 cout <<
"# " <<
endl;
499 cout <<
"# indx #spec #pks #ok rEnergy FW05 FW01 Area Position Width Ampli WTML WTMR slope*gain rChi2%";
501 cout <<
" offs1*g slope1*g rChi2%";
503 cout <<
" offs2*g slope2*g coeff2*g rChi2%";
506 cout <<
"# indx #spec #pks #ok rEnergy FW05 FW01 Area Position Width Ampli WTML WTMR cross-talk";
511 cout <<
"# indx #spec #pks #ok rEnergy FW05 FW01 Area Position Width Ampli WTML WTMR shift*gain";
513 cout <<
"\n# " <<
endl;
522 if(
fSourceName.Contains(
"22Na",TString::kIgnoreCase))
528 if(
fSourceName.Contains(
"56Co",TString::kIgnoreCase))
546 if(
fSourceName.Contains(
"40K",TString::kIgnoreCase))
552 if(
fSourceName.Contains(
"57Co",TString::kIgnoreCase))
559 if(
fSourceName.Contains(
"60Co",TString::kIgnoreCase))
565 if(
fSourceName.Contains(
"88Y",TString::kIgnoreCase))
572 if(
fSourceName.Contains(
"133Ba",TString::kIgnoreCase))
585 if(
fSourceName.Contains(
"134Cs",TString::kIgnoreCase))
598 if(
fSourceName.Contains(
"137Cs",TString::kIgnoreCase))
603 if(
fSourceName.Contains(
"152Eu",TString::kIgnoreCase))
618 if(
fSourceName.Contains(
"208Pb",TString::kIgnoreCase))
623 if(
fSourceName.Contains(
"226Ra",TString::kIgnoreCase))
644 if(
fSourceName.Contains(
"241Am",TString::kIgnoreCase))
658 cout<<Form(
"error decoding command %s ==> %d parameter(s) missing \n", cmd, nn);
679 if(n0 >=0 && n0 < specLength)
684 if(n0 >=0 && n0 < specLength)
685 testData[n0] += float(val*(n0+1-e0));
686 for(
int ii = n0+1 ; ii < n1; ii++) {
687 if(ii >=0 && ii < specLength)
690 if(n1 >=0 && n1 < specLength)
695 {
int nt = n0; n0 = n1; n1 = nt;}
696 if(n0 >=0 && n0 < specLength)
697 testData[n0] += float(val*(n0+1-e1));
698 for(
int ii = n0+1; ii < n1; ii++) {
699 if(ii >=0 && ii < specLength)
702 if(n1 >=0 && n1 < specLength)
710 return (nn == specLength);
722 int GWRecal::LargePeaks1(
float *m_pSpek,
int chA,
int chB,
float fwhm,
float minAmpl, std::vector<double>&vPeaks,
int maxNum)
725 int nChan = chB-chA+1;
727 double sigma = fwhm/
s2fwhm;
730 SmoothSpek(m_pSpek+chA, nChan, sigma, 1, tSpek, xMin);
731 int xMax = xMin + nChan;
737 xP_minAmpl = float(0.5*abs(minAmpl*exp(-.5)/sigma));
742 while(vPeaks.size() < size_t(maxNum)) {
748 for(
int nn = xMin+1; nn < xMax; nn++) {
749 if(tSpek[nn] < yMin) {
757 for(
int nn =
xP_4; nn > xMin; nn--) {
767 for(
int nn =
xP_3; nn < xMax; nn++) {
777 for(
int nn =
xP_2; nn > xMin; nn--) {
782 if(tSpek[nn] > yMax) {
796 float cmp = abs(yMax/yMin);
797 if(cmp < 0.2f || cmp > 2.f)
802 vPeaks.push_back(xPos-xMin+chA+1);
805 for(
int nn = xP_0; nn <
xP_5; nn++)
811 memcpy(m_pSpek+chA, tSpek+xMin,
sizeof(
float)*nChan);
812 float scale = float(sigma/exp(-.5));
813 for(
int nn = chA; nn < chA+nChan; nn++)
814 m_pSpek[nn] *= scale;
819 return vPeaks.size();
831 int GWRecal::PeakSearch1(
float *m_pSpek,
int chA,
int chB,
float fwhm,
float minAmpl, std::vector<double>&vPeaks)
834 int nChan = chB-chA+1;
836 double sigma = fwhm/
s2fwhm;
839 SmoothSpek(m_pSpek+chA, nChan, sigma, 1, tSpek, xMin);
840 int xMax = xMin + nChan;
846 xP_minAmpl = float(0.5*abs(minAmpl*exp(-.5)/sigma));
853 if(
xP_Next1(tSpek+xx, nChan-xx) <= 0 )
856 double xPos = xx + 0.5f*(
xP_2+
xP_3);
857 vPeaks.push_back(xPos + chA + 1 - xMin);
862 memcpy(m_pSpek+chA, tSpek+xMin,
sizeof(
float)*nChan);
868 float scale = float(sigma/exp(-.5));
869 for(
int nn = chA; nn < chA+nChan; nn++)
870 m_pSpek[nn] *= scale;
875 return vPeaks.size();
887 int GWRecal::PeakSearch2(
float *m_pSpek,
int chA,
int chB,
float fwhm,
float minAmpl, std::vector<double>&vPeaks)
890 int nChan = chB-chA+1;
892 double sigma = fwhm/
s2fwhm;
895 SmoothSpek(m_pSpek+chA, nChan, sigma, 2, tSpek, xMin);
896 int xMax = xMin + nChan;
902 xP_minAmpl = float(abs(minAmpl/(sigma*sigma)));
910 if(
xP_Next2(tSpek+xx, xMax-xx) <= 0 )
913 float xP0 = 0, xP1 = 0;
914 int nn0 = xx +
xP_2 + 1;
915 int nn1 = xx +
xP_4 + 1;
916 for(
int nn = nn0; nn < nn1; nn++) {
917 float x = float(nn-nn0)+0.5f;
922 float xPos = nn0 + xP1/xP0;
923 vPeaks.push_back(xPos + chA - xMin);
928 memcpy(m_pSpek+chA, tSpek+xMin,
sizeof(
float)*nChan);
934 float scale = float(sigma*sigma);
935 for(
int nn = chA; nn < chA+nChan; nn++)
936 m_pSpek[nn] *= scale;
941 return vPeaks.size();
952 int nKern = 2*int(5.5*sigma)+1;
954 double gfact1 = -1./(2.*sigma*sigma);
955 double gfact2 = 1./(sigma*sqrt(2.*
m_pi));
957 float *gKern =
new float [nKern];
958 for(
int nn = 0; nn <= zKern; nn++) {
959 double gvalue = gfact2*exp( ((nn-zKern)*(nn-zKern))*gfact1 );
960 gKern[nn] = gKern[nKern-1-nn] = float(gvalue);
964 int tLen = nKern + nchan + nKern;
967 tSpek =
new float [tLen];
971 memset(tSpek, 0,
sizeof(
float)*nKern);
972 memcpy(tSpek+nKern, spek, nchan*
sizeof(
float));
973 memset(tSpek+nKern+nchan, 0,
sizeof(
float)*nKern);
976 for(
int ii = tLen-1; ii >= nKern; ii--) {
978 for(
int jj = 0; jj < nKern; jj++)
979 csum += gKern[jj]*tSpek[ii-jj];
985 for(
int nd = 0; nd < ndiff; nd++) {
986 for(
int ii = tLen-1; ii >0; ii--)
987 tSpek[ii] -= tSpek[ii-1];
1006 int state = stateUnknown;
1007 int widthP = 0, widthN = 0;
1011 for(
int nn = 0; nn < yLen; nn++) {
1012 float yInp = yDat[nn];
1042 state = stateUnknown;
1056 float cmp = abs(yMax/yMin);
1057 if(cmp < 0.2f || cmp > 2.f)
1058 state = stateUnknown;
1089 int state = stateUnknown;
1090 int widthP1 = 0, widthN = 0, widthP2 = 0;
1095 for(
int nn = 0; nn < yLen; nn++) {
1096 float yInp = yDat[nn];
1102 yMax1 = yMin = yInp;
1124 state = stateUnknown;
1139 yMin < -1.1*yMax1 &&
1140 yMin > -4.5*yMax1) {
1149 yMax1 = yMin = yInp;
1168 state = stateUnknown;
1186 const float nwLe = 4.f;
1187 const float nwOv = 2.f;
1188 const float nwRi = 3.f;
1196 for(
int nn = 0; nn < numpk; nn += 1 + nmult) {
1198 int chanB = int(
specPeaks[nn]+nwRi*fCurrentspecFWHMdef);
1199 chanA = max(1,chanA);
1204 for(
size_t jj = nn+1; jj <
specPeaks.size(); jj++) {
1205 if(
specPeaks[jj]-nwOv*fCurrentspecFWHMdef >= chanB)
1208 chanB = int(
specPeaks[jj]+nwRi*fCurrentspecFWHMdef);
1215 for(
int jj = 0; jj < np; jj++) {
1238 bool bad = (res.
area < 10) || (res.
fwhm >= 5*fCurrentspecFWHMdef) || (res.
tailR > 5.f*res.
tailL);
1240 if(nn || jj) cout<<Form(
"#1 ");
1241 if(jj == 0) cout<<Form(
" %3d ", nn+jj);
1242 else cout<<Form(
" %3d", nn+jj);
1249 Peaks.push_back(res);
1253 return Peaks.size();
1262 double GWRecal::ECalibration(
int nspe,
double& offset1_,
double& slope1_,
double& offset2_,
double& slope2_,
double& curv2_,
int verbose_)
1264 vector <Fitted>::iterator Iter;
1269 for(
size_t nn = 1; nn <
Peaks.size(); nn++) {
1274 offset1_ = slope1_ = 0;
1276 Peaks[pn_max].good =
true;
1277 Peaks[pn_max].eref = 0;
1279 cout<<Form(
"#2 %5d Slope = %10.6f\n", nspe, slope_);
1285 cout <<
"# Number of peaks (" <<
Peaks.size() <<
") or number of energies (" <<
Energies.size() <<
") too small" <<
endl;
1291 int npmax =
Peaks.size();
1292 for(
int np = 0; np < npmax; np++)
1293 Peaks[np].good =
true;
1297 int npmax = min( min(
Peaks.size(), size_t(4)),
Energies.size() );
1298 for(
int np = 0; np < npmax; np++)
1299 Peaks[np].good =
true;
1300 for(
size_t np = npmax; np <
Peaks.size(); np++)
1301 Peaks[np].good =
false;
1307 cout<<Form(
"# Sorted Peak Positions = (");
1308 for ( Iter =
Peaks.begin( ) ; Iter !=
Peaks.end( ) ; Iter++ ) cout<<Form(
" %d",
int((*Iter).posi) );
1318 double np_chi = 1.e40;
1320 for(
size_t np = 0; np <
Peaks.size(); np++) {
1325 double ec_chi = 1.e30;
1326 for(
size_t ne = 0; ne <
Energies.size(); ne++) {
1330 for(
size_t nee = 0; nee <
Energies.size(); nee++) {
1332 for(
size_t ip = 0; ip <
Peaks.size(); ip++) {
1333 double dpos =
Peaks[ip].posi-epos;
1334 double dpos2 = dpos*dpos;
1335 if(dpos2 < dpos2max) {
1342 if( (match > ec_max) ||
1343 ((match == ec_max) && (chi2 < ec_chi)) ) {
1349 if( (ec_max > np_max) ||
1350 ((ec_max == np_max) && (ec_chi < np_chi)) ) {
1362 cout<<Form(
"# Best-match slope %g [p=%d e=%d] with %d values\n", bestSlope, np_ind, np_ref, np_max);
1366 for(
size_t np = 0; np <
Peaks.size(); np++) {
1367 Peaks[np].eref = -1;
1368 Peaks[np].good =
false;
1371 for(
size_t ne = 0; ne <
Energies.size(); ne++) {
1372 double epos =
Energies[ne]/bestSlope;
1373 for(
size_t np = 0; np <
Peaks.size(); np++) {
1374 if(abs(
Peaks[np].posi-epos) < fCurrentspecFWHMdef && !
Peaks[np].good) {
1376 Peaks[np].eref = ne;
1377 Peaks[np].good =
true;
1387 for(
size_t np = 0; np <
Peaks.size(); np++) {
1388 if(
Peaks[np].good) {
1390 double x =
Peaks[np].posi;
1396 double slope0 = val_xy / val_xx;
1397 double slope_ = slope0;
1410 for(
size_t np = 0; np <
Peaks.size(); np++) {
1411 if(
Peaks[np].good) {
1413 double x =
Peaks[np].posi;
1415 double errP = slope0* pow(Peaks[np].fwhm/
s2fwhm, 2.)/Peaks[np].area;
1416 double w2 = 1. / (errP*errP+
errE*
errE);
1421 slope_ = val_xy / val_xx;
1424 bool fit1Done =
false;
1425 offset1_ = slope1_ = 0;
1428 double sx0 = 0., sx1 = 0., sx2 = 0., syx0 = 0., syx1 = 0.;
1432 for(
size_t np = 0; np <
Peaks.size(); np++) {
1433 if(
Peaks[np].good) {
1435 double x =
Peaks[np].posi;
1438 double errP = slope_* pow(Peaks[np].fwhm/
s2fwhm, 2.)/Peaks[np].area;
1455 double deter = sx0*sx2-sx1*sx1;
1457 offset1_ = ( sx2*syx0 - sx1*syx1)/deter;
1458 slope1_ = (-sx1*syx0 + sx0*syx1)/deter;
1465 bool fit2Done =
false;
1466 offset2_ = slope2_ = curv2_ = 0;
1469 double sx0 = 0., sx1 = 0., sx2 = 0., sx3 = 0., sx4 = 0., syx0 = 0., syx1 = 0., syx2 = 0.;
1473 for(
size_t np = 0; np <
Peaks.size(); np++) {
1474 if(
Peaks[np].good) {
1476 double x =
Peaks[np].posi;
1479 double errP = slope_* pow(Peaks[np].fwhm/
s2fwhm, 2.)/Peaks[np].area;
1499 double dd[9]; memset(dd, 0,
sizeof(dd));
1500 double xd[3]; memset(xd, 0,
sizeof(xd));
1505 dd[0] = sx0; dd[1] = sx1; dd[2] = sx2; xd[0] = syx0;
1506 dd[3] = sx1; dd[4] = sx2; dd[5] = sx3; xd[1] = syx1;
1507 dd[6] = sx2; dd[7] = sx3; dd[8] = sx4; xd[2] = syx2;
1511 offset2_ = DD[0]*xd[0] + DD[1]*xd[1] + DD[2]*xd[2];
1512 slope2_ = DD[3]*xd[0] + DD[4]*xd[1] + DD[5]*xd[2];
1513 curv2_ = DD[6]*xd[0] + DD[7]*xd[1] + DD[8]*xd[2];
1519 cout<<Form(
"#2 %5d Slope = %1.6f", nspe, slope_);
1521 cout<<Form(
" Cal1=[ %7.4f %1.6f ]", offset1_, slope1_);
1522 if(fit1Done && fit2Done)
1523 cout<<Form(
" Cal2=[ %7.4f %1.6f % .5e ]", offset2_, slope2_, curv2_);
1526 double chi2[5] = {0};
1528 for(
size_t np = 0; np <
Peaks.size(); np++) {
1529 if(
Peaks[np].good) {
1532 double seenPosi = Peaks[np].posi;
1533 double seenEner = seenPosi*slope_;
1534 double diffEner = seenEner-lineEner;
1535 chi2[0] += diffEner*diffEner;
1536 cout<<Form(
"#2 %5d %4d %4d %15.1f %10.2f %9.3f %9.3f %11.3f %7.3f",
1537 nspe,
int(nn++),
int(np), Peaks[np].area, Peaks[np].posi, Peaks[np].fwhm, Peaks[np].fwhm*slope_, lineEner, diffEner);
1539 seenEner = offset1_ + slope1_*seenPosi;
1540 diffEner = seenEner-lineEner;
1541 cout<<Form(
" %7.3f", diffEner);
1542 chi2[1] += diffEner*diffEner;
1544 if(fit1Done && fit2Done) {
1545 seenEner = offset2_ + slope2_*seenPosi + curv2_*seenPosi*seenPosi;
1546 diffEner = seenEner-lineEner;
1547 cout<<Form(
" %7.3f", diffEner);
1548 chi2[2] += diffEner*diffEner;
1553 chi2[0] = (nused-1) ? chi2[0]/(nused-1) : 0;
1554 cout<<Form(
"#2 %5d Chi2 %73.3f", nspe, chi2[0]);
1556 chi2[1] = (nused-2) ? chi2[1]/(nused-2) : 0;
1557 cout<<Form(
" %7.3f", chi2[1]);
1559 if(fit1Done && fit2Done) {
1560 chi2[2] = (nused-3) ? chi2[2]/(nused-3) : 0;
1561 cout<<Form(
" %7.3f", chi2[2]);
1590 double Det = d00*(d11*d22 - d12*d21) + d01*(d12*d20 - d10*d22) + d02*(d10*d21 - d11*d20);
1594 double D00 = d11*d22 - d12*d21;
double D01 = d12*d20 - d10*d22;
double D02 = d10*d21 - d11*d20;
1595 double D10 = d21*d02 - d22*d01;
double D11 = d22*d00 - d20*d02;
double D12 = d20*d01 - d21*d00;
1596 double D20 = d01*d12 - d02*d11;
double D21 = d02*d10 - d00*d12;
double D22 = d00*d11 - d01*d10;
1600 invOut[0] = D00 * Det;
1601 invOut[1] = D01 * Det;
1602 invOut[2] = D02 * Det;
1603 invOut[3] = D10 * Det;
1604 invOut[4] = D11 * Det;
1605 invOut[5] = D12 * Det;
1606 invOut[6] = D20 * Det;
1607 invOut[7] = D21 * Det;
1608 invOut[8] = D22 * Det;
1611 #define indx(n1, n2) (n1*3+n2)
1612 double unit[9]; memset(unit, 0,
sizeof(unit));
1613 for(
int i1 = 0; i1 < 3; i1++) {
1614 for(
int i2 = 0; i2 < 3; i2++) {
1616 for(
int ii = 0; ii < 3; ii++) {
1617 accu += m[indx(i1,ii)]*invOut[indx(ii,i2)];
1619 unit[indx(i1,i2)] = accu;
1642 bool IndexAlreadyDefined =
false;
1643 for(
size_t i=0 ; i<
nlim.size() ; i++)
1646 if(lim.
index == SpecNbr)
1648 lim.
from = (int)ChFrom;
1650 IndexAlreadyDefined =
true;
1653 if(!IndexAlreadyDefined)
1656 lim.
index = SpecNbr;
1657 lim.
from = (int)ChFrom;
1659 nlim.push_back(lim);
1667 bool IndexAlreadyDefined =
false;
1668 for(
size_t i=0 ; i<
nwa.size() ; i++)
1671 if(tnwa.
index == SpecNbr)
1675 IndexAlreadyDefined =
true;
1679 if(!IndexAlreadyDefined)
1682 tnwa.
index = SpecNbr;
1685 nwa.push_back(tnwa);
void numparams(char *, int)
******************************************************************************************/// ...
void SetHistChannelLimits(int SpecNbr, float ChFrom, float ChTo)
******************************************************************************************/// ...
TString fSpectraFolderName
bool InvertMatrix3(const double m[9], double invOut[9])
******************************************************************************************/// ...
int PeakSearch2(float *data, int chA, int chB, float fwhm, float minAmpl, std::vector< double > &vPeaks)
******************************************************************************************/// ...
int CalcGaussianFit(float *pSpek, int chanA, int chanB, std::vector< double > &vPeaks)
float fCurrentspecFWHMdef
double TCalibration()
******************************************************************************************/// ...
void SetHistPeaksLimits(int SpecNbr, float FWHM, float Ampli)
******************************************************************************************/// ...
int PeakSearch1(float *data, int chA, int chB, float fwhm, float minAmpl, std::vector< double > &vPeaks)
******************************************************************************************/// ...
int FitPeaks(int verbose)
******************************************************************************************/// ...
double Calibrated(double x)
******************************************************************************************/// ...
bool SpecNameDecode(std::string sName, std::string &sForm, int &slen)
bool Read(int slen, int snum=0)
bool Open(std::string sName, std::string sForm)
bool TestResults()
******************************************************************************************/// ...
int LargePeaks1(float *data, int chA, int chB, float fwhm, float minAmpl, std::vector< double > &vPeaks, int maxNum)
******************************************************************************************/// ...
int xP_Next1(float *yVal, int yLen)
******************************************************************************************/// ...
vector< double > specPeaks
void StartCalib()
******************************************************************************************/// ...
vector< double > Energies
void AnalyseSources()
******************************************************************************************/// ...
vector< double > Delendae
vector< Fitted > Peaks
void SetFormat(string type, int nchan){specFormat = type; specLength = nchan;} // format of the data ...
ADF::LogMessage & endl(ADF::LogMessage &log)
float fCurrentspecAMPLdef
void SmoothSpek(float *spek, int nchan, double sigma, int ndiff, float *&tSpek, int &start)
******************************************************************************************/// ...
int xP_Next2(float *yVal, int yLen)
******************************************************************************************/// ...
void initialize()
******************************************************************************************/// ...
double ECalibration(int nspe, double &offset1, double &slope1_, double &offset2_, double &slope2_, double &curv2_, int verbose_)
******************************************************************************************/// ...