GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Gw::Peak1D Class Reference

A graphical interface for placing schematic peak onto a 1D histogram with a given position, height and FWHM. More...

#include <Peak1D.h>

Inheritance diagram for Gw::Peak1D:

Public Types

enum  EDrawAs { kPeak, kGate }
 

Public Member Functions

virtual void Area (Option_t *opt="h")
 to get the Area (+bkg) of this peak More...
 
Double_t Bkg (Double_t *x, Double_t *par)
 
virtual TF1 * BkgFunction ()
 Access to signal function ... don't delete it ! More...
 
virtual void Browse (TBrowser *)
 
virtual Bool_t CombinedFlag () const
 Get flag for combined fit. More...
 
virtual Int_t Compare (const TObject *obj) const
 
virtual void Copy (TObject &o) const
 Assignment operator. More...
 
virtual void DisableFit ()
 Set flag off to enable fit of the peak. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Compute distance to object. More...
 
double DoubleSidedCrystalBallFct (double *xx, double *pp)
 Double Sided Crystal Ball Fonction. More...
 
double DoubleTailedGaussian (double *xx, double *pp)
 Double tailed gaussian (Dino like) More...
 
double DoubleTailedStepedGaussian (double *xx, double *pp)
 Double tailed gaussian with step (Dino like) More...
 
virtual void Draw (Option_t *opt="")
 
virtual void EnableFit ()
 Set flag on to enable fit of the peak. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Handle event in pad. More...
 
TF1 * ExtractBkgFromDTGStep (TString Name)
 
virtual void Fit (TH1 *histo, Option_t *optFit="RN", Option_t *optBkg="pol1")
 Fit peak with background. More...
 
virtual void FitCombined (TH1 *histo, TList *peakList, Option_t *optFit="RN", Option_t *optBkg="pol1")
 Fit multi-defined peak with a common background. More...
 
virtual Bool_t FitFlag () const
 Get flag for enable fit. More...
 
void FitMenu (const char *nameFunc="gaus", Option_t *optFit="RN", Option_t *optBkg="pol1")
 Fit with given function and background. More...
 
virtual void FitOn (Bool_t fit_on=true)
 
double Gaus (double *xx, double *pp)
 Gaus Fonction. More...
 
Double_t GetBase () const
 Get base of peakM. More...
 
virtual Double_t GetBinWidth ()
 
Double_t GetBkgIntegral () const
 Get integral of background after calling area method. More...
 
const TVector2 GetBkgLeft () const
 Get background limits. More...
 
const TVector2 GetBkgRight () const
 
virtual UShort_t GetDimension () const
 Get dimension of peak. More...
 
virtual EDrawAs GetDrawAs () const
 to know the current display mode More...
 
virtual Double_t GetFWHM (Option_t *axis="X") const
 Get FWHM of peak. More...
 
GammaSourceRayGetGammaSourceRay ()
 
virtual Double_t GetHeight () const
 Get height of peak. More...
 
virtual Double_t GetIntensity () const
 Get intensity of peak. More...
 
virtual Color_t GetLineColorPeak ()
 Get line peak color. More...
 
virtual TMarker * GetMarker (Int_t markerId)
 Get marker for a given Id. More...
 
Double_t GetPeakIntegral () const
 Get integral of peak after calling area method. More...
 
Double_t GetPeakIntegralError () const
 
virtual Double_t GetPosition (Option_t *axis="X") const
 Get position of peak. More...
 
virtual TF1 * GetSigFunction ()
 Get signal function. More...
 
Double_t GetSubPeakIntegral () const
 Get integral of background under peak after calling area method. More...
 
bool IsAGammaSourceRay ()
 
bool IsDrawAs (EDrawAs mode)
 To test the draw mod ex: IsDrawAs(kGate) More...
 
Short_t IsPointInBkg (Double_t x, Double_t=0)
 to determine if a point is in bg. 0 likely in peak, 1 in bg, 2 outside bg More...
 
