1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
// -*- C++ -*-
//
// ColourBase.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_ColourBase_H
#define ThePEG_ColourBase_H
// This is the declaration of the ColourBase class.
#include "ThePEG/EventRecord/EventInfoBase.h"
#include "ThePEG/EventRecord/ColourLine.h"
namespace ThePEG {
/**
* ColourBase is the base class to be used to supply a
* Particle with information about its colour
* state. This base class supplies information about the
* <code>ColourLine</code>s to which the particle is
* connected. This should be sufficient for most uses. If any other
* info is required for a particle, it may be supplied by an object of
* a sub-class of <code>ColourBase</code>, the additional information
* would then have to be extracted by dynamically casting to the
* sub-class.
*
* @see Particle
* @see ColourLine
*/
class ColourBase: public EventInfoBase {
public:
/** ColourLine is a good friend. */
friend class ColourLine;
public:
/**
* Destructor.
*/
virtual ~ColourBase();
public:
/**
* Return the anti-colour line to which this particle is connected.
*/
tColinePtr antiColourLine() const { return theAntiColourLine; }
/**
* Return the colour line to which this particle is connected.
*/
tColinePtr colourLine() const { return theColourLine; }
/**
* Return the anti-colour lines to which this particle is
* connected. (Always only one colour line for this base class.)
*/
virtual vector<tcColinePtr> antiColourLines() const;
/**
* Return the colour lines to which this particle is
* connected. (Always only one colour line for this base class.)
*/
virtual vector<tcColinePtr> colourLines() const;
/**
* Return true if the particle is connected to the given (\a anti-)
* colour \a line.
*/
virtual bool hasColourLine(tcColinePtr line, bool anti = false) const;
/**
* Return true if the particle is connected to the given anti-colour
* \a line.
*/
bool hasAntiColourLine(tcColinePtr line) const {
return hasColourLine(line, true);
}
protected:
/**
* Set the anti-colour \a line to which this particle is connected.
*/
virtual void antiColourLine(tColinePtr line) {
theAntiColourLine = line;
}
/**
* Set the (\a anti-) colour line to which this particle is connected.
*/
virtual void colourLine(tColinePtr l, bool anti = false) {
if ( anti ) antiColourLine(l);
else theColourLine = l;
}
/**
* Remove the anti-colour \a line to which this particle is connected.
*/
virtual void removeAntiColourLine(tcColinePtr line) {
if ( antiColourLine() == line ) theAntiColourLine = tColinePtr();
}
/**
* Remove the (\a anti-) colour line to which this particle is connected.
*/
virtual void removeColourLine(tcColinePtr line, bool anti = false) {
if ( anti ) removeAntiColourLine(line);
else if ( colourLine() == line ) theColourLine = tColinePtr();
}
public:
/**
* Rebind to cloned objects. When a ColourBase is cloned, a shallow
* copy is done first, then all <code>ColourLine</code>s etc, are
* cloned, and finally this method is used to see to that the
* pointers in the cloned ColourBase points to the cloned
* <code>ColourLine</code>s etc.
*/
virtual void rebind(const EventTranslationMap & trans);
/**
* Standard function for writing to a persistent stream.
*/
void persistentOutput(PersistentOStream &) const;
/**
* Standard functions for reading from a persistent stream.
*/
void persistentInput(PersistentIStream &, int);
/**
* Standard Init function. @see Base::Init().
*/
static void Init();
/**
* Standard clone method.
*/
virtual EIPtr clone() const;
private:
/**
* The anti-colour line to which this particle is connected.
*/
ColinePtr theAntiColourLine;
/**
* The colour line to which this particle is connected.
*/
ColinePtr theColourLine;
private:
/**
* Describe concrete class with persistent data.
*/
static ClassDescription<ColourBase> initColourBase;
/**
* Private and non-existent assignment operator.
*/
ColourBase & operator=(const ColourBase &);
};
/** @cond TRAITSPECIALIZATIONS */
ThePEG_DECLARE_CLASS_TRAITS(ColourBase,EventInfoBase);
/** @endcond */
}
#endif /* ThePEG_ColourBase_H */
|