/usr/include/fastjet/tools/Pruner.hh is in libfastjettools-dev 3.0.6+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | #ifndef __FASTJET_TOOLS_PRUNER_HH__
#define __FASTJET_TOOLS_PRUNER_HH__
//STARTHEADER
// $Id: Pruner.hh 2616 2011-09-30 18:03:40Z salam $
//
// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
//
//----------------------------------------------------------------------
// This file is part of FastJet.
//
// FastJet is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// The algorithms that underlie FastJet have required considerable
// development and are described in hep-ph/0512210. If you use
// FastJet as part of work towards a scientific publication, please
// include a citation to the FastJet paper.
//
// FastJet is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------
//ENDHEADER
#include "fastjet/ClusterSequence.hh"
#include "fastjet/WrappedStructure.hh"
#include "fastjet/tools/Transformer.hh"
#include <iostream>
#include <string>
FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
// fwd declarations
class Pruner;
class PrunerStructure;
class PruningRecombiner;
class PruningPlugin;
//----------------------------------------------------------------------
/// @ingroup tools_generic
/// \class Pruner
/// Transformer that prunes a jet
///
/// This transformer prunes a jet according to the ideas presented in
/// arXiv:0903.5081 (S.D. Ellis, C.K. Vermilion and J.R. Walsh).
///
/// The jet's constituents are reclustered with a user-specified jet
/// definition, with the modification that objects i and j are only
/// recombined if at least one of the following two criteria is
/// satisfied:
///
/// - the geometric distance between i and j is smaller than 'Rcut'
/// with Rcut = Rcut_factor*2m/pt (Rcut_factor is a parameter of
/// the Pruner and m and pt obtained from the jet being pruned)
/// - the transverse momenta of i and j are at least 'zcut' p_t(i+j)
///
/// If both these criteria fail, i and j are not recombined, the
/// harder of i and j is kept, and the softer is rejected.
///
/// Usage:
/// \code
/// Pruner pruner(jet_def, zcut, Rcut_factor);
/// PseudoJet pruned_jet = pruner(jet);
/// \endcode
///
/// The pruned_jet has a valid associated cluster sequence. In addition
/// the subjets of the original jet that have been vetoed by pruning
/// (i.e. have been 'pruned away') can be accessed using
///
/// \code
/// vector<PseudoJet> rejected_subjets = pruned_jet.structure_of<Pruner>().rejected();
/// \endcode
///
/// If the re-clustering happens to find more than a single inclusive
/// jet (this should normally not happen if the radius of the jet
/// definition used for the reclustering was set large enough),
/// the hardest of these jets is retured as the result of the
/// Pruner. The other jets can be accessed through
///
/// \code
/// vector<PseudoJet> extra_jets = pruned_jet.structure_of<Pruner>().extra_jets();
/// \endcode
///
/// Instead of using Rcut_factor and zcut, one can alternatively
/// construct a Pruner by passing two (pointers to) functions of
/// PseudoJet that dynamically compute the Rcut and zcut to
/// be used for the jet being pruned.
///
/// When the jet being pruned has area support and explicit ghosts,
/// the resulting pruned jet will likewise have area.
///
//----------------------------------------------------------------------
class Pruner : public Transformer{
public:
/// minimal constructor, which takes a jet algorithm, sets the radius
/// to JetDefinition::max_allowable_R (practically equivalent to
/// infinity) and also tries to use a recombiner based on the one in
/// the jet definition of the particular jet being pruned.
///
/// \param jet_alg the jet algorithm for the internal clustering
/// \param zcut pt-fraction cut in the pruning
/// \param Rcut_factor the angular distance cut in the pruning will be
/// Rcut_factor * 2m/pt
Pruner(const JetAlgorithm jet_alg, double zcut, double Rcut_factor)
: _jet_def(jet_alg, JetDefinition::max_allowable_R),
_zcut(zcut), _Rcut_factor(Rcut_factor),
_zcut_dyn(0), _Rcut_dyn(0), _get_recombiner_from_jet(true) {}
/// alternative ctor in which the full reclustering jet definition can
/// be specified.
///
/// \param jet_def the jet definition for the internal clustering
/// \param zcut pt-fraction cut in the pruning
/// \param Rcut_factor the angular distance cut in the pruning will be
/// Rcut_factor * 2m/pt
Pruner(const JetDefinition &jet_def, double zcut, double Rcut_factor)
: _jet_def(jet_def),
_zcut(zcut), _Rcut_factor(Rcut_factor),
_zcut_dyn(0), _Rcut_dyn(0), _get_recombiner_from_jet(false) {}
/// alternative ctor in which the pt-fraction cut and angular distance
/// cut are functions of the jet being pruned.
///
/// \param jet_def the jet definition for the internal clustering
/// \param zcut_dyn dynamic pt-fraction cut in the pruning
/// \param Rcut_dyn dynamic angular distance cut in the pruning
Pruner(const JetDefinition &jet_def,
FunctionOfPseudoJet<double> *zcut_dyn,
FunctionOfPseudoJet<double> *Rcut_dyn);
/// action on a single jet
virtual PseudoJet result(const PseudoJet &jet) const;
/// description
virtual std::string description() const;
// the type of the associated structure
typedef PrunerStructure StructureType;
private:
/// check if the jet has explicit_ghosts (knowing that there is an
/// area support)
bool _check_explicit_ghosts(const PseudoJet &jet) const;
/// return a pointer to a "common" recombiner if there is one,
/// alternatively a null pointer.
const JetDefinition::Recombiner * _get_common_recombiner(const PseudoJet &jet) const;
JetDefinition _jet_def; ///< the internal jet definition
double _zcut; ///< the pt-fraction cut
double _Rcut_factor; ///< the angular separation cut factor
FunctionOfPseudoJet<double> *_zcut_dyn; ///< dynamic zcut
FunctionOfPseudoJet<double> *_Rcut_dyn; ///< dynamic Rcut
bool _get_recombiner_from_jet; ///< true for minimal constructor,
///< causes recombiner to be set equal
///< to that already used in the jet
///< (if it can be deduced)
};
//----------------------------------------------------------------------
/// @ingroup tools_generic
/// \class PrunerStructure
/// The structure associated with a PseudoJet thas has gone through a
/// Pruner transformer
//----------------------------------------------------------------------
class PrunerStructure : public WrappedStructure{
public:
/// default ctor
/// \param result_jet the jet for which we have to keep the structure
PrunerStructure(const PseudoJet & result_jet)
: WrappedStructure(result_jet.structure_shared_ptr()){}
/// description
virtual std::string description() const{ return "Pruned PseudoJet";}
/// return the constituents that have been rejected
std::vector<PseudoJet> rejected() const{
return validated_cs()->childless_pseudojets();
}
/// return the other jets that may have been found along with the
/// result of the pruning
/// The resulting vector is sorted in pt
std::vector<PseudoJet> extra_jets() const;
protected:
friend class Pruner; ///< to allow setting the internal information
};
//----------------------------------------------------------------------
/// \if internal_doc
/// @ingroup internal
/// \class PruningRecombiner
/// recombines the objects that are not vetoed by pruning
///
/// This recombiner only recombines, using the provided 'recombiner',
/// objects (i and j) that pass at least one of the following two criteria:
///
/// - the geometric distance between i and j is smaller than 'Rcut'
/// - the transverse momenta of i and j are at least 'zcut' p_t(i+j)
///
/// If both these criteria fail, the hardest of i and j is kept and
/// the softest is rejected.
///
/// Note that this in not meant for standalone use [in particular
/// because it could lead to memory issues due to the rejected indices
/// stored internally].
///
/// \endif
class PruningRecombiner : public JetDefinition::Recombiner{
public:
/// ctor
/// \param zcut transverse momentum fraction cut
/// \param Rcut angular separation cut
/// \param recomb pointer to a recombiner to use to cluster pairs
PruningRecombiner(double zcut, double Rcut,
const JetDefinition::Recombiner *recombiner)
: _zcut2(zcut*zcut), _Rcut2(Rcut*Rcut),
_recombiner(recombiner){}
/// perform a recombination taking into account the pruning
/// conditions
virtual void recombine(const PseudoJet &pa,
const PseudoJet &pb,
PseudoJet &pab) const;
/// returns the description of the recombiner
virtual std::string description() const;
/// return the history indices that have been pruned away
const std::vector<unsigned int> & rejected() const{ return _rejected;}
/// clears the list of rejected indices
///
/// If one decides to use this recombiner standalone, one has to
/// call this after each clustering in order for the rejected() vector
/// to remain sensible and not grow to infinite size.
void clear_rejected(){ _rejected.clear();}
private:
double _zcut2; ///< transverse momentum fraction cut (squared)
double _Rcut2; ///< angular separation cut (squared)
const JetDefinition::Recombiner *_recombiner; ///< the underlying recombiner to use
mutable std::vector<unsigned int> _rejected; ///< list of rejected history indices
};
//----------------------------------------------------------------------
/// \if internal_doc
/// @ingroup internal
/// \class PruningPlugin
/// FastJet internal plugin that clusters the particles using the
/// PruningRecombiner.
///
/// See PruningRecombiner for a description of what pruning does.
///
/// Note that this is an internal FastJet class used by the Pruner
/// transformer and it is not meant to be used as a standalone clustering
/// tool.
///
/// \endif
//----------------------------------------------------------------------
class PruningPlugin : public JetDefinition::Plugin{
public:
/// ctor
/// \param jet_def the jet definition to be used for the
/// internal clustering
/// \param zcut transverse momentum fraction cut
/// \param Rcut angular separation cut
PruningPlugin(const JetDefinition &jet_def, double zcut, double Rcut)
: _jet_def(jet_def), _zcut(zcut), _Rcut(Rcut){}
/// the actual clustering work for the plugin
virtual void run_clustering(ClusterSequence &input_cs) const;
/// description of the plugin
virtual std::string description() const;
/// returns the radius
virtual double R() const {return _jet_def.R();}
private:
JetDefinition _jet_def; ///< the internal jet definition
double _zcut; ///< transverse momentum fraction cut
double _Rcut; ///< angular separation cut
};
FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
#endif // __FASTJET_TOOLS_PRUNER_HH__
|