FastJet  3.0.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PseudoJetStructureBase.hh
1 #ifndef __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
2 #define __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
3 
4 //STARTHEADER
5 // $Id: PseudoJetStructureBase.hh 3071 2013-04-01 12:52:46Z cacciari $
6 //
7 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
8 //
9 //----------------------------------------------------------------------
10 // This file is part of FastJet.
11 //
12 // FastJet is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
16 //
17 // The algorithms that underlie FastJet have required considerable
18 // development and are described in hep-ph/0512210. If you use
19 // FastJet as part of work towards a scientific publication, please
20 // include a citation to the FastJet paper.
21 //
22 // FastJet is distributed in the hope that it will be useful,
23 // but WITHOUT ANY WARRANTY; without even the implied warranty of
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 // GNU General Public License for more details.
26 //
27 // You should have received a copy of the GNU General Public License
28 // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
29 //----------------------------------------------------------------------
30 //ENDHEADER
31 
32 
33 #include "fastjet/internal/base.hh"
34 
35 #include <vector>
36 #include <string>
37 
38 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
39 
40 class PseudoJet;
41 class ClusterSequence;
42 #ifndef __FJCORE__
43 class ClusterSequenceAreaBase;
44 #endif // __FJCORE__
45 
46 /// @ingroup extra_info
47 /// \class PseudoJetStructureBase
48 ///
49 /// Contains any information related to the clustering that should be
50 /// directly accessible to PseudoJet.
51 ///
52 /// By default, this class implements basic access to the
53 /// ClusterSequence related to a PseudoJet (like its constituents or
54 /// its area). But it can be overloaded in order e.g. to give access
55 /// to the jet substructure.
56 ///
58 public:
59  /// default ctor
61 
62  /// default (virtual) dtor
64 
65  /// description
66  virtual std::string description() const{ return "PseudoJet with an unknown structure"; }
67 
68  //-------------------------------------------------------------
69  /// @name Direct access to the associated ClusterSequence object.
70  ///
71  /// Get access to the associated ClusterSequence (if any)
72  //\{
73  //-------------------------------------------------------------
74  /// returns true if there is an associated ClusterSequence
75  virtual bool has_associated_cluster_sequence() const { return false;}
76 
77  /// get a (const) pointer to the parent ClusterSequence (NULL if
78  /// inexistent)
79  virtual const ClusterSequence* associated_cluster_sequence() const;
80 
81  /// returns true if this PseudoJet has an associated and still
82  /// valid ClusterSequence.
83  virtual bool has_valid_cluster_sequence() const {return false;}
84 
85  /// if the jet has a valid associated cluster sequence then return a
86  /// pointer to it; otherwise throw an error
87  virtual const ClusterSequence * validated_cs() const;
88 
89 #ifndef __FJCORE__
90  /// if the jet has valid area information then return a pointer to
91  /// the associated ClusterSequenceAreaBase object; otherwise throw an error
92  virtual const ClusterSequenceAreaBase * validated_csab() const;
93 #endif
94 
95  //\}
96 
97  //-------------------------------------------------------------
98  /// @name Methods for access to information about jet structure
99  ///
100  /// These allow access to jet constituents, and other jet
101  /// subtructure information. They only work if the jet is associated
102  /// with a ClusterSequence.
103  //-------------------------------------------------------------
104  //\{
105 
106  /// check if it has been recombined with another PseudoJet in which
107  /// case, return its partner through the argument. Otherwise,
108  /// 'partner' is set to 0.
109  ///
110  /// By default, throws an Error
111  virtual bool has_partner(const PseudoJet &reference, PseudoJet &partner) const;
112 
113  /// check if it has been recombined with another PseudoJet in which
114  /// case, return its child through the argument. Otherwise, 'child'
115  /// is set to 0.
116  ///
117  /// By default, throws an Error
118  virtual bool has_child(const PseudoJet &reference, PseudoJet &child) const;
119 
120  /// check if it is the product of a recombination, in which case
121  /// return the 2 parents through the 'parent1' and 'parent2'
122  /// arguments. Otherwise, set these to 0.
123  ///
124  /// By default, throws an Error
125  virtual bool has_parents(const PseudoJet &reference, PseudoJet &parent1, PseudoJet &parent2) const;
126 
127  /// check if the reference PseudoJet is contained the second one
128  /// passed as argument.
129  ///
130  /// By default, throws an Error
131  virtual bool object_in_jet(const PseudoJet &reference, const PseudoJet &jet) const;
132 
133 
134  /// return true if the structure supports constituents.
135  ///
136  /// false by default
137  virtual bool has_constituents() const {return false;}
138 
139  /// retrieve the constituents.
140  ///
141  /// By default, throws an Error
142  virtual std::vector<PseudoJet> constituents(const PseudoJet &reference) const;
143 
144 
145  /// return true if the structure supports exclusive_subjets.
146  virtual bool has_exclusive_subjets() const {return false;}
147 
148  /// return a vector of all subjets of the current jet (in the sense
149  /// of the exclusive algorithm) that would be obtained when running
150  /// the algorithm with the given dcut.
151  ///
152  /// Time taken is O(m ln m), where m is the number of subjets that
153  /// are found. If m gets to be of order of the total number of
154  /// constituents in the jet, this could be substantially slower than
155  /// just getting that list of constituents.
156  ///
157  /// By default, throws an Error
158  virtual std::vector<PseudoJet> exclusive_subjets(const PseudoJet &reference, const double & dcut) const;
159 
160  /// return the size of exclusive_subjets(...); still n ln n with same
161  /// coefficient, but marginally more efficient than manually taking
162  /// exclusive_subjets.size()
163  ///
164  /// By default, throws an Error
165  virtual int n_exclusive_subjets(const PseudoJet &reference, const double & dcut) const;
166 
167  /// return the list of subjets obtained by unclustering the supplied
168  /// jet down to nsub subjets (or all constituents if there are fewer
169  /// than nsub).
170  ///
171  /// By default, throws an Error
172  virtual std::vector<PseudoJet> exclusive_subjets_up_to (const PseudoJet &reference, int nsub) const;
173 
174  /// return the dij that was present in the merging nsub+1 -> nsub
175  /// subjets inside this jet.
176  ///
177  /// By default, throws an Error
178  virtual double exclusive_subdmerge(const PseudoJet &reference, int nsub) const;
179 
180  /// return the maximum dij that occurred in the whole event at the
181  /// stage that the nsub+1 -> nsub merge of subjets occurred inside
182  /// this jet.
183  ///
184  /// By default, throws an Error
185  virtual double exclusive_subdmerge_max(const PseudoJet &reference, int nsub) const;
186 
187 
188  //-------------------------------------------------------------------
189  // information related to the pieces of the jet
190  //-------------------------------------------------------------------
191  /// return true if the structure supports pieces.
192  ///
193  /// false by default
194  /// NB: "reference" is commented to avoid unused-variable compiler warnings
195  virtual bool has_pieces(const PseudoJet & /* reference */) const {
196  return false;}
197 
198  /// retrieve the pieces building the jet.
199  ///
200  /// By default, throws an Error.
201  /// NB: "reference" is commented to avoid unused-variable compiler warnings
202  virtual std::vector<PseudoJet> pieces(const PseudoJet & /* reference */
203  ) const;
204 
205 
206  // the following ones require a computation of the area in the
207  // parent ClusterSequence (See ClusterSequenceAreaBase for details)
208  //------------------------------------------------------------------
209 #ifndef __FJCORE__
210 
211  /// check if it has a defined area
212  ///
213  /// false by default
214  virtual bool has_area() const {return false;}
215 
216  /// return the jet (scalar) area.
217  ///
218  /// By default, throws an Error
219  virtual double area(const PseudoJet &reference) const;
220 
221  /// return the error (uncertainty) associated with the determination
222  /// of the area of this jet.
223  ///
224  /// By default, throws an Error
225  virtual double area_error(const PseudoJet &reference) const;
226 
227  /// return the jet 4-vector area.
228  ///
229  /// By default, throws an Error
230  virtual PseudoJet area_4vector(const PseudoJet &reference) const;
231 
232  /// true if this jet is made exclusively of ghosts.
233  ///
234  /// By default, throws an Error
235  virtual bool is_pure_ghost(const PseudoJet &reference) const;
236 
237 #endif // __FJCORE__
238  //\} --- end of jet structure -------------------------------------
239 };
240 
241 FASTJET_END_NAMESPACE
242 
243 #endif // __FASTJET_PSEUDOJET_STRUCTURE_BASE_HH__
virtual std::string description() const
description
deals with clustering
virtual bool has_pieces(const PseudoJet &) const
return true if the structure supports pieces.
virtual bool has_valid_cluster_sequence() const
returns true if this PseudoJet has an associated and still valid ClusterSequence. ...
virtual bool has_constituents() const
return true if the structure supports constituents.
Contains any information related to the clustering that should be directly accessible to PseudoJet...
virtual bool has_associated_cluster_sequence() const
returns true if there is an associated ClusterSequence
base class that sets interface for extensions of ClusterSequence that provide information about the a...
virtual ~PseudoJetStructureBase()
default (virtual) dtor
virtual bool has_exclusive_subjets() const
return true if the structure supports exclusive_subjets.
Class to contain pseudojets, including minimal information of use to jet-clustering routines...
Definition: PseudoJet.hh:65
virtual bool has_area() const
check if it has a defined area