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