File indexing completed on 2026-06-21 08:23:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef __CMPPLUGIN_HH__
0014 #define __CMPPLUGIN_HH__
0015
0016 #include "fastjet/contrib/FlavInfo.hh"
0017
0018 #ifndef __FJC_FLAVINFO_USEFJCORE__
0019 #include "fastjet/NNH.hh"
0020 #endif
0021
0022 FASTJET_BEGIN_NAMESPACE
0023 using namespace std;
0024 using namespace contrib;
0025
0026
0027
0028 class CMPPlugin : public JetDefinition::Plugin {
0029 public:
0030
0031
0032 enum CorrectionType {
0033
0034
0035
0036
0037 NoCorrection,
0038
0039
0040
0041
0042
0043
0044
0045
0046 SqrtCoshyCosPhiArgument,
0047
0048
0049
0050
0051 SqrtCoshyCosPhiArgument_a2,
0052
0053
0054
0055 CoshyCosPhi,
0056
0057
0058
0059 OverAllCoshyCosPhi,
0060
0061 OverAllCoshyCosPhi_a2
0062 };
0063
0064
0065
0066
0067 enum ClusteringType {DynamicKtMax, FixedKtMax};
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 CMPPlugin(double R, double a,
0081 CorrectionType correction_type = SqrtCoshyCosPhiArgument_a2,
0082 ClusteringType clustering_type = DynamicKtMax, bool spherical=false)
0083 : _R(R), _a(a), _correction_type(correction_type),
0084 _clustering_type(clustering_type), _spherical(spherical) {}
0085
0086
0087 CMPPlugin(const CMPPlugin &plugin) { *this = plugin; }
0088
0089
0090 double a() const { return _a; }
0091
0092 double R() const { return _R; }
0093
0094
0095 bool is_spherical() const { return _spherical; }
0096
0097
0098 virtual std::string description() const;
0099
0100 virtual double precise_squared_distance(const PseudoJet & j1, const PseudoJet & j2) const;
0101
0102 virtual double distance_opposite_flavour(const PseudoJet & j1, const PseudoJet & j2,
0103 const double ktmax) const;
0104
0105 virtual void run_clustering(ClusterSequence &) const;
0106
0107 void cross_product(const PseudoJet & p1, const PseudoJet & p2,
0108 PseudoJet & retp, bool lightlike=false) const {
0109 double px = p1.py() * p2.pz() - p2.py() * p1.pz();
0110 double py = p1.pz() * p2.px() - p2.pz() * p1.px();
0111 double pz = p1.px() * p2.py() - p2.px() * p1.py();
0112
0113 double E;
0114 if (lightlike) {
0115 E = sqrt(px*px + py*py + pz*pz);
0116 } else {
0117 E = 0.0;
0118 }
0119
0120
0121 retp.reset(px, py, pz, E);
0122
0123 return;
0124 }
0125 double dot_product_3d(const PseudoJet & a, const PseudoJet & b) const {
0126 return a.px()*b.px() + a.py()*b.py() + a.pz()*b.pz();
0127 }
0128
0129 double one_minus_costheta(const PseudoJet & p1, const PseudoJet & p2) const {
0130
0131 if (p1.m2() == 0 && p2.m2() == 0) {
0132
0133
0134 double res = dot_product(p1,p2) / (p1.E() * p2.E());
0135 return res;
0136 } else {
0137 double p1mod = sqrt(p1.modp2());
0138 double p2mod = sqrt(p2.modp2());
0139 double p1p2mod = p1mod*p2mod;
0140 double dot = dot_product_3d(p1,p2);
0141
0142 if (dot > (1-std::numeric_limits<double>::epsilon()) * p1p2mod) {
0143 PseudoJet cross_result;
0144 cross_product(p1, p2, cross_result, false);
0145
0146
0147
0148 double res = -cross_result.m2()/(p1p2mod * (p1p2mod+dot));
0149
0150 return res;
0151 }
0152 return 1.0 - dot/p1p2mod;
0153
0154 }
0155 }
0156
0157 private:
0158 static const double _deltaR2_handover;
0159 double _R, _a;
0160 CorrectionType _correction_type;
0161 ClusteringType _clustering_type;
0162 bool _spherical;
0163 template <typename NN>
0164 void _NN_clustering(ClusterSequence &cs, NN &nn) const;
0165
0166
0167 };
0168
0169 FASTJET_END_NAMESPACE
0170
0171 #endif