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