1#ifndef GAMR_TOOLKIT_PEAK_HH
2#define GAMR_TOOLKIT_PEAK_HH
40 virtual double GetAmp() {
return 0; }
56 class BPeak :
public Peak,
public TNamed,
public TAttLine {
70 std::vector<GamR::TK::Gate > mBackgrounds;
81 void Paint(Option_t *option =
"same");
82 Int_t DistancetoPrimitive(Int_t
px, Int_t
py);
83 void ExecuteEvent(Int_t event, Int_t
px, Int_t
py);
89 LFit(TH1D *background) { back = background; }
90 double operator() (
double *x,
double *p) {
return back->GetBinContent(back->FindBin(x[0])) + p[0] + x[0]*p[1]; }
106 void Set(TH1 *hist,
double x1,
double y1,
double x2,
double y2);
107 void Set(TH1 *hist,
GamR::TK::Gate peak, std::vector<GamR::TK::Gate > background, Option_t *foption=
"", Option_t *option=
"sl");
110 void SetCont(TH1 *hist,
GamR::TK::Gate peak, std::vector<GamR::TK::Gate > background, Option_t *foption=
"", Option_t *option=
"");
111 void SetPoint(TH1 *hist,
GamR::TK::Gate peak, std::vector<GamR::TK::Gate > background, Option_t *foption=
"", Option_t *option=
"");
112 void SetStep(TH1 *hist,
GamR::TK::Gate peak, std::vector<GamR::TK::Gate > background, Option_t *foption=
"", Option_t *option=
"");
115 void Set(TH1 *hist, Option_t *foption=
"", Option_t *option=
"sl");
116 void Set(TH2 *hist, Option_t *foption=
"", Option_t *option=
"sl");
173 void SetParameters(std::vector<double> params) {
for (
int i=0; i<(int)params.size(); ++i) {
fPeakFunc->SetParameter(i, params[i]); } }
174 void SetParErrors(std::vector<double> errors) {
for (
int i=0; i<(int)errors.size(); ++i) {
fPeakFunc->SetParError(i, errors[i]); } }
184 gaussfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
185 gaussfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
186 gaussfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
208 void SetParameters(std::vector<double> params) {
for (
int i=0; i<(int)params.size(); ++i) {
fPeakFunc->SetParameter(i, params[i]); } }
209 void SetParErrors(std::vector<double> errors) {
for (
int i=0; i<(int)errors.size(); ++i) {
fPeakFunc->SetParError(i, errors[i]); } }
217 TF1 *
GetStepFunc() { TF1 *stepfunc =
new TF1(
"StepFunc",
"[0]*([3]/100)*std::erfc((x-[1])/(sqrt(2)*[2]))",
fLow,
fHigh);
218 stepfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
219 stepfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
220 stepfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
221 stepfunc->SetParameter(3,
fPeakFunc->GetParameter(3));
226 gaussfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
227 gaussfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
228 gaussfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
248 void SetParameters(std::vector<double> params) {
for (
int i=0; i<(int)params.size(); ++i) {
fPeakFunc->SetParameter(i, params[i]); } }
249 void SetParErrors(std::vector<double> errors) {
for (
int i=0; i<(int)errors.size(); ++i) {
fPeakFunc->SetParError(i, errors[i]); } }
258 TF1 *
GetGaussFunc() { TF1 *gaussfunc =
new TF1(
"GaussFunc",
"[0]*(1-[3]/100)*exp(-pow(x-[1],2)/(2*pow([2],2)))",
fLow,
fHigh);
259 gaussfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
260 gaussfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
261 gaussfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
262 gaussfunc->SetParameter(3,
fPeakFunc->GetParameter(3));
281 void SetParameters(std::vector<double> params) {
for (
int i=0; i<(int)params.size(); ++i) {
fPeakFunc->SetParameter(i, params[i]); } }
282 void SetParErrors(std::vector<double> errors) {
for (
int i=0; i<(int)errors.size(); ++i) {
fPeakFunc->SetParError(i, errors[i]); } }
290 TF1 *
GetStepFunc() { TF1 *stepfunc =
new TF1(
"StepFunc",
"[0]*([3]/100)*std::erfc((x-[1])/(sqrt(2)*[2]))",
fLow,
fHigh);
291 stepfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
292 stepfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
293 stepfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
294 stepfunc->SetParameter(3,
fPeakFunc->GetParameter(5));
297 TF1 *
GetGaussFunc() { TF1 *gaussfunc =
new TF1(
"GaussFunc",
"[0]*(1-[3]/100)*exp(-pow(x-[1],2)/(2*pow([2],2)))",
fLow,
fHigh);
298 gaussfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
299 gaussfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
300 gaussfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
301 gaussfunc->SetParameter(3,
fPeakFunc->GetParameter(3));
320 void SetParameters(std::vector<double> params) {
for (
int i=0; i<(int)params.size(); ++i) {
fPeakFunc->SetParameter(i, params[i]); } }
321 void SetParErrors(std::vector<double> errors) {
for (
int i=0; i<(int)errors.size(); ++i) {
fPeakFunc->SetParError(i, errors[i]); } }
330 TF1 *
GetGaussFunc() { TF1 *gaussfunc =
new TF1(
"GaussFunc",
"[0]*(1 - [3]/100 - [4]/100)*exp(-pow(x-[1],2)/(2*pow([2],2)))",
fLow,
fHigh);
331 gaussfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
332 gaussfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
333 gaussfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
334 gaussfunc->SetParameter(3,
fPeakFunc->GetParameter(3));
335 gaussfunc->SetParameter(4,
fPeakFunc->GetParameter(5));
354 void SetParameters(std::vector<double> params) {
for (
int i=0; i<(int)params.size(); ++i) {
fPeakFunc->SetParameter(i, params[i]); } }
355 void SetParErrors(std::vector<double> errors) {
for (
int i=0; i<(int)errors.size(); ++i) {
fPeakFunc->SetParError(i, errors[i]); } }
363 TF1 *
GetStepFunc() { TF1 *stepfunc =
new TF1(
"StepFunc",
"[0]*([3]/100)*std::erfc((x-[1])/(sqrt(2)*[2]))",
fLow,
fHigh);
364 stepfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
365 stepfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
366 stepfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
367 stepfunc->SetParameter(3,
fPeakFunc->GetParameter(7));
370 TF1 *
GetGaussFunc() { TF1 *gaussfunc =
new TF1(
"GaussFunc",
"[0]*(1 - [3]/100 - [4]/100)*exp(-pow(x-[1],2)/(2*pow([2],2)))",
fLow,
fHigh);
371 gaussfunc->SetParameter(0,
fPeakFunc->GetParameter(0));
372 gaussfunc->SetParameter(1,
fPeakFunc->GetParameter(1));
373 gaussfunc->SetParameter(2,
fPeakFunc->GetParameter(2));
374 gaussfunc->SetParameter(3,
fPeakFunc->GetParameter(3));
375 gaussfunc->SetParameter(4,
fPeakFunc->GetParameter(5));
380 BPeak*
FitBPeak(TCanvas *canvas = gPad->GetCanvas(), Option_t *foption=
"", Option_t *option=
"sl");
381 BPeak*
ClickBPeak(TCanvas *canvas = gPad->GetCanvas());
void py(TVirtualPad *canvas)
void px(TVirtualPad *canvas)
virtual double GetWidth()
void SetParameters(std::vector< double > params)
void SetWidthError(double error)
void SetCent(double cent)
virtual double GetAmpError()
void SetParErrors(std::vector< double > errors)
void SetCentError(double error)
void SetParameters(std::vector< double > params)
void SetCent(double cent)
void SetParErrors(std::vector< double > errors)
virtual TF1 * GetStepFunc()
virtual double GetCentError()
virtual double GetWidthError()
virtual void SetAmp(double amp)
OneTailStepGaussianPeak()
void SetCentError(double error)
void SetWidthError(double error)
void SetParameters(std::vector< double > params)
virtual double GetAreaError()
void SetParErrors(std::vector< double > errors)
void SetAmpError(double error)
void SetWidth(double width)
void SetCent(double cent)
void SetCont(TH1 *hist, GamR::TK::Gate peak, std::vector< GamR::TK::Gate > background, Option_t *foption="", Option_t *option="")
void SetWidthError(double error)
void SetCent(double cent)
void SetWidth(double width)
void SetAmpError(double error)
void SetWidthError(double error)
void SetStep(TH1 *hist, GamR::TK::Gate peak, std::vector< GamR::TK::Gate > background, Option_t *foption="", Option_t *option="")
void SetAmpError(double error)
void SetParErrors(std::vector< double > errors)
virtual void SetWidth(double width)
TwoTailStepGaussianPeak()
void SetCentError(double error)
void SetWidth(double width)
void Delete(Option_t *option)
void SetCentError(double error)
virtual void SetAmpError(double error)
void SetAmpError(double error)
virtual void SetCentError(double error)
void SetParameters(std::vector< double > params)
void SetWidth(double width)
void SetCentError(double error)
void SetParErrors(std::vector< double > errors)
void SetWidth(double width)
double operator()(double *x, double *p)
virtual void SetWidthError(double error)
~OneTailStepGaussianPeak()
void SetAmpError(double error)
void SetParErrors(std::vector< double > errors)
BPeak * ClickBPeak(TCanvas *canvas)
virtual void SetCent(double cent)
virtual TF1 * GetGaussFunc()
void SetParameters(std::vector< double > params)
void SetAmpError(double error)
void SetPoint(TH1 *hist, GamR::TK::Gate peak, std::vector< GamR::TK::Gate > background, Option_t *foption="", Option_t *option="")
void SetWidthError(double error)
~TwoTailStepGaussianPeak()
virtual void SetParErrors(std::vector< double > errors)
FPeak(double Low, double High, PeakType Type)
virtual void SetParameters(std::vector< double > params)
void SetCent(double cent)
void SetParameters(std::vector< double > params)
void SetCentError(double error)
BPeak * FitBPeak(TCanvas *canvas, Option_t *foption, Option_t *option)
void SetWidthError(double error)
void SetWidth(double width)
void SetCent(double cent)