NCFS-Pack
A generic (astro)particle physics analysis framework
 
Loading...
Searching...
No Matches
NcSpectrum.h
Go to the documentation of this file.
1#ifndef NcSpectrum_h
2#define NcSpectrum_h
3
4// This is a copy of the file TSpectrum.h from ROOT 5.34/38
5// which was created by Miroslav Morhac (27/05/99).
6// It has been introduced as NcSpectrum.h in order to provide compatible
7// functionality within all ROOT versions, such that all the NCFS (based) code
8// can remain unchanged, and as such 100% backward (and forward) compatible.
9// The incompatibility that was introduced starting from ROOT6 consisted of
10// the fact that the Float_t* return arguments were changed into Double_t*.
11
12#include "TNamed.h"
13
14// Added by Nick van Eijndhoven, VUB-IIHE, Brussels, May 7, 2025 07:01Z
15#include "TPolyMarker.h"
16#include "TVirtualPad.h"
17#include "TList.h"
18#include "TH1.h"
19#include "TMath.h"
20
21// Commented out by Nick van Eijndhoven, VUB-IIHE, Brussels, May 7, 2025 07:01Z
22//@@@ class TH1;
23
25
26class NcSpectrum : public TNamed {
27private:
28
29 NcSpectrum(const NcSpectrum&); // Not implemented
30 NcSpectrum& operator=(const NcSpectrum&); // Not implemented
31
32protected:
33 Int_t fMaxPeaks; //Maximum number of peaks to be found
34 Int_t fNPeaks; //number of peaks found
35 Float_t *fPosition; //[fNPeaks] array of current peak positions
36 Float_t *fPositionX; //[fNPeaks] X position of peaks
37 Float_t *fPositionY; //[fNPeaks] Y position of peaks
38 Float_t fResolution; //resolution of the neighboring peaks
39 TH1 *fHistogram; //resulting histogram
40static Int_t fgAverageWindow; //Average window of searched peaks
41static Int_t fgIterations; //Maximum number of decon iterations (default=3)
42
43public:
44 enum {
58 };
59
60 NcSpectrum();
61 NcSpectrum(Int_t maxpositions, Float_t resolution=1);
62 virtual ~NcSpectrum();
63 virtual TH1 *Background(const TH1 *hist,Int_t niter=20, Option_t *option="");
64 TH1 *GetHistogram() const {return fHistogram;}
65 Int_t GetNPeaks() const {return fNPeaks;}
66 Float_t *GetPositionX() const {return fPositionX;}
67 Float_t *GetPositionY() const {return fPositionY;}
68 virtual void Print(Option_t *option="") const;
69 virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05);
70 static void SetAverageWindow(Int_t w=3); //set average window
71 static void SetDeconIterations(Int_t n=3); //set max number of decon iterations
72 void SetResolution(Float_t resolution=1);
73
74 //new functions January 2006
75 const char *Background(float *spectrum, Int_t ssize,Int_t numberIterations,Int_t direction, Int_t filterOrder,bool smoothing,Int_t smoothWindow,bool compton);
76 const char *SmoothMarkov(float *source, Int_t ssize, Int_t averWindow);
77 const char *Deconvolution(float *source, const float *response,Int_t ssize, Int_t numberIterations,Int_t numberRepetitions, Double_t boost );
78 const char *DeconvolutionRL(float *source, const float *response,Int_t ssize, Int_t numberIterations,Int_t numberRepetitions, Double_t boost );
79 const char *Unfolding(float *source,const float **respMatrix,Int_t ssizex, Int_t ssizey,Int_t numberIterations,Int_t numberRepetitions, Double_t boost);
80 Int_t SearchHighRes(float *source,float *destVector, Int_t ssize,float sigma, Double_t threshold,bool backgroundRemove,Int_t deconIterations,bool markov, Int_t averWindow);
81 Int_t Search1HighRes(float *source,float *destVector, Int_t ssize,float sigma, Double_t threshold,bool backgroundRemove,Int_t deconIterations,bool markov, Int_t averWindow);
82
83 static Int_t StaticSearch(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05);
84 static TH1 *StaticBackground(const TH1 *hist,Int_t niter=20, Option_t *option="");
85
86 ClassDef(NcSpectrum,1) // Facilities for advanced spectral analysis
87};
88#endif
89
static TH1 * StaticBackground(const TH1 *hist, Int_t niter=20, Option_t *option="")
static Int_t StaticSearch(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05)
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
NcSpectrum & operator=(const NcSpectrum &)
static Int_t fgAverageWindow
Definition NcSpectrum.h:40
Float_t fResolution
Definition NcSpectrum.h:38
Float_t * fPositionX
Definition NcSpectrum.h:36
static void SetDeconIterations(Int_t n=3)
@ kBackSmoothing11
Definition NcSpectrum.h:55
@ kBackSmoothing15
Definition NcSpectrum.h:57
@ kBackSmoothing7
Definition NcSpectrum.h:53
@ kBackSmoothing13
Definition NcSpectrum.h:56
@ kBackSmoothing9
Definition NcSpectrum.h:54
@ kBackIncreasingWindow
Definition NcSpectrum.h:49
@ kBackDecreasingWindow
Definition NcSpectrum.h:50
@ kBackSmoothing5
Definition NcSpectrum.h:52
@ kBackSmoothing3
Definition NcSpectrum.h:51
virtual ~NcSpectrum()
const char * Deconvolution(float *source, const float *response, Int_t ssize, Int_t numberIterations, Int_t numberRepetitions, Double_t boost)
const char * Background(float *spectrum, Int_t ssize, Int_t numberIterations, Int_t direction, Int_t filterOrder, bool smoothing, Int_t smoothWindow, bool compton)
static Int_t fgIterations
Definition NcSpectrum.h:41
Int_t Search1HighRes(float *source, float *destVector, Int_t ssize, float sigma, Double_t threshold, bool backgroundRemove, Int_t deconIterations, bool markov, Int_t averWindow)
Int_t SearchHighRes(float *source, float *destVector, Int_t ssize, float sigma, Double_t threshold, bool backgroundRemove, Int_t deconIterations, bool markov, Int_t averWindow)
Int_t GetNPeaks() const
Definition NcSpectrum.h:65
Float_t * fPosition
Definition NcSpectrum.h:35
NcSpectrum(const NcSpectrum &)
Float_t * GetPositionX() const
Definition NcSpectrum.h:66
virtual void Print(Option_t *option="") const
TH1 * GetHistogram() const
Definition NcSpectrum.h:64
static void SetAverageWindow(Int_t w=3)
Int_t fMaxPeaks
Definition NcSpectrum.h:33
Float_t * fPositionY
Definition NcSpectrum.h:37
const char * SmoothMarkov(float *source, Int_t ssize, Int_t averWindow)
void SetResolution(Float_t resolution=1)
const char * Unfolding(float *source, const float **respMatrix, Int_t ssizex, Int_t ssizey, Int_t numberIterations, Int_t numberRepetitions, Double_t boost)
const char * DeconvolutionRL(float *source, const float *response, Int_t ssize, Int_t numberIterations, Int_t numberRepetitions, Double_t boost)
TH1 * fHistogram
Definition NcSpectrum.h:39
Float_t * GetPositionY() const
Definition NcSpectrum.h:67
Int_t fNPeaks
Definition NcSpectrum.h:34
virtual TH1 * Background(const TH1 *hist, Int_t niter=20, Option_t *option="")