virtual Bool_t IsSortable () const
 Sort. More...
 
Bool_t IsWithBkg () const
 Test if peak defined with background. More...
 
double Landau (double *xx, double *pp)
 Landau Fonction. More...
 
virtual void Paint (Option_t *opt="")
 Paint method. More...
 
virtual void PaintFor (Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax)
 set attribute to paint this gate on the given histogram More...
 
 Peak1D ()
 
 Peak1D (const char *name, const char *title)
 
 Peak1D (TPolyLine *polyline)
 
 Peak1D (const Peak1D &p)
 
virtual TF1 * PeakFunction ()
 Access to peak function ... don't delete it ! More...
 
virtual void Print (Option_t *opt="f") const
 Print current peak. More...
 
void SetBackground (Double_t bgLeft1, Double_t bgLeft2, Double_t bgRight1, Double_t bgRight2, Double_t bgLevelLeft1, Double_t bgLevelLeft2, Double_t bgLevelRight1, Double_t bgLevelRight2)
 Set background limits. More...
 
void SetBackground (Double_t bgLeft1, Double_t bgLeft2, Double_t bgRight1, Double_t bgRight2, const TH1 *)
 Set background limits. More...
 
virtual void SetBinWidth (Double_t width)
 BinWidth of the fitted histogram for area correction. More...
 
virtual TF1 * SetBkgFunction (const char *nameFunc="-")
 Set pre-defined function for background during fit. More...
 
virtual TF1 * SetBkgFunction (const TF1 *func)
 Set user defined function for background during fit. More...
 
virtual void SetCombinedFlag (Bool_t flag)
 Set flag for combined fit. More...
 
virtual void SetDrawAs (EDrawAs d)
 Set drawing flag. More...
 
virtual void SetDrawOption (Option_t *option="")
 
void SetEfficiencyFunc (TF1 *f, Float_t EffRelError=0.1)
 
void SetEfficiencyGraph (TGraph *gr, Float_t EffRelError=0.1)
 
virtual void SetFillColorBkg (Color_t color)
 Set line attribute for bkg. More...
 
virtual void SetFillColorPeak (Color_t color)
 Set line attribute for peak. More...
 
virtual void SetFillStyleBkg (Style_t style)
 
virtual void SetFillStylePeak (Style_t style)
 
virtual void SetFWHM (const Double_t FWHM, Option_t *axis="X")
 Set FWHM of peak. More...
 
void SetGammaSourceRay (GammaSourceRay *gsr)
 
void SetHeight (const Double_t height)
 Set height of peak. More...
 
void SetIntensity (const Double_t intensity)
 Set Intensity of peak. More...
 
virtual void SetLineColorBkg (Color_t color)
 
virtual void SetLineColorPeak (Color_t color)
 
virtual void SetLineWidthBkg (Width_t width)
 
virtual void SetLineWidthPeak (Width_t width)
 
void SetMarkerColor (Int_t color)
 Set marker color of the peak polyline. More...
 
void SetPeak (Double_t pos, Double_t height, Double_t fwhm, Double_t intensity=0)
 Set peak members. More...
 
void SetPeakFromFit ()
 Set peak members + polyline. More...
 
void SetPeakIntegralError (Double_t IntErr)
 
virtual void SetPosition (const Double_t position, Option_t *axis="X")
 Set Position of peak. More...
 
void SetRefArea (Float_t a, Float_t ea)
 
virtual TF1 * SetSignalFunction (const char *nameFunc="gaus", TH1 *h=0x0)
 Set pre-defined function to fit the signal. More...
 
virtual TF1 * SetSignalFunction (const TF1 *func)
 Set function to fit the signal. More...
 
Double_t SignalAndBkg (Double_t *x, Double_t *par)
 functions used to really fit More...
 
virtual TF1 * SignalAndBkgFunction ()
 Access to signal+Bkg function. Signa + Bkg must be set first, parameter are copied ! More...
 
