FastJet 3.0beta1
|
00001 #ifndef __FASTJET_BACKGROUND_ESTIMATOR_BASE_HH__ 00002 #define __FASTJET_BACKGROUND_ESTIMATOR_BASE_HH__ 00003 00004 //STARTHEADER 00005 // $Id: BackgroundEstimatorBase.hh 2486 2011-08-02 09:38:36Z salam $ 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 #include <fastjet/ClusterSequenceAreaBase.hh> 00035 #include <fastjet/FunctionOfPseudoJet.hh> 00036 #include <fastjet/Selector.hh> 00037 #include <fastjet/Error.hh> 00038 #include <iostream> 00039 00040 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00041 00042 00043 /// @ingroup tools_background 00044 /// \class BackgroundEstimatorBase 00045 /// 00046 /// Abstract base class that provides the basic interface for classes 00047 /// that estimate levels of background radiation in hadrion and 00048 /// heavy-ion collider events. 00049 /// 00050 /// 00051 class BackgroundEstimatorBase { 00052 public: 00053 /// @ name constructors and destructors 00054 //\{ 00055 //---------------------------------------------------------------- 00056 BackgroundEstimatorBase() : _rescaling_class(0) {} 00057 //\} 00058 00059 /// a default virtual destructor that does nothing 00060 virtual ~BackgroundEstimatorBase() {} 00061 00062 00063 /// @name setting a new event 00064 //\{ 00065 //---------------------------------------------------------------- 00066 00067 /// tell the background estimator that it has a new event, composed 00068 /// of the specified particles. 00069 virtual void set_particles(const std::vector<PseudoJet> & particles) = 0; 00070 00071 //\} 00072 00073 /// @ name retrieving fundamental information 00074 //\{ 00075 //---------------------------------------------------------------- 00076 00077 /// get rho, the background density per unit area 00078 virtual double rho() const = 0; 00079 00080 /// get sigma, the background fluctuations per unit area; must be 00081 /// multipled by sqrt(area) to get fluctuations for a region of a 00082 /// given area. 00083 virtual double sigma() const { 00084 throw Error("sigma() not supported for this Background Estimator"); 00085 } 00086 00087 /// get rho, the background density per unit area, locally at the 00088 /// position of a given jet. Note that this is not const, because a 00089 /// user may then wish to query other aspects of the background that 00090 /// could depend on the position of the jet last used for a rho(jet) 00091 /// determination. 00092 virtual double rho(const PseudoJet & jet) = 0; 00093 00094 /// get sigma, the background fluctuations per unit area, locally at 00095 /// the position of a given jet. As for rho(jet), it is non-const. 00096 virtual double sigma(const PseudoJet & jet) { 00097 throw Error("sigma(jet) not supported for this Background Estimator"); 00098 } 00099 00100 /// returns true if this background estimator has support for 00101 /// determination of sigma 00102 virtual bool has_sigma() {return false;} 00103 //\} 00104 00105 00106 /// @name configuring the behaviour 00107 //\{ 00108 //---------------------------------------------------------------- 00109 00110 /// Set a pointer to a class that calculates the rescaling factor as 00111 /// a function of the jet (position). Note that the rescaling factor 00112 /// is used both in the determination of the "global" rho (the pt/A 00113 /// of each jet is divided by this factor) and when asking for a 00114 /// local rho (the result is multiplied by this factor). 00115 /// 00116 /// The BackgroundRescalingYPolynomial class can be used to get a 00117 /// rescaling that depends just on rapidity. 00118 virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class) { _rescaling_class = rescaling_class; } 00119 00120 /// return the pointer to the jet density class 00121 const FunctionOfPseudoJet<double> * rescaling_class() const{ 00122 return _rescaling_class; 00123 } 00124 00125 //\} 00126 00127 /// @name description 00128 //\{ 00129 //---------------------------------------------------------------- 00130 00131 /// returns a textual description of the background estimator 00132 virtual std::string description() const = 0; 00133 00134 //\} 00135 00136 protected: 00137 /// @name helpers for derived classes 00138 /// 00139 /// Note that these helpers are related to median-based estimation 00140 /// of the background, so there is no guarantee that they will 00141 /// remain in this base class in the long term 00142 //\{ 00143 //---------------------------------------------------------------- 00144 00145 /// given a quantity in a vector (e.g. pt_over_area) and knowledge 00146 /// about the number of empty jets, calculate the median and 00147 /// stand_dev_if_gaussian (roughly from the 16th percentile) 00148 /// 00149 /// If do_fj2_calculation is set to true then this performs FastJet 00150 /// 2.X estimation of the standard deviation, which has a spurious 00151 /// offset in the limit of a small number of jets. 00152 void _median_and_stddev(const std::vector<double> & quantity_vector, 00153 double n_empty_jets, 00154 double & median, 00155 double & stand_dev_if_gaussian, 00156 bool do_fj2_calculation = false 00157 ) const; 00158 00159 /// computes a percentile of a given _sorted_ vector 00160 /// \param sorted_quantity_vector the vector contains the data sample 00161 /// \param percentile the percentile (defined between 0 and 1) to compute 00162 /// \param nempty an additional number of 0's 00163 /// (considered at the beginning of 00164 /// the quantity vector) 00165 /// \param do_fj2_calculation carry out the calculation as it 00166 /// was done in fj2 (suffers from "edge effects") 00167 double _percentile(const std::vector<double> & sorted_quantity_vector, 00168 const double percentile, 00169 const double nempty=0.0, 00170 const bool do_fj2_calculation = false) const; 00171 00172 //\} 00173 00174 const FunctionOfPseudoJet<double> * _rescaling_class; 00175 static LimitedWarning _warnings_empty_area; 00176 }; 00177 00178 00179 00180 //---------------------------------------------------------------------- 00181 /// @ingroup tools_background 00182 /// A background rescaling that is a simple polynomial in y 00183 class BackgroundRescalingYPolynomial : public FunctionOfPseudoJet<double> { 00184 public: 00185 /// construct a background rescaling polynomial of the form 00186 /// a0 + a1*y + a2*y^2 + a3*y^3 + a4*y^4 00187 /// 00188 /// The following values give a reasonable reproduction of the 00189 /// Pythia8 tune 4C background shape for pp collisions at 00190 /// sqrt(s)=7TeV: 00191 /// 00192 /// - a0 = 1.157 00193 /// - a1 = 0 00194 /// - a2 = -0.0266 00195 /// - a3 = 0 00196 /// - a4 = 0.000048 00197 /// 00198 BackgroundRescalingYPolynomial(double a0=1, 00199 double a1=0, 00200 double a2=0, 00201 double a3=0, 00202 double a4=0) : _a0(a0), _a1(a1), _a2(a2), _a3(a3), _a4(a4) {} 00203 00204 /// return the rescaling factor associated with this jet 00205 virtual double result(const PseudoJet & jet) const; 00206 private: 00207 double _a0, _a1, _a2, _a3, _a4; 00208 }; 00209 00210 00211 00212 00213 00214 FASTJET_END_NAMESPACE 00215 00216 #endif // __BACKGROUND_ESTIMATOR_BASE_HH__ 00217