Fork me on GitHub

Ignore:
Timestamp:
Oct 9, 2015, 2:47:38 PM (9 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
8713dee
Parents:
f118021
Message:

update FastJet library to 3.1.3 and Nsubjettiness library to 2.2.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: NjettinessPlugin.hh 671 2014-06-10 17:47:52Z jthaler $
     7//  $Id: NjettinessPlugin.hh 822 2015-06-15 23:52:57Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    2626#define __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
    2727
     28#include <fastjet/config.h>
     29
    2830#include "Njettiness.hh"
    29 #include "MeasureFunction.hh"
    30 #include "AxesFinder.hh"
     31#include "MeasureDefinition.hh"
     32#include "AxesDefinition.hh"
     33#include "TauComponents.hh"
    3134
    3235#include "fastjet/ClusterSequence.hh"
     
    4144namespace contrib {
    4245
    43 //------------------------------------------------------------------------
    44 /// \class NjettinessExtras
    45 // This class contains the same information as Njettiness, but redoes it in terms of the ClusterSequence::Extras class.
    46 // This is done in order to help improve the interface for the main NjettinessPlugin class.
    47 // TODO:  This class should probably be merged with TauComponents, since both have access
    48 // to similar information
    49 class NjettinessExtras : public ClusterSequence::Extras {
    50    
    51    public:
    52       NjettinessExtras(TauComponents tau_components, std::vector<fastjet::PseudoJet> jets, std::vector<fastjet::PseudoJet> axes) : _tau_components(tau_components), _jets(jets), _axes(axes) {}
    53      
    54       double totalTau() const {return _tau_components.tau();}
    55       std::vector<double> subTaus() const {return _tau_components.jet_pieces();}
    56       std::vector<fastjet::PseudoJet> jets() const {return _jets;}
    57       std::vector<fastjet::PseudoJet> axes() const {return _axes;}
    58      
    59       double totalTau(const fastjet::PseudoJet& /*jet*/) const {
    60          return _tau_components.tau();
    61       }
    62      
    63       double subTau(const fastjet::PseudoJet& jet) const {
    64          if (labelOf(jet) == -1) return std::numeric_limits<double>::quiet_NaN(); // nonsense
    65          return _tau_components.jet_pieces()[labelOf(jet)];
    66       }
    67      
    68       double beamTau() const {
    69          return _tau_components.beam_piece();
    70       }
    71      
    72       fastjet::PseudoJet axis(const fastjet::PseudoJet& jet) const {
    73          return _axes[labelOf(jet)];
    74       }
    7546
    76       bool has_njettiness_extras(const fastjet::PseudoJet& jet) const {
    77          return (labelOf(jet) >= 0);
    78       }
    79    
    80 private:
    81    
    82    TauComponents _tau_components;
    83    std::vector<fastjet::PseudoJet> _jets;
    84    std::vector<fastjet::PseudoJet> _axes;
    85    
    86    int labelOf(const fastjet::PseudoJet& jet) const {
    87       int thisJet = -1;
    88       for (unsigned int i = 0; i < _jets.size(); i++) {
    89          if (_jets[i].cluster_hist_index() == jet.cluster_hist_index()) {
    90             thisJet = i;
    91             break;
    92          }
    93       }
    94       return thisJet;
    95    }
    96 };
    97 
    98 inline const NjettinessExtras * njettiness_extras(const fastjet::PseudoJet& jet) {
    99    const ClusterSequence * myCS = jet.associated_cluster_sequence();   
    100    if (myCS == NULL) return NULL;
    101    const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS->extras());   
    102    return extras;   
    103 }
    104 
    105 inline const NjettinessExtras * njettiness_extras(const fastjet::ClusterSequence& myCS) {
    106    const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS.extras());   
    107    return extras;   
    108 }
    109 
    110 /// The Njettiness jet algorithm
     47/// \class NjettinessPlugin
     48/// \brief Implements the N-jettiness Jet Algorithm
    11149/**
    11250 * An exclusive jet finder that identifies N jets; first N axes are found, then
     
    11452 * corresponding jet is simply the four-momentum sum of these particles.
    11553 *
    116  * Axes can be found in several ways, specified by the AxesMode argument.  The
    117  * recommended choices are
     54 * As of version 2.2, it is recommended to use the XConePlugin, which has
     55 * sensible default values for jet finding.
    11856 *
    119  * kt_axes              : exclusive kT
    120  * wta_kt_axes          : exclusive kT with winner-take-all-recombination
    121  * onepass_kt_axes      : one-pass minimization seeded by kt (pretty good)
    122  * onepass_wta_kt_axes  : one-pass minimization seeded by wta_kt
     57 * Axes can be found in several ways, specified by the AxesDefinition argument.
     58 * The recommended AxesDefinitions for jet finding (different than for jet shapes)
     59 *    OnePass_AntiKT(R0)  :  one-pass minimization from anti-kT starting point
     60 *    OnePass_GenET_GenKT_Axes(delta, p, R0) : one-pass min. from GenET/KT
     61 *    OnePass_WTA_GenKT_Axes(p, R0)          : one-pass min from WTA/GenKT
     62 * For recommendations on which axes to use, please see the README file.
     63 *
     64 * Jet regions are determined by the MeasureDefinition.  The recommended choices
     65 * for jet finding are
     66 *    ConicalMeasure(beta,R0) : perfect cones in rapidity/azimuth plane
     67 *    XConeMeasure(beta,R0)   : approximate cones based on dot product distances.
    12368 *
    124  * For the UnnormalizedMeasure(beta), N-jettiness is defined as:
    125  *
    126  * tau_N = Sum_{all particles i} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...)
    127  *
    128  *   DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
    129  *   and jet j.
     69 * Other measures introduced in version 2.2 include OriginalGeometricMeasure,
     70 * ModifiedGeometricMeasure, and ConicalGeometricMeasure, which define N-jettiness
     71 * through dot products of particle momenta with light-like axes. OriginalGeometricMeasure
     72 * produces football-shaped jets due to its central weighting of the beam measure,
     73 * but ModifiedGeometric and ConicalGeometric both deform the original geometric measure
     74 * to allow for cone-shaped jets. The size of these cones can be controlled through Rcutoff
     75 * just as in the other measures. See the README file or MeasureDefinition.hh for information
     76 * on how to call these measures.
    13077 *
    131  * The NormalizedMeausure include an extra parameter R0, and the various cutoff
    132  * measures include an Rcutoff, which effectively defines an angular cutoff
    133  * similar in effect to a cone-jet radius.
    134  *
    13578 */
    136 
    13779class NjettinessPlugin : public JetDefinition::Plugin {
    13880public:
    13981
    140    // Constructor with same arguments as Nsubjettiness.
     82   /// Constructor with same arguments as Nsubjettiness (N, AxesDefinition, MeasureDefinition)
    14183   NjettinessPlugin(int N,
    14284                    const AxesDefinition & axes_def,
     
    14486   : _njettinessFinder(axes_def, measure_def), _N(N) {}
    14587   
     88
     89   /// Description
     90   virtual std::string description () const;
     91   /// Jet radius (this does not make sense yet)
     92   virtual double R() const {return -1.0;} // TODO: make this not stupid
     93
     94   /// The actually clustering, which first called Njettiness and then creates a dummy ClusterSequence
     95   virtual void run_clustering(ClusterSequence&) const;
     96
     97   /// For using manual axes with Njettiness Plugin
     98   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
     99      // Cross check that manual axes are being used is in Njettiness
     100      _njettinessFinder.setAxes(myAxes);
     101   }
     102
     103   /// Destructor
     104   virtual ~NjettinessPlugin() {}
     105
     106private:
     107
     108   Njettiness _njettinessFinder;  ///< The core Njettiness that does the heavy lifting
     109   int _N;  ///< Number of exclusive jets to find.
     110
     111   /// Warning if the user tries to use v1.0.3 constructor.
     112   static LimitedWarning _old_constructor_warning;
    146113   
     114public:
     115
    147116   // Alternative constructors that define the measure via enums and parameters
    148    // These constructors are likely be removed
     117   // These constructors are deprecated and will be removed in a future version.
     118   
     119   /// \deprecated
     120   /// Old-style constructor with 0 arguments (DEPRECATED)
    149121   NjettinessPlugin(int N,
    150                  Njettiness::AxesMode axes_mode,
    151                  Njettiness::MeasureMode measure_mode)
    152    : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {}
     122                    Njettiness::AxesMode axes_mode,
     123                    Njettiness::MeasureMode measure_mode)
     124   : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {
     125      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
     126   }
    153127   
     128   /// \deprecated
     129   /// Old-style constructor with 1 argument (DEPRECATED)
     130      NjettinessPlugin(int N,
     131                    Njettiness::AxesMode axes_mode,
     132                    Njettiness::MeasureMode measure_mode,
     133                    double para1)
     134   : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {
     135      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
    154136   
     137   }
     138   
     139   /// \deprecated
     140   /// Old-style constructor with 2 arguments (DEPRECATED)
    155141   NjettinessPlugin(int N,
    156                  Njettiness::AxesMode axes_mode,
    157                  Njettiness::MeasureMode measure_mode,
    158                  double para1)
    159    : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {}
     142                    Njettiness::AxesMode axes_mode,
     143                    Njettiness::MeasureMode measure_mode,
     144                    double para1,
     145                    double para2)
     146   : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {
     147      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
    160148   
     149   }
    161150   
     151   /// \deprecated
     152   /// Old-style constructor with 3 arguments (DEPRECATED)
    162153   NjettinessPlugin(int N,
    163                  Njettiness::AxesMode axes_mode,
    164                  Njettiness::MeasureMode measure_mode,
    165                  double para1,
    166                  double para2)
    167    : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {}
     154                    Njettiness::AxesMode axes_mode,
     155                    Njettiness::MeasureMode measure_mode,
     156                    double para1,
     157                    double para2,
     158                    double para3)
     159   : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {
     160      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
     161   }
    168162   
    169    
    170    NjettinessPlugin(int N,
    171                  Njettiness::AxesMode axes_mode,
    172                  Njettiness::MeasureMode measure_mode,
    173                  double para1,
    174                  double para2,
    175                  double para3)
    176    : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {}
    177 
    178 
    179    // Old constructor for backwards compatibility with v1.0,
    180    // where NormalizedCutoffMeasure was the only option
     163   /// \deprecated
     164   /// Old-style constructor for backwards compatibility with v1.0, when NormalizedCutoffMeasure was the only option
    181165   NjettinessPlugin(int N,
    182166                    Njettiness::AxesMode mode,
     
    184168                    double R0,
    185169                    double Rcutoff=std::numeric_limits<double>::max())
    186    : _njettinessFinder(mode, NormalizedCutoffMeasure(beta, R0, Rcutoff)), _N(N) {}
     170   : _njettinessFinder(mode, NormalizedCutoffMeasure(beta, R0, Rcutoff)), _N(N) {
     171      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
     172   }
    187173
    188 
    189 
    190    // The things that are required by base class.
    191    virtual std::string description () const;
    192    virtual double R() const {return -1.0;} // TODO: make this not stupid
    193    virtual void run_clustering(ClusterSequence&) const;
    194 
    195    virtual ~NjettinessPlugin() {}
    196 
    197 private:
    198 
    199    Njettiness _njettinessFinder;
    200    int _N;
    201174
    202175};
Note: See TracChangeset for help on using the changeset viewer.