Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ClusterSequenceActiveAreaExplicitGhosts.hh

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: ClusterSequenceActiveAreaExplicitGhosts.hh 430 2007-01-19 17:00:57Z 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 #ifndef __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_
00032 #define __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_ 
00033 
00034 #include "fastjet/PseudoJet.hh"
00035 #include "fastjet/ClusterSequenceWithArea.hh"
00036 #include "fastjet/ActiveAreaSpec.hh"
00037 #include<iostream>
00038 #include<vector>
00039 
00040 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00041 
00042 //======================================================================
00047 class ClusterSequenceActiveAreaExplicitGhosts : 
00048   public ClusterSequenceWithArea {
00049 public:
00052   template<class L> ClusterSequenceActiveAreaExplicitGhosts
00053          (const std::vector<L> & pseudojets, 
00054           const JetDefinition & jet_def,
00055           const ActiveAreaSpec & area_spec,
00056           const bool & writeout_combinations = false) 
00057            : ClusterSequenceWithArea() {
00058            _initialise(pseudojets,jet_def,area_spec,writeout_combinations); }
00059 
00061   template<class L> void _initialise
00062          (const std::vector<L> & pseudojets, 
00063           const JetDefinition & jet_def,
00064           const ActiveAreaSpec & area_spec,
00065           const bool & writeout_combinations); 
00066 
00067   //vector<PseudoJet> constituents (const PseudoJet & jet) const;
00068 
00070   unsigned int n_hard_particles() const;
00071 
00073   virtual double area (const PseudoJet & jet) const;
00074 
00079   virtual PseudoJet area_4vector (const PseudoJet & jet) const;
00080 
00082   bool is_pure_ghost(const PseudoJet & jet) const;
00083 
00087   bool is_pure_ghost(int history_index) const;
00088 
00090   double total_area () const;
00091   
00092 private:
00093 
00094   int    _n_ghosts;
00095   double _ghost_area;
00096   std::vector<bool> _is_pure_ghost;
00097   std::vector<double> _areas;
00098   std::vector<PseudoJet> _area_4vectors;
00099   
00100   unsigned int _initial_hard_n;
00101 
00104   void _add_ghosts(const ActiveAreaSpec & area_spec); 
00105 
00109   void _post_process();
00110 
00111 };
00112 
00113 
00114 //----------------------------------------------------------------------
00115 // initialise from some generic type... Has to be made available
00116 // here in order for the template aspect of it to work...
00117 template<class L> void ClusterSequenceActiveAreaExplicitGhosts::_initialise
00118          (const std::vector<L> & pseudojets, 
00119           const JetDefinition & jet_def,
00120           const ActiveAreaSpec & area_spec,
00121           const bool & writeout_combinations) {
00122   // don't reserve space yet -- will be done below
00123 
00124   // insert initial jets this way so that any type L that can be
00125   // converted to a pseudojet will work fine (basically PseudoJet
00126   // and any type that has [] subscript access to the momentum
00127   // components, such as CLHEP HepLorentzVector).
00128   for (unsigned int i = 0; i < pseudojets.size(); i++) {
00129     PseudoJet mom(pseudojets[i]);
00130     //mom.set_user_index(0); // for user's particles (user index now lost...)
00131     _jets.push_back(mom);
00132     _is_pure_ghost.push_back(false);
00133   }
00134 
00135   _initial_hard_n = _jets.size();
00136 
00137   _add_ghosts(area_spec);
00138 
00139   if (writeout_combinations) {
00140     std::cout << "# Printing particles including ghosts\n";
00141     for (unsigned j = 0; j < _jets.size(); j++) {
00142       printf("%5u %20.13f %20.13f %20.13e\n",
00143                j,_jets[j].rap(),_jets[j].phi_02pi(),_jets[j].kt2());
00144     }
00145     std::cout << "# Finished printing particles including ghosts\n";
00146   }
00147 
00148   // this will ensure that we can still point to jets without
00149   // difficulties arising!
00150   _jets.reserve(_jets.size()*2);
00151 
00152   // run the clustering
00153   _initialise_and_run(jet_def,writeout_combinations);
00154 
00155   // set up all other information
00156   _post_process();
00157 }
00158 
00159 
00160 inline unsigned int ClusterSequenceActiveAreaExplicitGhosts::n_hard_particles() const {return _initial_hard_n;}
00161 
00162 
00163 
00164 FASTJET_END_NAMESPACE
00165 
00166 #endif // __FASTJET_CLUSTERSEQUENCEACTIVEAREAEXPLICITGHOSTS_HH_

Generated on Mon Apr 2 20:57:48 2007 for fastjet by  doxygen 1.4.2