00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef __FASTJET_PSEUDOJET_HH__
00036 #define __FASTJET_PSEUDOJET_HH__
00037
00038 #include<valarray>
00039 #include<vector>
00040 #include<cassert>
00041 #include "fastjet/internal/numconsts.hh"
00042
00043 FASTJET_BEGIN_NAMESPACE
00044
00045
00046
00049 const double MaxRap = 1e5;
00050
00053 class PseudoJet {
00054 public:
00055 PseudoJet() {};
00057 PseudoJet(const double px, const double py, const double pz, const double E);
00059 template <class L> PseudoJet(const L & some_four_vector) ;
00060
00061
00062
00063
00064
00065
00066 inline double E() const {return _E;};
00067 inline double e() const {return _E;};
00068 inline double px() const {return _px;};
00069 inline double py() const {return _py;};
00070 inline double pz() const {return _pz;};
00071
00073 inline const double phi() const {return phi_02pi();};
00074
00076 inline const double phi_std() const {
00077 return _phi > pi ? _phi-twopi : pi;};
00078
00080 inline const double phi_02pi() const {return _phi;};
00081
00084 inline double rap() const {return _rap;};
00085
00087 inline double rapidity() const {return _rap;};
00088
00090 inline double kt2() const {return _kt2;};
00092 inline double perp2() const {return _kt2;};
00094 inline double perp() const {return sqrt(_kt2);};
00096 inline double m2() const {return (_E+_pz)*(_E-_pz)-_kt2;};
00098 double operator () (int i) const ;
00100 inline double operator [] (int i) const { return (*this)(i); };
00101
00102
00103 enum { X=0, Y=1, Z=2, T=3, NUM_COORDINATES=4, SIZE=NUM_COORDINATES };
00104
00105
00108 inline const int & cluster_hist_index() const {return _cluster_hist_index;};
00110 inline void set_cluster_hist_index(const int index) {_cluster_hist_index = index;};
00111
00113 inline const int & user_index() const {return _user_index;};
00115 inline void set_user_index(const int index) {_user_index = index;};
00116
00119 std::valarray<double> four_mom() const;
00120
00122 double kt_distance(const PseudoJet & other) const;
00123
00125 double plain_distance(const PseudoJet & other) const;
00126
00128
00129
00130
00131
00133 inline double beam_distance() const {return _kt2;};
00134
00135
00136 void operator*=(double);
00137 void operator/=(double);
00138 void operator+=(const PseudoJet &);
00139 void operator-=(const PseudoJet &);
00140
00141 private:
00142
00143 double _px,_py,_pz,_E;
00144 double _phi, _rap, _kt2;
00145 int _cluster_hist_index, _user_index;
00146 void _finish_init();
00147
00148 };
00149
00150
00151
00152
00153
00154 PseudoJet operator+(const PseudoJet &, const PseudoJet &);
00155 PseudoJet operator-(const PseudoJet &, const PseudoJet &);
00156 PseudoJet operator*(double, const PseudoJet &);
00157 PseudoJet operator*(const PseudoJet &, double);
00158 PseudoJet operator/(const PseudoJet &, double);
00159
00160
00161
00162
00163
00164
00166 std::vector<PseudoJet> sorted_by_pt(const std::vector<PseudoJet> & jets);
00167
00169 std::vector<PseudoJet> sorted_by_rapidity(const std::vector<PseudoJet> & jets);
00170
00172 std::vector<PseudoJet> sorted_by_E(const std::vector<PseudoJet> & jets);
00173
00174
00175
00176
00179 void sort_indices(std::vector<int> & indices,
00180 const std::vector<double> & values);
00181
00186 template<class T> std::vector<T> objects_sorted_by_values(const std::vector<T> & objects,
00187 const std::vector<double> & values);
00188
00190 class IndexedSortHelper {
00191 public:
00192 inline IndexedSortHelper (const std::vector<double> * reference_values) {
00193 _ref_values = reference_values;
00194 };
00195 inline int operator() (const int & i1, const int & i2) const {
00196 return (*_ref_values)[i1] < (*_ref_values)[i2];
00197 };
00198 private:
00199 const std::vector<double> * _ref_values;
00200 };
00201
00202
00203
00205
00206
00207 template <class L> inline PseudoJet::PseudoJet(const L & some_four_vector) {
00208
00209 _px = some_four_vector[0];
00210 _py = some_four_vector[1];
00211 _pz = some_four_vector[2];
00212 _E = some_four_vector[3];
00213 this->_finish_init();
00214 };
00215
00216
00224
00225
00226 FASTJET_END_NAMESPACE
00227
00228 #endif // __FASTJET_PSEUDOJET_HH__