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 |
QCurveCrawler::QCurveCrawler | ( | const QCurveCrawler & | orig | ) |
QCurveCrawler::QCurveCrawler | ( | double | xMin, | |
double | xMax = 10000 , |
|||
double | StepSize = 300 , |
|||
int | MinPointsPerStep = 15 | |||
) |
General constructor.
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.
std::vector<TGraph*> QCurveCrawler::Crawl | ( | const std::vector< double > & | xVals, | |
const std::vector< double > & | yVals | |||
) |
Execute crawling algorithm on data provided.
xVals | ||
yVals |
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.
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.
xVals | ||
yVals | ||
devs |
References fSegments.
TGraph * QCurveCrawler::Spline | ( | const std::vector< double > & | xVals, | |
const std::vector< double > & | yVals, | |||
TGraph *& | grKnots | |||
) |
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.
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 |