|
||||
File indexing completed on 2025-01-18 09:57:17
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_COMPOSITEJET_STRUCTURE_HH__ 0033 #define __FASTJET_COMPOSITEJET_STRUCTURE_HH__ 0034 0035 #include "fastjet/PseudoJet.hh" 0036 #include "fastjet/PseudoJetStructureBase.hh" 0037 0038 // to have access to the recombiner we need to include the JetDefinition header 0039 #include "fastjet/JetDefinition.hh" 0040 0041 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 0042 0043 /// @ingroup extra_info 0044 /// \class CompositeJetStructure 0045 /// The structure for a jet made of pieces 0046 /// 0047 /// This stores the vector of the pieces that make the jet and provide 0048 /// the methods to access them 0049 class CompositeJetStructure : public PseudoJetStructureBase{ 0050 public: 0051 // basic class info 0052 //------------------------------------------------------------------- 0053 /// default ctor 0054 CompositeJetStructure() : _area_4vector_ptr(0){}; 0055 0056 /// ctor with initialisation 0057 CompositeJetStructure(const std::vector<PseudoJet> & initial_pieces, 0058 const JetDefinition::Recombiner * recombiner = 0); 0059 0060 /// default dtor 0061 virtual ~CompositeJetStructure(){ 0062 if (_area_4vector_ptr) delete _area_4vector_ptr; 0063 }; 0064 0065 /// description 0066 virtual std::string description() const FASTJET_OVERRIDE; 0067 0068 // things reimplemented from the base structure 0069 //------------------------------------------------------------------- 0070 /// true unless the jet has no pieces (see also the description of 0071 /// constituents() below) 0072 virtual bool has_constituents() const FASTJET_OVERRIDE; 0073 0074 /// return the constituents (i.e. the union of the constituents of each piece) 0075 /// 0076 /// If any of the pieces has no constituent, the piece itself is 0077 /// considered as a constituent 0078 /// Note that as a consequence, a composite jet with no pieces will 0079 /// have an empty vector as constituents 0080 virtual std::vector<PseudoJet> constituents(const PseudoJet &jet) const FASTJET_OVERRIDE; 0081 0082 //------------------------------------------------------------------- 0083 // information related to the pieces of the jet 0084 //------------------------------------------------------------------- 0085 /// true if it has pieces (always the case) 0086 virtual bool has_pieces(const PseudoJet & /*jet*/) const FASTJET_OVERRIDE {return true;} 0087 0088 /// returns the pieces 0089 virtual std::vector<PseudoJet> pieces(const PseudoJet &jet) const FASTJET_OVERRIDE; 0090 0091 // area-related material 0092 #ifndef __FJCORE__ 0093 0094 /// check if it has a well-defined area 0095 virtual bool has_area() const FASTJET_OVERRIDE; 0096 0097 /// return the jet (scalar) area. 0098 virtual double area(const PseudoJet &reference) const FASTJET_OVERRIDE; 0099 0100 /// return the error (uncertainty) associated with the determination 0101 /// of the area of this jet. 0102 /// 0103 /// Be conservative: return the sum of the errors 0104 virtual double area_error(const PseudoJet &reference) const FASTJET_OVERRIDE; 0105 0106 /// return the jet 4-vector area. 0107 virtual PseudoJet area_4vector(const PseudoJet &reference) const FASTJET_OVERRIDE; 0108 0109 /// true if this jet is made exclusively of ghosts. 0110 /// 0111 /// In this case, it will be true if all pieces are pure ghost 0112 virtual bool is_pure_ghost(const PseudoJet &reference) const FASTJET_OVERRIDE; 0113 0114 //unused: // allows one to modify the area information 0115 //unused: // (for use in join()) 0116 //unused: // 0117 //unused: // This member cannot be used by users who need to create a jet with 0118 //unused: // user-supplied area information, because it sets only the 4-vector 0119 //unused: // part of the area, but not all the other area information 0120 //unused: // (e.g. scalar area) -- that other information is always deduced 0121 //unused: // dynamically from the individual constituents. 0122 //unused: // ------------------------------------------------------------------------------ 0123 //unused: void set_area_information(PseudoJet *area_4vector_ptr){ 0124 //unused: _area_4vector_ptr = area_4vector_ptr; 0125 //unused: } 0126 0127 /// disable the area of the composite jet 0128 /// 0129 /// this can be used e.g. to discard the area of a composite jet 0130 /// made of pieces with non-explicit-ghost area since the area may 0131 /// by erroneous in that case 0132 void discard_area(){ 0133 if (_area_4vector_ptr) delete _area_4vector_ptr; 0134 _area_4vector_ptr = 0; 0135 } 0136 0137 #endif // __FJCORE__ 0138 0139 protected: 0140 std::vector<PseudoJet> _pieces; ///< the pieces building the jet 0141 PseudoJet * _area_4vector_ptr; ///< pointer to the 4-vector jet area 0142 }; 0143 0144 0145 0146 // helpers to "join" jets and produce a structure derived from 0147 // CompositeJetStructure 0148 // 0149 // The template structure T must have a constructor accepting as 0150 // argument the pieces and of the composite jet 0151 // ------------------------------------------------------------------------ 0152 0153 /// build a "CompositeJet" from the vector of its pieces with an 0154 /// extended structure of type T derived from CompositeJetStructure 0155 template<typename T> PseudoJet join(const std::vector<PseudoJet> & pieces){ 0156 PseudoJet result(0.0,0.0,0.0,0.0); 0157 for (unsigned int i=0; i<pieces.size(); i++){ 0158 const PseudoJet it = pieces[i]; 0159 result += it; 0160 } 0161 0162 T *cj_struct = new T(pieces); 0163 result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(cj_struct)); 0164 0165 return result; 0166 } 0167 0168 0169 /// build a "CompositeJet" from a single PseudoJet with an extended 0170 /// structure of type T derived from CompositeJetStructure 0171 template<typename T> PseudoJet join(const PseudoJet & j1){ 0172 return join<T>(std::vector<PseudoJet>(1,j1)); 0173 } 0174 0175 /// build a "CompositeJet" from two PseudoJet with an extended 0176 /// structure of type T derived from CompositeJetStructure 0177 template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2){ 0178 std::vector<PseudoJet> pieces; 0179 pieces.push_back(j1); 0180 pieces.push_back(j2); 0181 return join<T>(pieces); 0182 } 0183 0184 /// build a "CompositeJet" from 3 PseudoJet with an extended structure 0185 /// of type T derived from CompositeJetStructure 0186 template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, 0187 const PseudoJet & j3){ 0188 std::vector<PseudoJet> pieces; 0189 pieces.push_back(j1); 0190 pieces.push_back(j2); 0191 pieces.push_back(j3); 0192 return join<T>(pieces); 0193 } 0194 0195 /// build a "CompositeJet" from 4 PseudoJet with an extended structure 0196 /// of type T derived from CompositeJetStructure 0197 template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, 0198 const PseudoJet & j3, const PseudoJet & j4){ 0199 std::vector<PseudoJet> pieces; 0200 pieces.push_back(j1); 0201 pieces.push_back(j2); 0202 pieces.push_back(j3); 0203 pieces.push_back(j4); 0204 return join<T>(pieces); 0205 } 0206 0207 0208 // the same as above with an additional argument for a 0209 // user-defined recombiner 0210 // 0211 // The template structure T must be derived from CompositeJetStructure 0212 // and have a constructor accepting as arguments the pieces and a 0213 // pointer to the recombination scheme 0214 // ---------------------------------------------------------------------- 0215 0216 /// build a "CompositeJet" from the vector of its pieces with an 0217 /// extended structure of type T derived from CompositeJetStructure 0218 template<typename T> PseudoJet join(const std::vector<PseudoJet> & pieces, 0219 const JetDefinition::Recombiner & recombiner){ 0220 PseudoJet result; 0221 if (pieces.size()>0){ 0222 result = pieces[0]; 0223 for (unsigned int i=1; i<pieces.size(); i++){ 0224 recombiner.plus_equal(result, pieces[i]); 0225 } 0226 } 0227 0228 T *cj_struct = new T(pieces, &recombiner); 0229 result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(cj_struct)); 0230 0231 return result; 0232 } 0233 0234 /// build a "CompositeJet" from a single PseudoJet with an extended 0235 /// structure of type T derived from CompositeJetStructure 0236 template<typename T> PseudoJet join(const PseudoJet & j1, 0237 const JetDefinition::Recombiner & recombiner){ 0238 return join<T>(std::vector<PseudoJet>(1,j1), recombiner); 0239 } 0240 0241 /// build a "CompositeJet" from two PseudoJet with an extended 0242 /// structure of type T derived from CompositeJetStructure 0243 template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, 0244 const JetDefinition::Recombiner & recombiner){ 0245 std::vector<PseudoJet> pieces; 0246 pieces.reserve(2); 0247 pieces.push_back(j1); 0248 pieces.push_back(j2); 0249 return join<T>(pieces, recombiner); 0250 } 0251 0252 /// build a "CompositeJet" from 3 PseudoJet with an extended structure 0253 /// of type T derived from CompositeJetStructure 0254 template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, 0255 const PseudoJet & j3, 0256 const JetDefinition::Recombiner & recombiner){ 0257 std::vector<PseudoJet> pieces; 0258 pieces.reserve(3); 0259 pieces.push_back(j1); 0260 pieces.push_back(j2); 0261 pieces.push_back(j3); 0262 return join<T>(pieces, recombiner); 0263 } 0264 0265 /// build a "CompositeJet" from 4 PseudoJet with an extended structure 0266 /// of type T derived from CompositeJetStructure 0267 template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, 0268 const PseudoJet & j3, const PseudoJet & j4, 0269 const JetDefinition::Recombiner & recombiner){ 0270 std::vector<PseudoJet> pieces; 0271 pieces.reserve(4); 0272 pieces.push_back(j1); 0273 pieces.push_back(j2); 0274 pieces.push_back(j3); 0275 pieces.push_back(j4); 0276 return join<T>(pieces, recombiner); 0277 } 0278 0279 0280 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh 0281 0282 #endif // __FASTJET_MERGEDJET_STRUCTURE_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |