QCurveCrawler Class Reference

Inheritance diagram for QCurveCrawler:

QObject

List of all members.


Detailed Description

Class to find curves in a scatter plot.

Author:
L. Kogler This class can identify a curve in a scatter plot by crawling along the regions of highest density from a given starting point. It can be used for setting pulse shape cuts based on scatter plots.

Public Member Functions

 QCurveCrawler ()
 default constructor
 QCurveCrawler (const QCurveCrawler &orig)
 copy constructor
 QCurveCrawler (double xMin, double xMax=10000, double StepSize=300, int MinPointsPerStep=15)
 General constructor.
virtual ~QCurveCrawler ()
 destructor
void SetXMax (double xMax)
 Set maximum x value.
void SetXMin (double xMin)
 Set minimum x value.
void SetStepSize (double StepSize)
 Set step size.
std::vector< LineSegment > GetLineSegments ()
 Get vector of line segments representing the curve.
void SetMinPointsPerStep (int MinPointsPerStep)
 Set minimum points per step.
std::vector< TGraph * > Crawl (const std::vector< double > &xVals, const std::vector< double > &yVals)
 Execute crawling algorithm on data provided.
int Crop (std::vector< double > &xVals, std::vector< double > &yVals, double nMedianDeviations, bool UseFractionalDeviation=true)
 Delete elements more than a given distance from curve.
std::vector< double > GetYDeviations (const std::vector< double > &xVals, const std::vector< double > &yVals)
 Get deviation dy from each point to the curve crawler line.
TGraph * Spline (const std::vector< double > &xVals, const std::vector< double > &yVals, TGraph *&grKnots)
 Perform a polynomial interpolation of data and produce a TSpline.
void Print ()
 Prints line segment info to screen.

Private Member Functions

TGraph * DoFit (std::vector< double > &vx, std::vector< double > &vy, double x0, double y0, LineSegment &seg, double prev_theta)
 Fits a line to the data by scanning the angle theta.

Private Attributes

std::vector< LineSegment > fSegments
 Vector of line segments to follow the curve.
double fxMin
 Parameters for curve crawling algorithm.
double fxMax
double fStepSize
unsigned int fMinPointsPerStep

Constructor & Destructor Documentation

QCurveCrawler::QCurveCrawler ( const QCurveCrawler orig  ) 

copy constructor

Parameters:
orig original QCurveCrawler

QCurveCrawler::QCurveCrawler ( double  xMin,
double  xMax = 10000,
double  StepSize = 300,
int  MinPointsPerStep = 15 
)

General constructor.

Parameters:
xMin minimum x value to consider
xMax maximum x value
StepSize size of steps to take when crawling along curve (units of x)
MinPointsPerStep minimum number of points per step

References fxMin.


Member Function Documentation

std::vector<TGraph*> QCurveCrawler::Crawl ( const std::vector< double > &  xVals,
const std::vector< double > &  yVals 
)

Execute crawling algorithm on data provided.

Parameters:
xVals 
yVals 
Returns:
number of steps taken

Referenced by MSetOBChiSquareCuts::Done(), and Spline().

int QCurveCrawler::Crop ( std::vector< double > &  xVals,
std::vector< double > &  yVals,
double  nMedianDeviations,
bool  UseFractionalDeviation = true 
)

Delete elements more than a given distance from curve.

Parameters:
xVals 
yVals 
nMedianDeviations cut all points farther than this many median deviations from the curve-crawler line

Referenced by MSetOBChiSquareCuts::Done().

vector< double > QCurveCrawler::GetYDeviations ( const std::vector< double > &  xVals,
const std::vector< double > &  yVals 
)

Get deviation dy from each point to the curve crawler line.

Parameters:
xVals 
yVals 
devs 
Returns:
vector of dy for each point

References fSegments.

TGraph * QCurveCrawler::Spline ( const std::vector< double > &  xVals,
const std::vector< double > &  yVals,
TGraph *&  grKnots 
)

Perform a polynomial interpolation of data and produce a TSpline.

Parameters:
xVals 
yVals 
Returns:
TSpline approximating the data

References Crawl(), and fSegments.

TGraph* QCurveCrawler::DoFit ( std::vector< double > &  vx,
std::vector< double > &  vy,
double  x0,
double  y0,
LineSegment &  seg,
double  prev_theta 
) [private]

Fits a line to the data by scanning the angle theta.

Parameters:
x array of x points
y array of y points
x0 the origin -- line is constrained to pass through this point
y0 the origin -- line is constrained to pass through this point
seg a LineSegment struct to hold the fit info
prev_theta Fit is weighted toward angle of previous fit in order to discourage sudden changes of direction


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

Generated on Tue Nov 16 10:50:05 2010 for CUORE Software by  doxygen 1.5.6