File indexing completed on 2024-04-06 12:23:21
0001 #ifndef CandUtils_Thrust_h
0002 #define CandUtils_Thrust_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #include "DataFormats/Math/interface/Vector3D.h"
0035 #include "DataFormats/Candidate/interface/Candidate.h"
0036 #include <vector>
0037
0038 class Thrust {
0039 public:
0040
0041 typedef math::XYZVector Vector;
0042
0043 template <typename const_iterator>
0044 Thrust(const_iterator begin, const_iterator end) : thrust_(0), axis_(0, 0, 0), pSum_(0), n_(end - begin), p_(n_) {
0045 if (n_ == 0)
0046 return;
0047 std::vector<const reco::Candidate *> cands;
0048 for (const_iterator i = begin; i != end; ++i) {
0049 cands.push_back(&*i);
0050 }
0051 init(cands);
0052 }
0053
0054 double thrust() const { return thrust_; }
0055
0056 const Vector &axis() const { return axis_; }
0057
0058 private:
0059 double thrust_;
0060 Vector axis_;
0061 double pSum_;
0062 const unsigned int n_;
0063 std::vector<Vector> p_;
0064
0065 struct ThetaPhi {
0066 ThetaPhi(double t, double p) : theta(t), phi(p) {}
0067 double theta, phi;
0068 };
0069 double thrust(const Vector &theAxis) const;
0070 ThetaPhi initialAxis() const;
0071 ThetaPhi finalAxis(ThetaPhi) const;
0072 Vector axis(double theta, double phi) const;
0073 Vector axis(const ThetaPhi &tp) const { return axis(tp.theta, tp.phi); }
0074 void parabola(double &a, double &b, double &c, const Vector &, const Vector &, const Vector &) const;
0075 void init(const std::vector<const reco::Candidate *> &);
0076 };
0077
0078 #endif