CMS 3D CMS Logo

Thrust.h
Go to the documentation of this file.
1 #ifndef CandUtils_Thrust_h
2 #define CandUtils_Thrust_h
3 
36 #include <vector>
37 
38 class Thrust {
39 public:
43  template <typename const_iterator>
44  Thrust(const_iterator begin, const_iterator end) : thrust_(0), axis_(0, 0, 0), pSum_(0), n_(end - begin), p_(n_) {
45  if (n_ == 0)
46  return;
47  std::vector<const reco::Candidate *> cands;
48  for (const_iterator i = begin; i != end; ++i) {
49  cands.push_back(&*i);
50  }
51  init(cands);
52  }
54  double thrust() const { return thrust_; }
56  const Vector &axis() const { return axis_; }
57 
58 private:
59  double thrust_;
61  double pSum_;
62  const unsigned int n_;
63  std::vector<Vector> p_;
64 
65  struct ThetaPhi {
66  ThetaPhi(double t, double p) : theta(t), phi(p) {}
67  double theta, phi;
68  };
69  double thrust(const Vector &theAxis) const;
70  ThetaPhi initialAxis() const;
72  Vector axis(double theta, double phi) const;
73  Vector axis(const ThetaPhi &tp) const { return axis(tp.theta, tp.phi); }
74  void parabola(double &a, double &b, double &c, const Vector &, const Vector &, const Vector &) const;
75  void init(const std::vector<const reco::Candidate *> &);
76 };
77 
78 #endif
ThetaPhi initialAxis() const
Definition: Thrust.cc:16
ThetaPhi finalAxis(ThetaPhi) const
Definition: Thrust.cc:67
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
Thrust(const_iterator begin, const_iterator end)
constructor from first and last iterators
Definition: Thrust.h:44
double phi
Definition: Thrust.h:67
double theta
Definition: Thrust.h:67
void parabola(double &a, double &b, double &c, const Vector &, const Vector &, const Vector &) const
Definition: Thrust.cc:135
double thrust() const
thrust value (in the range [0.5, 1.0])
Definition: Thrust.h:54
double pSum_
Definition: Thrust.h:61
math::XYZVector Vector
spatial vector
Definition: Thrust.h:41
ThetaPhi(double t, double p)
Definition: Thrust.h:66
double thrust_
Definition: Thrust.h:59
const unsigned int n_
Definition: Thrust.h:62
std::vector< Vector > p_
Definition: Thrust.h:63
const Vector & axis() const
thrust axis (with magnitude = 1)
Definition: Thrust.h:56
void init(const std::vector< const reco::Candidate *> &)
Definition: Thrust.cc:6
Definition: Thrust.h:38
Vector axis_
Definition: Thrust.h:60
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double b
Definition: hdecay.h:120
Vector axis(const ThetaPhi &tp) const
Definition: Thrust.h:73
double a
Definition: hdecay.h:121