Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:57:14

0001 //FJSTARTHEADER
0002 // $Id$
0003 //
0004 // Copyright (c) 2005-2025, 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_PSEUDOJET_HH__
0033 #define __FASTJET_PSEUDOJET_HH__
0034 
0035 #include<valarray>
0036 #include<vector>
0037 #include<cassert>
0038 #include<cmath>
0039 #include<iostream>
0040 #include "fastjet/config.h"
0041 #include "fastjet/internal/numconsts.hh"
0042 #include "fastjet/internal/IsBase.hh"
0043 #include "fastjet/SharedPtr.hh"
0044 #include "fastjet/Error.hh"
0045 #include "fastjet/PseudoJetStructureBase.hh"
0046 
0047 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
0048 
0049 //using namespace std;
0050 
0051 /// Used to protect against parton-level events where pt can be zero
0052 /// for some partons, giving rapidity=infinity. KtJet fails in those cases.
0053 const double MaxRap = 1e5;
0054 
0055 /// default value for phi, meaning it (and rapidity) have yet to be calculated) 
0056 const double pseudojet_invalid_phi = -100.0;
0057 const double pseudojet_invalid_rap = -1e200;
0058 
0059 #ifndef __FJCORE__
0060 // forward definition
0061 class ClusterSequenceAreaBase;
0062 #endif  // __FJCORE__
0063 
0064 /// @ingroup basic_classes
0065 /// \class PseudoJet
0066 /// Class to contain pseudojets, including minimal information of use to
0067 /// jet-clustering routines.
0068 class PseudoJet {
0069 
0070  public:
0071   //----------------------------------------------------------------------
0072   /// @name Constructors and destructor
0073   //\{
0074   /// default constructor, which as of FJ3.0 provides an object for
0075   /// which all operations are now valid and which has zero momentum
0076   ///
0077   // (cf. this is actually OK from a timing point of view and in some
0078   // cases better than just having the default constructor for the
0079   // internal shared pointer: see PJtiming.cc and the notes therein)
0080   //
0081   // note: no reset of shared pointers needed
0082   PseudoJet() : _px(0), _py(0), _pz(0), _E(0) {_finish_init(); _reset_indices();}
0083   //PseudoJet() : _px(0), _py(0), _pz(0), _E(0), _phi(pseudojet_invalid_phi), _rap(pseudojet_invalid_rap), _kt2(0) {_reset_indices();}
0084   /// construct a pseudojet from explicit components
0085   PseudoJet(const double px, const double py, const double pz, const double E);
0086 
0087   /// constructor from any object that has px,py,pz,E = some_four_vector[0--3],
0088   #ifndef SWIG
0089   template <class L> PseudoJet(const L & some_four_vector);
0090   #endif
0091   
0092   // Constructor that performs minimal initialisation (only that of
0093   // the shared pointers), of use in certain speed-critical contexts
0094   //
0095   // NB: "dummy" is commented to avoid unused-variable compiler warnings
0096   PseudoJet(bool /* dummy */) {}
0097 
0098 #ifdef FASTJET_HAVE_THREAD_SAFETY
0099   PseudoJet(const PseudoJet &other){ (*this)=other; }
0100   PseudoJet& operator=(const PseudoJet& other);
0101 #endif
0102   
0103   /// default (virtual) destructor
0104   virtual ~PseudoJet(){}
0105 //std::shared_ptr: #ifdef FASTJET_HAVE_THREAD_SAFETY
0106 //std::shared_ptr:     ;
0107 //std::shared_ptr: #else
0108 //std::shared_ptr:     {}
0109 //std::shared_ptr: #endif
0110   //\} ---- end of constructors and destructors --------------------------
0111 
0112   //----------------------------------------------------------------------
0113   /// @name Kinematic access functions
0114   //\{
0115   //----------------------------------------------------------------------
0116   inline double E()   const {return _E;}
0117   inline double e()   const {return _E;} // like CLHEP
0118   inline double px()  const {return _px;}
0119   inline double py()  const {return _py;}
0120   inline double pz()  const {return _pz;}
0121 
0122   /// returns phi (in the range 0..2pi)
0123   inline double phi() const {return phi_02pi();}
0124 
0125   /// returns phi in the range -pi..pi
0126   inline double phi_std()  const {
0127     _ensure_valid_rap_phi();
0128     return _phi > pi ? _phi-twopi : _phi;}
0129 
0130   /// returns phi in the range 0..2pi
0131   inline double phi_02pi() const {
0132     _ensure_valid_rap_phi();
0133     return _phi;
0134   }
0135 
0136   /// returns the rapidity or some large value when the rapidity
0137   /// is infinite
0138   inline double rap() const {
0139     _ensure_valid_rap_phi();
0140     return _rap;
0141   }
0142 
0143   /// the same as rap()
0144   inline double rapidity() const {return rap();} // like CLHEP
0145 
0146   /// returns the pseudo-rapidity or some large value when the
0147   /// rapidity is infinite
0148   double pseudorapidity() const;
0149   double eta() const {return pseudorapidity();}
0150 
0151   /// returns the squared transverse momentum
0152   inline double pt2() const {return _kt2;}
0153   /// returns the scalar transverse momentum
0154   inline double  pt() const {return sqrt(_kt2);} 
0155   /// returns the squared transverse momentum
0156   inline double perp2() const {return _kt2;}  // like CLHEP
0157   /// returns the scalar transverse momentum
0158   inline double  perp() const {return sqrt(_kt2);}    // like CLHEP
0159   /// returns the squared transverse momentum
0160   inline double kt2() const {return _kt2;} // for bkwds compatibility
0161 
0162   /// returns the squared invariant mass // like CLHEP
0163   inline double  m2() const {return (_E+_pz)*(_E-_pz)-_kt2;}    
0164   /// returns the invariant mass 
0165   /// (If m2() is negative then -sqrt(-m2()) is returned, as in CLHEP)
0166   inline double  m() const;    
0167 
0168   /// returns the squared transverse mass = kt^2+m^2
0169   inline double mperp2() const {return (_E+_pz)*(_E-_pz);}
0170   /// returns the transverse mass = sqrt(kt^2+m^2)
0171   inline double mperp() const {return sqrt(std::abs(mperp2()));}
0172   /// returns the squared transverse mass = kt^2+m^2
0173   inline double mt2() const {return (_E+_pz)*(_E-_pz);}
0174   /// returns the transverse mass = sqrt(kt^2+m^2)
0175   inline double mt() const {return sqrt(std::abs(mperp2()));}
0176 
0177   /// return the squared 3-vector modulus = px^2+py^2+pz^2
0178   inline double modp2() const {return _kt2+_pz*_pz;}
0179   /// return the 3-vector modulus = sqrt(px^2+py^2+pz^2)
0180   inline double modp() const {return sqrt(_kt2+_pz*_pz);}
0181 
0182   /// return the transverse energy
0183   inline double Et() const {return (_kt2==0) ? 0.0 : _E/sqrt(1.0+_pz*_pz/_kt2);}
0184   /// return the transverse energy squared
0185   inline double Et2() const {return (_kt2==0) ? 0.0 : _E*_E/(1.0+_pz*_pz/_kt2);}
0186 
0187   /// cos of the polar angle
0188   /// should we have: min(1.0,max(-1.0,_pz/sqrt(modp2()))); 
0189   inline double cos_theta() const {
0190     return std::min(1.0, std::max(-1.0, _pz/sqrt(modp2())));
0191   }
0192   /// polar angle
0193   inline double theta() const { return acos(cos_theta()); }
0194 
0195   /// returns component i, where X==0, Y==1, Z==2, E==3
0196   double operator () (int i) const ; 
0197   /// returns component i, where X==0, Y==1, Z==2, E==3
0198   inline double operator [] (int i) const { return (*this)(i); }; // this too
0199 
0200 
0201 
0202   /// returns kt distance (R=1) between this jet and another
0203   double kt_distance(const PseudoJet & other) const;
0204 
0205   /// returns squared cylinder (rap-phi) distance between this jet and another
0206   double plain_distance(const PseudoJet & other) const;
0207   /// returns squared cylinder (rap-phi) distance between this jet and
0208   /// another
0209   inline double squared_distance(const PseudoJet & other) const {
0210     return plain_distance(other);}
0211 
0212   /// return the cylinder (rap-phi) distance between this jet and another,
0213   /// \f$\Delta_R = \sqrt{\Delta y^2 + \Delta \phi^2}\f$.
0214   inline double delta_R(const PseudoJet & other) const {
0215     return sqrt(squared_distance(other));
0216   }
0217 
0218   /// returns other.phi() - this.phi(), constrained to be in 
0219   /// range -pi .. pi
0220   double delta_phi_to(const PseudoJet & other) const;
0221 
0222   //// this seemed to compile except if it was used
0223   //friend inline double 
0224   //  kt_distance(const PseudoJet & jet1, const PseudoJet & jet2) { 
0225   //                                      return jet1.kt_distance(jet2);}
0226 
0227   /// returns distance between this jet and the beam
0228   inline double beam_distance() const {return _kt2;}
0229 
0230   /// return a valarray containing the four-momentum (components 0-2
0231   /// are 3-mom, component 3 is energy).
0232   std::valarray<double> four_mom() const;
0233 
0234   //\}  ------- end of kinematic access functions
0235 
0236   // taken from CLHEP
0237   enum { X=0, Y=1, Z=2, T=3, NUM_COORDINATES=4, SIZE=NUM_COORDINATES };
0238 
0239 
0240   //----------------------------------------------------------------------
0241   /// @name Kinematic modification functions
0242   //\{
0243   //----------------------------------------------------------------------
0244   /// transform this jet (given in the rest frame of prest) into a jet
0245   /// in the lab frame
0246   PseudoJet & boost(const PseudoJet & prest);
0247   /// transform this jet (given in lab) into a jet in the rest
0248   /// frame of prest
0249   PseudoJet & unboost(const PseudoJet & prest);
0250 
0251   PseudoJet & operator*=(double);
0252   PseudoJet & operator/=(double);
0253   PseudoJet & operator+=(const PseudoJet &);
0254   PseudoJet & operator-=(const PseudoJet &);
0255 
0256 //std::shared_ptr: #ifdef FASTJET_HAVE_THREAD_SAFETY
0257 //std::shared_ptr:   /// overload the assignment through the = operator
0258 //std::shared_ptr:   ///
0259 //std::shared_ptr:   /// this is needed to make sure that release_from_cs is called
0260 //std::shared_ptr:   /// before copying the structure shared pointer!
0261 //std::shared_ptr:   void operator=(const PseudoJet &other){
0262 //std::shared_ptr:     _release_jet_from_cs();
0263 //std::shared_ptr:     _structure = other._structure;
0264 //std::shared_ptr:     _user_info = other._user_info;
0265 //std::shared_ptr: 
0266 //std::shared_ptr:     _px = other._px;
0267 //std::shared_ptr:     _py = other._py;
0268 //std::shared_ptr:     _pz = other._pz;
0269 //std::shared_ptr:     _E  = other._E;
0270 //std::shared_ptr: 
0271 //std::shared_ptr:     _phi = other._phi;
0272 //std::shared_ptr:     _rap = other._rap;
0273 //std::shared_ptr:     _kt2  = other._kt2;
0274 //std::shared_ptr:     
0275 //std::shared_ptr:     _cluster_hist_index = other._cluster_hist_index;
0276 //std::shared_ptr:     _user_index = other._user_index;
0277 //std::shared_ptr:   }
0278 //std::shared_ptr: 
0279 //std::shared_ptr:   /// force resetting the structure pointer to an empty structure
0280 //std::shared_ptr:   ///
0281 //std::shared_ptr:   /// THIS IS STRICTLY MEANT FOR INTERNAL USAGE IN SELF-DELETING
0282 //std::shared_ptr:   /// ClusterSequences. IT SHOULD NOT BE USED BY END-USERS.
0283 //std::shared_ptr:   void force_reset_structure(){
0284 //std::shared_ptr:     _structure.reset();
0285 //std::shared_ptr:   }  
0286 //std::shared_ptr: #endif
0287 
0288   /// reset the 4-momentum according to the supplied components and
0289   /// put the user and history indices back to their default values
0290   inline void reset(double px, double py, double pz, double E);
0291 
0292   /// reset the PseudoJet to be equal to psjet (including its
0293   /// indices); NB if the argument is derived from a PseudoJet then
0294   /// the "reset" used will be the templated version
0295   ///
0296   /// Note: this is included on top of the templated version because
0297   /// PseudoJet is not "derived" from PseudoJet, so the templated
0298   /// reset would not handle this case properly.
0299   inline void reset(const PseudoJet & psjet) {
0300     (*this) = psjet;
0301   }
0302 
0303   /// reset the 4-momentum according to the supplied generic 4-vector
0304   /// (accessible via indexing, [0]==px,...[3]==E) and put the user
0305   /// and history indices back to their default values.
0306 #ifndef SWIG
0307   template <class L> inline void reset(const L & some_four_vector) {
0308     // check if some_four_vector can be cast to a PseudoJet
0309     //
0310     // Note that a regular dynamic_cast would not work here because
0311     // there is no guarantee that L is polymorphic. We use a more
0312     // complex construct here that works also in such a case. As for
0313     // dynamic_cast, NULL is returned if L is not derived from
0314     // PseudoJet
0315     //
0316     // Note the explicit request for fastjet::cast_if_derived; when
0317     // combining fastjet and fjcore, this avoids ambiguity in which of
0318     // the two cast_if_derived calls to use.
0319     const PseudoJet * pj = fastjet::cast_if_derived<const PseudoJet>(&some_four_vector);
0320 
0321     if (pj){
0322       (*this) = *pj;
0323     } else {
0324       reset(some_four_vector[0], some_four_vector[1],
0325         some_four_vector[2], some_four_vector[3]);
0326     }
0327   }
0328 #endif // SWIG
0329 
0330   /// reset the PseudoJet according to the specified pt, rapidity,
0331   /// azimuth and mass (also resetting indices, etc.)
0332   /// (phi should satisfy -2pi<phi<4pi)
0333   inline void reset_PtYPhiM(double pt_in, double y_in, double phi_in, double m_in=0.0) {
0334     reset_momentum_PtYPhiM(pt_in, y_in, phi_in, m_in);
0335     _reset_indices();
0336     //std::shared_ptr: _reset_shared_pointers();
0337   }
0338 
0339   /// reset the 4-momentum according to the supplied components 
0340   /// but leave all other information (indices, user info, etc.)
0341   /// untouched
0342   inline void reset_momentum(double px, double py, double pz, double E);
0343 
0344   /// reset the 4-momentum according to the components of the supplied
0345   /// PseudoJet, including cached components; note that the template
0346   /// version (below) will be called for classes derived from PJ.
0347   inline void reset_momentum(const PseudoJet & pj);
0348 
0349   /// reset the 4-momentum according to the specified pt, rapidity,
0350   /// azimuth and mass (phi should satisfy -2pi<phi<4pi)
0351   void reset_momentum_PtYPhiM(double pt, double y, double phi, double m=0.0);
0352 
0353   /// reset the 4-momentum according to the supplied generic 4-vector
0354   /// (accessible via indexing, [0]==px,...[3]==E), but leave all
0355   /// other information (indices, user info, etc.)  untouched
0356   template <class L> inline void reset_momentum(const L & some_four_vector) {
0357     reset_momentum(some_four_vector[0], some_four_vector[1],
0358            some_four_vector[2], some_four_vector[3]);
0359   }
0360 
0361   /// in some cases when setting a 4-momentum, the user/program knows
0362   /// what rapidity and azimuth are associated with that 4-momentum;
0363   /// by calling this routine the user can provide the information
0364   /// directly to the PseudoJet and avoid expensive rap-phi
0365   /// recalculations.
0366   ///
0367   /// - \param rap  rapidity
0368   /// - \param phi  (in range -twopi...4*pi)
0369   ///
0370   /// USE WITH CAUTION: there are no checks that the rapidity and
0371   /// azimuth supplied are sensible, nor does this reset the
0372   /// 4-momentum components if things don't match.
0373   void set_cached_rap_phi(double rap, double phi);
0374 
0375 
0376   //\} --- end of kin mod functions ------------------------------------
0377 
0378   //----------------------------------------------------------------------
0379   /// @name User index functions
0380   ///
0381   /// To allow the user to set and access an integer index which can
0382   /// be exploited by the user to associate extra information with a
0383   /// particle/jet (for example pdg id, or an indication of a
0384   /// particle's origin within the user's analysis)
0385   //
0386   //\{
0387 
0388   /// return the user_index, 
0389   inline int user_index() const {return _user_index;}
0390   /// set the user_index, intended to allow the user to add simple
0391   /// identifying information to a particle/jet
0392   inline void set_user_index(const int index) {_user_index = index;}
0393 
0394   //\} ----- end of use index functions ---------------------------------
0395 
0396   //----------------------------------------------------------------------
0397   /// @name User information types and functions
0398   ///
0399   /// Allows PseudoJet to carry extra user info (as an object derived from
0400   /// UserInfoBase).
0401   //\{
0402 
0403   /// @ingroup user_info
0404   /// \class UserInfoBase
0405   /// a base class to hold extra user information in a PseudoJet
0406   ///
0407   /// This is a base class to help associate extra user information
0408   /// with a jet. The user should store their information in a class
0409   /// derived from this. This allows information of arbitrary
0410   /// complexity to be easily associated with a PseudoJet (in contrast
0411   /// to the user index). For example, in a Monte Carlo simulation,
0412   /// the user information might include the PDG ID, and the position
0413   /// of the production vertex for the particle.
0414   ///
0415   /// The PseudoJet is able to store a shared pointer to any object
0416   /// derived from UserInfo. The use of a shared pointer frees the
0417   /// user of the need to handle the memory management associated with
0418   /// the information.
0419   ///
0420   /// Having the user information derive from a common base class also
0421   /// facilitates dynamic casting, etc.
0422   ///
0423   class UserInfoBase{
0424   public:
0425     // dummy ctor
0426     UserInfoBase(){};
0427 
0428     // dummy virtual dtor
0429     // makes it polymorphic to allow for dynamic_cast
0430     virtual ~UserInfoBase(){}; 
0431   };
0432 
0433   /// error class to be thrown if accessing user info when it doesn't
0434   /// exist
0435   class InexistentUserInfo : public Error {
0436   public:
0437     InexistentUserInfo();
0438   };
0439 
0440   /// sets the internal shared pointer to the user information.
0441   ///
0442   /// Note that the PseudoJet will now _own_ the pointer, and delete
0443   /// the corresponding object when it (the jet, and any copies of the jet)
0444   /// goes out of scope. 
0445   void set_user_info(UserInfoBase * user_info_in) {
0446     _user_info.reset(user_info_in);
0447   }
0448 
0449   /// returns a reference to the dynamic cast conversion of user_info
0450   /// to type L.
0451   ///
0452   /// Usage: suppose you have previously set the user info with a pointer
0453   /// to an object of type MyInfo, 
0454   ///
0455   ///   class MyInfo: public PseudoJet::UserInfoBase {
0456   ///      MyInfo(int id) : _pdg_id(id);
0457   ///      int pdg_id() const {return _pdg_id;}
0458   ///      int _pdg_id;
0459   ///   };
0460   ///
0461   ///   PseudoJet particle(...);
0462   ///   particle.set_user_info(new MyInfo(its_pdg_id));
0463   ///
0464   /// Then you would access that pdg_id() as
0465   ///
0466   ///   particle.user_info<MyInfo>().pdg_id();
0467   ///
0468   /// It's overkill for just a single integer, but scales easily to
0469   /// more extensive information.
0470   ///
0471   /// Note that user_info() throws an InexistentUserInfo() error if
0472   /// there is no user info; throws a std::bad_cast if the conversion
0473   /// doesn't work
0474   ///
0475   /// If this behaviour does not fit your needs, use instead the the
0476   /// user_info_ptr() or user_info_shared_ptr() member functions.
0477   template<class L>
0478   const L & user_info() const{
0479     if (_user_info.get() == 0) throw InexistentUserInfo();
0480     return dynamic_cast<const L &>(* _user_info.get());
0481   }
0482 
0483   /// returns true if the PseudoJet has user information
0484   bool has_user_info() const{
0485     return _user_info.get();
0486   }
0487 
0488   /// returns true if the PseudoJet has user information than can be
0489   /// cast to the template argument type.
0490   template<class L>
0491   bool has_user_info() const{
0492     return _user_info.get() && dynamic_cast<const L *>(_user_info.get());
0493   }
0494 
0495   /// retrieve a pointer to the (const) user information
0496   const UserInfoBase * user_info_ptr() const{
0497     // the line below is not needed since the next line would anyway
0498     // return NULL in that case
0499     //if (!_user_info) return NULL;
0500     return _user_info.get();
0501   }
0502 
0503 
0504   /// retrieve a (const) shared pointer to the user information
0505   const SharedPtr<UserInfoBase> & user_info_shared_ptr() const{
0506     return _user_info;
0507   }
0508 
0509   /// retrieve a (non-const) shared pointer to the user information;
0510   /// you can use this, for example, to set the shared pointer, eg
0511   ///
0512   /// \code
0513   ///   p2.user_info_shared_ptr() = p1.user_info_shared_ptr();
0514   /// \endcode
0515   ///
0516   /// or 
0517   ///
0518   /// \code
0519   ///   SharedPtr<PseudoJet::UserInfoBase> info_shared(new MyInfo(...));
0520   ///   p2.user_info_shared_ptr() = info_shared;
0521   /// \endcode
0522   SharedPtr<UserInfoBase> & user_info_shared_ptr(){
0523     return _user_info;
0524   }
0525 
0526   void set_user_info_shared_ptr(const SharedPtr<UserInfoBase> & user_info_in) {
0527     _user_info = user_info_in;
0528   }
0529 
0530   // \} --- end of extra info functions ---------------------------------
0531 
0532   //----------------------------------------------------------------------
0533   /// @name Description
0534   ///
0535   /// Since a PseudoJet can have a structure that contains a variety
0536   /// of information, we provide a description that allows one to check
0537   /// exactly what kind of PseudoJet we are dealing with
0538   //
0539   //\{
0540 
0541   /// return a string describing what kind of PseudoJet we are dealing with 
0542   std::string description() const;
0543 
0544   //\} ----- end of description functions ---------------------------------
0545 
0546   //-------------------------------------------------------------
0547   /// @name Access to the associated ClusterSequence object.
0548   ///
0549   /// In addition to having kinematic information, jets may contain a
0550   /// reference to an associated ClusterSequence (this is the case,
0551   /// for example, if the jet has been returned by a ClusterSequence
0552   /// member function).
0553   //\{
0554   //-------------------------------------------------------------
0555   /// returns true if this PseudoJet has an associated ClusterSequence.
0556   bool has_associated_cluster_sequence() const;
0557   /// shorthand for has_associated_cluster_sequence()
0558   bool has_associated_cs() const {return has_associated_cluster_sequence();}
0559 
0560   /// returns true if this PseudoJet has an associated and still
0561   /// valid(ated) ClusterSequence.
0562   bool has_valid_cluster_sequence() const;
0563   /// shorthand for has_valid_cluster_sequence()
0564   bool has_valid_cs() const {return has_valid_cluster_sequence();}
0565 
0566   /// get a (const) pointer to the parent ClusterSequence (NULL if
0567   /// inexistent)
0568   const ClusterSequence* associated_cluster_sequence() const;
0569   // shorthand for associated_cluster_sequence()
0570   const ClusterSequence* associated_cs() const {return associated_cluster_sequence();}
0571 
0572   /// if the jet has a valid associated cluster sequence then return a
0573   /// pointer to it; otherwise throw an error
0574   inline const ClusterSequence * validated_cluster_sequence() const {
0575     return validated_cs();
0576   }
0577   /// shorthand for validated_cluster_sequence()
0578   const ClusterSequence * validated_cs() const;
0579 
0580 #ifndef __FJCORE__
0581   /// if the jet has valid area information then return a pointer to
0582   /// the associated ClusterSequenceAreaBase object; otherwise throw an error
0583   inline const ClusterSequenceAreaBase * validated_cluster_sequence_area_base() const {
0584     return validated_csab();
0585   }
0586 
0587   /// shorthand for validated_cluster_sequence_area_base()
0588   const ClusterSequenceAreaBase * validated_csab() const;
0589 #endif  //  __FJCORE__
0590 
0591   //\}
0592 
0593   //-------------------------------------------------------------
0594   /// @name Access to the associated PseudoJetStructureBase object.
0595   ///
0596   /// In addition to having kinematic information, jets may contain a
0597   /// reference to an associated ClusterSequence (this is the case,
0598   /// for example, if the jet has been returned by a ClusterSequence
0599   /// member function).
0600   //\{
0601   //-------------------------------------------------------------
0602 
0603   /// set the associated structure
0604   void set_structure_shared_ptr(const SharedPtr<PseudoJetStructureBase> &structure_in);
0605 
0606   /// return true if there is some structure associated with this PseudoJet
0607   bool has_structure() const;
0608 
0609   /// return a pointer to the structure (of type
0610   /// PseudoJetStructureBase*) associated with this PseudoJet.
0611   ///
0612   /// return NULL if there is no associated structure
0613   const PseudoJetStructureBase* structure_ptr() const;
0614   
0615   /// return a non-const pointer to the structure (of type
0616   /// PseudoJetStructureBase*) associated with this PseudoJet.
0617   ///
0618   /// return NULL if there is no associated structure
0619   ///
0620   /// Only use this if you know what you are doing. In any case,
0621   /// prefer the 'structure_ptr()' (the const version) to this method,
0622   /// unless you really need a write access to the PseudoJet's
0623   /// underlying structure.
0624   PseudoJetStructureBase* structure_non_const_ptr();
0625   
0626   /// return a pointer to the structure (of type
0627   /// PseudoJetStructureBase*) associated with this PseudoJet.
0628   ///
0629   /// throw an error if there is no associated structure
0630   const PseudoJetStructureBase* validated_structure_ptr() const;
0631   
0632   /// return a reference to the shared pointer to the
0633   /// PseudoJetStructureBase associated with this PseudoJet
0634   const SharedPtr<PseudoJetStructureBase> & structure_shared_ptr() const;
0635 
0636   /// returns a reference to the structure casted to the requested
0637   /// structure type
0638   ///
0639   /// If there is no structure associated, an Error is thrown.
0640   /// If the type is not met, a std::bad_cast error is thrown.
0641   template<typename StructureType>
0642   const StructureType & structure() const;
0643 
0644   /// check if the PseudoJet has the structure resulting from a Transformer 
0645   /// (that is, its structure is compatible with a Transformer::StructureType).
0646   /// If there is no structure, false is returned.
0647   template<typename TransformerType>
0648   bool has_structure_of() const;
0649 
0650   /// this is a helper to access any structure created by a Transformer 
0651   /// (that is, of type Transformer::StructureType).
0652   ///
0653   /// If there is no structure, or if the structure is not compatible
0654   /// with TransformerType, an error is thrown.
0655   template<typename TransformerType>
0656   const typename TransformerType::StructureType & structure_of() const;
0657 
0658   //\}
0659 
0660   //-------------------------------------------------------------
0661   /// @name Methods for access to information about jet structure
0662   ///
0663   /// These allow access to jet constituents, and other jet
0664   /// subtructure information. They only work if the jet is associated
0665   /// with a ClusterSequence.
0666   //-------------------------------------------------------------
0667   //\{
0668 
0669   /// check if it has been recombined with another PseudoJet in which
0670   /// case, return its partner through the argument. Otherwise,
0671   /// 'partner' is set to 0.
0672   ///
0673   /// an Error is thrown if this PseudoJet has no currently valid
0674   /// associated ClusterSequence
0675   virtual bool has_partner(PseudoJet &partner) const;
0676 
0677   /// check if it has been recombined with another PseudoJet in which
0678   /// case, return its child through the argument. Otherwise, 'child'
0679   /// is set to 0.
0680   /// 
0681   /// an Error is thrown if this PseudoJet has no currently valid
0682   /// associated ClusterSequence
0683   virtual bool has_child(PseudoJet &child) const;
0684 
0685   /// check if it is the product of a recombination, in which case
0686   /// return the 2 parents through the 'parent1' and 'parent2'
0687   /// arguments. Otherwise, set these to 0.
0688   ///
0689   /// an Error is thrown if this PseudoJet has no currently valid
0690   /// associated ClusterSequence
0691   virtual bool has_parents(PseudoJet &parent1, PseudoJet &parent2) const;
0692 
0693   /// check if the current PseudoJet contains the one passed as
0694   /// argument.
0695   ///
0696   /// an Error is thrown if this PseudoJet has no currently valid
0697   /// associated ClusterSequence
0698   virtual bool contains(const PseudoJet &constituent) const;
0699 
0700   /// check if the current PseudoJet is contained in the one passed as
0701   /// argument.
0702   ///
0703   /// an Error is thrown if this PseudoJet has no currently valid
0704   /// associated ClusterSequence
0705   virtual bool is_inside(const PseudoJet &jet) const;
0706 
0707 
0708   /// returns true if the PseudoJet has constituents
0709   virtual bool has_constituents() const;
0710 
0711   /// retrieve the constituents. 
0712   ///
0713   /// an Error is thrown if this PseudoJet has no currently valid
0714   /// associated ClusterSequence or other substructure information
0715   virtual std::vector<PseudoJet> constituents() const;
0716 
0717 
0718   /// returns true if the PseudoJet has support for exclusive subjets
0719   virtual bool has_exclusive_subjets() const;
0720 
0721   /// return a vector of all subjets of the current jet (in the sense
0722   /// of the exclusive algorithm) that would be obtained when running
0723   /// the algorithm with the given dcut. 
0724   ///
0725   /// Time taken is O(m ln m), where m is the number of subjets that
0726   /// are found. If m gets to be of order of the total number of
0727   /// constituents in the jet, this could be substantially slower than
0728   /// just getting that list of constituents.
0729   ///
0730   /// an Error is thrown if this PseudoJet has no currently valid
0731   /// associated ClusterSequence
0732   std::vector<PseudoJet> exclusive_subjets (const double dcut) const;
0733 
0734   /// return the size of exclusive_subjets(...); still n ln n with same
0735   /// coefficient, but marginally more efficient than manually taking
0736   /// exclusive_subjets.size()
0737   ///
0738   /// an Error is thrown if this PseudoJet has no currently valid
0739   /// associated ClusterSequence
0740   int n_exclusive_subjets(const double dcut) const;
0741 
0742   /// return the list of subjets obtained by unclustering the supplied
0743   /// jet down to nsub subjets. Throws an error if there are fewer than
0744   /// nsub particles in the jet.
0745   ///
0746   /// For ClusterSequence type jets, requires nsub ln nsub time
0747   ///
0748   /// An Error is thrown if this PseudoJet has no currently valid
0749   /// associated ClusterSequence
0750   std::vector<PseudoJet> exclusive_subjets (int nsub) const;
0751 
0752   /// return the list of subjets obtained by unclustering the supplied
0753   /// jet down to nsub subjets (or all constituents if there are fewer
0754   /// than nsub).
0755   ///
0756   /// For ClusterSequence type jets, requires nsub ln nsub time
0757   ///
0758   /// An Error is thrown if this PseudoJet has no currently valid
0759   /// associated ClusterSequence
0760   std::vector<PseudoJet> exclusive_subjets_up_to (int nsub) const;
0761 
0762   /// Returns the dij that was present in the merging nsub+1 -> nsub 
0763   /// subjets inside this jet.
0764   ///
0765   /// Returns 0 if there were nsub or fewer constituents in the jet.
0766   ///
0767   /// an Error is thrown if this PseudoJet has no currently valid
0768   /// associated ClusterSequence
0769   double exclusive_subdmerge(int nsub) const;
0770 
0771   /// Returns the maximum dij that occurred in the whole event at the
0772   /// stage that the nsub+1 -> nsub merge of subjets occurred inside 
0773   /// this jet.
0774   ///
0775   /// Returns 0 if there were nsub or fewer constituents in the jet.
0776   ///
0777   /// an Error is thrown if this PseudoJet has no currently valid
0778   /// associated ClusterSequence
0779   double exclusive_subdmerge_max(int nsub) const;
0780 
0781 
0782   /// returns true if a jet has pieces
0783   ///
0784   /// By default a single particle or a jet coming from a
0785   /// ClusterSequence have no pieces and this methos will return false.
0786   ///
0787   /// In practice, this is equivalent to have an structure of type
0788   /// CompositeJetStructure.
0789   virtual bool has_pieces() const;
0790 
0791 
0792   /// retrieve the pieces that make up the jet. 
0793   ///
0794   /// If the jet does not support pieces, an error is throw
0795   virtual std::vector<PseudoJet> pieces() const;
0796 
0797 
0798   // the following ones require a computation of the area in the
0799   // parent ClusterSequence (See ClusterSequenceAreaBase for details)
0800   //------------------------------------------------------------------
0801 #ifndef __FJCORE__
0802 
0803   /// check if it has a defined area
0804   virtual bool has_area() const;
0805 
0806   /// return the jet (scalar) area.
0807   /// throws an Error if there is no support for area in the parent CS
0808   virtual double area() const;
0809 
0810   /// return the error (uncertainty) associated with the determination
0811   /// of the area of this jet.
0812   /// throws an Error if there is no support for area in the parent CS
0813   virtual double area_error() const;
0814 
0815   /// return the jet 4-vector area.
0816   /// throws an Error if there is no support for area in the parent CS
0817   virtual PseudoJet area_4vector() const;
0818 
0819   /// true if this jet is made exclusively of ghosts.
0820   /// throws an Error if there is no support for area in the parent CS
0821   virtual bool is_pure_ghost() const;
0822 
0823 #endif  // __FJCORE__
0824   //\} --- end of jet structure -------------------------------------
0825 
0826 
0827 
0828   //----------------------------------------------------------------------
0829   /// @name Members mainly intended for internal use
0830   //----------------------------------------------------------------------
0831   //\{
0832   /// return the cluster_hist_index, intended to be used by clustering
0833   /// routines.
0834   inline int cluster_hist_index() const {return _cluster_hist_index;}
0835   /// set the cluster_hist_index, intended to be used by clustering routines.
0836   inline void set_cluster_hist_index(const int index) {_cluster_hist_index = index;}
0837 
0838   /// alternative name for cluster_hist_index() [perhaps more meaningful]
0839   inline int cluster_sequence_history_index() const {
0840     return cluster_hist_index();}
0841   /// alternative name for set_cluster_hist_index(...) [perhaps more
0842   /// meaningful]
0843   inline void set_cluster_sequence_history_index(const int index) {
0844     set_cluster_hist_index(index);}
0845 
0846   //\} ---- end of internal use functions ---------------------------
0847 
0848  protected:  
0849 
0850   SharedPtr<PseudoJetStructureBase> _structure;
0851   SharedPtr<UserInfoBase> _user_info;
0852 
0853 
0854  private: 
0855   // NB: following order must be kept for things to behave sensibly...
0856   double _px,_py,_pz,_E;
0857   mutable double _phi, _rap;
0858   double _kt2; 
0859   int    _cluster_hist_index, _user_index;
0860 
0861 #ifdef FASTJET_HAVE_THREAD_SAFETY
0862   enum {
0863     Init_Done=1,
0864     Init_NotDone=0,
0865     Init_InProgress=-1
0866   };
0867 
0868   mutable std::atomic<int> _init_status;
0869 #endif
0870   
0871   /// calculate phi, rap, kt2 based on the 4-momentum components
0872   void _finish_init();
0873   /// set the indices to default values
0874   void _reset_indices();
0875   
0876 //std::shared_ptr: /// reset the shared pointers to empty ones
0877 //std::shared_ptr: void _reset_shared_pointers();
0878 //std::shared_ptr: 
0879 //std::shared_ptr: #ifdef FASTJET_HAVE_THREAD_SAFETY
0880 //std::shared_ptr:   /// For jets associated with a ClusterSequence, this will "free" the
0881 //std::shared_ptr:   /// jet from the ClusterSequence. This means that, for self-deleting
0882 //std::shared_ptr:   /// cluster sequences, it will reset the structure pointer and check
0883 //std::shared_ptr:   /// if the CS needs to be deleted.
0884 //std::shared_ptr:   ///
0885 //std::shared_ptr:   /// This is the replacement mechanism for self-deleting cs (with
0886 //std::shared_ptr:   /// set_count not working with std shared_ptr) and...
0887 //std::shared_ptr:   ///
0888 //std::shared_ptr:   /// IT HAS TO BE CALLED BEFORE ANY CHANGE OF THE JET STRUCTURE
0889 //std::shared_ptr:   /// POINTER
0890 //std::shared_ptr:   void _release_jet_from_cs();
0891 //std::shared_ptr: #endif //FASTJET_HAVE_THREAD_SAFETY
0892 
0893   /// ensure that the internal values for rapidity and phi 
0894   /// correspond to 4-momentum structure
0895 #ifdef FASTJET_HAVE_THREAD_SAFETY
0896   void _ensure_valid_rap_phi() const;
0897 #else
0898   inline void _ensure_valid_rap_phi() const{
0899     if (_phi == pseudojet_invalid_phi) _set_rap_phi();
0900   }
0901 #endif
0902   
0903   /// set cached rapidity and phi values
0904   void _set_rap_phi() const;
0905 
0906   // needed for operator* to have access to _ensure_valid_rap_phi()
0907   friend PseudoJet operator*(double, const PseudoJet &);
0908 };
0909 
0910 
0911 //----------------------------------------------------------------------
0912 // routines for basic binary operations
0913 
0914 PseudoJet operator+(const PseudoJet &, const PseudoJet &);
0915 PseudoJet operator-(const PseudoJet &, const PseudoJet &);
0916 PseudoJet operator*(double, const PseudoJet &);
0917 PseudoJet operator*(const PseudoJet &, double);
0918 PseudoJet operator/(const PseudoJet &, double);
0919 
0920 /// returns true if the 4 momentum components of the two PseudoJets
0921 /// are identical and all the internal indices (user, cluster_history)
0922 /// + structure and user-info shared pointers are too
0923 bool operator==(const PseudoJet &, const PseudoJet &);
0924 
0925 /// inequality test which is exact opposite of operator==
0926 inline bool operator!=(const PseudoJet & a, const PseudoJet & b) {return !(a==b);}
0927 
0928 /// Can only be used with val=0 and tests whether all four
0929 /// momentum components are equal to val (=0.0)
0930 bool operator==(const PseudoJet & jet, const double val);
0931 inline bool operator==(const double val, const PseudoJet & jet) {return jet == val;}
0932 
0933 /// Can only be used with val=0 and tests whether at least one of the
0934 /// four momentum components is different from val (=0.0)
0935 inline bool operator!=(const PseudoJet & a, const double val)  {return !(a==val);}
0936 inline bool operator!=( const double val, const PseudoJet & a) {return !(a==val);}
0937 
0938 /// returns the 4-vector dot product of a and b
0939 inline double dot_product(const PseudoJet & a, const PseudoJet & b) {
0940   return a.E()*b.E() - a.px()*b.px() - a.py()*b.py() - a.pz()*b.pz();
0941 }
0942 
0943 /// returns the cosine of the angle between a and b
0944 inline double cos_theta(const PseudoJet & a, const PseudoJet & b) {
0945   double dot_3d = a.px()*b.px() + a.py()*b.py() + a.pz()*b.pz();
0946   return std::min(1.0, std::max(-1.0, dot_3d/sqrt(a.modp2()*b.modp2())));
0947 }
0948 
0949 /// returns the angle between a and b
0950 inline double theta(const PseudoJet & a, const PseudoJet & b) {
0951   return acos(cos_theta(a,b));
0952 }
0953 
0954 /// returns true if the momenta of the two input jets are identical
0955 bool have_same_momentum(const PseudoJet &, const PseudoJet &);
0956 
0957 /// return a pseudojet with the given pt, y, phi and mass
0958 /// (phi should satisfy -2pi<phi<4pi)
0959 PseudoJet PtYPhiM(double pt, double y, double phi, double m = 0.0);
0960 
0961 //----------------------------------------------------------------------
0962 // Routines to do with providing sorted arrays of vectors.
0963 
0964 /// return a vector of jets sorted into decreasing transverse momentum
0965 std::vector<PseudoJet> sorted_by_pt(const std::vector<PseudoJet> & jets);
0966 
0967 /// return a vector of jets sorted into increasing rapidity
0968 std::vector<PseudoJet> sorted_by_rapidity(const std::vector<PseudoJet> & jets);
0969 
0970 /// return a vector of jets sorted into decreasing energy
0971 std::vector<PseudoJet> sorted_by_E(const std::vector<PseudoJet> & jets);
0972 
0973 /// return a vector of jets sorted into increasing pz
0974 std::vector<PseudoJet> sorted_by_pz(const std::vector<PseudoJet> & jets);
0975 
0976 //----------------------------------------------------------------------
0977 // some code to help sorting
0978 
0979 /// sort the indices so that values[indices[0->n-1]] is sorted
0980 /// into increasing order 
0981 void sort_indices(std::vector<int> & indices, 
0982           const std::vector<double> & values);
0983 
0984 /// given a vector of values with a one-to-one correspondence with the
0985 /// vector of objects, sort objects into an order such that the
0986 /// associated values would be in increasing order (but don't actually
0987 /// touch the values vector in the process).
0988 template<class T> std::vector<T> objects_sorted_by_values(const std::vector<T> & objects, 
0989                           const std::vector<double> & values) {
0990   //assert(objects.size() == values.size());
0991   if (objects.size() != values.size()){
0992     throw Error("fastjet::objects_sorted_by_values(...): the size of the 'objects' vector must match the size of the 'values' vector");
0993   }
0994   
0995   // get a vector of indices
0996   std::vector<int> indices(values.size());
0997   for (size_t i = 0; i < indices.size(); i++) {indices[i] = i;}
0998   
0999   // sort the indices
1000   sort_indices(indices, values);
1001   
1002   // copy the objects 
1003   std::vector<T> objects_sorted(objects.size());
1004   
1005   // place the objects in the correct order
1006   for (size_t i = 0; i < indices.size(); i++) {
1007     objects_sorted[i] = objects[indices[i]];
1008   }
1009 
1010   return objects_sorted;
1011 }
1012 
1013 /// \if internal_doc
1014 /// @ingroup internal
1015 /// \class IndexedSortHelper
1016 /// a class that helps us carry out indexed sorting.
1017 /// \endif
1018 class IndexedSortHelper {
1019 public:
1020   inline IndexedSortHelper (const std::vector<double> * reference_values) {
1021     _ref_values = reference_values;
1022   };
1023   inline int operator() (const int i1, const int i2) const {
1024     return  (*_ref_values)[i1] < (*_ref_values)[i2];
1025   };
1026 private:
1027   const std::vector<double> * _ref_values;
1028 };
1029 
1030 
1031 //----------------------------------------------------------------------
1032 /// constructor from any object that has px,py,pz,E = some_four_vector[0--3],
1033 // NB: do not know if it really needs to be inline, but when it wasn't
1034 //     linking failed with g++ (who knows what was wrong...)
1035 #ifndef SWIG
1036 template <class L> inline  PseudoJet::PseudoJet(const L & some_four_vector) {
1037   reset(some_four_vector);
1038 }
1039 #endif
1040 
1041 //----------------------------------------------------------------------
1042 inline void PseudoJet::_reset_indices() { 
1043   set_cluster_hist_index(-1);
1044   set_user_index(-1);
1045 
1046   _structure.reset();
1047   _user_info.reset();
1048 }
1049 
1050 //std::shared_ptr: inline void PseudoJet::_reset_shared_pointers() {
1051 //std::shared_ptr: #ifdef FASTJET_HAVE_THREAD_SAFETY
1052 //std::shared_ptr:   // if the jet currently belongs to a cs, we need to release it before any chenge
1053 //std::shared_ptr:   _release_jet_from_cs();
1054 //std::shared_ptr: #endif // FASTJET_HAVE_THREAD_SAFETY
1055 //std::shared_ptr:   _structure.reset();
1056 //std::shared_ptr:   _user_info.reset();
1057 //std::shared_ptr:   // and do not forget to remove it in reset_indices above
1058 //std::shared_ptr: }
1059 
1060 
1061 
1062 
1063 // taken literally from CLHEP
1064 inline double PseudoJet::m() const {
1065   double mm = m2();
1066   return mm < 0.0 ? -std::sqrt(-mm) : std::sqrt(mm);
1067 }
1068 
1069 
1070 inline void PseudoJet::reset(double px_in, double py_in, double pz_in, double E_in) {
1071   _px = px_in;
1072   _py = py_in;
1073   _pz = pz_in;
1074   _E  = E_in;
1075   _finish_init();
1076   _reset_indices();
1077   //std::shared_ptr: _reset_shared_pointers();
1078 }
1079 
1080 inline void PseudoJet::reset_momentum(double px_in, double py_in, double pz_in, double E_in) {
1081   _px = px_in;
1082   _py = py_in;
1083   _pz = pz_in;
1084   _E  = E_in;
1085   _finish_init();
1086 }
1087 
1088 inline void PseudoJet::reset_momentum(const PseudoJet & pj) {
1089   _px  = pj._px ;
1090   _py  = pj._py ;
1091   _pz  = pj._pz ;
1092   _E   = pj._E  ;
1093 #ifdef FASTJET_HAVE_THREAD_SAFETY
1094   // the following lines are here to address the situation where
1095   // the current form of the jet has Init_Done, but the other jet does
1096   // not (or is in the process of being initialized, so that copying
1097   // is dangerous). 
1098   // We take the approach of verifying if the pj has been initialised
1099   // and if it has we take its cached phi & rapidity, otherwise
1100   // we call _finish_init(), which sets Init_NotDone and puts
1101   // rapidity & phi to invalid values. 
1102   int expected = Init_Done;
1103   if (pj._init_status.compare_exchange_weak(expected, Init_Done)) {
1104     _init_status = Init_Done;
1105     _phi = pj._phi;
1106     _rap = pj._rap;
1107     _kt2 = pj._kt2;
1108   } else {
1109     _finish_init();
1110   }
1111 #else 
1112   _phi = pj._phi;
1113   _rap = pj._rap;
1114   _kt2 = pj._kt2;
1115 #endif
1116 }
1117 
1118 //-------------------------------------------------------------------------------
1119 // implementation of the templated accesses to the underlying structyre
1120 //-------------------------------------------------------------------------------
1121 
1122 // returns a reference to the structure casted to the requested
1123 // structure type
1124 //
1125 // If there is no sructure associated, an Error is thrown.
1126 // If the type is not met, a std::bad_cast error is thrown.
1127 template<typename StructureType>
1128 const StructureType & PseudoJet::structure() const{
1129   return dynamic_cast<const StructureType &>(* validated_structure_ptr());
1130   
1131 }
1132 
1133 // check if the PseudoJet has the structure resulting from a Transformer 
1134 // (that is, its structure is compatible with a Transformer::StructureType)
1135 template<typename TransformerType>
1136 bool PseudoJet::has_structure_of() const{
1137   if (!_structure) return false;
1138 
1139   return dynamic_cast<const typename TransformerType::StructureType *>(_structure.get()) != 0;
1140 }
1141 
1142 // this is a helper to access a structure created by a Transformer 
1143 // (that is, of type Transformer::StructureType)
1144 // NULL is returned if the corresponding type is not met
1145 template<typename TransformerType>
1146 const typename TransformerType::StructureType & PseudoJet::structure_of() const{
1147   if (!_structure) 
1148     throw Error("Trying to access the structure of a PseudoJet without an associated structure");
1149 
1150   return dynamic_cast<const typename TransformerType::StructureType &>(*_structure);
1151 }
1152 
1153 
1154 
1155 //-------------------------------------------------------------------------------
1156 // helper functions to build a jet made of pieces
1157 //
1158 // Note that there are more complete versions of these functions, with
1159 // an additional argument for a recombination scheme, in
1160 // JetDefinition.hh
1161 // -------------------------------------------------------------------------------
1162 
1163 /// build a "CompositeJet" from the vector of its pieces
1164 ///
1165 /// In this case, E-scheme recombination is assumed to compute the
1166 /// total momentum
1167 PseudoJet join(const std::vector<PseudoJet> & pieces);
1168 
1169 /// build a MergedJet from a single PseudoJet
1170 PseudoJet join(const PseudoJet & j1);
1171 
1172 /// build a MergedJet from 2 PseudoJet
1173 PseudoJet join(const PseudoJet & j1, const PseudoJet & j2);
1174 
1175 /// build a MergedJet from 3 PseudoJet
1176 PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, const PseudoJet & j3);
1177 
1178 /// build a MergedJet from 4 PseudoJet
1179 PseudoJet join(const PseudoJet & j1, const PseudoJet & j2, const PseudoJet & j3, const PseudoJet & j4);
1180 
1181 
1182 
1183 FASTJET_END_NAMESPACE
1184 
1185 #endif // __FASTJET_PSEUDOJET_HH__