ThePEG  1.8.0
ColourBase.h
1 // -*- C++ -*-
2 //
3 // ColourBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 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 
44  virtual ~ColourBase();
45 
46 public:
47 
52 
56  tColinePtr colourLine() const { return theColourLine; }
57 
62  virtual vector<tcColinePtr> antiColourLines() const;
63 
68  virtual vector<tcColinePtr> colourLines() const;
69 
74  virtual bool hasColourLine(tcColinePtr line, bool anti = false) const;
75 
80  bool hasAntiColourLine(tcColinePtr line) const {
81  return hasColourLine(line, true);
82  }
83 
84 protected:
85 
89  virtual void antiColourLine(tColinePtr line) {
90  theAntiColourLine = line;
91  }
92 
96  virtual void colourLine(tColinePtr l, bool anti = false) {
97  if ( anti ) antiColourLine(l);
98  else theColourLine = l;
99  }
100 
104  virtual void removeAntiColourLine(tcColinePtr line) {
105  if ( antiColourLine() == line ) theAntiColourLine = tColinePtr();
106  }
107 
111  virtual void removeColourLine(tcColinePtr line, bool anti = false) {
112  if ( anti ) removeAntiColourLine(line);
113  else if ( colourLine() == line ) theColourLine = tColinePtr();
114  }
115 
116 public:
117 
125  virtual void rebind(const EventTranslationMap & trans);
126 
130  void persistentOutput(PersistentOStream &) const;
131 
135  void persistentInput(PersistentIStream &, int);
136 
140  static void Init();
141 
145  virtual EIPtr clone() const;
146 
147 private:
148 
153 
158 
159 private:
160 
165 
169  ColourBase & operator=(const ColourBase &);
170 
171 };
172 
173 
175 ThePEG_DECLARE_CLASS_TRAITS(ColourBase,EventInfoBase);
178 }
179 
180 #endif /* ThePEG_ColourBase_H */
ColourBase & operator=(const ColourBase &)
Private and non-existent assignment operator.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
virtual EIPtr clone() const
Standard clone method.
virtual vector< tcColinePtr > colourLines() const
Return the colour lines to which this particle is connected.
EventInfoBase is a base class for information objects.
Definition: EventInfoBase.h:27
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:681
tColinePtr antiColourLine() const
Return the anti-colour line to which this particle is connected.
Definition: ColourBase.h:51
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:509
tColinePtr colourLine() const
Return the colour line to which this particle is connected.
Definition: ColourBase.h:56
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
virtual void colourLine(tColinePtr l, bool anti=false)
Set the (anti-) colour line to which this particle is connected.
Definition: ColourBase.h:96
virtual ~ColourBase()
Destructor.
virtual void antiColourLine(tColinePtr line)
Set the anti-colour line to which this particle is connected.
Definition: ColourBase.h:89
virtual void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
virtual bool hasColourLine(tcColinePtr line, bool anti=false) const
Return true if the particle is connected to the given (anti-) colour line.
ThePEG::Ptr< ColourLine >::transient_pointer tColinePtr
Alias for a transient pointer to ColourLine .
Definition: Pointers.h:96
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
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:157
static ClassDescription< ColourBase > initColourBase
Describe concrete class with persistent data.
Definition: ColourBase.h:164
virtual vector< tcColinePtr > antiColourLines() const
Return the anti-colour lines to which this particle is connected.
The ColourLine class represents colour lines connecting Particles.
Definition: ColourLine.h:36
void persistentInput(PersistentIStream &, int)
Standard functions for reading from a persistent stream.
bool hasAntiColourLine(tcColinePtr line) const
Return true if the particle is connected to the given anti-colour line.
Definition: ColourBase.h:80
virtual void removeAntiColourLine(tcColinePtr line)
Remove the anti-colour line to which this particle is connected.
Definition: ColourBase.h:104
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:111
ColinePtr theAntiColourLine
The anti-colour line to which this particle is connected.
Definition: ColourBase.h:152