1#ifndef __FASTJET_SELECTOR_HH__
2#define __FASTJET_SELECTOR_HH__
34#include "fastjet/PseudoJet.hh"
36#include "fastjet/RangeDefinition.hh"
41FASTJET_BEGIN_NAMESPACE
84 virtual void terminator(std::vector<const PseudoJet *> & jets)
const {
85 for (
unsigned i = 0; i < jets.size(); i++) {
86 if (jets[i] && !pass(*jets[i])) jets[i] = NULL;
94 virtual std::string
description()
const {
return "missing description";}
107 throw Error(
"set_reference(...) cannot be used for a selector worker that does not take a reference");
115 throw Error(
"this SelectorWorker has nothing to copy");
124 rapmax = std::numeric_limits<double>::infinity();
133 virtual bool has_finite_area()
const;
140 throw Error(
"this selector has no computable area");
179 if (!validated_worker()->applies_jet_by_jet()) {
180 throw Error(
"Cannot apply this selector to an individual jet");
182 return _worker->pass(jet);
194 unsigned int count(
const std::vector<PseudoJet> & jets)
const;
200 PseudoJet sum(
const std::vector<PseudoJet> & jets)
const;
206 double scalar_pt_sum(
const std::vector<PseudoJet> & jets)
const;
210 void sift(
const std::vector<PseudoJet> & jets,
211 std::vector<PseudoJet> & jets_that_pass,
212 std::vector<PseudoJet> & jets_that_fail)
const;
216 return validated_worker()->applies_jet_by_jet();
220 std::vector<PseudoJet> operator()(
const std::vector<PseudoJet> & jets)
const;
228 validated_worker()->terminator(jets);
233 return validated_worker()->get_rapidity_extent(rapmin, rapmax);
238 return validated_worker()->description();
244 return validated_worker()->is_geometric();
251 return validated_worker()->has_finite_area();
273 double area(
double ghost_area)
const;
288 return validated_worker()->takes_reference();
295 if (! validated_worker()->takes_reference()){
301 _copy_worker_if_needed();
303 _worker->set_reference(reference);
318 InvalidArea() :
Error(
"Attempt to obtain area from Selector for which this is not meaningful") {}
341 if (_worker.unique())
return;
345 _worker.reset(_worker->copy());
365Selector SelectorIdentity();
373Selector operator!(
const Selector & s);
378Selector operator ||(
const Selector & s1,
const Selector & s2);
388Selector operator&&(
const Selector & s1,
const Selector & s2);
398Selector operator*(
const Selector & s1,
const Selector & s2);
403Selector SelectorPtMin(
double ptmin);
404Selector SelectorPtMax(
double ptmax);
405Selector SelectorPtRange(
double ptmin,
double ptmax);
407Selector SelectorEtMin(
double Etmin);
408Selector SelectorEtMax(
double Etmax);
409Selector SelectorEtRange(
double Etmin,
double Etmax);
411Selector SelectorEMin(
double Emin);
412Selector SelectorEMax(
double Emax);
413Selector SelectorERange(
double Emin,
double Emax);
415Selector SelectorMassMin(
double Mmin);
416Selector SelectorMassMax(
double Mmax);
417Selector SelectorMassRange(
double Mmin,
double Mmax);
419Selector SelectorRapMin(
double rapmin);
420Selector SelectorRapMax(
double rapmax);
421Selector SelectorRapRange(
double rapmin,
double rapmax);
423Selector SelectorAbsRapMin(
double absrapmin);
424Selector SelectorAbsRapMax(
double absrapmax);
425Selector SelectorAbsRapRange(
double absrapmin,
double absrapmax);
427Selector SelectorEtaMin(
double etamin);
428Selector SelectorEtaMax(
double etamax);
429Selector SelectorEtaRange(
double etamin,
double etamax);
431Selector SelectorAbsEtaMin(
double absetamin);
432Selector SelectorAbsEtaMax(
double absetamax);
433Selector SelectorAbsEtaRange(
double absetamin,
double absetamax);
435Selector SelectorPhiRange(
double phimin,
double phimax);
443Selector SelectorRapPhiRange(
double rapmin,
double rapmax,
double phimin,
double phimax);
446Selector SelectorNHardest(
unsigned int n);
454Selector SelectorCircle(
const double radius);
458Selector SelectorDoughnut(
const double radius_in,
const double radius_out);
462Selector SelectorStrip(
const double half_width);
467Selector SelectorRectangle(
const double half_rap_width,
const double half_phi_width);
473Selector SelectorPtFractionMin(
double fraction);
480Selector SelectorIsZero();
485Selector SelectorIsPureGhost();
base class corresponding to errors that can be thrown by FastJet
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
class for holding a range definition specification, given by limits on rapidity and azimuth.
default selector worker is an abstract virtual base class
virtual void set_reference(const PseudoJet &)
sets the reference jet for the selector NB: "reference" is commented to avoid unused-variable compile...
virtual bool has_known_area() const
check if it has an analytically computable area
virtual void terminator(std::vector< const PseudoJet * > &jets) const
For each jet that does not pass the cuts, this routine sets the pointer to 0.
virtual bool takes_reference() const
returns true if the worker is defined with respect to a reference jet
virtual ~SelectorWorker()
default dtor
virtual void get_rapidity_extent(double &rapmin, double &rapmax) const
returns the rapidity range for which it may return "true"
virtual bool applies_jet_by_jet() const
returns true if this can be applied jet by jet
virtual double known_area() const
if it has a computable area, return it
virtual std::string description() const
returns a description of the worker
virtual SelectorWorker * copy()
return a copy of the current object.
virtual bool is_geometric() const
check if it is a geometric selector (i.e.
virtual bool pass(const PseudoJet &jet) const =0
returns true if a given object passes the selection criterion, and is the main function that needs to...
class that gets thrown when the area is requested from a Selector for which the area is not meaningfu...
class that gets thrown when a Selector is applied despite it not having a valid underlying worker.
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
void _copy_worker_if_needed()
Helper for copying selector workers if needed.
const SharedPtr< SelectorWorker > & worker() const
returns a (reference to) the underlying worker's shared pointer
bool has_finite_area() const
returns true if it has a meaningful and finite area (i.e.
bool pass(const PseudoJet &jet) const
return true if the jet passes the selection
bool applies_jet_by_jet() const
returns true if this can be applied jet by jet
virtual ~Selector()
dummy virtual dtor
Selector(SelectorWorker *worker_in)
constructor that causes the Selector to use the supplied worker
bool operator()(const PseudoJet &jet) const
an operator way of knowing whether a given jet passes the selection or not
std::string description() const
returns a textual description of the selector
bool takes_reference() const
returns true if this can be applied jet by jet
const SelectorWorker * validated_worker() const
returns a worker if there is a valid one, otherwise throws an InvalidWorker error
const Selector & set_reference(const PseudoJet &reference)
set the reference jet for this Selector
bool is_geometric() const
returns true if it is a geometric selector (i.e.
virtual void nullify_non_selected(std::vector< const PseudoJet * > &jets) const
For each jet that does not pass the cuts, this routine sets the pointer to 0.
Selector()
default constructor produces a Selector whose action is undefined (any attempt to use it will lead to...
void get_rapidity_extent(double &rapmin, double &rapmax) const
returns the rapidity range for which it may return "true"
An implementation of shared pointers that is broadly similar to C++11 shared_ptr (https://en....