Rivet  1.8.0
ParticleBase.hh
1 #ifndef RIVET_ParticleBase_HH
2 #define RIVET_ParticleBase_HH
3 
4 #include "Rivet/Rivet.hh"
5 #include "Rivet/Math/Vectors.hh"
6 
7 namespace Rivet {
8 
9 
11  class ParticleBase {
12  public:
13 
14  ParticleBase() { }
15 
16  virtual ~ParticleBase() { }
17 
18  // virtual FourMomentum& momentum() = 0;
19 
20  virtual const FourMomentum& momentum() const = 0;
21 
22 
24  struct byPTAscending {
25  bool operator()(const ParticleBase& left, const ParticleBase& right) const {
26  double pt2left = left.momentum().pT2();
27  double pt2right = right.momentum().pT2();
28  return pt2left < pt2right;
29  }
30 
31  bool operator()(const ParticleBase* left, const ParticleBase* right) const {
32  return (*this)(*left, *right);
33  }
34  };
35 
36 
38  struct byPTDescending {
39  bool operator()(const ParticleBase& left, const ParticleBase& right) const {
40  return byPTAscending()(right, left);
41  }
42 
43  bool operator()(const ParticleBase* left, const ParticleBase* right) const {
44  return (*this)(*left, *right);
45  }
46  };
47 
48 
50  struct byETAscending {
51  bool operator()(const ParticleBase& left, const ParticleBase& right) const {
52  double pt2left = left.momentum().Et2();
53  double pt2right = right.momentum().Et2();
54  return pt2left < pt2right;
55  }
56 
57  bool operator()(const ParticleBase* left, const ParticleBase* right) const {
58  return (*this)(*left, *right);
59  }
60  };
61 
62 
64  struct byETDescending {
65  bool operator()(const ParticleBase& left, const ParticleBase& right) const {
66  return byETAscending()(right, left);
67  }
68 
69  bool operator()(const ParticleBase* left, const ParticleBase* right) const {
70  return (*this)(*left, *right);
71  }
72  };
73 
74 
76  struct byEAscending {
77  bool operator()(const ParticleBase& left, const ParticleBase& right) const {
78  double pt2left = left.momentum().E();
79  double pt2right = right.momentum().E();
80  return pt2left < pt2right;
81  }
82 
83  bool operator()(const ParticleBase* left, const ParticleBase* right) const {
84  return (*this)(*left, *right);
85  }
86  };
87 
88 
90  struct byEDescending {
91  bool operator()(const ParticleBase& left, const ParticleBase& right) const {
92  return byEAscending()(right, left);
93  }
94 
95  bool operator()(const ParticleBase* left, const ParticleBase* right) const {
96  return (*this)(*left, *right);
97  }
98  };
99 
100 
101  };
102 
103 
104 }
105 
106 #endif