From 86338ea3b0d582e145c1b12565873a3d90db1314 Mon Sep 17 00:00:00 2001 From: Rares Vernica Date: Tue, 5 Apr 2016 13:00:47 -0700 Subject: [PATCH 1/5] Remove unused SetResolution function and fResolution member. --- hist/spectrum/inc/TSpectrum.h | 4 +--- hist/spectrum/inc/TSpectrum2.h | 4 +--- hist/spectrum/inc/TSpectrum3.h | 4 +--- hist/spectrum/src/TSpectrum.cxx | 24 +----------------------- hist/spectrum/src/TSpectrum2.cxx | 24 +----------------------- hist/spectrum/src/TSpectrum3.cxx | 24 +----------------------- 6 files changed, 6 insertions(+), 78 deletions(-) diff --git a/hist/spectrum/inc/TSpectrum.h b/hist/spectrum/inc/TSpectrum.h index b52b4a4de1214..b7ee4785a050d 100644 --- a/hist/spectrum/inc/TSpectrum.h +++ b/hist/spectrum/inc/TSpectrum.h @@ -29,7 +29,6 @@ class TSpectrum : public TNamed { Double_t *fPosition; ///< [fNPeaks] array of current peak positions Double_t *fPositionX; ///< [fNPeaks] X position of peaks Double_t *fPositionY; ///< [fNPeaks] Y position of peaks - Double_t fResolution; ///< resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram static Int_t fgAverageWindow; ///< Average window of searched peaks static Int_t fgIterations; ///< Maximum number of decon iterations (default=3) @@ -52,7 +51,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (de }; TSpectrum(); - TSpectrum(Int_t maxpositions, Double_t resolution=1); + TSpectrum(Int_t maxpositions); virtual ~TSpectrum(); virtual TH1 *Background(const TH1 *hist,Int_t niter=20, Option_t *option=""); TH1 *GetHistogram() const {return fHistogram;} @@ -63,7 +62,6 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (de virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); static void SetAverageWindow(Int_t w=3); //set average window static void SetDeconIterations(Int_t n=3); //set max number of decon iterations - void SetResolution(Double_t resolution=1); //new functions January 2006 const char *Background(Double_t *spectrum, Int_t ssize,Int_t numberIterations,Int_t direction, Int_t filterOrder,bool smoothing,Int_t smoothWindow,bool compton); diff --git a/hist/spectrum/inc/TSpectrum2.h b/hist/spectrum/inc/TSpectrum2.h index 7b1bd194a336a..c1d54c3e43dd9 100644 --- a/hist/spectrum/inc/TSpectrum2.h +++ b/hist/spectrum/inc/TSpectrum2.h @@ -24,7 +24,6 @@ class TSpectrum2 : public TNamed { Double_t *fPosition; ///< [fNPeaks] array of current peak positions Double_t *fPositionX; ///< [fNPeaks] X position of peaks Double_t *fPositionY; ///< [fNPeaks] Y position of peaks - Double_t fResolution; ///< resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram static Int_t fgAverageWindow; ///< Average window of searched peaks static Int_t fgIterations; ///< Maximum number of decon iterations (default=3) @@ -38,7 +37,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (def }; TSpectrum2(); - TSpectrum2(Int_t maxpositions, Double_t resolution=1); + TSpectrum2(Int_t maxpositions); virtual ~TSpectrum2(); virtual TH1 *Background(const TH1 *hist, Int_t niter=20, Option_t *option=""); TH1 *GetHistogram() const {return fHistogram;} @@ -49,7 +48,6 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (def virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); static void SetAverageWindow(Int_t w=3); //set average window static void SetDeconIterations(Int_t n=3); //set max number of decon iterations - void SetResolution(Double_t resolution=1); //new functions January 2006 const char *Background(Double_t **spectrum,Int_t ssizex, Int_t ssizey,Int_t numberIterationsX,Int_t numberIterationsY,Int_t direction,Int_t filterType); diff --git a/hist/spectrum/inc/TSpectrum3.h b/hist/spectrum/inc/TSpectrum3.h index 6a1413e8ef474..172c7b49246e2 100644 --- a/hist/spectrum/inc/TSpectrum3.h +++ b/hist/spectrum/inc/TSpectrum3.h @@ -25,7 +25,6 @@ class TSpectrum3 : public TNamed { Double_t *fPositionX; ///< [fNPeaks] X positions of peaks Double_t *fPositionY; ///< [fNPeaks] Y positions of peaks Double_t *fPositionZ; ///< [fNPeaks] Z positions of peaks - Double_t fResolution; ///< resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram public: @@ -37,7 +36,7 @@ class TSpectrum3 : public TNamed { }; TSpectrum3(); - TSpectrum3(Int_t maxpositions, Double_t resolution=1); + TSpectrum3(Int_t maxpositions); virtual ~TSpectrum3(); virtual const char *Background(const TH1 *hist, Int_t niter, Option_t *option="goff"); const char *Background(Double_t ***spectrum, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t numberIterationsX,Int_t numberIterationsY, Int_t numberIterationsZ, Int_t direction,Int_t filterType); @@ -51,7 +50,6 @@ class TSpectrum3 : public TNamed { virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05); 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); 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); - void SetResolution(Double_t resolution=1); const char *SmoothMarkov(Double_t ***source, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t averWindow); ClassDef(TSpectrum3,1) //Peak Finder, Background estimator, Markov smoothing and Deconvolution for 3-D histograms diff --git a/hist/spectrum/src/TSpectrum.cxx b/hist/spectrum/src/TSpectrum.cxx index 252d954952ba6..eacb3e6fa4035 100644 --- a/hist/spectrum/src/TSpectrum.cxx +++ b/hist/spectrum/src/TSpectrum.cxx @@ -50,20 +50,14 @@ TSpectrum::TSpectrum() :TNamed("Spectrum", "Miroslav Morhac peak finder") fPosition = new Double_t[n]; fPositionX = new Double_t[n]; fPositionY = new Double_t[n]; - fResolution = 1; fHistogram = 0; fNPeaks = 0; } //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks -/// - resolution: determines resolution of the neighbouring peaks -/// default value is 1 correspond to 3 sigma distance -/// between peaks. Higher values allow higher resolution -/// (smaller distance between peaks. -/// May be set later through SetResolution. -TSpectrum::TSpectrum(Int_t maxpositions, Double_t resolution) +TSpectrum::TSpectrum(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac peak finder") { Int_t n = maxpositions; @@ -74,7 +68,6 @@ TSpectrum::TSpectrum(Int_t maxpositions, Double_t resolution) fPositionY = new Double_t[n]; fHistogram = 0; fNPeaks = 0; - SetResolution(resolution); } //////////////////////////////////////////////////////////////////////////////// @@ -336,21 +329,6 @@ Int_t TSpectrum::Search(const TH1 * hin, Double_t sigma, Option_t * option, return 0; } -//////////////////////////////////////////////////////////////////////////////// -/// resolution: determines resolution of the neighbouring peaks -/// default value is 1 correspond to 3 sigma distance -/// between peaks. Higher values allow higher resolution -/// (smaller distance between peaks. -/// May be set later through SetResolution. - -void TSpectrum::SetResolution(Double_t resolution) -{ - if (resolution > 1) - fResolution = resolution; - else - fResolution = 1; -} - //////////////////////////////////////////////////////////////////////////////// /// This function calculates background spectrum from source spectrum. /// The result is placed in the vector pointed by spe1945ctrum pointer. diff --git a/hist/spectrum/src/TSpectrum2.cxx b/hist/spectrum/src/TSpectrum2.cxx index 7f6727b1509bd..64295ce1984ff 100644 --- a/hist/spectrum/src/TSpectrum2.cxx +++ b/hist/spectrum/src/TSpectrum2.cxx @@ -57,20 +57,14 @@ TSpectrum2::TSpectrum2() :TNamed("Spectrum", "Miroslav Morhac peak finder") fPosition = new Double_t[n]; fPositionX = new Double_t[n]; fPositionY = new Double_t[n]; - fResolution = 1; fHistogram = 0; fNPeaks = 0; } //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks -/// - resolution: determines resolution of the neighbouring peaks -/// default value is 1 correspond to 3 sigma distance -/// between peaks. Higher values allow higher resolution -/// (smaller distance between peaks. -/// May be set later through SetResolution. -TSpectrum2::TSpectrum2(Int_t maxpositions, Double_t resolution) :TNamed("Spectrum", "Miroslav Morhac peak finder") +TSpectrum2::TSpectrum2(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac peak finder") { Int_t n = maxpositions; fMaxPeaks = n; @@ -79,7 +73,6 @@ TSpectrum2::TSpectrum2(Int_t maxpositions, Double_t resolution) :TNamed("Spectru fPositionY = new Double_t[n]; fHistogram = 0; fNPeaks = 0; - SetResolution(resolution); } //////////////////////////////////////////////////////////////////////////////// @@ -272,21 +265,6 @@ Int_t TSpectrum2::Search(const TH1 * hin, Double_t sigma, return npeaks; } -//////////////////////////////////////////////////////////////////////////////// -/// resolution: determines resolution of the neighboring peaks -/// default value is 1 correspond to 3 sigma distance -/// between peaks. Higher values allow higher resolution -/// (smaller distance between peaks. -/// May be set later through SetResolution. - -void TSpectrum2::SetResolution(Double_t resolution) -{ - if (resolution > 1) - fResolution = resolution; - else - fResolution = 1; -} - //////////////////////////////////////////////////////////////////////////////// /// This function calculates background spectrum from source spectrum. /// The result is placed to the array pointed by spectrum pointer. diff --git a/hist/spectrum/src/TSpectrum3.cxx b/hist/spectrum/src/TSpectrum3.cxx index 1dc70f62756d4..131613baace59 100644 --- a/hist/spectrum/src/TSpectrum3.cxx +++ b/hist/spectrum/src/TSpectrum3.cxx @@ -59,7 +59,6 @@ TSpectrum3::TSpectrum3() :TNamed("Spectrum", "Miroslav Morhac peak finder") fPositionX = new Double_t[n]; fPositionY = new Double_t[n]; fPositionZ = new Double_t[n]; - fResolution = 1; fHistogram = 0; fNPeaks = 0; } @@ -67,13 +66,8 @@ TSpectrum3::TSpectrum3() :TNamed("Spectrum", "Miroslav Morhac peak finder") //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks -/// - resolution: determines resolution of the neighbouring peaks -/// default value is 1 correspond to 3 sigma distance -/// between peaks. Higher values allow higher resolution -/// (smaller distance between peaks. -/// May be set later through SetResolution. -TSpectrum3::TSpectrum3(Int_t maxpositions, Double_t resolution) :TNamed("Spectrum", "Miroslav Morhac peak finder") +TSpectrum3::TSpectrum3(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac peak finder") { Int_t n = TMath::Max(maxpositions, 100); fMaxPeaks = n; @@ -83,7 +77,6 @@ TSpectrum3::TSpectrum3(Int_t maxpositions, Double_t resolution) :TNamed("Spectru fPositionZ = new Double_t[n]; fHistogram = 0; fNPeaks = 0; - SetResolution(resolution); } @@ -212,21 +205,6 @@ Int_t TSpectrum3::Search(const TH1 * hin, Double_t sigma, } -//////////////////////////////////////////////////////////////////////////////// -/// resolution: determines resolution of the neighbouring peaks -/// default value is 1 correspond to 3 sigma distance -/// between peaks. Higher values allow higher resolution -/// (smaller distance between peaks. -/// May be set later through SetResolution. - -void TSpectrum3::SetResolution(Double_t resolution) -{ - if (resolution > 1) - fResolution = resolution; - else - fResolution = 1; -} - //////////////////////////////////////////////////////////////////////////////// /// This function calculates background spectrum from source spectrum. /// The result is placed to the array pointed by spectrum pointer. From 119f6a49cc6fc4e4f51bd0ed26efb87f60e40813 Mon Sep 17 00:00:00 2001 From: Rares Vernica Date: Tue, 5 Apr 2016 13:10:51 -0700 Subject: [PATCH 2/5] Update broken links to the .ps files and add links to the manual. --- hist/spectrum/src/TSpectrum.cxx | 15 +++++++++++---- hist/spectrum/src/TSpectrum2.cxx | 14 +++++++++++--- hist/spectrum/src/TSpectrum3.cxx | 14 +++++++++++--- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/hist/spectrum/src/TSpectrum.cxx b/hist/spectrum/src/TSpectrum.cxx index eacb3e6fa4035..6ebcfc64efbac 100644 --- a/hist/spectrum/src/TSpectrum.cxx +++ b/hist/spectrum/src/TSpectrum.cxx @@ -28,10 +28,17 @@ These NIM papers are also available as doc or ps files from: - - [Spectrum.doc](ftp://root.cern.ch/root/Spectrum.doc) - - [SpectrumDec.ps.gz](ftp://root.cern.ch/root/SpectrumDec.ps.gz) - - [SpectrumSrc.ps.gz](ftp://root.cern.ch/root/SpectrumSrc.ps.gz) - - [SpectrumBck.ps.gz](ftp://root.cern.ch/root/SpectrumBck.ps.gz) + - [SpectrumDec.ps.gz](ftp://root.cern.ch/download/SpectrumDec.ps.gz) + - [SpectrumSrc.ps.gz](ftp://root.cern.ch/download/SpectrumSrc.ps.gz) + - [SpectrumBck.ps.gz](ftp://root.cern.ch/download/SpectrumBck.ps.gz) + + Manual: + + - [Spectrum.doc](ftp://root.cern.ch/download/Spectrum.doc) + - [Spectrum.html](ftp://root.cern.ch/download/doc/spectrum/Spectrum.html) + - [Spectrum.pdf](ftp://root.cern.ch/download/doc/spectrum/Spectrum.pdf) + - [SpectrumLetter.pdf](ftp://root.cern.ch/download/doc/spectrum/SpectrumLetter.pdf) + - [Spectrum.epub](ftp://root.cern.ch/download/doc/spectrum/Spectrum.epub) */ Int_t TSpectrum::fgIterations = 3; diff --git a/hist/spectrum/src/TSpectrum2.cxx b/hist/spectrum/src/TSpectrum2.cxx index 64295ce1984ff..f0a1926bd92ba 100644 --- a/hist/spectrum/src/TSpectrum2.cxx +++ b/hist/spectrum/src/TSpectrum2.cxx @@ -25,9 +25,17 @@ These NIM papers are also available as doc or ps files from: - - [SpectrumDec.ps.gz](ftp://root.cern.ch/root/SpectrumDec.ps.gz) - - [SpectrumSrc.ps.gz](ftp://root.cern.ch/root/SpectrumSrc.ps.gz) - - [SpectrumBck.ps.gz](ftp://root.cern.ch/root/SpectrumBck.ps.gz) + - [SpectrumDec.ps.gz](ftp://root.cern.ch/download/SpectrumDec.ps.gz) + - [SpectrumSrc.ps.gz](ftp://root.cern.ch/download/SpectrumSrc.ps.gz) + - [SpectrumBck.ps.gz](ftp://root.cern.ch/download/SpectrumBck.ps.gz) + + Manual: + + - [Spectrum.doc](ftp://root.cern.ch/download/Spectrum.doc) + - [Spectrum.html](ftp://root.cern.ch/download/doc/spectrum/Spectrum.html) + - [Spectrum.pdf](ftp://root.cern.ch/download/doc/spectrum/Spectrum.pdf) + - [SpectrumLetter.pdf](ftp://root.cern.ch/download/doc/spectrum/SpectrumLetter.pdf) + - [Spectrum.epub](ftp://root.cern.ch/download/doc/spectrum/Spectrum.epub) All the figures in this page were prepared using the DaqProVis system, Data Acquisition, Processing and Visualization system, diff --git a/hist/spectrum/src/TSpectrum3.cxx b/hist/spectrum/src/TSpectrum3.cxx index 131613baace59..a2aab72d43138 100644 --- a/hist/spectrum/src/TSpectrum3.cxx +++ b/hist/spectrum/src/TSpectrum3.cxx @@ -36,9 +36,17 @@ These NIM papers are also available as Postscript files from: - - [SpectrumDec.ps.gz](ftp://root.cern.ch/root/SpectrumDec.ps.gz) - - [SpectrumSrc.ps.gz](ftp://root.cern.ch/root/SpectrumSrc.ps.gz) - - [SpectrumBck.ps.gz](ftp://root.cern.ch/root/SpectrumBck.ps.gz) + - [SpectrumDec.ps.gz](ftp://root.cern.ch/download/SpectrumDec.ps.gz) + - [SpectrumSrc.ps.gz](ftp://root.cern.ch/download/SpectrumSrc.ps.gz) + - [SpectrumBck.ps.gz](ftp://root.cern.ch/download/SpectrumBck.ps.gz) + + Manual: + + - [Spectrum.doc](ftp://root.cern.ch/download/Spectrum.doc) + - [Spectrum.html](ftp://root.cern.ch/download/doc/spectrum/Spectrum.html) + - [Spectrum.pdf](ftp://root.cern.ch/download/doc/spectrum/Spectrum.pdf) + - [SpectrumLetter.pdf](ftp://root.cern.ch/download/doc/spectrum/SpectrumLetter.pdf) + - [Spectrum.epub](ftp://root.cern.ch/download/doc/spectrum/Spectrum.epub) */ #include "TSpectrum3.h" From 33df022869f52d4f237dbe353cbfb166e24324dd Mon Sep 17 00:00:00 2001 From: Rares Vernica Date: Tue, 19 Jul 2016 16:22:28 -0700 Subject: [PATCH 3/5] Revert "Remove unused SetResolution function and fResolution member." This reverts commit 86338ea3b0d582e145c1b12565873a3d90db1314. --- hist/spectrum/inc/TSpectrum.h | 4 +++- hist/spectrum/inc/TSpectrum2.h | 4 +++- hist/spectrum/inc/TSpectrum3.h | 4 +++- hist/spectrum/src/TSpectrum.cxx | 24 +++++++++++++++++++++++- hist/spectrum/src/TSpectrum2.cxx | 24 +++++++++++++++++++++++- hist/spectrum/src/TSpectrum3.cxx | 24 +++++++++++++++++++++++- 6 files changed, 78 insertions(+), 6 deletions(-) diff --git a/hist/spectrum/inc/TSpectrum.h b/hist/spectrum/inc/TSpectrum.h index b7ee4785a050d..b52b4a4de1214 100644 --- a/hist/spectrum/inc/TSpectrum.h +++ b/hist/spectrum/inc/TSpectrum.h @@ -29,6 +29,7 @@ class TSpectrum : public TNamed { Double_t *fPosition; ///< [fNPeaks] array of current peak positions Double_t *fPositionX; ///< [fNPeaks] X position of peaks Double_t *fPositionY; ///< [fNPeaks] Y position of peaks + Double_t fResolution; ///< resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram static Int_t fgAverageWindow; ///< Average window of searched peaks static Int_t fgIterations; ///< Maximum number of decon iterations (default=3) @@ -51,7 +52,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (de }; TSpectrum(); - TSpectrum(Int_t maxpositions); + TSpectrum(Int_t maxpositions, Double_t resolution=1); virtual ~TSpectrum(); virtual TH1 *Background(const TH1 *hist,Int_t niter=20, Option_t *option=""); TH1 *GetHistogram() const {return fHistogram;} @@ -62,6 +63,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (de virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); static void SetAverageWindow(Int_t w=3); //set average window static void SetDeconIterations(Int_t n=3); //set max number of decon iterations + void SetResolution(Double_t resolution=1); //new functions January 2006 const char *Background(Double_t *spectrum, Int_t ssize,Int_t numberIterations,Int_t direction, Int_t filterOrder,bool smoothing,Int_t smoothWindow,bool compton); diff --git a/hist/spectrum/inc/TSpectrum2.h b/hist/spectrum/inc/TSpectrum2.h index c1d54c3e43dd9..7b1bd194a336a 100644 --- a/hist/spectrum/inc/TSpectrum2.h +++ b/hist/spectrum/inc/TSpectrum2.h @@ -24,6 +24,7 @@ class TSpectrum2 : public TNamed { Double_t *fPosition; ///< [fNPeaks] array of current peak positions Double_t *fPositionX; ///< [fNPeaks] X position of peaks Double_t *fPositionY; ///< [fNPeaks] Y position of peaks + Double_t fResolution; ///< resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram static Int_t fgAverageWindow; ///< Average window of searched peaks static Int_t fgIterations; ///< Maximum number of decon iterations (default=3) @@ -37,7 +38,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (def }; TSpectrum2(); - TSpectrum2(Int_t maxpositions); + TSpectrum2(Int_t maxpositions, Double_t resolution=1); virtual ~TSpectrum2(); virtual TH1 *Background(const TH1 *hist, Int_t niter=20, Option_t *option=""); TH1 *GetHistogram() const {return fHistogram;} @@ -48,6 +49,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (def virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); static void SetAverageWindow(Int_t w=3); //set average window static void SetDeconIterations(Int_t n=3); //set max number of decon iterations + void SetResolution(Double_t resolution=1); //new functions January 2006 const char *Background(Double_t **spectrum,Int_t ssizex, Int_t ssizey,Int_t numberIterationsX,Int_t numberIterationsY,Int_t direction,Int_t filterType); diff --git a/hist/spectrum/inc/TSpectrum3.h b/hist/spectrum/inc/TSpectrum3.h index 172c7b49246e2..6a1413e8ef474 100644 --- a/hist/spectrum/inc/TSpectrum3.h +++ b/hist/spectrum/inc/TSpectrum3.h @@ -25,6 +25,7 @@ class TSpectrum3 : public TNamed { Double_t *fPositionX; ///< [fNPeaks] X positions of peaks Double_t *fPositionY; ///< [fNPeaks] Y positions of peaks Double_t *fPositionZ; ///< [fNPeaks] Z positions of peaks + Double_t fResolution; ///< resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram public: @@ -36,7 +37,7 @@ class TSpectrum3 : public TNamed { }; TSpectrum3(); - TSpectrum3(Int_t maxpositions); + TSpectrum3(Int_t maxpositions, Double_t resolution=1); virtual ~TSpectrum3(); virtual const char *Background(const TH1 *hist, Int_t niter, Option_t *option="goff"); const char *Background(Double_t ***spectrum, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t numberIterationsX,Int_t numberIterationsY, Int_t numberIterationsZ, Int_t direction,Int_t filterType); @@ -50,6 +51,7 @@ class TSpectrum3 : public TNamed { virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05); 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); 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); + void SetResolution(Double_t resolution=1); const char *SmoothMarkov(Double_t ***source, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t averWindow); ClassDef(TSpectrum3,1) //Peak Finder, Background estimator, Markov smoothing and Deconvolution for 3-D histograms diff --git a/hist/spectrum/src/TSpectrum.cxx b/hist/spectrum/src/TSpectrum.cxx index 6ebcfc64efbac..8608921755e25 100644 --- a/hist/spectrum/src/TSpectrum.cxx +++ b/hist/spectrum/src/TSpectrum.cxx @@ -57,14 +57,20 @@ TSpectrum::TSpectrum() :TNamed("Spectrum", "Miroslav Morhac peak finder") fPosition = new Double_t[n]; fPositionX = new Double_t[n]; fPositionY = new Double_t[n]; + fResolution = 1; fHistogram = 0; fNPeaks = 0; } //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks +/// - resolution: determines resolution of the neighbouring peaks +/// default value is 1 correspond to 3 sigma distance +/// between peaks. Higher values allow higher resolution +/// (smaller distance between peaks. +/// May be set later through SetResolution. -TSpectrum::TSpectrum(Int_t maxpositions) +TSpectrum::TSpectrum(Int_t maxpositions, Double_t resolution) :TNamed("Spectrum", "Miroslav Morhac peak finder") { Int_t n = maxpositions; @@ -75,6 +81,7 @@ TSpectrum::TSpectrum(Int_t maxpositions) fPositionY = new Double_t[n]; fHistogram = 0; fNPeaks = 0; + SetResolution(resolution); } //////////////////////////////////////////////////////////////////////////////// @@ -336,6 +343,21 @@ Int_t TSpectrum::Search(const TH1 * hin, Double_t sigma, Option_t * option, return 0; } +//////////////////////////////////////////////////////////////////////////////// +/// resolution: determines resolution of the neighbouring peaks +/// default value is 1 correspond to 3 sigma distance +/// between peaks. Higher values allow higher resolution +/// (smaller distance between peaks. +/// May be set later through SetResolution. + +void TSpectrum::SetResolution(Double_t resolution) +{ + if (resolution > 1) + fResolution = resolution; + else + fResolution = 1; +} + //////////////////////////////////////////////////////////////////////////////// /// This function calculates background spectrum from source spectrum. /// The result is placed in the vector pointed by spe1945ctrum pointer. diff --git a/hist/spectrum/src/TSpectrum2.cxx b/hist/spectrum/src/TSpectrum2.cxx index f0a1926bd92ba..4ff07b390cf92 100644 --- a/hist/spectrum/src/TSpectrum2.cxx +++ b/hist/spectrum/src/TSpectrum2.cxx @@ -65,14 +65,20 @@ TSpectrum2::TSpectrum2() :TNamed("Spectrum", "Miroslav Morhac peak finder") fPosition = new Double_t[n]; fPositionX = new Double_t[n]; fPositionY = new Double_t[n]; + fResolution = 1; fHistogram = 0; fNPeaks = 0; } //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks +/// - resolution: determines resolution of the neighbouring peaks +/// default value is 1 correspond to 3 sigma distance +/// between peaks. Higher values allow higher resolution +/// (smaller distance between peaks. +/// May be set later through SetResolution. -TSpectrum2::TSpectrum2(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac peak finder") +TSpectrum2::TSpectrum2(Int_t maxpositions, Double_t resolution) :TNamed("Spectrum", "Miroslav Morhac peak finder") { Int_t n = maxpositions; fMaxPeaks = n; @@ -81,6 +87,7 @@ TSpectrum2::TSpectrum2(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac fPositionY = new Double_t[n]; fHistogram = 0; fNPeaks = 0; + SetResolution(resolution); } //////////////////////////////////////////////////////////////////////////////// @@ -273,6 +280,21 @@ Int_t TSpectrum2::Search(const TH1 * hin, Double_t sigma, return npeaks; } +//////////////////////////////////////////////////////////////////////////////// +/// resolution: determines resolution of the neighboring peaks +/// default value is 1 correspond to 3 sigma distance +/// between peaks. Higher values allow higher resolution +/// (smaller distance between peaks. +/// May be set later through SetResolution. + +void TSpectrum2::SetResolution(Double_t resolution) +{ + if (resolution > 1) + fResolution = resolution; + else + fResolution = 1; +} + //////////////////////////////////////////////////////////////////////////////// /// This function calculates background spectrum from source spectrum. /// The result is placed to the array pointed by spectrum pointer. diff --git a/hist/spectrum/src/TSpectrum3.cxx b/hist/spectrum/src/TSpectrum3.cxx index a2aab72d43138..d79ce488aa1d9 100644 --- a/hist/spectrum/src/TSpectrum3.cxx +++ b/hist/spectrum/src/TSpectrum3.cxx @@ -67,6 +67,7 @@ TSpectrum3::TSpectrum3() :TNamed("Spectrum", "Miroslav Morhac peak finder") fPositionX = new Double_t[n]; fPositionY = new Double_t[n]; fPositionZ = new Double_t[n]; + fResolution = 1; fHistogram = 0; fNPeaks = 0; } @@ -74,8 +75,13 @@ TSpectrum3::TSpectrum3() :TNamed("Spectrum", "Miroslav Morhac peak finder") //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks +/// - resolution: determines resolution of the neighbouring peaks +/// default value is 1 correspond to 3 sigma distance +/// between peaks. Higher values allow higher resolution +/// (smaller distance between peaks. +/// May be set later through SetResolution. -TSpectrum3::TSpectrum3(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac peak finder") +TSpectrum3::TSpectrum3(Int_t maxpositions, Double_t resolution) :TNamed("Spectrum", "Miroslav Morhac peak finder") { Int_t n = TMath::Max(maxpositions, 100); fMaxPeaks = n; @@ -85,6 +91,7 @@ TSpectrum3::TSpectrum3(Int_t maxpositions) :TNamed("Spectrum", "Miroslav Morhac fPositionZ = new Double_t[n]; fHistogram = 0; fNPeaks = 0; + SetResolution(resolution); } @@ -213,6 +220,21 @@ Int_t TSpectrum3::Search(const TH1 * hin, Double_t sigma, } +//////////////////////////////////////////////////////////////////////////////// +/// resolution: determines resolution of the neighbouring peaks +/// default value is 1 correspond to 3 sigma distance +/// between peaks. Higher values allow higher resolution +/// (smaller distance between peaks. +/// May be set later through SetResolution. + +void TSpectrum3::SetResolution(Double_t resolution) +{ + if (resolution > 1) + fResolution = resolution; + else + fResolution = 1; +} + //////////////////////////////////////////////////////////////////////////////// /// This function calculates background spectrum from source spectrum. /// The result is placed to the array pointed by spectrum pointer. From 79e574a7cc6efb5d016979968702d048fa665934 Mon Sep 17 00:00:00 2001 From: Rares Vernica Date: Tue, 19 Jul 2016 16:30:05 -0700 Subject: [PATCH 4/5] Mark uses of fResolution, resolution, and SetResolution as *NOT USED* --- hist/spectrum/inc/TSpectrum.h | 6 +++--- hist/spectrum/inc/TSpectrum2.h | 6 +++--- hist/spectrum/inc/TSpectrum3.h | 6 +++--- hist/spectrum/src/TSpectrum.cxx | 3 ++- hist/spectrum/src/TSpectrum2.cxx | 3 ++- hist/spectrum/src/TSpectrum3.cxx | 3 ++- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hist/spectrum/inc/TSpectrum.h b/hist/spectrum/inc/TSpectrum.h index b52b4a4de1214..a43b4dedaee82 100644 --- a/hist/spectrum/inc/TSpectrum.h +++ b/hist/spectrum/inc/TSpectrum.h @@ -29,7 +29,7 @@ class TSpectrum : public TNamed { Double_t *fPosition; ///< [fNPeaks] array of current peak positions Double_t *fPositionX; ///< [fNPeaks] X position of peaks Double_t *fPositionY; ///< [fNPeaks] Y position of peaks - Double_t fResolution; ///< resolution of the neighboring peaks + Double_t fResolution; ///< *NOT USED* resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram static Int_t fgAverageWindow; ///< Average window of searched peaks static Int_t fgIterations; ///< Maximum number of decon iterations (default=3) @@ -52,7 +52,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (de }; TSpectrum(); - TSpectrum(Int_t maxpositions, Double_t resolution=1); + TSpectrum(Int_t maxpositions, Double_t resolution=1); // resolution is *NOT USED* virtual ~TSpectrum(); virtual TH1 *Background(const TH1 *hist,Int_t niter=20, Option_t *option=""); TH1 *GetHistogram() const {return fHistogram;} @@ -63,7 +63,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (de virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); static void SetAverageWindow(Int_t w=3); //set average window static void SetDeconIterations(Int_t n=3); //set max number of decon iterations - void SetResolution(Double_t resolution=1); + void SetResolution(Double_t resolution=1); // *NOT USED* //new functions January 2006 const char *Background(Double_t *spectrum, Int_t ssize,Int_t numberIterations,Int_t direction, Int_t filterOrder,bool smoothing,Int_t smoothWindow,bool compton); diff --git a/hist/spectrum/inc/TSpectrum2.h b/hist/spectrum/inc/TSpectrum2.h index 7b1bd194a336a..5dc6647c432b0 100644 --- a/hist/spectrum/inc/TSpectrum2.h +++ b/hist/spectrum/inc/TSpectrum2.h @@ -24,7 +24,7 @@ class TSpectrum2 : public TNamed { Double_t *fPosition; ///< [fNPeaks] array of current peak positions Double_t *fPositionX; ///< [fNPeaks] X position of peaks Double_t *fPositionY; ///< [fNPeaks] Y position of peaks - Double_t fResolution; ///< resolution of the neighboring peaks + Double_t fResolution; ///< *NOT USED* resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram static Int_t fgAverageWindow; ///< Average window of searched peaks static Int_t fgIterations; ///< Maximum number of decon iterations (default=3) @@ -38,7 +38,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (def }; TSpectrum2(); - TSpectrum2(Int_t maxpositions, Double_t resolution=1); + TSpectrum2(Int_t maxpositions, Double_t resolution=1); // resolution is *NOT USED* virtual ~TSpectrum2(); virtual TH1 *Background(const TH1 *hist, Int_t niter=20, Option_t *option=""); TH1 *GetHistogram() const {return fHistogram;} @@ -49,7 +49,7 @@ static Int_t fgIterations; ///< Maximum number of decon iterations (def virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); static void SetAverageWindow(Int_t w=3); //set average window static void SetDeconIterations(Int_t n=3); //set max number of decon iterations - void SetResolution(Double_t resolution=1); + void SetResolution(Double_t resolution=1); // *NOT USED* //new functions January 2006 const char *Background(Double_t **spectrum,Int_t ssizex, Int_t ssizey,Int_t numberIterationsX,Int_t numberIterationsY,Int_t direction,Int_t filterType); diff --git a/hist/spectrum/inc/TSpectrum3.h b/hist/spectrum/inc/TSpectrum3.h index 6a1413e8ef474..75f5a64e689e4 100644 --- a/hist/spectrum/inc/TSpectrum3.h +++ b/hist/spectrum/inc/TSpectrum3.h @@ -25,7 +25,7 @@ class TSpectrum3 : public TNamed { Double_t *fPositionX; ///< [fNPeaks] X positions of peaks Double_t *fPositionY; ///< [fNPeaks] Y positions of peaks Double_t *fPositionZ; ///< [fNPeaks] Z positions of peaks - Double_t fResolution; ///< resolution of the neighboring peaks + Double_t fResolution; ///< *NOT USED* resolution of the neighboring peaks TH1 *fHistogram; ///< resulting histogram public: @@ -37,7 +37,7 @@ class TSpectrum3 : public TNamed { }; TSpectrum3(); - TSpectrum3(Int_t maxpositions, Double_t resolution=1); + TSpectrum3(Int_t maxpositions, Double_t resolution=1); // resolution is *NOT USED* virtual ~TSpectrum3(); virtual const char *Background(const TH1 *hist, Int_t niter, Option_t *option="goff"); const char *Background(Double_t ***spectrum, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t numberIterationsX,Int_t numberIterationsY, Int_t numberIterationsZ, Int_t direction,Int_t filterType); @@ -51,7 +51,7 @@ class TSpectrum3 : public TNamed { virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05); 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); 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); - void SetResolution(Double_t resolution=1); + void SetResolution(Double_t resolution=1); // *NOT USED* const char *SmoothMarkov(Double_t ***source, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t averWindow); ClassDef(TSpectrum3,1) //Peak Finder, Background estimator, Markov smoothing and Deconvolution for 3-D histograms diff --git a/hist/spectrum/src/TSpectrum.cxx b/hist/spectrum/src/TSpectrum.cxx index 8608921755e25..5e428b5726733 100644 --- a/hist/spectrum/src/TSpectrum.cxx +++ b/hist/spectrum/src/TSpectrum.cxx @@ -64,7 +64,7 @@ TSpectrum::TSpectrum() :TNamed("Spectrum", "Miroslav Morhac peak finder") //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks -/// - resolution: determines resolution of the neighbouring peaks +/// - resolution: *NOT USED* determines resolution of the neighbouring peaks /// default value is 1 correspond to 3 sigma distance /// between peaks. Higher values allow higher resolution /// (smaller distance between peaks. @@ -344,6 +344,7 @@ Int_t TSpectrum::Search(const TH1 * hin, Double_t sigma, Option_t * option, } //////////////////////////////////////////////////////////////////////////////// +/// *NOT USED* /// resolution: determines resolution of the neighbouring peaks /// default value is 1 correspond to 3 sigma distance /// between peaks. Higher values allow higher resolution diff --git a/hist/spectrum/src/TSpectrum2.cxx b/hist/spectrum/src/TSpectrum2.cxx index 4ff07b390cf92..77064fd15a322 100644 --- a/hist/spectrum/src/TSpectrum2.cxx +++ b/hist/spectrum/src/TSpectrum2.cxx @@ -72,7 +72,7 @@ TSpectrum2::TSpectrum2() :TNamed("Spectrum", "Miroslav Morhac peak finder") //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks -/// - resolution: determines resolution of the neighbouring peaks +/// - resolution: *NOT USED* determines resolution of the neighbouring peaks /// default value is 1 correspond to 3 sigma distance /// between peaks. Higher values allow higher resolution /// (smaller distance between peaks. @@ -281,6 +281,7 @@ Int_t TSpectrum2::Search(const TH1 * hin, Double_t sigma, } //////////////////////////////////////////////////////////////////////////////// +/// *NOT USED* /// resolution: determines resolution of the neighboring peaks /// default value is 1 correspond to 3 sigma distance /// between peaks. Higher values allow higher resolution diff --git a/hist/spectrum/src/TSpectrum3.cxx b/hist/spectrum/src/TSpectrum3.cxx index d79ce488aa1d9..cec9e4863a05d 100644 --- a/hist/spectrum/src/TSpectrum3.cxx +++ b/hist/spectrum/src/TSpectrum3.cxx @@ -75,7 +75,7 @@ TSpectrum3::TSpectrum3() :TNamed("Spectrum", "Miroslav Morhac peak finder") //////////////////////////////////////////////////////////////////////////////// /// - maxpositions: maximum number of peaks -/// - resolution: determines resolution of the neighbouring peaks +/// - resolution: *NOT USED* determines resolution of the neighbouring peaks /// default value is 1 correspond to 3 sigma distance /// between peaks. Higher values allow higher resolution /// (smaller distance between peaks. @@ -221,6 +221,7 @@ Int_t TSpectrum3::Search(const TH1 * hin, Double_t sigma, //////////////////////////////////////////////////////////////////////////////// +/// *NOT USED* /// resolution: determines resolution of the neighbouring peaks /// default value is 1 correspond to 3 sigma distance /// between peaks. Higher values allow higher resolution From 7b503f29e31a01f3c106e49b151bf5be54086a0a Mon Sep 17 00:00:00 2001 From: Rares Vernica Date: Tue, 19 Jul 2016 16:45:17 -0700 Subject: [PATCH 5/5] Add links to online documentation and tutorial to 2D and 3D spectrum as well. --- hist/spectrum/src/TSpectrum2.cxx | 4 ++++ hist/spectrum/src/TSpectrum3.cxx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/hist/spectrum/src/TSpectrum2.cxx b/hist/spectrum/src/TSpectrum2.cxx index 77064fd15a322..afdbaffeec372 100644 --- a/hist/spectrum/src/TSpectrum2.cxx +++ b/hist/spectrum/src/TSpectrum2.cxx @@ -37,6 +37,10 @@ - [SpectrumLetter.pdf](ftp://root.cern.ch/download/doc/spectrum/SpectrumLetter.pdf) - [Spectrum.epub](ftp://root.cern.ch/download/doc/spectrum/Spectrum.epub) + See also the + [online documentation](https://root.cern.ch/guides/tspectrum-manual) and + [tutorials](https://root.cern.ch/doc/master/group__tutorial__spectrum.html). + All the figures in this page were prepared using the DaqProVis system, Data Acquisition, Processing and Visualization system, developed at the Institute of Physics, Slovak Academy of Sciences, Bratislava, diff --git a/hist/spectrum/src/TSpectrum3.cxx b/hist/spectrum/src/TSpectrum3.cxx index cec9e4863a05d..bd7ce5825aa3b 100644 --- a/hist/spectrum/src/TSpectrum3.cxx +++ b/hist/spectrum/src/TSpectrum3.cxx @@ -47,6 +47,10 @@ - [Spectrum.pdf](ftp://root.cern.ch/download/doc/spectrum/Spectrum.pdf) - [SpectrumLetter.pdf](ftp://root.cern.ch/download/doc/spectrum/SpectrumLetter.pdf) - [Spectrum.epub](ftp://root.cern.ch/download/doc/spectrum/Spectrum.epub) + + See also the + [online documentation](https://root.cern.ch/guides/tspectrum-manual) and + [tutorials](https://root.cern.ch/doc/master/group__tutorial__spectrum.html). */ #include "TSpectrum3.h"