StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PeakAna Class Reference
Inheritance diagram for PeakAna:
StFcsPulseAna

Public Member Functions

 PeakAna ()
 Default constructor that always creates a new TGraph.
 
 PeakAna (int size, double *xvals, double *yvals)
 Constructor using array of x and y values with known size.
 
 PeakAna (TGraph *Sig)
 Constructor with a known TGraph.
 
 PeakAna (TH1 *hist)
 Constructor with a histogram, histogram gets converted to graph object.
 
 PeakAna (const PeakAna &OldAna, TGraph *graph=0)
 Copy constructor can be called with a new graph.
 
PeakAnaoperator= (const PeakAna &rhs)
 Assignment operator doesn't clone graph.
 
virtual ~PeakAna ()
 Destructor.
 
virtual void Copy (TObject &obj) const
 Internal method use Clone instead.
 
virtual TObject * Clone (const char *newname) const
 Clones internal graph as opposed to just copying the pointer.
 
virtual void AddPeakStats (TPaveText *pave, const char *opt="")
 Add peak information to a "statistics" box. More...
 
void ConvertPeaksToGraph ()
 same as ConvertPeaksToGraph() but creates a new graph that replaces old one
 
PeakAna ConvertPeaksToAna ()
 same as ConvertPeaksToAna() but returns new PeakAna with same settings without modifying current one
 
virtual void GetPossiblePeaks ()
 Finds all possible Peaks in signal with some criteria. More...
 
virtual Int_t SearchForPeak (const std::vector< PeakWindow > &PossiblePeaks)
 searches a vector of PeakWindow's for a specific peak based on input search criteria More...
 
Int_t SearchForPeak (const std::vector< PeakWindow > &PossiblePeaks, const PeakWindow &search)
 same as SearchForPeak() but and set search criteria using PeakWindow
 
Int_t SearchForPeak (const std::vector< PeakWindow > &PossiblePeaks, Double_t peak, Double_t width)
 same as SearchForPeak() and set search window by peak location and width
 
virtual Int_t AnalyzeForPeak ()
 Main analysis method for finding peaks. More...
 
virtual Int_t AnalyzeForPeak (Double_t peak, Double_t width)
 
virtual Int_t AnalyzeForNoisyPeak ()
 
virtual void MergeByProbability (std::vector< PeakWindow > &newpeaks) const
 Merges peaks in mPeaks using peak probability parameters. More...
 
virtual void MergeByChirality (std::vector< PeakWindow > &newpeaks) const
 
virtual short MergeLeftOrRight (UInt_t index) const
 
Double_t Baseline () const
 
Double_t BaselineSigma () const
 
Double_t BaselineSigmaScale () const
 
Double_t MinX () const
 
Double_t MinY () const
 
Double_t MaxX () const
 
Double_t MaxY () const
 
Double_t SearchPeak () const
 
Double_t SearchWidth () const
 
Double_t TunnelScale () const
 
Double_t TunnelSigma () const
 
Double_t TunnelThreshold () const
 
virtual void Draw (Option_t *opt="")
 Draw method for PeakAna. More...
 
virtual void Paint (Option_t *opt="")
 
PeakAnaPainterGetPainter (Option_t *opt="")
 
void ForceInternal ()
 
PeakAnaGausFilter (Int_t sizeavgs=0, bool copy=true)
 Apply a Gaussian filter to the data. More...
 
bool GoodWindow ()
 Check if found peak is inside mXRangeMin, mYRangeMin, mXRangeMax, mYRangeMax and has logical values.
 
virtual TGraph * GetData () const
 
UInt_t GetDebug () const
 
const PeakWindowGetPeak (UInt_t peakidx) const
 
PeakWindowGetPeak (UInt_t peakidx)
 
UInt_t GetFilter () const
 
Int_t GetFilterScale () const
 
Int_t FoundPeakIndex () const
 
virtual void GetXYMax (Double_t xmin, Double_t xmax)
 Finds and sets mMaxX and mMaxY.
 
Double_t MaxXval ()
 
Double_t MaxYval ()
 
PeakAnaMeanFilter (Int_t sizeavgs=0, bool copy=true)
 Apply a Mean filter to the data. More...
 
int NPeaks () const
 
bool ValidPeakIdx () const
 
Double_t PeakStart ()
 Found Signal starting x-value.
 
Double_t PeakEnd ()
 Found Signal ending x-value.
 
Double_t PeakX ()
 x-value of found signal peak
 
Double_t PeakY ()
 y-value of found signal peak
 
void PeakXY (Double_t &xval, Double_t &yval)
 get peak x, and y value directly by reference
 
bool PeakTunnel (const PeakWindow &window) const
 test whether a given peak satisifies peak tunnel parameters More...
 
