00001 //STARTHEADER 00002 // $Id: CompositeJetStructure.cc 1985 2011-03-09 22:26:40Z soyez $ 00003 // 00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin 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, 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/CompositeJetStructure.hh> 00032 00033 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00034 00035 using namespace std; 00036 00037 00038 //------------------------------------------------------------------------------- 00039 // \class CompositeJetStructure 00040 // The structure for a jet made of pieces 00041 // 00042 // This stores the vector of the pieces that make the jet and provide 00043 // the methods to access them 00044 // ------------------------------------------------------------------------------- 00045 00046 // description 00047 std::string CompositeJetStructure::description() const{ 00048 string str = "Composite PseudoJet"; 00049 return str; 00050 } 00051 00052 00053 00054 // things reimplemented from the base structure 00055 //------------------------------------------------------------------------------ 00056 bool CompositeJetStructure::has_constituents() const{ 00057 for (vector<PseudoJet>::const_iterator pit=_pieces.begin(); pit!=_pieces.end(); pit++) 00058 if (!pit->has_constituents()) return false; 00059 00060 return true; 00061 } 00062 00063 std::vector<PseudoJet> CompositeJetStructure::constituents(const PseudoJet &jet) const{ 00064 // the following code automatically throws an Error if any of the 00065 // pieces has no constituents 00066 vector<PseudoJet> all_constituents = _pieces[0].constituents(); 00067 for (unsigned i = 1; i < _pieces.size(); i++) { 00068 vector<PseudoJet> constits = _pieces[i].constituents(); 00069 copy(constits.begin(), constits.end(), back_inserter(all_constituents)); 00070 } 00071 00072 return all_constituents; 00073 } 00074 00075 std::vector<PseudoJet> CompositeJetStructure::pieces(const PseudoJet &jet) const{ 00076 return _pieces; 00077 } 00078 00079 00080 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh