fastjet 2.4.5
ClusterSequencePassiveArea.cc
Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: ClusterSequencePassiveArea.cc 958 2007-11-28 17:43:48Z cacciari $
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 #include "fastjet/ClusterSequencePassiveArea.hh"
00032 #include "fastjet/ClusterSequenceVoronoiArea.hh"
00033 
00034 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00035 
00036 
00037 using namespace std;
00038 
00039 //----------------------------------------------------------------------
00043 void ClusterSequencePassiveArea::_initialise_and_run_PA (
00044                 const JetDefinition & jet_def,
00045                 const GhostedAreaSpec & area_spec,
00046                 const bool & writeout_combinations) {
00047 
00048   if (jet_def.jet_algorithm() == kt_algorithm) {
00049     // first run the passive area
00050     ClusterSequenceVoronoiArea csva(_jets,jet_def,VoronoiAreaSpec(1.0));
00051     // now set up and transfer relevant information    
00052     // first the clustering sequence
00053     transfer_from_sequence(csva);
00054     // then the areas
00055     _resize_and_zero_AA();
00056     for (unsigned i = 0; i < _history.size(); i++) {
00057       int ijetp = _history[i].jetp_index;
00058       if (ijetp != Invalid) {
00059         _average_area[i] = csva.area(_jets[ijetp]);
00060         _average_area_4vector[i] = csva.area_4vector(_jets[ijetp]);
00061       }
00062     }
00063 
00064   } else if (jet_def.jet_algorithm() == cambridge_algorithm) {
00065     // run a variant of the cambridge algorithm that has been hacked
00066     // to deal with passive areas
00067     JetDefinition tmp_jet_def = jet_def;
00068     tmp_jet_def.set_jet_finder(cambridge_for_passive_algorithm);
00069     tmp_jet_def.set_extra_param(sqrt(area_spec.mean_ghost_kt()));
00070     _initialise_and_run_AA(tmp_jet_def, area_spec, writeout_combinations);
00071     _jet_def = jet_def;
00072 
00073   } else if (jet_def.jet_algorithm() == antikt_algorithm) {
00074     // for the antikt algorithm, passive and active are identical
00075     _initialise_and_run_AA(jet_def, area_spec, writeout_combinations);
00076 
00077   } else if (jet_def.jet_algorithm() == plugin_algorithm &&
00078              jet_def.plugin()->supports_ghosted_passive_areas()) {
00079     // for some plugin algorithms, one can "prime" the algorithm with information
00080     // about the ghost scale, and then an "AA" run will actually give a passive
00081     // area
00082     double ghost_sep_scale_store = jet_def.plugin()->ghost_separation_scale();
00083     jet_def.plugin()->set_ghost_separation_scale(sqrt(area_spec.mean_ghost_kt()));
00084     _initialise_and_run_AA(jet_def, area_spec, writeout_combinations);
00085 
00086     // restore the original ghost_sep_scale
00087     jet_def.plugin()->set_ghost_separation_scale(ghost_sep_scale_store);
00088 
00089   } else {
00090     // for a generic algorithm, just run the 1GhostPassiveArea
00091     _initialise_and_run_1GPA(jet_def, area_spec, writeout_combinations);
00092   }
00093 }
00094 
00095 //----------------------------------------------------------------------
00096 // dispatch to most relevant empty area calculation...
00097 double ClusterSequencePassiveArea::empty_area (const RangeDefinition & range) const {
00098   if (jet_def().jet_algorithm() == kt_algorithm) {
00099     // run the naive algorithm
00100     return ClusterSequenceAreaBase::empty_area(range);
00101   } else {
00102     return ClusterSequence1GhostPassiveArea::empty_area(range);
00103   }
00104 }
00105 
00106 
00107 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
00108 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines