fastjet 2.4.5
|
00001 //STARTHEADER 00002 // $Id: ClusterSequenceArea.hh 1658 2010-01-19 11:13:34Z salam $ 00003 // 00004 // Copyright (c) 2006-2007, Matteo Cacciari, Gavin Salam and Gregory Soyez 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_CLUSTERSEQUENCEAREA_HH__ 00032 #define __FASTJET_CLUSTERSEQUENCEAREA_HH__ 00033 00034 #include "fastjet/ClusterSequenceAreaBase.hh" 00035 #include "fastjet/ClusterSequenceActiveArea.hh" 00036 #include "fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh" 00037 #include "fastjet/ClusterSequencePassiveArea.hh" 00038 #include "fastjet/ClusterSequenceVoronoiArea.hh" 00039 #include "fastjet/AreaDefinition.hh" 00040 00041 FASTJET_BEGIN_NAMESPACE 00042 00049 class ClusterSequenceArea : public ClusterSequenceAreaBase { 00050 public: 00052 template<class L> ClusterSequenceArea 00053 (const std::vector<L> & pseudojets, 00054 const JetDefinition & jet_def, 00055 const AreaDefinition & area_def_in) : _area_def(area_def_in) { 00056 initialize_and_run_cswa(pseudojets, jet_def); 00057 } 00058 00060 template<class L> ClusterSequenceArea 00061 (const std::vector<L> & pseudojets, 00062 const JetDefinition & jet_def, 00063 const GhostedAreaSpec & ghost_spec) : _area_def(ghost_spec){ 00064 initialize_and_run_cswa(pseudojets, jet_def); 00065 } 00066 00068 template<class L> ClusterSequenceArea 00069 (const std::vector<L> & pseudojets, 00070 const JetDefinition & jet_def, 00071 const VoronoiAreaSpec & voronoi_spec) : _area_def(voronoi_spec){ 00072 initialize_and_run_cswa(pseudojets, jet_def); 00073 } 00074 00076 const AreaDefinition & area_def() const {return _area_def;} 00077 00078 00080 virtual double area (const PseudoJet & jet) const { 00081 return _area_base->area(jet);} 00082 00085 virtual double area_error (const PseudoJet & jet) const { 00086 return _area_base->area_error(jet);} 00087 00089 virtual PseudoJet area_4vector(const PseudoJet & jet) const { 00090 return _area_base->area_4vector(jet);} 00091 00092 // /// return the total area, up to |y|<maxrap, that is free of jets 00093 // virtual double empty_area(double maxrap) const { 00094 // return _area_base->empty_area(maxrap);} 00095 // 00096 // /// return something similar to the number of pure ghost jets 00097 // /// in the given rapidity range in an active area case. 00098 // /// For the local implementation we return empty_area/(0.55 pi R^2), 00099 // /// based on measured properties of ghost jets with kt and cam. Note 00100 // /// that the number returned is a double. 00101 // virtual double n_empty_jets(double maxrap) const { 00102 // return _area_base->n_empty_jets(maxrap); 00103 00105 virtual double empty_area(const RangeDefinition & range) const { 00106 return _area_base->empty_area(range);} 00107 00113 virtual double n_empty_jets(const RangeDefinition & range) const { 00114 return _area_base->n_empty_jets(range); 00115 } 00116 00118 virtual bool is_pure_ghost(const PseudoJet & jet) const { 00119 return _area_base->is_pure_ghost(jet); 00120 } 00121 00123 virtual bool has_explicit_ghosts() const { 00124 return _area_base->has_explicit_ghosts(); 00125 } 00126 00127 00131 virtual void get_median_rho_and_sigma(const std::vector<PseudoJet> & all_jets, 00132 const RangeDefinition & range, 00133 bool use_area_4vector, 00134 double & median, double & sigma, 00135 double & mean_area, 00136 bool all_are_incl = false) const { 00137 _warn_if_range_unsuitable(range); 00138 ClusterSequenceAreaBase::get_median_rho_and_sigma( 00139 all_jets, range, use_area_4vector, 00140 median, sigma, mean_area, all_are_incl); 00141 } 00142 00147 virtual void get_median_rho_and_sigma(const RangeDefinition & range, 00148 bool use_area_4vector, 00149 double & median, double & sigma) const { 00150 ClusterSequenceAreaBase::get_median_rho_and_sigma(range,use_area_4vector, 00151 median,sigma); 00152 } 00153 00158 virtual void get_median_rho_and_sigma(const RangeDefinition & range, 00159 bool use_area_4vector, 00160 double & median, double & sigma, 00161 double & mean_area) const { 00162 ClusterSequenceAreaBase::get_median_rho_and_sigma(range,use_area_4vector, 00163 median,sigma, mean_area); 00164 } 00165 00166 00170 virtual void parabolic_pt_per_unit_area(double & a, double & b, 00171 const RangeDefinition & range, 00172 double exclude_above=-1.0, 00173 bool use_area_4vector=false) const { 00174 _warn_if_range_unsuitable(range); 00175 ClusterSequenceAreaBase::parabolic_pt_per_unit_area( 00176 a,b,range, exclude_above, use_area_4vector); 00177 } 00178 00179 00180 private: 00181 00185 void _warn_if_range_unsuitable(const RangeDefinition & range) const; 00186 00187 template<class L> void initialize_and_run_cswa ( 00188 const std::vector<L> & pseudojets, 00189 const JetDefinition & jet_def); 00190 00191 std::auto_ptr<ClusterSequenceAreaBase> _area_base; 00192 AreaDefinition _area_def; 00193 static LimitedWarning _range_warnings; 00194 static LimitedWarning _explicit_ghosts_repeats_warnings; 00195 00196 }; 00197 00198 //---------------------------------------------------------------------- 00199 template<class L> void ClusterSequenceArea::initialize_and_run_cswa( 00200 const std::vector<L> & pseudojets, 00201 const JetDefinition & jet_def) 00202 { 00203 00204 ClusterSequenceAreaBase * _area_base_ptr; 00205 switch(_area_def.area_type()) { 00206 case active_area: 00207 _area_base_ptr = new ClusterSequenceActiveArea(pseudojets, 00208 jet_def, 00209 _area_def.ghost_spec()); 00210 break; 00211 case active_area_explicit_ghosts: 00212 if (_area_def.ghost_spec().repeat() != 1) 00213 _explicit_ghosts_repeats_warnings.warn("Requested active area with explicit ghosts with repeat != 1; only 1 set of ghosts will be used"); 00214 _area_base_ptr = new ClusterSequenceActiveAreaExplicitGhosts(pseudojets, 00215 jet_def, 00216 _area_def.ghost_spec()); 00217 break; 00218 case voronoi_area: 00219 _area_base_ptr = new ClusterSequenceVoronoiArea(pseudojets, 00220 jet_def, 00221 _area_def.voronoi_spec()); 00222 break; 00223 case one_ghost_passive_area: 00224 _area_base_ptr = new ClusterSequence1GhostPassiveArea(pseudojets, 00225 jet_def, 00226 _area_def.ghost_spec()); 00227 break; 00228 case passive_area: 00229 _area_base_ptr = new ClusterSequencePassiveArea(pseudojets, 00230 jet_def, 00231 _area_def.ghost_spec()); 00232 break; 00233 default: 00234 std::cerr << "Error: unrecognized area_type in ClusterSequenceArea:" 00235 << _area_def.area_type() << std::endl; 00236 exit(-1); 00237 } 00238 // now copy across the information from the area base class 00239 _area_base = std::auto_ptr<ClusterSequenceAreaBase>(_area_base_ptr); 00240 transfer_from_sequence(*_area_base); 00241 } 00242 00243 FASTJET_END_NAMESPACE 00244 00245 #endif // __FASTJET_CLUSTERSEQUENCEAREA_HH__ 00246 00247