Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:16

0001 //FJSTARTHEADER
0002 // $Id$
0003 //
0004 // Copyright (c) 2005-2021, 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 #ifndef __FASTJET_TOOLS_SUBTRACTOR_HH__
0032 #define __FASTJET_TOOLS_SUBTRACTOR_HH__
0033 
0034 #include "fastjet/internal/base.hh"     // namespace macros (include explicitly to help Doxygen)
0035 #include "fastjet/tools/Transformer.hh" // to derive Subtractor from Transformer
0036 #include "fastjet/tools/BackgroundEstimatorBase.hh" // used as a ctor argument
0037 
0038 FASTJET_BEGIN_NAMESPACE     // defined in fastjet/internal/base.hh
0039 
0040 
0041 //----------------------------------------------------------------------
0042 /// @ingroup tools_background
0043 /// \class Subtractor
0044 /// Class that helps perform jet background subtraction.
0045 ///
0046 /// This class derives from Transformer and makes use of a pointer to
0047 /// a BackgroundEstimatorBase object in order to determine the background
0048 /// in the vicinity of a given jet and then subtract area*background from
0049 /// the jet. It can also be initialised with a specific fixed value for the 
0050 /// background pt density.
0051 ///
0052 /// \section input Input conditions
0053 /// 
0054 /// The original jet must have area support (4-vector)
0055 ///
0056 /// \section output Output/interface
0057 /// 
0058 /// The underlying structure of the returned, subtracted jet
0059 /// (i.e. constituents, pieces, etc.) is identical to that of the
0060 /// original jet.
0061 ///
0062 class Subtractor : public Transformer{
0063 public:
0064   /// define a subtractor based on a BackgroundEstimator
0065   Subtractor(const BackgroundEstimatorBase * bge) : 
0066     _bge(bge), _rho(-1.0) { set_defaults(); }
0067 
0068   /// define a subtractor that uses a fixed value of rho, the background
0069   /// pt density per unit area (which must be positive)
0070   Subtractor(double rho);
0071 
0072   /// define a subtractor that uses a fixed value of rho and rho_m;
0073   /// both must be >= 0;
0074   Subtractor(double rho, double rho_m);
0075 
0076   /// default constructor
0077   Subtractor() : _bge(0), _rho(_invalid_rho) { set_defaults(); }
0078 
0079   /// default dtor
0080   virtual ~Subtractor(){};
0081 
0082   /// @name configuring the behaviour
0083   //\{
0084   //----------------------------------------------------------------
0085 
0086   /// reset all parameters to default values
0087   ///
0088   /// Note: by default, the rho_m term is not included and the safety
0089   /// test for the mass is not done. This is mostly for backwards
0090   /// compatibility with FastJet 3.0 and is highly likely to change in
0091   /// a future release of FastJet
0092   void set_defaults();
0093 
0094   void set_background_estimator(const BackgroundEstimatorBase * bge) {
0095     _bge = bge;
0096     _rho = _invalid_rho;
0097   }
0098 
0099   /// when 'use_rho_m' is true, include in the subtraction the
0100   /// correction from rho_m, the purely longitudinal,
0101   /// particle-mass-induced component of the background density per
0102   /// unit area
0103   ///
0104   /// Note: this will be switched off by default (for backwards
0105   /// compatibility with FastJet 3.0) but is highly likely to change
0106   /// in a future release of FastJet
0107   void set_use_rho_m(bool use_rho_m_in = true){
0108     if (_bge == 0  && _rho_m < 0) {
0109       throw Error("Subtractor: rho_m support works only for Subtractors constructed with a background estimator or an explicit rho_m value");
0110     }
0111     _use_rho_m=use_rho_m_in;
0112   }
0113   
0114   /// returns whether or not the rho_m component is used
0115   bool use_rho_m() const{ return _use_rho_m;}
0116 
0117   /// when 'safe_mass' is true, ensure that the mass of the subtracted
0118   /// 4-vector remain positive
0119   ///
0120   /// when true, if the subtracted mass is negative, we return a
0121   /// 4-vector with 0 mass, pt and phi from the subtracted 4-vector
0122   /// and the rapidity of the original, unsubtracted jet.
0123   ///
0124   /// Note: this will be switched off by default (for backwards
0125   /// compatibility with FastJet 3.0) but is highly likely to change
0126   /// in a future release of FastJet
0127   void set_safe_mass(bool safe_mass_in=true){ _safe_mass=safe_mass_in;}
0128 
0129   /// returns whether or not safety tests on the mass are included
0130   bool safe_mass() const{ return _safe_mass;}
0131 
0132   /// This is mostly intended for cherge-hadron-subtracted type of
0133   /// events where we wich to use vertex information to improve the
0134   /// subtraction.
0135   ///
0136   /// Given the following parameters:
0137   ///   \param sel_known_vertex    selects the particles with a
0138   ///                              known vertex origin
0139   ///   \param sel_leading_vertex  amongst the particles with a
0140   ///                              known vertex origin, select those
0141   ///                              coming from the leading vertex
0142   /// Momentum identified as coming from the leading vertex will be
0143   /// kept, momentum identified as coming from a non-leading vertex
0144   /// will be eliminated and a regular area-median subtraction will be
0145   /// applied on the 4-vector sum of the particles with unknown vertex
0146   /// origin.
0147   ///
0148   /// When this is set, we shall ensure that the pt of the subtracted
0149   /// 4-vector is at least the pt of the particles that are known to
0150   /// come from the leading vertex (if it fails, subtraction returns
0151   /// the component that is known to come from the leading vertex ---
0152   /// or, the original unsubtracted jet if it contains no particles
0153   /// from the leading vertex).  Furthermore, when safe_mass() is on, we
0154   /// also impose a similar constraint on the mass of the subtracted
0155   /// 4-vector (if the test fails, the longitudinal part of the
0156   /// subtracted 4-vector is taken from the component that is known to
0157   /// come from the leading vertex).
0158   void set_known_selectors(const Selector &sel_known_vertex,
0159                const Selector &sel_leading_vertex){
0160     _sel_known_vertex   = sel_known_vertex;
0161     _sel_leading_vertex = sel_leading_vertex;
0162   }
0163 
0164   //\}
0165 
0166   /// @name description and action
0167   //\{
0168   //----------------------------------------------------------------
0169 
0170   /// returns a jet that's subtracted
0171   ///
0172   /// \param jet    the jet that is to be subtracted
0173   /// \return       the subtracted jet
0174   virtual PseudoJet result(const PseudoJet & jet) const;
0175 
0176   /// class description
0177   virtual std::string description() const;
0178 
0179   //\}
0180 protected:
0181   /// compute the 4-vector that should be subtracted from the given
0182   /// jet
0183   PseudoJet _amount_to_subtract(const PseudoJet &jet) const;
0184 
0185   /// the tool used to estimate the background
0186   /// if has to be mutable in case its underlying selector takes a reference jet
0187   const BackgroundEstimatorBase * _bge;
0188   /// the fixed value of rho and/or rho_m to use if the user has selected that option
0189   double _rho, _rho_m;
0190 
0191   // configuration parameters/flags
0192   bool _use_rho_m;   ///< include the rho_m correction
0193   bool _safe_mass;   ///< ensures that the subtracted mass is +ve
0194 
0195   Selector _sel_known_vertex;   ///< selects the particles with a
0196                 ///< known vertex origin
0197   Selector _sel_leading_vertex; ///< amongst the particles with a
0198                 ///< known vertex origin, select those
0199                 ///< coming from the leading vertex
0200 
0201   /// a value of rho that is used as a default to label that the stored
0202   /// rho is not valid for subtraction. 
0203   //
0204   // NB: there are two reasons for not having the value written here:
0205   // 1) that it caused problems on karnak with g++ 4.0.1 and 2) that
0206   // we anyway like -infinity as a default, and since that's a function,
0207   // that's not allowed in an include file.
0208   static const double _invalid_rho;
0209 
0210   static LimitedWarning _unused_rho_m_warning;
0211 };
0212 
0213 FASTJET_END_NAMESPACE
0214 
0215 #endif  // __FASTJET_TOOLS_SUBTRACTOR_HH__
0216