Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:12:11

0001 //  Nsubjettiness Package
0002 //  Questions/Comments?  jthaler@jthaler.net
0003 //
0004 //  Copyright (c) 2011-14
0005 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
0006 //
0007 //  $Id: AxesDefinition.hh 1412 2024-02-29 00:15:59Z jthaler $
0008 //----------------------------------------------------------------------
0009 // This file is part of FastJet contrib.
0010 //
0011 // It is free software; you can redistribute it and/or modify it under
0012 // the terms of the GNU General Public License as published by the
0013 // Free Software Foundation; either version 2 of the License, or (at
0014 // your option) any later version.
0015 //
0016 // It is distributed in the hope that it will be useful, but WITHOUT
0017 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
0018 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
0019 // License for more details.
0020 //
0021 // You should have received a copy of the GNU General Public License
0022 // along with this code. If not, see <http://www.gnu.org/licenses/>.
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      // defined in fastjet/internal/base.hh
0041 
0042 namespace contrib {
0043    
0044 // The following AxesDefinitions are currently available (and the relevant arguments, if needed)
0045 class HalfKT_Axes;
0046 class KT_Axes;
0047 class CA_Axes;
0048 class AntiKT_Axes;         // (R0)
0049 class WTA_HalfKT_Axes;
0050 class WTA_KT_Axes;
0051 class WTA_CA_Axes;
0052 class GenKT_Axes;          // (p, R0 = infinity)
0053 class WTA_GenKT_Axes;      // (p, R0 = infinity)
0054 class GenET_GenKT_Axes;    // (delta, p, R0 = infinity)
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;       // (R0)
0061 class OnePass_WTA_HalfKT_Axes;
0062 class OnePass_WTA_KT_Axes;
0063 class OnePass_WTA_CA_Axes;
0064 class OnePass_GenKT_Axes;        // (p, R0 = infinity)
0065 class OnePass_WTA_GenKT_Axes;    // (p, R0 = infinity)
0066 class OnePass_GenET_GenKT_Axes;  // (delta, p, R0 = infinity)
0067 class OnePass_Manual_Axes;
0068    
0069 class MultiPass_Axes;            // (NPass) (currently only defined for KT_Axes)
0070 class MultiPass_Manual_Axes;     // (NPass)
0071 
0072 class Comb_GenKT_Axes;           // (nExtra, p, R0 = infinity)
0073 class Comb_WTA_GenKT_Axes;       // (nExtra, p, R0 = infinity)
0074 class Comb_GenET_GenKT_Axes;     // (nExtra, delta, p, R0 = infinity)
0075 
0076 ///////
0077 //
0078 // AxesDefinition
0079 //
0080 ///////
0081 
0082 ///------------------------------------------------------------------------
0083 /// \class AxesDefinition
0084 /// \brief Base class for axes definitions
0085 ///
0086 /// A generic AxesDefinition first finds a set of seed axes.
0087 /// Then, if desired, uses measure information
0088 /// (from MeasureDefinition) to refine those axes starting from those seed axes.
0089 /// The AxesDefinitions are typically based on sequential jet algorithms.
0090 ///------------------------------------------------------------------------
0091 class AxesDefinition {
0092    
0093 public:
0094    
0095    /// This function should be overloaded in all derived classes, and defines how to find the seed axes.
0096    /// If desired, the measure information (which might be NULL) can be used to test multiple axes choices, but should
0097    /// not be used for iterative refining (since that is the job of MeasureDefinition).
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    /// Short description of AxesDefinitions (and any parameters)
0103    virtual std::string short_description() const = 0;
0104 
0105    /// Long description of AxesDefinitions (and any parameters)
0106    virtual std::string description() const = 0;
0107    
0108    /// This has to be defined in all derived classes, and allows these to be copied around.
0109    virtual AxesDefinition* create() const = 0;
0110    
0111 public:
0112    
0113    /// Starting from seeds, refine axes using one or more passes.
0114    /// Note that in order to do >0 passes, we need information from the MeasureDefinition about how to do the appropriate minimization.
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()); //added int casting to get rid of compiler warning
0121             
0122       if (_Npass == 0) {
0123          // no refining, just use seeds
0124          return seedAxes;
0125       } else if (_Npass == 1) {
0126          if (measure == NULL) throw Error("AxesDefinition:  One-pass minimization requires specifying a MeasureDefinition.");
0127          
0128          // do one pass minimum using measure definition
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    /// Combines get_starting_axes with get_refined_axes.
0137    /// In the Njettiness class, these two steps are done separately in order to store seed axes information.
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    /// Short-hand for the get_axes function.  Useful when trying to write terse code.
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    /// \enum AxesRefiningEnum
0154    /// Defines the cases of zero pass and one pass for convenience
0155    enum AxesRefiningEnum {
0156       UNDEFINED_REFINE = -1, // added to create a default value
0157       NO_REFINING = 0,
0158       ONE_PASS = 1,
0159       MULTI_PASS = 100,
0160    };
0161    
0162    /// A integer that is used externally to decide how to do multi-pass minimization
0163    int nPass() const { return _Npass; }
0164 
0165    /// A flag that indicates whether results are deterministics.
0166    bool givesRandomizedResults() const {
0167       return (_Npass > 1);
0168    }
0169    
0170    /// A flag that indicates whether manual axes are being used.
0171    bool needsManualAxes() const {
0172       return _needsManualAxes; // if there is no starting axes finder
0173    }
0174    
0175    /// Allows user to change number of passes.  Also used internally to set nPass.
0176    /// Can also specify details of one/multi pass minimziation
0177    void setNPass(int nPass,
0178                  int nAttempts = 1000,
0179                  double accuracy  = 0.0001,
0180                  double noise_range = 1.0 // only needed for MultiPass minimization
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    /// Destructor
0191    virtual ~AxesDefinition() {};
0192    
0193 protected:
0194    
0195    /// Default constructor contains no information.  Number of passes has to be set
0196    /// manually by derived classes using setNPass function.
0197    AxesDefinition() : _Npass(UNDEFINED_REFINE),
0198                      _nAttempts(0),
0199                      _accuracy(0.0),
0200                      _noise_range(0.0),
0201                      _needsManualAxes(false) {}
0202 
0203    /// Does multi-pass minimization by randomly jiggling the axes within _noise_range
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    /// Function to jiggle axes within _noise_range
0210    PseudoJet jiggle(const PseudoJet& axis) const;
0211    
0212    int _Npass;            ///< Number of passes (0 = no refining, 1 = one-pass, >1 multi-pass)
0213    int _nAttempts;        ///< Number of attempts per pass
0214    double _accuracy;      ///< Accuracy goal per pass
0215    double _noise_range;   ///< Noise in rapidity/phi (for multi-pass minimization only)
0216    bool _needsManualAxes; ///< Flag to indicate special case of manual axes
0217 };
0218   
0219 ///------------------------------------------------------------------------
0220 /// \class ExclusiveJetAxes
0221 /// \brief Base class for axes defined from exclusive jet algorithm
0222 ///
0223 /// This class finds axes by clustering particles with an exclusive jet definition.
0224 /// This can be implemented with different jet algorithms.  The user can call this directly
0225 /// using their favorite fastjet::JetDefinition
0226 ///------------------------------------------------------------------------
0227 class ExclusiveJetAxes : public AxesDefinition {
0228    
0229 public:
0230    /// Constructor takes JetDefinition as an argument
0231    ExclusiveJetAxes(fastjet::JetDefinition def)
0232    : AxesDefinition(), _def(def) {
0233       setNPass(NO_REFINING);    // default to no minimization
0234    }
0235    
0236    /// Starting axes obtained by creating a cluster sequenence and running exclusive_jets.
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);  // resize to make sure there are enough axes to not yield an error elsewhere
0247       }
0248      
0249       // Create axes list with extra information stripped (since ClusterSequence will not be kept around)
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    /// Short description
0260    virtual std::string short_description() const { return "ExclAxes";}
0261    /// Long description
0262    virtual std::string description() const { return "ExclAxes: " + _def.description();}
0263    
0264    /// To make it possible to copy around.
0265    virtual ExclusiveJetAxes* create() const {return new ExclusiveJetAxes(*this);}
0266 
0267 private:
0268    fastjet::JetDefinition _def; ///< Jet definition to use.
0269    static LimitedWarning _too_few_axes_warning;
0270 };
0271 
0272 ///------------------------------------------------------------------------
0273 /// \class ExclusiveCombinatorialJetAxes
0274 /// \brief Base class for axes defined from exclusive jet algorithm, checking combinatorial options
0275 ///
0276 /// This class finds axes by clustering particles with an exclusive jet definition.
0277 /// It takes an extra number of jets (specificed by the user via nExtra), and then finds the set of N that minimizes N-jettiness.
0278 /// WARNING: If one wants to be guarenteed that results improve by increasing nExtra, then one should use
0279 /// winner-take-all-style recombination schemes
0280 ///------------------------------------------------------------------------
0281 class ExclusiveCombinatorialJetAxes : public AxesDefinition {
0282    
0283 public:
0284    /// Constructor takes JetDefinition and nExtra as options (nExtra=0 acts the same as ExclusiveJetAxes)
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);   // default to no minimization
0289    }
0290    
0291     /// Find n_jets + _nExtra axes, and then choose the n_jets subset with the smallest N-(sub)jettiness value.
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);  // resize to make sure there are enough axes to not yield an error elsewhere
0302        }
0303        
0304       std::vector<fastjet::PseudoJet> final_axes;
0305 
0306       // check so that no computation time is wasted if there are no extra axes
0307       if (_nExtra == 0) final_axes = starting_axes;
0308 
0309       else {
0310  
0311         // define string of 1's based on number of desired jets
0312         std::string bitmask(n_jets, 1);
0313         // expand the array size to the total number of jets with extra 0's at the end, makes string easy to permute
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           // only take an axis if it is listed as true (1) in the string
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           // permutes string of 1's and 0's according to next lexicographic ordering and returns true
0335           // continues to loop through all possible lexicographic orderings
0336           // returns false and breaks the loop when there are no more possible orderings
0337         } while (std::prev_permutation(bitmask.begin(), bitmask.end()));
0338       }
0339 
0340       return final_axes;
0341     }
0342 
0343    /// Short description
0344    virtual std::string short_description() const { return "ExclCombAxes";}
0345    /// Long description
0346    virtual std::string description() const { return "ExclCombAxes: " + _def.description();}
0347    /// To make it possible to copy around.
0348    virtual ExclusiveCombinatorialJetAxes* create() const {return new ExclusiveCombinatorialJetAxes(*this);}
0349 
0350 private:
0351    fastjet::JetDefinition _def;   ///< Jet definition to use
0352    int _nExtra;                   ///< Extra axes to find
0353    static LimitedWarning _too_few_axes_warning;
0354 };
0355    
0356 ///------------------------------------------------------------------------
0357 /// \class HardestJetAxes
0358 /// \brief Base class for axes defined from an inclusive jet algorithm
0359 ///
0360 /// This class finds axes by running an inclusive algorithm and then finding the n hardest jets.
0361 /// This can be implemented with different jet algorithms, and can be called by the user.
0362 ///------------------------------------------------------------------------
0363 class HardestJetAxes : public AxesDefinition {
0364 public:
0365    /// Constructor takes JetDefinition
0366    HardestJetAxes(fastjet::JetDefinition def)
0367    : AxesDefinition(), _def(def) {
0368       setNPass(NO_REFINING);    // default to no minimization
0369    }
0370    
0371    /// Finds seed axes by running a ClusterSequence, running inclusive_jets, and finding the N hardest
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);  // only keep n hardest
0383       return axes;
0384    }
0385    
0386    /// Short description
0387    virtual std::string short_description() const { return "HardAxes";}
0388    /// Long description
0389    virtual std::string description() const { return "HardAxes: " + _def.description();}
0390    /// To make it possible to copy around.
0391    virtual HardestJetAxes* create() const {return new HardestJetAxes(*this);}
0392    
0393 private:
0394    fastjet::JetDefinition _def;  ///< Jet Definition to use.
0395    
0396    static LimitedWarning _too_few_axes_warning;
0397 
0398 };
0399 
0400 
0401 ///------------------------------------------------------------------------
0402 /// \class HalfKT_Axes
0403 /// \brief Axes from exclusive generalized kT with p = 1/2
0404 ///
0405 /// Axes from a general KT algorithm with p=1/2 (standard E-scheme recombination)
0406 ///------------------------------------------------------------------------
0407 class HalfKT_Axes : public ExclusiveJetAxes {
0408    
0409 public:
0410    /// Constructor
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    /// Short description
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    /// Long descriptions
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    /// For copying purposes
0435    virtual HalfKT_Axes* create() const {return new HalfKT_Axes(*this);}
0436 
0437 };
0438 
0439    
0440 ///------------------------------------------------------------------------
0441 /// \class KT_Axes
0442 /// \brief Axes from exclusive kT
0443 ///
0444 /// Axes from kT algorithm with E_scheme recombination.
0445 ///------------------------------------------------------------------------
0446 class KT_Axes : public ExclusiveJetAxes {
0447 public:
0448    /// Constructor
0449    KT_Axes()
0450    : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::kt_algorithm,
0451                                              fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
0452                                              fastjet::E_scheme,
0453                                              fastjet::Best)
0454                       ) {
0455       setNPass(NO_REFINING);
0456    }
0457 
0458    /// Short description
0459    virtual std::string short_description() const {
0460       return "KT";
0461    };
0462    
0463    /// Long description
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    /// For copying purposes
0472    virtual KT_Axes* create() const {return new KT_Axes(*this);}
0473 
0474 };
0475 
0476 ///------------------------------------------------------------------------
0477 /// \class CA_Axes
0478 /// \brief Axes from exclusive CA
0479 ///
0480 /// Axes from CA algorithm with E_scheme recombination.
0481 ///------------------------------------------------------------------------
0482 class CA_Axes : public ExclusiveJetAxes {
0483 public:
0484    /// Constructor
0485    CA_Axes()
0486    : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::cambridge_algorithm,
0487                                              fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
0488                                              fastjet::E_scheme,
0489                                              fastjet::Best)
0490                       ) {
0491       setNPass(NO_REFINING);
0492    }
0493 
0494    /// Short description
0495    virtual std::string short_description() const {
0496       return "CA";
0497    };
0498    
0499    /// Long description
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    /// For copying purposes
0508    virtual CA_Axes* create() const {return new CA_Axes(*this);}
0509    
0510 };
0511 
0512    
0513 ///------------------------------------------------------------------------
0514 /// \class AntiKT_Axes
0515 /// \brief Axes from inclusive anti-kT
0516 ///
0517 /// Axes from anti-kT algorithm and E_scheme.
0518 /// The one parameter R0 is subjet radius
0519 ///------------------------------------------------------------------------
0520 class AntiKT_Axes : public HardestJetAxes {
0521 
0522 public:
0523    /// Constructor.  Takes jet radius as argument
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    /// Short description
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    /// Long description
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    /// For copying purposes
0550    virtual AntiKT_Axes* create() const {return new AntiKT_Axes(*this);}
0551    
0552 protected:
0553    double _R0;  ///<  AKT jet radius
0554 
0555 };
0556 
0557 ///------------------------------------------------------------------------
0558 /// \class JetDefinitionWrapper
0559 /// \brief Wrapper for jet definitions (for memory management)
0560 ///
0561 /// This class is used by all AxesDefinition with a manual recombiner to
0562 /// ensure that the delete_recombiner_when_unused function is always called
0563 ///------------------------------------------------------------------------
0564 class JetDefinitionWrapper {
0565 
0566 public: 
0567    
0568    /// Default Constructor
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();        // added to prevent memory leaks
0573    }
0574 
0575    /// Additional constructor so that build-in FastJet algorithms can also be called
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    /// Return jet definition
0582    JetDefinition getJetDef() {
0583       return jet_def;
0584    }
0585 
0586 private:
0587    JetDefinition jet_def;  ///< my jet definition
0588 };
0589 
0590 ///------------------------------------------------------------------------
0591 /// \class WTA_HalfKT_Axes
0592 /// \brief Axes from exclusive generalized kT with p =1/2, winner-take-all recombination
0593 ///
0594 /// Axes from a general KT algorithm (p = 1/2) with a Winner Take All Recombiner
0595 ///------------------------------------------------------------------------
0596 class WTA_HalfKT_Axes : public ExclusiveJetAxes {
0597 
0598 public:
0599    /// Constructor
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    /// Short description
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    /// Long descriptions
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    /// For copying purposes
0626    virtual WTA_HalfKT_Axes* create() const {return new WTA_HalfKT_Axes(*this);}
0627 
0628 };
0629 
0630 
0631 ///------------------------------------------------------------------------
0632 /// \class WTA_KT_Axes
0633 /// \brief Axes from exclusive kT, winner-take-all recombination
0634 ///
0635 /// Axes from kT algorithm and winner-take-all recombination
0636 ///------------------------------------------------------------------------
0637 class WTA_KT_Axes : public ExclusiveJetAxes {
0638 public:
0639    /// Constructor
0640    WTA_KT_Axes()
0641    : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::kt_algorithm,
0642                                           fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
0643                                           new WinnerTakeAllRecombiner(), // Needs to be explicitly declared (this will be deleted by JetDefinitionWrapper)
0644                                           fastjet::Best).getJetDef()
0645                       ) {
0646       setNPass(NO_REFINING);
0647     }
0648 
0649    /// Short description
0650    virtual std::string short_description() const {
0651       return "WTA KT";
0652    };
0653    
0654    /// Long description
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    /// For copying purposes
0663    virtual WTA_KT_Axes* create() const {return new WTA_KT_Axes(*this);}
0664 
0665 };
0666    
0667 ///------------------------------------------------------------------------
0668 /// \class WTA_CA_Axes
0669 /// \brief Axes from exclusive CA, winner-take-all recombination
0670 ///
0671 /// Axes from CA algorithm and winner-take-all recombination
0672 ///------------------------------------------------------------------------
0673 class WTA_CA_Axes : public ExclusiveJetAxes {
0674 public:
0675    /// Constructor
0676    WTA_CA_Axes()
0677    : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::cambridge_algorithm,
0678                                              fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
0679                                              new WinnerTakeAllRecombiner(), // Needs to be explicitly declared (this will be deleted by JetDefinitionWrapper)
0680                                              fastjet::Best).getJetDef()) {
0681     setNPass(NO_REFINING);
0682   }
0683 
0684    /// Short description
0685    virtual std::string short_description() const {
0686       return "WTA CA";
0687    };
0688    
0689    /// Long descriptions
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    /// For copying purposes
0698    virtual WTA_CA_Axes* create() const {return new WTA_CA_Axes(*this);}
0699   
0700 };
0701 
0702 
0703 ///------------------------------------------------------------------------
0704 /// \class GenKT_Axes
0705 /// \brief Axes from exclusive generalized kT
0706 ///
0707 /// Axes from a general KT algorithm (standard E-scheme recombination)
0708 /// Requires the power of the KT algorithm to be used and the radius parameter
0709 ///------------------------------------------------------------------------
0710 class GenKT_Axes : public ExclusiveJetAxes {
0711    
0712 public:
0713    /// Constructor
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    /// Short description
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    /// Long descriptions
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    /// For copying purposes
0739    virtual GenKT_Axes* create() const {return new GenKT_Axes(*this);}
0740    
0741 protected:
0742    double _p;   ///< genkT power
0743    double _R0;  ///< jet radius
0744 };
0745    
0746    
0747 ///------------------------------------------------------------------------
0748 /// \class WTA_GenKT_Axes
0749 /// \brief Axes from exclusive generalized kT, winner-take-all recombination
0750 ///
0751 /// Axes from a general KT algorithm with a Winner Take All Recombiner
0752 /// Requires the power of the KT algorithm to be used and the radius parameter
0753 ///------------------------------------------------------------------------
0754 class WTA_GenKT_Axes : public ExclusiveJetAxes {
0755 
0756 public:
0757    /// Constructor
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    /// Short description
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    /// Long descriptions
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    /// For copying purposes
0785    virtual WTA_GenKT_Axes* create() const {return new WTA_GenKT_Axes(*this);}
0786    
0787 protected:
0788    double _p;   ///< genkT power
0789    double _R0;  ///< jet radius
0790 };
0791    
0792 ///------------------------------------------------------------------------
0793 /// \class GenET_GenKT_Axes
0794 /// \brief Axes from exclusive kT, generalized Et-scheme recombination
0795 ///
0796 /// Class using general KT algorithm with a more general recombination scheme
0797 /// Requires power of KT algorithm, power of recombination weights, and radius parameter
0798 ///------------------------------------------------------------------------
0799 class GenET_GenKT_Axes : public ExclusiveJetAxes {
0800 
0801 public:
0802    /// Constructor
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    /// Short description
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    /// Long description
0820    virtual std::string description() const {
0821       std::stringstream stream;
0822       stream << std::fixed << std::setprecision(2);
0823       // TODO: if _delta is huge, change to "WTA"
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    /// For copying purposes
0831    virtual GenET_GenKT_Axes* create() const {return new GenET_GenKT_Axes(*this);}
0832    
0833 protected:
0834    double _delta; ///< Recombination pT weighting
0835    double _p;     ///< GenkT power
0836    double _R0;    ///< jet radius
0837 };
0838 
0839 ///------------------------------------------------------------------------
0840 /// \class OnePass_HalfKT_Axes
0841 /// \brief Axes from exclusive generalized kT (p = 1/2) with one-pass minimization
0842 ///
0843 /// Onepass minimization, General KT Axes with p = 1/2 (standard E-scheme recombination)
0844 ///------------------------------------------------------------------------
0845 class OnePass_HalfKT_Axes : public HalfKT_Axes {
0846    
0847 public:
0848    /// Constructor
0849   OnePass_HalfKT_Axes() : HalfKT_Axes() {
0850       setNPass(ONE_PASS);
0851    }
0852    
0853    /// Short description
0854    virtual std::string short_description() const {
0855       return "OnePass HalfKT";
0856    };
0857    
0858    /// Long description
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    /// For copying purposes
0867    virtual OnePass_HalfKT_Axes* create() const {return new OnePass_HalfKT_Axes(*this);}
0868 };
0869 
0870 
0871 ///------------------------------------------------------------------------
0872 /// \class OnePass_KT_Axes
0873 /// \brief Axes from exclusive kT, with one-pass minimization
0874 ///
0875 /// Onepass minimization from kt axes
0876 ///------------------------------------------------------------------------
0877 class OnePass_KT_Axes : public KT_Axes {
0878 public:
0879    /// Constructor
0880    OnePass_KT_Axes() : KT_Axes() {
0881       setNPass(ONE_PASS);
0882    }
0883    
0884    /// Short description
0885    virtual std::string short_description() const {
0886       return "OnePass KT";
0887    };
0888    
0889    /// Long description
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    /// For copying purposes
0898    virtual OnePass_KT_Axes* create() const {return new OnePass_KT_Axes(*this);}
0899 
0900 };
0901 
0902 ///------------------------------------------------------------------------
0903 /// \class OnePass_CA_Axes
0904 /// \brief Axes from exclusive CA, with one-pass minimization
0905 ///
0906 /// Onepass minimization from CA axes
0907 ///------------------------------------------------------------------------
0908 class OnePass_CA_Axes : public CA_Axes {
0909 public:
0910    /// Constructor
0911    OnePass_CA_Axes() : CA_Axes() {
0912       setNPass(ONE_PASS);
0913    }
0914 
0915    /// Short description
0916    virtual std::string short_description() const {
0917       return "OnePass CA";
0918    };
0919    
0920    /// Long description
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    /// For copying purposes
0929    virtual OnePass_CA_Axes* create() const {return new OnePass_CA_Axes(*this);}
0930 
0931 
0932 };
0933    
0934 ///------------------------------------------------------------------------
0935 /// \class OnePass_AntiKT_Axes
0936 /// \brief Axes from inclusive anti-kT, with one-pass minimization
0937 ///
0938 /// Onepass minimization from AntiKT axes, one parameter R0
0939 ///------------------------------------------------------------------------
0940 class OnePass_AntiKT_Axes : public AntiKT_Axes {
0941 
0942 public:
0943    /// Constructor
0944    OnePass_AntiKT_Axes(double R0) : AntiKT_Axes(R0) {
0945       setNPass(ONE_PASS);
0946    }
0947    
0948    /// Short Description
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    /// Long description
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    /// For copying purposes
0965    virtual OnePass_AntiKT_Axes* create() const {return new OnePass_AntiKT_Axes(*this);}
0966 
0967 };
0968 
0969 
0970 ///------------------------------------------------------------------------
0971 /// \class OnePass_WTA_HalfKT_Axes
0972 /// \brief Axes from exclusive generalized kT with p = 1/2, winner-take-all recombination, with one-pass minimization
0973 ///
0974 /// Onepass minimization from winner-take-all, General KT Axes with p = 1/2
0975 ///------------------------------------------------------------------------
0976 class OnePass_WTA_HalfKT_Axes : public WTA_HalfKT_Axes {
0977    
0978 public:
0979    /// Constructor
0980    OnePass_WTA_HalfKT_Axes() : WTA_HalfKT_Axes() {
0981       setNPass(ONE_PASS);
0982    }
0983 
0984    /// Short description
0985    virtual std::string short_description() const {
0986       return "OnePass WTA HalfKT";
0987    };
0988    
0989    /// Long description
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    /// For copying purposes
0998    virtual OnePass_WTA_HalfKT_Axes* create() const {return new OnePass_WTA_HalfKT_Axes(*this);}
0999 };
1000 
1001 ///------------------------------------------------------------------------
1002 /// \class OnePass_WTA_KT_Axes
1003 /// \brief Axes from exclusive kT, winner-take-all recombination, with one-pass minimization
1004 ///
1005 /// Onepass minimization from winner-take-all kt axes
1006 ///------------------------------------------------------------------------
1007 class OnePass_WTA_KT_Axes : public WTA_KT_Axes {
1008 public:
1009    /// Constructor
1010    OnePass_WTA_KT_Axes() : WTA_KT_Axes() {
1011       setNPass(ONE_PASS);
1012    }
1013    
1014    /// Short description
1015    virtual std::string short_description() const {
1016       return "OnePass WTA KT";
1017    };
1018    
1019    /// Long description
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    /// For copying purposes
1028    virtual OnePass_WTA_KT_Axes* create() const {return new OnePass_WTA_KT_Axes(*this);}
1029    
1030 
1031 };
1032 
1033 ///------------------------------------------------------------------------
1034 /// \class OnePass_WTA_CA_Axes
1035 /// \brief Axes from exclusive CA, winner-take-all recombination, with one-pass minimization
1036 ///
1037 /// Onepass minimization from winner-take-all CA axes
1038 ///------------------------------------------------------------------------
1039 class OnePass_WTA_CA_Axes : public WTA_CA_Axes {
1040    
1041 public:
1042    /// Constructor
1043    OnePass_WTA_CA_Axes() : WTA_CA_Axes() {
1044       setNPass(ONE_PASS);
1045    }
1046 
1047    /// Short description
1048    virtual std::string short_description() const {
1049       return "OnePass WTA CA";
1050    };
1051    
1052    /// Long description
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    /// For copying purposes
1061    virtual OnePass_WTA_CA_Axes* create() const {return new OnePass_WTA_CA_Axes(*this);}
1062    
1063 };
1064 
1065 ///------------------------------------------------------------------------
1066 /// \class OnePass_GenKT_Axes
1067 /// \brief Axes from exclusive generalized kT with one-pass minimization
1068 ///
1069 /// Onepass minimization, General KT Axes (standard E-scheme recombination)
1070 ///------------------------------------------------------------------------
1071 class OnePass_GenKT_Axes : public GenKT_Axes {
1072    
1073 public:
1074    /// Constructor
1075    OnePass_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R) : GenKT_Axes(p, R0) {
1076       setNPass(ONE_PASS);
1077    }
1078    
1079    /// Short description
1080    virtual std::string short_description() const {
1081       return "OnePass GenKT";
1082    };
1083    
1084    /// Long description
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    /// For copying purposes
1093    virtual OnePass_GenKT_Axes* create() const {return new OnePass_GenKT_Axes(*this);}
1094 };
1095    
1096 ///------------------------------------------------------------------------
1097 /// \class OnePass_WTA_GenKT_Axes
1098 /// \brief Axes from exclusive generalized kT, winner-take-all recombination, with one-pass minimization
1099 ///
1100 /// Onepass minimization from winner-take-all, General KT Axes
1101 ///------------------------------------------------------------------------
1102 class OnePass_WTA_GenKT_Axes : public WTA_GenKT_Axes {
1103    
1104 public:
1105    /// Constructor
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    /// Short description
1111    virtual std::string short_description() const {
1112       return "OnePass WTA GenKT";
1113    };
1114    
1115    /// Long description
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    /// For copying purposes
1124    virtual OnePass_WTA_GenKT_Axes* create() const {return new OnePass_WTA_GenKT_Axes(*this);}
1125 };
1126 
1127 ///------------------------------------------------------------------------
1128 /// \class OnePass_GenET_GenKT_Axes
1129 /// \brief Axes from exclusive generalized kT, generalized Et-scheme recombination, with one-pass minimization
1130 ///
1131 /// Onepass minimization from General Recomb, General KT axes
1132 ///------------------------------------------------------------------------
1133 class OnePass_GenET_GenKT_Axes : public GenET_GenKT_Axes {
1134    
1135 public:
1136    /// Constructor
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    /// Short description
1142    virtual std::string short_description() const {
1143       return "OnePass GenET, GenKT";
1144    };
1145    
1146    /// Long description
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    /// For copying purposes
1157    virtual OnePass_GenET_GenKT_Axes* create() const {return new OnePass_GenET_GenKT_Axes(*this);}
1158 };
1159 
1160 
1161 ///------------------------------------------------------------------------
1162 /// \class Manual_Axes
1163 /// \brief Manual axes finding
1164 ///
1165 /// Allows the user to set the axes manually
1166 ///------------------------------------------------------------------------
1167 class Manual_Axes : public AxesDefinition {
1168 public:
1169    /// Constructor.  Note that _needsManualAxes is set to true.
1170    Manual_Axes() : AxesDefinition() {
1171       setNPass(NO_REFINING);
1172       _needsManualAxes = true;
1173    }
1174    
1175    /// This is now a dummy function since this is manual mode
1176    virtual std::vector<fastjet::PseudoJet> get_starting_axes(int,
1177                                                              const std::vector<fastjet::PseudoJet>&,
1178                                                              const MeasureDefinition *) const;
1179 
1180    
1181    /// Short description
1182    virtual std::string short_description() const {
1183       return "Manual";
1184    };
1185    
1186    /// Long description
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    /// For copying purposes
1195    virtual Manual_Axes* create() const {return new Manual_Axes(*this);}
1196 
1197 
1198 };
1199 
1200 ///------------------------------------------------------------------------
1201 /// \class OnePass_Manual_Axes
1202 /// \brief Manual axes finding, with one-pass minimization
1203 ///
1204 /// One pass minimization from manual starting point
1205 ///------------------------------------------------------------------------
1206 class OnePass_Manual_Axes : public Manual_Axes {
1207 public:
1208    /// Constructor.  Note that _needsManualAxes is set to true.
1209    OnePass_Manual_Axes() : Manual_Axes() {
1210       setNPass(ONE_PASS);
1211    }
1212    
1213    /// Short description
1214    virtual std::string short_description() const {
1215       return "OnePass Manual";
1216    };
1217    
1218    /// Long description
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    // For copying purposes
1227    virtual OnePass_Manual_Axes* create() const {return new OnePass_Manual_Axes(*this);}
1228 
1229 };
1230    
1231 ///------------------------------------------------------------------------
1232 /// \class MultiPass_Axes
1233 /// \brief Manual axes finding, with multi-pass (randomized) minimization
1234 ///
1235 /// Multi-pass minimization from kT starting point
1236 ///------------------------------------------------------------------------
1237 class MultiPass_Axes : public KT_Axes {
1238 
1239 public:
1240    
1241    /// Constructor
1242    MultiPass_Axes(unsigned int Npass) : KT_Axes() {
1243       setNPass(Npass);
1244    }
1245 
1246    /// Short description
1247    virtual std::string short_description() const {
1248       return "MultiPass";
1249    };
1250    
1251    /// Long description
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    /// For copying purposs
1260    virtual MultiPass_Axes* create() const {return new MultiPass_Axes(*this);}
1261    
1262 };
1263 
1264 ///------------------------------------------------------------------------
1265 /// \class MultiPass_Manual_Axes
1266 /// \brief Axes finding from exclusive kT, with multi-pass (randomized) minimization
1267 ///
1268 /// multi-pass minimization from kT starting point
1269 ///------------------------------------------------------------------------
1270 class MultiPass_Manual_Axes : public Manual_Axes {
1271 
1272 public:
1273    /// Constructor
1274    MultiPass_Manual_Axes(unsigned int Npass) : Manual_Axes() {
1275       setNPass(Npass);
1276    }
1277 
1278    /// Short Description
1279    virtual std::string short_description() const {
1280       return "MultiPass Manual";
1281    };
1282    
1283    
1284    /// Long description
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    /// For copying purposes
1293    virtual MultiPass_Manual_Axes* create() const {return new MultiPass_Manual_Axes(*this);}
1294    
1295 };
1296 
1297 ///------------------------------------------------------------------------
1298 /// \class Comb_GenKT_Axes
1299 /// \brief Axes from exclusive generalized kT with combinatorial testing
1300 ///
1301 /// Axes from kT algorithm (standard E-scheme recombination)
1302 /// Requires nExtra parameter and returns set of N that minimizes N-jettiness
1303 /// Note that this method is not guaranteed to find a deeper minimum than GenKT_Axes
1304 ///------------------------------------------------------------------------
1305 class Comb_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
1306 public:
1307    /// Constructor
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    /// Short description
1316    virtual std::string short_description() const {
1317       return "N Choose M GenKT";
1318    };
1319    
1320    /// Long description
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    /// For copying purposes
1329    virtual Comb_GenKT_Axes* create() const {return new Comb_GenKT_Axes(*this);}
1330    
1331 private:
1332    double _nExtra;   ///< Number of extra axes
1333    double _p;        ///< GenkT power
1334    double _R0;       ///< jet radius
1335 };
1336    
1337    
1338 
1339 ///------------------------------------------------------------------------
1340 /// \class Comb_WTA_GenKT_Axes
1341 /// \brief Axes from exclusive generalized kT, winner-take-all recombination, with combinatorial testing
1342 ///
1343 /// Axes from kT algorithm and winner-take-all recombination
1344 /// Requires nExtra parameter and returns set of N that minimizes N-jettiness
1345 ///------------------------------------------------------------------------
1346 class Comb_WTA_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
1347 public:
1348    /// Constructor
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    /// Short description
1357    virtual std::string short_description() const {
1358       return "N Choose M WTA GenKT";
1359    };
1360    
1361    /// Long description
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    /// For copying purposes
1370    virtual Comb_WTA_GenKT_Axes* create() const {return new Comb_WTA_GenKT_Axes(*this);}
1371 
1372 private:
1373    double _nExtra;   ///< Number of extra axes
1374    double _p;        ///< GenkT power
1375    double _R0;       ///< jet radius
1376 };
1377    
1378 ///------------------------------------------------------------------------
1379 /// \class Comb_GenET_GenKT_Axes
1380 /// \brief Axes from exclusive generalized kT, generalized Et-scheme recombination, with combinatorial testing
1381 ///
1382 /// Axes from kT algorithm and General Et scheme recombination
1383 /// Requires nExtra parameter and returns set of N that minimizes N-jettiness
1384 ///------------------------------------------------------------------------
1385 class Comb_GenET_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
1386 public:
1387    /// Constructor
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    /// Short description
1397    virtual std::string short_description() const {
1398       return "N Choose M GenET GenKT";
1399    };
1400    
1401    /// Long description
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    /// For copying purposes
1412    virtual Comb_GenET_GenKT_Axes* create() const {return new Comb_GenET_GenKT_Axes(*this);}
1413 
1414 private:
1415    double _nExtra;   ///< Number of extra axes
1416    double _delta;    ///< Recombination pT weighting exponent
1417    double _p;        ///< GenkT power
1418    double _R0;       ///< jet radius
1419 };
1420    
1421 
1422 } // namespace contrib
1423 
1424 FASTJET_END_NAMESPACE
1425 
1426 #endif  // __FASTJET_CONTRIB_NJETTINESS_HH__
1427