00001 #ifndef RIVET_ParticleBase_HH
00002 #define RIVET_ParticleBase_HH
00003
00004 #include "Rivet/Rivet.hh"
00005 #include "Rivet/Math/Vectors.hh"
00006
00007 namespace Rivet {
00008
00009
00010 class ParticleBase {
00011 public:
00012
00013 ParticleBase() { }
00014
00015 virtual ~ParticleBase() { }
00016
00017
00018
00019 virtual const FourMomentum& momentum() const = 0;
00020
00021
00022
00023 struct byPTAscending {
00024 bool operator()(const ParticleBase& left, const ParticleBase& right) const {
00025 double pt2left = left.momentum().pT2();
00026 double pt2right = right.momentum().pT2();
00027 return pt2left < pt2right;
00028 }
00029
00030 bool operator()(const ParticleBase* left, const ParticleBase* right) const {
00031 return (*this)(*left, *right);
00032 }
00033 };
00034
00035
00036
00037 struct byPTDescending {
00038 bool operator()(const ParticleBase& left, const ParticleBase& right) const {
00039 return byPTAscending()(right, left);
00040 }
00041
00042 bool operator()(const ParticleBase* left, const ParticleBase* right) const {
00043 return (*this)(*left, *right);
00044 }
00045 };
00046
00047
00048
00049 struct byETAscending {
00050 bool operator()(const ParticleBase& left, const ParticleBase& right) const {
00051 double pt2left = left.momentum().Et2();
00052 double pt2right = right.momentum().Et2();
00053 return pt2left < pt2right;
00054 }
00055
00056 bool operator()(const ParticleBase* left, const ParticleBase* right) const {
00057 return (*this)(*left, *right);
00058 }
00059 };
00060
00061
00062
00063 struct byETDescending {
00064 bool operator()(const ParticleBase& left, const ParticleBase& right) const {
00065 return byETAscending()(right, left);
00066 }
00067
00068 bool operator()(const ParticleBase* left, const ParticleBase* right) const {
00069 return (*this)(*left, *right);
00070 }
00071 };
00072
00073
00074
00075 struct byEAscending {
00076 bool operator()(const ParticleBase& left, const ParticleBase& right) const {
00077 double pt2left = left.momentum().E();
00078 double pt2right = right.momentum().E();
00079 return pt2left < pt2right;
00080 }
00081
00082 bool operator()(const ParticleBase* left, const ParticleBase* right) const {
00083 return (*this)(*left, *right);
00084 }
00085 };
00086
00087
00088
00089 struct byEDescending {
00090 bool operator()(const ParticleBase& left, const ParticleBase& right) const {
00091 return byEAscending()(right, left);
00092 }
00093
00094 bool operator()(const ParticleBase* left, const ParticleBase* right) const {
00095 return (*this)(*left, *right);
00096 }
00097 };
00098
00099
00100 };
00101
00102
00103 }
00104
00105 #endif