Example to illustrate the 2-d peak finder (class TSpectrum2).
This script generates a random number of 2-d gaussian peaks The position of the peaks is found via TSpectrum2 To execute this example, do:
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The script will iterate generating a new histogram having between 5 and the maximun number of peaks specified. Double Click on the bottom right corner of the pad to go to a new spectrum To Quit, select the "quit" item in the canvas "File" menu
{
}
}
{
}
c1 =
new TCanvas(
"c1",
"c1", 10, 10, 1000, 700);
h2->FillRandom(
"f2", 500000);
}
}
}
}
printf(
"\nDouble click in the bottom right corner of the pad to continue\n");
}
}
{
for (int i = 0; i < 10; ++i) {
}
}
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
R__EXTERN TRandom * gRandom
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual void SetParameters(const Double_t *params)
A 2-Dim function with parameters.
virtual void SetNpy(Int_t npy=100)
Set the number of points used to draw the function.
2-D histogram with a float per channel (see TH1 documentation)
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Advanced 2-dimensional spectra processing.
Double_t * GetPositionY() const
Double_t * GetPositionX() const
void Print(Option_t *option="") const override
Print the array of positions.
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...
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculates a gaussian function with mean and sigma.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
- Author
- Rene Brun
Definition in file peaks2.C.