virtual TF1 * SignalFunction ()
 Access to signal function ... don't delete it ! More...
 
void WithBkg (Bool_t with_bg=true)
 toggle background (fit and display) More...
 
virtual ~Peak1D ()
 

Static Public Member Functions

static Color_t GetDefaultFuncColor ()
 Get default function color. More...
 
static Color_t GetDefaultMarkerColor ()
 Get default marker color. More...
 
static Int_t GetGateAxis (Color_t co)
 
static Color_t GetGateColor (Int_t idx)
 
static Bool_t IsvalideGateColor (Color_t co)
 
static void SetDefaultFuncColor (Color_t c)
 Set default function color. More...
 
static void SetDefaultMarkerColor (Color_t c)
 Set default marker color. More...
 

Public Attributes

TF1 * fBkgFunc
 
TF1 * fFitCombined
 pointer to signal+ bkg function More...
 
TF1 * fPeakFunc
 
TF1 * fSigFunc
 

Static Public Attributes

static GateColor gGateColor = { kRed-9, kBlue-7, kGreen-8, kYellow-6 }
 

Protected Member Functions

 ClassDef (BasePeak, 1)
 

Protected Attributes

Double_t fBinWidth
 
TPolyLine fCopyPolyline
 current polyline More...
 
TPolyLine * fCPolyline
 
UShort_t fDimension
 dimension of the peak More...
 
EDrawAs fDrawAs
 
GammaSourceRayfGammaSourceRay
 
Double_t fHeight
 height of the Peak More...
 
Double_t fIntensity
 intensity of the peak More...
 
bool fIsAGammaSourceRay
 
Bool_t fIsCombined
 flag to stated peak is part of a combined fit More...
 
Bool_t fIsFitOn
 flag for fitted peak More...
 
LogMessage fLog
 
TList fMarkerList
 current polyline before modification More...
 
TPolyLine fPolyLineBkgL
 
TPolyLine fPolyLineBkgR
 
TPolyLine fPolyLinePeak
 

Static Protected Attributes

static Style_t fgFillStyleBkg = 3001
 
static Style_t fgFillStylePeak = 3004
 
static Color_t fgFuncColor = 26
 
static const Int_t fgkPeakIdx = 3
 
static const Int_t fgkPointsBkg = 4
 
static const Int_t fgkPointsPeak = 7
 pointer to signal+ bkg function More...
 
static Color_t fgLineColorBkg = 39
 
static Color_t fgLineColorPeak []
 
static Color_t fgMarkerColor = 36
 

Detailed Description

A graphical interface for placing schematic peak onto a 1D histogram with a given position, height and FWHM.

Background limits left and right respect to the peak centroid could be placed.

A function (TF1) is associated to the peak, gaussian and landau are pre-defined but the user could defined a customized function based on a TFormula expression (don't use C defined function)

The user could choose between a linear or a quadratic fit in the given windows for the background.

A example for gaussian fit with linear background for gamma ray spectrum (radware spectrum):

// open spectrum with HistoDB class (see this class for details)
db.Open("toto", "rad:$PWD");
TH1F* h = new TH1F();
h->SetName("Eu152.spe");
db >> *h;
h->SetAxisRange(600, 800);
h->Draw();
// set peak
Gw::Peak1D* p = new Gw::Peak1D("PeakName", "PeakTitle");
p->SetPeak(689, 79631, 4.0); // position height and FWHM, first guess
p->SetBackground(640, 650, 712, 728); // set background left and right for lower and upper limits
p->Draw(""); // option "f" fill the peak with the given attribute
// fit the spectrum with the given function and initialize with the parameters of the peak
p->SetFunction("gaus");
p->Fit("lin"); // fit histogram with gaus and linear background functions in the current pad (histogram has to exist)
p->Draw(); // draw peak with new parameters from fit.
Author
Christian Finck

Definition at line 79 of file Peak1D.h.


The documentation for this class was generated from the following files: