ClusterSequenceArea.hh

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: ClusterSequenceArea.hh 957 2007-11-22 18:58:45Z 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 
00128   virtual void parabolic_pt_per_unit_area(double & a, double & b, 
00129                                           const RangeDefinition & range, 
00130                                           double exclude_above=-1.0, 
00131                                           bool use_area_4vector=false) const {
00132     _warn_if_range_unsuitable(range);
00133     ClusterSequenceAreaBase::parabolic_pt_per_unit_area(
00134                                 a,b,range, exclude_above, use_area_4vector);
00135   }
00136 
00137 
00138 private:
00139   
00143   void _warn_if_range_unsuitable(const RangeDefinition & range) const;
00144 
00145   template<class L> void initialize_and_run_cswa (
00146                                  const std::vector<L> & pseudojets, 
00147                                  const JetDefinition & jet_def);
00148 
00149   std::auto_ptr<ClusterSequenceAreaBase> _area_base;
00150   AreaDefinition _area_def;
00151   static LimitedWarning _range_warnings;
00152 
00153 };
00154 
00155 //----------------------------------------------------------------------
00156 template<class L> void ClusterSequenceArea::initialize_and_run_cswa(
00157            const std::vector<L> & pseudojets, 
00158            const JetDefinition  & jet_def)
00159  {
00160   
00161   ClusterSequenceAreaBase * _area_base_ptr;
00162   switch(_area_def.area_type()) {
00163   case active_area:
00164     _area_base_ptr = new ClusterSequenceActiveArea(pseudojets, 
00165                                                    jet_def, 
00166                                                    _area_def.ghost_spec());
00167     break;
00168   case active_area_explicit_ghosts:
00169     _area_base_ptr = new ClusterSequenceActiveAreaExplicitGhosts(pseudojets, 
00170                                                    jet_def, 
00171                                                    _area_def.ghost_spec());
00172     break;
00173   case voronoi_area:
00174     _area_base_ptr = new ClusterSequenceVoronoiArea(pseudojets, 
00175                                                    jet_def, 
00176                                                    _area_def.voronoi_spec());
00177     break;
00178   case one_ghost_passive_area:
00179     _area_base_ptr = new ClusterSequence1GhostPassiveArea(pseudojets, 
00180                                                     jet_def, 
00181                                                     _area_def.ghost_spec());
00182     break;
00183   case passive_area:
00184     _area_base_ptr = new ClusterSequencePassiveArea(pseudojets, 
00185                                                     jet_def, 
00186                                                     _area_def.ghost_spec());
00187     break;
00188   default:
00189     std::cerr << "Error: unrecognized area_type in ClusterSequenceArea:" 
00190               << _area_def.area_type() << std::endl;
00191     exit(-1);
00192   }
00193   // now copy across the information from the area base class
00194   _area_base = std::auto_ptr<ClusterSequenceAreaBase>(_area_base_ptr);
00195   transfer_from_sequence(*_area_base);
00196 }
00197 
00198 FASTJET_END_NAMESPACE
00199 
00200 #endif // __FASTJET_CLUSTERSEQUENCEAREA_HH__
00201 
00202 

Generated on Tue Dec 18 17:05:02 2007 for fastjet by  doxygen 1.5.2