[859] | 1 | //STARTHEADER
|
---|
[1332] | 2 | // $Id: CompositeJetStructure.hh 3071 2013-04-01 12:52:46Z cacciari $
|
---|
[859] | 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
|
---|
[1332] | 90 | #ifndef __FJCORE__
|
---|
[859] | 91 |
|
---|
| 92 | /// check if it has a well-defined area
|
---|
| 93 | virtual bool has_area() const;
|
---|
| 94 |
|
---|
| 95 | /// return the jet (scalar) area.
|
---|
| 96 | virtual double area(const PseudoJet &reference) const;
|
---|
| 97 |
|
---|
| 98 | /// return the error (uncertainty) associated with the determination
|
---|
| 99 | /// of the area of this jet.
|
---|
| 100 | ///
|
---|
| 101 | /// Be conservative: return the sum of the errors
|
---|
| 102 | virtual double area_error(const PseudoJet &reference) const;
|
---|
| 103 |
|
---|
| 104 | /// return the jet 4-vector area.
|
---|
| 105 | virtual PseudoJet area_4vector(const PseudoJet &reference) const;
|
---|
| 106 |
|
---|
| 107 | /// true if this jet is made exclusively of ghosts.
|
---|
| 108 | ///
|
---|
| 109 | /// In this case, it will be true if all pieces are pure ghost
|
---|
| 110 | virtual bool is_pure_ghost(const PseudoJet &reference) const;
|
---|
| 111 |
|
---|
| 112 | // allow to modify the area information
|
---|
| 113 | // (for use in join())
|
---|
| 114 | //------------------------------------------------------------------------------
|
---|
| 115 | void set_area_information(PseudoJet *area_4vector_ptr){
|
---|
| 116 | _area_4vector_ptr = area_4vector_ptr;
|
---|
| 117 | }
|
---|
| 118 |
|
---|
[1332] | 119 | #endif // __FJCORE__
|
---|
[859] | 120 |
|
---|
| 121 | protected:
|
---|
| 122 | std::vector<PseudoJet> _pieces; ///< the pieces building the jet
|
---|
| 123 | PseudoJet * _area_4vector_ptr; ///< pointer to the 4-vector jet area
|
---|
| 124 | };
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 | // helpers to "join" jets and produce a structure derived from
|
---|
| 129 | // CompositeJetStructure
|
---|
| 130 | //
|
---|
| 131 | // The template structure T must have a constructor accepting as
|
---|
| 132 | // argument the pieces and of the composite jet
|
---|
| 133 | // ------------------------------------------------------------------------
|
---|
| 134 |
|
---|
| 135 | /// build a "CompositeJet" from the vector of its pieces with an
|
---|
| 136 | /// extended structure of type T derived from CompositeJetStructure
|
---|
| 137 | template<typename T> PseudoJet join(const std::vector<PseudoJet> & pieces){
|
---|
| 138 | PseudoJet result(0.0,0.0,0.0,0.0);
|
---|
| 139 | for (unsigned int i=0; i<pieces.size(); i++){
|
---|
| 140 | const PseudoJet it = pieces[i];
|
---|
| 141 | result += it;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | T *cj_struct = new T(pieces);
|
---|
| 145 | result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(cj_struct));
|
---|
| 146 |
|
---|
| 147 | return result;
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 |
|
---|
| 151 | /// build a "CompositeJet" from a single PseudoJet with an extended
|
---|
| 152 | /// structure of type T derived from CompositeJetStructure
|
---|
| 153 | template<typename T> PseudoJet join(const PseudoJet & j1){
|
---|
| 154 | return join<T>(std::vector<PseudoJet>(1,j1));
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | /// build a "CompositeJet" from two PseudoJet with an extended
|
---|
| 158 | /// structure of type T derived from CompositeJetStructure
|
---|
| 159 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2){
|
---|
| 160 | std::vector<PseudoJet> pieces;
|
---|
| 161 | pieces.push_back(j1);
|
---|
| 162 | pieces.push_back(j2);
|
---|
| 163 | return join<T>(pieces);
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | /// build a "CompositeJet" from 3 PseudoJet with an extended structure
|
---|
| 167 | /// of type T derived from CompositeJetStructure
|
---|
| 168 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 169 | const PseudoJet & j3){
|
---|
| 170 | std::vector<PseudoJet> pieces;
|
---|
| 171 | pieces.push_back(j1);
|
---|
| 172 | pieces.push_back(j2);
|
---|
| 173 | pieces.push_back(j3);
|
---|
| 174 | return join<T>(pieces);
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | /// build a "CompositeJet" from 4 PseudoJet with an extended structure
|
---|
| 178 | /// of type T derived from CompositeJetStructure
|
---|
| 179 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 180 | const PseudoJet & j3, const PseudoJet & j4){
|
---|
| 181 | std::vector<PseudoJet> pieces;
|
---|
| 182 | pieces.push_back(j1);
|
---|
| 183 | pieces.push_back(j2);
|
---|
| 184 | pieces.push_back(j3);
|
---|
| 185 | pieces.push_back(j4);
|
---|
| 186 | return join<T>(pieces);
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 |
|
---|
| 190 | // the same as above with an additional argument for a
|
---|
| 191 | // user-defined recombiner
|
---|
| 192 | //
|
---|
| 193 | // The template structure T must be derived from CompositeJetStructure
|
---|
| 194 | // and have a constructor accepting as arguments the pieces and a
|
---|
| 195 | // pointer to the recombination scheme
|
---|
| 196 | // ----------------------------------------------------------------------
|
---|
| 197 |
|
---|
| 198 | /// build a "CompositeJet" from the vector of its pieces with an
|
---|
| 199 | /// extended structure of type T derived from CompositeJetStructure
|
---|
| 200 | template<typename T> PseudoJet join(const std::vector<PseudoJet> & pieces,
|
---|
| 201 | const JetDefinition::Recombiner & recombiner){
|
---|
| 202 | PseudoJet result;
|
---|
| 203 | if (pieces.size()>0){
|
---|
| 204 | result = pieces[0];
|
---|
| 205 | for (unsigned int i=1; i<pieces.size(); i++){
|
---|
| 206 | recombiner.plus_equal(result, pieces[i]);
|
---|
| 207 | }
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | T *cj_struct = new T(pieces, &recombiner);
|
---|
| 211 | result.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(cj_struct));
|
---|
| 212 |
|
---|
| 213 | return result;
|
---|
| 214 | }
|
---|
| 215 |
|
---|
| 216 | /// build a "CompositeJet" from a single PseudoJet with an extended
|
---|
| 217 | /// structure of type T derived from CompositeJetStructure
|
---|
| 218 | template<typename T> PseudoJet join(const PseudoJet & j1,
|
---|
| 219 | const JetDefinition::Recombiner & recombiner){
|
---|
| 220 | return join<T>(std::vector<PseudoJet>(1,j1), recombiner);
|
---|
| 221 | }
|
---|
| 222 |
|
---|
| 223 | /// build a "CompositeJet" from two PseudoJet with an extended
|
---|
| 224 | /// structure of type T derived from CompositeJetStructure
|
---|
| 225 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 226 | const JetDefinition::Recombiner & recombiner){
|
---|
| 227 | std::vector<PseudoJet> pieces;
|
---|
| 228 | pieces.push_back(j1);
|
---|
| 229 | pieces.push_back(j2);
|
---|
| 230 | return join<T>(pieces, recombiner);
|
---|
| 231 | }
|
---|
| 232 |
|
---|
| 233 | /// build a "CompositeJet" from 3 PseudoJet with an extended structure
|
---|
| 234 | /// of type T derived from CompositeJetStructure
|
---|
| 235 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 236 | const PseudoJet & j3,
|
---|
| 237 | const JetDefinition::Recombiner & recombiner){
|
---|
| 238 | std::vector<PseudoJet> pieces;
|
---|
| 239 | pieces.push_back(j1);
|
---|
| 240 | pieces.push_back(j2);
|
---|
| 241 | pieces.push_back(j3);
|
---|
| 242 | return join<T>(pieces, recombiner);
|
---|
| 243 | }
|
---|
| 244 |
|
---|
| 245 | /// build a "CompositeJet" from 4 PseudoJet with an extended structure
|
---|
| 246 | /// of type T derived from CompositeJetStructure
|
---|
| 247 | template<typename T> PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
|
---|
| 248 | const PseudoJet & j3, const PseudoJet & j4,
|
---|
| 249 | const JetDefinition::Recombiner & recombiner){
|
---|
| 250 | std::vector<PseudoJet> pieces;
|
---|
| 251 | pieces.push_back(j1);
|
---|
| 252 | pieces.push_back(j2);
|
---|
| 253 | pieces.push_back(j3);
|
---|
| 254 | pieces.push_back(j4);
|
---|
| 255 | return join<T>(pieces, recombiner);
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 |
|
---|
| 259 | FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
| 260 |
|
---|
| 261 | #endif // __FASTJET_MERGEDJET_STRUCTURE_HH__
|
---|