1 #ifndef __FASTJET_SELECTOR_HH__ 2 #define __FASTJET_SELECTOR_HH__ 34 #include "fastjet/PseudoJet.hh" 36 #include "fastjet/RangeDefinition.hh" 41 FASTJET_BEGIN_NAMESPACE
78 virtual bool pass(
const PseudoJet & jet)
const = 0;
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());
490 FASTJET_END_NAMESPACE
492 #endif // __FASTJET_SELECTOR_HH__ Selector SelectorPtMax(double ptmax)
select objects with pt <= ptmax
virtual void set_reference(const PseudoJet &)
sets the reference jet for the selector NB: "reference" is commented to avoid unused-variable compile...
Selector SelectorEtaMin(double etamin)
select objects with eta >= etamin
Selector SelectorEtRange(double Etmin, double Etmax)
select objects with Etmin <= Et <= Etmax
Selector SelectorRectangle(const double half_rap_width, const double half_phi_width)
select objets within rapidity distance 'half_rap_width' from the reference jet and azimuthal-angle di...
Selector SelectorPtFractionMin(double fraction)
select objects that carry at least a fraction "fraction" of the reference jet.
Selector SelectorRapPhiRange(double rapmin, double rapmax, double phimin, double phimax)
select objects with rapmin <= rap <= rapmax && phimin <= phi <= phimax
Selector SelectorAbsRapMin(double absrapmin)
select objects with |rap| >= absrapmin
Selector SelectorIsZero()
select PseudoJet with 0 momentum
Selector SelectorNHardest(unsigned int n)
select the n hardest objects
Selector SelectorRapMin(double rapmin)
select objects with rap >= rapmin
Selector SelectorEtaRange(double etamin, double etamax)
select objects with etamin <= eta <= etamax
bool is_geometric() const
returns true if it is a geometric selector (i.e.
virtual double known_area() const
if it has a computable area, return it
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 is_geometric() const
check if it is a geometric selector (i.e.
Selector SelectorEtMax(double Etmax)
select objects with Et <= Etmax
virtual ~Selector()
dummy virtual dtor
const SharedPtr< SelectorWorker > & worker() const
returns a (reference to) the underlying worker's shared pointer
Selector operator*(const Selector &s1, const Selector &s2)
successive application of 2 selectors
Selector SelectorRapRange(double rapmin, double rapmax)
select objects with rapmin <= rap <= rapmax
class that gets thrown when the area is requested from a Selector for which the area is not meaningfu...
Selector SelectorAbsRapMax(double absrapmax)
select objects with |rap| <= absrapmax
virtual bool takes_reference() const
returns true if the worker is defined with respect to a reference jet
virtual SelectorWorker * copy()
return a copy of the current object.
Selector operator||(const Selector &s1, const Selector &s2)
logical or between two selectors
bool has_finite_area() const
returns true if it has a meaningful and finite area (i.e.
Selector SelectorAbsEtaMax(double absetamax)
select objects with |eta| <= absetamax
class that gets thrown when a Selector is applied despite it not having a valid underlying worker...
bool takes_reference() const
returns true if this can be applied jet by jet
class for holding a range definition specification, given by limits on rapidity and azimuth...
void get_rapidity_extent(double &rapmin, double &rapmax) const
returns the rapidity range for which it may return "true"
Selector SelectorAbsEtaMin(double absetamin)
select objects with |eta| >= absetamin
virtual bool has_known_area() const
check if it has an analytically computable area
Selector SelectorStrip(const double half_width)
select objets within a rapidity distance 'half_width' from the location of the reference jet...
const SelectorWorker * validated_worker() const
returns a worker if there is a valid one, otherwise throws an InvalidWorker error ...
Selector SelectorPtMin(double ptmin)
select objects with pt >= ptmin
Selector SelectorAbsRapRange(double rapmin, double rapmax)
select objects with absrapmin <= |rap| <= absrapmax
bool applies_jet_by_jet() const
returns true if this can be applied jet by jet
Selector SelectorAbsEtaRange(double absetamin, double absetamax)
select objects with absetamin <= |eta| <= absetamax
Selector SelectorPtRange(double ptmin, double ptmax)
select objects with ptmin <= pt <= ptmax
Selector()
default constructor produces a Selector whose action is undefined (any attempt to use it will lead to...
Selector SelectorEtMin(double Etmin)
select objects with Et >= Etmin
bool pass(const PseudoJet &jet) const
return true if the jet passes the selection
Selector SelectorEMin(double Emin)
select objects with E >= Emin
base class corresponding to errors that can be thrown by FastJet
Selector SelectorMassMax(double mmax)
select objects with Mass <= Mmax
Selector SelectorEMax(double Emax)
select objects with E <= Emax
Selector SelectorPhiRange(double phimin, double phimax)
select objects with phimin <= phi <= phimax
Selector SelectorRapMax(double rapmax)
select objects with rap <= rapmax
Selector(SelectorWorker *worker_in)
constructor that causes the Selector to use the supplied worker
void _copy_worker_if_needed()
Helper for copying selector workers if needed.
an implementation of C++0x shared pointers (or boost's)
Selector SelectorCircle(const double radius)
select objets within a distance 'radius' from the location of the reference jet, set by Selector::set...
virtual ~SelectorWorker()
default dtor
Selector operator &&(const Selector &s1, const Selector &s2)
logical and between two selectors
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...
Selector SelectorDoughnut(const double radius_in, const double radius_out)
select objets with distance from the reference jet is between 'radius_in' and 'radius_out'; the refer...
Selector SelectorMassMin(double mmin)
select objects with Mass >= Mmin
std::string description() const
returns a textual description of the selector
virtual bool applies_jet_by_jet() const
returns true if this can be applied jet by jet
bool operator()(const PseudoJet &jet) const
an operator way of knowing whether a given jet passes the selection or not
Selector SelectorIsPureGhost()
select objects that are (or are only made of) ghosts.
default selector worker is an abstract virtual base class
Selector SelectorERange(double Emin, double Emax)
select objects with Emin <= E <= Emax
virtual void get_rapidity_extent(double &rapmin, double &rapmax) const
returns the rapidity range for which it may return "true"
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.
virtual std::string description() const
returns a description of the worker
Class to contain pseudojets, including minimal information of use to jet-clustering routines...
Selector SelectorMassRange(double mmin, double mmax)
select objects with Mmin <= Mass <= Mmax
Selector SelectorEtaMax(double etamax)
select objects with eta <= etamax
Selector operator!(const Selector &s)
logical not applied on a selector