Fork me on GitHub

Ignore:
Timestamp:
Sep 3, 2014, 3:18:54 PM (10 years ago)
Author:
Pavel Demin <demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
be2222c
Parents:
5b5a56b
Message:

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

Location:
external/fastjet/plugins/GridJet
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/plugins/GridJet/GridJetPlugin.cc

    r5b5a56b r35cdc46  
    1 //STARTHEADER
    2 // $Id$
    3 //
    4 // Copyright (c) 2011, Matteo Cacciari, Gavin Salam and Gregory Soyez
     1//FJSTARTHEADER
     2// $Id: GridJetPlugin.cc 2268 2011-06-20 15:12:26Z salam $
     3//
     4// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
    55//
    66//----------------------------------------------------------------------
     
    1313//
    1414//  The algorithms that underlie FastJet have required considerable
    15 //  development and are described in hep-ph/0512210. If you use
     15//  development. They are described in the original FastJet paper,
     16//  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
    1617//  FastJet as part of work towards a scientific publication, please
    17 //  include a citation to the FastJet paper.
     18//  quote the version you use and include a citation to the manual and
     19//  optionally also to hep-ph/0512210.
    1820//
    1921//  FastJet is distributed in the hope that it will be useful,
     
    2527//  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
    2628//----------------------------------------------------------------------
    27 //ENDHEADER
     29//FJENDHEADER
    2830
    2931// fastjet stuff
     
    4345                              double requested_grid_spacing,
    4446                              const JetDefinition & post_jet_def) :
     47#ifdef FASTJET_GRIDJET_USEFJGRID
     48  RectangularGrid(ymax, requested_grid_spacing), _post_jet_def(post_jet_def) {
     49}
     50#else
    4551  _ymin(-ymax), _ymax(ymax),
    4652  _requested_grid_spacing(requested_grid_spacing) ,
     
    4955  setup_grid();
    5056}
    51 
     57#endif
     58
     59#ifdef FASTJET_GRIDJET_USEFJGRID
     60GridJetPlugin::GridJetPlugin (const RectangularGrid & grid,
     61                              const JetDefinition & post_jet_def) :
     62  RectangularGrid(grid), _post_jet_def(post_jet_def) {
     63  if (!RectangularGrid::is_initialised())
     64    throw Error("attempt to construct GridJetPlugin with uninitialised RectangularGrid");
     65}
     66#endif // FASTJET_GRIDJET_USEFJGRID
     67
     68#ifndef FASTJET_GRIDJET_USEFJGRID
    5269void GridJetPlugin::setup_grid() {
    5370  // since we've exchanged the arguments of the constructor,
     
    6986}
    7087
    71 
    72 //----------------------------------------------------------------------
    73 string GridJetPlugin::description () const {
    74   ostringstream desc;
    75   desc << "GridJetPlugin plugin with ymax = " << _ymax << ", dy = " << _dy << ", dphi = " << _dphi << " (requested grid spacing was " << _requested_grid_spacing << ")";
    76   if (_post_jet_def.jet_algorithm() != undefined_jet_algorithm) {
    77     desc << ", followed by " << _post_jet_def.description();
    78   }
    79   return desc.str();
    80 }
    81 
    82 
    83 //----------------------------------------------------------------------
    84 double GridJetPlugin::R() const {return sqrt(_dy*_dphi/pi);}
    85 
    86 
    87 //----------------------------------------------------------------------
    88 int GridJetPlugin::igrid(const PseudoJet & p) const {
     88//----------------------------------------------------------------------
     89int GridJetPlugin::tile_index(const PseudoJet & p) const {
    8990  // directly taking int does not work for values between -1 and 0
    9091  // so use floor instead
     
    108109  return igrid_res;
    109110}
     111#endif // not FASTJET_GRIDJET_USEFJGRID
     112
     113
     114//----------------------------------------------------------------------
     115string GridJetPlugin::description () const {
     116  ostringstream desc;
     117  desc << "GridJetPlugin plugin with ";
     118#ifndef FASTJET_GRIDJET_USEFJGRID
     119  desc << "ymax = " << _ymax << ", dy = " << _dy << ", dphi = " << _dphi << " (requested grid spacing was " << _requested_grid_spacing << ")";
     120#else
     121  desc << RectangularGrid::description();
     122#endif
     123  if (_post_jet_def.jet_algorithm() != undefined_jet_algorithm) {
     124    desc << ", followed by " << _post_jet_def.description();
     125  }
     126  return desc.str();
     127}
     128
     129
     130//----------------------------------------------------------------------
     131double GridJetPlugin::R() const {return sqrt(drap()*dphi()/pi);}
    110132
    111133
     
    117139  //  * a number >= 0 will mean that particle indicated by the index
    118140  //    is currently the jet on the grid
    119   vector<int> grid(_ntotal, -1);
     141  vector<int> grid(n_tiles(), -1);
    120142 
    121143  int nparticles = cs.jets().size();
     
    126148  // combine particles with whatever is in the grid
    127149  for (int i = 0; i < nparticles; i++) {
    128     int igrd = igrid(cs.jets()[i]);
     150    int igrd = tile_index(cs.jets()[i]);
    129151    //cout << i << " " << cs.jets()[i].rap() << " " << cs.jets()[i].phi()
    130152    //   << " " << igrd << " " << grid.size() << " " << _ntotal << endl;
    131153    if (igrd < 0) continue;
    132     assert(igrd <= _ntotal);
     154    assert(igrd <= n_tiles());
    133155    if (grid[igrd] == -1) {
    134156      grid[igrd] = i; // jet index of initial particle i is i
     
    145167    // make the final jets via iB recombinations
    146168    for (unsigned igrd = 0; igrd < grid.size(); igrd++) {
    147       if (grid[igrd] != -1) cs.plugin_record_iB_recombination(grid[igrd],
    148                                                               dij_or_diB);
     169      if (grid[igrd] != -1 && tile_is_good(igrd))
     170                   cs.plugin_record_iB_recombination(grid[igrd], dij_or_diB);
    149171    }
    150172  } else {
  • external/fastjet/plugins/GridJet/fastjet/GridJetPlugin.hh

    r5b5a56b r35cdc46  
    1 #ifndef __GRIDJETPLUGIN_HH__
    2 #define __GRIDJETPLUGIN_HH__
     1#ifndef __FASTJET_GRIDJETPLUGIN_HH__
     2#define __FASTJET_GRIDJETPLUGIN_HH__
    33
    4 //STARTHEADER
     4//FJSTARTHEADER
    55// $Id: GridJetPlugin.hh 2267 2011-06-20 15:10:23Z salam $
    66//
    7 // Copyright (c) 2011, Matteo Cacciari, Gavin Salam and Gregory Soyez
     7// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
    88//
    99//----------------------------------------------------------------------
     
    1616//
    1717//  The algorithms that underlie FastJet have required considerable
    18 //  development and are described in hep-ph/0512210. If you use
     18//  development. They are described in the original FastJet paper,
     19//  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
    1920//  FastJet as part of work towards a scientific publication, please
    20 //  include a citation to the FastJet paper.
     21//  quote the version you use and include a citation to the manual and
     22//  optionally also to hep-ph/0512210.
    2123//
    2224//  FastJet is distributed in the hope that it will be useful,
     
    2830//  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
    2931//----------------------------------------------------------------------
    30 //ENDHEADER
     32//FJENDHEADER
    3133
    3234
    3335#include "fastjet/JetDefinition.hh"
     36
     37// makes it easy to switch back and forth between use of
     38// RectangularGrid or not; this got enabled in FJ3.1
     39#define FASTJET_GRIDJET_USEFJGRID
     40
     41#ifdef FASTJET_GRIDJET_USEFJGRID
     42#include "fastjet/RectangularGrid.hh"
     43#endif
    3444
    3545FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
     
    4959/// but is rather provided for comparison purposes with the
    5060/// GridMedianBackgroundEstimator (which is even faster).
    51 class GridJetPlugin : public JetDefinition::Plugin {
     61class GridJetPlugin : public JetDefinition::Plugin
     62#ifdef FASTJET_GRIDJET_USEFJGRID
     63                                      , RectangularGrid
     64#endif
     65{
    5266public:
    53   /// Main constructor for the GridJetPlugin Plugin class.
     67  /// Basic constructor for the GridJetPlugin Plugin class.
    5468  ///
    5569  /// \param ymax           The maximal rapidity extent of the grid
     
    6276                 const JetDefinition & post_jet_def = JetDefinition());
    6377
    64   /// copy constructor
    65   GridJetPlugin (const GridJetPlugin & plugin) {
    66     *this = plugin;
    67   }
     78#ifdef FASTJET_GRIDJET_USEFJGRID
     79  /// Constructor for the GridJetPlugin Plugin class that allows
     80  /// full control over the underlying grid. New in FastJet 3.1.
     81  ///
     82  /// \param grid           The maximal rapidity extent of the grid
     83  /// \param post_jet_def   if present, and not == JetDefinition()
     84  ///                       (which has undefined_jet_algorithm), then
     85  ///                       run the post_jet_def on the result of the grid
     86  ///                       clustering.
     87  GridJetPlugin (const RectangularGrid & grid,
     88                 const JetDefinition & post_jet_def = JetDefinition());
     89#endif // FASTJET_GRIDJET_USEFJGRID
     90
     91 
     92
     93  // /// copy constructor
     94  // GridJetPlugin (const GridJetPlugin & plugin) {
     95  //   *this = plugin;
     96  // }
    6897
    6998  // the things that are required by base class
     
    75104  virtual double R() const;
    76105
     106  // As of FastJet 3.1 the following functions become available through
     107  // the underlying RectangularGrid class.
     108#ifndef FASTJET_GRIDJET_USEFJGRID
    77109  /// returns the actual rapidity spacing of the grid
    78110  double drap()   const {return _dy;}
     
    83115  /// returns the maximum rapidity of the grid
    84116  double rapmax() const {return _ymax;}
     117#endif
    85118
    86119private:
    87120
     121#ifndef FASTJET_GRIDJET_USEFJGRID
    88122  void setup_grid();
    89123
    90   int igrid(const PseudoJet & p) const;
     124  int n_tiles() const {return _ntotal;}
     125  int n_good_tiles() const {return _ntotal;}
     126
     127  int tile_index(const PseudoJet & p) const;
     128  bool tile_is_good(int /* itile */) const {return true;}
    91129
    92130  double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing;
    93131  int _ny, _nphi, _ntotal;
     132#endif
    94133
    95134  JetDefinition _post_jet_def;
     
    99138FASTJET_END_NAMESPACE        // defined in fastjet/internal/base.hh
    100139
    101 #endif // __GRIDJETPLUGIN_HH__
     140#endif // __FASTJET_GRIDJETPLUGIN_HH__
    102141
Note: See TracChangeset for help on using the changeset viewer.