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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/tools/GridMedianBackgroundEstimator.hh

    r5b5a56b r35cdc46  
    22#define __GRID_MEDIAN_BACKGROUND_ESTIMATOR_HH__
    33
    4 //STARTHEADER
    5 // $Id: GridMedianBackgroundEstimator.hh 2580 2011-09-13 17:25:43Z salam $
    6 //
    7 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     4//FJSTARTHEADER
     5// $Id: GridMedianBackgroundEstimator.hh 3610 2014-08-13 09:49:28Z salam $
     6//
     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/tools/BackgroundEstimatorBase.hh"
     36
     37// if defined then we'll use the RectangularGrid class
     38//
     39// (For FastJet 3.2, maybe remove the symbol and simply clean up the
     40// code below to use exclusively the RectangularGrid)
     41#define FASTJET_GMBGE_USEFJGRID
     42
     43#ifdef FASTJET_GMBGE_USEFJGRID
     44#include "fastjet/RectangularGrid.hh"
     45#endif
     46
     47
    3448
    3549FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
     
    6175///   rho() [Without rescaling, they are identical]
    6276///
    63 class GridMedianBackgroundEstimator : public BackgroundEstimatorBase {
     77class GridMedianBackgroundEstimator : public BackgroundEstimatorBase
     78#ifdef FASTJET_GMBGE_USEFJGRID
     79                                                                    , RectangularGrid
     80#endif
     81{
     82
    6483public:
    6584  /// @name  constructors and destructors
    6685  //\{
     86#ifdef FASTJET_GMBGE_USEFJGRID
    6787  //----------------------------------------------------------------
    6888  ///   \param ymax   maximal absolute rapidity extent of the grid
     
    7191  ///             periodicity in azimuthal angle (size, not area)
    7292  GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) :
     93    RectangularGrid(ymax, requested_grid_spacing),
     94    _has_particles(false), _enable_rho_m(true) {}
     95
     96  //----------------------------------------------------------------
     97  /// Constructor based on a user's fully specified RectangularGrid
     98  GridMedianBackgroundEstimator(const RectangularGrid & grid) :
     99    RectangularGrid(grid),
     100    _has_particles(false), _enable_rho_m(true) {
     101    if (!RectangularGrid::is_initialised())
     102      throw Error("attempt to construct GridMedianBackgroundEstimator with uninitialised RectangularGrid");
     103  }   
     104
     105#else  // alternative in old framework where we didn't have the rectangular grid
     106  GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) :
    73107    _ymin(-ymax), _ymax(ymax),
    74108    _requested_grid_spacing(requested_grid_spacing),
    75     _has_particles(false){setup_grid();}
     109    _has_particles(false), _enable_rho_m(true)
     110  {
     111     setup_grid();
     112  }
     113#endif // FASTJET_GMBGE_USEFJGRID
     114
    76115  //\}
    77116
     
    84123  /// of the specified particles.
    85124  void set_particles(const std::vector<PseudoJet> & particles);
     125
     126  /// determine whether the automatic calculation of rho_m and sigma_m
     127  /// is enabled (by default true)
     128  void set_compute_rho_m(bool enable){ _enable_rho_m = enable;}
    86129
    87130  //\}
     
    114157  bool has_sigma() {return true;}
    115158
     159  //-----------------------------------------------------------------
     160  /// Returns rho_m, the purely longitudinal, particle-mass-induced
     161  /// component of the background density per unit area
     162  double rho_m() const;
     163
     164  /// returns sigma_m, a measure of the fluctuations in the purely
     165  /// longitudinal, particle-mass-induced component of the background
     166  /// density per unit area; must be multipled by sqrt(area) to get
     167  /// fluctuations for a region of a given area.
     168  double sigma_m() const;
     169
     170  /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const.
     171  double rho_m(const PseudoJet & jet);
     172
     173  /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const.
     174  double sigma_m(const PseudoJet & jet);
     175
     176  /// Returns true if this background estimator has support for
     177  /// determination of rho_m.
     178  ///
     179  /// Note that support for sigma_m is automatic is one has sigma and
     180  /// rho_m support.
     181  bool has_rho_m() const {return _enable_rho_m;}
     182
     183
    116184  /// returns the area of the grid cells (all identical, but
    117185  /// referred to as "mean" area for uniformity with JetMedianBGE).
    118   double mean_area() const {return _cell_area;}
     186  double mean_area() const {return mean_tile_area();}
    119187  //\}
    120188
     
    134202  /// Note that this has to be called BEFORE any attempt to do an
    135203  /// actual computation
     204  ///
     205  /// The same profile will be used for both pt and mt (this is
     206  /// probabaly a good approximation since the particle density
     207  /// changes is what dominates the rapidity profile)
    136208  virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class);
    137209
     
    149221
    150222private:
     223
     224#ifndef FASTJET_GMBGE_USEFJGRID
     225
    151226  /// configure the grid
    152227  void setup_grid();
    153228
    154229  /// retrieve the grid cell index for a given PseudoJet
    155   int igrid(const PseudoJet & p) const;
     230  int tile_index(const PseudoJet & p) const;
     231
     232  // information about the grid
     233  double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _tile_area;
     234  int _ny, _nphi, _ntotal;
     235
     236  int n_tiles() const {return _ntotal;}
     237  int n_good_tiles() const {return n_tiles();}
     238  int tile_is_good(int /* itile */) const {return true;}
     239
     240  double mean_tile_area() const {return _tile_area;}
     241#endif // FASTJET_GMBGE_USEFJGRID
     242
    156243
    157244  /// verify that particles have been set and throw an error if not
    158245  void verify_particles_set() const;
    159246
    160   // information about the grid
    161   double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _cell_area;
    162   int _ny, _nphi, _ntotal;
    163 
    164247  // information abotu the event
    165   std::vector<double> _scalar_pt;
     248  //std::vector<double> _scalar_pt;
     249  double _rho, _sigma, _rho_m, _sigma_m;
    166250  bool _has_particles;
    167 
    168   // various warnings to let people aware of potential dangers
     251  bool _enable_rho_m;
     252
     253  // various warnings to inform people of potential dangers
    169254  LimitedWarning _warning_rho_of_jet;
    170255  LimitedWarning _warning_rescaling;
Note: See TracChangeset for help on using the changeset viewer.