File indexing completed on 2026-09-25 09:12:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef __FASTJET_CONTRIB_AXES_DEFINITION_HH__
0026 #define __FASTJET_CONTRIB_AXES_DEFINITION_HH__
0027
0028
0029 #include "MeasureDefinition.hh"
0030 #include "ExtraRecombiners.hh"
0031
0032 #include "fastjet/PseudoJet.hh"
0033 #include <fastjet/LimitedWarning.hh>
0034
0035 #include <iomanip>
0036 #include <cmath>
0037 #include <vector>
0038 #include <list>
0039
0040 FASTJET_BEGIN_NAMESPACE
0041
0042 namespace contrib {
0043
0044
0045 class HalfKT_Axes;
0046 class KT_Axes;
0047 class CA_Axes;
0048 class AntiKT_Axes;
0049 class WTA_HalfKT_Axes;
0050 class WTA_KT_Axes;
0051 class WTA_CA_Axes;
0052 class GenKT_Axes;
0053 class WTA_GenKT_Axes;
0054 class GenET_GenKT_Axes;
0055 class Manual_Axes;
0056
0057 class OnePass_HalfKT_Axes;
0058 class OnePass_KT_Axes;
0059 class OnePass_CA_Axes;
0060 class OnePass_AntiKT_Axes;
0061 class OnePass_WTA_HalfKT_Axes;
0062 class OnePass_WTA_KT_Axes;
0063 class OnePass_WTA_CA_Axes;
0064 class OnePass_GenKT_Axes;
0065 class OnePass_WTA_GenKT_Axes;
0066 class OnePass_GenET_GenKT_Axes;
0067 class OnePass_Manual_Axes;
0068
0069 class MultiPass_Axes;
0070 class MultiPass_Manual_Axes;
0071
0072 class Comb_GenKT_Axes;
0073 class Comb_WTA_GenKT_Axes;
0074 class Comb_GenET_GenKT_Axes;
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 class AxesDefinition {
0092
0093 public:
0094
0095
0096
0097
0098 virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
0099 const std::vector<fastjet::PseudoJet>& inputs,
0100 const MeasureDefinition * measure) const = 0;
0101
0102
0103 virtual std::string short_description() const = 0;
0104
0105
0106 virtual std::string description() const = 0;
0107
0108
0109 virtual AxesDefinition* create() const = 0;
0110
0111 public:
0112
0113
0114
0115 std::vector<fastjet::PseudoJet> get_refined_axes(int n_jets,
0116 const std::vector<fastjet::PseudoJet>& inputs,
0117 const std::vector<fastjet::PseudoJet>& seedAxes,
0118 const MeasureDefinition * measure = NULL) const {
0119
0120 assert(n_jets == (int)seedAxes.size());
0121
0122 if (_Npass == 0) {
0123
0124 return seedAxes;
0125 } else if (_Npass == 1) {
0126 if (measure == NULL) throw Error("AxesDefinition: One-pass minimization requires specifying a MeasureDefinition.");
0127
0128
0129 return measure->get_one_pass_axes(n_jets, inputs, seedAxes,_nAttempts,_accuracy);
0130 } else {
0131 if (measure == NULL) throw Error("AxesDefinition: Multi-pass minimization requires specifying a MeasureDefinition.");
0132 return get_multi_pass_axes(n_jets, inputs, seedAxes, measure);
0133 }
0134 }
0135
0136
0137
0138 std::vector<fastjet::PseudoJet> get_axes(int n_jets,
0139 const std::vector<fastjet::PseudoJet>& inputs,
0140 const MeasureDefinition * measure = NULL) const {
0141 std::vector<fastjet::PseudoJet> seedAxes = get_starting_axes(n_jets, inputs, measure);
0142 return get_refined_axes(n_jets,inputs,seedAxes,measure);
0143 }
0144
0145
0146
0147 inline std::vector<fastjet::PseudoJet> operator() (int n_jets,
0148 const std::vector<fastjet::PseudoJet>& inputs,
0149 const MeasureDefinition * measure = NULL) const {
0150 return get_axes(n_jets,inputs,measure);
0151 }
0152
0153
0154
0155 enum AxesRefiningEnum {
0156 UNDEFINED_REFINE = -1,
0157 NO_REFINING = 0,
0158 ONE_PASS = 1,
0159 MULTI_PASS = 100,
0160 };
0161
0162
0163 int nPass() const { return _Npass; }
0164
0165
0166 bool givesRandomizedResults() const {
0167 return (_Npass > 1);
0168 }
0169
0170
0171 bool needsManualAxes() const {
0172 return _needsManualAxes;
0173 }
0174
0175
0176
0177 void setNPass(int nPass,
0178 int nAttempts = 1000,
0179 double accuracy = 0.0001,
0180 double noise_range = 1.0
0181 )
0182 {
0183 _Npass = nPass;
0184 _nAttempts = nAttempts;
0185 _accuracy = accuracy;
0186 _noise_range = noise_range;
0187 if (nPass < 0) throw Error("AxesDefinition requires a nPass >= 0");
0188 }
0189
0190
0191 virtual ~AxesDefinition() {};
0192
0193 protected:
0194
0195
0196
0197 AxesDefinition() : _Npass(UNDEFINED_REFINE),
0198 _nAttempts(0),
0199 _accuracy(0.0),
0200 _noise_range(0.0),
0201 _needsManualAxes(false) {}
0202
0203
0204 std::vector<fastjet::PseudoJet> get_multi_pass_axes(int n_jets,
0205 const std::vector<fastjet::PseudoJet>& inputs,
0206 const std::vector<fastjet::PseudoJet>& seedAxes,
0207 const MeasureDefinition* measure) const;
0208
0209
0210 PseudoJet jiggle(const PseudoJet& axis) const;
0211
0212 int _Npass;
0213 int _nAttempts;
0214 double _accuracy;
0215 double _noise_range;
0216 bool _needsManualAxes;
0217 };
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227 class ExclusiveJetAxes : public AxesDefinition {
0228
0229 public:
0230
0231 ExclusiveJetAxes(fastjet::JetDefinition def)
0232 : AxesDefinition(), _def(def) {
0233 setNPass(NO_REFINING);
0234 }
0235
0236
0237 virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
0238 const std::vector <fastjet::PseudoJet> & inputs,
0239 const MeasureDefinition * ) const {
0240 fastjet::ClusterSequence jet_clust_seq(inputs, _def);
0241
0242 std::vector<fastjet::PseudoJet> axes_temp = jet_clust_seq.exclusive_jets_up_to(n_jets);
0243
0244 if ((int)axes_temp.size() < n_jets) {
0245 _too_few_axes_warning.warn("ExclusiveJetAxes::get_starting_axes: Fewer than N axes found; results are unpredictable.");
0246 axes_temp.resize(n_jets);
0247 }
0248
0249
0250 std::vector<fastjet::PseudoJet> axes;
0251 axes.resize(n_jets);
0252 for (unsigned int i = 0; i < axes_temp.size(); i++) {
0253 axes[i].reset_momentum(axes_temp[i]);
0254 }
0255
0256 return axes;
0257 }
0258
0259
0260 virtual std::string short_description() const { return "ExclAxes";}
0261
0262 virtual std::string description() const { return "ExclAxes: " + _def.description();}
0263
0264
0265 virtual ExclusiveJetAxes* create() const {return new ExclusiveJetAxes(*this);}
0266
0267 private:
0268 fastjet::JetDefinition _def;
0269 static LimitedWarning _too_few_axes_warning;
0270 };
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281 class ExclusiveCombinatorialJetAxes : public AxesDefinition {
0282
0283 public:
0284
0285 ExclusiveCombinatorialJetAxes(fastjet::JetDefinition def, int nExtra = 0)
0286 : AxesDefinition(), _def(def), _nExtra(nExtra) {
0287 if (nExtra < 0) throw Error("Need nExtra >= 0");
0288 setNPass(NO_REFINING);
0289 }
0290
0291
0292 virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
0293 const std::vector<fastjet::PseudoJet> & inputs,
0294 const MeasureDefinition *measure) const {
0295 int starting_number = n_jets + _nExtra;
0296 fastjet::ClusterSequence jet_clust_seq(inputs, _def);
0297 std::vector<fastjet::PseudoJet> starting_axes = jet_clust_seq.exclusive_jets_up_to(starting_number);
0298
0299 if ((int)starting_axes.size() < n_jets) {
0300 _too_few_axes_warning.warn("ExclusiveCombinatorialJetAxes::get_starting_axes: Fewer than N + nExtra axes found; results are unpredictable.");
0301 starting_axes.resize(n_jets);
0302 }
0303
0304 std::vector<fastjet::PseudoJet> final_axes;
0305
0306
0307 if (_nExtra == 0) final_axes = starting_axes;
0308
0309 else {
0310
0311
0312 std::string bitmask(n_jets, 1);
0313
0314 bitmask.resize(starting_number, 0);
0315
0316 double min_tau = std::numeric_limits<double>::max();
0317 std::vector<fastjet::PseudoJet> temp_axes;
0318
0319 do {
0320
0321 temp_axes.clear();
0322
0323
0324 for (int i = 0; i < (int)starting_axes.size(); ++i) {
0325 if (bitmask[i]) temp_axes.push_back(starting_axes[i]);
0326 }
0327
0328 double temp_tau = measure->result(inputs, temp_axes);
0329 if (temp_tau < min_tau) {
0330 min_tau = temp_tau;
0331 final_axes = temp_axes;
0332 }
0333
0334
0335
0336
0337 } while (std::prev_permutation(bitmask.begin(), bitmask.end()));
0338 }
0339
0340 return final_axes;
0341 }
0342
0343
0344 virtual std::string short_description() const { return "ExclCombAxes";}
0345
0346 virtual std::string description() const { return "ExclCombAxes: " + _def.description();}
0347
0348 virtual ExclusiveCombinatorialJetAxes* create() const {return new ExclusiveCombinatorialJetAxes(*this);}
0349
0350 private:
0351 fastjet::JetDefinition _def;
0352 int _nExtra;
0353 static LimitedWarning _too_few_axes_warning;
0354 };
0355
0356
0357
0358
0359
0360
0361
0362
0363 class HardestJetAxes : public AxesDefinition {
0364 public:
0365
0366 HardestJetAxes(fastjet::JetDefinition def)
0367 : AxesDefinition(), _def(def) {
0368 setNPass(NO_REFINING);
0369 }
0370
0371
0372 virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
0373 const std::vector <fastjet::PseudoJet> & inputs,
0374 const MeasureDefinition * ) const {
0375 fastjet::ClusterSequence jet_clust_seq(inputs, _def);
0376 std::vector<fastjet::PseudoJet> axes = sorted_by_pt(jet_clust_seq.inclusive_jets());
0377
0378 if ((int)axes.size() < n_jets) {
0379 _too_few_axes_warning.warn("HardestJetAxes::get_starting_axes: Fewer than N axes found; results are unpredictable.");
0380 }
0381
0382 axes.resize(n_jets);
0383 return axes;
0384 }
0385
0386
0387 virtual std::string short_description() const { return "HardAxes";}
0388
0389 virtual std::string description() const { return "HardAxes: " + _def.description();}
0390
0391 virtual HardestJetAxes* create() const {return new HardestJetAxes(*this);}
0392
0393 private:
0394 fastjet::JetDefinition _def;
0395
0396 static LimitedWarning _too_few_axes_warning;
0397
0398 };
0399
0400
0401
0402
0403
0404
0405
0406
0407 class HalfKT_Axes : public ExclusiveJetAxes {
0408
0409 public:
0410
0411 HalfKT_Axes()
0412 : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::genkt_algorithm,
0413 fastjet::JetDefinition::max_allowable_R,
0414 0.5)) {
0415 setNPass(NO_REFINING);
0416 }
0417
0418
0419 virtual std::string short_description() const {
0420 std::stringstream stream;
0421 stream << std::fixed << std::setprecision(2)
0422 << "HalfKT";
0423 return stream.str();
0424 };
0425
0426
0427 virtual std::string description() const {
0428 std::stringstream stream;
0429 stream << std::fixed << std::setprecision(2)
0430 << "Half KT Axes";
0431 return stream.str();
0432 };
0433
0434
0435 virtual HalfKT_Axes* create() const {return new HalfKT_Axes(*this);}
0436
0437 };
0438
0439
0440
0441
0442
0443
0444
0445
0446 class KT_Axes : public ExclusiveJetAxes {
0447 public:
0448
0449 KT_Axes()
0450 : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::kt_algorithm,
0451 fastjet::JetDefinition::max_allowable_R,
0452 fastjet::E_scheme,
0453 fastjet::Best)
0454 ) {
0455 setNPass(NO_REFINING);
0456 }
0457
0458
0459 virtual std::string short_description() const {
0460 return "KT";
0461 };
0462
0463
0464 virtual std::string description() const {
0465 std::stringstream stream;
0466 stream << std::fixed << std::setprecision(2)
0467 << "KT Axes";
0468 return stream.str();
0469 };
0470
0471
0472 virtual KT_Axes* create() const {return new KT_Axes(*this);}
0473
0474 };
0475
0476
0477
0478
0479
0480
0481
0482 class CA_Axes : public ExclusiveJetAxes {
0483 public:
0484
0485 CA_Axes()
0486 : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::cambridge_algorithm,
0487 fastjet::JetDefinition::max_allowable_R,
0488 fastjet::E_scheme,
0489 fastjet::Best)
0490 ) {
0491 setNPass(NO_REFINING);
0492 }
0493
0494
0495 virtual std::string short_description() const {
0496 return "CA";
0497 };
0498
0499
0500 virtual std::string description() const {
0501 std::stringstream stream;
0502 stream << std::fixed << std::setprecision(2)
0503 << "CA Axes";
0504 return stream.str();
0505 };
0506
0507
0508 virtual CA_Axes* create() const {return new CA_Axes(*this);}
0509
0510 };
0511
0512
0513
0514
0515
0516
0517
0518
0519
0520 class AntiKT_Axes : public HardestJetAxes {
0521
0522 public:
0523
0524 AntiKT_Axes(double R0)
0525 : HardestJetAxes(fastjet::JetDefinition(fastjet::antikt_algorithm,
0526 R0,
0527 fastjet::E_scheme,
0528 fastjet::Best)
0529 ), _R0(R0) {
0530 setNPass(NO_REFINING);
0531 }
0532
0533
0534 virtual std::string short_description() const {
0535 std::stringstream stream;
0536 stream << std::fixed << std::setprecision(2)
0537 << "AKT" << _R0;
0538 return stream.str();
0539 };
0540
0541
0542 virtual std::string description() const {
0543 std::stringstream stream;
0544 stream << std::fixed << std::setprecision(2)
0545 << "Anti-KT Axes (R0 = " << _R0 << ")";
0546 return stream.str();
0547 };
0548
0549
0550 virtual AntiKT_Axes* create() const {return new AntiKT_Axes(*this);}
0551
0552 protected:
0553 double _R0;
0554
0555 };
0556
0557
0558
0559
0560
0561
0562
0563
0564 class JetDefinitionWrapper {
0565
0566 public:
0567
0568
0569 JetDefinitionWrapper(JetAlgorithm jet_algorithm_in, double R_in, double xtra_param_in, const JetDefinition::Recombiner *recombiner) {
0570 jet_def = fastjet::JetDefinition(jet_algorithm_in, R_in, xtra_param_in);
0571 jet_def.set_recombiner(recombiner);
0572 jet_def.delete_recombiner_when_unused();
0573 }
0574
0575
0576 JetDefinitionWrapper(JetAlgorithm jet_algorithm_in, double R_in, const JetDefinition::Recombiner *recombiner, fastjet::Strategy strategy_in) {
0577 jet_def = fastjet::JetDefinition(jet_algorithm_in, R_in, recombiner, strategy_in);
0578 jet_def.delete_recombiner_when_unused();
0579 }
0580
0581
0582 JetDefinition getJetDef() {
0583 return jet_def;
0584 }
0585
0586 private:
0587 JetDefinition jet_def;
0588 };
0589
0590
0591
0592
0593
0594
0595
0596 class WTA_HalfKT_Axes : public ExclusiveJetAxes {
0597
0598 public:
0599
0600 WTA_HalfKT_Axes()
0601 : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::genkt_algorithm,
0602 fastjet::JetDefinition::max_allowable_R,
0603 0.5,
0604 new WinnerTakeAllRecombiner()
0605 ).getJetDef()) {
0606 setNPass(NO_REFINING);
0607 }
0608
0609
0610 virtual std::string short_description() const {
0611 std::stringstream stream;
0612 stream << std::fixed << std::setprecision(2)
0613 << "WTA, HalfKT";
0614 return stream.str();
0615 };
0616
0617
0618 virtual std::string description() const {
0619 std::stringstream stream;
0620 stream << std::fixed << std::setprecision(2)
0621 << "Winner-Take-All Half KT Axes";
0622 return stream.str();
0623 };
0624
0625
0626 virtual WTA_HalfKT_Axes* create() const {return new WTA_HalfKT_Axes(*this);}
0627
0628 };
0629
0630
0631
0632
0633
0634
0635
0636
0637 class WTA_KT_Axes : public ExclusiveJetAxes {
0638 public:
0639
0640 WTA_KT_Axes()
0641 : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::kt_algorithm,
0642 fastjet::JetDefinition::max_allowable_R,
0643 new WinnerTakeAllRecombiner(),
0644 fastjet::Best).getJetDef()
0645 ) {
0646 setNPass(NO_REFINING);
0647 }
0648
0649
0650 virtual std::string short_description() const {
0651 return "WTA KT";
0652 };
0653
0654
0655 virtual std::string description() const {
0656 std::stringstream stream;
0657 stream << std::fixed << std::setprecision(2)
0658 << "Winner-Take-All KT Axes";
0659 return stream.str();
0660 };
0661
0662
0663 virtual WTA_KT_Axes* create() const {return new WTA_KT_Axes(*this);}
0664
0665 };
0666
0667
0668
0669
0670
0671
0672
0673 class WTA_CA_Axes : public ExclusiveJetAxes {
0674 public:
0675
0676 WTA_CA_Axes()
0677 : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::cambridge_algorithm,
0678 fastjet::JetDefinition::max_allowable_R,
0679 new WinnerTakeAllRecombiner(),
0680 fastjet::Best).getJetDef()) {
0681 setNPass(NO_REFINING);
0682 }
0683
0684
0685 virtual std::string short_description() const {
0686 return "WTA CA";
0687 };
0688
0689
0690 virtual std::string description() const {
0691 std::stringstream stream;
0692 stream << std::fixed << std::setprecision(2)
0693 << "Winner-Take-All CA Axes";
0694 return stream.str();
0695 };
0696
0697
0698 virtual WTA_CA_Axes* create() const {return new WTA_CA_Axes(*this);}
0699
0700 };
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710 class GenKT_Axes : public ExclusiveJetAxes {
0711
0712 public:
0713
0714 GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R)
0715 : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::genkt_algorithm,
0716 R0,
0717 p)), _p(p), _R0(R0) {
0718 if (p < 0) throw Error("GenKT_Axes: Currently only p >=0 is supported.");
0719 setNPass(NO_REFINING);
0720 }
0721
0722
0723 virtual std::string short_description() const {
0724 std::stringstream stream;
0725 stream << std::fixed << std::setprecision(2)
0726 << "GenKT Axes";
0727 return stream.str();
0728 };
0729
0730
0731 virtual std::string description() const {
0732 std::stringstream stream;
0733 stream << std::fixed << std::setprecision(2)
0734 << "General KT (p = " << _p << "), R0 = " << _R0;
0735 return stream.str();
0736 };
0737
0738
0739 virtual GenKT_Axes* create() const {return new GenKT_Axes(*this);}
0740
0741 protected:
0742 double _p;
0743 double _R0;
0744 };
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754 class WTA_GenKT_Axes : public ExclusiveJetAxes {
0755
0756 public:
0757
0758 WTA_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R)
0759 : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::genkt_algorithm,
0760 R0,
0761 p,
0762 new WinnerTakeAllRecombiner()
0763 ).getJetDef()), _p(p), _R0(R0) {
0764 if (p < 0) throw Error("WTA_GenKT_Axes: Currently only p >=0 is supported.");
0765 setNPass(NO_REFINING);
0766 }
0767
0768
0769 virtual std::string short_description() const {
0770 std::stringstream stream;
0771 stream << std::fixed << std::setprecision(2)
0772 << "WTA, GenKT Axes";
0773 return stream.str();
0774 };
0775
0776
0777 virtual std::string description() const {
0778 std::stringstream stream;
0779 stream << std::fixed << std::setprecision(2)
0780 << "Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
0781 return stream.str();
0782 };
0783
0784
0785 virtual WTA_GenKT_Axes* create() const {return new WTA_GenKT_Axes(*this);}
0786
0787 protected:
0788 double _p;
0789 double _R0;
0790 };
0791
0792
0793
0794
0795
0796
0797
0798
0799 class GenET_GenKT_Axes : public ExclusiveJetAxes {
0800
0801 public:
0802
0803 GenET_GenKT_Axes(double delta, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
0804 : ExclusiveJetAxes((JetDefinitionWrapper(fastjet::genkt_algorithm, R0, p, new GeneralEtSchemeRecombiner(delta))).getJetDef() ),
0805 _delta(delta), _p(p), _R0(R0) {
0806 if (p < 0) throw Error("GenET_GenKT_Axes: Currently only p >=0 is supported.");
0807 if (delta <= 0) throw Error("GenET_GenKT_Axes: Currently only delta >0 is supported.");
0808 setNPass(NO_REFINING);
0809 }
0810
0811
0812 virtual std::string short_description() const {
0813 std::stringstream stream;
0814 stream << std::fixed << std::setprecision(2)
0815 << "GenET, GenKT Axes";
0816 return stream.str();
0817 };
0818
0819
0820 virtual std::string description() const {
0821 std::stringstream stream;
0822 stream << std::fixed << std::setprecision(2);
0823
0824 if (_delta < std::numeric_limits<int>::max()) stream << "General Recombiner (delta = " << _delta << "), " << "General KT (p = " << _p << ") Axes, R0 = " << _R0;
0825 else stream << "Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
0826
0827 return stream.str();
0828 };
0829
0830
0831 virtual GenET_GenKT_Axes* create() const {return new GenET_GenKT_Axes(*this);}
0832
0833 protected:
0834 double _delta;
0835 double _p;
0836 double _R0;
0837 };
0838
0839
0840
0841
0842
0843
0844
0845 class OnePass_HalfKT_Axes : public HalfKT_Axes {
0846
0847 public:
0848
0849 OnePass_HalfKT_Axes() : HalfKT_Axes() {
0850 setNPass(ONE_PASS);
0851 }
0852
0853
0854 virtual std::string short_description() const {
0855 return "OnePass HalfKT";
0856 };
0857
0858
0859 virtual std::string description() const {
0860 std::stringstream stream;
0861 stream << std::fixed << std::setprecision(2)
0862 << "One-Pass Minimization from Half KT Axes";
0863 return stream.str();
0864 };
0865
0866
0867 virtual OnePass_HalfKT_Axes* create() const {return new OnePass_HalfKT_Axes(*this);}
0868 };
0869
0870
0871
0872
0873
0874
0875
0876
0877 class OnePass_KT_Axes : public KT_Axes {
0878 public:
0879
0880 OnePass_KT_Axes() : KT_Axes() {
0881 setNPass(ONE_PASS);
0882 }
0883
0884
0885 virtual std::string short_description() const {
0886 return "OnePass KT";
0887 };
0888
0889
0890 virtual std::string description() const {
0891 std::stringstream stream;
0892 stream << std::fixed << std::setprecision(2)
0893 << "One-Pass Minimization from KT Axes";
0894 return stream.str();
0895 };
0896
0897
0898 virtual OnePass_KT_Axes* create() const {return new OnePass_KT_Axes(*this);}
0899
0900 };
0901
0902
0903
0904
0905
0906
0907
0908 class OnePass_CA_Axes : public CA_Axes {
0909 public:
0910
0911 OnePass_CA_Axes() : CA_Axes() {
0912 setNPass(ONE_PASS);
0913 }
0914
0915
0916 virtual std::string short_description() const {
0917 return "OnePass CA";
0918 };
0919
0920
0921 virtual std::string description() const {
0922 std::stringstream stream;
0923 stream << std::fixed << std::setprecision(2)
0924 << "One-Pass Minimization from CA Axes";
0925 return stream.str();
0926 };
0927
0928
0929 virtual OnePass_CA_Axes* create() const {return new OnePass_CA_Axes(*this);}
0930
0931
0932 };
0933
0934
0935
0936
0937
0938
0939
0940 class OnePass_AntiKT_Axes : public AntiKT_Axes {
0941
0942 public:
0943
0944 OnePass_AntiKT_Axes(double R0) : AntiKT_Axes(R0) {
0945 setNPass(ONE_PASS);
0946 }
0947
0948
0949 virtual std::string short_description() const {
0950 std::stringstream stream;
0951 stream << std::fixed << std::setprecision(2)
0952 << "OnePassAKT" << _R0;
0953 return stream.str();
0954 };
0955
0956
0957 virtual std::string description() const {
0958 std::stringstream stream;
0959 stream << std::fixed << std::setprecision(2)
0960 << "One-Pass Minimization from Anti-KT Axes (R0 = " << _R0 << ")";
0961 return stream.str();
0962 };
0963
0964
0965 virtual OnePass_AntiKT_Axes* create() const {return new OnePass_AntiKT_Axes(*this);}
0966
0967 };
0968
0969
0970
0971
0972
0973
0974
0975
0976 class OnePass_WTA_HalfKT_Axes : public WTA_HalfKT_Axes {
0977
0978 public:
0979
0980 OnePass_WTA_HalfKT_Axes() : WTA_HalfKT_Axes() {
0981 setNPass(ONE_PASS);
0982 }
0983
0984
0985 virtual std::string short_description() const {
0986 return "OnePass WTA HalfKT";
0987 };
0988
0989
0990 virtual std::string description() const {
0991 std::stringstream stream;
0992 stream << std::fixed << std::setprecision(2)
0993 << "One-Pass Minimization from Winner-Take-All Half KT Axes";
0994 return stream.str();
0995 };
0996
0997
0998 virtual OnePass_WTA_HalfKT_Axes* create() const {return new OnePass_WTA_HalfKT_Axes(*this);}
0999 };
1000
1001
1002
1003
1004
1005
1006
1007 class OnePass_WTA_KT_Axes : public WTA_KT_Axes {
1008 public:
1009
1010 OnePass_WTA_KT_Axes() : WTA_KT_Axes() {
1011 setNPass(ONE_PASS);
1012 }
1013
1014
1015 virtual std::string short_description() const {
1016 return "OnePass WTA KT";
1017 };
1018
1019
1020 virtual std::string description() const {
1021 std::stringstream stream;
1022 stream << std::fixed << std::setprecision(2)
1023 << "One-Pass Minimization from Winner-Take-All KT Axes";
1024 return stream.str();
1025 };
1026
1027
1028 virtual OnePass_WTA_KT_Axes* create() const {return new OnePass_WTA_KT_Axes(*this);}
1029
1030
1031 };
1032
1033
1034
1035
1036
1037
1038
1039 class OnePass_WTA_CA_Axes : public WTA_CA_Axes {
1040
1041 public:
1042
1043 OnePass_WTA_CA_Axes() : WTA_CA_Axes() {
1044 setNPass(ONE_PASS);
1045 }
1046
1047
1048 virtual std::string short_description() const {
1049 return "OnePass WTA CA";
1050 };
1051
1052
1053 virtual std::string description() const {
1054 std::stringstream stream;
1055 stream << std::fixed << std::setprecision(2)
1056 << "One-Pass Minimization from Winner-Take-All CA Axes";
1057 return stream.str();
1058 };
1059
1060
1061 virtual OnePass_WTA_CA_Axes* create() const {return new OnePass_WTA_CA_Axes(*this);}
1062
1063 };
1064
1065
1066
1067
1068
1069
1070
1071 class OnePass_GenKT_Axes : public GenKT_Axes {
1072
1073 public:
1074
1075 OnePass_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R) : GenKT_Axes(p, R0) {
1076 setNPass(ONE_PASS);
1077 }
1078
1079
1080 virtual std::string short_description() const {
1081 return "OnePass GenKT";
1082 };
1083
1084
1085 virtual std::string description() const {
1086 std::stringstream stream;
1087 stream << std::fixed << std::setprecision(2)
1088 << "One-Pass Minimization from General KT (p = " << _p << "), R0 = " << _R0;
1089 return stream.str();
1090 };
1091
1092
1093 virtual OnePass_GenKT_Axes* create() const {return new OnePass_GenKT_Axes(*this);}
1094 };
1095
1096
1097
1098
1099
1100
1101
1102 class OnePass_WTA_GenKT_Axes : public WTA_GenKT_Axes {
1103
1104 public:
1105
1106 OnePass_WTA_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R) : WTA_GenKT_Axes(p, R0) {
1107 setNPass(ONE_PASS);
1108 }
1109
1110
1111 virtual std::string short_description() const {
1112 return "OnePass WTA GenKT";
1113 };
1114
1115
1116 virtual std::string description() const {
1117 std::stringstream stream;
1118 stream << std::fixed << std::setprecision(2)
1119 << "One-Pass Minimization from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
1120 return stream.str();
1121 };
1122
1123
1124 virtual OnePass_WTA_GenKT_Axes* create() const {return new OnePass_WTA_GenKT_Axes(*this);}
1125 };
1126
1127
1128
1129
1130
1131
1132
1133 class OnePass_GenET_GenKT_Axes : public GenET_GenKT_Axes {
1134
1135 public:
1136
1137 OnePass_GenET_GenKT_Axes(double delta, double p, double R0 = fastjet::JetDefinition::max_allowable_R) : GenET_GenKT_Axes(delta, p, R0) {
1138 setNPass(ONE_PASS);
1139 }
1140
1141
1142 virtual std::string short_description() const {
1143 return "OnePass GenET, GenKT";
1144 };
1145
1146
1147 virtual std::string description() const {
1148 std::stringstream stream;
1149 stream << std::fixed << std::setprecision(2);
1150 if (_delta < std::numeric_limits<int>::max()) stream << "One-Pass Minimization from General Recombiner (delta = "
1151 << _delta << "), " << "General KT (p = " << _p << ") Axes, R0 = " << _R0;
1152 else stream << "One-Pass Minimization from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
1153 return stream.str();
1154 };
1155
1156
1157 virtual OnePass_GenET_GenKT_Axes* create() const {return new OnePass_GenET_GenKT_Axes(*this);}
1158 };
1159
1160
1161
1162
1163
1164
1165
1166
1167 class Manual_Axes : public AxesDefinition {
1168 public:
1169
1170 Manual_Axes() : AxesDefinition() {
1171 setNPass(NO_REFINING);
1172 _needsManualAxes = true;
1173 }
1174
1175
1176 virtual std::vector<fastjet::PseudoJet> get_starting_axes(int,
1177 const std::vector<fastjet::PseudoJet>&,
1178 const MeasureDefinition *) const;
1179
1180
1181
1182 virtual std::string short_description() const {
1183 return "Manual";
1184 };
1185
1186
1187 virtual std::string description() const {
1188 std::stringstream stream;
1189 stream << std::fixed << std::setprecision(2)
1190 << "Manual Axes";
1191 return stream.str();
1192 };
1193
1194
1195 virtual Manual_Axes* create() const {return new Manual_Axes(*this);}
1196
1197
1198 };
1199
1200
1201
1202
1203
1204
1205
1206 class OnePass_Manual_Axes : public Manual_Axes {
1207 public:
1208
1209 OnePass_Manual_Axes() : Manual_Axes() {
1210 setNPass(ONE_PASS);
1211 }
1212
1213
1214 virtual std::string short_description() const {
1215 return "OnePass Manual";
1216 };
1217
1218
1219 virtual std::string description() const {
1220 std::stringstream stream;
1221 stream << std::fixed << std::setprecision(2)
1222 << "One-Pass Minimization from Manual Axes";
1223 return stream.str();
1224 };
1225
1226
1227 virtual OnePass_Manual_Axes* create() const {return new OnePass_Manual_Axes(*this);}
1228
1229 };
1230
1231
1232
1233
1234
1235
1236
1237 class MultiPass_Axes : public KT_Axes {
1238
1239 public:
1240
1241
1242 MultiPass_Axes(unsigned int Npass) : KT_Axes() {
1243 setNPass(Npass);
1244 }
1245
1246
1247 virtual std::string short_description() const {
1248 return "MultiPass";
1249 };
1250
1251
1252 virtual std::string description() const {
1253 std::stringstream stream;
1254 stream << std::fixed << std::setprecision(2)
1255 << "Multi-Pass Axes (Npass = " << _Npass << ")";
1256 return stream.str();
1257 };
1258
1259
1260 virtual MultiPass_Axes* create() const {return new MultiPass_Axes(*this);}
1261
1262 };
1263
1264
1265
1266
1267
1268
1269
1270 class MultiPass_Manual_Axes : public Manual_Axes {
1271
1272 public:
1273
1274 MultiPass_Manual_Axes(unsigned int Npass) : Manual_Axes() {
1275 setNPass(Npass);
1276 }
1277
1278
1279 virtual std::string short_description() const {
1280 return "MultiPass Manual";
1281 };
1282
1283
1284
1285 virtual std::string description() const {
1286 std::stringstream stream;
1287 stream << std::fixed << std::setprecision(2)
1288 << "Multi-Pass Manual Axes (Npass = " << _Npass << ")";
1289 return stream.str();
1290 };
1291
1292
1293 virtual MultiPass_Manual_Axes* create() const {return new MultiPass_Manual_Axes(*this);}
1294
1295 };
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305 class Comb_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
1306 public:
1307
1308 Comb_GenKT_Axes(int nExtra, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
1309 : ExclusiveCombinatorialJetAxes(fastjet::JetDefinition(fastjet::genkt_algorithm, R0, p), nExtra),
1310 _p(p), _R0(R0) {
1311 if (p < 0) throw Error("Comb_GenKT_Axes: Currently only p >=0 is supported.");
1312 setNPass(NO_REFINING);
1313 }
1314
1315
1316 virtual std::string short_description() const {
1317 return "N Choose M GenKT";
1318 };
1319
1320
1321 virtual std::string description() const {
1322 std::stringstream stream;
1323 stream << std::fixed << std::setprecision(2)
1324 << "N Choose M Minimization (nExtra = " << _nExtra << ") from General KT (p = " << _p << "), R0 = " << _R0;
1325 return stream.str();
1326 };
1327
1328
1329 virtual Comb_GenKT_Axes* create() const {return new Comb_GenKT_Axes(*this);}
1330
1331 private:
1332 double _nExtra;
1333 double _p;
1334 double _R0;
1335 };
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346 class Comb_WTA_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
1347 public:
1348
1349 Comb_WTA_GenKT_Axes(int nExtra, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
1350 : ExclusiveCombinatorialJetAxes((JetDefinitionWrapper(fastjet::genkt_algorithm, R0, p, new WinnerTakeAllRecombiner())).getJetDef(), nExtra),
1351 _p(p), _R0(R0) {
1352 if (p < 0) throw Error("Comb_WTA_GenKT_Axes: Currently only p >=0 is supported.");
1353 setNPass(NO_REFINING);
1354 }
1355
1356
1357 virtual std::string short_description() const {
1358 return "N Choose M WTA GenKT";
1359 };
1360
1361
1362 virtual std::string description() const {
1363 std::stringstream stream;
1364 stream << std::fixed << std::setprecision(2)
1365 << "N Choose M Minimization (nExtra = " << _nExtra << ") from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
1366 return stream.str();
1367 };
1368
1369
1370 virtual Comb_WTA_GenKT_Axes* create() const {return new Comb_WTA_GenKT_Axes(*this);}
1371
1372 private:
1373 double _nExtra;
1374 double _p;
1375 double _R0;
1376 };
1377
1378
1379
1380
1381
1382
1383
1384
1385 class Comb_GenET_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
1386 public:
1387
1388 Comb_GenET_GenKT_Axes(int nExtra, double delta, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
1389 : ExclusiveCombinatorialJetAxes((JetDefinitionWrapper(fastjet::genkt_algorithm, R0, p, new GeneralEtSchemeRecombiner(delta))).getJetDef(), nExtra),
1390 _delta(delta), _p(p), _R0(R0) {
1391 if (p < 0) throw Error("Comb_GenET_GenKT_Axes: Currently only p >=0 is supported.");
1392 if (delta <= 0) throw Error("Comb_GenET_GenKT_Axes: Currently only delta >=0 is supported.");
1393 setNPass(NO_REFINING);
1394 }
1395
1396
1397 virtual std::string short_description() const {
1398 return "N Choose M GenET GenKT";
1399 };
1400
1401
1402 virtual std::string description() const {
1403 std::stringstream stream;
1404 stream << std::fixed << std::setprecision(2);
1405 if (_delta < std::numeric_limits<int>::max()) stream << "N choose M Minimization (nExtra = " << _nExtra
1406 << ") from General Recombiner (delta = " << _delta << "), " << "General KT (p = " << _p << ") Axes, R0 = " << _R0;
1407 else stream << "N choose M Minimization (nExtra = " << _nExtra << ") from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
1408 return stream.str();
1409 };
1410
1411
1412 virtual Comb_GenET_GenKT_Axes* create() const {return new Comb_GenET_GenKT_Axes(*this);}
1413
1414 private:
1415 double _nExtra;
1416 double _delta;
1417 double _p;
1418 double _R0;
1419 };
1420
1421
1422 }
1423
1424 FASTJET_END_NAMESPACE
1425
1426 #endif
1427