thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
ColourBase.h
1 // -*- C++ -*-
2 //
3 // ColourBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2017 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 
16 namespace ThePEG {
17 
32 class ColourBase: public EventInfoBase {
33 
34 public:
35 
37  friend class ColourLine;
38 
39 public:
40 
45 
49  tColinePtr colourLine() const { return theColourLine; }
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 
77 protected:
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 
109 public:
110 
118  virtual void rebind(const EventTranslationMap & trans);
119 
123  void persistentOutput(PersistentOStream &) const;
124 
128  void persistentInput(PersistentIStream &, int);
129 
133  static void Init();
134 
138  virtual EIPtr clone() const;
139 
140 private:
141 
146 
151 
152 private:
153 
158 
162  ColourBase & operator=(const ColourBase &) = delete;
163 
164 };
165 
166 
168 ThePEG_DECLARE_CLASS_TRAITS(ColourBase,EventInfoBase);
171 }
172 
173 #endif /* ThePEG_ColourBase_H */
PersistentIStream is used to read persistent objects from a stream where they were previously written...
EventInfoBase is a base class for information objects.
Definition: EventInfoBase.h:27
virtual vector< tcColinePtr > antiColourLines() const
Return the anti-colour lines to which this particle is connected.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
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
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
virtual void colourLine(tColinePtr l, bool anti=false)
Set the (anti-) colour line to which this particle is connected.
Definition: ColourBase.h:89
tColinePtr antiColourLine() const
Return the anti-colour line to which this particle is connected.
Definition: ColourBase.h:44
virtual EIPtr clone() const
Standard clone method.
virtual void antiColourLine(tColinePtr line)
Set the anti-colour line to which this particle is connected.
Definition: ColourBase.h:82
bool hasAntiColourLine(tcColinePtr line) const
Return true if the particle is connected to the given anti-colour line.
Definition: ColourBase.h:73
virtual bool hasColourLine(tcColinePtr line, bool anti=false) const
Return true if the particle is connected to the given (anti-) colour line.
virtual void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
ThePEG::Ptr< ColourLine >::transient_pointer tColinePtr
Alias for a transient pointer to ColourLine .
Definition: Pointers.h:96
ColourBase & operator=(const ColourBase &)=delete
Private and non-existent assignment operator.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
ColourBase is the base class to be used to supply a Particle with information about its colour state...
Definition: ColourBase.h:32
ColinePtr theColourLine
The colour line to which this particle is connected.
Definition: ColourBase.h:150
static ClassDescription< ColourBase > initColourBase
Describe concrete class with persistent data.
Definition: ColourBase.h:157
The ColourLine class represents colour lines connecting Particles.
Definition: ColourLine.h:36
tColinePtr colourLine() const
Return the colour line to which this particle is connected.
Definition: ColourBase.h:49
virtual vector< tcColinePtr > colourLines() const
Return the colour lines to which this particle is connected.
void persistentInput(PersistentIStream &, int)
Standard functions for reading from a persistent stream.
virtual void removeAntiColourLine(tcColinePtr line)
Remove the anti-colour line to which this particle is connected.
Definition: ColourBase.h:97
static void Init()
Standard Init function.
virtual void removeColourLine(tcColinePtr line, bool anti=false)
Remove the (anti-) colour line to which this particle is connected.
Definition: ColourBase.h:104
ColinePtr theAntiColourLine
The anti-colour line to which this particle is connected.
Definition: ColourBase.h:145