Double_t PeakProb (const PeakWindow &window, Double_t scale, Double_t sigma) const
 compute a given PeakWindow probability using internal graph More...
 
virtual void Print (Option_t *opt="") const
 Print peak information.
 
void ResetPeak ()
 Resets values associated with peak finding.
 
void SetDebug (UInt_t level)
 
virtual void SetData (TGraph *graph)
 sets new data for PeakAna More...
 
virtual void SetData (TH1 *hist, UInt_t numavgs=1)
 sets new data for PeakAna using histogram object More...
 
void SetBaseline (Double_t base, Double_t sigma)
 
void SetBaselineSigmaScale (Double_t scale)
 
void SetContinuity (Double_t val)
 
void SetFilter (UInt_t filter, Int_t scale, Double_t sigma=0)
 Set the filter to use when peak finding. More...
 
void SetRange (Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
 Sets the absolute range of the data. More...
 
void SetSearchWindow (Double_t peak, Double_t width)
 Sets peak search parameters. More...
 
void SetTunnelScale (Double_t value)
 
void SetTunnelSigma (Double_t value)
 
void SetTunnelPars (Double_t scale, Double_t sigma)
 
void SetTunnelThreshold (Double_t value)
 
Double_t ChiralityPeakScale () const
 
Double_t ChiralityScale () const
 
Double_t ChiralityProbScale () const
 
Double_t ChiralityThreshold () const
 
void SetChiralityPeakScale (Double_t v)
 
void SetChiralityScale (Double_t v)
 
void SetChiralityProbScale (Double_t v)
 
void SetChiralityThreshold (Double_t v)
 
void SetPeak (const Int_t peakpoint, const Double_t peakx)
 Overwrite peak location in #mFoundpeak. WARNING doesn't set start and end values nor overwrite mComputedIndex.
 
void SetWindow (const Int_t start, const Int_t end)
 Overwrite peak start and end values in mFoundPeak. WARNING doesn't set peak values nor overwrite mComputedIndex.
 
void SetWindow (PeakWindow window)
 Overwrite mFoundPeak with a different PeakWindow. WARNING doesn't overwrite mComputedIndex.
 
Color_t GetLineColor () const
 
Style_t GetLineStyle () const
 
Width_t GetLineWidth () const
 
Color_t GetFillColor () const
 
Style_t GetFillStyle () const
 
Color_t GetMarkerColor () const
 
Size_t GetMarkerSize () const
 
Style_t GetMarkerStyle () const
 
void SetLineColor (Color_t color)
 
void SetLineColorAlpha (Color_t color, Float_t alpha)
 
void SetLineStyle (Style_t style)
 
void SetLineWidth (Width_t width)
 
void SetFillColor (Color_t color)
 
void SetFillColorAlpha (Color_t color, Float_t alpha)
 
void SetFillStyle (Style_t style)
 
void SetMarkerColor (Color_t color=1)
 
void SetMarkerColorAlpha (Color_t color, Float_t alpha)
 
void SetMarkerSize (Size_t size=1)
 
void SetMarkerStyle (Style_t style=1)
 
Color_t GetBaseLineColor () const
 
Style_t GetBaseLineStyle () const
 
Width_t GetBaseLineWidth () const
 
Color_t GetHitLineColor () const
 
Style_t GetHitLineStyle () const
 
Width_t GetHitLineWidth () const
 
void SetBaseLineColor (Color_t color)
 
void SetBaseLineColorAlpha (Color_t color, Float_t alpha)
 
void SetBaseLineStyle (Style_t style)
 
void SetBaseLineWidth (Width_t width)
 
void SetHitLineColor (Color_t color)
 
void SetHitLineColorAlpha (Color_t color, Float_t alpha)
 
void SetHitLineStyle (Style_t style)
 
void SetHitLineWidth (Width_t width)
 
Color_t GetPeakLineColorS (UInt_t peakidx) const
 
Color_t GetPeakLineColorE (UInt_t peakidx) const
 
Style_t GetPeakStyleS (UInt_t peakidx) const
 
Style_t GetPeakStyleE (UInt_t peakidx) const
 
Width_t GetPeakWidthS (UInt_t peakidx) const
 
Width_t GetPeakWidthE (UInt_t peakidx) const
 
Color_t GetFoundPeakLineColorS () const
 
Color_t GetFoundPeakLineColorE () const
 
Style_t GetFoundPeakStyleS () const
 
Style_t GetFoundPeakStyleE () const
 
Width_t GetFoundPeakWidthS () const
 
Width_t GetFoundPeakWidthE () const
 
void SetFoundPeakLineColorS (Color_t s_color)
 
void SetFoundPeakLineColorE (Color_t e_color)
 
void SetFoundPeakLineColor (Color_t s_color, Color_t e_color)
 
void SetFoundPeakStyleS (Style_t s_style)
 
void SetFoundPeakStyleE (Style_t e_style)
 
void SetFoundPeakStyle (Style_t s_style, Style_t e_style)
 
void SetFoundPeakWidthS (Width_t s_width)
 
void SetFoundPeakWidthE (Width_t e_width)
 
void SetFoundPeakWidth (Width_t s_width, Width_t e_width)
 
void SetPeakLineColorS (UInt_t peakidx, Color_t s_color)
 
void SetPeakLineColorE (UInt_t peakidx, Color_t e_color)
 
void SetPeakLineColor (UInt_t peakidx, Color_t s_color, Color_t e_color)
 
void SetPeakLineColorAlphaS (UInt_t peakidx, Color_t s_color, Float_t s_alpha)
 
void SetPeakLineColorAlphaE (UInt_t peakidx, Color_t e_color, Float_t e_alpha)
 
void SetPeakLineColorAlpha (UInt_t peakidx, Color_t s_color, Float_t s_alpha, Color_t e_color, Float_t e_alpha)
 
void SetPeakLineStyleS (UInt_t peakidx, Style_t s_style)
 
void SetPeakLineStyleE (UInt_t peakidx, Style_t e_style)
 
void SetPeakLineStyle (UInt_t peakidx, Style_t s_style, Style_t e_style)
 
void SetPeakLineWidthS (UInt_t peakidx, Width_t s_width)
 
void SetPeakLineWidthE (UInt_t peakidx, Width_t e_width)
 
void SetPeakLineWidth (UInt_t peakidx, Width_t s_width, Width_t e_width)
 
void SetAllPeakLineColor (Color_t s_color, Color_t e_color)
 
void SetAllPeakLineStyle (Style_t s_style, Color_t e_style)
 
void SetAllPeakLineWidth (Width_t s_width, Width_t e_width)
 

Static Public Member Functions

static TGraph * ConvertHistToGraph (TH1 *graph, UInt_t numavgs=1)
 Converts a histogram to a graph. More...
 
static TGraph * ConvertPeaksToGraph (const std::vector< PeakWindow > &Peaks)
 Convert each peak position into a TGraph. More...
 
static PeakAna ConvertPeaksToAna (const PeakAna &Ana)
 same as ConvertPeaksToGraph() but returns a new PeakAna with same settings without modifying old one
 

Protected Member Functions

void Init ()
 Initialize internal varaibles.
 
virtual bool MergeLeft (Double_t leftchir, Double_t thischir, Double_t rightchir) const
 
virtual std::vector< std::pair
< int, int > > 
MergeIndices (std::vector< short > &vec) const
 

Static Protected Member Functions

static double * GaussianMatrix2D (int rx, double sx=0, int ry=0, double sy=0, bool kNorm=true)
 Generates up to a 2D matrix of Gaussian weights. More...
 

Protected Attributes

Int_t mComputedIndex
 Index in mPeaks where a peak was found. More...
 
std::vector< PeakWindowmPeaks
 vector that stores all the found peaks in the data
 
PeakWindow mFoundPeak
 Copy of found peak in mPeaks. More...
 
PeakWindow mSearch
 Variable that defines peak search parameters. More...
 
Double_t mBaseline
 Minimum threshold to search for a peak. More...
 
Double_t mBaselineSigma
 Error on PeakAna::mBaseline. More...
 
Double_t mBaselineSigmaScale
 scale on PeakAna::mBaselineSigma to determine final threshold More...
 
Double_t mMaxX
 x-value where global maximum occurs
 
Double_t mMaxY
 y-value of global maximum
 
Double_t mDeltaX
 graph known delta-x More...
 
TGraph * mG_Data
 TGraph that stores the x,y data. More...
 
Double_t mXRangeMin
 Absolute possible x-value minimum of data.
 
Double_t mXRangeMax
 Absolute possible x-value maximum of data.
 
Double_t mYRangeMin
 Absolute possible y-value minimum of data.
 
Double_t mYRangeMax
 Absolute possible y-value maximum of data.
 
Double_t mTunnelScale
 Scale on exponential for determining tunneling probability (default is 1) see #PeakWindow::PeakTunelProb()
 
Double_t mTunnelSigma
 Sigma for Gaussian for determining tunneling probability (default is 1) see #PeakWindow::PeakTunelProb()
 
Double_t mTunnelThreshold
 Cutoff probability for peak tunneling method. If threshold less than 0 (default) then skip peak tunnel method, see PeakTunnel()
 
Double_t mChiralityPeakScale
 
Double_t mChiralityScale
 
Double_t mChiralityProbScale
 
Double_t mChiralityThreshold
 
UInt_t mFilter
 Filter to use in AnalyzeForPeak() More...
 
Double_t * mFilterWeights
 Array of weights to use in filtering, size is 2*mFilterScale+1.
 
Int_t mFilterScale
 How many points to group together when applying filter.
 
PeakAnaPaintermPainter
 Painter for this class.
 
TString mOption
 Drawing option.
 

Detailed Description

Definition at line 94 of file PeakAna.h.

Member Function Documentation

void PeakAna::AddPeakStats ( TPaveText *  pave,
const char *  opt = "" 
)
virtual

Add peak information to a "statistics" box.

"statistics" box can be a TPaveText or a TPaveStats since the latter inherits from the former.

Parameters
paveTPaveText to write peak information
optoptions for what information to add to stats box
"" (No option) means just show found peak "a" means show all found peaks "d" means show all detail information for the peak

Definition at line 1010 of file PeakAna.cxx.

References AnalyzeForPeak(), GetData(), GetPeak(), mComputedIndex, mPeaks, NPeaks(), TunnelScale(), and TunnelSigma().

Referenced by PeakAnaPainter::PaintStats().

Int_t PeakAna::AnalyzeForPeak ( )
virtual
Double_t PeakAna::Baseline ( ) const
inline
Double_t PeakAna::BaselineSigma ( ) const
inline
Double_t PeakAna::BaselineSigmaScale ( ) const
inline
TGraph * PeakAna::ConvertHistToGraph ( TH1 *  graph,
UInt_t  numavgs = 1 
)
static

Converts a histogram to a graph.

Treats each bin in the histogram as a point in a TGraph and the bin content as the y-value. Also, can be used to do a running average over "numavgs" bins

Parameters
graphhistogram to be converted to a graph
numavgsnumber of bins to average over when creating the graph (running average), 1 means no running average
Returns
TGraph with bin data as points

Definition at line 382 of file PeakAna.cxx.

Referenced by PeakAna(), and SetData().

TGraph * PeakAna::ConvertPeaksToGraph ( const std::vector< PeakWindow > &  Peaks)
static

Convert each peak position into a TGraph.

The purpose of this function is to help with really noisy data where the "peaks" are really just noise. Essentially the idea is that each "peak" should actually be a point on a kind of "running average" in this way you capture the overall shape of the data without noise.

Parameters
Peaksvector of PeakWindows to convert to a TGraph
Returns
TGraph with each peak in "Peaks" as a point

Definition at line 401 of file PeakAna.cxx.

void PeakAna::Draw ( Option_t *  opt = "")
virtual

Draw method for PeakAna.

Options are semicolon seperated list with graph options first then the peak qa drawing options and finally the stats box drawing option.
peak qa drawing options(case insensitive):

  • "R" for range
  • "B" for baselines
  • "F" found peak window
  • "P" for all peak windows
  • "M" for found peak marker
  • "W" for all peak markers (upside down M)
  • "E" combines "P" and "W"
  • "A" for all, which combines "B", "P", and "W"
    stats drawing options(case insensitive):
  • "S" is to show just the found peak
  • "A" is to show for all peaks
  • "D" is whether to show detailed printout or not (works with option "S" or "A")

Example1: "APL;FB;S" means draw graph using option "APL", draw only found peak qa and baselines, and create a stats box showing only basic information about the found peak. Example2: ";A;AD" means don't draw graph but draw all peaks and put detailed information of all peaks in a stats box Example3: "PL;A" means draw graph with option "PL" and draw all peaks but don't draw a stats box

Definition at line 984 of file PeakAna.cxx.

Referenced by StFcsWaveformFitMaker::drawFitter().

Int_t PeakAna::FoundPeakIndex ( ) const
inline
PeakAna * PeakAna::GausFilter ( Int_t  sizeavgs = 0,
bool  copy = true 
)

Apply a Gaussian filter to the data.

Applies a Gaussian filter by sampling "sizeavgs" and Gaussian weights stored in mFilterWeights.

Parameters
sizeavgsnumber of points to sample during filtering
copyif copy is true returns a new PeakAna with Gaussian filtered data, if false modifies "this" object
Returns
new PeakAna object if copy=true or "this" object if false

Definition at line 518 of file PeakAna.cxx.

References Baseline(), GetData(), GetDebug(), mDeltaX, mFilterWeights, PeakAna(), ResetPeak(), and SetData().

Referenced by AnalyzeForPeak().

double * PeakAna::GaussianMatrix2D ( int  rx,
double  sx = 0,
int  ry = 0,
double  sy = 0,
bool  kNorm = true 
)
staticprotected

Generates up to a 2D matrix of Gaussian weights.

Generates Gaussian weights to use in Gaussian filtering in a flattened 2D matrix.

Parameters
rxnumber of columns to generate weights
sxsigma of Gaussian to use in column weights
rynumber of rows to generate weights
sysigma of Gaussian to use in row weights
kNormif true use a normalized Gaussian i.e. sum of all weights=1
Returns
1D array containing weights

Definition at line 1248 of file PeakAna.cxx.

Referenced by SetFilter().

virtual TGraph* PeakAna::GetData ( ) const
inlinevirtual
UInt_t PeakAna::GetDebug ( ) const
inline
UInt_t PeakAna::GetFilter ( ) const
inline
Returns
mFilter

Definition at line 230 of file PeakAna.h.

References mFilter.

Int_t PeakAna::GetFilterScale ( ) const
inline
Returns
mFilterScale

Definition at line 231 of file PeakAna.h.

References mFilterScale.

const PeakWindow& PeakAna::GetPeak ( UInt_t  peakidx) const
inline
PeakWindow& PeakAna::GetPeak ( UInt_t  peakidx)
inline
Returns
peak at index peakidx

Definition at line 229 of file PeakAna.h.

References mPeaks.

void PeakAna::GetPossiblePeaks ( )
virtual

Finds all possible Peaks in signal with some criteria.

Uses a second derivative test to find all peaks in the data. Found peaks must be above the baseline, and the slope must change by mBaseline+mBaselineSigma*mBaselineSigmaScale. These values can be set with the appropriate function calls. Also, checks each peak's probability and merges peaks below some threshold if set.
Called by AnalyzeForPeak();

Definition at line 640 of file PeakAna.cxx.

References Baseline(), BaselineSigma(), BaselineSigmaScale(), PeakWindow::Combine(), GetDebug(), mDeltaX, PeakWindow::mEndX, PeakWindow::mEndY, mG_Data, PeakWindow::mP_Peak, mPeaks, PeakWindow::mPeakX, PeakWindow::mPeakY, PeakWindow::mStartX, PeakWindow::mStartY, mTunnelScale, mTunnelSigma, mXRangeMax, mXRangeMin, mYRangeMax, mYRangeMin, PeakTunnel(), PeakWindow::PeakTunnelProb(), PeakWindow::Print(), PeakWindow::Reset(), and PeakWindow::SetPeak().

Referenced by AnalyzeForPeak().

Double_t PeakAna::MaxX ( ) const
inline
Double_t PeakAna::MaxXval ( )
inline
Returns
mMaxX

Definition at line 235 of file PeakAna.h.

References GetXYMax(), mMaxX, mXRangeMax, and mXRangeMin.

Double_t PeakAna::MaxY ( ) const
inline
Double_t PeakAna::MaxYval ( )
inline
Returns
mMaxY

Definition at line 236 of file PeakAna.h.

References GetXYMax(), mMaxY, mXRangeMax, mXRangeMin, and mYRangeMin.

PeakAna * PeakAna::MeanFilter ( Int_t  sizeavgs = 0,
bool  copy = true 
)

Apply a Mean filter to the data.

Applies a Mean filter by sampling "sizeavgs"

Parameters
sizeavgsnumber of points to sample during filtering
copyif copy is true returns a new PeakAna with Mean filtered data, if false modifies "this" object
Returns
new PeakAna object if copy=true or "this" object if false

Definition at line 435 of file PeakAna.cxx.

References Baseline(), GetData(), GetDebug(), mDeltaX, mFilterWeights, PeakAna(), ResetPeak(), and SetData().

Referenced by AnalyzeForPeak().

void PeakAna::MergeByProbability ( std::vector< PeakWindow > &  newpeaks) const
virtual

Merges peaks in mPeaks using peak probability parameters.

It is intended to be used after calling AnalyzeForPeak() since it doesn't do this by itself.

Parameters
newpeaksvector to store merged peaks

Reimplemented in StFcsPulseAna.

Definition at line 792 of file PeakAna.cxx.

References mG_Data, mPeaks, mTunnelScale, mTunnelSigma, and PeakTunnel().

Double_t PeakAna::MinX ( ) const
inline
Returns
mXRangeMin

Definition at line 181 of file PeakAna.h.

References mXRangeMin.

Referenced by PeakAnaPainter::PaintBaselines().

Double_t PeakAna::MinY ( ) const
inline
Returns
mYRangeMin

Definition at line 182 of file PeakAna.h.

References mYRangeMin.

Referenced by PeakAnaPainter::PaintFoundPeakRange(), and PeakAnaPainter::PaintPeakRanges().

int PeakAna::NPeaks ( ) const
inline
Double_t PeakAna::PeakProb ( const PeakWindow window,
Double_t  scale,
Double_t  sigma 
) const

compute a given PeakWindow probability using internal graph

Evaluates a given PeakWindow's prbability using internal graph and external parameters for the probability function

Parameters
windowPeakWindow to compute probability
scalex-value scale for probability, see mTunnelScale
sigmay-value scale for probability, see mTunnelSigma
Returns
computed probability

Definition at line 635 of file PeakAna.cxx.

References mG_Data, and PeakWindow::PeakTunnelProb().

bool PeakAna::PeakTunnel ( const PeakWindow window) const

test whether a given peak satisifies peak tunnel parameters

Evaluates a PeakWindow's probability with function parameters stored in this class, and the internal graph object.

Parameters
windowPeakWindow to be evaluated
Returns
true if peak probability>mTunnelThreshold, false otherwise

Definition at line 619 of file PeakAna.cxx.

References GetDebug(), mG_Data, mTunnelScale, mTunnelSigma, mTunnelThreshold, and PeakWindow::PeakTunnelProb().

Referenced by GetPossiblePeaks(), StFcsPulseAna::MergeByProbability(), and MergeByProbability().

Int_t PeakAna::SearchForPeak ( const std::vector< PeakWindow > &  PossiblePeaks)
virtual

searches a vector of PeakWindow's for a specific peak based on input search criteria

Search criteria is stored in mSearch where the #mStartX is the peak location to search for and #mEndX is the tolerance (width) around which the peak should be found.
Called by AnalyzeForPeak() on mPeaks

Parameters
PossiblePeaksvector of peaks to search
Returns
index in mPeaks of found peak that matched search criteria

Definition at line 741 of file PeakAna.cxx.

References GetDebug(), PeakWindow::mEndX, mSearch, and PeakWindow::mStartX.

Referenced by StFcsPulseAna::AnalyzeForPeak(), AnalyzeForPeak(), and SearchForPeak().

Double_t PeakAna::SearchPeak ( ) const
inline
Returns
expected peak location for searching

Definition at line 185 of file PeakAna.h.

References mSearch, and PeakWindow::mStartX.

Referenced by Copy().

Double_t PeakAna::SearchWidth ( ) const
inline
Returns
width from expected peak location to search

Definition at line 186 of file PeakAna.h.

References PeakWindow::mEndX, and mSearch.

Referenced by Copy().

void PeakAna::SetBaseline ( Double_t  base,
Double_t  sigma 
)
void PeakAna::SetBaselineSigmaScale ( Double_t  scale)
Parameters
scalesets mBaselineSigmaScale

Definition at line 337 of file PeakAna.cxx.

References mBaselineSigmaScale.

Referenced by StFcsWaveformFitMaker::InitFitter().

void PeakAna::SetContinuity ( Double_t  val)
inline
Parameters
valsets mDeltaX

Definition at line 293 of file PeakAna.h.

References mDeltaX.

Referenced by StFcsWaveformFitMaker::InitFitter().

void PeakAna::SetData ( TGraph *  graph)
virtual

sets new data for PeakAna

This will change mG_Data to the graph object passed in and calls ResetPeak(). Since graph is passed as external parameter this means this object should not delete it in the future so #mInternalSignal is set to false. If you want to change this behavior so this class deletes mG_Data call #ForceInternal()

Parameters
graphsets mG_Data

Definition at line 302 of file PeakAna.cxx.

References mG_Data, and ResetPeak().

Referenced by ConvertPeaksToGraph(), GausFilter(), StFcsWaveformFitMaker::gausFit(), MeanFilter(), StFcsWaveformFitMaker::PedFitPulseFit(), StFcsWaveformFitMaker::PulseFit1(), StFcsWaveformFitMaker::PulseFit2(), StFcsWaveformFitMaker::PulseFitAll(), and StFcsPulseAna::ResetFinder().

void PeakAna::SetData ( TH1 *  hist,
UInt_t  numavgs = 1 
)
virtual

sets new data for PeakAna using histogram object

Works like SetData() but first calls ConvertHistToGraph() to convert a histogram to a graph. Since it creates a new graph #mInternalSignal is set to true so that the new graph gets deleted properly. The second argument can be used to do a running average over 'numavgs' number of bins.

Parameters
histhistogram to use as graph data
numavgscontrols how many bins you want to average over when creating graph (1 means no average)

Definition at line 311 of file PeakAna.cxx.

References ConvertHistToGraph(), mG_Data, and ResetPeak().

void PeakAna::SetDebug ( UInt_t  level)
inline
void PeakAna::SetFilter ( UInt_t  filter,
Int_t  scale,
Double_t  sigma = 0 
)

Set the filter to use when peak finding.

There are two filters that can be used: a Mean filter which just averages over small samples of the data at a time, and a Gaussian filter which does a weighted average over the data samples, where the weights resemble a Gaussian function see GaussianMatrix2D(). The data sample averaging size is determined by mFilterScale. Note that a filter does not alter the size of the data.

Parameters
filtersets mFilter (0=none, 1=Mean, 2=Gaussian)
scalesets mFilterScale (number of points to group together when filtering)
sigmasigma of Gaussian to use to compute mFilterWeights (0 means sigma=mFilterScale/2)

Definition at line 320 of file PeakAna.cxx.

References GaussianMatrix2D(), mFilter, mFilterScale, and mFilterWeights.

void PeakAna::SetRange ( Double_t  xmin,
Double_t  ymin,
Double_t  xmax,
Double_t  ymax 
)

Sets the absolute range of the data.

This sets the varaibles that tell the finder the range of x,y values possible for the data. This kind of range is needed for the algorithm to work properly since it only checks for peaks inside that range.

Parameters
xminsets mXRangeMin
yminsets mYRangeMin
xmaxsets mXRangeMax
ymaxsets mYRangeMax

Definition at line 342 of file PeakAna.cxx.

References mXRangeMax, mXRangeMin, mYRangeMax, and mYRangeMin.

Referenced by StFcsWaveformFitMaker::InitFitter().

void PeakAna::SetSearchWindow ( Double_t  peak,
Double_t  width 
)

Sets peak search parameters.

This function is needed if you want to pick/check out a particular peak in the vector of #PeakWindows. It allows you to set the x-value of where you expect or want a peak and how far from that ideal position (width) you would like to check for a peak.

Parameters
peakx-location where you expect or want a peak
widthhow far in x you expect or want a peak from the ideal position of "peak"

Definition at line 349 of file PeakAna.cxx.

References mSearch, ResetPeak(), and PeakWindow::SetWindow().

Referenced by StFcsWaveformFitMaker::InitFitter(), and SearchForPeak().

void PeakAna::SetTunnelPars ( Double_t  scale,
Double_t  sigma 
)
Parameters
scalesets mTunnelScale
sigmasets mTunnelSigma

Definition at line 371 of file PeakAna.cxx.

References SetTunnelScale(), and SetTunnelSigma().

void PeakAna::SetTunnelScale ( Double_t  value)
Parameters
valuesets mTunnelScale

Definition at line 363 of file PeakAna.cxx.

References mTunnelScale.

Referenced by SetTunnelPars(), and StFcsWaveformFitMaker::SetupDavidFitterMay2022().

void PeakAna::SetTunnelSigma ( Double_t  value)
Parameters
valuesets mTunnelSigma

Definition at line 367 of file PeakAna.cxx.

References mTunnelSigma.

Referenced by SetTunnelPars(), and StFcsWaveformFitMaker::SetupDavidFitterMay2022().

void PeakAna::SetTunnelThreshold ( Double_t  value)
Parameters
valuesets mTunnelThreshold

Definition at line 376 of file PeakAna.cxx.

References mTunnelThreshold.

Referenced by StFcsWaveformFitMaker::SetupDavidFitterMay2022().

Double_t PeakAna::TunnelScale ( ) const
inline
Returns
mTunnelScale

Definition at line 187 of file PeakAna.h.

References mTunnelScale.

Referenced by AddPeakStats().

Double_t PeakAna::TunnelSigma ( ) const
inline
Returns
mTunnelSigma

Definition at line 188 of file PeakAna.h.

References mTunnelSigma.

Referenced by AddPeakStats().

Double_t PeakAna::TunnelThreshold ( ) const
inline
Returns
mTunnelThreshold

Definition at line 189 of file PeakAna.h.

References mTunnelThreshold.

bool PeakAna::ValidPeakIdx ( ) const
Returns
true if 0<= mComputedIndex < mPeaks.size(), false otherwise

Definition at line 204 of file PeakAna.cxx.

References mComputedIndex, and mPeaks.

Referenced by StFcsWaveformFitMaker::gausFit().

Member Data Documentation

Double_t PeakAna::mBaseline
protected

Minimum threshold to search for a peak.

Threshold for peak start and end values meaning y-value must exceed this variable to even check if it contains a peak. y-values below this variable will be ignored. This defines the noise level

Definition at line 456 of file PeakAna.h.

Referenced by StFcsPulseAna::AnalyzeForPedestal(), Baseline(), Copy(), StFcsPulseAna::FindBaseline(), Init(), StFcsPulseAna::Print(), Print(), StFcsPulseAna::ResetBaseline(), and SetBaseline().

Double_t PeakAna::mBaselineSigma
protected

Error on PeakAna::mBaseline.

This is used to characterize how much noise there is. It will be used with PeakAna::mBaseline to determine the threshold y-value for the data. It effectively sets the resolution of the finder. This is the standard deviation (sigma) around the baseline for ADCs (Also used as a threshold for the hit) error in baseline (fabs in case sigma is negative), //The sigma will determine the threshold value above baseline('value') i.e. the resolution of the finder

Definition at line 463 of file PeakAna.h.

Referenced by StFcsPulseAna::AnalyzeForPedestal(), BaselineSigma(), Copy(), StFcsPulseAna::FindBaseline(), Init(), StFcsPulseAna::Print(), Print(), StFcsPulseAna::ResetBaseline(), and SetBaseline().

Double_t PeakAna::mBaselineSigmaScale
protected

scale on PeakAna::mBaselineSigma to determine final threshold

This is a multiplicative factor on PeakAna::mBaselineSigma that is used to determine the final thresholds on the y-value and slope to start the second derivative test in GetPossiblePeaks(). This "hit" threshold is PeakAna::mBaseline + PeakAna::mBaselineSigma * PeakAna::mBaselineSigmaScale. The default is 4. This threshold also applies to the first positive slope to prevent finding data with small changes as potential peaks.

Definition at line 469 of file PeakAna.h.

Referenced by BaselineSigmaScale(), Copy(), Init(), and SetBaselineSigmaScale().

Int_t PeakAna::mComputedIndex
protected

Index in mPeaks where a peak was found.

This variables is negative if AnalyzeForPeak() was not called.
It is equal to size of mPeaks if AnalyzeForPeak() was called but no peak was found.
All other times it equals the index in mPeaks where the peak was found. The found peak is also stored in mFoundPeak.
This makes it easy to tell whether AnalyzeForPeak() was called and whether or not a peak was found.

Definition at line 436 of file PeakAna.h.

Referenced by AddPeakStats(), StFcsPulseAna::AnalyzeForPeak(), AnalyzeForPeak(), StFcsPulseAna::Clone(), Clone(), FoundPeakIndex(), GoodWindow(), Init(), PeakEnd(), PeakStart(), PeakX(), PeakXY(), PeakY(), ResetPeak(), and ValidPeakIdx().

Double_t PeakAna::mDeltaX
protected

graph known delta-x

Set this value if you know how far apart each x point in the data/graph needs to be. This way the finder can handle discontinuities (i.e. each adjacent point is not a fixed x-distance) in the actual data. Default is -1, which means don't check continuity.

Definition at line 478 of file PeakAna.h.

Referenced by Copy(), GausFilter(), GetPossiblePeaks(), Init(), MeanFilter(), and SetContinuity().

UInt_t PeakAna::mFilter
protected

Filter to use in AnalyzeForPeak()

see SetFilter(). Note that filters do not change the size of the data

  • 0 = No Filter (default)
  • 1 = Mean Filter
  • 2 = Gauss Filter/Blur

Definition at line 509 of file PeakAna.h.

Referenced by AnalyzeForPeak(), Copy(), GetFilter(), Init(), and SetFilter().

PeakWindow PeakAna::mFoundPeak
protected

Copy of found peak in mPeaks.

This gets set after SearchForPeak() is called and finds a peak with given search parameters. It is separate for ease of access and so it can be overwritten for testing and debugging purposes

Definition at line 444 of file PeakAna.h.

Referenced by StFcsPulseAna::AnalyzeForPeak(), AnalyzeForPeak(), StFcsPulseAna::Clone(), Clone(), GoodWindow(), Init(), StFcsPulseAna::MBFit(), PeakEnd(), PeakStart(), PeakX(), PeakXY(), PeakY(), StFcsPulseAna::Print(), Print(), ResetPeak(), SetPeak(), SetWindow(), and StFcsPulseAna::SignalMBPars().

TGraph* PeakAna::mG_Data
protected

TGraph that stores the x,y data.

This graph object will not be deleted by this class unless #PeakAna::mInternalSiganl=true A TGraph is used because it is easier to process but may want to change to dynamic arrays for speed??

Definition at line 485 of file PeakAna.h.

Referenced by StFcsPulseAna::GausFit(), StFcsPulseAna::GetData(), GetData(), GetPossiblePeaks(), GetXYMax(), Init(), StFcsPulseAna::MBFit(), StFcsPulseAna::MergeByProbability(), MergeByProbability(), operator=(), PeakAna(), PeakProb(), PeakTunnel(), PeakX(), PeakXY(), PeakY(), Print(), StFcsPulseAna::PulseFit(), SetData(), StFcsPulseAna::Sum(), and ~PeakAna().

PeakWindow PeakAna::mSearch
protected

Variable that defines peak search parameters.

The values are stored in a PeakWindow object but only PeakWindow::mStartX is used for the peak location and PeakWindow::mEndX is used for the width. The width represents the +- window from PeakWindow::mStartX to look for a peak. This is used by SearchForPeak(). Default is peak at 0 with a width of 1.

Definition at line 450 of file PeakAna.h.

Referenced by Init(), StFcsPulseAna::Print(), Print(), SearchForPeak(), SearchPeak(), SearchWidth(), and SetSearchWindow().


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