47 #define PEAK_WINDOW 1024 158 Error(
"Background",
"function not yet implemented: h=%s, iter=%d, option=%sn" 159 , h->
GetName(), number_of_iterations, option);
168 printf(
"\nNumber of positions = %d\n",
fNPeaks);
212 if (dimension != 2) {
213 Error(
"Search",
"Must be a 2-d histogram");
232 Int_t i, j, binx,biny, npeaks;
235 for (i = 0; i < sizex; i++) {
238 for (j = 0; j < sizey; j++) {
249 for (i = 0; i < npeaks; i++) {
255 for (i = 0; i < sizex; i++) {
264 if (!npeaks)
return 0;
275 ((
TH1*)hin)->Draw(option);
485 Int_t numberIterationsX,
486 Int_t numberIterationsY,
490 Int_t i,
x,
y, sampling, r1, r2;
492 if (ssizex <= 0 || ssizey <= 0)
493 return "Wrong parameters";
494 if (numberIterationsX < 1 || numberIterationsY < 1)
495 return "Width of Clipping Window Must Be Positive";
496 if (ssizex < 2 * numberIterationsX + 1
497 || ssizey < 2 * numberIterationsY + 1)
498 return (
"Too Large Clipping Window");
500 for (i = 0; i < ssizex; i++)
501 working_space[i] =
new Double_t[ssizey];
506 for (i = 1; i <= sampling; i++) {
509 for (y = r2; y < ssizey - r2; y++) {
510 for (x = r1; x < ssizex - r1; x++) {
512 p1 = spectrum[x - r1][y - r2];
513 p2 = spectrum[x - r1][y + r2];
514 p3 = spectrum[x + r1][y - r2];
515 p4 = spectrum[x + r1][y + r2];
516 s1 = spectrum[
x][y - r2];
517 s2 = spectrum[x - r1][
y];
518 s3 = spectrum[x + r1][
y];
519 s4 = spectrum[
x][y + r2];
532 s1 = s1 - (p1 +
p3) / 2.0;
533 s2 = s2 - (p1 +
p2) / 2.0;
534 s3 = s3 - (p3 + p4) / 2.0;
535 s4 = s4 - (p2 + p4) / 2.0;
536 b = (s1 + s4) / 2.0 + (s2 + s3) / 2.0 + (p1 + p2 +
541 working_space[
x][
y] =
a;
544 for (y = r2; y < ssizey - r2; y++) {
545 for (x = r1; x < ssizex - r1; x++) {
546 spectrum[
x][
y] = working_space[
x][
y];
553 for (i = 1; i <= sampling; i++) {
556 for (y = r2; y < ssizey - r2; y++) {
557 for (x = r1; x < ssizex - r1; x++) {
559 b = -(spectrum[x - r1][y - r2] +
560 spectrum[x - r1][y + r2] + spectrum[x + r1][y -
562 + spectrum[x + r1][y + r2]) / 4 +
563 (spectrum[x][y - r2] + spectrum[x - r1][y] +
564 spectrum[x + r1][y] + spectrum[x][y + r2]) / 2;
567 working_space[
x][
y] =
a;
570 for (y = i; y < ssizey - i; y++) {
571 for (x = i; x < ssizex - i; x++) {
572 spectrum[
x][
y] = working_space[
x][
y];
581 for (i = sampling; i >= 1; i--) {
584 for (y = r2; y < ssizey - r2; y++) {
585 for (x = r1; x < ssizex - r1; x++) {
587 p1 = spectrum[x - r1][y - r2];
588 p2 = spectrum[x - r1][y + r2];
589 p3 = spectrum[x + r1][y - r2];
590 p4 = spectrum[x + r1][y + r2];
591 s1 = spectrum[
x][y - r2];
592 s2 = spectrum[x - r1][
y];
593 s3 = spectrum[x + r1][
y];
594 s4 = spectrum[
x][y + r2];
607 s1 = s1 - (p1 +
p3) / 2.0;
608 s2 = s2 - (p1 +
p2) / 2.0;
609 s3 = s3 - (p3 + p4) / 2.0;
610 s4 = s4 - (p2 + p4) / 2.0;
611 b = (s1 + s4) / 2.0 + (s2 + s3) / 2.0 + (p1 + p2 +
616 working_space[
x][
y] =
a;
619 for (y = r2; y < ssizey - r2; y++) {
620 for (x = r1; x < ssizex - r1; x++) {
621 spectrum[
x][
y] = working_space[
x][
y];
628 for (i = sampling; i >= 1; i--) {
631 for (y = r2; y < ssizey - r2; y++) {
632 for (x = r1; x < ssizex - r1; x++) {
634 b = -(spectrum[x - r1][y - r2] +
635 spectrum[x - r1][y + r2] + spectrum[x + r1][y -
637 + spectrum[x + r1][y + r2]) / 4 +
638 (spectrum[x][y - r2] + spectrum[x - r1][y] +
639 spectrum[x + r1][y] + spectrum[x][y + r2]) / 2;
642 working_space[
x][
y] =
a;
645 for (y = i; y < ssizey - i; y++) {
646 for (x = i; x < ssizex - i; x++) {
647 spectrum[
x][
y] = working_space[
x][
y];
653 for (i = 0; i < ssizex; i++)
654 delete[]working_space[i];
655 delete[]working_space;
741 Double_t nom, nip, nim, sp, sm, spx, spy, smx, smy, plocha = 0;
743 return "Averaging Window must be positive";
745 for(i = 0; i < ssizex; i++)
746 working_space[i] =
new Double_t[ssizey];
751 for(i = 0, maxch = 0; i < ssizex; i++){
752 for(j = 0; j < ssizey; j++){
753 working_space[i][j] = 0;
754 if(maxch < source[i][j])
755 maxch = source[i][j];
757 plocha += source[i][j];
761 delete [] working_space;
767 for(i = xmin; i <
xmax; i++){
768 nip = source[i][
ymin] / maxch;
769 nim = source[i + 1][
ymin] / maxch;
771 for(l = 1; l <= averWindow; l++){
776 a = source[i +
l][
ymin] / maxch;
790 a = source[i - l + 1][
ymin] / maxch;
802 a = working_space[i + 1][
ymin] = a * working_space[i][
ymin];
805 for(i = ymin; i <
ymax; i++){
806 nip = source[
xmin][i] / maxch;
807 nim = source[
xmin][i + 1] / maxch;
809 for(l = 1; l <= averWindow; l++){
814 a = source[
xmin][i +
l] / maxch;
828 a = source[
xmin][i - l + 1] / maxch;
840 a = working_space[
xmin][i + 1] = a * working_space[
xmin][i];
843 for(i = xmin; i <
xmax; i++){
844 for(j = ymin; j <
ymax; j++){
845 nip = source[i][j + 1] / maxch;
846 nim = source[i + 1][j + 1] / maxch;
848 for(l = 1; l <= averWindow; l++){
850 a = source[
xmax][j] / maxch;
853 a = source[i +
l][j] / maxch;
864 a = source[
xmin][j] / maxch;
867 a = source[i - l + 1][j] / maxch;
879 nip = source[i + 1][j] / maxch;
880 nim = source[i + 1][j + 1] / maxch;
881 for (l = 1; l <= averWindow; l++) {
882 if (j + l > ymax) a = source[i][
ymax]/maxch;
883 else a = source[i][j +
l] / maxch;
885 if (a + nip <= 0) a = 1;
890 if (j - l + 1 < ymin) a = source[i][
ymin] / maxch;
891 else a = source[i][j - l + 1] / maxch;
893 if (a + nim <= 0) a = 1;
899 a = (spx * working_space[i][j + 1] + spy * working_space[i + 1][j]) / (smx +smy);
900 working_space[i + 1][j + 1] =
a;
904 for(i = xmin; i <=
xmax; i++){
905 for(j = ymin; j <=
ymax; j++){
906 working_space[i][j] = working_space[i][j] / nom;
909 for(i = 0;i < ssizex; i++){
910 for(j = 0; j < ssizey; j++){
911 source[i][j] = plocha * working_space[i][j];
914 for (i = 0; i < ssizex; i++)
915 delete[]working_space[i];
916 delete[]working_space;
1136 Int_t numberIterations,
1137 Int_t numberRepetitions,
1140 Int_t i, j, lhx, lhy, i1, i2, j1, j2, k1, k2, lindex, i1min, i1max,
1141 i2min, i2max, j1min, j1max, j2min, j2max, positx = 0, posity = 0, repet;
1142 Double_t lda, ldb, ldc, area, maximum = 0;
1143 if (ssizex <= 0 || ssizey <= 0)
1144 return "Wrong parameters";
1145 if (numberIterations <= 0)
1146 return "Number of iterations must be positive";
1147 if (numberRepetitions <= 0)
1148 return "Number of repetitions must be positive";
1150 for (i = 0; i < ssizex; i++)
1151 working_space[i] =
new Double_t[5 * ssizey];
1154 for (i = 0; i < ssizex; i++) {
1155 for (j = 0; j < ssizey; j++) {
1163 working_space[i][j] = lda;
1165 if (lda > maximum) {
1167 positx = i, posity = j;
1171 if (lhx == -1 || lhy == -1) {
1172 delete [] working_space;
1173 return (
"Zero response data");
1177 for (i2 = 0; i2 < ssizey; i2++) {
1178 for (i1 = 0; i1 < ssizex; i1++) {
1180 for (j2 = 0; j2 <= (lhy - 1); j2++) {
1181 for (j1 = 0; j1 <= (lhx - 1); j1++) {
1182 k2 = i2 + j2, k1 = i1 + j1;
1183 if (k2 >= 0 && k2 < ssizey && k1 >= 0 && k1 < ssizex) {
1184 lda = working_space[j1][j2];
1185 ldb = source[k1][k2];
1186 ldc = ldc + lda * ldb;
1190 working_space[i1][i2 + ssizey] = ldc;
1195 i1min = -(lhx - 1), i1max = lhx - 1;
1196 i2min = -(lhy - 1), i2max = lhy - 1;
1197 for (i2 = i2min; i2 <= i2max; i2++) {
1198 for (i1 = i1min; i1 <= i1max; i1++) {
1203 j2max = lhy - 1 - i2;
1204 if (j2max > lhy - 1)
1206 for (j2 = j2min; j2 <= j2max; j2++) {
1210 j1max = lhx - 1 - i1;
1211 if (j1max > lhx - 1)
1213 for (j1 = j1min; j1 <= j1max; j1++) {
1214 lda = working_space[j1][j2];
1215 if (i1 + j1 < ssizex && i2 + j2 < ssizey)
1216 ldb = working_space[i1 + j1][i2 + j2];
1219 ldc = ldc + lda * ldb;
1222 working_space[i1 - i1min][i2 - i2min + 2 * ssizey ] = ldc;
1227 for (i2 = 0; i2 < ssizey; i2++) {
1228 for (i1 = 0; i1 < ssizex; i1++) {
1229 working_space[i1][i2 + 3 * ssizey] = 1;
1230 working_space[i1][i2 + 4 * ssizey] = 0;
1235 for (repet = 0; repet < numberRepetitions; repet++) {
1237 for (i = 0; i < ssizex; i++) {
1238 for (j = 0; j < ssizey; j++) {
1239 working_space[i][j + 3 * ssizey] =
1244 for (lindex = 0; lindex < numberIterations; lindex++) {
1245 for (i2 = 0; i2 < ssizey; i2++) {
1246 for (i1 = 0; i1 < ssizex; i1++) {
1249 if (j2min > lhy - 1)
1252 j2max = ssizey - i2 - 1;
1253 if (j2max > lhy - 1)
1256 if (j1min > lhx - 1)
1259 j1max = ssizex - i1 - 1;
1260 if (j1max > lhx - 1)
1262 for (j2 = j2min; j2 <= j2max; j2++) {
1263 for (j1 = j1min; j1 <= j1max; j1++) {
1264 ldc = working_space[j1 - i1min][j2 - i2min + 2 * ssizey];
1265 lda = working_space[i1 + j1][i2 + j2 + 3 * ssizey];
1266 ldb = ldb + lda * ldc;
1269 lda = working_space[i1][i2 + 3 * ssizey];
1270 ldc = working_space[i1][i2 + 1 * ssizey];
1271 if (ldc * lda != 0 && ldb != 0) {
1272 lda = lda * ldc / ldb;
1277 working_space[i1][i2 + 4 * ssizey] = lda;
1280 for (i2 = 0; i2 < ssizey; i2++) {
1281 for (i1 = 0; i1 < ssizex; i1++)
1282 working_space[i1][i2 + 3 * ssizey] =
1283 working_space[i1][i2 + 4 * ssizey];
1287 for (i = 0; i < ssizex; i++) {
1288 for (j = 0; j < ssizey; j++)
1289 source[(i + positx) % ssizex][(j + posity) % ssizey] =
1290 area * working_space[i][j + 3 * ssizey];
1292 for (i = 0; i < ssizex; i++)
1293 delete[]working_space[i];
1294 delete[]working_space;
1595 Int_t number_of_iterations = (
Int_t)(4 * sigma + 0.5);
1596 Int_t k, lindex, priz;
1597 Double_t lda, ldb, ldc, area, maximum;
1598 Int_t xmin,
xmax,
l, peak_index = 0, ssizex_ext = ssizex + 4 * number_of_iterations, ssizey_ext = ssizey + 4 * number_of_iterations, shift = 2 * number_of_iterations;
1601 Double_t nom, nip, nim, sp, sm, spx, spy, smx, smy;
1604 Int_t lhx, lhy, i1, i2, j1, j2, k1, k2, i1min, i1max, i2min, i2max, j1min, j1max, j2min, j2max, positx, posity;
1606 Error(
"SearchHighRes",
"Invalid sigma, must be greater than or equal to 1");
1610 if(threshold<=0||threshold>=100){
1611 Error(
"SearchHighRes",
"Invalid threshold, must be positive and less than 100");
1615 j = (
Int_t) (5.0 * sigma + 0.5);
1617 Error(
"SearchHighRes",
"Too large sigma");
1621 if (markov ==
true) {
1622 if (averWindow <= 0) {
1623 Error(
"SearchHighRes",
"Averaging window must be positive");
1627 if(backgroundRemove ==
true){
1628 if(ssizex_ext < 2 * number_of_iterations + 1 || ssizey_ext < 2 * number_of_iterations + 1){
1629 Error(
"SearchHighRes",
"Too large clipping window");
1633 i = (
Int_t)(4 * sigma + 0.5);
1636 for (j = 0; j < ssizex + i; j++) {
1638 for (k=0;k<16 * (ssizey + i);k++) wsk[k] = 0;
1640 for(j = 0; j < ssizey_ext; j++){
1641 for(i = 0; i < ssizex_ext; i++){
1644 working_space[i][j + ssizey_ext] = source[0][0];
1646 else if(j >= ssizey + shift)
1647 working_space[i][j + ssizey_ext] = source[0][ssizey - 1];
1650 working_space[i][j + ssizey_ext] = source[0][j - shift];
1653 else if(i >= ssizex + shift){
1655 working_space[i][j + ssizey_ext] = source[ssizex - 1][0];
1657 else if(j >= ssizey + shift)
1658 working_space[i][j + ssizey_ext] = source[ssizex - 1][ssizey - 1];
1661 working_space[i][j + ssizey_ext] = source[ssizex - 1][j - shift];
1666 working_space[i][j + ssizey_ext] = source[i - shift][0];
1668 else if(j >= ssizey + shift)
1669 working_space[i][j + ssizey_ext] = source[i - shift][ssizey - 1];
1672 working_space[i][j + ssizey_ext] = source[i - shift][j - shift];
1676 if(backgroundRemove ==
true){
1677 for(i = 1; i <= number_of_iterations; i++){
1678 for(y = i; y < ssizey_ext - i; y++){
1679 for(x = i; x < ssizex_ext - i; x++){
1680 a = working_space[
x][y + ssizey_ext];
1681 p1 = working_space[x - i][y + ssizey_ext - i];
1682 p2 = working_space[x - i][y + ssizey_ext + i];
1683 p3 = working_space[x + i][y + ssizey_ext - i];
1684 p4 = working_space[x + i][y + ssizey_ext + i];
1685 s1 = working_space[
x][y + ssizey_ext - i];
1686 s2 = working_space[x - i][y + ssizey_ext];
1687 s3 = working_space[x + i][y + ssizey_ext];
1688 s4 = working_space[
x][y + ssizey_ext + i];
1689 b = (p1 +
p2) / 2.0;
1692 b = (p1 +
p3) / 2.0;
1695 b = (p2 + p4) / 2.0;
1698 b = (p3 + p4) / 2.0;
1701 s1 = s1 - (p1 +
p3) / 2.0;
1702 s2 = s2 - (p1 +
p2) / 2.0;
1703 s3 = s3 - (p3 + p4) / 2.0;
1704 s4 = s4 - (p2 + p4) / 2.0;
1705 b = (s1 + s4) / 2.0 + (s2 + s3) / 2.0 + (p1 + p2 + p3 + p4) / 4.0;
1708 working_space[
x][
y] =
a;
1711 for(y = i;y < ssizey_ext - i; y++){
1712 for(x = i; x < ssizex_ext - i; x++){
1713 working_space[
x][y + ssizey_ext] = working_space[
x][
y];
1717 for(j = 0;j < ssizey_ext; j++){
1718 for(i = 0; i < ssizex_ext; i++){
1721 working_space[i][j + ssizey_ext] = source[0][0] - working_space[i][j + ssizey_ext];
1723 else if(j >= ssizey + shift)
1724 working_space[i][j + ssizey_ext] = source[0][ssizey - 1] - working_space[i][j + ssizey_ext];
1727 working_space[i][j + ssizey_ext] = source[0][j - shift] - working_space[i][j + ssizey_ext];
1730 else if(i >= ssizex + shift){
1732 working_space[i][j + ssizey_ext] = source[ssizex - 1][0] - working_space[i][j + ssizey_ext];
1734 else if(j >= ssizey + shift)
1735 working_space[i][j + ssizey_ext] = source[ssizex - 1][ssizey - 1] - working_space[i][j + ssizey_ext];
1738 working_space[i][j + ssizey_ext] = source[ssizex - 1][j - shift] - working_space[i][j + ssizey_ext];
1743 working_space[i][j + ssizey_ext] = source[i - shift][0] - working_space[i][j + ssizey_ext];
1745 else if(j >= ssizey + shift)
1746 working_space[i][j + ssizey_ext] = source[i - shift][ssizey - 1] - working_space[i][j + ssizey_ext];
1749 working_space[i][j + ssizey_ext] = source[i - shift][j - shift] - working_space[i][j + ssizey_ext];
1754 for(j = 0; j < ssizey_ext; j++){
1755 for(i = 0; i < ssizex_ext; i++){
1756 working_space[i][j + 15*ssizey_ext] = working_space[i][j + ssizey_ext];
1760 for(i = 0;i < ssizex_ext; i++){
1761 for(j = 0; j < ssizey_ext; j++)
1762 working_space[i][j + 2 * ssizex_ext] = working_space[i][ssizey_ext + j];
1765 xmax = ssizex_ext - 1;
1767 ymax = ssizey_ext - 1;
1768 for(i = 0, maxch = 0; i < ssizex_ext; i++){
1769 for(j = 0; j < ssizey_ext; j++){
1770 working_space[i][j] = 0;
1771 if(maxch < working_space[i][j + 2 * ssizey_ext])
1772 maxch = working_space[i][j + 2 * ssizey_ext];
1773 plocha += working_space[i][j + 2 * ssizey_ext];
1777 delete [] working_space;
1783 for(i = xmin; i <
xmax; i++){
1784 nip = working_space[i][ymin + 2 * ssizey_ext] / maxch;
1785 nim = working_space[i + 1][ymin + 2 * ssizey_ext] / maxch;
1787 for(l = 1;l <= averWindow; l++){
1789 a = working_space[xmax][ymin + 2 * ssizey_ext] / maxch;
1792 a = working_space[i +
l][ymin + 2 * ssizey_ext] / maxch;
1803 if(i - l + 1 < xmin)
1804 a = working_space[
xmin][ymin + 2 * ssizey_ext] / maxch;
1807 a = working_space[i - l + 1][ymin + 2 * ssizey_ext] / maxch;
1819 a = working_space[i + 1][
ymin] = a * working_space[i][
ymin];
1822 for(i = ymin; i <
ymax; i++){
1823 nip = working_space[
xmin][i + 2 * ssizey_ext] / maxch;
1824 nim = working_space[
xmin][i + 1 + 2 * ssizey_ext] / maxch;
1826 for(l = 1; l <= averWindow; l++){
1828 a = working_space[
xmin][ymax + 2 * ssizey_ext] / maxch;
1831 a = working_space[
xmin][i + l + 2 * ssizey_ext] / maxch;
1841 if(i - l + 1 < ymin)
1842 a = working_space[
xmin][ymin + 2 * ssizey_ext] / maxch;
1845 a = working_space[
xmin][i - l + 1 + 2 * ssizey_ext] / maxch;
1857 a = working_space[
xmin][i + 1] = a * working_space[
xmin][i];
1860 for(i = xmin; i <
xmax; i++){
1861 for(j = ymin; j <
ymax; j++){
1862 nip = working_space[i][j + 1 + 2 * ssizey_ext] / maxch;
1863 nim = working_space[i + 1][j + 1 + 2 * ssizey_ext] / maxch;
1865 for(l = 1; l <= averWindow; l++){
1867 a = working_space[
xmax][j + 2 * ssizey_ext] / maxch;
1870 a = working_space[i +
l][j + 2 * ssizey_ext] / maxch;
1880 if(i - l + 1 < xmin)
1881 a = working_space[
xmin][j + 2 * ssizey_ext] / maxch;
1884 a = working_space[i - l + 1][j + 2 * ssizey_ext] / maxch;
1896 nip = working_space[i + 1][j + 2 * ssizey_ext] / maxch;
1897 nim = working_space[i + 1][j + 1 + 2 * ssizey_ext] / maxch;
1898 for(l = 1; l <= averWindow; l++){
1900 a = working_space[i][ymax + 2 * ssizey_ext] / maxch;
1903 a = working_space[i][j + l + 2 * ssizey_ext] / maxch;
1913 if(j - l + 1 < ymin)
1914 a = working_space[i][ymin + 2 * ssizey_ext] / maxch;
1917 a = working_space[i][j - l + 1 + 2 * ssizey_ext] / maxch;
1927 a = (spx * working_space[i][j + 1] + spy * working_space[i + 1][j]) / (smx + smy);
1928 working_space[i + 1][j + 1] =
a;
1932 for(i = xmin; i <=
xmax; i++){
1933 for(j = ymin; j <=
ymax; j++){
1934 working_space[i][j] = working_space[i][j] / nom;
1937 for(i = 0; i < ssizex_ext; i++){
1938 for(j = 0; j < ssizey_ext; j++){
1939 working_space[i][j + ssizey_ext] = working_space[i][j] * plocha;
1940 working_space[i][2 * ssizey_ext + j] = working_space[i][ssizey_ext + j];
1947 positx = 0,posity = 0;
1950 for(i = 0; i < ssizex_ext; i++){
1951 for(j = 0; j < ssizey_ext; j++){
1954 lda = (lda * lda + ldb * ldb) / (2 * sigma * sigma);
1964 working_space[i][j] = lda;
1968 positx = i,posity = j;
1973 for(i = 0;i < ssizex_ext; i++){
1974 for(j = 0;j < ssizey_ext; j++){
1975 working_space[i][j + 14 * ssizey_ext] =
TMath::Abs(working_space[i][j + ssizey_ext]);
1987 i1min = -i,i1max = i;
1988 i2min = -j,i2max = j;
1989 for(i2 = i2min; i2 <= i2max; i2++){
1990 for(i1 = i1min; i1 <= i1max; i1++){
1996 j2max = lhy - 1 - i2;
2000 for(j2 = j2min; j2 <= j2max; j2++){
2005 j1max = lhx - 1 - i1;
2009 for(j1 = j1min; j1 <= j1max; j1++){
2010 lda = working_space[j1][j2];
2011 ldb = working_space[i1 + j1][i2 + j2];
2012 ldc = ldc + lda * ldb;
2015 k = (i1 + ssizex_ext) / ssizex_ext;
2016 working_space[(i1 + ssizex_ext) % ssizex_ext][i2 + ssizey_ext + 10 * ssizey_ext + k * 2 * ssizey_ext] = ldc;
2028 i2min = -j,i2max = ssizey_ext + j - 1;
2029 i1min = -i,i1max = ssizex_ext + i - 1;
2030 for(i2 = i2min; i2 <= i2max; i2++){
2031 for(i1=i1min;i1<=i1max;i1++){
2033 for(j2 = 0; j2 <= (lhy - 1); j2++){
2034 for(j1 = 0; j1 <= (lhx - 1); j1++){
2035 k2 = i2 + j2,k1 = i1 + j1;
2036 if(k2 >= 0 && k2 < ssizey_ext && k1 >= 0 && k1 < ssizex_ext){
2037 lda = working_space[j1][j2];
2038 ldb = working_space[k1][k2 + 14 * ssizey_ext];
2039 ldc = ldc + lda * ldb;
2043 k = (i1 + ssizex_ext) / ssizex_ext;
2044 working_space[(i1 + ssizex_ext) % ssizex_ext][i2 + ssizey_ext + ssizey_ext + k * 3 * ssizey_ext] = ldc;
2048 for(i2 = 0; i2 < ssizey_ext; i2++){
2049 for(i1 = 0; i1 < ssizex_ext; i1++){
2050 k = (i1 + ssizex_ext) / ssizex_ext;
2051 ldb = working_space[(i1 + ssizex_ext) % ssizex_ext][i2 + ssizey_ext + ssizey_ext + k * 3 * ssizey_ext];
2052 working_space[i1][i2 + 14 * ssizey_ext] = ldb;
2056 for(i2 = 0; i2 < ssizey_ext; i2++){
2057 for(i1 = 0; i1 < ssizex_ext; i1++){
2058 working_space[i1][i2 + ssizey_ext] = 1;
2059 working_space[i1][i2 + 2 * ssizey_ext] = 0;
2063 for(lindex = 0; lindex < deconIterations; lindex++){
2064 for(i2 = 0; i2 < ssizey_ext; i2++){
2065 for(i1 = 0; i1 < ssizex_ext; i1++){
2066 lda = working_space[i1][i2 + ssizey_ext];
2067 ldc = working_space[i1][i2 + 14 * ssizey_ext];
2068 if(lda > 0.000001 && ldc > 0.000001){
2075 j2max = ssizey_ext - i2 - 1;
2084 j1max = ssizex_ext - i1 - 1;
2088 for(j2 = j2min; j2 <= j2max; j2++){
2089 for(j1 = j1min; j1 <= j1max; j1++){
2090 k = (j1 + ssizex_ext) / ssizex_ext;
2091 ldc = working_space[(j1 + ssizex_ext) % ssizex_ext][j2 + ssizey_ext + 10 * ssizey_ext + k * 2 * ssizey_ext];
2092 lda = working_space[i1 + j1][i2 + j2 + ssizey_ext];
2093 ldb = ldb + lda * ldc;
2096 lda = working_space[i1][i2 + ssizey_ext];
2097 ldc = working_space[i1][i2 + 14 * ssizey_ext];
2098 if(ldc * lda != 0 && ldb != 0){
2099 lda =lda * ldc / ldb;
2104 working_space[i1][i2 + 2 * ssizey_ext] = lda;
2108 for(i2 = 0; i2 < ssizey_ext; i2++){
2109 for(i1 = 0; i1 < ssizex_ext; i1++)
2110 working_space[i1][i2 + ssizey_ext] = working_space[i1][i2 + 2 * ssizey_ext];
2115 for(i = 0; i < ssizex_ext; i++){
2116 for(j = 0; j < ssizey_ext; j++){
2117 working_space[(i + positx) % ssizex_ext][(j + posity) % ssizey_ext] = area * working_space[i][j + ssizey_ext];
2118 if(maximum < working_space[(i + positx) % ssizex_ext][(j + posity) % ssizey_ext])
2119 maximum = working_space[(i + positx) % ssizex_ext][(j + posity) % ssizey_ext];
2124 for(i = 1; i < ssizex_ext - 1; i++){
2125 for(j = 1; j < ssizey_ext - 1; j++){
2126 if(working_space[i][j] > working_space[i - 1][j] && working_space[i][j] > working_space[i - 1][j - 1] && working_space[i][j] > working_space[i][j - 1] && working_space[i][j] > working_space[i + 1][j - 1] && working_space[i][j] > working_space[i + 1][j] && working_space[i][j] > working_space[i + 1][j + 1] && working_space[i][j] > working_space[i][j + 1] && working_space[i][j] > working_space[i - 1][j + 1]){
2127 if(i >= shift && i < ssizex + shift && j >= shift && j < ssizey + shift){
2128 if(working_space[i][j] > threshold * maximum / 100.0){
2130 for(k = i - 1,a = 0,b = 0; k <= i + 1; k++){
2131 a += (
Double_t)(k - shift) * working_space[k][j];
2132 b += working_space[k][j];
2141 for(k = j - 1,a = 0,b = 0; k <= j + 1; k++){
2142 a += (
Double_t)(k - shift) * working_space[i][k];
2143 b += working_space[i][k];
2152 if(peak_index == 0){
2159 for(k = 0, priz = 0; k < peak_index && priz == 0; k++){
2171 for(l = peak_index; l >= k; l--){
2190 for(i = 0; i < ssizex; i++){
2191 for(j = 0; j < ssizey; j++){
2192 dest[i][j] = working_space[i + shift][j + shift];
2195 i = (
Int_t)(4 * sigma + 0.5);
2197 for (j = 0; j < ssizex + i; j++)
2198 delete[]working_space[j];
2199 delete[]working_space;
2210 return s.
Search(hist,sigma,option,threshold);
virtual const char * GetName() const
Returns name of object.
const char * Deconvolution(Double_t **source, Double_t **resp, Int_t ssizex, Int_t ssizey, Int_t numberIterations, Int_t numberRepetitions, Double_t boost)
This function calculates deconvolution from source spectrum according to response spectrum The result...
static double p3(double t, double a, double b, double c, double d)
Double_t * fPositionY
[fNPeaks] Y position of peaks
Advanced 2-dimensional spectra processing.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
static Int_t fgAverageWindow
Average window of searched peaks.
TH1 * fHistogram
resulting histogram
static void SetDeconIterations(Int_t n=3)
static function: Set max number of decon iterations in deconvolution operation see TSpectrum2::Search...
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
Double_t fResolution
NOT USED resolution of the neighboring peaks
void SetResolution(Double_t resolution=1)
NOT USED resolution: determines resolution of the neighboring peaks default value is 1 correspond to ...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
virtual Int_t GetDimension() const
Int_t fNPeaks
number of peaks found
The TNamed class is the base class for all named ROOT classes.
static double p2(double t, double a, double b, double c)
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void Print(Option_t *option="") const
Print the array of positions.
Int_t fMaxPeaks
Maximum number of peaks to be found.
Double_t * fPositionX
[fNPeaks] X position of peaks
virtual TObject * Remove(TObject *obj)
Remove object from the list.
static void SetAverageWindow(Int_t w=3)
static function: Set average window of searched peaks see TSpectrum2::SearchHighRes ...
LVector boost(const LVector &v, const BoostVector &b)
Boost a generic Lorentz Vector class using a generic 3D Vector class describing the boost The only re...
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
static double p1(double t, double a, double b)
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
static Int_t StaticSearch(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05)
static function (called by TH1), interface to TSpectrum2::Search
A PolyMarker is defined by an array on N points in a 2-D space.
Double_t * fPosition
[fNPeaks] array of current peak positions
virtual ~TSpectrum2()
Destructor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
virtual void Add(TObject *obj)
const char * SmoothMarkov(Double_t **source, Int_t ssizex, Int_t ssizey, Int_t averWindow)
This function calculates smoothed spectrum from source spectrum based on Markov chain method...
#define dest(otri, vertexptr)
Short_t Max(Short_t a, Short_t b)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
static TH1 * StaticBackground(const TH1 *hist, Int_t niter=20, Option_t *option="")
static function (called by TH1), interface to TSpectrum2::Background
virtual TH1 * Background(const TH1 *hist, Int_t niter=20, Option_t *option="")
This function calculates the background spectrum in the input histogram h.
Double_t Sqrt(Double_t x)
TList * GetListOfFunctions() const
Int_t SearchHighRes(Double_t **source, Double_t **dest, Int_t ssizex, Int_t ssizey, Double_t sigma, Double_t threshold, Bool_t backgroundRemove, Int_t deconIterations, Bool_t markov, Int_t averWindow)
This function searches for peaks in source spectrum It is based on deconvolution method.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
static Int_t fgIterations
Maximum number of decon iterations (default=3)
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
This function searches for peaks in source spectrum in hin The number of found peaks and their positi...