[d7d2da3] | 1 | //STARTHEADER
|
---|
| 2 | // $Id: CompositeJetStructure.hh 2684 2011-11-14 07:41:44Z soyez $
|
---|
| 3 | //
|
---|
| 4 | // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
|
---|
| 5 | //
|
---|
| 6 | //----------------------------------------------------------------------
|
---|
| 7 | // This file is part of FastJet.
|
---|
| 8 | //
|
---|
| 9 | // FastJet is free software; you can redistribute it and/or modify
|
---|
| 10 | // it under the terms of the GNU General Public License as published by
|
---|
| 11 | // the Free Software Foundation; either version 2 of the License, or
|
---|
| 12 | // (at your option) any later version.
|
---|
| 13 | //
|
---|
| 14 | // The algorithms that underlie FastJet have required considerable
|
---|
| 15 | // development and are described in hep-ph/0512210. If you use
|
---|
| 16 | // FastJet as part of work towards a scientific publication, please
|
---|
| 17 | // include a citation to the FastJet paper.
|
---|
| 18 | //
|
---|
| 19 | // FastJet is distributed in the hope that it will be useful,
|
---|
| 20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 22 | // GNU General Public License for more details.
|
---|
| 23 | //
|
---|
| 24 | // You should have received a copy of the GNU General Public License
|
---|
| 25 | // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 26 | //----------------------------------------------------------------------
|
---|
| 27 | //ENDHEADER
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | #ifndef __FASTJET_COMPOSITEJET_STRUCTURE_HH__
|
---|
| 31 | #define __FASTJET_COMPOSITEJET_STRUCTURE_HH__
|
---|
| 32 |
|
---|
| 33 | #include <fastjet/PseudoJet.hh>
|
---|
| 34 | #include <fastjet/PseudoJetStructureBase.hh>
|
---|
| 35 |
|
---|
| 36 | // to have access to the recombiner we need to include the JetDefinition header
|
---|
| 37 | #include <fastjet/JetDefinition.hh>
|
---|
| 38 |
|
---|
| 39 | FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
| 40 |
|
---|
| 41 | /// @ingroup extra_info
|
---|
| 42 | /// \class CompositeJetStructure
|
---|
| 43 | /// The structure for a jet made of pieces
|
---|
| 44 | ///
|
---|
| 45 | /// This stores the vector of the pieces that make the jet and provide
|
---|
| 46 | /// the methods to access them
|
---|
| 47 | class CompositeJetStructure : public PseudoJetStructureBase{
|
---|
| 48 | public:
|
---|
| 49 | // basic class info
|
---|
| 50 | //-------------------------------------------------------------------
|
---|
| 51 | /// default ctor
|
---|
| 52 | CompositeJetStructure() : _area_4vector_ptr(0){};
|
---|
| 53 |
|
---|
| 54 | /// ctor with initialisation
|
---|
| 55 | CompositeJetStructure(const std::vector<PseudoJet> & initial_pieces,
|
---|
| 56 | const JetDefinition::Recombiner * recombiner = 0);
|
---|
| 57 |
|
---|
| 58 | /// default dtor
|
---|
| 59 | virtual ~CompositeJetStructure(){
|
---|
| 60 | if (_area_4vector_ptr) delete _area_4vector_ptr;
|
---|
| 61 | };
|
---|
| 62 |
|
---|
| 63 | /// description
|
---|
| 64 | virtual std::string description() const;
|
---|
| 65 |
|
---|
| 66 | // things reimplemented from the base structure
|
---|
| 67 | //-------------------------------------------------------------------
|
---|
| 68 | /// true unless the jet has no pieces (see also the description of
|
---|
| 69 | /// constituents() below)
|
---|
| 70 | virtual bool has_constituents() const;
|
---|
| 71 |
|
---|
| 72 | /// return the constituents (i.e. the union of the constituents of each piece)
|
---|
| 73 | ///
|
---|
| 74 | /// If any of the pieces has no constituent, the piece itself is
|
---|
| 75 | /// considered as a constituent
|
---|
| 76 | /// Note that as a consequence, a composite jet with no pieces will
|
---|
| 77 | /// have an empty vector as constituents
|
---|
| 78 | virtual std::vector<PseudoJet> constituents(const PseudoJet &jet) const;
|
---|
| 79 |
|
---|
| 80 | //-------------------------------------------------------------------
|
---|
| 81 | // information related to the pieces of the jet
|
---|
| 82 | //-------------------------------------------------------------------
|
---|
| 83 | /// true if it has pieces (always the case)
|
---|
| 84 | virtual bool has_pieces(const PseudoJet & /*jet*/) const {return true;}
|
---|
| 85 |
|
---|
| 86 | /// returns the pieces
|
---|
| 87 | virtual std::vector<PseudoJet> pieces(const PseudoJet &jet) const;
|
---|
| 88 |
|
---|
| 89 | // area-related material
|
---|
| 90 |
|
---|
| 91 | /// check if it has a well-defined area
|
---|
| 92 | virtual bool has_area() const;
|
---|
| 93 |
|
---|
| 94 | /// return the jet (scalar) area.
|
---|
| 95 | virtual double area(const PseudoJet &reference) const;
|
---|
| 96 |
|
---|
| 97 | /// return the error (uncertainty) associated with the determination
|
---|
| 98 | /// of the area of this jet.
|
---|
| 99 | ///
|
---|
| 100 | /// Be conservative: return the sum of the errors
|
---|
| 101 | virtual double area_error(const PseudoJet &reference) const;
|
---|
| 102 |
|
---|
| 103 | /// return the jet 4-vector area.
|
---|
| 104 | virtual PseudoJet area_4vector(const PseudoJet &reference) const;
|
---|
| 105 |
|
---|
| 106 | /// true if this jet is made exclusively of ghosts.
|
---|
| 107 | ///
|
---|
| 108 | /// In this case, it will be true if all pieces are pure ghost
|
---|
| 109 | virtual bool is_pure_ghost(const PseudoJet &reference) const;
|
---|
| 110 |
|
---|
| 111 | // allow to modify the area information
|
---|
| 112 | // (for use in join())
|
---|
| 113 | //------------------------------------------------------------------------------
|
---|
| 114 | void set_area_information(PseudoJet *area_4vector_ptr){
|
---|
| 115 | _area_4vector_ptr = area_4vector_ptr;
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | protected:
|
---|
| 120 | std::vector<PseudoJet> _pieces; ///< the pieces building the jet
|
---|
| 121 | PseudoJet * _area_4vector_ptr; ///< pointer to the 4-vector jet area
|
---|
| 122 | };
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | // helpers to "join" jets and produce a structure derived from
|
---|
| 127 | // CompositeJetStructure
|
---|
| 128 | //
|
---|
| 129 | // The template structure T must have a constructor accepting as
|
---|
| 130 | // argument the pieces and of the composite jet
|
---|
| 131 | // ------------------------------------------------------------------------
|
---|
| 132 |
|
---|
| 133 | /// build a "CompositeJet" from the vector of its pieces with an
|
---|
| 134 | /// extended structure of type T derived from CompositeJetStructure
|
---|
| 135 | template<typename T> PseudoJet join(const std::vector<PseudoJet> & pieces){
|
---|
| 136 | PseudoJet result(0.0,0.0,0.0,0.0);
|
---|
| 137 | for (unsigned int i=0; i<pieces.size(); i++){
|
---|
| 138 | const PseudoJet it = pieces[i];
|
---|
| 139 | result += it;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | T *cj_struct = new T(pieces);
|
---|
| 143 | result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(cj_struct));
|
---|
| 144 |
|
---|
| 145 | return result;
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 |
|
---|
| 149 | /// build a "CompositeJet" from a single PseudoJet with an extended
|
---|
| 150 | /// structure of type T derived from CompositeJetStructure
|
---|
| 151 | template<typename T> PseudoJet join(const PseudoJet & j1){
|
---|
| 152 | return join<T>(std::vector<PseudoJet>(1,j1));
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | /// build a "CompositeJet" from two PseudoJet with an extended
|
---|
| 156 | /// structure of type T derived from CompositeJetStructure
|
---|
| 157 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2){
|
---|
| 158 | std::vector<PseudoJet> pieces;
|
---|
| 159 | pieces.push_back(j1);
|
---|
| 160 | pieces.push_back(j2);
|
---|
| 161 | return join<T>(pieces);
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | /// build a "CompositeJet" from 3 PseudoJet with an extended structure
|
---|
| 165 | /// of type T derived from CompositeJetStructure
|
---|
| 166 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 167 | const PseudoJet & j3){
|
---|
| 168 | std::vector<PseudoJet> pieces;
|
---|
| 169 | pieces.push_back(j1);
|
---|
| 170 | pieces.push_back(j2);
|
---|
| 171 | pieces.push_back(j3);
|
---|
| 172 | return join<T>(pieces);
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | /// build a "CompositeJet" from 4 PseudoJet with an extended structure
|
---|
| 176 | /// of type T derived from CompositeJetStructure
|
---|
| 177 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 178 | const PseudoJet & j3, const PseudoJet & j4){
|
---|
| 179 | std::vector<PseudoJet> pieces;
|
---|
| 180 | pieces.push_back(j1);
|
---|
| 181 | pieces.push_back(j2);
|
---|
| 182 | pieces.push_back(j3);
|
---|
| 183 | pieces.push_back(j4);
|
---|
| 184 | return join<T>(pieces);
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 |
|
---|
| 188 | // the same as above with an additional argument for a
|
---|
| 189 | // user-defined recombiner
|
---|
| 190 | //
|
---|
| 191 | // The template structure T must be derived from CompositeJetStructure
|
---|
| 192 | // and have a constructor accepting as arguments the pieces and a
|
---|
| 193 | // pointer to the recombination scheme
|
---|
| 194 | // ----------------------------------------------------------------------
|
---|
| 195 |
|
---|
| 196 | /// build a "CompositeJet" from the vector of its pieces with an
|
---|
| 197 | /// extended structure of type T derived from CompositeJetStructure
|
---|
| 198 | template<typename T> PseudoJet join(const std::vector<PseudoJet> & pieces,
|
---|
| 199 | const JetDefinition::Recombiner & recombiner){
|
---|
| 200 | PseudoJet result;
|
---|
| 201 | if (pieces.size()>0){
|
---|
| 202 | result = pieces[0];
|
---|
| 203 | for (unsigned int i=1; i<pieces.size(); i++){
|
---|
| 204 | recombiner.plus_equal(result, pieces[i]);
|
---|
| 205 | }
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 | T *cj_struct = new T(pieces, &recombiner);
|
---|
| 209 | result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(cj_struct));
|
---|
| 210 |
|
---|
| 211 | return result;
|
---|
| 212 | }
|
---|
| 213 |
|
---|
| 214 | /// build a "CompositeJet" from a single PseudoJet with an extended
|
---|
| 215 | /// structure of type T derived from CompositeJetStructure
|
---|
| 216 | template<typename T> PseudoJet join(const PseudoJet & j1,
|
---|
| 217 | const JetDefinition::Recombiner & recombiner){
|
---|
| 218 | return join<T>(std::vector<PseudoJet>(1,j1), recombiner);
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | /// build a "CompositeJet" from two PseudoJet with an extended
|
---|
| 222 | /// structure of type T derived from CompositeJetStructure
|
---|
| 223 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 224 | const JetDefinition::Recombiner & recombiner){
|
---|
| 225 | std::vector<PseudoJet> pieces;
|
---|
| 226 | pieces.push_back(j1);
|
---|
| 227 | pieces.push_back(j2);
|
---|
| 228 | return join<T>(pieces, recombiner);
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | /// build a "CompositeJet" from 3 PseudoJet with an extended structure
|
---|
| 232 | /// of type T derived from CompositeJetStructure
|
---|
| 233 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 234 | const PseudoJet & j3,
|
---|
| 235 | const JetDefinition::Recombiner & recombiner){
|
---|
| 236 | std::vector<PseudoJet> pieces;
|
---|
| 237 | pieces.push_back(j1);
|
---|
| 238 | pieces.push_back(j2);
|
---|
| 239 | pieces.push_back(j3);
|
---|
| 240 | return join<T>(pieces, recombiner);
|
---|
| 241 | }
|
---|
| 242 |
|
---|
| 243 | /// build a "CompositeJet" from 4 PseudoJet with an extended structure
|
---|
| 244 | /// of type T derived from CompositeJetStructure
|
---|
| 245 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 246 | const PseudoJet & j3, const PseudoJet & j4,
|
---|
| 247 | const JetDefinition::Recombiner & recombiner){
|
---|
| 248 | std::vector<PseudoJet> pieces;
|
---|
| 249 | pieces.push_back(j1);
|
---|
| 250 | pieces.push_back(j2);
|
---|
| 251 | pieces.push_back(j3);
|
---|
| 252 | pieces.push_back(j4);
|
---|
| 253 | return join<T>(pieces, recombiner);
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 |
|
---|
| 257 | FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
| 258 |
|
---|
| 259 | #endif // __FASTJET_MERGEDJET_STRUCTURE_HH__
|
---|