00001 //STARTHEADER 00002 // $Id$ 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/tools/Transformer.hh" 00032 00033 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00034 00035 using namespace std; 00036 00037 //------------------------------------------------------------------------------- 00038 // class Transformer 00039 // Base (abstract) class for a jet transformer 00040 // 00041 // The idea of a transformer is to take a list of jets, apply some 00042 // transformation on them and return the list of modified jets This 00043 // base class sets the fundamental requirements for all the 00044 // transformers. 00045 // 00046 // Similarly, to gain access to the information relative to the 00047 // transformation, a "transformed" PseudoJet will have a 00048 // corresponding PseudoJetInterface. Any transformer thus have to 00049 // providwe (at least) 2 classes: 00050 // - the transformer itself (derived from Transformer) 00051 // - the associated property class (derived from TransformerInterface see below) 00052 //------------------------------------------------------------------------------- 00053 00054 // description of the transformer 00055 std::string Transformer::description() const{ 00056 return "dummy transformer"; 00057 } 00058 00059 // action of the transformer on a single jet 00060 PseudoJet Transformer::operator()(const PseudoJet & original) const{ 00061 // default behaviour? 00062 // options include 00063 // - simply copy the original 00064 // - keep the original with an empty PseudoJetInterfaceBase 00065 // - throw an error 00066 // we go for the 2nd one mostly to illustrate the process but also 00067 // because it would follow a more standard behaviour of a 00068 // Transformer leading to an object with a TransformerInterface 00069 00070 PseudoJet result = original; 00071 00072 // the following sets the "structure" 00073 PseudoJetStructureBase *struct_ptr = new PseudoJetStructureBase(); 00074 result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(struct_ptr)); 00075 00076 return result; 00077 } 00078 00079 // action of the transformer on each jet from the vector 00080 vector<PseudoJet> Transformer::operator()(const std::vector<PseudoJet> & originals) const{ 00081 vector<PseudoJet> result; 00082 for (vector<PseudoJet>::const_iterator it=originals.begin(); it!=originals.end(); it++) 00083 result.push_back((*this)(*it)); 00084 return result; 00085 } 00086 00087 00088 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh