FastJet 3.0.5
PseudoJetStructureBase.hh
00001 #ifndef __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
00002 #define __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
00003 
00004 //STARTHEADER
00005 // $Id: PseudoJetStructureBase.hh 3071 2013-04-01 12:52:46Z cacciari $
00006 //
00007 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
00008 //
00009 //----------------------------------------------------------------------
00010 // This file is part of FastJet.
00011 //
00012 //  FastJet is free software; you can redistribute it and/or modify
00013 //  it under the terms of the GNU General Public License as published by
00014 //  the Free Software Foundation; either version 2 of the License, or
00015 //  (at your option) any later version.
00016 //
00017 //  The algorithms that underlie FastJet have required considerable
00018 //  development and are described in hep-ph/0512210. If you use
00019 //  FastJet as part of work towards a scientific publication, please
00020 //  include a citation to the FastJet paper.
00021 //
00022 //  FastJet is distributed in the hope that it will be useful,
00023 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025 //  GNU General Public License for more details.
00026 //
00027 //  You should have received a copy of the GNU General Public License
00028 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
00029 //----------------------------------------------------------------------
00030 //ENDHEADER
00031 
00032 
00033 #include "fastjet/internal/base.hh"
00034 
00035 #include <vector>
00036 #include <string>
00037 
00038 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00039 
00040 class PseudoJet;
00041 class ClusterSequence;
00042 #ifndef __FJCORE__
00043 class ClusterSequenceAreaBase;
00044 #endif  // __FJCORE__
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 #ifndef __FJCORE__
00090   /// if the jet has valid area information then return a pointer to
00091   /// the associated ClusterSequenceAreaBase object; otherwise throw an error
00092   virtual const ClusterSequenceAreaBase * validated_csab() const;
00093 #endif
00094 
00095   //\}
00096 
00097   //-------------------------------------------------------------
00098   /// @name Methods for access to information about jet structure
00099   ///
00100   /// These allow access to jet constituents, and other jet
00101   /// subtructure information. They only work if the jet is associated
00102   /// with a ClusterSequence.
00103   //-------------------------------------------------------------
00104   //\{
00105 
00106   /// check if it has been recombined with another PseudoJet in which
00107   /// case, return its partner through the argument. Otherwise,
00108   /// 'partner' is set to 0.
00109   ///
00110   /// By default, throws an Error
00111   virtual bool has_partner(const PseudoJet &reference, PseudoJet &partner) const;
00112 
00113   /// check if it has been recombined with another PseudoJet in which
00114   /// case, return its child through the argument. Otherwise, 'child'
00115   /// is set to 0.
00116   /// 
00117   /// By default, throws an Error
00118   virtual bool has_child(const PseudoJet &reference, PseudoJet &child) const;
00119 
00120   /// check if it is the product of a recombination, in which case
00121   /// return the 2 parents through the 'parent1' and 'parent2'
00122   /// arguments. Otherwise, set these to 0.
00123   ///
00124   /// By default, throws an Error
00125   virtual bool has_parents(const PseudoJet &reference, PseudoJet &parent1, PseudoJet &parent2) const;
00126 
00127   /// check if the reference PseudoJet is contained the second one
00128   /// passed as argument.
00129   ///
00130   /// By default, throws an Error
00131   virtual bool object_in_jet(const PseudoJet &reference, const PseudoJet &jet) const;
00132 
00133 
00134   /// return true if the structure supports constituents. 
00135   ///
00136   /// false by default
00137   virtual bool has_constituents() const {return false;}
00138 
00139   /// retrieve the constituents. 
00140   ///
00141   /// By default, throws an Error
00142   virtual std::vector<PseudoJet> constituents(const PseudoJet &reference) const;
00143 
00144 
00145   /// return true if the structure supports exclusive_subjets. 
00146   virtual bool has_exclusive_subjets() const {return false;}
00147 
00148   /// return a vector of all subjets of the current jet (in the sense
00149   /// of the exclusive algorithm) that would be obtained when running
00150   /// the algorithm with the given dcut. 
00151   ///
00152   /// Time taken is O(m ln m), where m is the number of subjets that
00153   /// are found. If m gets to be of order of the total number of
00154   /// constituents in the jet, this could be substantially slower than
00155   /// just getting that list of constituents.
00156   ///
00157   /// By default, throws an Error
00158   virtual std::vector<PseudoJet> exclusive_subjets(const PseudoJet &reference, const double & dcut) const;
00159 
00160   /// return the size of exclusive_subjets(...); still n ln n with same
00161   /// coefficient, but marginally more efficient than manually taking
00162   /// exclusive_subjets.size()
00163   ///
00164   /// By default, throws an Error
00165   virtual int n_exclusive_subjets(const PseudoJet &reference, const double & dcut) const;
00166 
00167   /// return the list of subjets obtained by unclustering the supplied
00168   /// jet down to nsub subjets (or all constituents if there are fewer
00169   /// than nsub).
00170   ///
00171   /// By default, throws an Error
00172   virtual std::vector<PseudoJet> exclusive_subjets_up_to (const PseudoJet &reference, int nsub) const;
00173 
00174   /// return the dij that was present in the merging nsub+1 -> nsub 
00175   /// subjets inside this jet.
00176   ///
00177   /// By default, throws an Error
00178   virtual double exclusive_subdmerge(const PseudoJet &reference, int nsub) const;
00179 
00180   /// return the maximum dij that occurred in the whole event at the
00181   /// stage that the nsub+1 -> nsub merge of subjets occurred inside 
00182   /// this jet.
00183   ///
00184   /// By default, throws an Error
00185   virtual double exclusive_subdmerge_max(const PseudoJet &reference, int nsub) const;
00186 
00187 
00188   //-------------------------------------------------------------------
00189   // information related to the pieces of the jet
00190   //-------------------------------------------------------------------
00191   /// return true if the structure supports pieces. 
00192   ///
00193   /// false by default
00194   /// NB: "reference" is commented to avoid unused-variable compiler warnings
00195   virtual bool has_pieces(const PseudoJet & /* reference */) const {
00196     return false;}
00197 
00198   /// retrieve the pieces building the jet. 
00199   ///
00200   /// By default, throws an Error.
00201   /// NB: "reference" is commented to avoid unused-variable compiler warnings
00202   virtual std::vector<PseudoJet> pieces(const PseudoJet & /* reference */
00203                                         ) const;
00204 
00205 
00206   // the following ones require a computation of the area in the
00207   // parent ClusterSequence (See ClusterSequenceAreaBase for details)
00208   //------------------------------------------------------------------
00209 #ifndef __FJCORE__
00210 
00211   /// check if it has a defined area
00212   ///
00213   /// false by default
00214   virtual bool has_area() const {return false;}
00215 
00216   /// return the jet (scalar) area.
00217   ///
00218   /// By default, throws an Error
00219   virtual double area(const PseudoJet &reference) const;
00220 
00221   /// return the error (uncertainty) associated with the determination
00222   /// of the area of this jet.
00223   ///
00224   /// By default, throws an Error
00225   virtual double area_error(const PseudoJet &reference) const;
00226 
00227   /// return the jet 4-vector area.
00228   ///
00229   /// By default, throws an Error
00230   virtual PseudoJet area_4vector(const PseudoJet &reference) const;
00231 
00232   /// true if this jet is made exclusively of ghosts.
00233   ///
00234   /// By default, throws an Error
00235   virtual bool is_pure_ghost(const PseudoJet &reference) const;
00236 
00237 #endif  // __FJCORE__
00238   //\} --- end of jet structure -------------------------------------
00239 };
00240 
00241 FASTJET_END_NAMESPACE
00242 
00243 #endif  //  __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends