CMS 3D CMS Logo

CaloEllipse.h
Go to the documentation of this file.
1 /*
2  * CaloEllipse.h
3  *
4  * Created on: 24-Mar-2009
5  * Author: jamie
6  */
7 
8 #ifndef CALOELLIPSE_H_
9 #define CALOELLIPSE_H_
10 
11 #include <utility>
12 #include <vector>
13 #include <iostream>
14 #include <string>
15 #include <sstream>
16 namespace pftools {
17 
18 typedef std::pair<double, double> Point;
19 typedef std::vector<Point> PointVector;
20 typedef PointVector::const_iterator PointCit;
21 typedef PointVector::iterator PointIt;
22 
23 class CaloEllipse {
24 public:
25  CaloEllipse();
26 
27  virtual ~CaloEllipse();
28 
29  void addPoint(double x, double y) {
30  std::pair<double, double> point(x, y);
31  dataPoints_.push_back(point);
32  }
33 
34  void clearPoints() {
35  dataPoints_.clear();
36  }
37 
38  Point getPosition() const;
39 
40  Point getMajorMinorAxes(double sigma = 1.0) const;
41 
42  double getTheta() const;
43 
44  double getEccentricity() const;
45 
46  double cachedTheta_;
47  double cachedMajor_;
48  double cachedMinor_;
50 
51  void makeCaches();
52 
53  void resetCaches();
54 
55  void reset();
56 
57 
58 private:
59  std::vector<Point> dataPoints_;
60 
61 };
62  std::ostream& operator<<(std::ostream& s, const CaloEllipse& em);
63 }
64 
65 
66 #endif /* CALOELLIPSE_H_ */
67 
68 #ifndef TOSTR_H
69 #define TOSTR_H
70 #include <sstream>
71 #include <iostream>
72 template <class T> std::string toString(const std::pair<T, T>& aT) {
73  std::ostringstream oss;
74  oss << "(" << aT.first << ", " << aT.second << ")";
75  return oss.str();
76 }
77 #endif /*TOSTR_H */
78 
79 
PointVector::iterator PointIt
Definition: CaloEllipse.h:21
std::vector< Point > dataPoints_
Definition: CaloEllipse.h:59
double getEccentricity() const
Definition: CaloEllipse.cc:87
Point getMajorMinorAxes(double sigma=1.0) const
Definition: CaloEllipse.cc:48
std::pair< double, double > Point
Definition: CaloEllipse.h:18
double cachedEccentricity_
Definition: CaloEllipse.h:49
std::vector< Point > PointVector
Definition: CaloEllipse.h:19
std::string toString(const std::pair< T, T > &aT)
Definition: CaloEllipse.h:72
double getTheta() const
Definition: CaloEllipse.cc:23
void addPoint(double x, double y)
Definition: CaloEllipse.h:29
PointVector::const_iterator PointCit
Definition: CaloEllipse.h:20
std::ostream & operator<<(std::ostream &s, const Calibratable &calib_)
Definition: Calibratable.cc:6
Point getPosition() const
Definition: CaloEllipse.cc:97
*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
virtual ~CaloEllipse()
Definition: CaloEllipse.cc:20