|
FastJet 3.0alpha3
|
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJet(s). More...
#include <Selector.hh>

Classes | |
| class | InvalidArea |
| class that gets throw when a Selector is applied despite it not having a valid underlying worker. More... | |
| class | InvalidWorker |
| class that gets throw when a Selector is applied despite it not having a valid underlying worker. More... | |
Public Member Functions | |
| Selector () | |
| default constructor produces a Selector whose action is undefined (any attempt to use it will lead to an error) | |
| Selector (SelectorWorker *worker) | |
| constructor that causes the Selector to use the supplied worker | |
| Selector (const RangeDefinition &range) | |
| ctor from a RangeDefinition | |
| virtual | ~Selector () |
| dummy virtual dtor | |
| bool | pass (const PseudoJet &jet) const |
| return true if the jet passes the selection | |
| bool | operator() (const PseudoJet &jet) const |
| an operator way of knowing whether a given jet passes the selection or not | |
| unsigned int | count (const std::vector< PseudoJet > &jets) const |
| Return a count of the objects that pass the selection. | |
| 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 | applies_jet_by_jet () const |
| returns true if this can be applied jet by jet | |
| std::vector< PseudoJet > | operator() (const std::vector< PseudoJet > &jets) const |
| returns a vector with the jets that pass the selection | |
| 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. | |
| void | get_rapidity_extent (double &rapmin, double &rapmax) const |
| returns the rapidity range for which it may return "true" | |
| std::string | description () const |
| return a textual description of the selector | |
| bool | is_geometric () const |
| check if it is a geometric selector (i.e. | |
| bool | has_finite_area () const |
| check if it has a meaningful and finite area | |
| double | area (double cell_area) const |
| returns the rapidity-phi area associated with the Selector (throws InvalidArea if the area does not make sense). | |
| double | area () const |
| estimate of area, which will use the default ghost area from the ghosted_area_spec | |
| const SharedPtr< SelectorWorker > & | worker () const |
| returns a (reference to) the underlying worker's shared pointer | |
| const SelectorWorker * | validated_worker () const |
| returns a worker if there is a valid one, otherwise throws an InvalidWorker error | |
| bool | takes_reference () const |
| returns true if this can be applied jet by jet | |
| const Selector & | set_reference (const PseudoJet &reference) |
| set the reference jet for this Selector | |
Protected Member Functions | |
| void | _copy_worker_if_needed () |
| Helper for copying selector workers if needed. | |
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJet(s).
Definition at line 139 of file Selector.hh.
| fastjet::Selector::Selector | ( | SelectorWorker * | worker | ) | [inline] |
constructor that causes the Selector to use the supplied worker
Note that the Selector takes ownership of the pointer to the worker (and so will delete automatically when appropriate).
Definition at line 149 of file Selector.hh.
{_worker.reset(worker);}
| fastjet::Selector::Selector | ( | const RangeDefinition & | range | ) |
ctor from a RangeDefinition
This is provided for backward compatibility and will be removed in a future major release of FastJet
Watch out that the Selector will only hold a pointer to the range so the selector will crash if one tries to use it after the range has gone out of scope. We thus strongly advise against the direct use of this constructor.
Definition at line 1363 of file Selector.cc.
{
_worker.reset(new SW_RangeDefinition(range));
}
| unsigned int fastjet::Selector::count | ( | const std::vector< PseudoJet > & | jets | ) | const |
Return a count of the objects that pass the selection.
This will often be more efficient that getting the vector of objects that passes and then evaluating the size of the vector
Definition at line 43 of file Selector.cc.
References fastjet::SelectorWorker::applies_jet_by_jet(), and fastjet::SelectorWorker::pass().
{
unsigned n = 0;
const SelectorWorker * worker = validated_worker();
// separate strategies according to whether the worker applies jet by jet
if (worker->applies_jet_by_jet()) {
for (unsigned i = 0; i < jets.size(); i++) {
if (worker->pass(jets[i])) n++;
}
} else {
std::vector<const PseudoJet *> jetptrs(jets.size());
for (unsigned i = 0; i < jets.size(); i++) {
jetptrs[i] = & jets[i];
}
_worker->terminator(jetptrs);
for (unsigned i = 0; i < jetptrs.size(); i++) {
if (jetptrs[i]) n++;
}
}
return n;
}
| virtual void fastjet::Selector::nullify_non_selected | ( | std::vector< const PseudoJet * > & | jets | ) | const [inline, virtual] |
For each jet that does not pass the cuts, this routine sets the pointer to 0.
It does not assume that the PseudoJet* passed as argumetn are not NULL
Definition at line 203 of file Selector.hh.
{
validated_worker()->terminator(jets);
}
| bool fastjet::Selector::is_geometric | ( | ) | const [inline] |
check if it is a geometric selector (i.e.
one that only puts constraints on rapidities and azimuthal angles)
Definition at line 219 of file Selector.hh.
{
return validated_worker()->is_geometric();
}
| double fastjet::Selector::area | ( | double | cell_area | ) | const |
returns the rapidity-phi area associated with the Selector (throws InvalidArea if the area does not make sense).
The argument passed is the requested cell area, which is used for obtaining a Monte Carlo type estimate of the area in case the Selector does not have an analytically known error. The Monte Carlo estimate involves a time penalty proportional to rapidity extent of the Selector.
Definition at line 110 of file Selector.cc.
References fastjet::GhostedAreaSpec::add_ghosts().
Referenced by fastjet::ClusterSequenceAreaBase::empty_area_from_jets().
{
if (! is_geometric()) throw InvalidArea();
// has area will already check we've got a valid worker
if (_worker->has_known_area()) return _worker->known_area();
// generate a set of "ghosts"
double rapmin, rapmax;
get_rapidity_extent(rapmin, rapmax);
GhostedAreaSpec ghost_spec(rapmin, rapmax, 1, cell_area);
std::vector<PseudoJet> ghosts;
ghost_spec.add_ghosts(ghosts);
// check what passes the selection
return ghost_spec.ghost_area() * ((*this)(ghosts)).size();
}
| void fastjet::Selector::_copy_worker_if_needed | ( | ) | [inline, protected] |
Helper for copying selector workers if needed.
The following is needed if we want to modify a selectors that shares a worker with another selector. In that case, we need to get another copy of the worker to avoid interferences
Note that any non-const operation has to call this to behave correctly w.r.t shared workers!
Definition at line 299 of file Selector.hh.
{
// do nothing if there's a sinlge user of the worker
if (_worker.unique()) return;
// call the worker's copy
//std::cout << "will make a copy of " << description() << std::endl;
_worker.reset(_worker->copy());
}
1.7.4