FastJet 3.0beta1
PseudoJetStructureBase.hh
00001 //STARTHEADER
00002 // $Id: PseudoJetStructureBase.hh 2326 2011-06-30 14:02:09Z salam $
00003 //
00004 // Copyright (c) 2005-2010, 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 
00032 #ifndef __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
00033 #define __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
00034 
00035 #include "fastjet/internal/base.hh"
00036 
00037 #include <vector>
00038 #include <string>
00039 
00040 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00041 
00042 class PseudoJet;
00043 class ClusterSequence;
00044 class ClusterSequenceAreaBase;
00045 
00046 /// @ingroup extra_info
00047 /// \class PseudoJetStructureBase
00048 ///
00049 /// Contains any information related to the clustering that should be
00050 /// directly accessible to PseudoJet.
00051 ///
00052 /// By default, this class implements basic access to the
00053 /// ClusterSequence related to a PseudoJet (like its constituents or
00054 /// its area). But it can be overloaded in order e.g. to give access
00055 /// to the jet substructure.
00056 ///
00057 class PseudoJetStructureBase{
00058 public:
00059   /// default ctor
00060   PseudoJetStructureBase(){};
00061 
00062   /// default (virtual) dtor
00063   virtual ~PseudoJetStructureBase(){};
00064 
00065   /// description
00066   virtual std::string description() const{ return "PseudoJet with an unknown structure"; }
00067 
00068   //-------------------------------------------------------------
00069   /// @name Direct access to the associated ClusterSequence object.
00070   ///
00071   /// Get access to the associated ClusterSequence (if any)
00072   //\{
00073   //-------------------------------------------------------------
00074   /// returns true if there is an associated ClusterSequence
00075   virtual bool has_associated_cluster_sequence() const { return false;}
00076 
00077   /// get a (const) pointer to the parent ClusterSequence (NULL if
00078   /// inexistent)
00079   virtual const ClusterSequence* associated_cluster_sequence() const;
00080   
00081   /// returns true if this PseudoJet has an associated and still
00082   /// valid ClusterSequence.
00083   virtual bool has_valid_cluster_sequence() const {return false;}
00084 
00085   /// if the jet has a valid associated cluster sequence then return a
00086   /// pointer to it; otherwise throw an error
00087   virtual const ClusterSequence * validated_cs() const;
00088 
00089   /// if the jet has valid area information then return a pointer to
00090   /// the associated ClusterSequenceAreaBase object; otherwise throw an error
00091   virtual const ClusterSequenceAreaBase * validated_csab() const;
00092 
00093   //\}
00094 
00095   //-------------------------------------------------------------
00096   /// @name Methods for access to information about jet structure
00097   ///
00098   /// These allow access to jet constituents, and other jet
00099   /// subtructure information. They only work if the jet is associated
00100   /// with a ClusterSequence.
00101   //-------------------------------------------------------------
00102   //\{
00103 
00104   /// check if it has been recombined with another PseudoJet in which
00105   /// case, return its partner through the argument. Otherwise,
00106   /// 'partner' is set to 0.
00107   ///
00108   /// By default, throws an Error
00109   virtual bool has_partner(const PseudoJet &reference, PseudoJet &partner) const;
00110 
00111   /// check if it has been recombined with another PseudoJet in which
00112   /// case, return its child through the argument. Otherwise, 'child'
00113   /// is set to 0.
00114   /// 
00115   /// By default, throws an Error
00116   virtual bool has_child(const PseudoJet &reference, PseudoJet &child) const;
00117 
00118   /// check if it is the product of a recombination, in which case
00119   /// return the 2 parents through the 'parent1' and 'parent2'
00120   /// arguments. Otherwise, set these to 0.
00121   ///
00122   /// By default, throws an Error
00123   virtual bool has_parents(const PseudoJet &reference, PseudoJet &parent1, PseudoJet &parent2) const;
00124 
00125   /// check if the reference PseudoJet is contained the second one
00126   /// passed as argument.
00127   ///
00128   /// By default, throws an Error
00129   virtual bool object_in_jet(const PseudoJet &reference, const PseudoJet &jet) const;
00130 
00131 
00132   /// return true if the structure supports constituents. 
00133   ///
00134   /// false by default
00135   virtual bool has_constituents() const {return false;}
00136 
00137   /// retrieve the constituents. 
00138   ///
00139   /// By default, throws an Error
00140   virtual std::vector<PseudoJet> constituents(const PseudoJet &reference) const;
00141 
00142 
00143   /// return true if the structure supports exclusive_subjets. 
00144   virtual bool has_exclusive_subjets() const {return false;}
00145 
00146   /// return a vector of all subjets of the current jet (in the sense
00147   /// of the exclusive algorithm) that would be obtained when running
00148   /// the algorithm with the given dcut. 
00149   ///
00150   /// Time taken is O(m ln m), where m is the number of subjets that
00151   /// are found. If m gets to be of order of the total number of
00152   /// constituents in the jet, this could be substantially slower than
00153   /// just getting that list of constituents.
00154   ///
00155   /// By default, throws an Error
00156   virtual std::vector<PseudoJet> exclusive_subjets(const PseudoJet &reference, const double & dcut) const;
00157 
00158   /// return the size of exclusive_subjets(...); still n ln n with same
00159   /// coefficient, but marginally more efficient than manually taking
00160   /// exclusive_subjets.size()
00161   ///
00162   /// By default, throws an Error
00163   virtual int n_exclusive_subjets(const PseudoJet &reference, const double & dcut) const;
00164 
00165   /// return the list of subjets obtained by unclustering the supplied
00166   /// jet down to nsub subjets (or all constituents if there are fewer
00167   /// than nsub).
00168   ///
00169   /// By default, throws an Error
00170   virtual std::vector<PseudoJet> exclusive_subjets_up_to (const PseudoJet &reference, int nsub) const;
00171 
00172   /// return the dij that was present in the merging nsub+1 -> nsub 
00173   /// subjets inside this jet.
00174   ///
00175   /// By default, throws an Error
00176   virtual double exclusive_subdmerge(const PseudoJet &reference, int nsub) const;
00177 
00178   /// return the maximum dij that occurred in the whole event at the
00179   /// stage that the nsub+1 -> nsub merge of subjets occurred inside 
00180   /// this jet.
00181   ///
00182   /// By default, throws an Error
00183   virtual double exclusive_subdmerge_max(const PseudoJet &reference, int nsub) const;
00184 
00185 
00186   //-------------------------------------------------------------------
00187   // information related to the pieces of the jet
00188   //-------------------------------------------------------------------
00189   /// return true if the structure supports pieces. 
00190   ///
00191   /// false by default
00192   virtual bool has_pieces(const PseudoJet &reference) const {return false;}
00193 
00194   /// retrieve the pieces building the jet. 
00195   ///
00196   /// By default, throws an Error
00197   virtual std::vector<PseudoJet> pieces(const PseudoJet &reference) const;
00198 
00199 
00200   // the following ones require a computation of the area in the
00201   // parent ClusterSequence (See ClusterSequenceAreaBase for details)
00202   //------------------------------------------------------------------
00203 
00204   /// check if it has a defined area
00205   ///
00206   /// false by default
00207   virtual bool has_area() const {return false;}
00208 
00209   /// return the jet (scalar) area.
00210   ///
00211   /// By default, throws an Error
00212   virtual double area(const PseudoJet &reference) const;
00213 
00214   /// return the error (uncertainty) associated with the determination
00215   /// of the area of this jet.
00216   ///
00217   /// By default, throws an Error
00218   virtual double area_error(const PseudoJet &reference) const;
00219 
00220   /// return the jet 4-vector area.
00221   ///
00222   /// By default, throws an Error
00223   virtual PseudoJet area_4vector(const PseudoJet &reference) const;
00224 
00225   /// true if this jet is made exclusively of ghosts.
00226   ///
00227   /// By default, throws an Error
00228   virtual bool is_pure_ghost(const PseudoJet &reference) const;
00229 
00230   //\} --- end of jet structure -------------------------------------
00231 };
00232 
00233 FASTJET_END_NAMESPACE
00234 
00235 #endif  //  __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends