FastJet 3.0beta1
CASubJetTagger.hh
00001 //STARTHEADER
00002 // $Id: CASubJetTagger.hh 2474 2011-07-26 13:13:54Z cacciari $
00003 //
00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez
00005 //
00006 //----------------------------------------------------------------------
00007 // This file is part of FastJet.
00008 //
00009 //  FastJet is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU General Public License as published by
00011 //  the Free Software Foundation; either version 2 of the License, or
00012 //  (at your option) any later version.
00013 //
00014 //  The algorithms that underlie FastJet have required considerable
00015 //  development and are described in hep-ph/0512210. If you use
00016 //  FastJet as part of work towards a scientific publication, please
00017 //  include a citation to the FastJet paper.
00018 //
00019 //  FastJet is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with FastJet; if not, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 #ifndef __CASUBJET_TAGGER_HH__
00032 #define __CASUBJET_TAGGER_HH__
00033 
00034 #include <fastjet/PseudoJet.hh>
00035 #include <fastjet/WrappedStructure.hh>
00036 #include <fastjet/tools/Transformer.hh>
00037 #include "fastjet/internal/LimitedWarning.hh"
00038 
00039 FASTJET_BEGIN_NAMESPACE
00040 
00041 class CASubJetTagger;
00042 class CASubJetTaggerStructure;
00043 
00044 //----------------------------------------------------------------------
00045 /// @ingroup tools_taggers
00046 /// \class CASubJetTagger
00047 /// clean (almost parameter-free) tagger searching for the element in
00048 /// the clustering history that maximises a chosen distance
00049 ///
00050 /// class to help us get a clean (almost parameter-free) handle on
00051 /// substructure inside a C/A jet. It follows the logic described in
00052 /// arXiv:0906.0728 (and is inspired by the original Cambridge
00053 /// algorithm paper in its use of separate angular and dimensionful
00054 /// distances), but provides some extra flexibility.
00055 ///
00056 /// It searches for all splittings that pass a symmetry cut (zcut) and
00057 /// then selects the one with the largest auxiliary scale choice
00058 /// (e.g. jade distance of the splitting, kt distance of the
00059 /// splitting, etc.)
00060 ///
00061 /// By default, the zcut is calculated from the fraction of the child
00062 /// pt carried by the parent jet. If one calls set_absolute_z_cut the
00063 /// fraction of transverse momentum will be computed wrt the original
00064 /// jet.
00065 ///
00066 /// original code copyright (C) 2009 by Gavin Salam, released under
00067 /// the GPL.
00068 ///
00069 /// \section desc Options
00070 /// 
00071 ///  - the distance choice: options are
00072 ///        kt2_distance        : usual min(kti^2,ktj^2)DeltaR_{ij}^2
00073 ///        jade_distance       : kti . ktj DeltaR_{ij}^2 (LI version of jade)
00074 ///        jade2_distance      : kti . ktj DeltaR_{ij}^4 (LI version of jade * DR^2)
00075 ///        plain_distance      :           DeltaR_{ij}^2
00076 ///        mass_drop_distance  : m_jet - max(m_parent1,m_parent2)
00077 ///        dot_product_distance: parent1.parent2
00078 ///    (kt2_distance by default)
00079 ///
00080 ///  - the z cut (0 by default)
00081 ///
00082 ///  - by calling set_absolute_z_cut(), one can ask that the pt
00083 ///    fraction if calculated wrt the original jet
00084 ///
00085 ///  - by calling set_dr_min(drmin), one can ask that only the
00086 ///    recombinations where the 2 objects are (geometrically) distant
00087 ///    by at least drmin are kept in the maximisation.
00088 ///
00089 /// \section input Input conditions
00090 /// 
00091 ///  - the jet must have been obtained from a Cambridge/Aachen cluster
00092 ///    sequence
00093 ///
00094 /// \section output Output/structure
00095 /// 
00096 ///  - the element of the cluster sequence maximising the requested
00097 ///    distance (and satisfying the zcut) is returned.
00098 ///
00099 ///  - if the original jet has no parents, it will be returned
00100 ///
00101 ///  - the value of the "z" and distance corresponding to that history
00102 ///    element are stored and accessible through
00103 ///      result.structure_of<CASubJetTagger>().z();
00104 ///      result.structure_of<CASubJetTagger>().distance();
00105 ///
00106 class CASubJetTagger : public Transformer {
00107 public:
00108 
00109   /// the available choices of auxiliary scale with respect to which
00110   /// to order the splittings
00111   enum ScaleChoice {
00112     kt2_distance,        //< usual min(kti^2,ktj^2)DeltaR_{ij}^2
00113     jade_distance,       //< kti . ktj DeltaR_{ij}^2 (LI version of jade)
00114     jade2_distance,      //< kti . ktj DeltaR_{ij}^4 (LI version of jade * DR^2)
00115     plain_distance,      //<           DeltaR_{ij}^2
00116     mass_drop_distance,  //<    m_jet - max(m_parent1,m_parent2)
00117     dot_product_distance //<  parent1.parent2
00118   };
00119 
00120   /// just constructs
00121   CASubJetTagger(ScaleChoice scale_choice = jade_distance,
00122                  double      z_threshold  = 0.1)
00123     : _scale_choice(scale_choice), _z_threshold(z_threshold),
00124       _dr2_min(0.0), _absolute_z_cut(false){};
00125 
00126   /// sets a minimum delta R below which spliting will be ignored
00127   /// (only relevant if set prior to calling run())
00128   void set_dr_min(double drmin) {_dr2_min = drmin*drmin;}
00129 
00130   /// returns a textual description of the tagger
00131   virtual std::string description() const;
00132 
00133   /// If (abs_z_cut) is set to false (the default) then for a
00134   /// splitting to be considered, each subjet must satisfy 
00135   /// 
00136   ///        p_{t,sub} > z_threshold * p_{t,parent}
00137   ///
00138   /// whereas if it is set to true, then each subject must satisfy
00139   ///
00140   ///        p_{t,sub} > z_threshold * p_{t,original-jet}
00141   ///
00142   /// where parent is the immediate parent of the splitting, and
00143   /// original jet is the one supplied to the run() function.
00144   ///
00145   /// Only relevant is called prior to run().
00146   void set_absolute_z_cut(bool abs_z_cut=true) {_absolute_z_cut = abs_z_cut;}
00147   
00148   /// runs the tagger on the given jet and
00149   /// returns the tagged PseudoJet if successful, or a PseudoJet==0 otherwise
00150   /// (standard access is through operator()).
00151   virtual PseudoJet result(const fastjet::PseudoJet & jet) const;
00152 
00153   /// the type of Structure returned
00154   typedef CASubJetTaggerStructure StructureType;
00155 
00156 protected:
00157   /// class that contains the result internally
00158   class JetAux {
00159   public:
00160     fastjet::PseudoJet jet;          //< the subjet (immediate parent of splitting)
00161     double             aux_distance; //< the auxiliary distance between its two subjets
00162     double             delta_r;      //< the angular distance between its two subjets
00163     double             z;            //< the transverse momentum fraction
00164   };
00165 
00166 
00167   void _recurse_through_jet(const PseudoJet & current_jet, 
00168                             JetAux &aux_max,
00169                             const PseudoJet & original_jet) const;
00170 
00171   ScaleChoice _scale_choice;
00172   double      _z_threshold;
00173   double      _dr2_min;
00174   bool        _absolute_z_cut;
00175 
00176   static  LimitedWarning _non_ca_warnings;
00177 };
00178 
00179 
00180 //------------------------------------------------------------------------
00181 /// @ingroup tools_taggers
00182 /// the structure returned by a CASubJetTagger
00183 ///
00184 /// Since this is directly an element of the ClusterSequence, we keep
00185 /// basically the original ClusterSequenceStructure (wrapped for
00186 /// memory-management reasons) and add information about the pt
00187 /// fraction and distance of the subjet structure
00188 class CASubJetTaggerStructure : public WrappedStructure{
00189 public:
00190   /// default ctor
00191   ///  \param result_jet   the jet for which we have to keep the
00192   ///                      structure
00193   CASubJetTaggerStructure(const PseudoJet & result_jet)
00194     : WrappedStructure(result_jet.structure_shared_ptr()){}
00195 
00196   /// returns the scale choice asked for the maximisation
00197   CASubJetTagger::ScaleChoice scale_choice() const {return _scale_choice;}
00198 
00199   /// returns the value of the distance measure (corresponding to
00200   /// ScaleChoice) for this jet's splitting
00201   double distance() const {return _distance;}
00202 
00203   /// returns the pt fraction contained by the softer of the two component
00204   /// pieces of this jet (normalised relative to this jet)
00205   double z() const {return _z;}
00206 
00207   /// returns the pt fraction contained by the softer of the two component
00208   /// pieces of this jet (normalised relative to the original jet)
00209   bool absolute_z() const {return _absolute_z;}
00210 
00211 //  /// returns the original jet (before tagging)
00212 //  const PseudoJet & original() const {return _original_jet;}
00213 
00214 protected:
00215   CASubJetTagger::ScaleChoice _scale_choice; ///< the user scale choice 
00216   double _distance;  ///< the maximal distance associated with the result
00217   bool _absolute_z;  ///< whether z is computed wrt to the original jet or not
00218   double _z;         ///< the transverse momentum fraction
00219 //  PseudoJet _original_jet;  ///< the original jet (before tagging)
00220 
00221   friend class CASubJetTagger; ///< to allow setting the internal information
00222 };
00223 
00224 FASTJET_END_NAMESPACE
00225 
00226 #endif // __CASUBJET_HH__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends