CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
pftools::CaloEllipse Class Reference

#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< PointdataPoints_
 

Detailed Description

Definition at line 23 of file CaloEllipse.h.

Constructor & Destructor Documentation

CaloEllipse::CaloEllipse ( )

Definition at line 15 of file CaloEllipse.cc.

15  {
16 
17 
18 }
CaloEllipse::~CaloEllipse ( )
virtual

Definition at line 20 of file CaloEllipse.cc.

20  {
21 
22 }

Member Function Documentation

void pftools::CaloEllipse::addPoint ( double  x,
double  y 
)
inline

Definition at line 29 of file CaloEllipse.h.

References dataPoints_, and point.

29  {
30  std::pair<double, double> point(x, y);
31  dataPoints_.push_back(point);
32  }
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void pftools::CaloEllipse::clearPoints ( )
inline

Definition at line 34 of file CaloEllipse.h.

References dataPoints_, getEccentricity(), getMajorMinorAxes(), getPosition(), and getTheta().

34  {
35  dataPoints_.clear();
36  }
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
double CaloEllipse::getEccentricity ( ) const

Definition at line 87 of file CaloEllipse.cc.

References a, b, getMajorMinorAxes(), AlCaHLTBitMon_ParallelJobs::p, and mathSSE::sqrt().

Referenced by clearPoints(), and pftools::operator<<().

87  {
89  double a = p.first;
90  double b = p.second;
91  if(a == 0)
92  return 0;
93  double ecc = sqrt((a * a - b * b) / (a * a));
94  return ecc;
95 }
Point getMajorMinorAxes(double sigma=1.0) const
Definition: CaloEllipse.cc:48
T sqrt(T t)
Definition: SSEVec.h:18
double b
Definition: hdecay.h:120
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
double a
Definition: hdecay.h:121
Point CaloEllipse::getMajorMinorAxes ( double  sigma = 1.0) const

Definition at line 48 of file CaloEllipse.cc.

References a, b, funct::cos(), dataPoints_, getPosition(), getTheta(), SiStripPI::mean, AlCaHLTBitMon_ParallelJobs::p, funct::sin(), mathSSE::sqrt(), makeMuonMisalignmentScenario::sum_xx, makeMuonMisalignmentScenario::sum_yy, theta(), X, and DOFs::Y.

Referenced by clearPoints(), getEccentricity(), makeCaches(), and pftools::operator<<().

48  {
49 
50  if (dataPoints_.size() < 2) {
51  return Point(0, 0);
52  }
53 
55 
56  PointCit it = dataPoints_.begin();
57  double sum_xx(0.0);
58  double sum_yy(0.0);
59  double theta = getTheta();
60 
61  for (; it != dataPoints_.end(); ++it) {
62  const Point& p = *it;
63  double X = cos(theta) * (p.first - mean.first) - sin(theta) * (p.second
64  - mean.second);
65  double Y = sin(theta) * (p.first - mean.first) + cos(theta) * (p.second
66  - mean.second);
67  sum_xx += X * X;
68  sum_yy += Y * Y;
69  }
70 
71  double a = sigma * sqrt(sum_xx / dataPoints_.size());
72  double b = sigma * sqrt(sum_yy / dataPoints_.size());
73 
74  double major, minor;
75 
76  if(a > b) {
77  major = a;
78  minor = b;
79  } else {
80  major = b;
81  minor = a;
82  }
83 
84  return Point(major, minor);
85 }
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
#define X(str)
Definition: MuonsGrabber.cc:48
std::pair< double, double > Point
Definition: CaloEllipse.h:18
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double getTheta() const
Definition: CaloEllipse.cc:23
double b
Definition: hdecay.h:120
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
double a
Definition: hdecay.h:121
PointVector::const_iterator PointCit
Definition: CaloEllipse.h:20
Point getPosition() const
Definition: CaloEllipse.cc:97
Point CaloEllipse::getPosition ( ) const

Definition at line 97 of file CaloEllipse.cc.

References dataPoints_, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by clearPoints(), getMajorMinorAxes(), getTheta(), and pftools::operator<<().

97  {
98 
99  if (dataPoints_.empty()) {
100  return Point(0, 0);
101  }
102 
103  double x_tot(0.0);
104  double y_tot(0.0);
105  PointCit it = dataPoints_.begin();
106  for (; it != dataPoints_.end(); ++it) {
107  const Point& p = *it;
108  x_tot += p.first;
109  y_tot += p.second;
110 
111  }
112 
113  return Point(x_tot / dataPoints_.size(), y_tot / dataPoints_.size());
114 }
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
std::pair< double, double > Point
Definition: CaloEllipse.h:18
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
PointVector::const_iterator PointCit
Definition: CaloEllipse.h:20
double CaloEllipse::getTheta ( ) const

Definition at line 23 of file CaloEllipse.cc.

References dataPoints_, getPosition(), SiStripPI::mean, AlCaHLTBitMon_ParallelJobs::p, lumiQueryAPI::q, and theta().

Referenced by clearPoints(), getMajorMinorAxes(), makeCaches(), and pftools::operator<<().

23  {
24  if (dataPoints_.size() < 2) {
25  return 0.0;
26  }
27 
28  PointVector meanAdj;
29 
31 
32  double sum_dxdx(0.0);
33  double sum_dydy(0.0);
34  double sum_dxdy(0.0);
35  PointCit it = dataPoints_.begin();
36  for (; it != dataPoints_.end(); ++it) {
37  const Point& p = *it;
38  Point q(p.first - mean.first, p.second - mean.second);
39  meanAdj.push_back(q);
40  sum_dxdx += q.first * q.first;
41  sum_dydy += q.second * q.second;
42  sum_dxdy += q.first * q.second;
43  }
44  double theta = 0.5 * atan(2.0 * sum_dxdy / (sum_dydy - sum_dxdx));
45  return theta;
46 }
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
Geom::Theta< T > theta() const
std::vector< Point > PointVector
Definition: CaloEllipse.h:19
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
PointVector::const_iterator PointCit
Definition: CaloEllipse.h:20
Point getPosition() const
Definition: CaloEllipse.cc:97
void CaloEllipse::makeCaches ( )

Definition at line 123 of file CaloEllipse.cc.

References cachedMajor_, cachedMinor_, cachedTheta_, getMajorMinorAxes(), and getTheta().

Referenced by pftools::CandidateWrapper::recompute().

123  {
125  Point axes = getMajorMinorAxes();
126  cachedMajor_ = axes.first;
127  cachedMinor_ = axes.second;
128 }
Point getMajorMinorAxes(double sigma=1.0) const
Definition: CaloEllipse.cc:48
double getTheta() const
Definition: CaloEllipse.cc:23
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
void CaloEllipse::reset ( void  )

Definition at line 130 of file CaloEllipse.cc.

References dataPoints_, and resetCaches().

Referenced by pftools::CandidateWrapper::reset().

130  {
131  dataPoints_.clear();
132  resetCaches();
133 }
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
void CaloEllipse::resetCaches ( )

Definition at line 116 of file CaloEllipse.cc.

References cachedMajor_, cachedMinor_, and cachedTheta_.

Referenced by reset().

116  {
117  cachedTheta_ = 0.0;
118  cachedMinor_ = 0.0;
119  cachedMajor_ = 0.0;
120 
121 }

Member Data Documentation

double pftools::CaloEllipse::cachedEccentricity_

Definition at line 49 of file CaloEllipse.h.

double pftools::CaloEllipse::cachedMajor_

Definition at line 47 of file CaloEllipse.h.

Referenced by makeCaches(), and resetCaches().

double pftools::CaloEllipse::cachedMinor_

Definition at line 48 of file CaloEllipse.h.

Referenced by makeCaches(), and resetCaches().

double pftools::CaloEllipse::cachedTheta_

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().