FastJet 3.0.0
ClusterSequencePassiveArea.cc
00001 //STARTHEADER
00002 // $Id: ClusterSequencePassiveArea.cc 2577 2011-09-13 15:11:38Z salam $
00003 //
00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. 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, see <http://www.gnu.org/licenses/>.
00026 //----------------------------------------------------------------------
00027 //ENDHEADER
00028 
00029 #include "fastjet/ClusterSequencePassiveArea.hh"
00030 #include "fastjet/ClusterSequenceVoronoiArea.hh"
00031 
00032 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00033 
00034 
00035 using namespace std;
00036 
00037 //----------------------------------------------------------------------
00038 /// global routine for initialising and running a passive area that is
00039 /// correct in general, but that chooses an optimal approach for
00040 /// various special cases.
00041 void ClusterSequencePassiveArea::_initialise_and_run_PA (
00042                 const JetDefinition & jet_def,
00043                 const GhostedAreaSpec & area_spec,
00044                 const bool & writeout_combinations) {
00045 
00046   if (jet_def.jet_algorithm() == kt_algorithm) {
00047     // first run the passive area
00048     ClusterSequenceVoronoiArea csva(_jets,jet_def,VoronoiAreaSpec(1.0));
00049     // now set up and transfer relevant information    
00050     // first the clustering sequence
00051     transfer_from_sequence(csva);
00052     // then the areas
00053     _resize_and_zero_AA();
00054     for (unsigned i = 0; i < _history.size(); i++) {
00055       int ijetp = _history[i].jetp_index;
00056       if (ijetp != Invalid) {
00057         _average_area[i] = csva.area(_jets[ijetp]);
00058         _average_area_4vector[i] = csva.area_4vector(_jets[ijetp]);
00059       }
00060     }
00061 
00062   } else if (jet_def.jet_algorithm() == cambridge_algorithm) {
00063     // run a variant of the cambridge algorithm that has been hacked
00064     // to deal with passive areas
00065     JetDefinition tmp_jet_def = jet_def;
00066     tmp_jet_def.set_jet_finder(cambridge_for_passive_algorithm);
00067     tmp_jet_def.set_extra_param(sqrt(area_spec.mean_ghost_kt()));
00068     _initialise_and_run_AA(tmp_jet_def, area_spec, writeout_combinations);
00069     _jet_def = jet_def;
00070 
00071   } else if (jet_def.jet_algorithm() == antikt_algorithm) {
00072     // for the antikt algorithm, passive and active are identical
00073     _initialise_and_run_AA(jet_def, area_spec, writeout_combinations);
00074 
00075   } else if (jet_def.jet_algorithm() == plugin_algorithm &&
00076              jet_def.plugin()->supports_ghosted_passive_areas()) {
00077     // for some plugin algorithms, one can "prime" the algorithm with information
00078     // about the ghost scale, and then an "AA" run will actually give a passive
00079     // area
00080     double ghost_sep_scale_store = jet_def.plugin()->ghost_separation_scale();
00081     jet_def.plugin()->set_ghost_separation_scale(sqrt(area_spec.mean_ghost_kt()));
00082     _initialise_and_run_AA(jet_def, area_spec, writeout_combinations);
00083 
00084     // restore the original ghost_sep_scale
00085     jet_def.plugin()->set_ghost_separation_scale(ghost_sep_scale_store);
00086 
00087   } else {
00088     // for a generic algorithm, just run the 1GhostPassiveArea
00089     _initialise_and_run_1GPA(jet_def, area_spec, writeout_combinations);
00090   }
00091 }
00092 
00093 //----------------------------------------------------------------------
00094 // dispatch to most relevant empty area calculation...
00095 double ClusterSequencePassiveArea::empty_area (const Selector & selector) const {
00096   if (jet_def().jet_algorithm() == kt_algorithm) {
00097     // run the naive algorithm
00098     return ClusterSequenceAreaBase::empty_area(selector);
00099   } else {
00100     return ClusterSequence1GhostPassiveArea::empty_area(selector);
00101   }
00102 }
00103 
00104 
00105 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
00106 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends