21 #ifndef yap__Filters_h
22 #define yap__Filters_h
24 #include "fwd/Filters.h"
26 #include "fwd/DecayChannel.h"
27 #include "fwd/DecayingParticle.h"
28 #include "fwd/DecayTree.h"
29 #include "fwd/FinalStateParticle.h"
30 #include "fwd/FreeAmplitude.h"
31 #include "fwd/MassShape.h"
32 #include "fwd/MassShapeWithNominalMass.h"
33 #include "fwd/Particle.h"
34 #include "fwd/Resonance.h"
35 #include "fwd/SpinAmplitude.h"
50 template <
typename container>
51 typename container::value_type
lone_elt(container& C)
60 template <
typename container>
61 typename container::value_type
lone_elt(container&& C)
71 template <
typename T,
typename Last,
typename ... UnaryPredicates>
72 std::set<std::shared_ptr<T> >
filter(
const std::set<std::shared_ptr<T> >& S, Last p, UnaryPredicates ... P)
74 auto s =
filter<T, UnaryPredicates...>(S, P...);
75 for (
auto it = s.begin(); it != s.end(); ) {
86 const std::set<std::shared_ptr<T> >&
filter(
const std::set<std::shared_ptr<T> >& S)
99 using filter_decay_tree::operator();
111 using filter_free_amplitude::operator();
123 using filter_free_amplitude::operator();
142 using filter_particle::operator();
154 using filter_decaying_particle::operator();
166 using filter_resonance::operator();
179 template <
class F,
typename T>
180 const bool by_ptr(
const F& f,
const std::shared_ptr<T>& ptr)
181 {
return ptr and f(*ptr); }
186 template <
class F,
typename T>
187 const bool by_ptr(
const F& f,
const T* ptr)
188 {
return ptr and f(*ptr); }
200 using filter_decay_channel::operator();
201 using filter_decaying_particle::operator();
211 const bool operator()(
const std::shared_ptr<DecayChannel> dc)
const
236 using filter_spin_amplitude::operator();
246 const bool operator()(
const std::shared_ptr<SpinAmplitude>& sa)
const
266 to(
const ParticleVector& daughters)
269 if (std::any_of(
Daughters_.begin(),
Daughters_.end(), std::logical_not<ParticleVector::value_type>()))
274 template <
typename ... Others>
275 to(std::shared_ptr<Particle> A, Others ... others)
279 if (std::any_of(
Daughters_.begin(),
Daughters_.end(), std::logical_not<ParticleVector::value_type>()))
283 using filter_decay_channel::operator();
284 using filter_decaying_particle::operator();
309 template <
typename ... Others>
310 exactly_to(
const ParticleVector::value_type& A, Others ... others)
311 :
to(A, others...) {}
313 using to::operator();
328 using filter_spin_amplitude::operator();
349 using filter_free_amplitude::operator();
370 template <
typename T>
372 {
return t.name() ==
Name_; }
388 using filter_decaying_particle::operator();
389 using filter_decay_tree::operator();
396 const bool operator()(
const std::shared_ptr<DecayTree>& dt)
const
420 using filter_decaying_particle::operator();
421 using filter_free_amplitude::operator();
434 const bool operator()(
const std::shared_ptr<FreeAmplitude>& fa)
const
456 from(
const std::shared_ptr<DecayingParticle>& dp)
459 using filter_decay_channel::operator();
460 using filter_particle::operator();
493 using filter_mass_shape::operator();
virtual const bool operator()(const Particle &p) const override
Particle functor.
Definition: Filters.cxx:142
Stores complex free amplitude for the particular decay of a particle.
Definition: FreeAmplitude.h:48
const bool by_ptr(const F &f, const std::shared_ptr< T > &ptr)
Definition: Filters.h:180
const bool operator()(const DecayTree &dt) const
DecayTree functor.
Definition: Filters.h:392
exactly_to(const ParticleVector::value_type &A, Others...others)
constructor (variadic)
Definition: Filters.h:310
to(const ParticleVector &daughters)
Definition: Filters.h:266
has_spin_amplitude(const SpinAmplitude *sa)
Definition: Filters.h:233
virtual const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.cxx:105
container::value_type lone_elt(container &C)
Definition: Filter.h:39
const SpinAmplitude * SpinAmplitude_
SpinAmplitude pointer to check equality to.
Definition: Filters.h:255
const FreeAmplitude * FreeAmplitude_
FreeAmplitude to look for.
Definition: Filters.h:443
const bool operator()(const DecayChannel &dc) const override
DecayChannel functor.
Definition: Filters.h:207
virtual const bool operator()(const SpinAmplitude &sa) const override
SpinAmplitude functor.
Definition: Filters.cxx:99
from(const std::shared_ptr< DecayingParticle > &dp)
Constructor.
Definition: Filters.h:456
to(std::shared_ptr< Particle > A, Others...others)
constructor (variadic)
Definition: Filters.h:275
ParticleVector Daughters_
Particle content to check equality to.
Definition: Filters.h:295
const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.h:430
int TwoM_
spin projection to check equality to
Definition: Filters.h:357
virtual const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.cxx:24
Functor object for filtering by parent particle.
Definition: Filters.h:448
const bool operator()(const DecayChannel &dc) const override
DecayChannel functor.
Definition: Filters.h:471
Functor class for filtering by particle content.
Definition: Filters.h:260
helper base class for filtering Resonance's
Definition: Filters.h:153
Functor class for checking whether objects have a particular free amplitude.
Definition: Filters.h:413
helper base class for functor classes that can filter DecayChannel's
Definition: Filters.h:110
Class holding vectors of fixed and free amplitudes that define a decay tree.
Definition: DecayTree.h:49
Functor class for checking if DecayingParticle has specified DecayTree.
Definition: Filters.h:381
helper base class for filtering DecayingParticle's
Definition: Filters.h:141
const bool operator()(const SpinAmplitude *sa) const
SpinAmplitude* functor.
Definition: Filters.h:250
Functor class for filtering by exact particle content.
Definition: Filters.h:301
exactly_to(const ParticleVector &daughters)
Definition: Filters.h:306
has_free_amplitude(const FreeAmplitude *fa)
constructor
Definition: Filters.h:417
const bool operator()(const std::shared_ptr< SpinAmplitude > &sa) const
shared_ptr<SpinAmplitude> functor
Definition: Filters.h:246
virtual const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.cxx:30
const bool operator()(const DecayTree *dt) const
DecayTree* functor.
Definition: Filters.h:400
const bool operator()(const DecayTree &dt) const override
DecayTree functor.
Definition: Filters.h:463
has_decay_tree(const DecayTree *dt)
constructor
Definition: Filters.h:385
const bool operator()(const SpinAmplitude &sa) const override
SpinAmplitude functor.
Definition: Filters.h:242
const DecayTree * DecayTree_
DecayTree pointer to search for.
Definition: Filters.h:408
unsigned L_
orbital angular momentum to check equality to
Definition: Filters.h:336
const bool operator()(const T &t) const
functor
Definition: Filters.h:371
virtual const bool operator()(const DecayTree &dt) const =0
DecayTree functor.
has_decay_channel(const DecayChannel *dc)
Definition: Filters.h:197
Base class for handling YAP exceptions.
Definition: Exceptions.h:39
const bool operator()(const FreeAmplitude *fa) const
FreeAmplitude* functor.
Definition: Filters.h:438
Class representing a final-state particle.
Definition: FinalStateParticle.h:43
Functor class for filtering by spin amplitude.
Definition: Filters.h:228
helper base class for filtering Particle's
Definition: Filters.h:134
const bool operator()(const DecayTree &dt) const override
DecayTree functor.
Definition: Filters.cxx:120
const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.cxx:72
Class for MassShape that gets its nominal mass from its owning resonance.
Definition: MassShapeWithNominalMass.h:39
Functor object for filtering by spin projection.
Definition: Filters.h:342
Functor object for filtering by orbital angular momentum.
Definition: Filters.h:321
const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.cxx:60
const bool operator()(const DecayChannel *dc) const
DecayChannel* functor.
Definition: Filters.h:215
virtual const bool operator()(const Particle &p) const override
Particle functor.
Definition: Filters.cxx:36
virtual const bool operator()(const DecayTree &dt) const override
DecayTree functor.
Definition: Filters.cxx:18
const DecayChannel * DecayChannel_
DecayChannel pointer to check equality to.
Definition: Filters.h:223
helper base class for filtering MassShape's
Definition: Filters.h:165
virtual const bool operator()(const Resonance &dp) const override
Resonance functor.
Definition: Filters.cxx:52
virtual const bool operator()(const DecayChannel &dc) const override
DecayChannel functor.
Definition: Filters.cxx:93
Functor class for filtering by decay channel.
Definition: Filters.h:192
is_named(std::string name)
constructor
Definition: Filters.h:367
Functors return true if particle is a final state particle or if a mass shape can be found that inher...
Definition: Filters.h:487
const DecayingParticle * DecayingParticle_
DecayingParticle to check for.
Definition: Filters.h:479
std::set< std::shared_ptr< T > > filter(const std::set< std::shared_ptr< T > > &S, Last p, UnaryPredicates...P)
Definition: Filter.h:60
std::string to_string(const CachedValue::Status &S)
streaming operator for CachedValue::Status
Definition: CachedValue.cxx:27
const bool operator()(const std::shared_ptr< DecayTree > &dt) const
shared_ptr<DecayTree> functor
Definition: Filters.h:396
l_equals(unsigned l)
constructor
Definition: Filters.h:326
const bool operator()(const FreeAmplitude &fa) const override
FreeAmplitude functor.
Definition: Filters.h:467
virtual const bool operator()(const DecayChannel &dc) const override
DecayChannel functor.
Definition: Filters.cxx:78
const bool operator()(const std::shared_ptr< FreeAmplitude > &fa) const
shared_ptr<FreeAmplitude> functor
Definition: Filters.h:434
Definition: DecayingParticle.h:51
Class for a particle that will decay and has a mass shape.
Definition: Resonance.h:47
Abstract Particle base class.
Definition: Particle.h:47
virtual const bool operator()(const Particle &p) const =0
Particle functor.
m_equals(int two_m)
constructor
Definition: Filters.h:347
helper base class for functor classes that can filter SpinAmplitude's
Definition: Filters.h:122
Functor class for filtering objects that have a #name() function.
Definition: Filters.h:363
Abstract base class for all mass shapes.
Definition: MassShape.h:46
helper base class for functor classes that can filter DecayTree's
Definition: Filters.h:91
const bool operator()(const std::shared_ptr< DecayChannel > dc) const
shared_ptr<DecayChannel> functor
Definition: Filters.h:211
has_mass()
constructor
Definition: Filters.h:491
virtual const bool operator()(const DecayingParticle &dp) const override
DecayingParticle functor.
Definition: Filters.cxx:44
std::string Name_
name to check equality to
Definition: Filters.h:376
Class implementing a decay channel.
Definition: DecayChannel.h:40
from(const DecayingParticle &dp)
Constructor.
Definition: Filters.h:452
const bool operator()(const FinalStateParticle &p) const
FinalStateParticle functor.
Definition: Filters.h:499
Abstract base class implementing a spin amplitude.
Definition: SpinAmplitude.h:46
const bool operator()(const MassShapeWithNominalMass &m) const
MassShapeWithNominalMass functor.
Definition: Filters.h:506
helper base class for functor classes that can filter FreeAmplitude's
Definition: Filters.h:98