39 for (
Int_t p=0;p<npeaks;p++) {
50 printf(
"Generating histogram with %d peaks\n",npeaks);
60 h2 =
new TH2F(
"h2",
"test",nbinsx,xmin,xmax,nbinsy,ymin,ymax);
65 for (p=0;p<npeaks;p++) {
72 TF2 *
f2 =
new TF2(
"f2",fpeaks2,xmin,xmax,ymin,ymax,5*npeaks);
77 if (!c1) c1 =
new TCanvas(
"c1",
"c1",10,10,1000,700);
87 for (p=0;p<npeaks;p++) {
88 for (pf=0;pf<nfound;pf++) {
91 if (diffx < 2*dx && diffy < 2*dy) ngood++;
94 if (ngood > nfound) ngood = nfound;
97 for (pf=0;pf<nfound;pf++) {
99 for (p=0;p<npeaks;p++) {
102 if (diffx < 2*dx && diffy < 2*dy) nf++;
104 if (nf == 0) nghost++;
109 printf(
"Gener=%d, Found=%d, Good=%d, Ghost=%d\n",npeaks,nfound,ngood,nghost);
110 if (!
gROOT->IsBatch()) {
111 printf(
"\nDouble click in the bottom right corner of the pad to continue\n");
115 void peaks2(
Int_t maxpeaks=50) {
117 for (
int i=0; i<10; ++i) {
virtual void SetParameters(const Double_t *params)
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
Advanced 2-dimensional spectra processing.
virtual void Print(Option_t *option="") const
Print the array of positions.
tomato 2-D histogram with a float per channel (see TH1 documentation)}
virtual void SetNpy(Int_t npy=100)
Set the number of points used to draw the function.
A 2-Dim function with parameters.
R__EXTERN TRandom * gRandom
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual TObject * WaitPrimitive(const char *pname="", const char *emode="")
Loop and sleep until a primitive with name=pname is found in the pad.
Double_t * GetPositionY() const
double f2(const double *x)
Double_t * GetPositionX() const
virtual void Update()
Update canvas pad buffers.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
double norm(double *x, double *p)
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
This function searches for peaks in source spectrum in hin The number of found peaks and their positi...