ClusterSequenceArea.hh

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: ClusterSequenceArea.hh 967 2007-12-04 21:58:23Z 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 
00043 class ClusterSequenceArea : public ClusterSequenceAreaBase {
00044 public:
00045   template<class L> ClusterSequenceArea
00046          (const std::vector<L> & pseudojets, 
00047           const JetDefinition & jet_def,
00048           const AreaDefinition & area_def_in)  : _area_def(area_def_in) {
00049     initialize_and_run_cswa(pseudojets, jet_def);
00050   }
00051 
00052   template<class L> ClusterSequenceArea
00053          (const std::vector<L> & pseudojets, 
00054           const JetDefinition & jet_def,
00055           const GhostedAreaSpec & area_spec)   : _area_def(area_spec){
00056     initialize_and_run_cswa(pseudojets, jet_def);
00057   }
00058 
00059   template<class L> ClusterSequenceArea
00060          (const std::vector<L> & pseudojets, 
00061           const JetDefinition & jet_def,
00062           const VoronoiAreaSpec & area_spec)   : _area_def(area_spec){
00063     initialize_and_run_cswa(pseudojets, jet_def);
00064   }
00065 
00067   const AreaDefinition & area_def() const {return _area_def;}
00068 
00069 
00071   virtual double area       (const PseudoJet & jet) const {
00072     return _area_base->area(jet);}
00073 
00076   virtual double area_error (const PseudoJet & jet) const {
00077     return _area_base->area_error(jet);}
00078 
00080   virtual PseudoJet area_4vector(const PseudoJet & jet) const {
00081     return _area_base->area_4vector(jet);}
00082 
00083   // /// return the total area, up to |y|<maxrap, that is free of jets
00084   // virtual double empty_area(double maxrap) const {
00085   //   return _area_base->empty_area(maxrap);}
00086   // 
00087   // /// return something similar to the number of pure ghost jets
00088   // /// in the given rapidity range in an active area case.
00089   // /// For the local implementation we return empty_area/(0.55 pi R^2),
00090   // /// based on measured properties of ghost jets with kt and cam. Note
00091   // /// that the number returned is a double.
00092   // virtual double n_empty_jets(double maxrap) const {
00093   //   return _area_base->n_empty_jets(maxrap);
00094 
00096   virtual double empty_area(const RangeDefinition & range) const {
00097     return _area_base->empty_area(range);}
00098 
00104   virtual double n_empty_jets(const RangeDefinition & range) const {
00105     return _area_base->n_empty_jets(range);
00106   }
00107 
00109   virtual bool is_pure_ghost(const PseudoJet & jet) const {
00110     return _area_base->is_pure_ghost(jet);
00111   }
00112 
00116   virtual void get_median_rho_and_sigma(const RangeDefinition & range, 
00117                                         bool use_area_4vector,
00118                                         double & median, double & sigma,
00119                                         double & mean_area) const {
00120     _warn_if_range_unsuitable(range);
00121     ClusterSequenceAreaBase::get_median_rho_and_sigma(range, use_area_4vector,
00122                                                       median, sigma, mean_area);
00123   }
00124 
00129   virtual void get_median_rho_and_sigma(const RangeDefinition & range, 
00130                                         bool use_area_4vector,
00131                                         double & median, double & sigma) const {
00132     ClusterSequenceAreaBase::get_median_rho_and_sigma(range,use_area_4vector,
00133                                                       median,sigma);
00134   }
00135 
00136 
00140   virtual void parabolic_pt_per_unit_area(double & a, double & b, 
00141                                           const RangeDefinition & range, 
00142                                           double exclude_above=-1.0, 
00143                                           bool use_area_4vector=false) const {
00144     _warn_if_range_unsuitable(range);
00145     ClusterSequenceAreaBase::parabolic_pt_per_unit_area(
00146                                 a,b,range, exclude_above, use_area_4vector);
00147   }
00148 
00149 
00150 private:
00151   
00155   void _warn_if_range_unsuitable(const RangeDefinition & range) const;
00156 
00157   template<class L> void initialize_and_run_cswa (
00158                                  const std::vector<L> & pseudojets, 
00159                                  const JetDefinition & jet_def);
00160 
00161   std::auto_ptr<ClusterSequenceAreaBase> _area_base;
00162   AreaDefinition _area_def;
00163   static LimitedWarning _range_warnings;
00164 
00165 };
00166 
00167 //----------------------------------------------------------------------
00168 template<class L> void ClusterSequenceArea::initialize_and_run_cswa(
00169            const std::vector<L> & pseudojets, 
00170            const JetDefinition  & jet_def)
00171  {
00172   
00173   ClusterSequenceAreaBase * _area_base_ptr;
00174   switch(_area_def.area_type()) {
00175   case active_area:
00176     _area_base_ptr = new ClusterSequenceActiveArea(pseudojets, 
00177                                                    jet_def, 
00178                                                    _area_def.ghost_spec());
00179     break;
00180   case active_area_explicit_ghosts:
00181     _area_base_ptr = new ClusterSequenceActiveAreaExplicitGhosts(pseudojets, 
00182                                                    jet_def, 
00183                                                    _area_def.ghost_spec());
00184     break;
00185   case voronoi_area:
00186     _area_base_ptr = new ClusterSequenceVoronoiArea(pseudojets, 
00187                                                    jet_def, 
00188                                                    _area_def.voronoi_spec());
00189     break;
00190   case one_ghost_passive_area:
00191     _area_base_ptr = new ClusterSequence1GhostPassiveArea(pseudojets, 
00192                                                     jet_def, 
00193                                                     _area_def.ghost_spec());
00194     break;
00195   case passive_area:
00196     _area_base_ptr = new ClusterSequencePassiveArea(pseudojets, 
00197                                                     jet_def, 
00198                                                     _area_def.ghost_spec());
00199     break;
00200   default:
00201     std::cerr << "Error: unrecognized area_type in ClusterSequenceArea:" 
00202               << _area_def.area_type() << std::endl;
00203     exit(-1);
00204   }
00205   // now copy across the information from the area base class
00206   _area_base = std::auto_ptr<ClusterSequenceAreaBase>(_area_base_ptr);
00207   transfer_from_sequence(*_area_base);
00208 }
00209 
00210 FASTJET_END_NAMESPACE
00211 
00212 #endif // __FASTJET_CLUSTERSEQUENCEAREA_HH__
00213 
00214 

Generated on Thu Jan 3 19:04:29 2008 for fastjet by  doxygen 1.5.2