thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
ColourBase.h
1// -*- C++ -*-
2//
3// ColourBase.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_ColourBase_H
10#define ThePEG_ColourBase_H
11// This is the declaration of the ColourBase class.
12
13#include "ThePEG/EventRecord/EventInfoBase.h"
14#include "ThePEG/EventRecord/ColourLine.h"
15
16namespace ThePEG {
17
33
34public:
35
37 friend class ColourLine;
38
39public:
40
45
50
55 virtual vector<tcColinePtr> antiColourLines() const;
56
61 virtual vector<tcColinePtr> colourLines() const;
62
67 virtual bool hasColourLine(tcColinePtr line, bool anti = false) const;
68
73 bool hasAntiColourLine(tcColinePtr line) const {
74 return hasColourLine(line, true);
75 }
76
77protected:
78
82 virtual void antiColourLine(tColinePtr line) {
83 theAntiColourLine = line;
84 }
85
89 virtual void colourLine(tColinePtr l, bool anti = false) {
90 if ( anti ) antiColourLine(l);
91 else theColourLine = l;
92 }
93
97 virtual void removeAntiColourLine(tcColinePtr line) {
98 if ( antiColourLine() == line ) theAntiColourLine = tColinePtr();
99 }
100
104 virtual void removeColourLine(tcColinePtr line, bool anti = false) {
105 if ( anti ) removeAntiColourLine(line);
106 else if ( colourLine() == line ) theColourLine = tColinePtr();
107 }
108
109public:
110
118 virtual void rebind(const EventTranslationMap & trans);
119
124
129
133 static void Init();
134
138 virtual EIPtr clone() const;
139
140private:
141
146
151
152private:
153
158
162 ColourBase & operator=(const ColourBase &) = delete;
163
164};
165
166
168ThePEG_DECLARE_CLASS_TRAITS(ColourBase,EventInfoBase);
171}
172
173#endif /* ThePEG_ColourBase_H */
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
ColourBase is the base class to be used to supply a Particle with information about its colour state.
Definition: ColourBase.h:32
static ClassDescription< ColourBase > initColourBase
Describe concrete class with persistent data.
Definition: ColourBase.h:157
void persistentInput(PersistentIStream &, int)
Standard functions for reading from a persistent stream.
tColinePtr colourLine() const
Return the colour line to which this particle is connected.
Definition: ColourBase.h:49
virtual vector< tcColinePtr > antiColourLines() const
Return the anti-colour lines to which this particle is connected.
virtual void removeAntiColourLine(tcColinePtr line)
Remove the anti-colour line to which this particle is connected.
Definition: ColourBase.h:97
virtual void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
bool hasAntiColourLine(tcColinePtr line) const
Return true if the particle is connected to the given anti-colour line.
Definition: ColourBase.h:73
ColinePtr theAntiColourLine
The anti-colour line to which this particle is connected.
Definition: ColourBase.h:145
static void Init()
Standard Init function.
virtual void antiColourLine(tColinePtr line)
Set the anti-colour line to which this particle is connected.
Definition: ColourBase.h:82
virtual void removeColourLine(tcColinePtr line, bool anti=false)
Remove the (anti-) colour line to which this particle is connected.
Definition: ColourBase.h:104
ColourBase & operator=(const ColourBase &)=delete
Private and non-existent assignment operator.
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
virtual bool hasColourLine(tcColinePtr line, bool anti=false) const
Return true if the particle is connected to the given (anti-) colour line.
ColinePtr theColourLine
The colour line to which this particle is connected.
Definition: ColourBase.h:150
tColinePtr antiColourLine() const
Return the anti-colour line to which this particle is connected.
Definition: ColourBase.h:44
virtual void colourLine(tColinePtr l, bool anti=false)
Set the (anti-) colour line to which this particle is connected.
Definition: ColourBase.h:89
virtual vector< tcColinePtr > colourLines() const
Return the colour lines to which this particle is connected.
virtual EIPtr clone() const
Standard clone method.
The ColourLine class represents colour lines connecting Particles.
Definition: ColourLine.h:36
EventInfoBase is a base class for information objects.
Definition: EventInfoBase.h:27
PersistentIStream is used to read persistent objects from a stream where they were previously written...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
Rebinder is a class associating pairs of pointers to objects.
Definition: Rebinder.h:27
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
ThePEG::Ptr< ColourLine >::transient_pointer tColinePtr
Alias for a transient pointer to ColourLine .
Definition: Pointers.h:96