Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/NNH.hh

    r1d208a2 r35cdc46  
    33
    44//FJSTARTHEADER
    5 // $Id: NNH.hh 4034 2016-03-02 00:20:27Z soyez $
     5// $Id: NNH.hh 3433 2014-07-23 08:17:03Z salam $
    66//
    77// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     
    3232//FJENDHEADER
    3333
    34 #include <fastjet/NNBase.hh>
     34#include<fastjet/ClusterSequence.hh>
     35
    3536
    3637FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
     38
     39/// @ingroup advanced_usage
     40/// \class _NoInfo
     41/// dummy class, used as a default template argument
     42class _NoInfo {};
     43
     44/// @ingroup advanced_usage
     45/// \class NNHInfo
     46/// template that will help initialise a BJ with a PseudoJet and extra information
     47template<class I> class NNHInfo {
     48public:
     49  NNHInfo()         : _info(NULL) {}
     50  NNHInfo(I * info) : _info(info) {}
     51  template<class NNBJ> void init_jet(NNBJ * briefjet, const fastjet::PseudoJet & jet, int index) { briefjet->init(jet, index, _info);}
     52private:
     53  I * _info;
     54};
     55
     56/// @ingroup advanced_usage
     57/// Specialisation of NNHInfo for cases where there is no extra info
     58template<> class NNHInfo<_NoInfo>  {
     59public:
     60  NNHInfo()           {}
     61  NNHInfo(_NoInfo * ) {}
     62  template<class NNBJ> void init_jet(NNBJ * briefjet, const fastjet::PseudoJet & jet, int index) { briefjet->init(jet, index);}
     63};
     64
    3765
    3866//----------------------------------------------------------------------
     
    4068/// \class NNH
    4169/// Help solve closest pair problems with generic interparticle and
    42 /// beam distance (generic case)
    43 ///
    44 /// (see NNBase.hh for an introductory description)
    45 ///
    46 /// This variant provides an implementation for any distance measure.
    47 /// It is templated with a BJ (brief jet) classand can be used with or
    48 /// without an extra "Information" template, i.e. NNH<BJ> or NNH<BJ,I>
     70/// beam distance.
     71///
     72/// Class to help solve closest pair problems with generic interparticle
     73/// distances and a beam distance, using Anderberg's Nearest Neighbour
     74/// Heuristic.
     75///
     76/// It is templated with a BJ (brief jet) class --- BJ should
     77/// basically cache the minimal amount of information that is needed
     78/// to efficiently calculate interparticle distances and particle-beam
     79/// distances.
     80///
     81/// This class can be used with or without an extra "Information" template,
     82/// i.e. NNB<BJ> or NNH<BJ,I>
    4983///
    5084/// For the NNH<BJ> version of the class to function, BJ must provide
     
    5488///  - double BJ::distance(const BJ * other_bj_jet); // distance between this and other_bj_jet
    5589///  - double BJ::beam_distance()                  ; // distance to the beam
    56 /// 
     90///
    5791/// For the NNH<BJ,I> version to function, the BJ::init(...) member
    5892/// must accept an extra argument
     
    6094///  - void   BJ::init(const PseudoJet & jet, I * info);   // initialise with a PseudoJet + info
    6195///
    62 /// NOTE: THE DISTANCE MUST BE SYMMETRIC I.E. SATISFY
    63 ///     a.distance(b) == b.distance(a)
     96/// where info might be a pointer to a class that contains, e.g., information
     97/// about R, or other parameters of the jet algorithm
    6498///
    6599/// For an example of how the NNH<BJ> class is used, see the Jade (and
     
    73107/// implementations.
    74108///
    75 template<class BJ, class I = _NoInfo> class NNH : public NNBase<I> {
     109///
     110/// Implementation note: this class derives from NNHInfo, which deals
     111/// with storing any global information that is needed during the clustering
     112
     113template<class BJ, class I = _NoInfo> class NNH : public NNHInfo<I> {
    76114public:
    77115
    78116  /// constructor with an initial set of jets (which will be assigned indices
    79117  /// 0 ... jets.size()-1
    80   NNH(const std::vector<PseudoJet> & jets)           : NNBase<I>()     {start(jets);}
    81   NNH(const std::vector<PseudoJet> & jets, I * info) : NNBase<I>(info) {start(jets);}
    82 
    83   // initialisation from a given list of particles
     118  NNH(const std::vector<PseudoJet> & jets) {start(jets);}
     119  NNH(const std::vector<PseudoJet> & jets, I * info) : NNHInfo<I>(info) {start(jets);}
     120 
    84121  void start(const std::vector<PseudoJet> & jets);
    85122
Note: See TracChangeset for help on using the changeset viewer.