thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
EventRecord
SelectorBase.h
1
// -*- C++ -*-
2
//
3
// SelectorBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2019 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef ThePEG_SelectorBase_H
10
#define ThePEG_SelectorBase_H
11
// This is the declaration of the SelectorBase class.
12
13
14
#include "
EventConfig.h
"
15
16
namespace
ThePEG
{
17
45
class
SelectorBase
{
46
47
public
:
48
52
virtual
~SelectorBase
() {}
53
57
static
bool
Check
(
const
Particle
&) {
return
true
; }
58
62
static
bool
Intermediate
() {
return
true
; }
63
67
static
bool
FinalState
() {
return
true
; }
68
72
static
bool
AllSteps
() {
return
true
; }
73
77
static
bool
AllCollisions
() {
return
true
; }
78
82
virtual
bool
check
(
const
Particle
& p)
const
{
return
Check
(p); }
83
87
virtual
bool
finalState
()
const
{
return
FinalState
(); }
88
92
virtual
bool
intermediate
()
const
{
return
Intermediate
(); }
93
98
virtual
bool
allSteps
()
const
{
return
AllSteps
(); }
99
104
virtual
bool
allCollisions
()
const
{
return
AllCollisions
(); }
105
106
};
107
117
template
<
class
T>
118
struct
ParticleSelector
:
public
SelectorBase
{
119
123
static
bool
Check
(
const
Particle
& p) {
return
T::Check(p); }
124
128
static
bool
Intermediate
() {
return
T::Intermediate(); }
129
133
static
bool
FinalState
() {
return
T::FinalState(); }
134
138
static
bool
AllSteps
() {
return
T::AllSteps(); }
139
143
static
bool
AllCollisions
() {
return
T::AllCollisions(); }
144
148
virtual
bool
check
(
const
Particle
& p)
const
{
return
Check
(p); }
149
153
virtual
bool
finalState
()
const
{
return
FinalState
(); }
154
158
virtual
bool
intermediate
()
const
{
return
Intermediate
(); }
159
164
virtual
bool
allSteps
()
const
{
return
AllSteps
(); }
165
170
virtual
bool
allCollisions
()
const
{
return
AllCollisions
(); }
171
172
};
173
178
class
SelectIfNot
:
public
SelectorBase
{
179
180
public
:
181
183
explicit
SelectIfNot
(
const
SelectorBase
& S) :
s
(S) {}
184
188
virtual
bool
check
(
const
Particle
& p)
const
{
return
!
s
.
check
(p); }
189
193
virtual
bool
finalState
()
const
{
return
!
s
.
finalState
(); }
194
198
virtual
bool
intermediate
()
const
{
return
!
s
.
intermediate
(); }
199
204
virtual
bool
allSteps
()
const
{
return
!
s
.
allSteps
(); }
205
210
virtual
bool
allCollisions
()
const
{
return
!
s
.
allCollisions
(); }
211
212
private
:
213
217
const
SelectorBase
&
s
;
218
};
219
225
class
SelectIfBoth
:
public
SelectorBase
{
226
227
public
:
228
232
SelectIfBoth
(
const
SelectorBase
& S1,
const
SelectorBase
& S2)
233
:
s1
(S1),
s2
(S2) {}
234
238
virtual
bool
check
(
const
Particle
& p)
const
{
239
return
s1
.
check
(p) &&
s2
.
check
(p);
240
}
241
245
virtual
bool
finalState
()
const
{
246
return
s1
.
finalState
() &&
s2
.
finalState
();
247
}
248
252
virtual
bool
intermediate
()
const
{
253
return
s1
.
intermediate
() &&
s2
.
intermediate
();
254
}
255
260
virtual
bool
allSteps
()
const
{
261
return
s1
.
allSteps
() &&
s2
.
allSteps
();
262
}
263
268
virtual
bool
allCollisions
()
const
{
269
return
s1
.
allCollisions
() &&
s2
.
allCollisions
();
270
}
271
272
private
:
273
277
const
SelectorBase
&
s1
;
278
282
const
SelectorBase
&
s2
;
283
284
};
285
291
class
SelectIfEither
:
public
SelectorBase
{
292
293
public
:
294
298
SelectIfEither
(
const
SelectorBase
& S1,
const
SelectorBase
& S2)
299
:
s1
(S1),
s2
(S2) {}
300
304
virtual
bool
check
(
const
Particle
& p)
const
{
305
return
s1
.
check
(p) ||
s2
.
check
(p);
306
}
307
311
virtual
bool
finalState
()
const
{
312
return
s1
.
finalState
() ||
s2
.
finalState
();
313
}
314
318
virtual
bool
intermediate
()
const
{
319
return
s1
.
intermediate
() ||
s2
.
intermediate
();
320
}
321
326
virtual
bool
allSteps
()
const
{
327
return
s1
.
allSteps
() ||
s2
.
allSteps
();
328
}
329
334
virtual
bool
allCollisions
()
const
{
335
return
s1
.
allCollisions
() ||
s2
.
allCollisions
();
336
}
337
338
private
:
339
343
const
SelectorBase
&
s1
;
344
348
const
SelectorBase
&
s2
;
349
350
};
351
353
template
<
typename
OutputIterator,
typename
Container>
354
inline
void
copyIfCheck
(OutputIterator r,
const
Container & c,
355
const
SelectorBase
& s) {
356
for
(
typename
Container::const_iterator it = c.begin();
357
it != c.end(); ++it )
358
if
( s.check(**it) ) *r++ = *it;
359
}
360
361
}
362
363
#endif
/* ThePEG_SelectorBase_H */
EventConfig.h
This is the main config header file for the Event classes.
ThePEG::Particle
The Particle class is used to describe an instance of a particle.
Definition:
Particle.h:83
ThePEG::SelectIfBoth
The SelectIfBoth class can be used to combine other selector objects.
Definition:
SelectorBase.h:225
ThePEG::SelectIfBoth::s2
const SelectorBase & s2
The other selector to be combined.
Definition:
SelectorBase.h:282
ThePEG::SelectIfBoth::allCollisions
virtual bool allCollisions() const
Return ture if all collisions should be considered.
Definition:
SelectorBase.h:268
ThePEG::SelectIfBoth::allSteps
virtual bool allSteps() const
Return true if all steps should be considered.
Definition:
SelectorBase.h:260
ThePEG::SelectIfBoth::s1
const SelectorBase & s1
One selector to be combined.
Definition:
SelectorBase.h:277
ThePEG::SelectIfBoth::check
virtual bool check(const Particle &p) const
Return true if the particle should be extracted.
Definition:
SelectorBase.h:238
ThePEG::SelectIfBoth::SelectIfBoth
SelectIfBoth(const SelectorBase &S1, const SelectorBase &S2)
Constructor taking two SelectorBase object to be combiden.
Definition:
SelectorBase.h:232
ThePEG::SelectIfBoth::finalState
virtual bool finalState() const
Return true if final state particles are to be considered.
Definition:
SelectorBase.h:245
ThePEG::SelectIfBoth::intermediate
virtual bool intermediate() const
Return true if intermediate particles should be considered.
Definition:
SelectorBase.h:252
ThePEG::SelectIfEither
The SelectIfEither class can be used to combine other selector objects.
Definition:
SelectorBase.h:291
ThePEG::SelectIfEither::SelectIfEither
SelectIfEither(const SelectorBase &S1, const SelectorBase &S2)
Constructor taking two SelectorBase object to be combiden.
Definition:
SelectorBase.h:298
ThePEG::SelectIfEither::intermediate
virtual bool intermediate() const
Return true if intermediate particles should be considered.
Definition:
SelectorBase.h:318
ThePEG::SelectIfEither::check
virtual bool check(const Particle &p) const
Return true if the particle should be extracted.
Definition:
SelectorBase.h:304
ThePEG::SelectIfEither::allSteps
virtual bool allSteps() const
Return true if all steps should be considered.
Definition:
SelectorBase.h:326
ThePEG::SelectIfEither::finalState
virtual bool finalState() const
Return true if final state particles are to be considered.
Definition:
SelectorBase.h:311
ThePEG::SelectIfEither::s1
const SelectorBase & s1
One selector to be combined.
Definition:
SelectorBase.h:343
ThePEG::SelectIfEither::s2
const SelectorBase & s2
The other selector to be combined.
Definition:
SelectorBase.h:348
ThePEG::SelectIfEither::allCollisions
virtual bool allCollisions() const
Return ture if all collisions should be considered.
Definition:
SelectorBase.h:334
ThePEG::SelectIfNot
The SelectIfNot classes can be used to negate the meaning of another SelectorBase object.
Definition:
SelectorBase.h:178
ThePEG::SelectIfNot::allCollisions
virtual bool allCollisions() const
Return ture if all collisions should be considered.
Definition:
SelectorBase.h:210
ThePEG::SelectIfNot::finalState
virtual bool finalState() const
Return true if final state particles are to be considered.
Definition:
SelectorBase.h:193
ThePEG::SelectIfNot::allSteps
virtual bool allSteps() const
Return true if all steps should be considered.
Definition:
SelectorBase.h:204
ThePEG::SelectIfNot::intermediate
virtual bool intermediate() const
Return true if intermediate particles should be considered.
Definition:
SelectorBase.h:198
ThePEG::SelectIfNot::SelectIfNot
SelectIfNot(const SelectorBase &S)
Constructor taking the SelectorBase object to be negated.
Definition:
SelectorBase.h:183
ThePEG::SelectIfNot::s
const SelectorBase & s
The selector to be negated.
Definition:
SelectorBase.h:217
ThePEG::SelectIfNot::check
virtual bool check(const Particle &p) const
Return true if the particle should be extracted.
Definition:
SelectorBase.h:188
ThePEG::SelectorBase
Classes derived from the SelectorBase class are used to extract particles from an Event with Event::s...
Definition:
SelectorBase.h:45
ThePEG::SelectorBase::~SelectorBase
virtual ~SelectorBase()
Virtual destructor.
Definition:
SelectorBase.h:52
ThePEG::SelectorBase::check
virtual bool check(const Particle &p) const
Return true if the particle should be extracted.
Definition:
SelectorBase.h:82
ThePEG::SelectorBase::Check
static bool Check(const Particle &)
Static method corresponding to the virtual check() method.
Definition:
SelectorBase.h:57
ThePEG::SelectorBase::finalState
virtual bool finalState() const
Return true if final state particles are to be considered.
Definition:
SelectorBase.h:87
ThePEG::SelectorBase::intermediate
virtual bool intermediate() const
Return true if intermediate particles should be considered.
Definition:
SelectorBase.h:92
ThePEG::SelectorBase::AllCollisions
static bool AllCollisions()
Static method corresponding to the virtual allCollisions() method.
Definition:
SelectorBase.h:77
ThePEG::SelectorBase::AllSteps
static bool AllSteps()
Static method corresponding to the virtual allSteps() method.
Definition:
SelectorBase.h:72
ThePEG::SelectorBase::allSteps
virtual bool allSteps() const
Return true if all steps should be considered.
Definition:
SelectorBase.h:98
ThePEG::SelectorBase::Intermediate
static bool Intermediate()
Static method corresponding to the virtual intermediate() method.
Definition:
SelectorBase.h:62
ThePEG::SelectorBase::FinalState
static bool FinalState()
Static method corresponding to the virtual finalState() method.
Definition:
SelectorBase.h:67
ThePEG::SelectorBase::allCollisions
virtual bool allCollisions() const
Return ture if all collisions should be considered.
Definition:
SelectorBase.h:104
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::copyIfCheck
void copyIfCheck(OutputIterator r, const Container &c, const SelectorBase &s)
Helper function to be used together with SelectorBase objects.
Definition:
SelectorBase.h:354
ThePEG::ParticleSelector
The templated ParticleSelector class may be used to implement derived classes from the SelectorBase c...
Definition:
SelectorBase.h:118
ThePEG::ParticleSelector::Check
static bool Check(const Particle &p)
Static method corresponding to the virtual check() method.
Definition:
SelectorBase.h:123
ThePEG::ParticleSelector::allSteps
virtual bool allSteps() const
Return true if all steps should be considered.
Definition:
SelectorBase.h:164
ThePEG::ParticleSelector::FinalState
static bool FinalState()
Static method corresponding to the virtual finalState() method.
Definition:
SelectorBase.h:133
ThePEG::ParticleSelector::AllSteps
static bool AllSteps()
Static method corresponding to the virtual allSteps() method.
Definition:
SelectorBase.h:138
ThePEG::ParticleSelector::allCollisions
virtual bool allCollisions() const
Return ture if all collisions should be considered.
Definition:
SelectorBase.h:170
ThePEG::ParticleSelector::Intermediate
static bool Intermediate()
Static method corresponding to the virtual intermediate() method.
Definition:
SelectorBase.h:128
ThePEG::ParticleSelector::AllCollisions
static bool AllCollisions()
Static method corresponding to the virtual allCollisions() method.
Definition:
SelectorBase.h:143
ThePEG::ParticleSelector::check
virtual bool check(const Particle &p) const
Return true if the particle should be extracted.
Definition:
SelectorBase.h:148
ThePEG::ParticleSelector::finalState
virtual bool finalState() const
Return true if final state particles are to be considered.
Definition:
SelectorBase.h:153
ThePEG::ParticleSelector::intermediate
virtual bool intermediate() const
Return true if intermediate particles should be considered.
Definition:
SelectorBase.h:158
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6