54#define PEAK_WINDOW 1024
131 Int_t dimension =
h->GetDimension();
132 if (dimension != 3) {
133 Error(
"Background",
"Only implemented for 3-d histograms");
141 if (opt.
Contains(
"backincreasingwindow"))
144 if (opt.
Contains(
"backonestepfiltering"))
157 for (i = 0; i <
sizeX; i++) {
161 for (k = 0; k <
sizeZ; k++)
176 hb->GetListOfFunctions()->Delete();
177 for (i = 0; i <
sizeX; i++)
179 for (k = 0; k <
sizeZ; k++)
189 for (i = 0; i <
sizeX; i++) {
242 Int_t dimension =
hin->GetDimension();
243 if (dimension != 3) {
244 Error(
"Search",
"Must be a 3-d histogram");
254 for (i = 0; i <
sizex; i++) {
260 for (k = 0; k <
sizez; k++)
265 npeaks =
SearchHighRes((
const Double_t***)
source,
dest,
sizex,
sizey,
sizez,
sigma, 100*
threshold,
kTRUE, 3,
kFALSE, 3);
270 for (i = 0; i <
npeaks; i++) {
278 for (i = 0; i <
sizex; i++) {
281 delete []
dest[i][
j];
470 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;
472 return "Wrong parameters";
474 return "Width of Clipping Window Must Be Positive";
476 return (
"Too Large Clipping Window");
836 for(i = 0;i <
ssizex; i++){
940 Double_t nom,
nip,
nim,
sp,
sm,
spx,
smx,
spy,
smy,
spz,
smz,
plocha=0;
942 return "Averaging Window must be positive";
944 for(i = 0;i <
ssizex; i++){
957 for(k = 0;k <
ssizez; k++){
966 for(i = 0;i <
ssizex; i++){
1040 if(i -
l + 1 <
ymin)
1061 for(i = zmin;i < zmax; i++){
1082 if(i -
l + 1 < zmin)
1124 if(i -
l + 1 <
xmin)
1184 for(
j = zmin;
j < zmax;
j++){
1205 if(i -
l + 1 <
xmin)
1242 if(
j -
l + 1 < zmin)
1265 for(
j = zmin;
j < zmax;
j++){
1286 if(i -
l + 1 <
ymin)
1323 if(
j -
l + 1 < zmin)
1347 for(k = zmin;k < zmax; k++){
1368 if(i -
l + 1 <
xmin)
1467 for(k = zmin;k <= zmax; k++){
1472 for(i = 0;i <
ssizex; i++){
1474 for(k = 0;k <
ssizez; k++){
1479 for(i = 0;i <
ssizex; i++){
1680 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;
1683 return "Wrong parameters";
1685 return "Number of iterations must be positive";
1687 return "Number of repetitions must be positive";
1696 for (i = 0; i <
ssizex; i++) {
1698 for (k = 0; k <
ssizez; k++) {
1717 if (
lhx == -1 ||
lhy == -1 ||
lhz == -1) {
1718 for(i = 0;i <
ssizex; i++){
1724 return (
"Zero response data");
1805 for (i = 0; i <
ssizex; i++) {
1807 for (k = 0; k <
ssizez; k++) {
1868 for (i = 0; i <
ssizex; i++) {
1870 for (k = 0; k <
ssizez; k++)
1874 for(i = 0;i <
ssizex; i++){
2035 Double_t nom,
nip,
nim,
sp,
sm,
spx,
spy,
smx,
smy,
spz,
smz;
2036 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;
2039 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;
2041 Error(
"SearchHighRes",
"Invalid sigma, must be greater than or equal to 1");
2046 Error(
"SearchHighRes",
"Invalid threshold, must be positive and less than 100");
2052 Error(
"SearchHighRes",
"Too large sigma");
2058 Error(
"SearchHighRes",
"Averaging window must be positive");
2065 Error(
"SearchHighRes",
"Too large clipping window");
2075 for(k = 0;k <
ssizey + i; k++)
2086 else if(k >=
ssizez + shift)
2097 else if(k >=
ssizez + shift)
2108 else if(k >=
ssizez + shift)
2116 else if(i >=
ssizex + shift){
2121 else if(k >=
ssizez + shift)
2132 else if(k >=
ssizez + shift)
2143 else if(k >=
ssizez + shift)
2156 else if(k >=
ssizez + shift)
2167 else if(k >=
ssizez + shift)
2178 else if(k >=
ssizez + shift)
2220 b = (
p1 +
p3) / 2.0;
2224 b = (
p1 +
p2) / 2.0;
2228 b = (
p2 +
p4) / 2.0;
2232 b = (
p3 +
p4) / 2.0;
2236 b = (
p5 +
p7) / 2.0;
2240 b = (
p5 +
p6) / 2.0;
2244 b = (
p6 +
p8) / 2.0;
2248 b = (
p7 +
p8) / 2.0;
2252 b = (
p2 +
p6) / 2.0;
2256 b = (
p4 +
p8) / 2.0;
2260 b = (
p1 +
p5) / 2.0;
2264 b = (
p3 +
p7) / 2.0;
2334 else if(k >=
ssizez + shift)
2345 else if(k >=
ssizez + shift)
2356 else if(k >=
ssizez + shift)
2364 else if(i >=
ssizex + shift){
2369 else if(k >=
ssizez + shift)
2380 else if(k >=
ssizez + shift)
2391 else if(k >=
ssizez + shift)
2404 else if(k >=
ssizez + shift)
2415 else if(k >=
ssizez + shift)
2426 else if(k >=
ssizez + shift)
2465 for(i = 0;i <
ssizex + k; i++){
2496 if(i -
l + 1 <
xmin)
2538 if(i -
l + 1 <
ymin)
2559 for(i = zmin;i < zmax;i++){
2580 if(i -
l + 1 < zmin)
2623 if(i -
l + 1 <
xmin)
2683 for(
j = zmin;
j < zmax;
j++){
2704 if(i -
l + 1 <
xmin)
2741 if(
j -
l + 1 < zmin)
2764 for(
j = zmin;
j < zmax;
j++){
2785 if(i -
l + 1 <
ymin)
2822 if(
j -
l + 1 < zmin)
2846 for(k = zmin;k < zmax; k++){
2867 if(i -
l + 1 <
xmin)
2967 for(k = zmin;k <= zmax; k++){
3187 for(k = i - 1,
a = 0,
b = 0;k <= i + 1; k++){
3192 for(k =
j - 1,
a = 0,
b = 0;k <=
j + 1; k++){
3197 for(k =
l - 1,
a = 0,
b = 0;k <=
l + 1; k++){
3210 for(i = 0;i <
ssizex; i++){
3212 for(k = 0;k <
ssizez; k++){
3219 for(i = 0;i <
ssizex + k; i++){
3254 Int_t i,
j,k,
l,
li,
lj,
lk,
lmin,
lmax,
xmin,
xmax,
ymin,
ymax,zmin,zmax;
3256 Double_t nom,
nip,
nim,
sp,
sm,
spx,
spy,
smx,
smy,
spz,
smz;
3257 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;
3260 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;
3266 Error(
"SearchFast",
"Invalid sigma, must be greater than or equal to 1");
3271 Error(
"SearchFast",
"Invalid threshold, must be positive and less than 100");
3277 Error(
"SearchFast",
"Too large sigma");
3283 Error(
"SearchFast",
"Averaging window must be positive");
3289 Error(
"SearchFast",
"Too large clipping window");
3298 for(k = 0;k <
ssizey + i; k++)
3310 else if(k >=
ssizez + shift)
3321 else if(k >=
ssizez + shift)
3332 else if(k >=
ssizez + shift)
3340 else if(i >=
ssizex + shift){
3345 else if(k >=
ssizez + shift)
3356 else if(k >=
ssizez + shift)
3367 else if(k >=
ssizez + shift)
3380 else if(k >=
ssizez + shift)
3391 else if(k >=
ssizez + shift)
3402 else if(k >=
ssizez + shift)
3443 b = (
p1 +
p3) / 2.0;
3447 b = (
p1 +
p2) / 2.0;
3451 b = (
p2 +
p4) / 2.0;
3455 b = (
p3 +
p4) / 2.0;
3459 b = (
p5 +
p7) / 2.0;
3463 b = (
p5 +
p6) / 2.0;
3467 b = (
p6 +
p8) / 2.0;
3471 b = (
p7 +
p8) / 2.0;
3475 b = (
p2 +
p6) / 2.0;
3479 b = (
p4 +
p8) / 2.0;
3483 b = (
p1 +
p5) / 2.0;
3487 b = (
p3 +
p7) / 2.0;
3557 else if(k >=
ssizez + shift)
3568 else if(k >=
ssizez + shift)
3579 else if(k >=
ssizez + shift)
3587 else if(i >=
ssizex + shift){
3592 else if(k >=
ssizez + shift)
3603 else if(k >=
ssizez + shift)
3614 else if(k >=
ssizez + shift)
3627 else if(k >=
ssizez + shift)
3638 else if(k >=
ssizez + shift)
3649 else if(k >=
ssizez + shift)
3692 for(i = 0;i <
ssizex + k; i++){
3724 if(i -
l + 1 <
xmin)
3766 if(i -
l + 1 <
ymin)
3787 for(i = zmin;i < zmax;i++){
3808 if(i -
l + 1 < zmin)
3851 if(i -
l + 1 <
xmin)
3911 for(
j = zmin;
j < zmax;
j++){
3932 if(i -
l + 1 <
xmin)
3969 if(
j -
l + 1 < zmin)
3992 for(
j = zmin;
j < zmax;
j++){
4013 if(i -
l + 1 <
ymin)
4050 if(
j -
l + 1 < zmin)
4074 for(k = zmin;k < zmax; k++){
4095 if(i -
l + 1 <
xmin)
4195 for(k = zmin;k <= zmax; k++){
4211 for(k = 0;k <
ssizez; k++){
4213 for(i = 0;i <
ssizex; i++){
4225 for(i = -
j;i <=
j; i++){
4257 for(k = zmin;k <= zmax; k++){
4276 for(z = zmin + 1;z < zmax; z++){
4363 for(k =
x - 1,
a = 0,
b = 0;k <=
x + 1; k++){
4368 for(k =
y - 1,
a = 0,
b = 0;k <=
y + 1; k++){
4373 for(k = z - 1,
a = 0,
b = 0;k <= z + 1; k++){
4392 for(i = 0;i <
ssizex; i++){
4394 for(k = 0;k <
ssizez; k++){
4398 dest[i][
j][k] = val;
4404 for(i = 0;i <
ssizex + k; i++){
int Int_t
Signed integer 4 bytes (int)
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
TH1 is the base class of all histogram classes in ROOT.
The 3-D histogram classes derived from the 1-D histogram classes.
The TNamed class is the base class for all named ROOT classes.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Advanced 3-dimensional spectra processing functions.
Double_t fResolution
NOT USED resolution of the neighboring peaks
Int_t fMaxPeaks
Maximum number of peaks to be found.
virtual TH1 * Background(const TH1 *hist, Int_t nIterX=20, Int_t nIterY=20, Int_t nIterZ=20, Option_t *option="goff")
This function calculates background spectrum from source in h.
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 ...
TH1 * fHistogram
resulting histogram
static TH1 * StaticBackground(const TH1 *hist, Int_t nIterX=20, Int_t nIterY=20, Int_t nIterZ=20, Option_t *option="")
static function (called by TH3), interface to TSpectrum3::Background
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...
Double_t * fPositionY
[fNPeaks] Y positions of peaks
Double_t * fPosition
[fNPeaks] array of current peak positions
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...
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.
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.
@ kBackSuccessiveFiltering
Double_t * fPositionZ
[fNPeaks] Z positions of peaks
Double_t * fPositionX
[fNPeaks] X positions of peaks
Int_t fNPeaks
number of peaks found
void Print(Option_t *option="") const override
Print the array of positions.
void SetResolution(Double_t resolution=1)
NOT USED resolution: determines resolution of the neighbouring peaks default value is 1 correspond to...
~TSpectrum3() override
Destructor.
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.