|
||||
File indexing completed on 2025-01-18 09:57:19
0001 //FJSTARTHEADER 0002 // $Id$ 0003 // 0004 // Copyright (c) 2005-2021, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 0005 // 0006 //---------------------------------------------------------------------- 0007 // This file is part of FastJet. 0008 // 0009 // FastJet is free software; you can redistribute it and/or modify 0010 // it under the terms of the GNU General Public License as published by 0011 // the Free Software Foundation; either version 2 of the License, or 0012 // (at your option) any later version. 0013 // 0014 // The algorithms that underlie FastJet have required considerable 0015 // development. They are described in the original FastJet paper, 0016 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 0017 // FastJet as part of work towards a scientific publication, please 0018 // quote the version you use and include a citation to the manual and 0019 // optionally also to hep-ph/0512210. 0020 // 0021 // FastJet is distributed in the hope that it will be useful, 0022 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 // GNU General Public License for more details. 0025 // 0026 // You should have received a copy of the GNU General Public License 0027 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 0028 //---------------------------------------------------------------------- 0029 //FJENDHEADER 0030 0031 0032 #ifndef __FASTJET_WRAPPED_STRUCTURE_HH__ 0033 #define __FASTJET_WRAPPED_STRUCTURE_HH__ 0034 0035 #include "fastjet/PseudoJetStructureBase.hh" 0036 #include "fastjet/Error.hh" 0037 0038 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 0039 0040 /// @ingroup extra_info 0041 /// \class WrappedStructure 0042 /// 0043 /// This wraps a (shared) pointer to an underlying structure 0044 /// 0045 /// The typical use-case is when a PseusoJet needs to share its 0046 /// structure with another PseudoJet but also include extra 0047 /// information in its structure. For the memory management to be 0048 /// handled properly, it should hold a shared pointer to the shared 0049 /// structure. This is what this class ensures. Deriving a structure 0050 /// from this class would then allow for the implementation of the 0051 /// extra features. 0052 /// 0053 class WrappedStructure : public PseudoJetStructureBase{ 0054 public: 0055 /// default ctor 0056 /// the argument is the structure we need to wrap 0057 WrappedStructure(const SharedPtr<PseudoJetStructureBase> & to_be_shared) 0058 : _structure(to_be_shared){ 0059 if (!_structure) 0060 throw Error("Trying to construct a wrapped structure around an empty (NULL) structure"); 0061 } 0062 0063 /// default (virtual) dtor 0064 virtual ~WrappedStructure(){} 0065 0066 /// description 0067 virtual std::string description() const FASTJET_OVERRIDE{ 0068 return "PseudoJet wrapping the structure ("+_structure->description()+")"; 0069 } 0070 0071 //------------------------------------------------------------- 0072 /// @name Direct access to the associated ClusterSequence object. 0073 /// 0074 /// Get access to the associated ClusterSequence (if any) 0075 //\{ 0076 //------------------------------------------------------------- 0077 /// returns true if there is an associated ClusterSequence 0078 virtual bool has_associated_cluster_sequence() const FASTJET_OVERRIDE{ 0079 return _structure->has_associated_cluster_sequence(); 0080 } 0081 0082 /// get a (const) pointer to the parent ClusterSequence (NULL if 0083 /// inexistent) 0084 virtual const ClusterSequence* associated_cluster_sequence() const FASTJET_OVERRIDE{ 0085 return _structure->associated_cluster_sequence(); 0086 } 0087 0088 /// returns true if this PseudoJet has an associated and still 0089 /// valid ClusterSequence. 0090 virtual bool has_valid_cluster_sequence() const FASTJET_OVERRIDE{ 0091 return _structure->has_valid_cluster_sequence(); 0092 } 0093 0094 /// if the jet has a valid associated cluster sequence then return a 0095 /// pointer to it; otherwise throw an error 0096 virtual const ClusterSequence * validated_cs() const FASTJET_OVERRIDE{ 0097 return _structure->validated_cs(); 0098 } 0099 0100 /// if the jet has valid area information then return a pointer to 0101 /// the associated ClusterSequenceAreaBase object; otherwise throw an error 0102 virtual const ClusterSequenceAreaBase * validated_csab() const FASTJET_OVERRIDE{ 0103 return _structure->validated_csab(); 0104 } 0105 0106 //\} 0107 0108 //------------------------------------------------------------- 0109 /// @name Methods for access to information about jet structure 0110 /// 0111 /// These allow access to jet constituents, and other jet 0112 /// subtructure information. They only work if the jet is associated 0113 /// with a ClusterSequence. 0114 //------------------------------------------------------------- 0115 //\{ 0116 0117 /// check if it has been recombined with another PseudoJet in which 0118 /// case, return its partner through the argument. Otherwise, 0119 /// 'partner' is set to 0. 0120 /// 0121 /// By default, throws an Error 0122 virtual bool has_partner(const PseudoJet &reference, PseudoJet &partner) const FASTJET_OVERRIDE{ 0123 return _structure->has_partner(reference, partner); 0124 } 0125 0126 /// check if it has been recombined with another PseudoJet in which 0127 /// case, return its child through the argument. Otherwise, 'child' 0128 /// is set to 0. 0129 /// 0130 /// By default, throws an Error 0131 virtual bool has_child(const PseudoJet &reference, PseudoJet &child) const FASTJET_OVERRIDE{ 0132 return _structure->has_child(reference, child); 0133 } 0134 0135 /// check if it is the product of a recombination, in which case 0136 /// return the 2 parents through the 'parent1' and 'parent2' 0137 /// arguments. Otherwise, set these to 0. 0138 /// 0139 /// By default, throws an Error 0140 virtual bool has_parents(const PseudoJet &reference, 0141 PseudoJet &parent1, PseudoJet &parent2) const FASTJET_OVERRIDE{ 0142 return _structure->has_parents(reference, parent1, parent2); 0143 } 0144 0145 /// check if the reference PseudoJet is contained the second one 0146 /// passed as argument. 0147 /// 0148 /// By default, throws an Error 0149 virtual bool object_in_jet(const PseudoJet &reference, 0150 const PseudoJet &jet) const FASTJET_OVERRIDE{ 0151 return _structure->object_in_jet(reference, jet); 0152 } 0153 0154 0155 /// return true if the structure supports constituents. 0156 /// 0157 /// false by default 0158 virtual bool has_constituents() const FASTJET_OVERRIDE { 0159 return _structure->has_constituents(); 0160 } 0161 0162 /// retrieve the constituents. 0163 /// 0164 /// By default, throws an Error 0165 virtual std::vector<PseudoJet> constituents(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0166 return _structure->constituents(reference); 0167 } 0168 0169 /// return true if the structure supports exclusive_subjets. 0170 virtual bool has_exclusive_subjets() const FASTJET_OVERRIDE{ 0171 return _structure->has_exclusive_subjets(); 0172 } 0173 0174 /// return a vector of all subjets of the current jet (in the sense 0175 /// of the exclusive algorithm) that would be obtained when running 0176 /// the algorithm with the given dcut. 0177 /// 0178 /// Time taken is O(m ln m), where m is the number of subjets that 0179 /// are found. If m gets to be of order of the total number of 0180 /// constituents in the jet, this could be substantially slower than 0181 /// just getting that list of constituents. 0182 /// 0183 /// By default, throws an Error 0184 virtual std::vector<PseudoJet> exclusive_subjets(const PseudoJet &reference, 0185 const double & dcut) const FASTJET_OVERRIDE{ 0186 return _structure->exclusive_subjets(reference, dcut); 0187 } 0188 0189 /// return the size of exclusive_subjets(...); still n ln n with same 0190 /// coefficient, but marginally more efficient than manually taking 0191 /// exclusive_subjets.size() 0192 /// 0193 /// By default, throws an Error 0194 virtual int n_exclusive_subjets(const PseudoJet &reference, 0195 const double & dcut) const FASTJET_OVERRIDE{ 0196 return _structure->n_exclusive_subjets(reference, dcut); 0197 } 0198 0199 /// return the list of subjets obtained by unclustering the supplied 0200 /// jet down to n subjets (or all constituents if there are fewer 0201 /// than n). 0202 /// 0203 /// By default, throws an Error 0204 virtual std::vector<PseudoJet> exclusive_subjets_up_to (const PseudoJet &reference, 0205 int nsub) const FASTJET_OVERRIDE{ 0206 return _structure->exclusive_subjets_up_to (reference, nsub); 0207 } 0208 0209 /// return the dij that was present in the merging nsub+1 -> nsub 0210 /// subjets inside this jet. 0211 /// 0212 /// By default, throws an Error 0213 virtual double exclusive_subdmerge(const PseudoJet &reference, int nsub) const FASTJET_OVERRIDE{ 0214 return _structure->exclusive_subdmerge(reference, nsub); 0215 } 0216 0217 /// return the maximum dij that occurred in the whole event at the 0218 /// stage that the nsub+1 -> nsub merge of subjets occurred inside 0219 /// this jet. 0220 /// 0221 /// By default, throws an Error 0222 virtual double exclusive_subdmerge_max(const PseudoJet &reference, int nsub) const FASTJET_OVERRIDE{ 0223 return _structure->exclusive_subdmerge_max(reference, nsub); 0224 } 0225 0226 0227 //------------------------------------------------------------------- 0228 // information related to the pieces of the jet 0229 //------------------------------------------------------------------- 0230 /// return true if the structure supports pieces. 0231 /// 0232 /// false by default 0233 virtual bool has_pieces(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0234 return _structure->has_pieces(reference); 0235 } 0236 0237 /// retrieve the pieces building the jet. 0238 /// 0239 /// By default, throws an Error 0240 virtual std::vector<PseudoJet> pieces(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0241 return _structure->pieces(reference); 0242 } 0243 0244 // the following ones require a computation of the area in the 0245 // parent ClusterSequence (See ClusterSequenceAreaBase for details) 0246 //------------------------------------------------------------------ 0247 0248 /// check if it has a defined area 0249 /// 0250 /// false by default 0251 virtual bool has_area() const FASTJET_OVERRIDE{ 0252 return _structure->has_area(); 0253 } 0254 0255 /// return the jet (scalar) area. 0256 /// 0257 /// By default, throws an Error 0258 virtual double area(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0259 return _structure->area(reference); 0260 } 0261 0262 /// return the error (uncertainty) associated with the determination 0263 /// of the area of this jet. 0264 /// 0265 /// By default, throws an Error 0266 virtual double area_error(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0267 return _structure->area_error(reference); 0268 } 0269 0270 /// return the jet 4-vector area. 0271 /// 0272 /// By default, throws an Error 0273 virtual PseudoJet area_4vector(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0274 return _structure->area_4vector(reference); 0275 } 0276 0277 /// true if this jet is made exclusively of ghosts. 0278 /// 0279 /// By default, throws an Error 0280 virtual bool is_pure_ghost(const PseudoJet &reference) const FASTJET_OVERRIDE{ 0281 return _structure->is_pure_ghost(reference); 0282 } 0283 0284 //\} --- end of jet structure ------------------------------------- 0285 0286 protected: 0287 SharedPtr<PseudoJetStructureBase> _structure; ///< the wrapped structure 0288 }; 0289 0290 FASTJET_END_NAMESPACE 0291 0292 #endif // __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |