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/Njettiness.hh

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: Njettiness.hh 670 2014-06-06 01:24:42Z jthaler $
     7//  $Id: Njettiness.hh 822 2015-06-15 23:52:57Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    2727
    2828
    29 #include "MeasureFunction.hh"
    30 #include "AxesFinder.hh"
    31 #include "NjettinessDefinition.hh"
     29#include "MeasureDefinition.hh"
     30#include "AxesDefinition.hh"
     31#include "TauComponents.hh"
    3232
    3333#include "fastjet/PseudoJet.hh"
     
    4242
    4343namespace contrib {
    44    
     44
     45/** \mainpage Nsubjettiness Documentation
     46 *
     47 * These Doxygen pages provide automatically generated documentation for the
     48 * Nsubjettiness FastJet contrib.  This documentation is being slowly improved.
     49 *
     50 * \section core_classes Core Classes
     51 *
     52 * - Nsubjettiness:  Calculating N-subjettiness jet shapes
     53 * - NsubjettinessRatio:  Calculating N-subjettiness ratios
     54 * - XConePlugin:  Running the XCone jet algorithm
     55 * - NjettinessPlugin:  Running generic N-jettiness as a jet algorithm
     56 *
     57 * \subsection core_classes_helper Helper Classes for Core
     58 * - Njettiness:  Core code for all N-(sub)jettiness calculations
     59 * - NjettinessExtras:  Way to access additional N-jettiness information
     60 * - TauComponents:  Output format for all N-(sub)jettiness information
     61 * - TauPartition:  Access to N-(sub)jettiness partitioning information
     62 * - PseudoXConePlugin:  Testing code to compare to XConePlugin (doesn't use one-pass minimization)
     63 *
     64 * \section axes_classes Axes Definitions
     65 *
     66 * \subsection axes_classes_base Base Classes
     67 * - AxesDefinition:  Defines generic axes definition
     68 * - ExclusiveJetAxes:  Axes finder from exclusive jet algorithm
     69 * - ExclusiveCombinatorialJetAxes:  Axes finder from exclusive jet algorithm (with extra axes to test combinatoric options)
     70 * - HardestJetAxes:  Axes finder from inclusive jet algorithm
     71 *
     72 * \subsection axes_classes_derived Derived Classes
     73 *
     74 * \b OnePass means iterative improvement to a (local) N-(sub)jettiness minimum.
     75 *
     76 * \b MultiPass means using multiple random seed inputs
     77 *
     78 * \b Comb means checking N + Nextra choose N combinatorial options
     79 *
     80 * - KT_Axes / OnePass_KT_Axes:  Axes from exclusive kT
     81 * - CA_Axes / OnePass_CA_Axes:  Axes from exclusive Cambridge/Aachen
     82 * - AntiKT_Axes / OnePass_AntiKT_Axes:  Axes from inclusive anti-kT
     83 * - WTA_KT_Axes / OnePass_WTA_KT_Axes:  Axes from exclusive kT, using winner-take-all recombination
     84 * - WTA_CA_Axes / OnePass_WTA_CA_Axes:  Axes from exclusive CA, using winner-take-all recombination
     85 *
     86 * - GenET_GenKT_Axes / OnePass_GenET_GenKT_Axes / Comb_GenET_GenKT_Axes:  Axes from exclusive generalized kt, with generalized Et recombination
     87 * - WTA_GenKT_Axes / OnePass_WTA_GenKT_Axes / Comb_WTA_GenKT_Axes:  Axes from exclusive generalized kt, with winner-take-all recombination
     88 *
     89 * - Manual_Axes / OnePass_Manual_Axes / MultiPass_Manual_Axes:  Use manual axes
     90 * - MultiPass_Axes:  Multiple passes with random input seeds
     91 *
     92 * \subsection axes_classes_helper Helper Classes for Axes
     93 * - GeneralEtSchemeRecombiner:  Generalized Et-scheme recombiner
     94 * - WinnerTakeAllRecombiner:  Winner-take-all recombiner (similar functionality now in FastJet 3.1)
     95 * - JetDefinitionWrapper:  Wrapper for Jet Definitions to handle memory management
     96 *
     97 * \section measure_classes Measure Definitions
     98 *
     99 * \subsection measure_classes_bases Base Classes
     100 * - MeasureDefinition:  Defines generic measures
     101 * - DefaultMeasure:  Base class for the original N-subjettiness measures
     102 *
     103 * \subsection measure_classes_derived Derived Classes
     104 * - NormalizedMeasure / UnnormalizedMeasure / NormalizedCutoffMeasure / UnnormalizedCutoffMeasure : Variants on the default N-subjettiness measure.
     105 * - ConicalMeasure: Similar to default measure, but intended as N-jettiness event shape
     106 * - ConicalGeometricMeasure / XConeMeasure:  Measure used in XCone jet algorithm
     107 * - OriginalGeometricMeasure / ModifiedGeometricMeasure:  Dot product measures useful for theoretical calcualtions
     108 *
     109 * \subsection measure_classes_helper Helper Classes for Measures
     110 * - LightLikeAxis : Defines light-like axis
     111 */
     112
    45113///////
    46114//
     
    49117///////
    50118
    51 //------------------------------------------------------------------------
     119///------------------------------------------------------------------------
    52120/// \class Njettiness
    53 // Njettiness uses AxesFinder and MeasureFunction together in order to find tau_N for the event. The user specifies
    54 // which AxesFinder and which MeasureFunction to use in the calculation, and then Njettiness returns tau_N for the event.
    55 // It also can return information about the axes and jets it used in the calculation, as well as information about
    56 // how the event was partitioned.
     121/// \brief Core class for N-(sub)jettiness calculations
     122///
     123/**
     124 * The N-jettiness event shape.
     125 *
     126 * This is the core class used to perform N-jettiness jet finding (via NjettinessPlugin or XConePluggin)
     127 * as well as find the N-subjettiness jet shape (via Nsubjettiness).
     128 *
     129 * In general, the user should never need to call this object.  In addition, its API should not be considered
     130 * fixed, since all code improvements effectively happen from reorganizing this class.
     131 *
     132 * Njettiness uses AxesDefinition and MeasureDefinition together in order to find tau_N for the event.
     133 * It also can return information about the axes and jets it used in the calculation, as well as
     134 * information about how the event was partitioned.
     135 */
    57136class Njettiness {
    58137public:
    59138   
    60    // The various axes choices available to the user
    61    // It is recommended to use AxesDefinition instead of these.
     139   /// Main constructor that uses AxesMode and MeasureDefinition to specify measure
     140   /// Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen
     141   Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def);
     142
     143   /// Destructor
     144   ~Njettiness() {};
     145   
     146   /// setAxes for Manual mode
     147   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes);
     148   
     149   /// Calculates and returns all TauComponents that user would want.
     150   /// This information is stored in _current_tau_components for later access as well.
     151   TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const;
     152
     153   /// Calculates the value of N-subjettiness,
     154   /// but only returns the tau value from _current_tau_components
     155   double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
     156      return getTauComponents(n_jets, inputJets).tau();
     157   }
     158
     159   /// Return all relevant information about tau components
     160   TauComponents currentTauComponents() const {return _current_tau_components;}
     161   /// Return axes found by getTauComponents.
     162   std::vector<fastjet::PseudoJet> currentAxes() const { return _currentAxes;}
     163   /// Return seedAxes used if onepass minimization (otherwise, same as currentAxes)
     164   std::vector<fastjet::PseudoJet> seedAxes() const { return _seedAxes;}
     165   /// Return jet partition found by getTauComponents.
     166   std::vector<fastjet::PseudoJet> currentJets() const {return _currentPartition.jets();}
     167   /// Return beam partition found by getTauComponents.
     168   fastjet::PseudoJet currentBeam() const {return _currentPartition.beam();}
     169   /// Return beam partition found by getTauComponents.
     170   TauPartition currentPartition() const {return _currentPartition;}
     171   
     172
     173private:
     174   
     175   /// AxesDefinition to use.  Implemented as SharedPtrs to avoid memory management headaches
     176   SharedPtr<const AxesDefinition> _axes_def;
     177   /// MeasureDefinition to use.  Implemented as SharedPtrs to avoid memory management headaches
     178   SharedPtr<const MeasureDefinition> _measure_def;
     179
     180   
     181   // Information about the current information
     182   // Defined as mutables, so user should be aware that these change when getTau is called.
     183   // TODO:  These are not thread safe and should be fixed somehow
     184   mutable TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call
     185   mutable std::vector<fastjet::PseudoJet> _currentAxes; //axes found after minimization
     186   mutable std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable)
     187   mutable TauPartition _currentPartition; //partitioning information
     188
     189   /// Warning if the user tries to use v1.0.3 measure style.
     190   static LimitedWarning _old_measure_warning;
     191   /// Warning if the user tries to use v1.0.3 axes style.
     192   static LimitedWarning _old_axes_warning;
     193
     194   
     195public:
     196   
     197   // These interfaces are included for backwards compability, and will be deprecated in a future release (scheduled for deletion in v3.0)
     198   
     199   /// \deprecated
     200   /// Deprecated enum to determine axes mode
     201   /// The various axes choices available to the user
     202   /// It is recommended to use AxesDefinition instead of these.
    62203   enum AxesMode {
    63204      kt_axes,             // exclusive kt axes
     
    69210      onepass_ca_axes,     // one-pass minimization from ca starting point
    70211      onepass_antikt_0p2_axes,  // one-pass minimization from antikt-0.2 starting point
    71       onepass_wta_kt_axes, //one-pass minimization of WTA axes with kt 
    72       onepass_wta_ca_axes, //one-pass minimization of WTA axes with ca 
     212      onepass_wta_kt_axes, //one-pass minimization of WTA axes with kt
     213      onepass_wta_ca_axes, //one-pass minimization of WTA axes with ca
    73214      min_axes,            // axes that minimize N-subjettiness (100 passes by default)
    74215      manual_axes,         // set your own axes with setAxes()
    75216      onepass_manual_axes  // one-pass minimization from manual starting point
    76       //  These options are commented out because they have not been fully tested
    77       //      wta2_kt_axes,        // Winner Take All (alpha = 2) with kt
    78       //      wta2_ca_axes,         // Winner Take All (alpha = 2) with CA
    79       //      onepass_wta2_kt_axes, //one-pass minimization of WTA (alpha = 2) axes with kt
    80       //      onepass_wta2_ca_axes, //one-pass minimization of WTA (alpha = 2) axes with ca
    81217   };
    82 
    83    // The measures available to the user.
    84    // "normalized_cutoff_measure" was the default in v1.0 of Nsubjettiness
    85    // "unnormalized_measure" is now the recommended default usage
    86    // But it is recommended to use MeasureDefinition instead of these.
     218   
     219   /// \deprecated
     220   /// Deprecated enum to determine measure mode
     221   /// The measures available to the user.
     222   /// "normalized_cutoff_measure" was the default in v1.0 of Nsubjettiness
     223   /// "unnormalized_measure" is now the recommended default usage
     224   /// But it is recommended to use MeasureDefinition instead of these.
    87225   enum MeasureMode {
    88226      normalized_measure,           //default normalized measure
     
    93231      geometric_cutoff_measure      //geometric measure with explicit Rcutoff
    94232   };
    95 
    96    // Main constructor that uses AxesMode and MeasureDefinition to specify measure
    97    // Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen
    98    Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def);
    99 
    100    // Intermediate constructor (needed to enable v1.0.3 backwards compatibility?)
     233   
     234   /// \deprecated
     235   /// Intermediate constructor (needed to enable v1.0.3 backwards compatibility?)
    101236   Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def);
    102 
    103    // Alternative constructor which takes axes/measure information as enums with measure parameters
    104    // This version is not recommended
     237   
     238   /// \deprecated
     239   /// Old-style constructor which takes axes/measure information as enums with measure parameters
     240   /// This version absolutely is not recommended
    105241   Njettiness(AxesMode axes_mode,
    106242              MeasureMode measure_mode,
     
    110246              double para3 = std::numeric_limits<double>::quiet_NaN())
    111247   : _axes_def(createAxesDef(axes_mode)), _measure_def(createMeasureDef(measure_mode, num_para, para1, para2, para3)) {
    112       setMeasureFunctionAndAxesFinder();  // call helper function to do the hard work
    113248   }
    114 
    115    // destructor
    116    ~Njettiness() {};
    117    
    118    // setAxes for Manual mode
    119    void setAxes(const std::vector<fastjet::PseudoJet> & myAxes);
    120    
    121    // Calculates and returns all TauComponents that user would want.
    122    // This information is stored in _current_tau_components for later access as well.
    123    TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const;
    124 
    125    // Calculates the value of N-subjettiness,
    126    // but only returns the tau value from _current_tau_components
    127    double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
    128       return getTauComponents(n_jets, inputJets).tau();
    129    }
    130 
    131    // Return all relevant information about tau components
    132    TauComponents currentTauComponents() const {return _current_tau_components;}
    133    // Return axes found by getTauComponents.
    134    std::vector<fastjet::PseudoJet> currentAxes() const { return _currentAxes;}
    135    // Return seedAxes used if onepass minimization (otherwise, same as currentAxes)
    136    std::vector<fastjet::PseudoJet> seedAxes() const { return _seedAxes;}
    137    // Return jet partition found by getTauComponents.
    138    std::vector<fastjet::PseudoJet> currentJets() const {return _currentJets;}
    139    // Return beam partition found by getTauComponents.
    140    fastjet::PseudoJet currentBeam() const {return _currentBeam;}
    141    
    142    // partition inputs by Voronoi (each vector stores indices corresponding to inputJets)
    143    std::vector<std::list<int> > getPartitionList(const std::vector<fastjet::PseudoJet> & inputJets) const;
    144 
    145 private:
    146    
    147    // Information about Axes and Measures to be Used
    148    // Implemented as SharedPtrs to avoid memory management headaches
    149    SharedPtr<const AxesDefinition> _axes_def;
    150    SharedPtr<const MeasureDefinition> _measure_def;
    151    
    152    // The chosen axes/measure mode workers
    153    // Implemented as SharedPtrs to avoid memory management headaches
    154    // TODO: make into a SharedPtr<const AxesFinder>?
    155    SharedPtr<MeasureFunction> _measureFunction;  // The chosen measure
    156    SharedPtr<AxesFinder> _startingAxesFinder;    // The initial axes finder
    157    SharedPtr<AxesFinder> _finishingAxesFinder;   // A possible minimization step
    158    
    159    // Information about the current information
    160    // Defined as mutables, so user should be aware that these change when getTau is called.
    161    mutable TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call
    162    mutable std::vector<fastjet::PseudoJet> _currentAxes; //axes found after minimization
    163    mutable std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable)
    164    mutable std::vector<fastjet::PseudoJet> _currentJets; //partitioning information
    165    mutable fastjet::PseudoJet _currentBeam; //return beam, if requested
    166    
    167    // created separate function to set MeasureFunction and AxesFinder in order to keep constructor cleaner.
    168    void setMeasureFunctionAndAxesFinder();
    169    
    170    // Convert old style enums into new style MeasureDefinition
     249 
     250   /// \deprecated
     251   /// Convert old style enums into new style MeasureDefinition
    171252   AxesDefinition* createAxesDef(AxesMode axes_mode) const;
    172253   
    173    // Convert old style enums into new style MeasureDefinition
     254   /// \deprecated
     255   /// Convert old style enums into new style MeasureDefinition
    174256   MeasureDefinition* createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const;
    175257
Note: See TracChangeset for help on using the changeset viewer.