FastJet 3.0beta1
|
00001 #ifndef __GRID_MEDIAN_BACKGROUND_ESTIMATOR_HH__ 00002 #define __GRID_MEDIAN_BACKGROUND_ESTIMATOR_HH__ 00003 00004 //STARTHEADER 00005 // $Id: GridMedianBackgroundEstimator.hh 2472 2011-07-26 11:25:42Z cacciari $ 00006 // 00007 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez 00008 // 00009 //---------------------------------------------------------------------- 00010 // This file is part of FastJet. 00011 // 00012 // FastJet is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU General Public License as published by 00014 // the Free Software Foundation; either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // The algorithms that underlie FastJet have required considerable 00018 // development and are described in hep-ph/0512210. If you use 00019 // FastJet as part of work towards a scientific publication, please 00020 // include a citation to the FastJet paper. 00021 // 00022 // FastJet is distributed in the hope that it will be useful, 00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 // GNU General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with FastJet; if not, write to the Free Software 00029 // Foundation, Inc.: 00030 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00031 //---------------------------------------------------------------------- 00032 //ENDHEADER 00033 00034 00035 #include "fastjet/tools/BackgroundEstimatorBase.hh" 00036 00037 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00038 00039 /// @ingroup tools_background 00040 /// \class GridMedianBackgroundEstimator 00041 /// 00042 /// Background Estimator based on the median pt/area of a set of grid 00043 /// cells. 00044 /// 00045 /// Description of the method: 00046 /// This background estimator works by projecting the event onto a 00047 /// grid in rapidity and azimuth. In each grid cell, the scalar pt 00048 /// sum of the particles in the cell is computed. The background 00049 /// density is then estimated by the median of (scalar pt sum/cell 00050 /// area) for all cells. 00051 /// 00052 /// Parameters: 00053 /// The class takes 2 arguments: the absolute rapidity extent of the 00054 /// cells and the size of the grid cells. Note that the size of the cell 00055 /// will be adjusted in azimuth to satisfy the 2pi periodicity and 00056 /// in rapidity to match the requested rapidity extent. 00057 /// 00058 /// Rescaling: 00059 /// It is possible to use a rescaling profile. In this case, the 00060 /// profile needs to be set before setting the particles and it will 00061 /// be applied to each particle (i.e. not to each cell). 00062 /// Note also that in this case one needs to call rho(jet) instead of 00063 /// rho() [Without rescaling, they are identical] 00064 /// 00065 class GridMedianBackgroundEstimator : public BackgroundEstimatorBase { 00066 public: 00067 /// @ name constructors and destructors 00068 //\{ 00069 //---------------------------------------------------------------- 00070 /// default ctor 00071 /// The arguments are as follows: 00072 00073 /// \param ymax maximal absolute rapidity extent of the grid 00074 /// \param requested_grid_spacing size of the grid cell. The 00075 /// "real" cell size could differ due e.g. to the 2pi 00076 /// periodicity in azimuthal angle (size, not area) 00077 GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) : 00078 _ymin(-ymax), _ymax(ymax), 00079 _requested_grid_spacing(requested_grid_spacing), 00080 _has_particles(false){setup_grid();} 00081 //\} 00082 00083 00084 /// @name setting a new event 00085 //\{ 00086 //---------------------------------------------------------------- 00087 00088 /// tell the background estimator that it has a new event, composed 00089 /// of the specified particles. 00090 void set_particles(const std::vector<PseudoJet> & particles); 00091 00092 //\} 00093 00094 /// @ name retrieving fundamental information 00095 //\{ 00096 //---------------------------------------------------------------- 00097 00098 /// returns rho, the median background density per unit area 00099 double rho() const; 00100 00101 /// returns sigma, the background fluctuations per unit area; must be 00102 /// multipled by sqrt(area) to get fluctuations for a region of a 00103 /// given area. 00104 double sigma() const; 00105 00106 /// returns rho, the background density per unit area, locally at the 00107 /// position of a given jet. Note that this is not const, because a 00108 /// user may then wish to query other aspects of the background that 00109 /// could depend on the position of the jet last used for a rho(jet) 00110 /// determination. 00111 double rho(const PseudoJet & jet); 00112 00113 /// returns sigma, the background fluctuations per unit area, locally at 00114 /// the position of a given jet. As for rho(jet), it is non-const. 00115 double sigma(const PseudoJet & jet); 00116 00117 /// returns true if this background estimator has support for 00118 /// determination of sigma 00119 bool has_sigma() {return true;} 00120 00121 /// returns the area of the grid cells (all identical, but 00122 /// referred to as "mean" area for uniformity with JetMedianBGE). 00123 double mean_area() const {return _cell_area;} 00124 //\} 00125 00126 /// @name configuring the behaviour 00127 //\{ 00128 //---------------------------------------------------------------- 00129 00130 /// Set a pointer to a class that calculates the rescaling factor as 00131 /// a function of the jet (position). Note that the rescaling factor 00132 /// is used both in the determination of the "global" rho (the pt/A 00133 /// of each jet is divided by this factor) and when asking for a 00134 /// local rho (the result is multiplied by this factor). 00135 /// 00136 /// The BackgroundRescalingYPolynomial class can be used to get a 00137 /// rescaling that depends just on rapidity. 00138 /// 00139 /// Note that this has to be called BEFORE any attempt to do an 00140 /// actual computation 00141 virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class); 00142 00143 //\} 00144 00145 /// @name description 00146 //\{ 00147 //---------------------------------------------------------------- 00148 00149 /// returns a textual description of the background estimator 00150 std::string description() const; 00151 00152 //\} 00153 00154 00155 private: 00156 /// configure the grid 00157 void setup_grid(); 00158 00159 /// retrieve the grid cell index for a given PseudoJet 00160 int igrid(const PseudoJet & p) const; 00161 00162 /// verify that particles have been set and throw an error if not 00163 void verify_particles_set() const; 00164 00165 // information about the grid 00166 double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _cell_area; 00167 int _ny, _nphi, _ntotal; 00168 00169 // information abotu the event 00170 std::vector<double> _scalar_pt; 00171 bool _has_particles; 00172 00173 // various warnings to let people aware of potential dangers 00174 LimitedWarning _warning_rho_of_jet; 00175 LimitedWarning _warning_rescaling; 00176 }; 00177 00178 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh 00179 00180 #endif // __GRID_MEDIAN_BACKGROUND_ESTIMATOR_HH__