51 #define PEAK_WINDOW 1024 118 Error(
"Background",
"function not yet implemented: h=%s, iter=%d, option=%sn" 119 , h->
GetName(), number_of_iterations, option);
128 printf(
"\nNumber of positions = %d\n",
fNPeaks);
166 if (dimension != 3) {
167 Error(
"Search",
"Must be a 3-d histogram");
174 Int_t i, j, k, binx,biny,binz, npeaks;
177 for (i = 0; i < sizex; i++) {
180 for (j = 0; j < sizey; j++) {
183 for (k = 0; k < sizez; k++)
188 npeaks =
SearchHighRes((
const Double_t***)source, dest, sizex, sizey, sizez, sigma, 100*threshold,
kTRUE, 3,
kFALSE, 3);
193 for (i = 0; i < npeaks; i++) {
201 for (i = 0; i < sizex; i++) {
202 for (j = 0; j < sizey; j++){
203 delete [] source[i][j];
204 delete [] dest[i][j];
212 if (strstr(option,
"goff"))
214 if (!npeaks)
return 0;
386 Int_t numberIterationsX,
387 Int_t numberIterationsY,
388 Int_t numberIterationsZ,
392 Int_t i, j,
x,
y,
z, sampling, q1, q2, q3;
393 Double_t a,
b, c, d,
p1,
p2,
p3, p4, p5, p6, p7, p8, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12,
r1,
r2,
r3, r4, r5, r6;
394 if (ssizex <= 0 || ssizey <= 0 || ssizez <= 0)
395 return "Wrong parameters";
396 if (numberIterationsX < 1 || numberIterationsY < 1 || numberIterationsZ < 1)
397 return "Width of Clipping Window Must Be Positive";
398 if (ssizex < 2 * numberIterationsX + 1 || ssizey < 2 * numberIterationsY + 1 || ssizey < 2 * numberIterationsZ + 1)
399 return (
"Too Large Clipping Window");
401 for(i=0;i<ssizex;i++){
402 working_space[i] =
new Double_t*[ssizey];
403 for(j=0;j<ssizey;j++)
404 working_space[i][j]=
new Double_t[ssizez];
410 for (i = 1; i <= sampling; i++) {
412 for (z = q3; z < ssizez - q3; z++) {
413 for (y = q2; y < ssizey - q2; y++) {
414 for (x = q1; x < ssizex - q1; x++) {
415 a = spectrum[
x][
y][
z];
416 p1 = spectrum[x + q1][y + q2][z - q3];
417 p2 = spectrum[x - q1][y + q2][z - q3];
418 p3 = spectrum[x + q1][y - q2][z - q3];
419 p4 = spectrum[x - q1][y - q2][z - q3];
420 p5 = spectrum[x + q1][y + q2][z + q3];
421 p6 = spectrum[x - q1][y + q2][z + q3];
422 p7 = spectrum[x + q1][y - q2][z + q3];
423 p8 = spectrum[x - q1][y - q2][z + q3];
424 s1 = spectrum[x + q1][
y ][z - q3];
425 s2 = spectrum[
x ][y + q2][z - q3];
426 s3 = spectrum[x - q1][
y ][z - q3];
427 s4 = spectrum[
x ][y - q2][z - q3];
428 s5 = spectrum[x + q1][
y ][z + q3];
429 s6 = spectrum[
x ][y + q2][z + q3];
430 s7 = spectrum[x - q1][
y ][z + q3];
431 s8 = spectrum[
x ][y - q2][z + q3];
432 s9 = spectrum[x - q1][y + q2][
z ];
433 s10 = spectrum[x - q1][y - q2][
z ];
434 s11 = spectrum[x + q1][y + q2][
z ];
435 s12 = spectrum[x + q1][y - q2][
z ];
436 r1 = spectrum[
x ][
y ][z - q3];
437 r2 = spectrum[
x ][
y ][z + q3];
438 r3 = spectrum[x - q1][
y ][
z ];
439 r4 = spectrum[x + q1][
y ][
z ];
440 r5 = spectrum[
x ][y + q2][
z ];
441 r6 = spectrum[
x ][y - q2][
z ];
478 s1 = s1 - (p1 +
p3) / 2.0;
479 s2 = s2 - (p1 +
p2) / 2.0;
480 s3 = s3 - (p2 + p4) / 2.0;
481 s4 = s4 - (p3 + p4) / 2.0;
482 s5 = s5 - (p5 + p7) / 2.0;
483 s6 = s6 - (p5 + p6) / 2.0;
484 s7 = s7 - (p6 + p8) / 2.0;
485 s8 = s8 - (p7 + p8) / 2.0;
486 s9 = s9 - (p2 + p6) / 2.0;
487 s10 = s10 - (p4 + p8) / 2.0;
488 s11 = s11 - (p1 + p5) / 2.0;
489 s12 = s12 - (p3 + p7) / 2.0;
490 b = (s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0;
493 b = (s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0;
496 b = (s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0;
499 b = (s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0;
502 b = (s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0;
505 b = (s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0;
508 r1 = r1 - ((s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0);
509 r2 = r2 - ((s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0);
510 r3 = r3 - ((s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0);
511 r4 = r4 - ((s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0);
512 r5 = r5 - ((s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0);
513 r6 = r6 - ((s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0);
514 b = (r1 +
r2) / 2.0 + (r3 + r4) / 2.0 + (r5 + r6) / 2.0 + (s1 + s3 + s5 + s7) / 4.0 + (s2 + s4 + s6 + s8) / 4.0 + (s9 + s10 + s11 + s12) / 4.0 + (p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8.0;
517 working_space[
x][
y][
z] =
a;
521 for (z = q3; z < ssizez - q3; z++) {
522 for (y = q2; y < ssizey - q2; y++) {
523 for (x = q1; x < ssizex - q1; x++) {
524 spectrum[
x][
y][
z] = working_space[
x][
y][
z];
532 for (i = 1; i <= sampling; i++) {
534 for (z = q3; z < ssizez - q3; z++) {
535 for (y = q2; y < ssizey - q2; y++) {
536 for (x = q1; x < ssizex - q1; x++) {
537 a = spectrum[
x][
y][
z];
538 p1 = spectrum[x + q1][y + q2][z - q3];
539 p2 = spectrum[x - q1][y + q2][z - q3];
540 p3 = spectrum[x + q1][y - q2][z - q3];
541 p4 = spectrum[x - q1][y - q2][z - q3];
542 p5 = spectrum[x + q1][y + q2][z + q3];
543 p6 = spectrum[x - q1][y + q2][z + q3];
544 p7 = spectrum[x + q1][y - q2][z + q3];
545 p8 = spectrum[x - q1][y - q2][z + q3];
546 s1 = spectrum[x + q1][
y ][z - q3];
547 s2 = spectrum[
x ][y + q2][z - q3];
548 s3 = spectrum[x - q1][
y ][z - q3];
549 s4 = spectrum[
x ][y - q2][z - q3];
550 s5 = spectrum[x + q1][
y ][z + q3];
551 s6 = spectrum[
x ][y + q2][z + q3];
552 s7 = spectrum[x - q1][
y ][z + q3];
553 s8 = spectrum[
x ][y - q2][z + q3];
554 s9 = spectrum[x - q1][y + q2][
z ];
555 s10 = spectrum[x - q1][y - q2][
z ];
556 s11 = spectrum[x + q1][y + q2][
z ];
557 s12 = spectrum[x + q1][y - q2][
z ];
558 r1 = spectrum[
x ][
y ][z - q3];
559 r2 = spectrum[
x ][
y ][z + q3];
560 r3 = spectrum[x - q1][
y ][
z ];
561 r4 = spectrum[x + q1][
y ][
z ];
562 r5 = spectrum[
x ][y + q2][
z ];
563 r6 = spectrum[
x ][y - q2][
z ];
564 b=(p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8 - (s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12) / 4 + (r1 + r2 + r3 + r4 + r5 + r6) / 2;
565 c = -(s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12) / 4 + (r1 + r2 + r3 + r4 + r5 + r6) / 2;
566 d = -(p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8 + (s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12) / 12;
567 if(b < a && b >= 0 && c >=0 && d >= 0)
569 working_space[
x][
y][
z] =
a;
573 for (z = q3; z < ssizez - q3; z++) {
574 for (y = q2; y < ssizey - q2; y++) {
575 for (x = q1; x < ssizex - q1; x++) {
576 spectrum[
x][
y][
z] = working_space[
x][
y][
z];
586 for (i = sampling; i >= 1; i--) {
588 for (z = q3; z < ssizez - q3; z++) {
589 for (y = q2; y < ssizey - q2; y++) {
590 for (x = q1; x < ssizex - q1; x++) {
591 a = spectrum[
x][
y][
z];
592 p1 = spectrum[x + q1][y + q2][z - q3];
593 p2 = spectrum[x - q1][y + q2][z - q3];
594 p3 = spectrum[x + q1][y - q2][z - q3];
595 p4 = spectrum[x - q1][y - q2][z - q3];
596 p5 = spectrum[x + q1][y + q2][z + q3];
597 p6 = spectrum[x - q1][y + q2][z + q3];
598 p7 = spectrum[x + q1][y - q2][z + q3];
599 p8 = spectrum[x - q1][y - q2][z + q3];
600 s1 = spectrum[x + q1][
y ][z - q3];
601 s2 = spectrum[
x ][y + q2][z - q3];
602 s3 = spectrum[x - q1][
y ][z - q3];
603 s4 = spectrum[
x ][y - q2][z - q3];
604 s5 = spectrum[x + q1][
y ][z + q3];
605 s6 = spectrum[
x ][y + q2][z + q3];
606 s7 = spectrum[x - q1][
y ][z + q3];
607 s8 = spectrum[
x ][y - q2][z + q3];
608 s9 = spectrum[x - q1][y + q2][
z ];
609 s10 = spectrum[x - q1][y - q2][
z ];
610 s11 = spectrum[x + q1][y + q2][
z ];
611 s12 = spectrum[x + q1][y - q2][
z ];
612 r1 = spectrum[
x ][
y ][z - q3];
613 r2 = spectrum[
x ][
y ][z + q3];
614 r3 = spectrum[x - q1][
y ][
z ];
615 r4 = spectrum[x + q1][
y ][
z ];
616 r5 = spectrum[
x ][y + q2][
z ];
617 r6 = spectrum[
x ][y - q2][
z ];
654 s1 = s1 - (p1 +
p3) / 2.0;
655 s2 = s2 - (p1 +
p2) / 2.0;
656 s3 = s3 - (p2 + p4) / 2.0;
657 s4 = s4 - (p3 + p4) / 2.0;
658 s5 = s5 - (p5 + p7) / 2.0;
659 s6 = s6 - (p5 + p6) / 2.0;
660 s7 = s7 - (p6 + p8) / 2.0;
661 s8 = s8 - (p7 + p8) / 2.0;
662 s9 = s9 - (p2 + p6) / 2.0;
663 s10 = s10 - (p4 + p8) / 2.0;
664 s11 = s11 - (p1 + p5) / 2.0;
665 s12 = s12 - (p3 + p7) / 2.0;
666 b = (s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0;
669 b = (s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0;
672 b = (s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0;
675 b = (s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0;
678 b = (s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0;
681 b = (s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0;
684 r1 = r1 - ((s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0);
685 r2 = r2 - ((s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0);
686 r3 = r3 - ((s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0);
687 r4 = r4 - ((s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0);
688 r5 = r5 - ((s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0);
689 r6 = r6 - ((s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0);
690 b = (r1 +
r2) / 2.0 + (r3 + r4) / 2.0 + (r5 + r6) / 2.0 + (s1 + s3 + s5 + s7) / 4.0 + (s2 + s4 + s6 + s8) / 4.0 + (s9 + s10 + s11 + s12) / 4.0 + (p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8.0;
693 working_space[
x][
y][
z] =
a;
697 for (z = q3; z < ssizez - q3; z++) {
698 for (y = q2; y < ssizey - q2; y++) {
699 for (x = q1; x < ssizex - q1; x++) {
700 spectrum[
x][
y][
z] = working_space[
x][
y][
z];
708 for (i = sampling; i >= 1; i--) {
710 for (z = q3; z < ssizez - q3; z++) {
711 for (y = q2; y < ssizey - q2; y++) {
712 for (x = q1; x < ssizex - q1; x++) {
713 a = spectrum[
x][
y][
z];
714 p1 = spectrum[x + q1][y + q2][z - q3];
715 p2 = spectrum[x - q1][y + q2][z - q3];
716 p3 = spectrum[x + q1][y - q2][z - q3];
717 p4 = spectrum[x - q1][y - q2][z - q3];
718 p5 = spectrum[x + q1][y + q2][z + q3];
719 p6 = spectrum[x - q1][y + q2][z + q3];
720 p7 = spectrum[x + q1][y - q2][z + q3];
721 p8 = spectrum[x - q1][y - q2][z + q3];
722 s1 = spectrum[x + q1][
y ][z - q3];
723 s2 = spectrum[
x ][y + q2][z - q3];
724 s3 = spectrum[x - q1][
y ][z - q3];
725 s4 = spectrum[
x ][y - q2][z - q3];
726 s5 = spectrum[x + q1][
y ][z + q3];
727 s6 = spectrum[
x ][y + q2][z + q3];
728 s7 = spectrum[x - q1][
y ][z + q3];
729 s8 = spectrum[
x ][y - q2][z + q3];
730 s9 = spectrum[x - q1][y + q2][
z ];
731 s10 = spectrum[x - q1][y - q2][
z ];
732 s11 = spectrum[x + q1][y + q2][
z ];
733 s12 = spectrum[x + q1][y - q2][
z ];
734 r1 = spectrum[
x ][
y ][z - q3];
735 r2 = spectrum[
x ][
y ][z + q3];
736 r3 = spectrum[x - q1][
y ][
z ];
737 r4 = spectrum[x + q1][
y ][
z ];
738 r5 = spectrum[
x ][y + q2][
z ];
739 r6 = spectrum[
x ][y - q2][
z ];
740 b = (p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8 - (s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12) / 4 + (r1 + r2 + r3 + r4 + r5 + r6) / 2;
741 c = -(s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12) / 4+(r1 + r2 + r3 + r4 + r5 + r6) / 2;
742 d = -(p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8)/8 + (s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12) / 12;
743 if(b < a && b >= 0 && c >=0 && d >= 0)
745 working_space[
x][
y][
z] =
a;
749 for (z = q3; z < ssizez - q3; z++) {
750 for (y = q2; y < ssizey - q2; y++) {
751 for (x = q1; x < ssizex - q1; x++) {
752 spectrum[
x][
y][
z] = working_space[
x][
y][
z];
759 for(i = 0;i < ssizex; i++){
760 for(j = 0;j < ssizey; j++)
761 delete[] working_space[i][j];
762 delete[] working_space[i];
764 delete[] working_space;
863 Double_t nom,nip,nim,sp,sm,spx,smx,spy,smy,spz,smz,plocha=0;
865 return "Averaging Window must be positive";
867 for(i = 0;i < ssizex; i++){
868 working_space[i] =
new Double_t*[ssizey];
869 for(j = 0;j < ssizey; j++)
870 working_space[i][j] =
new Double_t[ssizez];
878 for(i = 0,maxch = 0;i < ssizex; i++){
879 for(j = 0;j < ssizey; j++){
880 for(k = 0;k < ssizez; k++){
881 working_space[i][j][k] = 0;
882 if(maxch < source[i][j][k])
883 maxch = source[i][j][k];
884 plocha += source[i][j][k];
889 delete [] working_space;
894 working_space[
xmin][
ymin][zmin] = 1;
895 for(i = xmin;i <
xmax; i++){
896 nip = source[i][
ymin][zmin] / maxch;
897 nim = source[i + 1][
ymin][zmin] / maxch;
899 for(l = 1;l <= averWindow; l++){
901 a = source[
xmax][
ymin][zmin] / maxch;
904 a = source[i +
l][
ymin][zmin] / maxch;
917 a = source[
xmin][
ymin][zmin] / maxch;
920 a = source[i - l + 1][
ymin][zmin] / maxch;
934 a = working_space[i + 1][
ymin][zmin] = a * working_space[i][
ymin][zmin];
937 for(i = ymin;i <
ymax; i++){
938 nip = source[
xmin][i][zmin] / maxch;
939 nim = source[
xmin][i + 1][zmin] / maxch;
941 for(l = 1;l <= averWindow; l++){
943 a = source[
xmin][
ymax][zmin] / maxch;
946 a = source[
xmin][i +
l][zmin] / maxch;
959 a = source[
xmin][
ymin][zmin] / maxch;
962 a = source[
xmin][i - l + 1][zmin] / maxch;
976 a = working_space[
xmin][i + 1][zmin] = a * working_space[
xmin][i][zmin];
979 for(i = zmin;i < zmax; i++){
980 nip = source[
xmin][
ymin][i] / maxch;
981 nim = source[
xmin][
ymin][i + 1] / maxch;
983 for(l = 1;l <= averWindow; l++){
985 a = source[
xmin][
ymin][zmax] / maxch;
1000 if(i - l + 1 < zmin)
1001 a = source[
xmin][
ymin][zmin] / maxch;
1004 a = source[
xmin][
ymin][i - l + 1] / maxch;
1020 for(i = xmin;i <
xmax; i++){
1021 for(j = ymin;j <
ymax; j++){
1022 nip = source[i][j + 1][zmin] / maxch;
1023 nim = source[i + 1][j + 1][zmin] / maxch;
1025 for(l = 1;l <= averWindow; l++){
1027 a = source[
xmax][j][zmin] / maxch;
1030 a = source[i +
l][j][zmin] / maxch;
1042 if(i - l + 1 < xmin)
1043 a = source[
xmin][j][zmin] / maxch;
1046 a = source[i - l + 1][j][zmin] / maxch;
1060 nip = source[i + 1][j][zmin] / maxch;
1061 nim = source[i + 1][j + 1][zmin] / maxch;
1062 for(l = 1;l <= averWindow; l++){
1064 a = source[i][
ymax][zmin] / maxch;
1067 a = source[i][j +
l][zmin] / maxch;
1079 if(j - l + 1 < ymin)
1080 a = source[i][
ymin][zmin] / maxch;
1083 a = source[i][j - l + 1][zmin] / maxch;
1096 a = (spx * working_space[i][j + 1][zmin] + spy * working_space[i + 1][j][zmin]) / (smx + smy);
1097 working_space[i + 1][j + 1][zmin] =
a;
1101 for(i = xmin;i <
xmax; i++){
1102 for(j = zmin;j < zmax; j++){
1103 nip = source[i][
ymin][j + 1] / maxch;
1104 nim = source[i + 1][
ymin][j + 1] / maxch;
1106 for(l = 1;l <= averWindow; l++){
1111 a = source[i +
l][
ymin][j] / maxch;
1123 if(i - l + 1 < xmin)
1127 a = source[i - l + 1][
ymin][j] / maxch;
1141 nip = source[i + 1][
ymin][j] / maxch;
1142 nim = source[i + 1][
ymin][j + 1] / maxch;
1143 for(l = 1;l <= averWindow; l++){
1145 a = source[i][
ymin][zmax] / maxch;
1148 a = source[i][
ymin][j +
l] / maxch;
1160 if(j - l + 1 < zmin)
1161 a = source[i][
ymin][zmin] / maxch;
1164 a = source[i][
ymin][j - l + 1] / maxch;
1177 a = (spx * working_space[i][
ymin][j + 1] + spz * working_space[i + 1][
ymin][j]) / (smx + smz);
1178 working_space[i + 1][
ymin][j + 1] =
a;
1182 for(i = ymin;i <
ymax; i++){
1183 for(j = zmin;j < zmax; j++){
1184 nip = source[
xmin][i][j + 1] / maxch;
1185 nim = source[
xmin][i + 1][j + 1] / maxch;
1187 for(l = 1;l <= averWindow; l++){
1192 a = source[
xmin][i +
l][j] / maxch;
1204 if(i - l + 1 < ymin)
1208 a = source[
xmin][i - l + 1][j] / maxch;
1222 nip = source[
xmin][i + 1][j] / maxch;
1223 nim = source[
xmin][i + 1][j + 1] / maxch;
1224 for(l = 1;l <= averWindow; l++){
1226 a = source[
xmin][i][zmax] / maxch;
1229 a = source[
xmin][i][j +
l] / maxch;
1241 if(j - l + 1 < zmin)
1242 a = source[
xmin][i][zmin] / maxch;
1245 a = source[
xmin][i][j - l + 1] / maxch;
1258 a = (spy * working_space[
xmin][i][j + 1] + spz * working_space[
xmin][i + 1][j]) / (smy + smz);
1259 working_space[
xmin][i + 1][j + 1] =
a;
1263 for(i = xmin;i <
xmax; i++){
1264 for(j = ymin;j <
ymax; j++){
1265 for(k = zmin;k < zmax; k++){
1266 nip = source[i][j + 1][k + 1] / maxch;
1267 nim = source[i + 1][j + 1][k + 1] / maxch;
1269 for(l = 1;l <= averWindow; l++){
1271 a = source[
xmax][j][k] / maxch;
1274 a = source[i +
l][j][k] / maxch;
1286 if(i - l + 1 < xmin)
1287 a = source[
xmin][j][k] / maxch;
1290 a = source[i - l + 1][j][k] / maxch;
1304 nip = source[i + 1][j][k + 1] / maxch;
1305 nim = source[i + 1][j + 1][k + 1] / maxch;
1306 for(l = 1;l <= averWindow; l++){
1308 a = source[i][
ymax][k] / maxch;
1311 a = source[i][j +
l][k] / maxch;
1323 if(j - l + 1 < ymin)
1324 a = source[i][
ymin][k] / maxch;
1327 a = source[i][j - l + 1][k] / maxch;
1341 nip = source[i + 1][j + 1][k] / maxch;
1342 nim = source[i + 1][j + 1][k + 1] / maxch;
1343 for(l = 1;l <= averWindow; l++){
1345 a = source[i][j][zmax] / maxch;
1348 a = source[i][j][k +
l] / maxch;
1360 if(j - l + 1 < ymin)
1361 a = source[i][j][zmin] / maxch;
1364 a = source[i][j][k - l + 1] / maxch;
1377 a = (spx * working_space[i][j + 1][k + 1] + spy * working_space[i + 1][j][k + 1] + spz * working_space[i + 1][j + 1][k]) / (smx + smy + smz);
1378 working_space[i + 1][j + 1][k + 1] =
a;
1383 for(i = xmin;i <=
xmax; i++){
1384 for(j = ymin;j <=
ymax; j++){
1385 for(k = zmin;k <= zmax; k++){
1386 working_space[i][j][k] = working_space[i][j][k] / nom;
1390 for(i = 0;i < ssizex; i++){
1391 for(j = 0;j < ssizey; j++){
1392 for(k = 0;k < ssizez; k++){
1393 source[i][j][k] = plocha * working_space[i][j][k];
1397 for(i = 0;i < ssizex; i++){
1398 for(j = 0;j < ssizey; j++)
1399 delete[] working_space[i][j];
1400 delete[] working_space[i];
1402 delete[] working_space;
1594 Int_t numberIterations,
1595 Int_t numberRepetitions,
1598 Int_t i, j, k, lhx, lhy, lhz, i1, i2, i3, j1, j2, j3, k1, k2, k3, lindex, i1min, i1max, i2min, i2max, i3min, i3max, j1min, j1max, j2min, j2max, j3min, j3max, positx = 0, posity = 0, positz = 0, repet;
1599 Double_t lda, ldb, ldc, area, maximum = 0;
1600 if (ssizex <= 0 || ssizey <= 0 || ssizez <= 0)
1601 return "Wrong parameters";
1602 if (numberIterations <= 0)
1603 return "Number of iterations must be positive";
1604 if (numberRepetitions <= 0)
1605 return "Number of repetitions must be positive";
1607 for(i=0;i<ssizex;i++){
1608 working_space[i]=
new Double_t* [ssizey];
1609 for(j=0;j<ssizey;j++)
1610 working_space[i][j]=
new Double_t [5*ssizez];
1613 lhx = -1, lhy = -1, lhz = -1;
1614 for (i = 0; i < ssizex; i++) {
1615 for (j = 0; j < ssizey; j++) {
1616 for (k = 0; k < ssizez; k++) {
1617 lda = resp[i][j][k];
1626 working_space[i][j][k] = lda;
1628 if (lda > maximum) {
1630 positx = i, posity = j, positz = k;
1635 if (lhx == -1 || lhy == -1 || lhz == -1) {
1636 delete [] working_space;
1637 return (
"Zero response data");
1641 for (i3 = 0; i3 < ssizez; i3++) {
1642 for (i2 = 0; i2 < ssizey; i2++) {
1643 for (i1 = 0; i1 < ssizex; i1++) {
1645 for (j3 = 0; j3 <= (lhz - 1); j3++) {
1646 for (j2 = 0; j2 <= (lhy - 1); j2++) {
1647 for (j1 = 0; j1 <= (lhx - 1); j1++) {
1648 k3 = i3 + j3, k2 = i2 + j2, k1 = i1 + j1;
1649 if (k3 >= 0 && k3 < ssizez && k2 >= 0 && k2 < ssizey && k1 >= 0 && k1 < ssizex) {
1650 lda = working_space[j1][j2][j3];
1651 ldb = source[k1][k2][k3];
1652 ldc = ldc + lda * ldb;
1657 working_space[i1][i2][i3 + ssizez] = ldc;
1663 i1min = -(lhx - 1), i1max = lhx - 1;
1664 i2min = -(lhy - 1), i2max = lhy - 1;
1665 i3min = -(lhz - 1), i3max = lhz - 1;
1666 for (i3 = i3min; i3 <= i3max; i3++) {
1667 for (i2 = i2min; i2 <= i2max; i2++) {
1668 for (i1 = i1min; i1 <= i1max; i1++) {
1673 j3max = lhz - 1 - i3;
1674 if (j3max > lhz - 1)
1676 for (j3 = j3min; j3 <= j3max; j3++) {
1680 j2max = lhy - 1 - i2;
1681 if (j2max > lhy - 1)
1683 for (j2 = j2min; j2 <= j2max; j2++) {
1687 j1max = lhx - 1 - i1;
1688 if (j1max > lhx - 1)
1690 for (j1 = j1min; j1 <= j1max; j1++) {
1691 lda = working_space[j1][j2][j3];
1692 if (i1 + j1 < ssizex && i2 + j2 < ssizey)
1693 ldb = working_space[i1 + j1][i2 + j2][i3 + j3];
1696 ldc = ldc + lda * ldb;
1700 working_space[i1 - i1min][i2 - i2min][i3 - i3min + 2 * ssizez ] = ldc;
1706 for (i3 = 0; i3 < ssizez; i3++) {
1707 for (i2 = 0; i2 < ssizey; i2++) {
1708 for (i1 = 0; i1 < ssizex; i1++) {
1709 working_space[i1][i2][i3 + 3 * ssizez] = 1;
1710 working_space[i1][i2][i3 + 4 * ssizez] = 0;
1716 for (repet = 0; repet < numberRepetitions; repet++) {
1718 for (i = 0; i < ssizex; i++) {
1719 for (j = 0; j < ssizey; j++) {
1720 for (k = 0; k < ssizez; k++) {
1721 working_space[i][j][k + 3 * ssizez] =
TMath::Power(working_space[i][j][k + 3 * ssizez],boost);
1726 for (lindex = 0; lindex < numberIterations; lindex++) {
1727 for (i3 = 0; i3 < ssizez; i3++) {
1728 for (i2 = 0; i2 < ssizey; i2++) {
1729 for (i1 = 0; i1 < ssizex; i1++) {
1732 if (j3min > lhz - 1)
1735 j3max = ssizez - i3 - 1;
1736 if (j3max > lhz - 1)
1739 if (j2min > lhy - 1)
1742 j2max = ssizey - i2 - 1;
1743 if (j2max > lhy - 1)
1746 if (j1min > lhx - 1)
1749 j1max = ssizex - i1 - 1;
1750 if (j1max > lhx - 1)
1752 for (j3 = j3min; j3 <= j3max; j3++) {
1753 for (j2 = j2min; j2 <= j2max; j2++) {
1754 for (j1 = j1min; j1 <= j1max; j1++) {
1755 ldc = working_space[j1 - i1min][j2 - i2min][j3 - i3min + 2 * ssizez];
1756 lda = working_space[i1 + j1][i2 + j2][i3 + j3 + 3 * ssizez];
1757 ldb = ldb + lda * ldc;
1761 lda = working_space[i1][i2][i3 + 3 * ssizez];
1762 ldc = working_space[i1][i2][i3 + 1 * ssizez];
1763 if (ldc * lda != 0 && ldb != 0) {
1764 lda = lda * ldc / ldb;
1769 working_space[i1][i2][i3 + 4 * ssizez] = lda;
1773 for (i3 = 0; i3 < ssizez; i3++) {
1774 for (i2 = 0; i2 < ssizey; i2++) {
1775 for (i1 = 0; i1 < ssizex; i1++)
1776 working_space[i1][i2][i3 + 3 * ssizez] = working_space[i1][i2][i3 + 4 * ssizez];
1781 for (i = 0; i < ssizex; i++) {
1782 for (j = 0; j < ssizey; j++){
1783 for (k = 0; k < ssizez; k++)
1784 source[(i + positx) % ssizex][(j + posity) % ssizey][(k + positz) % ssizez] = area * working_space[i][j][k + 3 * ssizez];
1787 delete [] working_space;
1937 Int_t number_of_iterations = (
Int_t)(4 * sigma + 0.5);
1940 Int_t xmin,
xmax,
l,peak_index = 0,sizex_ext=ssizex + 4 * number_of_iterations,sizey_ext = ssizey + 4 * number_of_iterations,sizez_ext = ssizez + 4 * number_of_iterations,shift = 2 * number_of_iterations;
1942 Double_t a,
b,maxch,plocha = 0,plocha_markov = 0;
1943 Double_t nom,nip,nim,sp,sm,spx,spy,smx,smy,spz,smz;
1944 Double_t p1,
p2,
p3,p4,p5,p6,p7,p8,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,
r1,
r2,
r3,r4,r5,r6;
1947 Int_t lhx,lhy,lhz,i1,i2,i3,j1,j2,j3,k1,k2,k3,i1min,i1max,i2min,i2max,i3min,i3max,j1min,j1max,j2min,j2max,j3min,j3max,positx,posity,positz;
1949 Error(
"SearchHighRes",
"Invalid sigma, must be greater than or equal to 1");
1953 if(threshold<=0||threshold>=100){
1954 Error(
"SearchHighRes",
"Invalid threshold, must be positive and less than 100");
1958 j = (
Int_t)(pocet_sigma*sigma+0.5);
1960 Error(
"SearchHighRes",
"Too large sigma");
1964 if (markov ==
true) {
1965 if (averWindow <= 0) {
1966 Error(
"SearchHighRes",
"Averaging window must be positive");
1971 if(backgroundRemove ==
true){
1972 if(sizex_ext < 2 * number_of_iterations + 1 || sizey_ext < 2 * number_of_iterations + 1 || sizez_ext < 2 * number_of_iterations + 1){
1973 Error(
"SearchHighRes",
"Too large clipping window");
1978 i = (
Int_t)(4 * sigma + 0.5);
1981 for(j = 0;j < ssizex + i; j++){
1982 working_space[j] =
new Double_t* [ssizey + i];
1983 for(k = 0;k < ssizey + i; k++)
1984 working_space[j][k] =
new Double_t [5 * (ssizez + i)];
1986 for(k = 0;k < sizez_ext; k++){
1987 for(j = 0;j < sizey_ext; j++){
1988 for(i = 0;i < sizex_ext; i++){
1992 working_space[i][j][k + sizez_ext] = source[0][0][0];
1994 else if(k >= ssizez + shift)
1995 working_space[i][j][k + sizez_ext] = source[0][0][ssizez - 1];
1998 working_space[i][j][k + sizez_ext] = source[0][0][k - shift];
2001 else if(j >= ssizey + shift){
2003 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][0];
2005 else if(k >= ssizez + shift)
2006 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][ssizez - 1];
2009 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][k - shift];
2014 working_space[i][j][k + sizez_ext] = source[0][j - shift][0];
2016 else if(k >= ssizez + shift)
2017 working_space[i][j][k + sizez_ext] = source[0][j - shift][ssizez - 1];
2020 working_space[i][j][k + sizez_ext] = source[0][j - shift][k - shift];
2024 else if(i >= ssizex + shift){
2027 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][0];
2029 else if(k >= ssizez + shift)
2030 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][ssizez - 1];
2033 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][k - shift];
2036 else if(j >= ssizey + shift){
2038 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][0];
2040 else if(k >= ssizez + shift)
2041 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][ssizez - 1];
2044 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][k - shift];
2049 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][0];
2051 else if(k >= ssizez + shift)
2052 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][ssizez - 1];
2055 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][k - shift];
2062 working_space[i][j][k + sizez_ext] = source[i - shift][0][0];
2064 else if(k >= ssizez + shift)
2065 working_space[i][j][k + sizez_ext] = source[i - shift][0][ssizez - 1];
2068 working_space[i][j][k + sizez_ext] = source[i - shift][0][k - shift];
2071 else if(j >= ssizey + shift){
2073 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][0];
2075 else if(k >= ssizez + shift)
2076 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][ssizez - 1];
2079 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][k - shift];
2084 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][0];
2086 else if(k >= ssizez + shift)
2087 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][ssizez - 1];
2090 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][k - shift];
2096 if(backgroundRemove ==
true){
2097 for(i = 1;i <= number_of_iterations; i++){
2098 for(z = i;z < sizez_ext - i; z++){
2099 for(y = i;y < sizey_ext - i; y++){
2100 for(x = i;x < sizex_ext - i; x++){
2101 a = working_space[
x][
y][z + sizez_ext];
2102 p1 = working_space[x + i][y + i][z - i + sizez_ext];
2103 p2 = working_space[x - i][y + i][z - i + sizez_ext];
2104 p3 = working_space[x + i][y - i][z - i + sizez_ext];
2105 p4 = working_space[x - i][y - i][z - i + sizez_ext];
2106 p5 = working_space[x + i][y + i][z + i + sizez_ext];
2107 p6 = working_space[x - i][y + i][z + i + sizez_ext];
2108 p7 = working_space[x + i][y - i][z + i + sizez_ext];
2109 p8 = working_space[x - i][y - i][z + i + sizez_ext];
2110 s1 = working_space[x + i][
y ][z - i + sizez_ext];
2111 s2 = working_space[
x ][y + i][z - i + sizez_ext];
2112 s3 = working_space[x - i][
y ][z - i + sizez_ext];
2113 s4 = working_space[
x ][y - i][z - i + sizez_ext];
2114 s5 = working_space[x + i][
y ][z + i + sizez_ext];
2115 s6 = working_space[
x ][y + i][z + i + sizez_ext];
2116 s7 = working_space[x - i][
y ][z + i + sizez_ext];
2117 s8 = working_space[
x ][y - i][z + i + sizez_ext];
2118 s9 = working_space[x - i][y + i][z + sizez_ext];
2119 s10 = working_space[x - i][y - i][z +sizez_ext];
2120 s11 = working_space[x + i][y + i][z +sizez_ext];
2121 s12 = working_space[x + i][y - i][z +sizez_ext];
2122 r1 = working_space[
x ][
y ][z - i + sizez_ext];
2123 r2 = working_space[
x ][
y ][z + i + sizez_ext];
2124 r3 = working_space[x - i][
y ][z + sizez_ext];
2125 r4 = working_space[x + i][
y ][z + sizez_ext];
2126 r5 = working_space[
x ][y + i][z + sizez_ext];
2127 r6 = working_space[
x ][y - i][z + sizez_ext];
2128 b = (p1 +
p3) / 2.0;
2132 b = (p1 +
p2) / 2.0;
2136 b = (p2 + p4) / 2.0;
2140 b = (p3 + p4) / 2.0;
2144 b = (p5 + p7) / 2.0;
2148 b = (p5 + p6) / 2.0;
2152 b = (p6 + p8) / 2.0;
2156 b = (p7 + p8) / 2.0;
2160 b = (p2 + p6) / 2.0;
2164 b = (p4 + p8) / 2.0;
2168 b = (p1 + p5) / 2.0;
2172 b = (p3 + p7) / 2.0;
2176 s1 = s1 - (p1 +
p3) / 2.0;
2177 s2 = s2 - (p1 +
p2) / 2.0;
2178 s3 = s3 - (p2 + p4) / 2.0;
2179 s4 = s4 - (p3 + p4) / 2.0;
2180 s5 = s5 - (p5 + p7) / 2.0;
2181 s6 = s6 - (p5 + p6) / 2.0;
2182 s7 = s7 - (p6 + p8) / 2.0;
2183 s8 = s8 - (p7 + p8) / 2.0;
2184 s9 = s9 - (p2 + p6) / 2.0;
2185 s10 = s10 - (p4 + p8) / 2.0;
2186 s11 = s11 - (p1 + p5) / 2.0;
2187 s12 = s12 - (p3 + p7) / 2.0;
2188 b = (s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0;
2192 b = (s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0;
2196 b = (s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0;
2200 b = (s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0;
2204 b = (s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0;
2208 b = (s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0;
2212 r1 = r1 - ((s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0);
2213 r2 = r2 - ((s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0);
2214 r3 = r3 - ((s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0);
2215 r4 = r4 - ((s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0);
2216 r5 = r5 - ((s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0);
2217 r6 = r6 - ((s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0);
2218 b = (r1 +
r2) / 2.0 + (r3 + r4) / 2.0 + (r5 + r6) / 2.0 + (s1 + s3 + s5 + s7) / 4.0 + (s2 + s4 + s6 + s8) / 4.0 + (s9 + s10 + s11 + s12) / 4.0 + (p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8.0;
2222 working_space[
x][
y][
z] =
a;
2226 for(z = i;z < sizez_ext - i; z++){
2227 for(y = i;y < sizey_ext - i; y++){
2228 for(x = i;x < sizex_ext - i; x++){
2229 working_space[
x][
y][z + sizez_ext] = working_space[
x][
y][
z];
2234 for(k = 0;k < sizez_ext; k++){
2235 for(j = 0;j < sizey_ext; j++){
2236 for(i = 0;i < sizex_ext; i++){
2240 working_space[i][j][k + sizez_ext] = source[0][0][0] - working_space[i][j][k + sizez_ext];
2242 else if(k >= ssizez + shift)
2243 working_space[i][j][k + sizez_ext] = source[0][0][ssizez - 1] - working_space[i][j][k + sizez_ext];
2246 working_space[i][j][k + sizez_ext] = source[0][0][k - shift] - working_space[i][j][k + sizez_ext];
2249 else if(j >= ssizey + shift){
2251 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][0] - working_space[i][j][k + sizez_ext];
2253 else if(k >= ssizez + shift)
2254 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][ssizez - 1] - working_space[i][j][k + sizez_ext];
2257 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][k - shift] - working_space[i][j][k + sizez_ext];
2262 working_space[i][j][k + sizez_ext] = source[0][j - shift][0] - working_space[i][j][k + sizez_ext];
2264 else if(k >= ssizez + shift)
2265 working_space[i][j][k + sizez_ext] = source[0][j - shift][ssizez - 1] - working_space[i][j][k + sizez_ext];
2268 working_space[i][j][k + sizez_ext] = source[0][j - shift][k - shift] - working_space[i][j][k + sizez_ext];
2272 else if(i >= ssizex + shift){
2275 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][0] - working_space[i][j][k + sizez_ext];
2277 else if(k >= ssizez + shift)
2278 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][ssizez - 1] - working_space[i][j][k + sizez_ext];
2281 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][k - shift] - working_space[i][j][k + sizez_ext];
2284 else if(j >= ssizey + shift){
2286 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][0] - working_space[i][j][k + sizez_ext];
2288 else if(k >= ssizez + shift)
2289 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][ssizez - 1] - working_space[i][j][k + sizez_ext];
2292 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][k - shift] - working_space[i][j][k + sizez_ext];
2297 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][0] - working_space[i][j][k + sizez_ext];
2299 else if(k >= ssizez + shift)
2300 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][ssizez - 1] - working_space[i][j][k + sizez_ext];
2303 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][k - shift] - working_space[i][j][k + sizez_ext];
2310 working_space[i][j][k + sizez_ext] = source[i - shift][0][0] - working_space[i][j][k + sizez_ext];
2312 else if(k >= ssizez + shift)
2313 working_space[i][j][k + sizez_ext] = source[i - shift][0][ssizez - 1] - working_space[i][j][k + sizez_ext];
2316 working_space[i][j][k + sizez_ext] = source[i - shift][0][k - shift] - working_space[i][j][k + sizez_ext];
2319 else if(j >= ssizey + shift){
2321 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][0] - working_space[i][j][k + sizez_ext];
2323 else if(k >= ssizez + shift)
2324 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][ssizez - 1] - working_space[i][j][k + sizez_ext];
2327 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][k - shift] - working_space[i][j][k + sizez_ext];
2332 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][0] - working_space[i][j][k + sizez_ext];
2334 else if(k >= ssizez + shift)
2335 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][ssizez - 1] - working_space[i][j][k + sizez_ext];
2338 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][k - shift] - working_space[i][j][k + sizez_ext];
2347 for(i = 0;i < sizex_ext; i++){
2348 for(j = 0;j < sizey_ext; j++){
2349 for(k = 0;k < sizez_ext; k++){
2350 working_space[i][j][k + 2 * sizez_ext] = working_space[i][j][sizez_ext + k];
2351 plocha_markov = plocha_markov + working_space[i][j][sizez_ext + k];
2356 xmax = sizex_ext - 1;
2358 ymax = sizey_ext - 1;
2360 zmax = sizez_ext - 1;
2361 for(i = 0,maxch = 0;i < sizex_ext; i++){
2362 for(j = 0;j < sizey_ext;j++){
2363 for(k = 0;k < sizez_ext;k++){
2364 working_space[i][j][k] = 0;
2365 if(maxch < working_space[i][j][k + 2 * sizez_ext])
2366 maxch = working_space[i][j][k + 2 * sizez_ext];
2368 plocha += working_space[i][j][k + 2 * sizez_ext];
2373 delete [] working_space;
2377 working_space[
xmin][
ymin][zmin] = 1;
2378 for(i = xmin;i <
xmax; i++){
2379 nip = working_space[i][
ymin][zmin + 2 * sizez_ext] / maxch;
2380 nim = working_space[i + 1][
ymin][zmin + 2 * sizez_ext] / maxch;
2382 for(l = 1;l <= averWindow; l++){
2384 a = working_space[xmax][ymin][zmin + 2 * sizez_ext] / maxch;
2387 a = working_space[i +
l][
ymin][zmin + 2 * sizez_ext] / maxch;
2399 if(i - l + 1 < xmin)
2400 a = working_space[
xmin][
ymin][zmin + 2 * sizez_ext] / maxch;
2403 a = working_space[i - l + 1][
ymin][zmin + 2 * sizez_ext] / maxch;
2417 a = working_space[i + 1][
ymin][zmin] = a * working_space[i][
ymin][zmin];
2420 for(i = ymin;i <
ymax; i++){
2421 nip = working_space[
xmin][i][zmin + 2 * sizez_ext] / maxch;
2422 nim = working_space[
xmin][i + 1][zmin + 2 * sizez_ext] / maxch;
2424 for(l = 1;l <= averWindow; l++){
2426 a = working_space[
xmin][
ymax][zmin + 2 * sizez_ext] / maxch;
2429 a = working_space[
xmin][i +
l][zmin + 2 * sizez_ext] / maxch;
2441 if(i - l + 1 < ymin)
2442 a = working_space[
xmin][
ymin][zmin + 2 * sizez_ext] / maxch;
2445 a = working_space[
xmin][i - l + 1][zmin + 2 * sizez_ext] / maxch;
2459 a = working_space[
xmin][i + 1][zmin] = a * working_space[
xmin][i][zmin];
2462 for(i = zmin;i < zmax;i++){
2463 nip = working_space[
xmin][
ymin][i + 2 * sizez_ext] / maxch;
2464 nim = working_space[
xmin][
ymin][i + 1 + 2 * sizez_ext] / maxch;
2466 for(l = 1;l <= averWindow;l++){
2468 a = working_space[
xmin][
ymin][zmax + 2 * sizez_ext] / maxch;
2471 a = working_space[
xmin][
ymin][i + l + 2 * sizez_ext] / maxch;
2483 if(i - l + 1 < zmin)
2484 a = working_space[
xmin][
ymin][zmin + 2 * sizez_ext] / maxch;
2487 a = working_space[
xmin][
ymin][i - l + 1 + 2 * sizez_ext] / maxch;
2504 for(i = xmin;i <
xmax; i++){
2505 for(j = ymin;j <
ymax; j++){
2506 nip = working_space[i][j + 1][zmin + 2 * sizez_ext] / maxch;
2507 nim = working_space[i + 1][j + 1][zmin + 2 * sizez_ext] / maxch;
2509 for(l = 1;l <= averWindow; l++){
2511 a = working_space[
xmax][j][zmin + 2 * sizez_ext] / maxch;
2514 a = working_space[i +
l][j][zmin + 2 * sizez_ext] / maxch;
2526 if(i - l + 1 < xmin)
2527 a = working_space[
xmin][j][zmin + 2 * sizez_ext] / maxch;
2530 a = working_space[i - l + 1][j][zmin + 2 * sizez_ext] / maxch;
2544 nip = working_space[i + 1][j][zmin + 2 * sizez_ext] / maxch;
2545 nim = working_space[i + 1][j + 1][zmin + 2 * sizez_ext] / maxch;
2546 for(l = 1;l <= averWindow; l++){
2548 a = working_space[i][
ymax][zmin + 2 * sizez_ext] / maxch;
2551 a = working_space[i][j +
l][zmin + 2 * sizez_ext] / maxch;
2563 if(j - l + 1 < ymin)
2564 a = working_space[i][
ymin][zmin + 2 * sizez_ext] / maxch;
2567 a = working_space[i][j - l + 1][zmin + 2 * sizez_ext] / maxch;
2580 a = (spx * working_space[i][j + 1][zmin] + spy * working_space[i + 1][j][zmin]) / (smx + smy);
2581 working_space[i + 1][j + 1][zmin] =
a;
2585 for(i = xmin;i <
xmax;i++){
2586 for(j = zmin;j < zmax;j++){
2587 nip = working_space[i][
ymin][j + 1 + 2 * sizez_ext] / maxch;
2588 nim = working_space[i + 1][
ymin][j + 1 + 2 * sizez_ext] / maxch;
2590 for(l = 1;l <= averWindow; l++){
2592 a = working_space[
xmax][
ymin][j + 2 * sizez_ext] / maxch;
2595 a = working_space[i +
l][
ymin][j + 2 * sizez_ext] / maxch;
2607 if(i - l + 1 < xmin)
2608 a = working_space[
xmin][
ymin][j + 2 * sizez_ext] / maxch;
2611 a = working_space[i - l + 1][
ymin][j + 2 * sizez_ext] / maxch;
2625 nip = working_space[i + 1][
ymin][j + 2 * sizez_ext] / maxch;
2626 nim = working_space[i + 1][
ymin][j + 1 + 2 * sizez_ext] / maxch;
2627 for(l = 1;l <= averWindow; l++){
2629 a = working_space[i][
ymin][zmax + 2 * sizez_ext] / maxch;
2632 a = working_space[i][
ymin][j + l + 2 * sizez_ext] / maxch;
2644 if(j - l + 1 < zmin)
2645 a = working_space[i][
ymin][zmin + 2 * sizez_ext] / maxch;
2648 a = working_space[i][
ymin][j - l + 1 + 2 * sizez_ext] / maxch;
2661 a = (spx * working_space[i][
ymin][j + 1] + spz * working_space[i + 1][
ymin][j]) / (smx + smz);
2662 working_space[i + 1][
ymin][j + 1] =
a;
2666 for(i = ymin;i <
ymax;i++){
2667 for(j = zmin;j < zmax;j++){
2668 nip = working_space[
xmin][i][j + 1 + 2 * sizez_ext] / maxch;
2669 nim = working_space[
xmin][i + 1][j + 1 + 2 * sizez_ext] / maxch;
2671 for(l = 1;l <= averWindow; l++){
2673 a = working_space[
xmin][
ymax][j + 2 * sizez_ext] / maxch;
2676 a = working_space[
xmin][i +
l][j + 2 * sizez_ext] / maxch;
2688 if(i - l + 1 < ymin)
2689 a = working_space[
xmin][
ymin][j + 2 * sizez_ext] / maxch;
2692 a = working_space[
xmin][i - l + 1][j + 2 * sizez_ext] / maxch;
2706 nip = working_space[
xmin][i + 1][j + 2 * sizez_ext] / maxch;
2707 nim = working_space[
xmin][i + 1][j + 1 + 2 * sizez_ext] / maxch;
2708 for(l = 1;l <= averWindow; l++){
2710 a = working_space[
xmin][i][zmax + 2 * sizez_ext] / maxch;
2713 a = working_space[
xmin][i][j + l + 2 * sizez_ext] / maxch;
2725 if(j - l + 1 < zmin)
2726 a = working_space[
xmin][i][zmin + 2 * sizez_ext] / maxch;
2729 a = working_space[
xmin][i][j - l + 1 + 2 * sizez_ext] / maxch;
2742 a = (spy * working_space[
xmin][i][j + 1] + spz * working_space[
xmin][i + 1][j]) / (smy + smz);
2743 working_space[
xmin][i + 1][j + 1] =
a;
2747 for(i = xmin;i <
xmax; i++){
2748 for(j = ymin;j <
ymax; j++){
2749 for(k = zmin;k < zmax; k++){
2750 nip = working_space[i][j + 1][k + 1 + 2 * sizez_ext] / maxch;
2751 nim = working_space[i + 1][j + 1][k + 1 + 2 * sizez_ext] / maxch;
2753 for(l = 1;l <= averWindow; l++){
2755 a = working_space[
xmax][j][k + 2 * sizez_ext] / maxch;
2758 a = working_space[i +
l][j][k + 2 * sizez_ext] / maxch;
2770 if(i - l + 1 < xmin)
2771 a = working_space[
xmin][j][k + 2 * sizez_ext] / maxch;
2774 a = working_space[i - l + 1][j][k + 2 * sizez_ext] / maxch;
2788 nip = working_space[i + 1][j][k + 1 + 2 * sizez_ext] / maxch;
2789 nim = working_space[i + 1][j + 1][k + 1 + 2 * sizez_ext] / maxch;
2790 for(l = 1;l <= averWindow; l++){
2792 a = working_space[i][
ymax][k + 2 * sizez_ext] / maxch;
2795 a = working_space[i][j +
l][k + 2 * sizez_ext] / maxch;
2807 if(j - l + 1 < ymin)
2808 a = working_space[i][
ymin][k + 2 * sizez_ext] / maxch;
2811 a = working_space[i][j - l + 1][k + 2 * sizez_ext] / maxch;
2825 nip = working_space[i + 1][j + 1][k + 2 * sizez_ext] / maxch;
2826 nim = working_space[i + 1][j + 1][k + 1 + 2 * sizez_ext] / maxch;
2827 for(l = 1;l <= averWindow; l++ ){
2829 a = working_space[i][j][zmax + 2 * sizez_ext] / maxch;
2832 a = working_space[i][j][k + l + 2 * sizez_ext] / maxch;
2844 if(j - l + 1 < ymin)
2845 a = working_space[i][j][zmin + 2 * sizez_ext] / maxch;
2848 a = working_space[i][j][k - l + 1 + 2 * sizez_ext] / maxch;
2861 a = (spx * working_space[i][j + 1][k + 1] + spy * working_space[i + 1][j][k + 1] + spz * working_space[i + 1][j + 1][k]) / (smx + smy + smz);
2862 working_space[i + 1][j + 1][k + 1] =
a;
2868 for(i = xmin;i <=
xmax; i++){
2869 for(j = ymin;j <=
ymax; j++){
2870 for(k = zmin;k <= zmax; k++){
2871 working_space[i][j][k] = working_space[i][j][k] / nom;
2872 a+=working_space[i][j][k];
2876 for(i = 0;i < sizex_ext; i++){
2877 for(j = 0;j < sizey_ext; j++){
2878 for(k = 0;k < sizez_ext; k++){
2879 working_space[i][j][k + sizez_ext] = working_space[i][j][k] * plocha_markov /
a;
2886 lhx = -1,lhy = -1,lhz = -1;
2887 positx = 0,posity = 0,positz = 0;
2890 for(i = 0;i < sizex_ext; i++){
2891 for(j = 0;j < sizey_ext; j++){
2892 for(k = 0;k < sizez_ext; k++){
2896 lda = (lda * lda + ldb * ldb + ldc * ldc) / (2 * sigma * sigma);
2909 working_space[i][j][k] = lda;
2913 positx = i,posity = j,positz = k;
2919 for(i = 0;i < sizex_ext; i++){
2920 for(j = 0;j < sizey_ext; j++){
2921 for(k = 0;k < sizez_ext; k++){
2922 working_space[i][j][k + 2 * sizez_ext] =
TMath::Abs(working_space[i][j][k + sizez_ext]);
2927 for (i3 = 0; i3 < sizez_ext; i3++) {
2928 for (i2 = 0; i2 < sizey_ext; i2++) {
2929 for (i1 = 0; i1 < sizex_ext; i1++) {
2931 for (j3 = 0; j3 <= (lhz - 1); j3++) {
2932 for (j2 = 0; j2 <= (lhy - 1); j2++) {
2933 for (j1 = 0; j1 <= (lhx - 1); j1++) {
2934 k3 = i3 + j3, k2 = i2 + j2, k1 = i1 + j1;
2935 if (k3 >= 0 && k3 < sizez_ext && k2 >= 0 && k2 < sizey_ext && k1 >= 0 && k1 < sizex_ext) {
2936 lda = working_space[j1][j2][j3];
2937 ldb = working_space[k1][k2][k3+2*sizez_ext];
2938 ldc = ldc + lda * ldb;
2943 working_space[i1][i2][i3 + sizez_ext] = ldc;
2948 i1min = -(lhx - 1), i1max = lhx - 1;
2949 i2min = -(lhy - 1), i2max = lhy - 1;
2950 i3min = -(lhz - 1), i3max = lhz - 1;
2951 for (i3 = i3min; i3 <= i3max; i3++) {
2952 for (i2 = i2min; i2 <= i2max; i2++) {
2953 for (i1 = i1min; i1 <= i1max; i1++) {
2959 j3max = lhz - 1 - i3;
2960 if (j3max > lhz - 1)
2963 for (j3 = j3min; j3 <= j3max; j3++) {
2968 j2max = lhy - 1 - i2;
2969 if (j2max > lhy - 1)
2972 for (j2 = j2min; j2 <= j2max; j2++) {
2977 j1max = lhx - 1 - i1;
2978 if (j1max > lhx - 1)
2981 for (j1 = j1min; j1 <= j1max; j1++) {
2982 lda = working_space[j1][j2][j3];
2983 if (i1 + j1 < sizex_ext && i2 + j2 < sizey_ext)
2984 ldb = working_space[i1 + j1][i2 + j2][i3 + j3];
2989 ldc = ldc + lda * ldb;
2993 working_space[i1 - i1min][i2 - i2min][i3 - i3min + 2 * sizez_ext ] = ldc;
2998 for (i3 = 0; i3 < sizez_ext; i3++) {
2999 for (i2 = 0; i2 < sizey_ext; i2++) {
3000 for (i1 = 0; i1 < sizex_ext; i1++) {
3001 working_space[i1][i2][i3 + 3 * sizez_ext] = 1;
3002 working_space[i1][i2][i3 + 4 * sizez_ext] = 0;
3008 for (lindex=0;lindex<deconIterations;lindex++){
3009 for (i3 = 0; i3 < sizez_ext; i3++) {
3010 for (i2 = 0; i2 < sizey_ext; i2++) {
3011 for (i1 = 0; i1 < sizex_ext; i1++) {
3012 if (
TMath::Abs(working_space[i1][i2][i3 + 3 * sizez_ext])>1
e-6 &&
TMath::Abs(working_space[i1][i2][i3 + 1 * sizez_ext])>1
e-6){
3015 if (j3min > lhz - 1)
3019 j3max = sizez_ext - i3 - 1;
3020 if (j3max > lhz - 1)
3024 if (j2min > lhy - 1)
3028 j2max = sizey_ext - i2 - 1;
3029 if (j2max > lhy - 1)
3033 if (j1min > lhx - 1)
3037 j1max = sizex_ext - i1 - 1;
3038 if (j1max > lhx - 1)
3041 for (j3 = j3min; j3 <= j3max; j3++) {
3042 for (j2 = j2min; j2 <= j2max; j2++) {
3043 for (j1 = j1min; j1 <= j1max; j1++) {
3044 ldc = working_space[j1 - i1min][j2 - i2min][j3 - i3min + 2 * sizez_ext];
3045 lda = working_space[i1 + j1][i2 + j2][i3 + j3 + 3 * sizez_ext];
3046 ldb = ldb + lda * ldc;
3050 lda = working_space[i1][i2][i3 + 3 * sizez_ext];
3051 ldc = working_space[i1][i2][i3 + 1 * sizez_ext];
3052 if (ldc * lda != 0 && ldb != 0) {
3053 lda = lda * ldc / ldb;
3058 working_space[i1][i2][i3 + 4 * sizez_ext] = lda;
3063 for (i3 = 0; i3 < sizez_ext; i3++) {
3064 for (i2 = 0; i2 < sizey_ext; i2++) {
3065 for (i1 = 0; i1 < sizex_ext; i1++)
3066 working_space[i1][i2][i3 + 3 * sizez_ext] = working_space[i1][i2][i3 + 4 * sizez_ext];
3072 for(i = 0;i < sizex_ext; i++){
3073 for(j = 0;j < sizey_ext; j++){
3074 for(k = 0;k < sizez_ext; k++){
3075 working_space[(i + positx) % sizex_ext][(j + posity) % sizey_ext][(k + positz) % sizez_ext] = area * working_space[i][j][k + 3 * sizez_ext];
3076 if(maximum < working_space[(i + positx) % sizex_ext][(j + posity) % sizey_ext][(k + positz) % sizez_ext])
3077 maximum = working_space[(i + positx) % sizex_ext][(j + posity) % sizey_ext][(k + positz) % sizez_ext];
3082 for(i = 1;i < sizex_ext - 1; i++){
3083 for(j = 1;j < sizey_ext - 1; j++){
3084 for(l = 1;l < sizez_ext - 1; l++){
3085 a = working_space[i][j][
l];
3086 if(a > working_space[i][j][l - 1] && a > working_space[i - 1][j][l - 1] && a > working_space[i - 1][j - 1][l - 1] && a > working_space[i][j - 1][l - 1] && a > working_space[i + 1][j - 1][l - 1] && a > working_space[i + 1][j][l - 1] && a > working_space[i + 1][j + 1][l - 1] && a > working_space[i][j + 1][l - 1] && a > working_space[i - 1][j + 1][l - 1] && a > working_space[i - 1][j][l] && a > working_space[i - 1][j - 1][l] && a > working_space[i][j - 1][l] && a > working_space[i + 1][j - 1][l] && a > working_space[i + 1][j][l] && a > working_space[i + 1][j + 1][l] && a > working_space[i][j + 1][l] && a > working_space[i - 1][j + 1][l] && a > working_space[i][j][l + 1] && a > working_space[i - 1][j][l + 1] && a > working_space[i - 1][j - 1][l + 1] && a > working_space[i][j - 1][l + 1] && a > working_space[i + 1][j - 1][l + 1] && a > working_space[i + 1][j][l + 1] && a > working_space[i + 1][j + 1][l + 1] && a > working_space[i][j + 1][l + 1] && a > working_space[i - 1][j + 1][l + 1]){
3087 if(i >= shift && i < ssizex + shift && j >= shift && j < ssizey + shift && l >= shift && l < ssizez + shift){
3088 if(working_space[i][j][l] > threshold * maximum / 100.0){
3090 for(k = i - 1,a = 0,b = 0;k <= i + 1; k++){
3091 a += (
Double_t)(k - shift) * working_space[k][j][
l];
3092 b += working_space[k][j][
l];
3095 for(k = j - 1,a = 0,b = 0;k <= j + 1; k++){
3096 a += (
Double_t)(k - shift) * working_space[i][k][
l];
3097 b += working_space[i][k][
l];
3100 for(k = l - 1,a = 0,b = 0;k <= l + 1; k++){
3101 a += (
Double_t)(k - shift) * working_space[i][j][k];
3102 b += working_space[i][j][k];
3113 for(i = 0;i < ssizex; i++){
3114 for(j = 0;j < ssizey; j++){
3115 for(k = 0;k < ssizez; k++){
3116 dest[i][j][k] = working_space[i + shift][j + shift][k + shift];
3120 k = (
Int_t)(4 * sigma + 0.5);
3122 for(i = 0;i < ssizex + k; i++){
3123 for(j = 0;j < ssizey + k; j++)
3124 delete[] working_space[i][j];
3125 delete[] working_space[i];
3127 delete[] working_space;
3157 Int_t i,j,k,
l,li,lj,lk,lmin,lmax,
xmin,
xmax,
ymin,
ymax,zmin,zmax;
3158 Double_t maxch,plocha = 0,plocha_markov = 0;
3159 Double_t nom,nip,nim,sp,sm,spx,spy,smx,smy,spz,smz;
3160 Double_t norma,val,val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11,val12,val13,val14,val15,val16,val17,val18,val19,val20,val21,val22,val23,val24,val25,val26;
3163 Double_t p1,
p2,
p3,p4,p5,p6,p7,p8,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,
r1,
r2,
r3,r4,r5,r6;
3165 Int_t number_of_iterations=(
Int_t)(4 * sigma + 0.5);
3166 Int_t sizex_ext=ssizex + 4 * number_of_iterations,sizey_ext = ssizey + 4 * number_of_iterations,sizez_ext = ssizez + 4 * number_of_iterations,shift = 2 * number_of_iterations;
3169 Error(
"SearchFast",
"Invalid sigma, must be greater than or equal to 1");
3173 if(threshold<=0||threshold>=100){
3174 Error(
"SearchFast",
"Invalid threshold, must be positive and less than 100");
3178 j = (
Int_t)(pocet_sigma*sigma+0.5);
3180 Error(
"SearchFast",
"Too large sigma");
3184 if (markov ==
true) {
3185 if (averWindow <= 0) {
3186 Error(
"SearchFast",
"Averaging window must be positive");
3191 if(sizex_ext < 2 * number_of_iterations + 1 || sizey_ext < 2 * number_of_iterations + 1 || sizez_ext < 2 * number_of_iterations + 1){
3192 Error(
"SearchFast",
"Too large clipping window");
3196 i = (
Int_t)(4 * sigma + 0.5);
3199 for(j = 0;j < ssizex + i; j++){
3200 working_space[j] =
new Double_t* [ssizey + i];
3201 for(k = 0;k < ssizey + i; k++)
3202 working_space[j][k] =
new Double_t [4 * (ssizez + i)];
3205 for(k = 0;k < sizez_ext; k++){
3206 for(j = 0;j < sizey_ext; j++){
3207 for(i = 0;i < sizex_ext; i++){
3211 working_space[i][j][k + sizez_ext] = source[0][0][0];
3213 else if(k >= ssizez + shift)
3214 working_space[i][j][k + sizez_ext] = source[0][0][ssizez - 1];
3217 working_space[i][j][k + sizez_ext] = source[0][0][k - shift];
3220 else if(j >= ssizey + shift){
3222 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][0];
3224 else if(k >= ssizez + shift)
3225 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][ssizez - 1];
3228 working_space[i][j][k + sizez_ext] = source[0][ssizey - 1][k - shift];
3233 working_space[i][j][k + sizez_ext] = source[0][j - shift][0];
3235 else if(k >= ssizez + shift)
3236 working_space[i][j][k + sizez_ext] = source[0][j - shift][ssizez - 1];
3239 working_space[i][j][k + sizez_ext] = source[0][j - shift][k - shift];
3243 else if(i >= ssizex + shift){
3246 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][0];
3248 else if(k >= ssizez + shift)
3249 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][ssizez - 1];
3252 working_space[i][j][k + sizez_ext] = source[ssizex - 1][0][k - shift];
3255 else if(j >= ssizey + shift){
3257 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][0];
3259 else if(k >= ssizez + shift)
3260 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][ssizez - 1];
3263 working_space[i][j][k + sizez_ext] = source[ssizex - 1][ssizey - 1][k - shift];
3268 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][0];
3270 else if(k >= ssizez + shift)
3271 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][ssizez - 1];
3274 working_space[i][j][k + sizez_ext] = source[ssizex - 1][j - shift][k - shift];
3281 working_space[i][j][k + sizez_ext] = source[i - shift][0][0];
3283 else if(k >= ssizez + shift)
3284 working_space[i][j][k + sizez_ext] = source[i - shift][0][ssizez - 1];
3287 working_space[i][j][k + sizez_ext] = source[i - shift][0][k - shift];
3290 else if(j >= ssizey + shift){
3292 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][0];
3294 else if(k >= ssizez + shift)
3295 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][ssizez - 1];
3298 working_space[i][j][k + sizez_ext] = source[i - shift][ssizey - 1][k - shift];
3303 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][0];
3305 else if(k >= ssizez + shift)
3306 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][ssizez - 1];
3309 working_space[i][j][k + sizez_ext] = source[i - shift][j - shift][k - shift];
3315 for(i = 1;i <= number_of_iterations; i++){
3316 for(z = i;z < sizez_ext - i; z++){
3317 for(y = i;y < sizey_ext - i; y++){
3318 for(x = i;x < sizex_ext - i; x++){
3319 a = working_space[
x][
y][z + sizez_ext];
3320 p1 = working_space[x + i][y + i][z - i + sizez_ext];
3321 p2 = working_space[x - i][y + i][z - i + sizez_ext];
3322 p3 = working_space[x + i][y - i][z - i + sizez_ext];
3323 p4 = working_space[x - i][y - i][z - i + sizez_ext];
3324 p5 = working_space[x + i][y + i][z + i + sizez_ext];
3325 p6 = working_space[x - i][y + i][z + i + sizez_ext];
3326 p7 = working_space[x + i][y - i][z + i + sizez_ext];
3327 p8 = working_space[x - i][y - i][z + i + sizez_ext];
3328 s1 = working_space[x + i][
y ][z - i + sizez_ext];
3329 s2 = working_space[
x ][y + i][z - i + sizez_ext];
3330 s3 = working_space[x - i][
y ][z - i + sizez_ext];
3331 s4 = working_space[
x ][y - i][z - i + sizez_ext];
3332 s5 = working_space[x + i][
y ][z + i + sizez_ext];
3333 s6 = working_space[
x ][y + i][z + i + sizez_ext];
3334 s7 = working_space[x - i][
y ][z + i + sizez_ext];
3335 s8 = working_space[
x ][y - i][z + i + sizez_ext];
3336 s9 = working_space[x - i][y + i][z + sizez_ext];
3337 s10 = working_space[x - i][y - i][z +sizez_ext];
3338 s11 = working_space[x + i][y + i][z +sizez_ext];
3339 s12 = working_space[x + i][y - i][z +sizez_ext];
3340 r1 = working_space[
x ][
y ][z - i + sizez_ext];
3341 r2 = working_space[
x ][
y ][z + i + sizez_ext];
3342 r3 = working_space[x - i][
y ][z + sizez_ext];
3343 r4 = working_space[x + i][
y ][z + sizez_ext];
3344 r5 = working_space[
x ][y + i][z + sizez_ext];
3345 r6 = working_space[
x ][y - i][z + sizez_ext];
3346 b = (p1 +
p3) / 2.0;
3350 b = (p1 +
p2) / 2.0;
3354 b = (p2 + p4) / 2.0;
3358 b = (p3 + p4) / 2.0;
3362 b = (p5 + p7) / 2.0;
3366 b = (p5 + p6) / 2.0;
3370 b = (p6 + p8) / 2.0;
3374 b = (p7 + p8) / 2.0;
3378 b = (p2 + p6) / 2.0;
3382 b = (p4 + p8) / 2.0;
3386 b = (p1 + p5) / 2.0;
3390 b = (p3 + p7) / 2.0;
3394 s1 = s1 - (p1 +
p3) / 2.0;
3395 s2 = s2 - (p1 +
p2) / 2.0;
3396 s3 = s3 - (p2 + p4) / 2.0;
3397 s4 = s4 - (p3 + p4) / 2.0;
3398 s5 = s5 - (p5 + p7) / 2.0;
3399 s6 = s6 - (p5 + p6) / 2.0;
3400 s7 = s7 - (p6 + p8) / 2.0;
3401 s8 = s8 - (p7 + p8) / 2.0;
3402 s9 = s9 - (p2 + p6) / 2.0;
3403 s10 = s10 - (p4 + p8) / 2.0;
3404 s11 = s11 - (p1 + p5) / 2.0;
3405 s12 = s12 - (p3 + p7) / 2.0;
3406 b = (s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0;
3410 b = (s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0;
3414 b = (s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0;
3418 b = (s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0;
3422 b = (s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0;
3426 b = (s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0;
3430 r1 = r1 - ((s1 + s3) / 2.0 + (s2 + s4) / 2.0 + (p1 + p2 + p3 + p4) / 4.0);
3431 r2 = r2 - ((s5 + s7) / 2.0 + (s6 + s8) / 2.0 + (p5 + p6 + p7 + p8) / 4.0);
3432 r3 = r3 - ((s3 + s7) / 2.0 + (s9 + s10) / 2.0 + (p2 + p4 + p6 + p8) / 4.0);
3433 r4 = r4 - ((s1 + s5) / 2.0 + (s11 + s12) / 2.0 + (p1 + p3 + p5 + p7) / 4.0);
3434 r5 = r5 - ((s9 + s11) / 2.0 + (s2 + s6) / 2.0 + (p1 + p2 + p5 + p6) / 4.0);
3435 r6 = r6 - ((s4 + s8) / 2.0 + (s10 + s12) / 2.0 + (p3 + p4 + p7 + p8) / 4.0);
3436 b = (r1 +
r2) / 2.0 + (r3 + r4) / 2.0 + (r5 + r6) / 2.0 + (s1 + s3 + s5 + s7) / 4.0 + (s2 + s4 + s6 + s8) / 4.0 + (s9 + s10 + s11 + s12) / 4.0 + (p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8) / 8.0;
3440 working_space[
x][
y][
z] =
a;
3444 for(z = i;z < sizez_ext - i; z++){
3445 for(y = i;y < sizey_ext - i; y++){
3446 for(x = i;x < sizex_ext - i; x++){
3447 working_space[
x][
y][z + sizez_ext] = working_space[
x][
y][
z];
3452 for(k = 0;k < sizez_ext; k++){
3453 for(j = 0;j < sizey_ext; j++){
3454 for(i = 0;i < sizex_ext; i++){
3458 working_space[i][j][k + 3 * sizez_ext] = source[0][0][0] - working_space[i][j][k + sizez_ext];
3460 else if(k >= ssizez + shift)
3461 working_space[i][j][k + 3 * sizez_ext] = source[0][0][ssizez - 1] - working_space[i][j][k + sizez_ext];
3464 working_space[i][j][k + 3 * sizez_ext] = source[0][0][k - shift] - working_space[i][j][k + sizez_ext];
3467 else if(j >= ssizey + shift){
3469 working_space[i][j][k + 3 * sizez_ext] = source[0][ssizey - 1][0] - working_space[i][j][k + sizez_ext];
3471 else if(k >= ssizez + shift)
3472 working_space[i][j][k + 3 * sizez_ext] = source[0][ssizey - 1][ssizez - 1] - working_space[i][j][k + sizez_ext];
3475 working_space[i][j][k + 3 * sizez_ext] = source[0][ssizey - 1][k - shift] - working_space[i][j][k + sizez_ext];
3480 working_space[i][j][k + 3 * sizez_ext] = source[0][j - shift][0] - working_space[i][j][k + sizez_ext];
3482 else if(k >= ssizez + shift)
3483 working_space[i][j][k + 3 * sizez_ext] = source[0][j - shift][ssizez - 1] - working_space[i][j][k + sizez_ext];
3486 working_space[i][j][k + 3 * sizez_ext] = source[0][j - shift][k - shift] - working_space[i][j][k + sizez_ext];
3490 else if(i >= ssizex + shift){
3493 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][0][0] - working_space[i][j][k + sizez_ext];
3495 else if(k >= ssizez + shift)
3496 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][0][ssizez - 1] - working_space[i][j][k + sizez_ext];
3499 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][0][k - shift] - working_space[i][j][k + sizez_ext];
3502 else if(j >= ssizey + shift){
3504 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][ssizey - 1][0] - working_space[i][j][k + sizez_ext];
3506 else if(k >= ssizez + shift)
3507 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][ssizey - 1][ssizez - 1] - working_space[i][j][k + sizez_ext];
3510 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][ssizey - 1][k - shift] - working_space[i][j][k + sizez_ext];
3515 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][j - shift][0] - working_space[i][j][k + sizez_ext];
3517 else if(k >= ssizez + shift)
3518 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][j - shift][ssizez - 1] - working_space[i][j][k + sizez_ext];
3521 working_space[i][j][k + 3 * sizez_ext] = source[ssizex - 1][j - shift][k - shift] - working_space[i][j][k + sizez_ext];
3528 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][0][0] - working_space[i][j][k + sizez_ext];
3530 else if(k >= ssizez + shift)
3531 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][0][ssizez - 1] - working_space[i][j][k + sizez_ext];
3534 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][0][k - shift] - working_space[i][j][k + sizez_ext];
3537 else if(j >= ssizey + shift){
3539 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][ssizey - 1][0] - working_space[i][j][k + sizez_ext];
3541 else if(k >= ssizez + shift)
3542 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][ssizey - 1][ssizez - 1] - working_space[i][j][k + sizez_ext];
3545 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][ssizey - 1][k - shift] - working_space[i][j][k + sizez_ext];
3550 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][j - shift][0] - working_space[i][j][k + sizez_ext];
3552 else if(k >= ssizez + shift)
3553 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][j - shift][ssizez - 1] - working_space[i][j][k + sizez_ext];
3556 working_space[i][j][k + 3 * sizez_ext] = source[i - shift][j - shift][k - shift] - working_space[i][j][k + sizez_ext];
3563 for(i = 0;i < sizex_ext; i++){
3564 for(j = 0;j < sizey_ext; j++){
3565 for(k = 0;k < sizez_ext; k++){
3566 if(i >= shift && i < ssizex + shift && j >= shift && j < ssizey + shift && k >= shift && k < ssizez + shift){
3567 working_space[i][j][k + 2 * sizez_ext] = source[i - shift][j - shift][k - shift];
3568 plocha_markov = plocha_markov + source[i - shift][j - shift][k - shift];
3571 working_space[i][j][k + 2 * sizez_ext] = 0;
3578 xmax = sizex_ext - 1;
3580 ymax = sizey_ext - 1;
3582 zmax = sizez_ext - 1;
3583 for(i = 0,maxch = 0;i < sizex_ext; i++){
3584 for(j = 0;j < sizey_ext;j++){
3585 for(k = 0;k < sizez_ext;k++){
3586 working_space[i][j][k] = 0;
3587 if(maxch < working_space[i][j][k + 2 * sizez_ext])
3588 maxch = working_space[i][j][k + 2 * sizez_ext];
3590 plocha += working_space[i][j][k + 2 * sizez_ext];
3595 delete [] working_space;
3600 working_space[
xmin][
ymin][zmin] = 1;
3601 for(i = xmin;i <
xmax; i++){
3602 nip = working_space[i][
ymin][zmin + 2 * sizez_ext] / maxch;
3603 nim = working_space[i + 1][
ymin][zmin + 2 * sizez_ext] / maxch;
3605 for(l = 1;l <= averWindow; l++){
3607 a = working_space[xmax][ymin][zmin + 2 * sizez_ext] / maxch;
3610 a = working_space[i +
l][
ymin][zmin + 2 * sizez_ext] / maxch;
3622 if(i - l + 1 < xmin)
3623 a = working_space[
xmin][
ymin][zmin + 2 * sizez_ext] / maxch;
3626 a = working_space[i - l + 1][
ymin][zmin + 2 * sizez_ext] / maxch;
3640 a = working_space[i + 1][
ymin][zmin] = a * working_space[i][
ymin][zmin];
3643 for(i = ymin;i <
ymax; i++){
3644 nip = working_space[
xmin][i][zmin + 2 * sizez_ext] / maxch;
3645 nim = working_space[
xmin][i + 1][zmin + 2 * sizez_ext] / maxch;
3647 for(l = 1;l <= averWindow; l++){
3649 a = working_space[
xmin][
ymax][zmin + 2 * sizez_ext] / maxch;
3652 a = working_space[
xmin][i +
l][zmin + 2 * sizez_ext] / maxch;
3664 if(i - l + 1 < ymin)
3665 a = working_space[
xmin][
ymin][zmin + 2 * sizez_ext] / maxch;
3668 a = working_space[
xmin][i - l + 1][zmin + 2 * sizez_ext] / maxch;
3682 a = working_space[
xmin][i + 1][zmin] = a * working_space[
xmin][i][zmin];
3685 for(i = zmin;i < zmax;i++){
3686 nip = working_space[
xmin][
ymin][i + 2 * sizez_ext] / maxch;
3687 nim = working_space[
xmin][
ymin][i + 1 + 2 * sizez_ext] / maxch;
3689 for(l = 1;l <= averWindow;l++){
3691 a = working_space[
xmin][
ymin][zmax + 2 * sizez_ext] / maxch;
3694 a = working_space[
xmin][
ymin][i + l + 2 * sizez_ext] / maxch;
3706 if(i - l + 1 < zmin)
3707 a = working_space[
xmin][
ymin][zmin + 2 * sizez_ext] / maxch;
3710 a = working_space[
xmin][
ymin][i - l + 1 + 2 * sizez_ext] / maxch;
3727 for(i = xmin;i <
xmax; i++){
3728 for(j = ymin;j <
ymax; j++){
3729 nip = working_space[i][j + 1][zmin + 2 * sizez_ext] / maxch;
3730 nim = working_space[i + 1][j + 1][zmin + 2 * sizez_ext] / maxch;
3732 for(l = 1;l <= averWindow; l++){
3734 a = working_space[
xmax][j][zmin + 2 * sizez_ext] / maxch;
3737 a = working_space[i +
l][j][zmin + 2 * sizez_ext] / maxch;
3749 if(i - l + 1 < xmin)
3750 a = working_space[
xmin][j][zmin + 2 * sizez_ext] / maxch;
3753 a = working_space[i - l + 1][j][zmin + 2 * sizez_ext] / maxch;
3767 nip = working_space[i + 1][j][zmin + 2 * sizez_ext] / maxch;
3768 nim = working_space[i + 1][j + 1][zmin + 2 * sizez_ext] / maxch;
3769 for(l = 1;l <= averWindow; l++){
3771 a = working_space[i][
ymax][zmin + 2 * sizez_ext] / maxch;
3774 a = working_space[i][j +
l][zmin + 2 * sizez_ext] / maxch;
3786 if(j - l + 1 < ymin)
3787 a = working_space[i][
ymin][zmin + 2 * sizez_ext] / maxch;
3790 a = working_space[i][j - l + 1][zmin + 2 * sizez_ext] / maxch;
3803 a = (spx * working_space[i][j + 1][zmin] + spy * working_space[i + 1][j][zmin]) / (smx + smy);
3804 working_space[i + 1][j + 1][zmin] =
a;
3808 for(i = xmin;i <
xmax;i++){
3809 for(j = zmin;j < zmax;j++){
3810 nip = working_space[i][
ymin][j + 1 + 2 * sizez_ext] / maxch;
3811 nim = working_space[i + 1][
ymin][j + 1 + 2 * sizez_ext] / maxch;
3813 for(l = 1;l <= averWindow; l++){
3815 a = working_space[
xmax][
ymin][j + 2 * sizez_ext] / maxch;
3818 a = working_space[i +
l][
ymin][j + 2 * sizez_ext] / maxch;
3830 if(i - l + 1 < xmin)
3831 a = working_space[
xmin][
ymin][j + 2 * sizez_ext] / maxch;
3834 a = working_space[i - l + 1][
ymin][j + 2 * sizez_ext] / maxch;
3848 nip = working_space[i + 1][
ymin][j + 2 * sizez_ext] / maxch;
3849 nim = working_space[i + 1][
ymin][j + 1 + 2 * sizez_ext] / maxch;
3850 for(l = 1;l <= averWindow; l++){
3852 a = working_space[i][
ymin][zmax + 2 * sizez_ext] / maxch;
3855 a = working_space[i][
ymin][j + l + 2 * sizez_ext] / maxch;
3867 if(j - l + 1 < zmin)
3868 a = working_space[i][
ymin][zmin + 2 * sizez_ext] / maxch;
3871 a = working_space[i][
ymin][j - l + 1 + 2 * sizez_ext] / maxch;
3884 a = (spx * working_space[i][
ymin][j + 1] + spz * working_space[i + 1][
ymin][j]) / (smx + smz);
3885 working_space[i + 1][
ymin][j + 1] =
a;
3889 for(i = ymin;i <
ymax;i++){
3890 for(j = zmin;j < zmax;j++){
3891 nip = working_space[
xmin][i][j + 1 + 2 * sizez_ext] / maxch;
3892 nim = working_space[
xmin][i + 1][j + 1 + 2 * sizez_ext] / maxch;
3894 for(l = 1;l <= averWindow; l++){
3896 a = working_space[
xmin][
ymax][j + 2 * sizez_ext] / maxch;
3899 a = working_space[
xmin][i +
l][j + 2 * sizez_ext] / maxch;
3911 if(i - l + 1 < ymin)
3912 a = working_space[
xmin][
ymin][j + 2 * sizez_ext] / maxch;
3915 a = working_space[
xmin][i - l + 1][j + 2 * sizez_ext] / maxch;
3929 nip = working_space[
xmin][i + 1][j + 2 * sizez_ext] / maxch;
3930 nim = working_space[
xmin][i + 1][j + 1 + 2 * sizez_ext] / maxch;
3931 for(l = 1;l <= averWindow; l++){
3933 a = working_space[
xmin][i][zmax + 2 * sizez_ext] / maxch;
3936 a = working_space[
xmin][i][j + l + 2 * sizez_ext] / maxch;
3948 if(j - l + 1 < zmin)
3949 a = working_space[
xmin][i][zmin + 2 * sizez_ext] / maxch;
3952 a = working_space[
xmin][i][j - l + 1 + 2 * sizez_ext] / maxch;
3965 a = (spy * working_space[
xmin][i][j + 1] + spz * working_space[
xmin][i + 1][j]) / (smy + smz);
3966 working_space[
xmin][i + 1][j + 1] =
a;
3970 for(i = xmin;i <
xmax; i++){
3971 for(j = ymin;j <
ymax; j++){
3972 for(k = zmin;k < zmax; k++){
3973 nip = working_space[i][j + 1][k + 1 + 2 * sizez_ext] / maxch;
3974 nim = working_space[i + 1][j + 1][k + 1 + 2 * sizez_ext] / maxch;
3976 for(l = 1;l <= averWindow; l++){
3978 a = working_space[
xmax][j][k + 2 * sizez_ext] / maxch;
3981 a = working_space[i +
l][j][k + 2 * sizez_ext] / maxch;
3993 if(i - l + 1 < xmin)
3994 a = working_space[
xmin][j][k + 2 * sizez_ext] / maxch;
3997 a = working_space[i - l + 1][j][k + 2 * sizez_ext] / maxch;
4011 nip = working_space[i + 1][j][k + 1 + 2 * sizez_ext] / maxch;
4012 nim = working_space[i + 1][j + 1][k + 1 + 2 * sizez_ext] / maxch;
4013 for(l = 1;l <= averWindow; l++){
4015 a = working_space[i][
ymax][k + 2 * sizez_ext] / maxch;
4018 a = working_space[i][j +
l][k + 2 * sizez_ext] / maxch;
4030 if(j - l + 1 < ymin)
4031 a = working_space[i][
ymin][k + 2 * sizez_ext] / maxch;
4034 a = working_space[i][j - l + 1][k + 2 * sizez_ext] / maxch;
4048 nip = working_space[i + 1][j + 1][k + 2 * sizez_ext] / maxch;
4049 nim = working_space[i + 1][j + 1][k + 1 + 2 * sizez_ext] / maxch;
4050 for(l = 1;l <= averWindow; l++ ){
4052 a = working_space[i][j][zmax + 2 * sizez_ext] / maxch;
4055 a = working_space[i][j][k + l + 2 * sizez_ext] / maxch;
4067 if(j - l + 1 < ymin)
4068 a = working_space[i][j][zmin + 2 * sizez_ext] / maxch;
4071 a = working_space[i][j][k - l + 1 + 2 * sizez_ext] / maxch;
4084 a = (spx * working_space[i][j + 1][k + 1] + spy * working_space[i + 1][j][k + 1] + spz * working_space[i + 1][j + 1][k]) / (smx + smy + smz);
4085 working_space[i + 1][j + 1][k + 1] =
a;
4091 for(i = xmin;i <=
xmax; i++){
4092 for(j = ymin;j <=
ymax; j++){
4093 for(k = zmin;k <= zmax; k++){
4094 working_space[i][j][k] = working_space[i][j][k] / nom;
4095 a+=working_space[i][j][k];
4099 for(i = 0;i < sizex_ext; i++){
4100 for(j = 0;j < sizey_ext; j++){
4101 for(k = 0;k < sizez_ext; k++){
4102 working_space[i][j][k + 2 * sizez_ext] = working_space[i][j][k] * plocha_markov /
a;
4109 for(k = 0;k < ssizez; k++){
4110 for(j = 0;j < ssizey; j++){
4111 for(i = 0;i < ssizex; i++){
4112 working_space[i][j][k] = 0;
4113 working_space[i][j][sizez_ext + k] = 0;
4114 if(working_space[i][j][k + 3 * sizez_ext] > maximum)
4115 maximum=working_space[i][j][k+3*sizez_ext];
4122 j = (
Int_t)(pocet_sigma * sigma + 0.5);
4123 for(i = -j;i <= j; i++){
4126 b = 2.0 * sigma *
sigma;
4131 s = s - sigma *
sigma;
4132 s = s / (sigma * sigma * sigma *
sigma);
4134 c[PEAK_WINDOW / 2 + i] = s;
4141 c[i] = c[i] / norma;
4143 a = pocet_sigma * sigma + 0.5;
4146 zmax = sizez_ext - i - 1;
4148 ymax = sizey_ext - i - 1;
4150 xmax = sizex_ext - i - 1;
4151 lmin = PEAK_WINDOW / 2 - i;
4152 lmax = PEAK_WINDOW / 2 + i;
4153 for(i = xmin;i <=
xmax; i++){
4154 for(j = ymin;j <=
ymax; j++){
4155 for(k = zmin;k <= zmax; k++){
4157 for(li = lmin;li <= lmax; li++){
4158 for(lj = lmin;lj <= lmax; lj++){
4159 for(lk = lmin;lk <= lmax; lk++){
4160 a = working_space[i + li - PEAK_WINDOW / 2][j + lj - PEAK_WINDOW / 2][k + lk - PEAK_WINDOW / 2 + 2 * sizez_ext];
4161 b = c[li] * c[lj] * c[lk];
4167 working_space[i][j][k] = s;
4168 working_space[i][j][k + sizez_ext] =
TMath::Sqrt(f);
4172 for(x = xmin;x <=
xmax; x++){
4173 for(y = ymin + 1;y <
ymax; y++){
4174 for(z = zmin + 1;z < zmax; z++){
4175 val = working_space[
x][
y][
z];
4176 val1 = working_space[x - 1][y - 1][z - 1];
4177 val2 = working_space[
x ][y - 1][z - 1];
4178 val3 = working_space[x + 1][y - 1][z - 1];
4179 val4 = working_space[x - 1][
y ][z - 1];
4180 val5 = working_space[
x ][
y ][z - 1];
4181 val6 = working_space[x + 1][
y ][z - 1];
4182 val7 = working_space[x - 1][y + 1][z - 1];
4183 val8 = working_space[
x ][y + 1][z - 1];
4184 val9 = working_space[x + 1][y + 1][z - 1];
4185 val10 = working_space[x - 1][y - 1][
z ];
4186 val11 = working_space[
x ][y - 1][
z ];
4187 val12 = working_space[x + 1][y - 1][
z ];
4188 val13 = working_space[x - 1][
y ][
z ];
4189 val14 = working_space[x + 1][
y ][
z ];
4190 val15 = working_space[x - 1][y + 1][
z ];
4191 val16 = working_space[
x ][y + 1][
z ];
4192 val17 = working_space[x + 1][y + 1][
z ];
4193 val18 = working_space[x - 1][y - 1][z + 1];
4194 val19 = working_space[
x ][y - 1][z + 1];
4195 val20 = working_space[x + 1][y - 1][z + 1];
4196 val21 = working_space[x - 1][
y ][z + 1];
4197 val22 = working_space[
x ][
y ][z + 1];
4198 val23 = working_space[x + 1][
y ][z + 1];
4199 val24 = working_space[x - 1][y + 1][z + 1];
4200 val25 = working_space[
x ][y + 1][z + 1];
4201 val26 = working_space[x + 1][y + 1][z + 1];
4202 f = -s_f_ratio_peaks * working_space[
x][
y][z + sizez_ext];
4203 if(val < f && val < val1 && val < val2 && val < val3 && val < val4 && val < val5 && val < val6 && val < val7 && val < val8 && val < val9 && val < val10 && val < val11 && val < val12 && val < val13 && val < val14 && val < val15 && val < val16 && val < val17 && val < val18 && val < val19 && val < val20 && val < val21 && val < val22 && val < val23 && val < val24 && val < val25 && val < val26){
4205 for(li = lmin;li <= lmax; li++){
4206 a = working_space[x + li - PEAK_WINDOW / 2][
y][z + 2 * sizez_ext];
4208 f += a * c[li] * c[li];
4210 f = -s_f_ratio_peaks *
sqrt(f);
4213 for(li = lmin;li <= lmax; li++){
4214 a = working_space[
x][y + li - PEAK_WINDOW / 2][z + 2 * sizez_ext];
4216 f += a * c[li] * c[li];
4218 f = -s_f_ratio_peaks *
sqrt(f);
4221 for(li = lmin;li <= lmax; li++){
4222 a = working_space[
x][
y][z + li - PEAK_WINDOW / 2 + 2 * sizez_ext];
4224 f += a * c[li] * c[li];
4226 f = -s_f_ratio_peaks *
sqrt(f);
4229 for(li = lmin;li <= lmax; li++){
4230 for(lj = lmin;lj <= lmax; lj++){
4231 a = working_space[x + li - PEAK_WINDOW / 2][y + lj - PEAK_WINDOW / 2][z + 2 * sizez_ext];
4232 s += a * c[li] * c[lj];
4233 f += a * c[li] * c[li] * c[lj] * c[lj];
4236 f = s_f_ratio_peaks *
sqrt(f);
4239 for(li = lmin;li <= lmax; li++){
4240 for(lj = lmin;lj <= lmax; lj++){
4241 a = working_space[x + li - PEAK_WINDOW / 2][
y][z + lj - PEAK_WINDOW / 2 + 2 * sizez_ext];
4242 s += a * c[li] * c[lj];
4243 f += a * c[li] * c[li] * c[lj] * c[lj];
4246 f = s_f_ratio_peaks *
sqrt(f);
4249 for(li = lmin;li <= lmax; li++){
4250 for(lj=lmin;lj<=lmax;lj++){
4251 a = working_space[
x][y + li - PEAK_WINDOW / 2][z + lj - PEAK_WINDOW / 2 + 2 * sizez_ext];
4252 s += a * c[li] * c[lj];
4253 f += a * c[li] * c[li] * c[lj] * c[lj];
4256 f = s_f_ratio_peaks *
sqrt(f);
4258 if(x >= shift && x < ssizex + shift && y >= shift && y < ssizey + shift && z >= shift && z < ssizez + shift){
4259 if(working_space[x][y][z + 3 * sizez_ext] > threshold * maximum / 100.0){
4261 for(k = x - 1,a = 0,b = 0;k <= x + 1; k++){
4262 a += (
Double_t)(k - shift) * working_space[k][
y][
z];
4263 b += working_space[k][
y][
z];
4266 for(k = y - 1,a = 0,b = 0;k <= y + 1; k++){
4267 a += (
Double_t)(k - shift) * working_space[
x][k][
z];
4268 b += working_space[
x][k][
z];
4271 for(k = z - 1,a = 0,b = 0;k <= z + 1; k++){
4272 a += (
Double_t)(k - shift) * working_space[
x][
y][k];
4273 b += working_space[
x][
y][k];
4290 for(i = 0;i < ssizex; i++){
4291 for(j = 0;j < ssizey; j++){
4292 for(k = 0;k < ssizez; k++){
4293 val = -working_space[i + shift][j + shift][k + shift];
4296 dest[i][j][k] = val;
4300 k = (
Int_t)(4 * sigma + 0.5);
4302 for(i = 0;i < ssizex + k; i++){
4303 for(j = 0;j < ssizey + k; j++)
4304 delete[] working_space[i][j];
4305 delete[] working_space[i];
4307 delete[] working_space;
virtual const char * GetName() const
Returns name of object.
void SetResolution(Double_t resolution=1)
NOT USED resolution: determines resolution of the neighbouring peaks default value is 1 correspond to...
Double_t * fPosition
[fNPeaks] array of current peak positions
static double p3(double t, double a, double b, double c, double d)
Int_t fNPeaks
number of peaks found
Int_t SearchFast(const Double_t ***source, Double_t ***dest, Int_t ssizex, Int_t ssizey, Int_t ssizez, Double_t sigma, Double_t threshold, Bool_t markov, Int_t averWindow)
THREE-DIMENSIONAL CLASSICAL PEAK SEARCH FUNCTION This function searches for peaks in source spectrum ...
const char * SmoothMarkov(Double_t ***source, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t averWindow)
This function calculates smoothed spectrum from source spectrum based on Markov chain method...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
const char * Deconvolution(Double_t ***source, const Double_t ***resp, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t numberIterations, Int_t numberRepetitions, Double_t boost)
This function calculates deconvolution from source spectrum according to response spectrum The result...
Short_t Min(Short_t a, Short_t b)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
virtual Int_t GetDimension() const
The TNamed class is the base class for all named ROOT classes.
unsigned int r3[N_CITIES]
static double p2(double t, double a, double b, double c)
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Double_t * fPositionZ
[fNPeaks] Z positions of peaks
virtual const char * Background(const TH1 *hist, Int_t niter, Option_t *option="goff")
This function calculates background spectrum from source in h.
Double_t * fPositionY
[fNPeaks] Y positions of peaks
Double_t fResolution
NOT USED resolution of the neighboring peaks
unsigned int r1[N_CITIES]
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.
Advanced 3-dimensional spectra processing functions.
static double p1(double t, double a, double b)
Int_t fMaxPeaks
Maximum number of peaks to be found.
Int_t SearchHighRes(const Double_t ***source, Double_t ***dest, Int_t ssizex, Int_t ssizey, Int_t ssizez, 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.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
TH1 * fHistogram
resulting histogram
Double_t * fPositionX
[fNPeaks] X positions of peaks
you should not use this method at all Int_t Int_t z
#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
Double_t Sqrt(Double_t x)
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05)
This function searches for peaks in source spectrum in hin The number of found peaks and their positi...
virtual void Print(Option_t *option="") const
Print the array of positions.
unsigned int r2[N_CITIES]
virtual ~TSpectrum3()
Destructor.