#include <CaloEllipse.h>
Public Member Functions | |
void | addPoint (double x, double y) |
CaloEllipse () | |
void | clearPoints () |
double | getEccentricity () const |
Point | getMajorMinorAxes (double sigma=1.0) const |
Point | getPosition () const |
double | getTheta () const |
void | makeCaches () |
void | reset () |
void | resetCaches () |
virtual | ~CaloEllipse () |
Public Attributes | |
double | cachedEccentricity_ |
double | cachedMajor_ |
double | cachedMinor_ |
double | cachedTheta_ |
Private Attributes | |
std::vector< Point > | dataPoints_ |
Definition at line 23 of file CaloEllipse.h.
CaloEllipse::CaloEllipse | ( | ) |
Definition at line 15 of file CaloEllipse.cc.
{ }
CaloEllipse::~CaloEllipse | ( | ) | [virtual] |
Definition at line 20 of file CaloEllipse.cc.
{ }
void pftools::CaloEllipse::addPoint | ( | double | x, |
double | y | ||
) | [inline] |
Definition at line 29 of file CaloEllipse.h.
References dataPoints_, and point.
{ std::pair<double, double> point(x, y); dataPoints_.push_back(point); }
void pftools::CaloEllipse::clearPoints | ( | ) | [inline] |
double CaloEllipse::getEccentricity | ( | ) | const |
Definition at line 87 of file CaloEllipse.cc.
References a, b, getMajorMinorAxes(), AlCaHLTBitMon_ParallelJobs::p, and mathSSE::sqrt().
Referenced by pftools::operator<<().
Point CaloEllipse::getMajorMinorAxes | ( | double | sigma = 1.0 | ) | const |
Definition at line 48 of file CaloEllipse.cc.
References a, b, funct::cos(), dataPoints_, getPosition(), getTheta(), timingPdfMaker::mean, AlCaHLTBitMon_ParallelJobs::p, funct::sin(), mathSSE::sqrt(), makeMuonMisalignmentScenario::sum_xx, makeMuonMisalignmentScenario::sum_yy, theta(), and X.
Referenced by getEccentricity(), makeCaches(), and pftools::operator<<().
{ if (dataPoints_.size() < 2) { return Point(0, 0); } Point mean = getPosition(); PointCit it = dataPoints_.begin(); double sum_xx(0.0); double sum_yy(0.0); double theta = getTheta(); for (; it != dataPoints_.end(); ++it) { const Point& p = *it; double X = cos(theta) * (p.first - mean.first) - sin(theta) * (p.second - mean.second); double Y = sin(theta) * (p.first - mean.first) + cos(theta) * (p.second - mean.second); sum_xx += X * X; sum_yy += Y * Y; } double a = sigma * sqrt(sum_xx / dataPoints_.size()); double b = sigma * sqrt(sum_yy / dataPoints_.size()); double major, minor; if(a > b) { major = a; minor = b; } else { major = b; minor = a; } return Point(major, minor); }
Point CaloEllipse::getPosition | ( | ) | const |
Definition at line 97 of file CaloEllipse.cc.
References dataPoints_, and AlCaHLTBitMon_ParallelJobs::p.
Referenced by getMajorMinorAxes(), getTheta(), and pftools::operator<<().
{ if (dataPoints_.size() < 1) { return Point(0, 0); } double x_tot(0.0); double y_tot(0.0); PointCit it = dataPoints_.begin(); for (; it != dataPoints_.end(); ++it) { const Point& p = *it; x_tot += p.first; y_tot += p.second; } return Point(x_tot / dataPoints_.size(), y_tot / dataPoints_.size()); }
double CaloEllipse::getTheta | ( | ) | const |
Definition at line 23 of file CaloEllipse.cc.
References dataPoints_, getPosition(), timingPdfMaker::mean, AlCaHLTBitMon_ParallelJobs::p, lumiQueryAPI::q, and theta().
Referenced by getMajorMinorAxes(), makeCaches(), and pftools::operator<<().
{ if (dataPoints_.size() < 2) { return 0.0; } PointVector meanAdj; Point mean = getPosition(); double sum_dxdx(0.0); double sum_dydy(0.0); double sum_dxdy(0.0); PointCit it = dataPoints_.begin(); for (; it != dataPoints_.end(); ++it) { const Point& p = *it; Point q(p.first - mean.first, p.second - mean.second); meanAdj.push_back(q); sum_dxdx += q.first * q.first; sum_dydy += q.second * q.second; sum_dxdy += q.first * q.second; } double theta = 0.5 * atan(2.0 * sum_dxdy / (sum_dydy - sum_dxdx)); return theta; }
void CaloEllipse::makeCaches | ( | ) |
Definition at line 123 of file CaloEllipse.cc.
References cachedMajor_, cachedMinor_, cachedTheta_, getMajorMinorAxes(), and getTheta().
Referenced by pftools::CandidateWrapper::recompute().
{ cachedTheta_ = getTheta(); Point axes = getMajorMinorAxes(); cachedMajor_ = axes.first; cachedMinor_ = axes.second; }
void CaloEllipse::reset | ( | void | ) |
Definition at line 130 of file CaloEllipse.cc.
References dataPoints_, and resetCaches().
Referenced by pftools::CandidateWrapper::CandidateWrapper(), and pftools::CandidateWrapper::reset().
{ dataPoints_.clear(); resetCaches(); }
void CaloEllipse::resetCaches | ( | ) |
Definition at line 116 of file CaloEllipse.cc.
References cachedMajor_, cachedMinor_, and cachedTheta_.
Referenced by reset().
{ cachedTheta_ = 0.0; cachedMinor_ = 0.0; cachedMajor_ = 0.0; }
Definition at line 49 of file CaloEllipse.h.
Definition at line 47 of file CaloEllipse.h.
Referenced by makeCaches(), and resetCaches().
Definition at line 48 of file CaloEllipse.h.
Referenced by makeCaches(), and resetCaches().
Definition at line 46 of file CaloEllipse.h.
Referenced by makeCaches(), and resetCaches().
std::vector<Point> pftools::CaloEllipse::dataPoints_ [private] |
Definition at line 59 of file CaloEllipse.h.
Referenced by addPoint(), clearPoints(), getMajorMinorAxes(), getPosition(), getTheta(), and reset().