FastJet 3.0beta1
|
00001 //STARTHEADER 00002 // $Id: ClusterSequenceAreaBase.hh 2304 2011-06-29 06:36:26Z soyez $ 00003 // 00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam 00005 // 00006 //---------------------------------------------------------------------- 00007 // This file is part of FastJet. 00008 // 00009 // FastJet is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // The algorithms that underlie FastJet have required considerable 00015 // development and are described in hep-ph/0512210. If you use 00016 // FastJet as part of work towards a scientific publication, please 00017 // include a citation to the FastJet paper. 00018 // 00019 // FastJet is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with FastJet; if not, write to the Free Software 00026 // Foundation, Inc.: 00027 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 //---------------------------------------------------------------------- 00029 //ENDHEADER 00030 00031 #ifndef __FASTJET_CLUSTERSEQUENCEAREABASE_HH__ 00032 #define __FASTJET_CLUSTERSEQUENCEAREABASE_HH__ 00033 00034 #include "fastjet/ClusterSequence.hh" 00035 #include "fastjet/internal/LimitedWarning.hh" 00036 #include "fastjet/Selector.hh" 00037 00038 FASTJET_BEGIN_NAMESPACE 00039 00040 /// @ingroup area_classes 00041 /// \class ClusterSequenceAreaBase 00042 /// base class that sets interface for extensions of ClusterSequence 00043 /// that provide information about the area of each jet 00044 /// 00045 /// the virtual functions here all return 0, since no area determination 00046 /// is implemented. 00047 class ClusterSequenceAreaBase : public ClusterSequence { 00048 public: 00049 00050 /// a constructor which just carries out the construction of the 00051 /// parent class 00052 template<class L> ClusterSequenceAreaBase 00053 (const std::vector<L> & pseudojets, 00054 const JetDefinition & jet_def, 00055 const bool & writeout_combinations = false) : 00056 ClusterSequence(pseudojets, jet_def, writeout_combinations) {} 00057 00058 00059 /// default constructor 00060 ClusterSequenceAreaBase() {} 00061 00062 00063 /// destructor 00064 virtual ~ClusterSequenceAreaBase() {} 00065 00066 00067 /// return the area associated with the given jet; this base class 00068 /// returns 0. 00069 virtual double area (const PseudoJet & ) const {return 0.0;} 00070 00071 /// return the error (uncertainty) associated with the determination 00072 /// of the area of this jet; this base class returns 0. 00073 virtual double area_error (const PseudoJet & ) const {return 0.0;} 00074 00075 /// return a PseudoJet whose 4-vector is defined by the following integral 00076 /// 00077 /// \int drap d\phi PseudoJet("rap,phi,pt=one") * 00078 /// * Theta("rap,phi inside jet boundary") 00079 /// 00080 /// where PseudoJet("rap,phi,pt=one") is a 4-vector with the given 00081 /// rapidity (rap), azimuth (phi) and pt=1, while Theta("rap,phi 00082 /// inside jet boundary") is a function that is 1 when rap,phi 00083 /// define a direction inside the jet boundary and 0 otherwise. 00084 /// 00085 /// This base class returns a null 4-vector. 00086 virtual PseudoJet area_4vector(const PseudoJet & ) const { 00087 return PseudoJet(0.0,0.0,0.0,0.0);} 00088 00089 /// true if a jet is made exclusively of ghosts 00090 /// 00091 /// NB: most area classes do not give any explicit ghost jets, but 00092 /// some do, and they should replace this function with their own 00093 /// version. 00094 virtual bool is_pure_ghost(const PseudoJet & ) const { 00095 return false; 00096 } 00097 00098 /// returns true if ghosts are explicitly included within 00099 /// jets for this ClusterSequence; 00100 /// 00101 /// Derived classes that do include explicit ghosts should provide 00102 /// an alternative version of this routine and set it properly. 00103 virtual bool has_explicit_ghosts() const { 00104 return false; 00105 } 00106 00107 /// return the total area, corresponding to the given Selector, that 00108 /// is free of jets, in general based on the inclusive jets. 00109 /// 00110 /// The selector passed as an argument has to have a finite area and 00111 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00112 /// tools for more generic usages) 00113 virtual double empty_area(const Selector & selector) const; 00114 00115 /// return the total area, corresponding to the given Selector, that 00116 /// is free of jets, based on the supplied all_jets 00117 /// 00118 /// The selector passed as an argument has to have a finite area and 00119 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00120 /// tools for more generic usages) 00121 double empty_area_from_jets(const std::vector<PseudoJet> & all_jets, 00122 const Selector & selector) const; 00123 00124 /// return something similar to the number of pure ghost jets 00125 /// in the given selector's range in an active area case. 00126 /// For the local implementation we return empty_area/(0.55 pi R^2), 00127 /// based on measured properties of ghost jets with kt and cam 00128 /// (cf arXiv:0802.1188). 00129 /// 00130 /// Note that the number returned is a double. 00131 /// 00132 /// The selector passed as an argument has to have a finite area and 00133 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00134 /// tools for more generic usages) 00135 virtual double n_empty_jets(const Selector & selector) const { 00136 double R = jet_def().R(); 00137 return empty_area(selector)/(0.55*pi*R*R); 00138 } 00139 00140 /// the median of (pt/area) for jets contained within the selector 00141 /// range, making use also of the info on n_empty_jets 00142 /// 00143 /// The selector passed as an argument has to have a finite area and 00144 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00145 /// tools for more generic usages) 00146 double median_pt_per_unit_area(const Selector & selector) const; 00147 00148 /// the median of (pt/area_4vector) for jets contained within the 00149 /// selector range, making use also of the info on n_empty_jets 00150 /// 00151 /// The selector passed as an argument has to have a finite area and 00152 /// apply jet-by-jet 00153 double median_pt_per_unit_area_4vector(const Selector & selector) const; 00154 00155 /// the function that does the work for median_pt_per_unit_area and 00156 /// median_pt_per_unit_area_4vector: 00157 /// - something_is_area_4vect = false -> use plain area 00158 /// - something_is_area_4vect = true -> use 4-vector area 00159 double median_pt_per_unit_something( 00160 const Selector & selector, bool use_area_4vector) const; 00161 00162 /// using jets withing the selector range (and with 4-vector areas if 00163 /// use_area_4vector), calculate the median pt/area, as well as an 00164 /// "error" (uncertainty), which is defined as the 1-sigma 00165 /// half-width of the distribution of pt/A, obtained by looking for 00166 /// the point below which we have (1-0.6827)/2 of the jets 00167 /// (including empty jets). 00168 /// 00169 /// The subtraction for a jet with uncorrected pt pt^U and area A is 00170 /// 00171 /// pt^S = pt^U - median*A +- sigma*sqrt(A) 00172 /// 00173 /// where the error is only that associated with the fluctuations 00174 /// in the noise and not that associated with the noise having 00175 /// caused changes in the hard-particle content of the jet. 00176 /// 00177 /// The selector passed as an argument has to have a finite area and 00178 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00179 /// tools for more generic usages) 00180 /// 00181 /// NB: subtraction may also be done with 4-vector area of course, 00182 /// and this is recommended for jets with larger values of R, as 00183 /// long as rho has also been determined with a 4-vector area; 00184 /// using a scalar area causes one to neglect terms of relative 00185 /// order $R^2/8$ in the jet $p_t$. 00186 virtual void get_median_rho_and_sigma(const Selector & selector, 00187 bool use_area_4vector, 00188 double & median, double & sigma, 00189 double & mean_area) const; 00190 00191 /// a more advanced version of get_median_rho_and_sigma, which allows 00192 /// one to use any "view" of the event containing all jets (so that, 00193 /// e.g. one might use Cam on a different resolution scale without 00194 /// have to rerun the algorithm). 00195 /// 00196 /// By default it will assume that "all" are not inclusive jets, 00197 /// so that in dealing with empty area it has to calculate 00198 /// the number of empty jets based on the empty area and the 00199 /// the observed <area> of jets rather than a surmised area 00200 /// 00201 /// Note that for small effective radii, this can cause problems 00202 /// because the harder jets get an area >> <ghost-jet-area> 00203 /// and so the estimate comes out all wrong. In these situations 00204 /// it is highly advisable to use an area with explicit ghosts, since 00205 /// then the "empty" jets are actually visible. 00206 /// 00207 /// The selector passed as an argument has to have a finite area and 00208 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00209 /// tools for more generic usages) 00210 virtual void get_median_rho_and_sigma(const std::vector<PseudoJet> & all_jets, 00211 const Selector & selector, 00212 bool use_area_4vector, 00213 double & median, double & sigma, 00214 double & mean_area, 00215 bool all_are_inclusive = false) const; 00216 00217 /// same as the full version of get_median_rho_and_error, but without 00218 /// access to the mean_area 00219 /// 00220 /// The selector passed as an argument has to have a finite area and 00221 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00222 /// tools for more generic usages) 00223 virtual void get_median_rho_and_sigma(const Selector & selector, 00224 bool use_area_4vector, 00225 double & median, double & sigma) const { 00226 double mean_area; 00227 get_median_rho_and_sigma(selector, use_area_4vector, 00228 median, sigma, mean_area); 00229 } 00230 00231 00232 /// fits a form pt_per_unit_area(y) = a + b*y^2 in the selector range. 00233 /// exclude_above allows one to exclude large values of pt/area from fit. 00234 /// (if negative, the cut is discarded) 00235 /// use_area_4vector = true uses the 4vector areas. 00236 /// 00237 /// The selector passed as an argument has to have a finite area and 00238 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00239 /// tools for more generic usages) 00240 virtual void parabolic_pt_per_unit_area(double & a, double & b, 00241 const Selector & selector, 00242 double exclude_above=-1.0, 00243 bool use_area_4vector=false) const; 00244 00245 /// return a vector of all subtracted jets, using area_4vector, given rho. 00246 /// Only inclusive_jets above ptmin are subtracted and returned. 00247 /// the ordering is the same as that of sorted_by_pt(cs.inclusive_jets()), 00248 /// i.e. not necessarily ordered in pt once subtracted 00249 std::vector<PseudoJet> subtracted_jets(const double rho, 00250 const double ptmin=0.0) const; 00251 00252 /// return a vector of subtracted jets, using area_4vector. 00253 /// Only inclusive_jets above ptmin are subtracted and returned. 00254 /// the ordering is the same as that of sorted_by_pt(cs.inclusive_jets()), 00255 /// i.e. not necessarily ordered in pt once subtracted 00256 /// 00257 /// The selector passed as an argument has to have a finite area and 00258 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00259 /// tools for more generic usages) 00260 std::vector<PseudoJet> subtracted_jets(const Selector & selector, 00261 const double ptmin=0.0) const; 00262 00263 /// return a subtracted jet, using area_4vector, given rho 00264 PseudoJet subtracted_jet(const PseudoJet & jet, 00265 const double rho) const; 00266 00267 /// return a subtracted jet, using area_4vector; note 00268 /// that this is potentially inefficient if repeatedly used for many 00269 /// different jets, because rho will be recalculated each time 00270 /// around. 00271 /// 00272 /// The selector passed as an argument has to have a finite area and 00273 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00274 /// tools for more generic usages) 00275 PseudoJet subtracted_jet(const PseudoJet & jet, 00276 const Selector & selector) const; 00277 00278 /// return the subtracted pt, given rho 00279 double subtracted_pt(const PseudoJet & jet, 00280 const double rho, 00281 bool use_area_4vector=false) const; 00282 00283 /// return the subtracted pt; note that this is 00284 /// potentially inefficient if repeatedly used for many different 00285 /// jets, because rho will be recalculated each time around. 00286 /// 00287 /// The selector passed as an argument has to have a finite area and 00288 /// apply jet-by-jet (see the BackgroundEstimator and Subtractor 00289 /// tools for more generic usages) 00290 double subtracted_pt(const PseudoJet & jet, 00291 const Selector & selector, 00292 bool use_area_4vector=false) const; 00293 00294 protected: 00295 /// check the selector is suited for the computations i.e. applies jet by jet and has a finite area 00296 void _check_selector_good_for_median(const Selector &selector) const; 00297 00298 00299 private: 00300 /// handle warning messages 00301 static LimitedWarning _warnings; 00302 static LimitedWarning _warnings_zero_area; 00303 static LimitedWarning _warnings_empty_area; 00304 00305 /// check the jet algorithm is suitable (and if not issue a warning) 00306 void _check_jet_alg_good_for_median() const; 00307 00308 }; 00309 00310 00311 00312 FASTJET_END_NAMESPACE 00313 00314 #endif // __FASTJET_CLUSTERSEQUENCEAREABASE_HH__