31#include "fastjet/tools/Pruner.hh" 
   32#include "fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh" 
   33#include "fastjet/Selector.hh" 
   42FASTJET_BEGIN_NAMESPACE      
 
   57  : _jet_def(jet_def), _zcut(0), _Rcut_factor(0),
 
   58    _zcut_dyn(zcut_dyn), _Rcut_dyn(Rcut_dyn), _get_recombiner_from_jet(false)  {
 
   59  assert(_zcut_dyn != 0 && _Rcut_dyn != 0);
 
 
   67    throw Error(
"Pruner: trying to apply the Pruner transformer to a jet that has no constituents");
 
   72  bool do_areas = jet.
has_area() && _check_explicit_ghosts(jet);
 
   75  double Rcut = (_Rcut_dyn) ? (*_Rcut_dyn)(jet) : _Rcut_factor * 2.0*jet.
m()/jet.
perp();
 
   76  double zcut = (_zcut_dyn) ? (*_zcut_dyn)(jet) : _zcut;
 
   81  if (_get_recombiner_from_jet) {
 
   87    if (_check_common_recombiner(jet, jet_def_for_recombiner)){
 
  104    vector<PseudoJet> particles, ghosts;
 
  109    double ghost_area = (ghosts.size()) ? ghosts[0].area() : 0.01;
 
 
  134bool Pruner::_check_explicit_ghosts(
const PseudoJet &jet)
 const{
 
  142    vector<PseudoJet> pieces = jet.
pieces();
 
  143    for (
unsigned int i=0;i<pieces.size(); i++)
 
  144      if (!_check_explicit_ghosts(pieces[i])) 
return false;
 
  159bool Pruner::_check_common_recombiner(
const PseudoJet &jet, 
 
  160                                      JetDefinition &jet_def_for_recombiner,
 
  161                                      bool assigned)
 const{
 
  162  if (jet.has_associated_cluster_sequence()){
 
  165      return jet.validated_cs()->jet_def().has_same_recombiner(jet_def_for_recombiner);
 
  168    jet_def_for_recombiner = jet.validated_cs()->jet_def();
 
  174  if (jet.has_pieces()){
 
  175    vector<PseudoJet> pieces = jet.pieces();
 
  176    if (pieces.size() == 0) 
return false;
 
  177    for (
unsigned int i=0;i<pieces.size(); i++)
 
  178      if (!_check_common_recombiner(pieces[i], jet_def_for_recombiner, assigned)) 
return false;
 
  191  oss << 
"Pruner with jet_definition = (" << _jet_def.
description() << 
")";
 
  193    oss << 
", dynamic zcut (" << _zcut_dyn->
description() << 
")" 
  194        << 
", dynamic Rcut (" << _Rcut_dyn->
description() << 
")";
 
  196    oss << 
", zcut = " << _zcut
 
  197        << 
", Rcut_factor = " << _Rcut_factor;
 
 
  232  double pt2a = pa.
perp2();
 
  233  double pt2b = pb.
perp2();
 
  237    if (pt2a<_zcut2*p.
perp2()){
 
  243    if (pt2b<_zcut2*p.
perp2()) {
 
 
  254  oss << 
"Pruning recombiner with zcut = " << sqrt(_zcut2)
 
  255      << 
", Rcut = " << sqrt(_Rcut2)
 
  256      << 
", and underlying recombiner = " << _recombiner->
description();
 
 
  275  const vector<ClusterSequence::history_element> & internal_hist = internal_cs.
history();
 
  278  vector<bool> kept(internal_hist.size(), 
true);
 
  279  const vector<unsigned int> &pr_rej = pruning_recombiner.
rejected();
 
  280  for (
unsigned int i=0;i<pr_rej.size(); i++) kept[pr_rej[i]]=
false;
 
  286  vector<unsigned int> internal2input(internal_hist.size());
 
  287  for (
unsigned int i=0; i<input_cs.
jets().size(); i++)
 
  288    internal2input[i] = i;
 
  290  for (
unsigned int i=input_cs.
jets().size(); i<internal_hist.size(); i++){
 
  294    if (he.
parent2 == ClusterSequence::BeamJet){
 
  296      int internal_hist_index = internal_cs.
jets()[internal_jetp_index].cluster_hist_index();
 
  298      int input_jetp_index = input_cs.
history()[internal2input[internal_hist_index]].jetp_index;
 
  309      internal2input[i]=internal2input[he.
parent2];
 
  315      internal2input[i]=internal2input[he.
parent1];
 
  325      internal2input[i]=input_cs.
jets()[new_index].cluster_hist_index();
 
 
  336  oss << 
"Pruning plugin with jet_definition = (" << _jet_def.
description()
 
  337      <<
"), zcut = " << _zcut
 
  338      << 
", Rcut = " << _Rcut;
 
 
Like ClusterSequence with computation of the active jet area with the addition of explicit ghosts.
virtual bool has_explicit_ghosts() const
returns true if ghosts are explicitly included within jets for this ClusterSequence;
const std::vector< history_element > & history() const
allow the user to access the raw internal history.
void plugin_record_iB_recombination(int jet_i, double diB)
record the fact that there has been a recombination between jets()[jet_i] and the beam,...
void delete_self_when_unused()
by calling this routine you tell the ClusterSequence to delete itself when all the Pseudojets associa...
std::vector< PseudoJet > inclusive_jets(const double ptmin=0.0) const
return a vector of all jets (in the sense of the inclusive algorithm) with pt >= ptmin.
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...
void plugin_record_ij_recombination(int jet_i, int jet_j, double dij, int &newjet_k)
record the fact that there has been a recombination between jets()[jet_i] and jets()[jet_k],...
base class corresponding to errors that can be thrown by FastJet
base class providing interface for a generic function of a PseudoJet
virtual std::string description() const
returns a description of the function (an empty string by default)
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
class that is intended to hold a full definition of the jet clusterer
std::string description() const
return a textual description of the current jet definition
const Recombiner * recombiner() const
returns a pointer to the currently defined recombiner.
void set_recombiner(const Recombiner *recomb)
set the recombiner class to the one provided
void delete_plugin_when_unused()
calling this causes the JetDefinition to handle the deletion of the plugin when it is no longer used
The structure associated with a PseudoJet thas has gone through a Pruner transformer.
std::vector< PseudoJet > extra_jets() const
return the other jets that may have been found along with the result of the pruning The resulting vec...
virtual std::string description() const
description
virtual PseudoJet result(const PseudoJet &jet) const
action on a single jet
virtual void run_clustering(ClusterSequence &input_cs) const
the actual clustering work for the plugin
virtual std::string description() const
description of the plugin
virtual void recombine(const PseudoJet &pa, const PseudoJet &pb, PseudoJet &pab) const
perform a recombination taking into account the pruning conditions
virtual std::string description() const
returns the description of the recombiner
const std::vector< unsigned int > & rejected() const
return the history indices that have been pruned away
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
virtual std::vector< PseudoJet > constituents() const
retrieve the constituents.
double squared_distance(const PseudoJet &other) const
returns squared cylinder (rap-phi) distance between this jet and another
const ClusterSequenceAreaBase * validated_csab() const
shorthand for validated_cluster_sequence_area_base()
virtual bool has_area() const
check if it has a defined area
double perp() const
returns the scalar transverse momentum
double perp2() const
returns the squared transverse momentum
virtual bool has_pieces() const
returns true if a jet has pieces
int cluster_hist_index() const
return the cluster_hist_index, intended to be used by clustering routines.
virtual bool has_constituents() const
returns true if the PseudoJet has constituents
void set_structure_shared_ptr(const SharedPtr< PseudoJetStructureBase > &structure_in)
set the associated structure
double m() const
returns the invariant mass (If m2() is negative then -sqrt(-m2()) is returned, as in CLHEP)
virtual std::vector< PseudoJet > pieces() const
retrieve the pieces that make up the jet.
bool has_associated_cluster_sequence() const
returns true if this PseudoJet has an associated ClusterSequence.
void sift(const std::vector< PseudoJet > &jets, std::vector< PseudoJet > &jets_that_pass, std::vector< PseudoJet > &jets_that_fail) const
sift the input jets into two vectors – those that pass the selector and those that do not
An implementation of shared pointers that is broadly similar to C++11 shared_ptr (https://en....
virtual const ClusterSequence * validated_cs() const
if the jet has a valid associated cluster sequence then return a pointer to it; otherwise throw an er...
Selector SelectorIsPureGhost()
select objects that are (or are only made of) ghosts.
Selector SelectorNHardest(unsigned int n)
select the n hardest objects
vector< PseudoJet > sorted_by_pt(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing kt2
a single element in the clustering history
int parent1
index in _history where first parent of this jet was created (InexistentParent if this jet is an orig...
int jetp_index
index in the _jets vector where we will find the PseudoJet object corresponding to this jet (i....
int parent2
index in _history where second parent of this jet was created (InexistentParent if this jet is an ori...
double dij
the distance corresponding to the recombination at this stage of the clustering.