thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
PDT
MatcherBase.h
1
// -*- C++ -*-
2
//
3
// MatcherBase.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_MatcherBase_H
10
#define ThePEG_MatcherBase_H
11
// This is the declaration of the MatcherBase class.
12
13
14
#include "ParticleData.h"
15
#include "ThePEG/EventRecord/Particle.h"
16
17
namespace
ThePEG
{
18
29
class
MatcherBase
:
public
Interfaced
{
30
31
public
:
32
34
friend
class
Repository
;
35
39
typedef
set<tPDPtr>
tPDSet
;
40
44
typedef
set<tPMPtr>
tPMSet
;
45
46
public
:
47
53
MatcherBase
();
54
58
MatcherBase
(
const
MatcherBase
&);
60
61
public
:
62
68
virtual
bool
check
(
const
ParticleData
&)
const
= 0;
69
75
virtual
PMPtr
pmclone
()
const
= 0;
77
83
bool
checkp
(
const
Particle
& p)
const
{
return
check
(p.
data
()); }
84
91
bool
matches
(
const
ParticleData
& pd)
const
{
92
return
member
(
matchingParticles
,
PDPtr
(
const_cast<
ParticleData
*
>
(&pd)));
93
}
94
95
102
bool
matches
(
const
Particle
& p)
const
{
return
matches
(p.
data
()); }
103
109
bool
matches
(
const
MatcherBase
& pm)
const
{
110
return
member
(
matchingMatchers
,
PMPtr
(
const_cast<
MatcherBase
*
>
(&pm)));
111
}
113
119
const
tPDSet
&
particles
()
const
{
return
matchingParticles
; }
123
const
tPMSet
&
matchers
()
const
{
return
matchingMatchers
; }
125
131
Energy
minMass
()
const
{
return
theMinMass
; }
132
136
Energy
maxMass
()
const
{
return
theMaxMass
; }
137
142
Energy
mass
()
const
{
return
commonMass
; }
143
148
Energy
width
()
const
{
return
commonWidth
; }
149
155
Length
cTau
()
const
{
return
commonCTau
; }
156
164
PDT::Charge
iCharge
()
const
{
return
commonCharge
; }
165
170
bool
charged
()
const
{
return
PDT::charged
(
commonCharge
); }
171
176
bool
positive
()
const
{
return
PDT::positive
(
commonCharge
); }
177
182
bool
negative
()
const
{
return
PDT::negative
(
commonCharge
); }
183
189
PDT::Spin
iSpin
()
const
{
return
commonSpin
; }
190
196
PDT::Colour
iColour
()
const
{
return
commonColour
; }
197
202
bool
coloured
()
const
{
return
PDT::coloured
(
commonColour
); }
203
208
int
stable
()
const
{
return
commonStable
; }
210
215
tPMPtr
CC
()
const
{
return
theAntiPartner
; }
216
217
public
:
218
219
226
void
persistentOutput
(
PersistentOStream
& os)
const
;
227
233
void
persistentInput
(
PersistentIStream
& is,
int
version);
235
239
static
void
Init
();
240
241
protected
:
242
248
virtual
void
doupdate
();
250
251
protected
:
252
257
void
addPIfMatch
(
tPDPtr
);
258
263
void
addMIfMatch
(
tPMPtr
);
264
269
template
<
typename
Iterator>
270
void
addPIfMatch
(Iterator first, Iterator last) {
271
for
( ; first != last; ++first )
addPIfMatch
(*first);
272
}
273
278
template
<
typename
Cont>
279
void
addPIfMatchFrom
(
const
Cont & c) {
280
addPIfMatch
(c.begin(), c.end());
281
}
282
287
template
<
typename
Iterator>
288
void
addMIfMatch
(Iterator first, Iterator last) {
289
for
( ; first != last; ++first )
addMIfMatch
(*first);
290
}
291
296
template
<
typename
Cont>
297
void
addMIfMatchFrom
(
const
Cont & c) {
298
addMIfMatch
(c.begin(), c.end());
299
}
300
304
void
clear
();
305
309
static
void
setCC
(
tPMPtr
pm,
tPMPtr
apm) {
310
pm->theAntiPartner = apm;
311
apm->theAntiPartner = pm;
312
}
313
314
private
:
315
319
tPDSet
matchingParticles
;
320
324
tPMSet
matchingMatchers
;
325
329
Energy
theMaxMass
;
330
334
Energy
theMinMass
;
335
339
Energy
commonMass
;
340
344
Energy
commonWidth
;
345
349
Length
commonCTau
;
350
354
PDT::Charge
commonCharge
;
355
359
PDT::Spin
commonSpin
;
360
364
PDT::Colour
commonColour
;
365
369
int
commonStable
;
370
375
tPMPtr
theAntiPartner
;
376
377
private
:
378
383
static
AbstractClassDescription<MatcherBase>
initMatcherBase
;
384
388
MatcherBase
&
operator=
(
const
MatcherBase
&) =
delete
;
389
390
};
391
396
template
<>
397
struct
BaseClassTrait
<
MatcherBase
,1>:
public
ClassTraitsType
{
399
typedef
Interfaced
NthBase
;
400
};
401
404
template
<>
405
struct
ClassTraits<MatcherBase>:
406
public
ClassTraitsBase<MatcherBase> {
408
static
string
className
() {
return
"ThePEG::MatcherBase"
; }
409
};
410
413
}
414
415
#endif
/* ThePEG_MatcherBase_H */
ThePEG::AbstractClassDescription
A concreate implementation of ClassDescriptionBase describing an abstract class with persistent data.
Definition:
ClassDescription.h:282
ThePEG::Interfaced
The Interfaced class is derived from the InterfacedBase class adding a couple of things particular to...
Definition:
Interfaced.h:38
ThePEG::MatcherBase
MatcherBase is an abstract base class to be used for objects representing groups of ParticleData obje...
Definition:
MatcherBase.h:29
ThePEG::MatcherBase::positive
bool positive() const
Are the particles positively charged? If all matching particles are positively charged,...
Definition:
MatcherBase.h:176
ThePEG::MatcherBase::addPIfMatch
void addPIfMatch(Iterator first, Iterator last)
Add a number of particles to the set of matching particles if they meets the criteria.
Definition:
MatcherBase.h:270
ThePEG::MatcherBase::matches
bool matches(const Particle &p) const
Check if a given particle belongs to the set of matches.
Definition:
MatcherBase.h:102
ThePEG::MatcherBase::theAntiPartner
tPMPtr theAntiPartner
Pointer to a matcher object which matches all anti particles which are matched by this matcher.
Definition:
MatcherBase.h:375
ThePEG::MatcherBase::checkp
bool checkp(const Particle &p) const
Check if a Particle meets the criteria.
Definition:
MatcherBase.h:83
ThePEG::MatcherBase::matchingParticles
tPDSet matchingParticles
The set of particle data objects matched by this matcher.
Definition:
MatcherBase.h:319
ThePEG::MatcherBase::matches
bool matches(const ParticleData &pd) const
Check if a given particle type belongs to the set of matches.
Definition:
MatcherBase.h:91
ThePEG::MatcherBase::tPMSet
set< tPMPtr > tPMSet
Convenient typedef.
Definition:
MatcherBase.h:44
ThePEG::MatcherBase::check
virtual bool check(const ParticleData &) const =0
Check if a particle type meets the criteria.
ThePEG::MatcherBase::addMIfMatch
void addMIfMatch(tPMPtr)
Add a particle matcher to the set of matching matchers if it meets the criteria.
ThePEG::MatcherBase::operator=
MatcherBase & operator=(const MatcherBase &)=delete
Private and non-existent assignment operator.
ThePEG::MatcherBase::coloured
bool coloured() const
Are the particles coloured? If all matching particles are coloured, return true, otherwise false.
Definition:
MatcherBase.h:202
ThePEG::MatcherBase::commonSpin
PDT::Spin commonSpin
The common spin of all matching particles.
Definition:
MatcherBase.h:359
ThePEG::MatcherBase::addMIfMatch
void addMIfMatch(Iterator first, Iterator last)
Add a number of particle matchers to the set of matching matchers if they meets the criteria.
Definition:
MatcherBase.h:288
ThePEG::MatcherBase::theMaxMass
Energy theMaxMass
The maximum mass of all matching particles.
Definition:
MatcherBase.h:329
ThePEG::MatcherBase::matchingMatchers
tPMSet matchingMatchers
A set of matchers which matches a subset of this matcher.
Definition:
MatcherBase.h:324
ThePEG::MatcherBase::minMass
Energy minMass() const
Returns the minimum mass of the matching particles.
Definition:
MatcherBase.h:131
ThePEG::MatcherBase::doupdate
virtual void doupdate()
Check sanity of the object during the setup phase.
ThePEG::MatcherBase::commonStable
int commonStable
The common stability of all matching particles.
Definition:
MatcherBase.h:369
ThePEG::MatcherBase::iSpin
PDT::Spin iSpin() const
Return common spin.
Definition:
MatcherBase.h:189
ThePEG::MatcherBase::commonWidth
Energy commonWidth
The common width of all matching particles.
Definition:
MatcherBase.h:344
ThePEG::MatcherBase::addMIfMatchFrom
void addMIfMatchFrom(const Cont &c)
Add a number of particle matchers to the set of matching matchers if they meets the criteria.
Definition:
MatcherBase.h:297
ThePEG::MatcherBase::commonColour
PDT::Colour commonColour
The common colour of all matching particles.
Definition:
MatcherBase.h:364
ThePEG::MatcherBase::CC
tPMPtr CC() const
Get the matcher object matching the antiparticles of this.
Definition:
MatcherBase.h:215
ThePEG::MatcherBase::particles
const tPDSet & particles() const
Access to the set of matching particles.
Definition:
MatcherBase.h:119
ThePEG::MatcherBase::initMatcherBase
static AbstractClassDescription< MatcherBase > initMatcherBase
The static object used to initialize the description of this class.
Definition:
MatcherBase.h:383
ThePEG::MatcherBase::addPIfMatchFrom
void addPIfMatchFrom(const Cont &c)
Add a number of particles to the set of matching particles if they meets the criteria.
Definition:
MatcherBase.h:279
ThePEG::MatcherBase::negative
bool negative() const
Are the particles negatively charged? If all matching particles are negatively charged,...
Definition:
MatcherBase.h:182
ThePEG::MatcherBase::matchers
const tPMSet & matchers() const
Access to the set of matching matchers.
Definition:
MatcherBase.h:123
ThePEG::MatcherBase::commonCharge
PDT::Charge commonCharge
The common charge of all matching particles.
Definition:
MatcherBase.h:354
ThePEG::MatcherBase::maxMass
Energy maxMass() const
Returns the maximum mass of the matching particles.
Definition:
MatcherBase.h:136
ThePEG::MatcherBase::commonCTau
Length commonCTau
The common decay length of all matching particles.
Definition:
MatcherBase.h:349
ThePEG::MatcherBase::charged
bool charged() const
Are the particles charged? If all matching particles are charged, return true, otherwise false.
Definition:
MatcherBase.h:170
ThePEG::MatcherBase::theMinMass
Energy theMinMass
The minimum mass of all matching particles.
Definition:
MatcherBase.h:334
ThePEG::MatcherBase::persistentInput
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
ThePEG::MatcherBase::stable
int stable() const
Are the particles stable? Returns (0)1 if all matching particles are (un)stable.
Definition:
MatcherBase.h:208
ThePEG::MatcherBase::addPIfMatch
void addPIfMatch(tPDPtr)
Add a particle to the set of matching particles if it meets the criteria.
ThePEG::MatcherBase::iColour
PDT::Colour iColour() const
If all matching particles have the same colour, the common colour is returned.
Definition:
MatcherBase.h:196
ThePEG::MatcherBase::setCC
static void setCC(tPMPtr pm, tPMPtr apm)
Set antipartner.
Definition:
MatcherBase.h:309
ThePEG::MatcherBase::matches
bool matches(const MatcherBase &pm) const
Check if a given particle matcher belongs to the set of matches.
Definition:
MatcherBase.h:109
ThePEG::MatcherBase::mass
Energy mass() const
Returns the common mass of the matching particles.
Definition:
MatcherBase.h:142
ThePEG::MatcherBase::iCharge
PDT::Charge iCharge() const
Return common charge.
Definition:
MatcherBase.h:164
ThePEG::MatcherBase::MatcherBase
MatcherBase()
Default constructor.
ThePEG::MatcherBase::tPDSet
set< tPDPtr > tPDSet
Convenient typedef.
Definition:
MatcherBase.h:39
ThePEG::MatcherBase::persistentOutput
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
ThePEG::MatcherBase::commonMass
Energy commonMass
The common mass of all matching particles.
Definition:
MatcherBase.h:339
ThePEG::MatcherBase::pmclone
virtual PMPtr pmclone() const =0
Specialized clone method for MatcherBase used by the Repository.
ThePEG::MatcherBase::Init
static void Init()
Standard Init function used to initialize the interface.
ThePEG::MatcherBase::clear
void clear()
Clear information about matching particles and matchers.
ThePEG::MatcherBase::width
Energy width() const
Returns the common width of the matching particles.
Definition:
MatcherBase.h:148
ThePEG::MatcherBase::cTau
Length cTau() const
Returns the common decay length of the matching particles.
Definition:
MatcherBase.h:155
ThePEG::MatcherBase::MatcherBase
MatcherBase(const MatcherBase &)
Copy-constructor.
ThePEG::PDT::positive
static bool positive(Charge c)
True if the argument corresponds to a positive charge.
Definition:
PDT.h:125
ThePEG::PDT::Charge
Charge
Definition of enumerated values used for charge information.
Definition:
PDT.h:51
ThePEG::PDT::Spin
Spin
Definition of enumerated values used for spin information.
Definition:
PDT.h:32
ThePEG::PDT::negative
static bool negative(Charge c)
True if the argument corresponds to a negative charge.
Definition:
PDT.h:132
ThePEG::PDT::Colour
Colour
Definition of enumerated values used for colour information.
Definition:
PDT.h:92
ThePEG::PDT::charged
static bool charged(Charge c)
True if the argument corresponds to a non-zero charge.
Definition:
PDT.h:118
ThePEG::PDT::coloured
static bool coloured(Colour c)
True if the argument corresponds to a non-zero colour charge.
Definition:
PDT.h:139
ThePEG::ParticleData
ParticleData inherits from InterfacedBase and represents the properties of a particle type.
Definition:
ParticleData.h:36
ThePEG::Particle
The Particle class is used to describe an instance of a particle.
Definition:
Particle.h:83
ThePEG::Particle::data
const ParticleDataClass & data() const
Access the ParticleData object of this particle type.
Definition:
Particle.h:277
ThePEG::PersistentIStream
PersistentIStream is used to read persistent objects from a stream where they were previously written...
Definition:
PersistentIStream.h:48
ThePEG::PersistentOStream
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
Definition:
PersistentOStream.h:51
ThePEG::Pointer::RCPtr
RCPtr is a reference counted (smart) pointer.
Definition:
RCPtr.h:60
ThePEG::Pointer::TransientRCPtr
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition:
RCPtr.h:519
ThePEG::Qty< 0, 1, 0 >
ThePEG::Repository
Repository inherits from the BaseRepository class.
Definition:
Repository.h:45
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::member
bool member(const Container &c, const Key &k)
Check if a given object is a part of a container.
Definition:
std.h:126
ThePEG::PMPtr
ThePEG::Ptr< MatcherBase >::pointer PMPtr
Alias for a reference counted pointer to MatcherBase .
Definition:
Pointers.h:65
ThePEG::PDPtr
ThePEG::Ptr< ParticleData >::pointer PDPtr
Alias for a reference counted pointer to ParticleData .
Definition:
Pointers.h:64
ThePEG::BaseClassTrait
BaseClassTraits describes the base classes of the templated class.
Definition:
ClassTraits.h:156
ThePEG::BaseClassTrait::NthBase
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition:
ClassTraits.h:161
ThePEG::ClassTraitsBase::className
static string className()
Return the name of class T.
Definition:
ClassTraits.h:66
ThePEG::ClassTraitsType
ClassTraitsType is an empty, non-polymorphic, base class.
Definition:
ClassTraits.h:30
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6