fastjet 2.4.5
ClusterSequence1GhostPassiveArea.cc
Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: ClusterSequence1GhostPassiveArea.cc 632 2007-05-10 15:17:00Z salam $
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/ClusterSequence1GhostPassiveArea.hh"
00032 
00033 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00034 
00035 
00036 using namespace std;
00037 
00038 //----------------------------------------------------------------------
00040 void ClusterSequence1GhostPassiveArea::_initialise_and_run_1GPA (
00041                 const JetDefinition & jet_def,
00042                 const GhostedAreaSpec & area_spec,
00043                 const bool & writeout_combinations) {
00044 
00045   bool continue_running;
00046   _initialise_AA(jet_def,  area_spec, writeout_combinations, continue_running);
00047   if (continue_running) {
00048     _run_1GPA(area_spec);
00049     _postprocess_AA(area_spec);
00050   }
00051 }
00052 
00053 
00054 //----------------------------------------------------------------------
00056 void ClusterSequence1GhostPassiveArea::_run_1GPA (const GhostedAreaSpec & area_spec) {
00057     // record the input jets as they are currently
00058   vector<PseudoJet> input_jets(_jets);
00059 
00060   // code for testing the unique tree
00061   vector<int> unique_tree;
00062 
00063   // initialise our temporary average area^2
00064   valarray<double> lcl_average_area2(0.0, _average_area.size());
00065   valarray<double> last_average_area(0.0, _average_area.size());
00066 
00067   // run the clustering multiple times so as to get areas of all the jets
00068   for (int irepeat = 0; irepeat < area_spec.repeat(); irepeat++) {
00069 
00070     // first establish list of all ghosts
00071     vector<PseudoJet> all_ghosts;
00072     area_spec.add_ghosts(all_ghosts);
00073 
00074     // then run many subsets of ghosts (actually each subset contains just one ghost)
00075     for (unsigned ig = 0; ig < all_ghosts.size(); ig++) {
00076       vector<PseudoJet> some_ghosts;
00077       some_ghosts.push_back(all_ghosts[ig]);
00078       ClusterSequenceActiveAreaExplicitGhosts clust_seq(input_jets, jet_def(), 
00079                                                        some_ghosts, area_spec.actual_ghost_area());
00080 
00081       if (irepeat == 0 && ig == 0) {
00082         // take the non-ghost part of the history and put into our own
00083         // history.
00084         _transfer_ghost_free_history(clust_seq);
00085         // get the "unique" order that will be used for transferring all areas. 
00086         unique_tree = unique_history_order();
00087       }
00088       
00089       // transfer areas from clust_seq into our object
00090       _transfer_areas(unique_tree, clust_seq);
00091     }
00092     // keep track of fluctuations in area
00093     lcl_average_area2 += (_average_area - last_average_area)*
00094                          (_average_area - last_average_area);
00095     last_average_area = _average_area;
00096   }
00097   _average_area2 = lcl_average_area2;
00098 }
00099 
00100 
00101 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
00102 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines