CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) :
45  thrust_(0), axis_(0, 0, 0), pSum_(0),
46  n_(end - begin), p_(n_) {
47  if (n_ == 0) return;
48  std::vector<const reco::Candidate*> cands;
49  for(const_iterator i = begin; i != end; ++i) {
50  cands.push_back(&*i);
51  }
52  init(cands);
53  }
55  double thrust() const { return thrust_; }
57  const Vector& axis() const { return axis_; }
58 
59 private:
60  double thrust_;
62  double pSum_;
63  const unsigned int n_;
64  std::vector<Vector> p_;
65 
66  struct ThetaPhi {
67  ThetaPhi(double t, double p) : theta( t ), phi( p ) { }
68  double theta, phi;
69  };
70  double thrust(const Vector & theAxis) const;
71  ThetaPhi initialAxis() const;
73  Vector axis(double theta, double phi) const;
74  Vector axis(const ThetaPhi & tp) const {
75  return axis(tp.theta, tp.phi);
76  }
77  void parabola(double & a, double & b, double & c,
78  const Vector &, const Vector &, const Vector &) const;
79  void init(const std::vector<const reco::Candidate*>&);
80 };
81 
82 #endif
int i
Definition: DBlmapReader.cc:9
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
const Vector & axis() const
thrust axis (with magnitude = 1)
Definition: Thrust.h:57
double phi
Definition: Thrust.h:68
ThetaPhi initialAxis() const
Definition: Thrust.cc:16
double theta
Definition: Thrust.h:68
Geom::Theta< T > theta() const
double pSum_
Definition: Thrust.h:62
math::XYZVector Vector
spatial vector
Definition: Thrust.h:41
ThetaPhi(double t, double p)
Definition: Thrust.h:67
double thrust_
Definition: Thrust.h:60
const unsigned int n_
Definition: Thrust.h:63
std::vector< Vector > p_
Definition: Thrust.h:64
double thrust() const
thrust value (in the range [0.5, 1.0])
Definition: Thrust.h:55
#define end
Definition: vmac.h:37
Vector axis(const ThetaPhi &tp) const
Definition: Thrust.h:74
Definition: Thrust.h:38
Vector axis_
Definition: Thrust.h:61
ThetaPhi finalAxis(ThetaPhi) const
Definition: Thrust.cc:63
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
double b
Definition: hdecay.h:120
#define begin
Definition: vmac.h:30
double a
Definition: hdecay.h:121
void parabola(double &a, double &b, double &c, const Vector &, const Vector &, const Vector &) const
Definition: Thrust.cc:126
void init(const std::vector< const reco::Candidate * > &)
Definition: Thrust.cc:6