FastJet 3.4.1
JetDefinition.hh
1#ifndef __FASTJET_JETDEFINITION_HH__
2#define __FASTJET_JETDEFINITION_HH__
3
4//FJSTARTHEADER
5// $Id$
6//
7// Copyright (c) 2005-2023, 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. They are described in the original FastJet paper,
19// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
20// FastJet as part of work towards a scientific publication, please
21// quote the version you use and include a citation to the manual and
22// optionally also to hep-ph/0512210.
23//
24// FastJet is distributed in the hope that it will be useful,
25// but WITHOUT ANY WARRANTY; without even the implied warranty of
26// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27// GNU General Public License for more details.
28//
29// You should have received a copy of the GNU General Public License
30// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
31//----------------------------------------------------------------------
32//FJENDHEADER
33
34#include<cassert>
35#include "fastjet/internal/numconsts.hh"
36#include "fastjet/PseudoJet.hh"
37#include "fastjet/internal/deprecated.hh"
38#include<string>
39#include<memory>
40
41FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
42
43/// return a string containing information about the release
44// NB: (implemented in ClusterSequence.cc but defined here because
45// this is a visible location)
46std::string fastjet_version_string();
47
48//======================================================================
49/// the various options for the algorithmic strategy to adopt in
50/// clustering events with kt and cambridge style algorithms.
52 /// Like N2MHTLazy9 in a number of respects, but does not calculate
53 /// ghost-ghost distances and so does not carry out ghost-ghost
54 /// recombination.
55 ///
56 /// If you want active ghosted areas, then this is only suitable for
57 /// use with the anti-kt algorithm (or genkt with negative p), and
58 /// does not produce any pure ghost jets. If used with active areas
59 /// with Kt or Cam algorithms it will actually produce a passive
60 /// area.
61 ///
62 /// Particles are deemed to be ghosts if their pt is below a
63 /// threshold (currently 1e-50, hard coded as ghost_limit in
64 /// LazyTiling9SeparateGhosts).
65 ///
66 /// Currently for events with a couple of thousand normal particles
67 /// and O(10k) ghosts, this can be quicker than N2MHTLazy9, which
68 /// would otherwise be the best strategy.
69 ///
70 /// New in FJ3.1
72 /// only looks into a neighbouring tile for a particle's nearest
73 /// neighbour (NN) if that particle's in-tile NN is further than the
74 /// distance to the edge of the neighbouring tile. Uses tiles of
75 /// size R and a 3x3 tile grid around the particle.
76 /// New in FJ3.1
78 /// Similar to N2MHTLazy9, but uses tiles of size R/2 and a 5x5 tile
79 /// grid around the particle.
80 /// New in FJ3.1
82 /// Like to N2MHTLazy9 but uses slightly different optimizations,
83 /// e.g. for calculations of distance to nearest tile; as of
84 /// 2014-07-18 it is slightly slower and not recommended for
85 /// production use. To considered deprecated.
86 /// New in FJ3.1
88 /// faster that N2Tiled above about 500 particles; differs from it
89 /// by retainig the di(closest j) distances in a MinHeap (sort of
90 /// priority queue) rather than a simple vector.
92 /// fastest from about 50..500
93 N2Tiled = -3,
94 /// legacy
96 /// fastest below 50
97 N2Plain = -1,
98 /// worse even than the usual N^3 algorithms
99 N3Dumb = 0,
100 /// automatic selection of the best (based on N), including
101 /// the LazyTiled strategies that are new to FJ3.1
102 Best = 1,
103 /// best of the NlnN variants -- best overall for N>10^4.
104 /// (Does not work for R>=2pi)
105 NlnN = 2,
106 /// legacy N ln N using 3pi coverage of cylinder.
107 /// (Does not work for R>=2pi)
109 /// legacy N ln N using 4pi coverage of cylinder
111 /// Chan's closest pair method (in a variant with 4pi coverage),
112 /// for use exclusively with the Cambridge algorithm.
113 /// (Does not work for R>=2pi)
115 /// Chan's closest pair method (in a variant with 2pi+2R coverage),
116 /// for use exclusively with the Cambridge algorithm.
117 /// (Does not work for R>=2pi)
119 /// Chan's closest pair method (in a variant with 2pi+minimal extra
120 /// variant), for use exclusively with the Cambridge algorithm.
121 /// (Does not work for R>=2pi)
122 NlnNCam = 12, // 2piMultD
123 /// the automatic strategy choice that was being made in FJ 3.0
124 /// (restricted to strategies that were present in FJ 3.0)
125 BestFJ30 = 21,
126 /// a variant of N2Plain strategy for native \f$e^+e^-\f$ algorithms
127 /// (eekt, ee_genkt) that uses a more accurate calculation of the
128 /// distance measure when angles between PseudoJets are smaller than
129 /// \f$\epsilon^{1/4}\f$, where \f$\epsilon\f$ is the machine
130 /// precision. It shifts the breakdown point from \f$\theta\sim
131 /// \sqrt{\epsilon}\f$ to \f$\theta \sim \epsilon\f$.
133 /// the plugin has been used...
134 plugin_strategy = 999
136
137
138//======================================================================
139/// \enum JetAlgorithm
140/// the various families of jet-clustering algorithm
141//
142// [Remember to update the "is_spherical()" routine if any further
143// spherical algorithms are added to the list below]
145 /// the longitudinally invariant kt algorithm
147 /// the longitudinally invariant variant of the cambridge algorithm
148 /// (aka Aachen algoithm).
150 /// like the k_t but with distance measures
151 /// dij = min(1/kti^2,1/ktj^2) Delta R_{ij}^2 / R^2
152 /// diB = 1/kti^2
154 /// like the k_t but with distance measures
155 /// dij = min(kti^{2p},ktj^{2p}) Delta R_{ij}^2 / R^2
156 /// diB = 1/kti^{2p}
157 /// where p = extra_param()
159 /// a version of cambridge with a special distance measure for
160 /// particles whose pt is < extra_param(); this is not usually
161 /// intended for end users, but is instead automatically selected
162 /// when requesting a passive Cambridge area.
164 /// a version of genkt with a special distance measure for particles
165 /// whose pt is < extra_param() [relevant for passive areas when p<=0]
166 /// ***** NB: THERE IS CURRENTLY NO IMPLEMENTATION FOR THIS ALG *******
168 //.................................................................
169 /// the e+e- kt algorithm
171 /// the e+e- genkt algorithm (R > 2 and p=1 gives ee_kt)
173 //.................................................................
174 /// any plugin algorithm supplied by the user
176 //.................................................................
177 /// the value for the jet algorithm in a JetDefinition for which
178 /// no algorithm has yet been defined
181
182/// make standard Les Houches nomenclature JetAlgorithm (algorithm is general
183/// recipe without the parameters) backward-compatible with old JetFinder
185
186/// provide other possible names for the Cambridge/Aachen algorithm
188const JetAlgorithm cambridge_aachen_algorithm = cambridge_algorithm;
189
190//======================================================================
191/// The various recombination schemes
192///
193/// Note that the schemes that recombine with non-linear weighting of
194/// the directions (e.g. pt2, winner-takes-all) are collinear safe
195/// only for algorithms with a suitable ordering of the
196/// recombinations: orderings in which, for particles of comparable
197/// energies, small-angle clusterings take place before large-angle
198/// clusterings. This property is satisfied by all gen-kt algorithms.
199///
201 /// summing the 4-momenta
203 /// pt weighted recombination of y,phi (and summing of pt's)
204 /// with preprocessing to make things massless by rescaling E=|\vec p|
206 /// pt^2 weighted recombination of y,phi (and summing of pt's)
207 /// with preprocessing to make things massless by rescaling E=|\vec p|
209 /// pt weighted recombination of y,phi (and summing of pt's)
210 /// with preprocessing to make things massless by rescaling |\vec p|->=E
212 /// pt^2 weighted recombination of y,phi (and summing of pt's)
213 /// with preprocessing to make things massless by rescaling |\vec p|->=E
215 /// pt weighted recombination of y,phi (and summing of pt's), with
216 /// no preprocessing
218 /// pt^2 weighted recombination of y,phi (and summing of pt's)
219 /// no preprocessing
221 /// pt-based Winner-Takes-All (WTA) recombination: the
222 /// result of the recombination has the rapidity, azimuth and mass
223 /// of the PseudoJet with the larger pt, and a pt equal to the
224 /// sum of the two pt's
226 /// mod-p-based Winner-Takes-All (WTA) recombination: the result of
227 /// the recombination gets the 3-vector direction and mass of the
228 /// PseudoJet with the larger |3-momentum| (modp), and a
229 /// |3-momentum| equal to the scalar sum of the two |3-momenta|.
231 // Energy-ordering can lead to dangerous situations with particles at
232 // rest. We instead implement the WTA_modp_scheme
233 //
234 // // energy-based Winner-Takes-All (WTA) recombination: the result of
235 // // the recombination gets the 3-vector direction and mass of the
236 // // PseudoJet with the larger energy, and an energy equal to the
237 // // to the sum of the two energies
238 // WTA_E_scheme=8,
239 /// for the user's external scheme
240 external_scheme = 99
242
243
244
245// forward declaration, needed in order to specify interface for the
246// plugin.
247class ClusterSequence;
248
249
250
251
252//======================================================================
253/// @ingroup basic_classes
254/// \class JetDefinition
255/// class that is intended to hold a full definition of the jet
256/// clusterer
258
259public:
260
261 /// forward declaration of a class that allows the user to introduce
262 /// their own plugin
263 class Plugin;
264
265 // forward declaration of a class that will provide the
266 // recombination scheme facilities and/or allow a user to
267 // extend these facilities
268 class Recombiner;
269
270
271 /// constructor with alternative ordering or arguments -- note that
272 /// we have not provided a default jet finder, to avoid ambiguous
273 /// JetDefinition() constructor.
274 JetDefinition(JetAlgorithm jet_algorithm_in,
275 double R_in,
276 RecombinationScheme recomb_scheme_in = E_scheme,
277 Strategy strategy_in = Best) {
278 *this = JetDefinition(jet_algorithm_in, R_in, recomb_scheme_in, strategy_in, 1);
279 }
280
281 /// constructor for algorithms that have no free parameters
282 /// (e.g. ee_kt_algorithm)
283 JetDefinition(JetAlgorithm jet_algorithm_in,
284 RecombinationScheme recomb_scheme_in = E_scheme,
285 Strategy strategy_in = Best) {
286 double dummyR = 0.0;
287 *this = JetDefinition(jet_algorithm_in, dummyR, recomb_scheme_in, strategy_in, 0);
288 }
289
290 /// constructor for algorithms that require R + one extra parameter to be set
291 /// (the gen-kt series for example)
292 JetDefinition(JetAlgorithm jet_algorithm_in,
293 double R_in,
294 double xtra_param_in,
295 RecombinationScheme recomb_scheme_in = E_scheme,
296 Strategy strategy_in = Best) {
297 *this = JetDefinition(jet_algorithm_in, R_in, recomb_scheme_in, strategy_in, 2);
298 set_extra_param(xtra_param_in);
299 }
300
301
302 /// constructor in a form that allows the user to provide a pointer
303 /// to an external recombiner class (which must remain valid for the
304 /// life of the JetDefinition object).
305 JetDefinition(JetAlgorithm jet_algorithm_in,
306 double R_in,
307 const Recombiner * recombiner_in,
308 Strategy strategy_in = Best) {
309 *this = JetDefinition(jet_algorithm_in, R_in, external_scheme, strategy_in);
310 _recombiner = recombiner_in;
311 }
312
313
314 /// constructor for case with 0 parameters (ee_kt_algorithm) and
315 /// and external recombiner
316 JetDefinition(JetAlgorithm jet_algorithm_in,
317 const Recombiner * recombiner_in,
318 Strategy strategy_in = Best) {
319 *this = JetDefinition(jet_algorithm_in, external_scheme, strategy_in);
320 _recombiner = recombiner_in;
321 }
322
323 /// constructor allowing the extra parameter to be set and a pointer to
324 /// a recombiner
325 JetDefinition(JetAlgorithm jet_algorithm_in,
326 double R_in,
327 double xtra_param_in,
328 const Recombiner * recombiner_in,
329 Strategy strategy_in = Best) {
330 *this = JetDefinition(jet_algorithm_in, R_in, xtra_param_in, external_scheme, strategy_in);
331 _recombiner = recombiner_in;
332 }
333
334 /// a default constructor which creates a jet definition that is in
335 /// a well-defined internal state, but not actually usable for jet
336 /// clustering.
339 }
340
341
342 // /// a default constructor
343 // JetDefinition() {
344 // *this = JetDefinition(kt_algorithm, 1.0);
345 // }
346
347 /// constructor based on a pointer to a user's plugin; the object
348 /// pointed to must remain valid for the whole duration of existence
349 /// of the JetDefinition and any related ClusterSequences
350 JetDefinition(const Plugin * plugin_in) {
351 _plugin = plugin_in;
352 _strategy = plugin_strategy;
353 _Rparam = _plugin->R();
354 _extra_param = 0.0; // a dummy value to keep static code checkers happy
355 _jet_algorithm = plugin_algorithm;
356 set_recombination_scheme(E_scheme);
357 }
358
359 /// constructor to fully specify a jet-definition (together with
360 /// information about how algorithically to run it).
361 JetDefinition(JetAlgorithm jet_algorithm_in,
362 double R_in,
363 RecombinationScheme recomb_scheme_in,
364 Strategy strategy_in,
365 int nparameters_in);
366
367 /// constructor to fully specify a jet-definition (together with
368 /// information about how algorithically to run it).
369 ///
370 /// the ordering of arguments here is old and deprecated (except
371 /// as the common constructor for internal use)
372 FASTJET_DEPRECATED_MSG("This argument ordering is deprecated. Use JetDefinition(alg, R, strategy, scheme[, n_parameters]) instead",
373 JetDefinition(JetAlgorithm jet_algorithm_in,
374 double R_in,
375 Strategy strategy_in,
376 RecombinationScheme recomb_scheme_in = E_scheme,
377 int nparameters_in = 1)){
378 (*this) = JetDefinition(jet_algorithm_in,R_in,recomb_scheme_in,strategy_in,nparameters_in);
379 }
380
381
382 /// cluster the supplied particles and returns a vector of resulting
383 /// jets, sorted by pt (or energy in the case of spherical,
384 /// i.e. e+e-, algorithms). This routine currently only makes
385 /// sense for "inclusive" type algorithms.
386 template <class L>
387 std::vector<PseudoJet> operator()(const std::vector<L> & particles) const;
388
389 /// R values larger than max_allowable_R are not allowed.
390 ///
391 /// We use a value of 1000, substantially smaller than
392 /// numeric_limits<double>::max(), to leave room for the convention
393 /// within PseudoJet of setting unphysical (infinite) rapidities to
394 /// +-(MaxRap + abs(pz())), where MaxRap is 10^5.
395 static const double max_allowable_R; //= 1000.0;
396
397 /// set the recombination scheme to the one provided
398 void set_recombination_scheme(RecombinationScheme);
399
400 /// set the recombiner class to the one provided
401 ///
402 /// Note that in order to associate to a jet definition a recombiner
403 /// from another jet definition, it is strongly recommended to use
404 /// the set_recombiner(const JetDefinition &) method below. The
405 /// latter correctly handles the situations where the jet definition
406 /// owns the recombiner (i.e. where delete_recombiner_when_unused
407 /// has been called). In such cases, using set_recombiner(const
408 /// Recombiner *) may lead to memory corruption.
409 void set_recombiner(const Recombiner * recomb) {
410 if (_shared_recombiner) _shared_recombiner.reset(recomb);
411 _recombiner = recomb;
412 _default_recombiner = DefaultRecombiner(external_scheme);
413 }
414
415 /// set the recombiner to be the same as the one of 'other_jet_def'
416 ///
417 /// Note that this is the recommended method to associate to a jet
418 /// definition the recombiner from another jet definition. Compared
419 /// to the set_recombiner(const Recombiner *) above, it correctly
420 /// handles the case where the jet definition owns the recombiner
421 /// (i.e. where delete_recombiner_when_unused has been called)
422 void set_recombiner(const JetDefinition &other_jet_def);
423
424 /// calling this tells the JetDefinition to handle the deletion of
425 /// the recombiner when it is no longer used. (Should not be called
426 /// if the recombiner was initialised from a JetDef whose recombiner
427 /// was already scheduled to delete itself - memory handling will
428 /// already be automatic across both JetDef's in that case).
429 void delete_recombiner_when_unused();
430
431 /// return a pointer to the plugin
432 const Plugin * plugin() const {return _plugin;};
433
434 /// calling this causes the JetDefinition to handle the deletion of the
435 /// plugin when it is no longer used
436 void delete_plugin_when_unused();
437
438 /// return information about the definition...
439 JetAlgorithm jet_algorithm () const {return _jet_algorithm ;}
440 /// same as above for backward compatibility
441 JetAlgorithm jet_finder () const {return _jet_algorithm ;}
442 double R () const {return _Rparam ;}
443 // a general purpose extra parameter, whose meaning depends on
444 // the algorithm, and may often be unused.
445 double extra_param () const {return _extra_param ;}
446 Strategy strategy () const {return _strategy ;}
447 RecombinationScheme recombination_scheme() const {
448 return _default_recombiner.scheme();}
449
450 /// (re)set the jet finder
451 void set_jet_algorithm(JetAlgorithm njf) {_jet_algorithm = njf;}
452 /// same as above for backward compatibility
453 void set_jet_finder(JetAlgorithm njf) {_jet_algorithm = njf;}
454 /// (re)set the general purpose extra parameter
455 void set_extra_param(double xtra_param) {_extra_param = xtra_param;}
456
457 /// returns a pointer to the currently defined recombiner.
458 ///
459 /// Warning: the pointer may be to an internal recombiner (for
460 /// default recombination schemes), in which case if the
461 /// JetDefinition becomes invalid (e.g. is deleted), the pointer
462 /// will then point to an object that no longer exists.
463 ///
464 /// Note also that if you copy a JetDefinition with a default
465 /// recombination scheme, then the two copies will have distinct
466 /// recombiners, and return different recombiner() pointers.
467 const Recombiner * recombiner() const {
468 return _recombiner == 0 ? & _default_recombiner : _recombiner;}
469
470 /// returns true if the current jet definitions shares the same
471 /// recombiner as the one passed as an argument
472 bool has_same_recombiner(const JetDefinition &other_jd) const;
473
474 /// returns true if the jet definition involves an algorithm
475 /// intended for use on a spherical geometry (e.g. e+e- algorithms,
476 /// as opposed to most pp algorithms, which use a cylindrical,
477 /// rapidity-phi geometry).
478 bool is_spherical() const;
479
480 /// return a textual description of the current jet definition
481 std::string description() const;
482
483 /// returns a description not including the recombiner information
484 std::string description_no_recombiner() const;
485
486 /// a short textual description of the algorithm jet_alg
487 static std::string algorithm_description(const JetAlgorithm jet_alg);
488
489 /// the number of parameters associated to a given jet algorithm
490 static unsigned int n_parameters_for_algorithm(const JetAlgorithm jet_alg);
491
492public:
493 //======================================================================
494 /// @ingroup advanced_usage
495 /// \class Recombiner
496 /// An abstract base class that will provide the recombination scheme
497 /// facilities and/or allow a user to extend these facilities
499 public:
500 /// return a textual description of the recombination scheme
501 /// implemented here
502 virtual std::string description() const = 0;
503
504 /// recombine pa and pb and put result into pab
505 virtual void recombine(const PseudoJet & pa, const PseudoJet & pb,
506 PseudoJet & pab) const = 0;
507
508 /// routine called to preprocess each input jet (to make all input
509 /// jets compatible with the scheme requirements (e.g. massless).
510 virtual void preprocess(PseudoJet & ) const {};
511
512 /// a destructor to be replaced if necessary in derived classes...
513 virtual ~Recombiner() {};
514
515 /// pa += pb in the given recombination scheme. Not virtual -- the
516 /// user should have no reason to want to redefine this!
517 inline void plus_equal(PseudoJet & pa, const PseudoJet & pb) const {
518 // put result in a temporary location in case the recombiner
519 // does something funny (ours doesn't, but who knows about the
520 // user's)
521 PseudoJet pres;
522 recombine(pa,pb,pres);
523 pa = pres;
524 }
525
526 };
527
528
529 //======================================================================
530 /// @ingroup advanced_usage
531 /// \class DefaultRecombiner
532 /// A class that will provide the recombination scheme facilities and/or
533 /// allow a user to extend these facilities
534 ///
535 /// This class is derived from the (abstract) class Recombiner. It
536 /// simply "sums" PseudoJets using a specified recombination scheme
537 /// (E-scheme by default)
539 public:
541 _recomb_scheme(recomb_scheme) {}
542
543 virtual std::string description() const FASTJET_OVERRIDE;
544
545 /// recombine pa and pb and put result into pab
546 virtual void recombine(const PseudoJet & pa, const PseudoJet & pb,
547 PseudoJet & pab) const FASTJET_OVERRIDE;
548
549 virtual void preprocess(PseudoJet & p) const FASTJET_OVERRIDE;
550
551 /// return the index of the recombination scheme
552 RecombinationScheme scheme() const {return _recomb_scheme;}
553
554 private:
555 RecombinationScheme _recomb_scheme;
556 };
557
558
559 //======================================================================
560 /// @ingroup advanced_usage
561 /// \class Plugin
562 /// a class that allows a user to introduce their own "plugin" jet
563 /// finder
564 ///
565 /// Note that all the plugins provided with FastJet are derived from
566 /// this class
567 class Plugin{
568 public:
569 /// return a textual description of the jet-definition implemented
570 /// in this plugin
571 virtual std::string description() const = 0;
572
573 /// given a ClusterSequence that has been filled up with initial
574 /// particles, the following function should fill up the rest of the
575 /// ClusterSequence, using the following member functions of
576 /// ClusterSequence:
577 /// - plugin_do_ij_recombination(...)
578 /// - plugin_do_iB_recombination(...)
579 virtual void run_clustering(ClusterSequence &) const = 0;
580
581 virtual double R() const = 0;
582
583 /// return true if there is specific support for the measurement
584 /// of passive areas, in the sense that areas determined from all
585 /// particles below the ghost separation scale will be a passive
586 /// area. [If you don't understand this, ignore it!]
587 virtual bool supports_ghosted_passive_areas() const {return false;}
588
589 /// set the ghost separation scale for passive area determinations
590 /// in future runs (strictly speaking that makes the routine
591 /// a non const, so related internal info must be stored as a mutable)
592 virtual void set_ghost_separation_scale(double scale) const;
593 virtual double ghost_separation_scale() const {return 0.0;}
594
595 /// if this returns false then a warning will be given
596 /// whenever the user requests "exclusive" jets from the
597 /// cluster sequence
598 virtual bool exclusive_sequence_meaningful() const {return false;}
599
600 /// returns true if the plugin implements an algorithm intended
601 /// for use on a spherical geometry (e.g. e+e- algorithms, as
602 /// opposed to most pp algorithms, which use a cylindrical,
603 /// rapidity-phi geometry).
604 virtual bool is_spherical() const {return false;}
605
606 /// a destructor to be replaced if necessary in derived classes...
607 virtual ~Plugin() {};
608 };
609
610private:
611
612
613 JetAlgorithm _jet_algorithm;
614 double _Rparam;
615 double _extra_param ; ///< parameter whose meaning varies according to context
616 Strategy _strategy ;
617
618 const Plugin * _plugin;
619 SharedPtr<const Plugin> _plugin_shared;
620
621 // when we use our own recombiner it's useful to point to it here
622 // so that we don't have to worry about deleting it etc...
623 DefaultRecombiner _default_recombiner;
624 const Recombiner * _recombiner;
625 SharedPtr<const Recombiner> _shared_recombiner;
626
627};
628
629
630//-------------------------------------------------------------------------------
631// helper functions to build a jet made of pieces
632//
633// These functions include an options recombiner used to compute the
634// total composite jet momentum
635// -------------------------------------------------------------------------------
636
637/// build a "CompositeJet" from the vector of its pieces
638///
639/// In this case, E-scheme recombination is assumed to compute the
640/// total momentum
641PseudoJet join(const std::vector<PseudoJet> & pieces, const JetDefinition::Recombiner & recombiner);
642
643/// build a MergedJet from a single PseudoJet
644PseudoJet join(const PseudoJet & j1,
645 const JetDefinition::Recombiner & recombiner);
646
647/// build a MergedJet from 2 PseudoJet
648PseudoJet join(const PseudoJet & j1, const PseudoJet & j2,
649 const JetDefinition::Recombiner & recombiner);
650
651/// build a MergedJet from 3 PseudoJet
652PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, const PseudoJet & j3,
653 const JetDefinition::Recombiner & recombiner);
654
655/// build a MergedJet from 4 PseudoJet
656PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, const PseudoJet & j3, const PseudoJet & j4,
657 const JetDefinition::Recombiner & recombiner);
658
659
660FASTJET_END_NAMESPACE
661
662// include ClusterSequence which includes the implementation of the
663// templated JetDefinition::operator()(...) member
664#include "fastjet/ClusterSequence.hh"
665
666
667#endif // __FASTJET_JETDEFINITION_HH__
deals with clustering
A class that will provide the recombination scheme facilities and/or allow a user to extend these fac...
RecombinationScheme scheme() const
return the index of the recombination scheme
a class that allows a user to introduce their own "plugin" jet finder
virtual bool is_spherical() const
returns true if the plugin implements an algorithm intended for use on a spherical geometry (e....
virtual bool supports_ghosted_passive_areas() const
return true if there is specific support for the measurement of passive areas, in the sense that area...
virtual bool exclusive_sequence_meaningful() const
if this returns false then a warning will be given whenever the user requests "exclusive" jets from t...
virtual ~Plugin()
a destructor to be replaced if necessary in derived classes...
virtual std::string description() const =0
return a textual description of the jet-definition implemented in this plugin
virtual void run_clustering(ClusterSequence &) const =0
given a ClusterSequence that has been filled up with initial particles, the following function should...
An abstract base class that will provide the recombination scheme facilities and/or allow a user to e...
virtual ~Recombiner()
a destructor to be replaced if necessary in derived classes...
virtual void recombine(const PseudoJet &pa, const PseudoJet &pb, PseudoJet &pab) const =0
recombine pa and pb and put result into pab
virtual std::string description() const =0
return a textual description of the recombination scheme implemented here
virtual void preprocess(PseudoJet &) const
routine called to preprocess each input jet (to make all input jets compatible with the scheme requir...
void plus_equal(PseudoJet &pa, const PseudoJet &pb) const
pa += pb in the given recombination scheme.
class that is intended to hold a full definition of the jet clusterer
void set_jet_finder(JetAlgorithm njf)
same as above for backward compatibility
void set_jet_algorithm(JetAlgorithm njf)
(re)set the jet finder
const Plugin * plugin() const
return a pointer to the plugin
JetDefinition(JetAlgorithm jet_algorithm_in, double R_in, double xtra_param_in, const Recombiner *recombiner_in, Strategy strategy_in=Best)
constructor allowing the extra parameter to be set and a pointer to a recombiner
JetDefinition(const Plugin *plugin_in)
constructor based on a pointer to a user's plugin; the object pointed to must remain valid for the wh...
JetAlgorithm jet_algorithm() const
return information about the definition...
JetAlgorithm jet_finder() const
same as above for backward compatibility
const Recombiner * recombiner() const
returns a pointer to the currently defined recombiner.
JetDefinition(JetAlgorithm jet_algorithm_in, double R_in, const Recombiner *recombiner_in, Strategy strategy_in=Best)
constructor in a form that allows the user to provide a pointer to an external recombiner class (whic...
JetDefinition(JetAlgorithm jet_algorithm_in, double R_in, double xtra_param_in, RecombinationScheme recomb_scheme_in=E_scheme, Strategy strategy_in=Best)
constructor for algorithms that require R + one extra parameter to be set (the gen-kt series for exam...
JetDefinition(JetAlgorithm jet_algorithm_in, RecombinationScheme recomb_scheme_in=E_scheme, Strategy strategy_in=Best)
constructor for algorithms that have no free parameters (e.g.
void set_extra_param(double xtra_param)
(re)set the general purpose extra parameter
JetDefinition(JetAlgorithm jet_algorithm_in, const Recombiner *recombiner_in, Strategy strategy_in=Best)
constructor for case with 0 parameters (ee_kt_algorithm) and and external recombiner
JetDefinition()
a default constructor which creates a jet definition that is in a well-defined internal state,...
static const double max_allowable_R
R values larger than max_allowable_R are not allowed.
void set_recombiner(const Recombiner *recomb)
set the recombiner class to the one provided
JetDefinition(JetAlgorithm jet_algorithm_in, double R_in, RecombinationScheme recomb_scheme_in=E_scheme, Strategy strategy_in=Best)
constructor with alternative ordering or arguments – note that we have not provided a default jet fin...
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
Definition: PseudoJet.hh:68
An implementation of shared pointers that is broadly similar to C++11 shared_ptr (https://en....
Definition: SharedPtr.hh:341
Strategy
the various options for the algorithmic strategy to adopt in clustering events with kt and cambridge ...
@ N2Plain
fastest below 50
@ N3Dumb
worse even than the usual N^3 algorithms
@ N2MHTLazy9AntiKtSeparateGhosts
Like N2MHTLazy9 in a number of respects, but does not calculate ghost-ghost distances and so does not...
@ N2Tiled
fastest from about 50..500
@ NlnN3pi
legacy N ln N using 3pi coverage of cylinder.
@ N2MHTLazy9Alt
Like to N2MHTLazy9 but uses slightly different optimizations, e.g.
@ Best
automatic selection of the best (based on N), including the LazyTiled strategies that are new to FJ3....
@ N2PlainEEAccurate
a variant of N2Plain strategy for native algorithms (eekt, ee_genkt) that uses a more accurate calcu...
@ plugin_strategy
the plugin has been used...
@ N2MHTLazy9
only looks into a neighbouring tile for a particle's nearest neighbour (NN) if that particle's in-til...
@ NlnN
best of the NlnN variants – best overall for N>10^4.
@ BestFJ30
the automatic strategy choice that was being made in FJ 3.0 (restricted to strategies that were prese...
@ NlnN4pi
legacy N ln N using 4pi coverage of cylinder
@ NlnNCam
Chan's closest pair method (in a variant with 2pi+minimal extra variant), for use exclusively with th...
@ N2PoorTiled
legacy
@ NlnNCam2pi2R
Chan's closest pair method (in a variant with 2pi+2R coverage), for use exclusively with the Cambridg...
@ N2MHTLazy25
Similar to N2MHTLazy9, but uses tiles of size R/2 and a 5x5 tile grid around the particle.
@ NlnNCam4pi
Chan's closest pair method (in a variant with 4pi coverage), for use exclusively with the Cambridge a...
@ N2MinHeapTiled
faster that N2Tiled above about 500 particles; differs from it by retainig the di(closest j) distance...
RecombinationScheme
The various recombination schemes.
@ E_scheme
summing the 4-momenta
@ BIpt2_scheme
pt^2 weighted recombination of y,phi (and summing of pt's) no preprocessing
@ pt2_scheme
pt^2 weighted recombination of y,phi (and summing of pt's) with preprocessing to make things massless...
@ pt_scheme
pt weighted recombination of y,phi (and summing of pt's) with preprocessing to make things massless b...
@ external_scheme
for the user's external scheme
@ Et_scheme
pt weighted recombination of y,phi (and summing of pt's) with preprocessing to make things massless b...
@ WTA_pt_scheme
pt-based Winner-Takes-All (WTA) recombination: the result of the recombination has the rapidity,...
@ WTA_modp_scheme
mod-p-based Winner-Takes-All (WTA) recombination: the result of the recombination gets the 3-vector d...
@ BIpt_scheme
pt weighted recombination of y,phi (and summing of pt's), with no preprocessing
@ Et2_scheme
pt^2 weighted recombination of y,phi (and summing of pt's) with preprocessing to make things massless...
JetAlgorithm
the various families of jet-clustering algorithm
@ ee_genkt_algorithm
the e+e- genkt algorithm (R > 2 and p=1 gives ee_kt)
@ genkt_algorithm
like the k_t but with distance measures dij = min(kti^{2p},ktj^{2p}) Delta R_{ij}^2 / R^2 diB = 1/kti...
@ undefined_jet_algorithm
the value for the jet algorithm in a JetDefinition for which no algorithm has yet been defined
@ plugin_algorithm
any plugin algorithm supplied by the user
@ ee_kt_algorithm
the e+e- kt algorithm
@ cambridge_algorithm
the longitudinally invariant variant of the cambridge algorithm (aka Aachen algoithm).
@ cambridge_for_passive_algorithm
a version of cambridge with a special distance measure for particles whose pt is < extra_param(); thi...
@ antikt_algorithm
like the k_t but with distance measures dij = min(1/kti^2,1/ktj^2) Delta R_{ij}^2 / R^2 diB = 1/kti^2
@ genkt_for_passive_algorithm
a version of genkt with a special distance measure for particles whose pt is < extra_param() [relevan...
@ kt_algorithm
the longitudinally invariant kt algorithm
string fastjet_version_string()
return a string containing information about the release
const JetAlgorithm aachen_algorithm
provide other possible names for the Cambridge/Aachen algorithm