CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DataFormats/ParticleFlowReco/interface/CaloEllipse.h

Go to the documentation of this file.
00001 /*
00002  * CaloEllipse.h
00003  *
00004  *  Created on: 24-Mar-2009
00005  *      Author: jamie
00006  */
00007 
00008 #ifndef CALOELLIPSE_H_
00009 #define CALOELLIPSE_H_
00010 
00011 #include <utility>
00012 #include <vector>
00013 #include <iostream>
00014 #include <string>
00015 #include <sstream>
00016 namespace pftools {
00017 
00018 typedef std::pair<double, double> Point;
00019 typedef std::vector<Point> PointVector;
00020 typedef PointVector::const_iterator PointCit;
00021 typedef PointVector::iterator PointIt;
00022 
00023 class CaloEllipse {
00024 public:
00025         CaloEllipse();
00026 
00027         virtual ~CaloEllipse();
00028 
00029         void addPoint(double x, double y) {
00030                 std::pair<double, double> point(x, y);
00031                 dataPoints_.push_back(point);
00032         }
00033 
00034         void clearPoints() {
00035                 dataPoints_.clear();
00036         }
00037 
00038         Point getPosition() const;
00039 
00040         Point getMajorMinorAxes(double sigma = 1.0) const;
00041 
00042         double getTheta() const;
00043 
00044         double getEccentricity() const;
00045 
00046         double cachedTheta_;
00047         double cachedMajor_;
00048         double cachedMinor_;
00049         double cachedEccentricity_;
00050 
00051         void makeCaches();
00052 
00053         void resetCaches();
00054 
00055         void reset();
00056 
00057 
00058 private:
00059         std::vector<Point> dataPoints_;
00060 
00061 };
00062         std::ostream& operator<<(std::ostream& s, const CaloEllipse& em);
00063 }
00064 
00065 
00066 #endif /* CALOELLIPSE_H_ */
00067 
00068 #ifndef TOSTR_H
00069 #define TOSTR_H
00070 #include <sstream>
00071 #include <iostream>
00072 template <class T> std::string toString(const std::pair<T, T>& aT) {
00073         std::ostringstream oss;
00074         oss << "(" << aT.first << ", " << aT.second << ")";
00075         return oss.str();
00076 }
00077 #endif /*TOSTR_H */
00078 
00079