31 #include "fastjet/tools/Filter.hh"
32 #include "fastjet/tools/Recluster.hh"
33 #include <fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh>
42 FASTJET_BEGIN_NAMESPACE
49 string Filter::description()
const {
51 return "uninitialised Filter";
55 ostr <<
"Filter with subjet_def = ";
57 ostr <<
"Cambridge/Aachen algorithm with dynamic Rfilt"
58 <<
" (recomb. scheme deduced from jet, or E-scheme if not unique)";
59 }
else if (_Rfilt > 0) {
60 ostr <<
"Cambridge/Aachen algorithm with Rfilt = "
62 <<
" (recomb. scheme deduced from jet, or E-scheme if not unique)";
64 ostr << _subjet_def.description();
66 ostr<<
", selection " << _selector.description();
68 ostr <<
", subtractor: " << _subtractor->description();
69 }
else if (_rho != 0) {
70 ostr <<
", subtracting with rho = " << _rho;
84 throw Error(
"uninitialised Filter");
91 vector<PseudoJet> subjets;
93 bool ca_optimised = _set_filtered_elements(jet, subjets);
97 subjets = (*_subtractor)(subjets);
99 if (subjets.size()>0){
101 for (
unsigned int i=0;i<subjets.size();i++){
108 vector<PseudoJet> kept, rejected;
113 selector_copy.
sift(subjets, kept, rejected);
116 return _finalise(jet, kept, rejected, ca_optimised);
124 bool Filter::_set_filtered_elements(
const PseudoJet & jet,
125 vector<PseudoJet> & filtered_elements)
const {
128 if ((_Rfilt>=0) || (_Rfiltfunc))
129 recluster =
Recluster(cambridge_algorithm, (_Rfiltfunc) ? (*_Rfiltfunc)(jet) : _Rfilt, Recluster::keep_all);
131 recluster =
Recluster(_subjet_def,
false, Recluster::keep_all);
140 PseudoJet Filter::_finalise(
const PseudoJet & ,
141 vector<PseudoJet> & kept,
142 vector<PseudoJet> & rejected,
143 bool ca_optimisation_used)
const {
144 PseudoJet filtered_jet;
146 if (kept.size()+rejected.size()>0){
148 const JetDefinition::Recombiner &rec = (kept.size()>0)
149 ? *(kept[0].associated_cs()->jet_def().recombiner())
150 : *(rejected[0].associated_cs()->jet_def().recombiner());
153 filtered_jet = join<StructureType>(kept, rec);
155 filtered_jet = join<StructureType>(kept);
157 StructureType *fs = (StructureType*) filtered_jet.structure_non_const_ptr();
158 fs->_rejected = rejected;
164 if ((ca_optimisation_used) && (kept.size()+rejected.size()>0)){
165 bool has_non_explicit_ghost_area = (kept.size()>0)
166 ? (kept[0].has_area() && (!(kept[0].validated_csab()->has_explicit_ghosts())))
167 : (rejected[0].has_area() && (!(rejected[0].validated_csab()->has_explicit_ghosts())));
168 if (has_non_explicit_ghost_area)
176 FASTJET_END_NAMESPACE
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 ...
bool takes_reference() const
returns true if this can be applied jet by jet
bool get_new_jets_and_def(const PseudoJet &input_jet, std::vector< PseudoJet > &output_jets) const
A lower-level method that does the actual work of reclustering the input jet.
base class that sets interface for extensions of ClusterSequence that provide information about the a...
base class corresponding to errors that can be thrown by FastJet
const Selector & set_reference(const PseudoJet &reference)
set the reference jet for this Selector
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
Recluster a jet's constituents with a new jet definition.
PseudoJet subtracted_jet(const PseudoJet &jet, const double rho) const
return a subtracted jet, using area_4vector, given rho
Class to contain pseudojets, including minimal information of use to jet-clustering routines...