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

Location:
external/fastjet/contribs/Nsubjettiness
Files:
9 added
8 deleted
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • external/fastjet/contribs/Nsubjettiness/AUTHORS

    rf118021 r973b92a  
    1 The Nsubjettiness FastJet contrib was written and is maintained and developed by:
     1-------------------------------------------------------------------------------
    22
    3    Jesse Thaler <jthaler@jthaler.net>
     3The Nsubjettiness FastJet contrib was written, maintained, and developed by:
     4
     5   Jesse Thaler <jthaler@mit.edu>
    46   Ken Van Tilburg <kenvt@stanford.edu>
    57   Christopher K. Vermilion <christopher.vermilion@gmail.com>
    68   TJ Wilkason <tjwilk@mit.edu>
    79
    8 Questions and comments should be directed to:  jthaler@jthaler.net.
     10Questions and comments should be directed to:  jthaler@mit.edu.
    911
    10 For physics details, see:
     12-------------------------------------------------------------------------------
     13
     14For physics details on N-subjettiness, see:
    1115
    1216   Identifying Boosted Objects with N-subjettiness.
     
    2024New in v2.0 is the winner-take-all axis, described in:
    2125
     26   Jet Observables Without Jet Algorithms.
     27   Daniele Bertolini, Tucker Chan, and Jesse Thaler.
     28   JHEP 1404:013 (2014), arXiv:1310.7584.
     29
    2230   Jet Shapes with the Broadening Axis.
    2331   Andrew J. Larkoski, Duff Neill, and Jesse Thaler.
    2432   JHEP 1404:017 (2014), arXiv:1401.2158.
    2533
    26 as well as in unpublished work by Gavin Salam.
     34   Unpublished work by Gavin Salam.
    2735
    28 ----------------------------------------------------------------------
     36New in v2.2 is the XCone jet algorithm, described in:
     37
     38   XCone: N-jettiness as an Exclusive Cone Jet Algorithm.
     39   Iain W. Stewart, Frank J. Tackmann, Jesse Thaler,
     40   Christopher K. Vermilion, and Thomas F. Wilkason.
     41   arXiv:1508.01516.
     42
     43   Resolving Boosted Jets with XCone.
     44   Jesse Thaler and Thomas F. Wilkason.
     45   arXiv:1508.01518.
     46
     47-------------------------------------------------------------------------------
  • external/fastjet/contribs/Nsubjettiness/COPYING

    rf118021 r973b92a  
    1212to
    1313
     14N-subjettiness:
    1415  arXiv:1011.2268
    1516  arXiv:1108.2701
    1617
     18Winner-take-all axes:
     19  arXiv:1310.7584
     20  arXiv:1401.2158
     21
     22XCone:
     23  arXiv:1508.01516
     24  arXiv:1508.01518
    1725
    1826
  • external/fastjet/contribs/Nsubjettiness/ChangeLog

    rf118021 r973b92a  
     12015-09-28 <jthaler>
     2   Updated NEWS for 2.2.1 release.
     32015-09-18 <jthaler>
     4   Fixed duplicate XConePlugin entry in Makefile.
     52015-08-20 <jthaler>
     6   Trying to fix "abs" bug in ExtraRecombiners.cc
     72015-08-19 <jthaler>
     8   Adding arXiv numbers to XCone papers
     9   Used this_jet in example_basic_usage.
     10   Fixed typo in example_advanced_usage header.
     11   Added copy/paste code in README file.
     122015-08-13 <jthaler>
     13   Ready for 2.2.0 release
     142015-07-23 <jthaler>
     15   Fixed typo in GenET_GenKT_Axes error message
     16   Added _too_few_axes_warning to ExclusiveJetAxes and ExclusiveCombinatorialJetAxes
     17   Switched to ../data/single_event_ee.dat for make check
     182015-07-20 <jthaler>
     19   Renamed WinnerTakeAllRecombiner.hh/cc to ExtraRecombiners.hh/cc
     20   Added _too_few_axes_warning to HardestJetAxes
     21   Added GenKT_Axes and OnePass_GenKT_Axes and Comb_GenKT_Axes (using E-scheme recombination).
     22   Added warning about p < 0 or delta <=0 in GenKT axes finders.
     23   Added warning about beta <= 0 in all measures.
     242015-07-10 <jthaler>
     25   Putting in small tweaks in documentation to get ready for 2.2 release candidate 1.
     262015-06-15 <jthaler>
     27   Starting doxygen file for eventual improved documentation.
     28   Starting long process of improving documentation throughout.
     29   Made the basic usage file a bit easier to read.
     30   Adding in LimitedWarnings for old style constructors
     312015-06-12 <jthaler>
     32   Synchronized definition of new measures with XCone paper.
     33   In MeasureDefinition, added default values of jet_distance_squared and beam_distance_squared for cases where we don't want to optimize specifically.
     34   Fixed bug in OriginalGeometricMeasure and ModifiedGeometric Measure
     35   Commented out DeprecatedGeometricMeasure and DeprecatedGeometricCutoffMeasure since they were only causing confusion
     362015-05-26 <TJW>
     37   Removed axis_scale_factor(), added bool to calculate this value if needed to save computation time
     38   Defined small offset in denominator of axis scaling according to accuracy of refinement
     39   Updated advanced examples to include tau values and number of jet constituents
     402015-05-25 <jthaler>
     41   Clean up of AxesDefinition
     42   Splitting get_axes into get_starting_axes and get_refined axes
     43   Putting in proper noise ranges (hopefully) for MultiPass
     44   Clean up of MeasureDefinition, rename jet_gamma to beam_gamma
     45   Put in zero checking for jet_distance in ConicalGeometricMeasure
     46   Added in ConicalMeasure for consistency
     47   Changing OnePass Minimization to allow for temporary uphill
     482015-05-24 <TJW>
     49   Added Combinatorial GenET_GenKT_Axes and MultiPass_Manual_Axes
     50   Moved Axes refining information into MeasureDefinition, associated each measure with corresponding axes refiner
     51   Moved get_one_pass_axes into MeasureDefinition, removed any mention of Npass
     52   Moved all information on number of passes to AxesDefinition
     53   Made AxesRefiner.hh/.cc into defunct files
     542015-05-22 <jthaler>
     55   Cleaning out commented text.  Renaming classes to be consistent with recommended usage.
     562015-05-22 <TJW>
     57   Added XConePlugin as a specific implementation of NjettinessPlugin
     58   Added usage of XCone beta = 1.0 and beta = 2.0 to both basic and advanced example files
     59   Added OriginalGeometric, ModifiedGeometric, ConicalGeometric, and XCone measures to list of test measures
     60   Added OnePass_GenRecomb_GenKT_Axes to list of test axes
     61   Added description to XCone measure in MeasureDefinition
     622015-05-21 <TJW>
     63   Updated minimization scheme to avoid divide-by-zero errors
     64   Fixed various factors of 2 in the definition of the measures
     652015-04-19 <TJW>
     66   Fixed bug in minimization scheme for GeneralAxesRefiner
     67   Moved measure_type to DefaultMeasure, removed geometric measure from e+e- example file
     682015-03-22 <TJW>
     69   Added OriginalGeometricMeasure and ModifiedGeometricMeasure definitions
     70   Changed all instances of GeometricMeasure to DeprecatedGeometricMeasure, and added error statements
     71   Made GeneralAxesRefiner the default axes refiner for Measure Definition, overwritten by DefaultMeasure and GeometricMeasure
     72   Created DefaultMeasure class for all the conical measure subclasses
     73   Separated out e+e- and pp measures into separate example files
     742015-03-09 <TJW>
     75   Added ConicalGeometric measures with jet_beta and jet_gamma definitions
     76   Added XCone measures derived from ConicalGeometric with jet_gamma = 1.0
     77   Added GeneralAxesRefiner for use with any measure (currently defined with XCone measure)
     78   Added axes_numerator in MeasureDefinition to define the momentum scaling for minimization (currently only defined for Conical Geometric measure)
     792014-11-28 <TJW>
     80   Minor change to default parameters in axes definition
     812014-10-08 <TJW>
     82   Updated example file with new e+e- measure definitions
     83   Added measure type to measure definition descriptions
     84   Changed order of parameters in new axes definitions
     85   Added standard C++ epsilon definition to GeneralERecombiner
     862014-10-07 <TJW>
     87   Updated example_advanced_usage with new axes choices
     88   Reversed inheritance of NormalizedMeasure and NormalizedCutoffMeasure (and Geometric) back to original
     89   Storing _RcutoffSq as separate variable, and recalculating it in NormalizedMeasure
     90   Cleaning up ExclusiveCombinatorialJetAxes and added comments to explain the process
     91   Fixed memory leaks using delete_recombiner_when_unused()
     92   Fixed manual axes bug in Njettiness
     93   Cleaned up enum definitions
     942014-10-01 <TJW>
     95   Added new parameterized recombination scheme to Winner-Take-All recombiner
     96   Created Winner-Take-All GenKT and general Recomb GenKT axes finders and onepass versions
     97   Created new N choose M minimization axis finder, created N choose M WTA GenKT axis finder as example
     98   Removed NPass as constructor argument in AxesDefinition, made it set through protected method
     99   Removed TauMode as constructor argument in MeasureDefinition, made it set through protected method
     100   Flipped inheritance of NormalizedMeasure and NormalizedCutoffMeasure (same for Geometric) to remove error of squaring the integer maximum
     101   Created new MeasureType enum to allow user to choose between pp and ee variables (ee variables need testing)
     102   Updated MeasureDefinition constructors to take in extra MeasureType parameter (but defaulted to pp variables)
     103   Added new Default TauMode argument
     104   Fixed unsigned integers in various places
     105   Added setAxes method to NjettinessPlugin
     1062014-08-26 <JDT>
     107   Enhanced TauComponents to include more infomation
     108   NjettinessExtras now inherits from TauComponents
     109   Removed getPartition from Njettiness, to avoid code duplication
     110   Fixed double calculating issue in NjettinessPlugin::run_clustering()
     111   Now AxesDefinition can use measure information without running AxesRefiner
     112   Added TauStructure so the jets returned by TauComponents can know their tau value.
     1132014-08-25 <JDT>
     114   Merged MeasureDefinition and MeasureFunction into new MeasureDefinition.
     115   Merged StartingAxesFinder and AxesDefinition into new AxesDefinition.
     116   Renamed AxesFinder.cc/hh to AxesRefiner.cc/hh
     117   Renamed NjettinessDefinition.cc/hh to AxesDefinition.cc/hh
     118   Renamed MeasureFunction.cc/hh to MeasureDefinition.cc/hh
     119   Renaming result() function in MeasureDefinition to be consistent with Nsubjettiness interface.
     120   Split off TauComponents into separate header
     121   Added TauPartition class for readability of partitioning
     122   Moved NjettinessExtras into TauComponents, as this will eventually be the logical location
     123   Added cross check of new MeasureDefinition and AxesDefinition in example_advanced_usage.
     124   Lots of comments updated.
     125   Changed version number to 2.2.0-alpha-dev, since this is going to be a bigger update than I had originally thought
     1262014-08-20 <JDT>
     127   Incorporated code in NjettinessPlugin to handle FJ3.1 treatment of auto_ptr (thanks Gregory)
     128   Changed version number to 2.1.1-alpha-dev
     129   Split AxesFinder into StartingAxesFinder and RefiningAxesFinder for clarity.
     130   Manual axes mode now corresponds to a NULL StartingAxesFinder in Njettiness (so removed AxesFinderFromUserInput)
     131   Added AxesRefiningMode to make selection of minimization routine more transparent in Njettiness
     132   Moved sq() to more appropriate place in AxesFinder.hh
     133   Rearranged Nsubjettiness.hh to make the old code less visible.
     134   Renamed AxesFinderFromOnePassMinimization -> AxesFinderFromConicalMinimization
     135   Renamed DefaultUnnormalizedMeasureFunction -> ConicalUnnormalizedMeasureFunction
     136   Removed supportsMultiPassMinimization() from MeasureDefinition since any One Pass algorithm can be multipass.
    11372014-07-09 <JDT>
    2138   Changed version for 2.1.0 release.
  • external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.cc

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: WinnerTakeAllRecombiner.cc 597 2014-04-16 23:07:55Z jthaler $
     7//  $Id: ExtraRecombiners.cc 842 2015-08-20 13:44:31Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    2323//----------------------------------------------------------------------
    2424
    25 #include "WinnerTakeAllRecombiner.hh"
     25#include "ExtraRecombiners.hh"
    2626
    2727FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
    2828
    2929namespace contrib{
     30 
     31std::string GeneralEtSchemeRecombiner::description() const {
     32   return "General Et-scheme recombination";
     33}
     34
     35// recombine pa and pb according to a generalized Et-scheme parameterized by the power delta
     36void GeneralEtSchemeRecombiner::recombine(const fastjet::PseudoJet & pa, const fastjet::PseudoJet & pb, fastjet::PseudoJet & pab) const {
     37   
     38   // Define new weights for recombination according to delta
     39   // definition of ratio done so that we do not encounter issues about numbers being too large for huge values of delta
     40   double ratio;
     41   if (std::abs(_delta - 1.0) < std::numeric_limits<double>::epsilon()) ratio = pb.perp()/pa.perp(); // save computation time of pow()
     42   else ratio = pow(pb.perp()/pa.perp(), _delta);
     43   double weighta = 1.0/(1.0 + ratio);
     44   double weightb = 1.0/(1.0 + 1.0/ratio);
     45   
     46   double perp_ab = pa.perp() + pb.perp();
     47   // reweight the phi and rap sums according to the weights above
     48   if (perp_ab != 0.0) {
     49      double y_ab = (weighta * pa.rap() + weightb * pb.rap());
     50     
     51      double phi_a = pa.phi(), phi_b = pb.phi();
     52      if (phi_a - phi_b > pi)  phi_b += twopi;
     53      if (phi_a - phi_b < -pi) phi_b -= twopi;
     54      double phi_ab = (weighta * phi_a + weightb * phi_b);
     55     
     56      pab.reset_PtYPhiM(perp_ab, y_ab, phi_ab);
     57     
     58   }
     59   else {
     60      pab.reset(0.0,0.0,0.0,0.0);
     61   }
     62}
     63
    3064
    3165std::string WinnerTakeAllRecombiner::description() const {
    32    return "Winner Take All scheme recombination";
     66   return "Winner-Take-All recombination";
    3367}
    3468
  • external/fastjet/contribs/Nsubjettiness/NEWS

    rf118021 r973b92a  
    1010Note that we have maintain backwards compatibility for the typical ways that
    1111Nsubjettiness was used.  In particular, all of the Nsubjettiness class code in
    12 the example file v1.0.3 from still compiles, as does the NjettinessPlugin class
     12the example file from v1.0.3 still compiles, as does the NjettinessPlugin class
    1313code that uses the default measure.
    1414
     
    1717  * NsubjettinessRatio:  Direct access to tau_N / tau_M (the most requested
    1818    feature)
    19   * MeasureDefinition to allow access to both normalized and unnormalized measures
     19  * MeasureDefinition to allow access to normalized and unnormalized measures
    2020  * AxesDefinition to allow for access to more general axes modes
    21   * Winner-Take-All recombination axes:  a faster way to find axes than beta = 1
     21  * Winner-Take-All recombination axes:  a faster way to find axes than beta=1
    2222    minimization, but with comparable performance.
    2323  * TauComponents to get access to the pieces of the N-(sub)jettiness
    2424    calculation.
     25  * TauExtras to get complete access to get partitioning and axes information.
    2526  * For clarity, split the example file into an example_basic_usage and
    26     example_advanced_usage
     27    example_advanced_usage (and example_advanced_usage_ee for e+e- collisions).
    2728  * In Nsubjettiness, access to seedAxes() and currentAxes() to figure out the
    2829    axes used before and after minimization.
    2930  * In Nsubjettiness, access to currentSubjets() to get the subjet fourvectors.
     31  * (v2.2)  XConePlugin, which improves on the previous NjettinessPlugin to use
     32    N-jettiness as a jet finder using the new ConicalGeometric measure.
    3033
     34-- 2.2.1:  (Sept 28, 2015)  Fix of small Makefile bug
     35-- 2.2.0:  (Sept 7, 2015)  Inclusion of the XCone jet algorithm, as well as a
     36           few new measures, including the "conical geometric" measure and
     37           options for e+e- colliders.  Improvement of the
     38           Measure/AxesDefinition interface to allow for direct
     39           use in calculations.
     40           * Fixed bug where MultiPass_Axes did not actually minimize
     41           * Fixed floating point error with infinity^2 in various measures
    3142
    32 -- 2.1.0:  (July 9, 2014) Inclusion of MeasureDefinition/AxesDefinition interface.
     43-- 2.1.0:  (July 9, 2014) Inclusion of Measure/AxesDefinition interface.
    3344           This was the first publicly available version of Nsubjettiness v2.
    3445-- 2.0.0:  Initial release of v2.0.  This was never officially made public.
  • external/fastjet/contribs/Nsubjettiness/Njettiness.cc

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: Njettiness.cc 677 2014-06-12 18:56:46Z jthaler $
     7//  $Id: Njettiness.cc 821 2015-06-15 18:50:53Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    3636///////
    3737
     38LimitedWarning Njettiness::_old_measure_warning;
     39LimitedWarning Njettiness::_old_axes_warning;
     40
     41   
     42// Constructor
    3843Njettiness::Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def)
    39 : _axes_def(axes_def.create()), _measure_def(measure_def.create()) {
    40    setMeasureFunctionAndAxesFinder();  // call helper function to do the hard work
    41 }
    42 
     44: _axes_def(axes_def.create()), _measure_def(measure_def.create()) {}
     45   
     46// setAxes for Manual mode
     47void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
     48   if (_axes_def()->needsManualAxes()) {
     49      _currentAxes = myAxes;
     50   } else {
     51      throw Error("You can only use setAxes for manual AxesDefinitions");
     52   }
     53}
     54   
     55// Calculates and returns all TauComponents that user would want.
     56// This information is stored in _current_tau_components for later access as well.
     57TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
     58   if (inputJets.size() <= n_jets) {  //if not enough particles, return zero
     59      _currentAxes = inputJets;
     60      _currentAxes.resize(n_jets,fastjet::PseudoJet(0.0,0.0,0.0,0.0));
     61      _current_tau_components = TauComponents();
     62      _seedAxes = _currentAxes;
     63      _currentPartition = TauPartition(n_jets); // empty partition
     64   } else {
     65      assert(_axes_def()); // this should never fail.
     66     
     67      if (_axes_def()->needsManualAxes()) { // if manual mode
     68         // take current axes as seeds
     69         _seedAxes = _currentAxes;
     70         
     71         // refine axes if requested
     72         _currentAxes = _axes_def->get_refined_axes(n_jets,inputJets,_seedAxes, _measure_def());
     73      } else { // non-manual axes
     74         
     75          //set starting point for minimization
     76         _seedAxes = _axes_def->get_starting_axes(n_jets,inputJets,_measure_def());
     77         
     78         // refine axes as needed
     79         _currentAxes = _axes_def->get_refined_axes(n_jets,inputJets,_seedAxes, _measure_def());
     80         
     81         // NOTE:  The above two function calls are combined in "AxesDefinition::get_axes"
     82         // but are separated here to allow seed axes to be stored.
     83      }
     84     
     85      // Find and store partition
     86      _currentPartition = _measure_def->get_partition(inputJets,_currentAxes);
     87     
     88      // Find and store tau value
     89      _current_tau_components = _measure_def->component_result_from_partition(_currentPartition, _currentAxes);  // sets current Tau Values
     90   }
     91   return _current_tau_components;
     92}
     93   
     94
     95///////
     96//
     97// Below is code for backward compatibility to use the old interface.
     98// May be deleted in a future version
     99//
     100///////
     101   
    43102Njettiness::Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def)
    44 : _axes_def(createAxesDef(axes_mode)), _measure_def(measure_def.create()) {
    45    setMeasureFunctionAndAxesFinder();  // call helper function to do the hard work
    46 }
    47    
     103: _axes_def(createAxesDef(axes_mode)), _measure_def(measure_def.create()) {}
     104
    48105// Convert from MeasureMode enum to MeasureDefinition
    49106// This returns a pointer that will be claimed by a SharedPtr
    50107MeasureDefinition* Njettiness::createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const {
    51 
     108   
     109   _old_measure_warning.warn("Njettiness::createMeasureDef:  You are using the old MeasureMode way of specifying N-subjettiness measures.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use MeasureDefinition instead.");
     110   
    52111   // definition of maximum Rcutoff for non-cutoff measures, changed later by other measures
    53112   double Rcutoff = std::numeric_limits<double>::max();  //large number
     
    77136         break;
    78137      case geometric_measure:
    79          beta = para1;
    80          if (num_para == 1) {
    81             return new GeometricMeasure(beta);
    82          } else {
    83             throw Error("geometric_measure needs 1 parameter (beta)");
    84          }
     138         throw Error("This class has been removed. Please use OriginalGeometricMeasure, ModifiedGeometricMeasure, or ConicalGeometricMeasure with the new Njettiness constructor.");
    85139         break;
    86140      case normalized_cutoff_measure:
     
    104158         break;
    105159      case geometric_cutoff_measure:
    106          beta = para1;
    107          Rcutoff = para2; //Rcutoff parameter is 2nd parameter in geometric_cutoff_measure
    108          if(num_para == 2) {
    109            return new GeometricCutoffMeasure(beta,Rcutoff);
    110          } else {
    111             throw Error("geometric_cutoff_measure has 2 parameters (beta, Rcutoff)");
    112          }
    113          break;
     160         throw Error("This class has been removed. Please use OriginalGeometricMeasure, ModifiedGeometricMeasure, or ConicalGeometricMeasure with the new Njettiness constructor.");
    114161      default:
    115162         assert(false);
     
    122169// This returns a pointer that will be claimed by a SharedPtr
    123170AxesDefinition* Njettiness::createAxesDef(Njettiness::AxesMode axes_mode) const {
     171   
     172   _old_axes_warning.warn("Njettiness::createAxesDef:  You are using the old AxesMode way of specifying N-subjettiness axes.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use AxesDefinition instead.");
     173   
    124174   
    125175   switch (axes_mode) {
     
    156206}
    157207
    158    
    159 // Parsing needed for constructor to set AxesFinder and MeasureFunction
    160 // All of the parameter handling is here, and checking that number of parameters is correct.
    161 void Njettiness::setMeasureFunctionAndAxesFinder() {
    162    // Get the correct MeasureFunction and AxesFinders
    163    _measureFunction.reset(_measure_def->createMeasureFunction());
    164    _startingAxesFinder.reset(_axes_def->createStartingAxesFinder(*_measure_def));
    165    _finishingAxesFinder.reset(_axes_def->createFinishingAxesFinder(*_measure_def));
    166 }
    167 
    168 // setAxes for Manual mode
    169 void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
    170    if (_axes_def->supportsManualAxes()) {
    171       _currentAxes = myAxes;
    172    } else {
    173       throw Error("You can only use setAxes for manual AxesDefinitions");
    174    }
    175 }
    176    
    177 // Calculates and returns all TauComponents that user would want.
    178 // This information is stored in _current_tau_components for later access as well.
    179 TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
    180    if (inputJets.size() <= n_jets) {  //if not enough particles, return zero
    181       _currentAxes = inputJets;
    182       _currentAxes.resize(n_jets,fastjet::PseudoJet(0.0,0.0,0.0,0.0));
    183       _current_tau_components = TauComponents();
    184       _seedAxes = _currentAxes;
    185       _currentJets = _currentAxes;
    186       _currentBeam = PseudoJet(0.0,0.0,0.0,0.0);
    187    } else {
    188 
    189       _seedAxes = _startingAxesFinder->getAxes(n_jets,inputJets,_currentAxes); //sets starting point for minimization
    190       if (_finishingAxesFinder) {
    191          _currentAxes = _finishingAxesFinder->getAxes(n_jets,inputJets,_seedAxes);
    192       } else {
    193          _currentAxes = _seedAxes;
    194       }
    195      
    196       // Find partition and store information
    197       // (jet information in _currentJets, beam in _currentBeam)
    198       _currentJets = _measureFunction->get_partition(inputJets,_currentAxes,&_currentBeam);
    199      
    200       // Find tau value and store information
    201       _current_tau_components = _measureFunction->result_from_partition(_currentJets, _currentAxes,&_currentBeam);  // sets current Tau Values
    202    }
    203    return _current_tau_components;
    204 }
    205    
    206    
    207 // Partition a list of particles according to which N-jettiness axis they are closest to.
    208 // Return a vector of length _currentAxes.size() (which should be N).
    209 // Each vector element is a list of ints corresponding to the indices in
    210 // particles of the particles belonging to that jet.
    211 std::vector<std::list<int> > Njettiness::getPartitionList(const std::vector<fastjet::PseudoJet> & particles) const {
    212    // core code is in MeasureFunction
    213    return _measureFunction->get_partition_list(particles,_currentAxes);
    214 }
    215 
     208
     209   
     210   
    216211   
    217212} // namespace contrib
  • 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
  • external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.cc

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: NjettinessPlugin.cc 663 2014-06-03 21:26:41Z jthaler $
     7//  $Id: NjettinessPlugin.cc 821 2015-06-15 18:50:53Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    2929namespace contrib{
    3030
    31 
     31LimitedWarning NjettinessPlugin::_old_constructor_warning;
    3232
    3333std::string NjettinessPlugin::description() const {return "N-jettiness jet finder";}
     
    4848   
    4949   
    50    _njettinessFinder.getTau(_N, particles);
    51 
    52    std::vector<std::list<int> > partition = _njettinessFinder.getPartitionList(particles);
    53 
    54    std::vector<fastjet::PseudoJet> jet_indices_for_extras;
     50   TauComponents tau_components = _njettinessFinder.getTauComponents(_N, particles);
     51   TauPartition tau_partition = _njettinessFinder.currentPartition();
     52   std::vector<std::list<int> > partition = tau_partition.jets_list();
     53   
     54   std::vector<int> jet_indices_for_extras;
    5555
    5656   // output clusterings for each jet
     
    7373      int finalJet = indices.back();
    7474      cs.plugin_record_iB_recombination(finalJet, fakeDib);
    75       jet_indices_for_extras.push_back(cs.jets()[finalJet]);  // Get the four vector for the final jets to compare later.
     75      jet_indices_for_extras.push_back(cs.jets()[finalJet].cluster_hist_index());  // Get the four vector for the final jets to compare later.
    7676   }
    7777
     
    7979   reverse(jet_indices_for_extras.begin(),jet_indices_for_extras.end());
    8080
    81    NjettinessExtras * extras = new NjettinessExtras(_njettinessFinder.currentTauComponents(),jet_indices_for_extras,_njettinessFinder.currentAxes());
     81   // Store extra information about jets
     82   NjettinessExtras * extras = new NjettinessExtras(tau_components,jet_indices_for_extras);
     83
     84#if FASTJET_VERSION_NUMBER>=30100
     85   cs.plugin_associate_extras(extras);
     86#else
     87   // auto_ptr no longer supported, apparently
    8288   cs.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras));
    83    
     89#endif
     90 
    8491}
    8592
  • 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};
  • external/fastjet/contribs/Nsubjettiness/Nsubjettiness.cc

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: Nsubjettiness.cc 597 2014-04-16 23:07:55Z jthaler $
     7//  $Id: Nsubjettiness.cc 821 2015-06-15 18:50:53Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    2929namespace contrib {
    3030
     31LimitedWarning Nsubjettiness::_old_constructor_warning;
     32   
     33   
    3134//result returns tau_N with normalization dependent on what is specified in constructor
    3235double Nsubjettiness::result(const PseudoJet& jet) const {
  • external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh

    rf118021 r973b92a  
    55//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
    66//
    7 //  $Id: Nsubjettiness.hh 670 2014-06-06 01:24:42Z jthaler $
     7//  $Id: Nsubjettiness.hh 822 2015-06-15 23:52:57Z jthaler $
    88//----------------------------------------------------------------------
    99// This file is part of FastJet contrib.
     
    3838namespace contrib {
    3939
    40 //------------------------------------------------------------------------
     40// Classes defined in this file.
     41class Nsubjettiness;
     42class NsubjettinessRatio;
     43   
     44///------------------------------------------------------------------------
    4145/// \class Nsubjettiness
    42 /// Nsubjettiness extends the concept of Njettiness to a jet shape, but other
    43 /// than the set of particles considered, they are identical.  This class
    44 /// wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet
    45 /// interface for convenience in larger analyses.  See NjettinessPlugin.hh for
    46 /// definitions of tau_N and the constructor options.
     46/// \brief Implements the N-subjettiness jet shape
     47///
     48/**
     49 * The N-jettiness jet shape.
     50 *
     51 * Nsubjettiness extends the concept of Njettiness to a jet shape, but other
     52 * than the set of particles considered, they are identical.  This class
     53 * wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet
     54 * interface for convenience in larger analyses.
     55 *
     56 * The recommended AxesDefinitions are:
     57 *   KT_Axes             : exclusive kt axes
     58 *   WTA_KT_Axes         : exclusive kt with winner-take-all recombination
     59 *   OnePass_KT_Axes     : one-pass minimization from kt starting point
     60 *   OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point
     61 * More AxesDefinitions are listed in the README and defined in AxesDefinition.hh
     62 *
     63 * The recommended MeasureDefinitions are (with the corresponding parameters)
     64 *   NormalizedMeasure(beta,R0)
     65 *      :  This was the original N-subjettiness measure (dimensionless)
     66 *   UnnormalizedMeasure(beta)
     67 *      :  This is the new recommended default, same as above but without
     68 *      :  the normalization factor, and hence has units of GeV
     69 *   NormalizedCutoffMeasure(beta,R0,Rcutoff)
     70 *      :  Same as normalized_measure, but cuts off at Rcutoff
     71 *   UnnormalizedCutoffMeasure(beta,Rcutoff)
     72 *      :  Same as unnormalized_measure, but cuts off at Rcutoff
     73 * More MeasureDefinitions are listed in the README and defined in MeasureDefinition.hh
     74 *
     75 * For example, for the UnnormalizedMeasure(beta), N-subjettiness is defined as:
     76 *
     77 * tau_N = Sum_{i in jet} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...)
     78 *
     79 *   DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
     80 *   and jet j.
     81 *
     82 * The NormalizedMeausure include an extra parameter R0, and the various cutoff
     83 * measures include an Rcutoff, which effectively defines an angular cutoff
     84 * similar in effect to a cone-jet radius.
     85 */
    4786class Nsubjettiness : public FunctionOfPseudoJet<double> {
    4887
    4988public:
    50 
    51    
    52    // Main constructor, which takes N, the AxesDefiniation, and the MeasureDefinition.
    53    // The Definitions are given in NjettinessDefinition.hh
    54    //
    55    // The recommended AxesDefinitions are (more are available as listed in the README
    56    // and defined in NjettinessDefinition.hh):
    57    //   KT_Axes             : exclusive kt axes
    58    //   WTA_KT_Axes         : exclusive kt with winner-take-all recombination
    59    //   OnePass_KT_Axes     : one-pass minimization from kt starting point
    60    //   OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point
    61    //
    62    // The recommended measure definitions are (with the corresponding parameters)
    63    //   NormalizedMeasure(beta,R0)
    64    //      :  This was the original N-subjettiness measure (dimensionless)
    65    //   UnnormalizedMeasure(beta)
    66    //      :  This is the new recommended default, same as above but without
    67    //      :  the normalization factor, and hence has units of GeV
    68    //   NormalizedCutoffMeasure(beta,R0,Rcutoff)
    69    //      :  Same as normalized_measure, but cuts off at Rcutoff
    70    //   UnnormalizedCutoffMeasure(beta,Rcutoff)
    71    //      :  Same as unnormalized_measure, but cuts off at Rcutoff
     89   
     90   /// Main constructor, which takes N, the AxesDefinition, and the MeasureDefinition.
     91   /// The Definitions are given in AxesDefinition.hh and MeasureDefinition.hh
    7292   Nsubjettiness(int N,
    7393                 const AxesDefinition& axes_def,
     
    7595   : _njettinessFinder(axes_def,measure_def), _N(N) {}
    7696   
    77    
    78    // Alternative constructors that define the measure via enums and parameters
    79    // These constructors are likely be removed
    80    // Zero parameter arguments
    81    // (Currently, no measure uses this)
     97   /// Returns tau_N, measured on the constituents of this jet
     98   double result(const PseudoJet& jet) const;
     99
     100   /// Returns components of tau_N, so that user can find individual tau values.
     101   TauComponents component_result(const PseudoJet& jet) const;
     102   
     103   /// To set axes in manual mode
     104   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
     105      // Note that cross check that manual mode has been set is in Njettiness
     106        _njettinessFinder.setAxes(myAxes);
     107   }
     108   
     109   /// returns seed axes used for onepass minimization (otherwise same as currentAxes)
     110   std::vector<fastjet::PseudoJet> seedAxes() const {
     111      return _njettinessFinder.seedAxes();
     112   }
     113   
     114   /// returns current axes found by result() calculation
     115   std::vector<fastjet::PseudoJet> currentAxes() const {
     116      return _njettinessFinder.currentAxes();
     117   }
     118
     119   /// returns subjet regions found by result() calculation (these have valid constituents)
     120   /// Note that the axes and the subjets are not the same
     121   std::vector<fastjet::PseudoJet> currentSubjets() const {
     122      return _njettinessFinder.currentJets();
     123   }
     124
     125   /// returns components of tau_N without recalculating anything
     126   TauComponents currentTauComponents() const {
     127      return _njettinessFinder.currentTauComponents();
     128   }
     129
     130   /// returns components of tau_N without recalculating anything
     131   TauPartition currentPartition() const {
     132      return _njettinessFinder.currentPartition();
     133   }
     134   
     135private:
     136   
     137   /// Core Njettiness code that is called
     138   Njettiness _njettinessFinder; // TODO:  should muck with this so result can be const without this mutable
     139   /// Number of subjets to find
     140   int _N;
     141   
     142   /// Warning if the user tries to use v1.0.3 constructor.
     143   static LimitedWarning _old_constructor_warning;
     144
     145public:
     146   
     147   // The following interfaces are included for backwards compatibility, but no longer recommended.
     148   // They may be deleted in a future release
     149   
     150   /// \deprecated
     151   /// Alternative constructors that define the measure via enums and parameters
     152   /// These constructors will be removed in v3.0
     153   /// Zero parameter arguments
     154   /// (Currently, no measure uses this)
    82155   Nsubjettiness(int N,
    83156                 Njettiness::AxesMode axes_mode,
    84157                 Njettiness::MeasureMode measure_mode)
    85    : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {}
    86 
    87    // One parameter argument
    88    // (for unnormalized_measure, para1=beta)
     158   : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {
     159      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
     160   }
     161   
     162   /// \deprecated
     163   /// Construcotr for one parameter argument
     164   /// (for unnormalized_measure, para1=beta)
    89165   Nsubjettiness(int N,
    90166                 Njettiness::AxesMode axes_mode,
    91167                 Njettiness::MeasureMode measure_mode,
    92168                 double para1)
    93    : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {}
    94 
    95    // Two parameter arguments
    96    // (for normalized_measure, para1=beta, para2=R0)
    97    // (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff)
     169   : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {
     170      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
     171   }
     172   
     173   /// \deprecated
     174   /// Constructor for two parameter arguments
     175   /// (for normalized_measure, para1=beta, para2=R0)
     176   /// (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff)
    98177   Nsubjettiness(int N,
    99178                 Njettiness::AxesMode axes_mode,
     
    101180                 double para1,
    102181                 double para2)
    103    : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {}
    104 
    105    // Three parameter arguments
    106    // (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff)
     182   : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {
     183      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
     184   }
     185   
     186   /// \deprecated
     187   /// Constructor for three parameter arguments
     188   /// (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff)
    107189   Nsubjettiness(int N,
    108190                 Njettiness::AxesMode axes_mode,
     
    111193                 double para2,
    112194                 double para3)
    113    : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {}
    114 
    115    // Old constructor for backwards compatibility with v1.0,
    116    // where normalized_cutoff_measure was the only option
     195   : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {
     196      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
     197   }
     198   
     199   /// \deprecated
     200   /// Old constructor for backwards compatibility with v1.0,
     201   /// where normalized_cutoff_measure was the only option
    117202   Nsubjettiness(int N,
    118203                 Njettiness::AxesMode axes_mode,
     
    120205                 double R0,
    121206                 double Rcutoff=std::numeric_limits<double>::max())
    122    : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {}
    123    
    124    /// returns tau_N, measured on the constituents of this jet
    125    double result(const PseudoJet& jet) const;
    126 
    127    /// returns components of tau_N, so that user can find individual tau values.
    128    TauComponents component_result(const PseudoJet& jet) const;
    129    
    130    /// returns current axes found by result() calculation
    131    std::vector<fastjet::PseudoJet> currentAxes() const {
    132       return _njettinessFinder.currentAxes();
    133    }
    134 
    135    /// returns seed axes used for onepass minimization (otherwise same as currentAxes)
    136    std::vector<fastjet::PseudoJet> seedAxes() const {
    137       return _njettinessFinder.seedAxes();
    138    }
    139    
    140    /// returns subjet regions found by result() calculation (these have valid constituents)
    141    /// Note that the axes and the subjets are not the same
    142    std::vector<fastjet::PseudoJet> currentSubjets() const {
    143       return _njettinessFinder.currentJets();
    144    }
    145 
    146    /// returns components of tau_N without recalculating anything
    147    TauComponents currentTauComponents() const {
    148       return _njettinessFinder.currentTauComponents();
    149    }
    150    
    151    // To set axes for manual use
    152    void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
    153       // Cross check that manual axes are being used is in Njettiness
    154         _njettinessFinder.setAxes(myAxes);
    155    }
    156    
    157    
    158 private:
    159    
    160    Njettiness _njettinessFinder; // TODO:  should muck with this so result can be const without this mutable
    161    int _N;
    162 
     207   : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {
     208      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
     209   }
     210   
    163211};
    164212
    165213
    166 //------------------------------------------------------------------------
     214///------------------------------------------------------------------------
    167215/// \class NsubjettinessRatio
    168 // NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio
    169 // tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values
    170 // is often used in analyses, so this class is helpful to streamline code.
     216/// \brief Implements ratios of N-subjettiness jet shapes
     217///
     218/// NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio
     219/// tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values
     220/// is often used in analyses, so this class is helpful to streamline code.  Note that
     221/// manual axis mode is not supported
    171222class NsubjettinessRatio : public FunctionOfPseudoJet<double> {
    172223public:
    173224
    174    // Main constructor.  Apart from specifying both N and M, the same options as Nsubjettiness
     225   /// Main constructor.  Apart from specifying both N and M, the same options as Nsubjettiness
    175226   NsubjettinessRatio(int N,
    176227                      int M,
     
    178229                      const MeasureDefinition & measure_def)
    179230   : _nsub_numerator(N,axes_def,measure_def),
    180    _nsub_denominator(M,axes_def,measure_def) {}
    181    
    182    // Alternative constructor with enums and parameters
    183    // Again, likely to be removed
     231   _nsub_denominator(M,axes_def,measure_def) {
     232      if (axes_def.needsManualAxes()) {
     233         throw Error("NsubjettinessRatio does not support ManualAxes mode.");
     234      }
     235   }
     236
     237   /// Returns tau_N/tau_M based off the input jet using result function from Nsubjettiness
     238   double result(const PseudoJet& jet) const;
     239
     240private:
     241
     242   Nsubjettiness _nsub_numerator;   ///< Function for numerator
     243   Nsubjettiness _nsub_denominator; ///< Function for denominator
     244
     245public:
     246   
     247   // The following interfaces are included for backwards compatibility, but no longer recommended.
     248   // They may be deprecated at some point.
     249   
     250   /// \deprecated
     251   /// Old-style constructor for zero arguments
     252   /// Alternative constructor with enums and parameters
     253   /// Again, likely to be removed
    184254   NsubjettinessRatio(int N,
    185255                      int M,
     
    188258   : _nsub_numerator(N, axes_mode, measure_mode),
    189259   _nsub_denominator(M, axes_mode, measure_mode) {}
    190 
    191    
     260   
     261   /// \deprecated
     262   /// Old-style constructor for one argument
    192263   NsubjettinessRatio(int N,
    193264                      int M,
     
    197268   : _nsub_numerator(N, axes_mode, measure_mode, para1),
    198269   _nsub_denominator(M, axes_mode, measure_mode, para1) {}
    199 
     270   
     271   /// \deprecated
     272   /// Old-style constructor for 2 arguments
    200273   NsubjettinessRatio(int N,
    201274                      int M,
     
    207280   _nsub_denominator(M, axes_mode, measure_mode, para1, para2) {}
    208281   
     282   /// \deprecated
     283   /// Old-style constructor for 3 arguments
    209284   NsubjettinessRatio(int N,
    210285                      int M,
     
    217292   _nsub_denominator(M, axes_mode, measure_mode, para1, para2, para3) {}
    218293
    219    //returns tau_N/tau_M based off the input jet using result function from Nsubjettiness
    220    double result(const PseudoJet& jet) const;
    221 
    222 private:
    223 
    224    Nsubjettiness _nsub_numerator;
    225    Nsubjettiness _nsub_denominator;
    226 
     294   
    227295};
    228296
  • external/fastjet/contribs/Nsubjettiness/README

    rf118021 r973b92a  
    1515New in v2.0 is the winner-take-all axis, which is described in:
    1616
     17   Jet Observables Without Jet Algorithms.
     18   Daniele Bertolini, Tucker Chan, and Jesse Thaler.
     19   JHEP 1404:013 (2014), arXiv:1310.7584.
     20
    1721   Jet Shapes with the Broadening Axis.
    1822   Andrew J. Larkoski, Duff Neill, and Jesse Thaler.
    1923   JHEP 1404:017 (2014), arXiv:1401.2158.
    2024
    21 as well as in unpublished work by Gavin Salam.
     25   Unpublished work by Gavin Salam
     26
     27New in v2.2 are new measures used in the XCone jet algorithm, described in:
     28
     29   XCone: N-jettiness as an Exclusive Cone Jet Algorithm.
     30   Iain W. Stewart, Frank J. Tackmann, Jesse Thaler,
     31   Christopher K. Vermilion, and Thomas F. Wilkason.
     32   arXiv:1508.01516.
     33
     34   Resolving Boosted Jets with XCone.
     35   Jesse Thaler and Thomas F. Wilkason.
     36   arXiv:1508.01518.
    2237
    2338--------------------------------------------------------------------------------
     
    2944
    3045Nsubjettiness       [Nsubjettiness.hh]:
    31    A FunctionOfPseudoJet<double> interface to measure N-subjettiness
     46   A FunctionOfPseudoJet<double> interface to measure the
     47   N-subjettiness jet shape
    3248   (Recommended for most users)
     49
    3350NsubjettinessRatio  [Nsubjettiness.hh]:
    3451   A FunctionOfPseudoJet<double> interface to measure ratios of
    3552   two different N-subjettiness (i.e. tau3/tau2)
     53   (Recommended for most users)
     54
     55XConePlugin         [XConePlugin.hh]:
     56   A FastJet plugin for using the XCone jet algorithm.
     57   (Recommended for most users)
     58
    3659NjettinessPlugin    [NjettinessPlugin.hh]:
    37    A FastJet plugin for finding jets by minimizing N-jettiness
    38    (Recommended for advanced users)
     60   A FastJet plugin for finding jets by minimizing N-jettiness.
     61   Same basic philosophy as XCone, but many more options.
     62   (Recommended for advanced users only.)
     63
    3964Njettiness          [Njettiness.hh]:
    4065   Access to the core Njettiness code.
    4166   (Not recommended for users, since the interface might change)
    4267
    43 The code assumes that you have FastJet 3.
     68The code assumes that you have FastJet 3, but does not (yet) require FastJet 3.1
    4469
    4570--------------------------------------------------------------------------------
     
    6489    // N and M give tau_N / tau_M, all other options the same
    6590
     91For example, if you just want the tau_2/tau_1 value of a jet, using recommended
     92parameter choices, do this:
     93
     94    PseudoJet this_jet = /*from your favorite jet algorithm*/;
     95    double beta = 1.0;
     96    NsubjettinessRatio nSub21(2,1,
     97                              OnePass_WTA_KT_Axes(),
     98                              UnnormalizedMeasure(beta));
     99    double tau21 = nSub21(this_jet);
     100
    66101--------------------------------------------------------------------------------
    67102AxesDefinition  [NjettinessDefinition.hh]
     
    72107recommended. Arguments in parentheses are parameters that the user must set.
    73108
    74 Axes can be found using standard recursive clustering procedures.  New is the
    75 option to use the "winner-take-all" recombination scheme:
    76 (*) KT_Axes           // exclusive kt axes
    77     CA_Axes           // exclusive ca axes
    78     AntiKT_Axes(R0)   // inclusive hardest axes with antikt, R0 = radius
    79 (*) WTA_KT_Axes       // exclusive kt with winner-take-all recombination
    80     WTA_CA_Axes       // exclusive ca with winner-take-all recombination
    81 
    82 One can also run a minimization routine to find a (local) minimum of
    83 N-(sub)jettiness:
     109Axes can be found using standard recursive clustering procedures.  New in v2 is
     110the option to use the "winner-take-all" recombination scheme:
     111(*) KT_Axes          // exclusive kt axes
     112    CA_Axes          // exclusive ca axes
     113    AntiKT_Axes(R0)  // inclusive hardest axes with antikt, R0 = radius
     114(*) WTA_KT_Axes      // exclusive kt with winner-take-all recombination
     115    WTA_CA_Axes      // exclusive ca with winner-take-all recombination
     116
     117New in v2.2 are generalized recombination/clustering schemes:
     118    GenET_GenKT_Axes(delta, p, R0 = inf)
     119    WTA_GenKT_Axes(p, R0 = inf)
     120    GenKT_Axes(p, R0 = inf)
     121Here, delta > 0 labels the generalized ET recombination scheme (delta = 1 for
     122standard ET scheme, delta = 2 for ET^2 scheme, delta = infinity for WTA scheme)
     123p >= 0 labels the generalized KT clustering metric (p = 0 for ca, p = 1 for kt),
     124R0 is the radius parameter, and the clustering is run in exclusive mode.  The
     125GenKT_Axes mode uses standard E-scheme recombination.  By default the value of
     126R0 is set to "infinity", namely fastjet::JetDefinition::max_allowable_R.
     127
     128Also new in v2.2 is option of identifying nExtra axes through exclusive
     129clustering and then looking at all (N + nExtra) choose N axes and finding the
     130one that gives the smallest N-(sub)jettiness value:
     131    Comb_GenET_GenKT_Axes(nExtra, delta, p, R0 = inf)
     132    Comb_WTA_GenKT_Axes(nExtra, p, R0 = inf)
     133    Comb_GenKT_Axes(nExtra, p, R0 = inf)
     134These modes are not recommended for reasons of speed.
     135
     136Starting from any set of seed axes, one can run a minimization routine to find
     137a (local) minimum of N-(sub)jettiness.  Note that the one-pass minimization
     138routine is tied to the choice of MeasureDefinition.
    84139(*) OnePass_KT_Axes          // one-pass minimization from kt starting point
    85140    OnePass_CA_Axes          // one-pass min. from ca starting point
     
    87142(*) OnePass_WTA_KT_Axes      // one-pass min. from wta_kt starting point
    88143    OnePass_WTA_CA_Axes      // one-pass min. from wta_ca starting point
    89 
    90 In general, it is difficult to finding the global minimum, but this mode
    91 attempts to do so
    92     MultiPass_Axes(Npass)    // axes that (attempt to) minimize N-subjettiness
    93                              // (NPass = 100 is typical)
     144    OnePass_GenET_GenKT_Axes(delta, p, R0 = inf) // one-pass min. from GenET/KT
     145    OnePass_WTA_GenKT_Axes(p, R0 = inf)          // one-pass min from WTA/GenKT
     146    OnePass_GenKT_Axes(p, R0 = inf)              // one-pass min from GenKT
     147
     148For one-pass minimization, OnePass_CA_Axes and OnePass_WTA_CA_Axes are not
     149recommended as they provide a poor choice of seed axes.
     150
     151In general, it is difficult to find the global minimum, but this mode attempts
     152to do so:
     153    MultiPass_Axes(NPass) // axes that (attempt to) minimize N-subjettiness
     154                          // (NPass = 100 is typical)
     155This does multi-pass minimization from KT_Axes starting points.
    94156
    95157Finally, one can set manual axes:
    96     Manual_Axes          // set your own axes with setAxes()
    97     OnePass_Manual_Axes  // one-pass minimization from manual starting point
     158    Manual_Axes              // set your own axes with setAxes()
     159    OnePass_Manual_Axes      // one-pass minimization from manual starting point
     160    MultiPass_Manual_Axes(Npass) // multi-pass min. from manual
     161
     162If one wants to change the number of passes used by any of the axes finders, one
     163can call the function
     164    setNPass(NPass,nAttempts,accuracy,noise_range)
     165where NPass = 0 only uses the seed axes, NPass = 1 is one-pass minimization, and
     166NPass = 100 is the default multi-pass.  nAttempts is the number of iterations to
     167use in each pass, accuracy is how close to the minimum one tries to get, and
     168noise_range is how much in rapidity/azimuth the random axes are jiggled.
    98169
    99170For most cases, running with OnePass_KT_Axes or OnePass_WTA_KT_Axes gives
    100171reasonable results (and the results are IRC safe).  Because it uses random
    101 number seeds, MultiPass_Axes is not IRC safe (and the code is rather slow).  Note
    102 that for the minimization routines, beta = 1.1 is faster than beta = 1, with
    103 comparable performance.
     172number seeds, MultiPass_Axes is not IRC safe (and the code is rather slow).
     173Note that for the minimization routines, beta = 1.1 is faster than beta = 1,
     174with comparable performance.
    104175
    105176--------------------------------------------------------------------------------
     
    107178--------------------------------------------------------------------------------
    108179
    109 At the moment, there are only a few measures.  Note that each one has a
    110 different number of parameters.  The one indicated by (*)
    111 is the one recommended for use by users new to Nsubjettiness.
     180The value of N-(sub)jettiness depends crucially on the choice of measure.  Each
     181measure has a different number of parameters, so one has to be careful when
     182switching between measures  The one indicated by (*) is the one recommended for
     183use by users new to Nsubjettiness.
    112184
    113185The original N-subjettiness measures are:
     
    122194    UnnormalizedCutoffMeasure(beta,Rcutoff)  //unnormalized measure with
    123195                                             //additional Rcutoff
    124 
    125 In beta testing are "geometric" measures where distances are measured using the
    126 Lorentz dot product (N.B. the formula for the geometric measure is likely to
    127 change since there should be separate beam and jet beta factors.)
    128     GeometricMeasure(beta)               //geometric measure with exponent beta
    129     GeometricCutoffMeasure(beta,Rcutoff) //geometric measure with Rcutoff
     196                                             
     197For all of the above measures, there is an optional argument to change from the
     198ordinary pt_R distance measure recommended for pp collisions to an
     199E_theta distance measure recommended for ee collisions.  There are also
     200lorentz_dot and perp_lorentz_dot distance measures recommended only for
     201advanced users.
     202
     203New for v2.2 is a set of measures defined in arXiv:1508.01516.  First, there is
     204the "conical measure":
     205
     206    ConicalMeasure(beta,R0) // same jets as UnnormalizedCutoffMeasure
     207                            // but differs in normalization and specifics
     208                            // of one-pass minimization
     209
     210Next, there is the geometric measure (as well as a modified version to yield
     211more conical jet regions):
     212
     213    OriginalGeometricMeasure(R) // not recommended for analysis
     214    ModifiedGeometricMeasure(R)
     215
     216(Prior to v2.2, there was a "GeometricMeasure" which unfortunately had the wrong
     217definition.  These have been commented out in the code as
     218"DeprecatedGeometricMeasure" and "DeprecatedGeometricCutoffMeasure", but they
     219should not be used.)
     220
     221Next, there is a "conical geometric" measure:
     222
     223    ConicalGeometricMeasure(beta, gamma, Rcutoff)
     224
     225This is a hybrid between the conical and geometric measures and is the basis for
     226the XCone jet algorithm.  Finally, setting to the gamma = 1 default gives the
     227XCone default measure, which is used in the XConePlugin jet finder
     228
     229(*)  XConeMeasure(beta,Rcutoff)
     230   
     231where beta = 2 is the recommended default value and beta = 1 is the recoil-free
     232default.
    130233
    131234--------------------------------------------------------------------------------
     
    138241
    139242beta = 1:  aka broadening/girth/width measure
     243   the axes behave like the "median" in that they point to the hardest cluster
    140244   wta_kt_axes are approximately the same as minimizing beta = 1 measure
    141245
    142246beta = 2:  aka thrust/mass measure
     247   the axes behave like the "mean" in that they point along the jet momentum
    143248   kt_axes are approximately the same as minimizing beta = 2 measure
    144249
     
    149254
    150255--------------------------------------------------------------------------------
    151 TauComponents  [MeasureFunction.hh]
    152 --------------------------------------------------------------------------------
    153 
    154 For most users, they will only need the value of N-subjettiness (i.e. tau)
    155 itself.  For advanced users, they can access individual tau components (i.e.
    156 the individual numerator pieces, the denominator, etc.) 
    157 
    158    TauComponents tauComp = nSub.component_result(jet);
    159    vector<double> numer = tauComp.jet_pieces_numerator(); //tau for each subjet
    160    double denom = tauComp.denominator();  //normalization factor
    161 
    162 --------------------------------------------------------------------------------
    163 WinnerTakeAllRecombiner  [WinnerTakeAllRecombiner.hh]
    164 --------------------------------------------------------------------------------
    165 
    166 New for version 2.0 of Nsubjettiness are winner-take-all axes.  They are found
    167 with the help of the WinnerTakeAllRecombiner. This class defines a new
    168 recombination scheme for clustering particles. This scheme recombines two
    169 PseudoJets into a PseudoJet with pT of the sum of the two input PseudoJet pTs
    170 and direction of the harder PseudoJet.  This is a "recoil-free" recombination
    171 scheme that guarantees that the axes is aligned with one of the input particles.
    172 It is IRC safe.  Axes found with the standard E-scheme recombiner at similar to
    173 the beta = 2 minimization, while winner-take-all is similar to the beta = 1
    174 measure.
    175 
    176 Note that the WinnerTakeAllRecombiner can be used outside of Nsubjettiness
    177 itself for jet finding.  For example, the direction of anti-kT jets found
    178 with the WinnerTakeAllRecombiner is particularly robust against soft jet
    179 contamination.
     256XConePlugin  [XConePlugin.hh]
     257--------------------------------------------------------------------------------
     258
     259The XCone FastJet plugin is an exclusive cone jet finder which yields a
     260fixed N number of jets which approximately conical boundaries. The algorithm
     261finds N axes, and jets are simply the sum of particles closest to a given axis
     262(or unclustered if they are closest to the beam).  Unlike the NjettinessPlugin
     263below, the user is restricted to using the XConeMeasure.
     264
     265   XConePlugin plugin(N,R,beta=2);
     266   JetDefinition def(&plugin);
     267   ClusterSequence cs(vector<PseudoJet>,def);
     268   vector<PseudoJet> jets = cs.inclusive_jets();
     269
     270Note that despite being an exclusive jet algorithm, one finds the jets using the
     271inclusive_jets() call.
     272
     273The AxesDefinition and MeasureDefinition are defaulted in this measure to
     274OnePass_GenET_GenKT_Axes and XConeMeasure, respectively. The parameters chosen
     275for the OnePass_GenET_GenKT_Axes are defined according to the chosen value of
     276beta as delta = 1/(beta - 1) and p = 1/beta. These have been shown to give the
     277optimal choice of seed axes. The R value for finding the axes is chosen to be
     278the same as the R for the jet algorithm, although in principle, these two radii
     279could be different.
     280
     281N.B.:  The order of the R, beta arguments is *reversed* from the XConeMeasure
     282itself, since this ordering is the more natural one to use for Plugins.  We
     283apologize in advance for any confusion this might cause.
    180284
    181285--------------------------------------------------------------------------------
     
    183287--------------------------------------------------------------------------------
    184288
    185 The Njettiness FastJet plugin represents an exclusive jet finder (yielding a
    186 fixed N number of jets). The algorithm finds N axes, and jets are simply the sum
    187 of particles closest to a given axis (or unclustered if they are closest to the
    188 beam).  The axes finding methods and measures are the same as for Nsubjettiness.
     289Same as the XConePlugin, but the axes finding methods and measures are the same
     290as for Nsubjettiness, allowing more flexibility.
    189291
    190292   NjettinessPlugin plugin(N, AxesDefinition, MeasureDefinition);
     
    193295   vector<PseudoJet> jets = cs.inclusive_jets();
    194296
    195 Note that despite being an exclusive jet algorithm, one finds the jets using the
    196 inclusive_jets() call.
    197 
    198297--------------------------------------------------------------------------------
    199298Very Advanced Usage:  Njettiness  [Njettiness.hh]
     
    202301Most users will want to use the Nsubjettiness or NjettinessPlugin classes to
    203302access N-(sub)jettiness information.  For direct access to the Njettiness class,
    204 one can use Njettiness.hh directly. This class is still evolving, so users who
    205 wish to extend its functionality should contact the authors first.
     303one can use Njettiness.hh directly. This class is in constant evolution, so
     304users who wish to extend its functionality should contact the authors first.
     305
     306--------------------------------------------------------------------------------
     307TauComponents  [MeasureDefinition.hh]
     308--------------------------------------------------------------------------------
     309
     310For most users, they will only need the value of N-subjettiness (i.e. tau)
     311itself.  For advanced users, they can access individual tau components (i.e.
     312the individual numerator pieces, the denominator, etc.) 
     313
     314   TauComponents tauComp = nSub.component_result(jet);
     315   vector<double> numer = tauComp.jet_pieces_numerator(); //tau for each subjet
     316   double denom = tauComp.denominator();  //normalization factor
     317
     318--------------------------------------------------------------------------------
     319Extra Recombiners  [ExtraRecombiners.hh]
     320--------------------------------------------------------------------------------
     321
     322New in v2.0 are winner-take-all axes.  (These have now been included in
     323FastJet 3.1, but we have left the code here to allow the plugin to work under
     324FJ 3.0).  These axes are found with the help of the WinnerTakeAllRecombiner.
     325This class defines a new recombination scheme for clustering particles. This
     326scheme recombines two PseudoJets into a PseudoJet with pT of the sum of the two
     327input PseudoJet pTs and direction of the harder PseudoJet.  This is a
     328"recoil-free" recombination scheme that guarantees that the axes is aligned with
     329one of the input particles. It is IRC safe.  Axes found with the standard
     330E-scheme recombiner at similar to the beta = 2 minimization, while
     331winner-take-all is similar to the beta = 1 measure.
     332
     333New in v2.2 is the GeneralEtSchemeRecombiner, as defined in arxiv:1506.XXXX.
     334This functions similarly to the Et-scheme defined in Fastjet, but the reweighting
     335of the sum of rap and phi is parameterized by an exponent delta. Thus, delta = 1
     336is the normal Et-scheme recombination, delta = 2 is Et^2 recombination, and
     337delta = infinity is the winner-take-all recombination. This recombination scheme
     338is used in GenET_GenKT_Axes, and we find that optimal seed axes for minimization
     339can be found by using delta = 1/(beta - 1).
     340
     341Note that the WinnerTakeAllRecombiner can be used outside of Nsubjettiness
     342itself for jet finding.  For example, the direction of anti-kT jets found
     343with the WinnerTakeAllRecombiner is particularly robust against soft jet
     344contamination.  That said, this functionality is now included in FJ 3.1, so this
     345code is likely to be deprecated in a future version.
    206346
    207347--------------------------------------------------------------------------------
     
    213353N-(sub)jettiness:
    214354
    215 AxesFinder.hh:
    216 
    217 The AxesFinder class (and derived classes) defines the axes used in the
     355AxesDefinition.hh:
     356
     357The AxesDefinition class (and derived classes) defines the axes used in the
    218358calculation of N-(sub)jettiness.  These axes can be defined from the exclusive
    219359jets from a kT or CA algorithm, the hardest jets from an anti-kT algorithm,
     
    223363AxesDefinition.
    224364
    225 MeasureFunction.hh:
    226 
    227 The MeasureFunction class (and derived classes) defines the measure by which
     365MeasureDefinition.hh:
     366
     367The MeasureDefinition class (and derived classes) defines the measure by which
    228368N-(sub)jettiness is calculated. This measure is calculated between each
    229369particle and its corresponding axis, and then summed and normalized to
     
    232372and its axis, and beta is the angular exponent.  Again, in the future the user
    233373will be able to write their own measures, but for the time being, only the
    234 predefined MeasureDefinition values should be used.
     374predefined MeasureDefinition values should be used.  Note that the one-pass
     375minimization algorithms are defined within MeasureDefinition, since they are
     376measure specific.
    235377
    236378--------------------------------------------------------------------------------
     
    240382-- The MultiPass_Axes mode gives different answers on different runs, since
    241383   random numbers are used.
    242 -- In rare cases, one pass minimization can give a larger value of Njettiness
    243    than without minimization.
     384-- For the default measures, in rare cases, one pass minimization can give a
     385   larger value of Njettiness than without minimization. The reason is due
     386   to the fact that axes in default measure are not defined as light-like
    244387-- Nsubjettiness is not thread safe, since there are mutables in Njettiness.
     388-- If the AxesDefinition does not find N axes, then it adds zero vectors to the
     389   list of axes to get the total up to N.  This can lead to unpredictable
     390   results (including divide by zero issues), and a warning is thrown to alert
     391   the user.
     392
     393--------------------------------------------------------------------------------
     394--------------------------------------------------------------------------------
  • external/fastjet/contribs/Nsubjettiness/VERSION

    rf118021 r973b92a  
    1 2.1.0
     12.2.1
Note: See TracChangeset for help on using the changeset viewer.