Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:21

0001 // -*- C++ -*-
0002 //
0003 // MultiColour.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef THEPEG_MultiColour_H
0010 #define THEPEG_MultiColour_H
0011 //
0012 // This is the declaration of the MultiColour class.
0013 //
0014 
0015 #include "ThePEG/EventRecord/ColourBase.h"
0016 
0017 namespace ThePEG {
0018 
0019 /**
0020  * This class is used to store colour information of RemnantParticle
0021  * objects and other particle classes with complicated colour
0022  * structures. Rather than just having a 
0023  */
0024 class MultiColour: public ColourBase {
0025 
0026 public:
0027 
0028   using ColourBase::colourLine;
0029   using ColourBase::antiColourLine;
0030 
0031   /**
0032    * Return the anti-colour lines to which this particle is
0033    * connected.
0034    */
0035   virtual vector<tcColinePtr> antiColourLines() const;
0036 
0037   /**
0038    * Return the colour lines to which this particle is
0039    * connected.
0040    */
0041   virtual vector<tcColinePtr> colourLines() const;
0042 
0043   /**
0044    * Add the given (\a anti-) colour \a line to the particle. If the base
0045    * class has no (anti-) colour line, it will also be set.
0046    */
0047   virtual void colourLine(tColinePtr line, bool anti = false);
0048 
0049   /**
0050    * Add the given (\a anti-) colour \a line to the particle. If the base
0051    * class has no (anti-) colour line, it will also be set.
0052    */
0053   virtual void colourLine(tColinePtr line, int index, bool anti = false);
0054 
0055   /**
0056    * Add the given anti-colour \a line to the particle. If the base
0057    * class has no anti-colour line, it will also be set.
0058    */
0059   virtual void antiColourLine(tColinePtr line);
0060 
0061   /**
0062    * Add the given anti-colour \a line to the particle. If the base
0063    * class has no anti-colour line, it will also be set.
0064    */
0065   virtual void antiColourLine(tColinePtr line, int index);
0066 
0067   /**
0068    * Remove the given (\a anti-) colour \a line from the particle. If
0069    * the line is the colourLine() of the base class, it will be
0070    * removed there as well.
0071    */
0072   virtual void removeColourLine(tcColinePtr line, bool anti = false);
0073 
0074   /**
0075    * Remove the given anti-colour \a line from the particle. If the
0076    * line is the antiColourLine() of the base class, it will be
0077    * removed there as well.
0078    */
0079   virtual void removeAntiColourLine(tcColinePtr line);
0080 
0081   /**
0082    * Return true if the particle is connected to the given (\a anti-)
0083    * colour \a line.
0084    */
0085   virtual bool hasColourLine(tcColinePtr line, bool anti = false) const;
0086 
0087 public:
0088 
0089   /** @name Functions used by the persistent I/O system. */
0090   //@{
0091   /**
0092    * Function used to write out object persistently.
0093    * @param os the persistent output stream written to.
0094    */
0095   void persistentOutput(PersistentOStream & os) const;
0096 
0097   /**
0098    * Function used to read in object persistently.
0099    * @param is the persistent input stream read from.
0100    * @param version the version number of the object when written.
0101    */
0102   void persistentInput(PersistentIStream & is, int version);
0103   //@}
0104 
0105   /**
0106    * The standard Init function used to initialize the interfaces.
0107    * Called exactly once for each class by the class description system
0108    * before the main function starts or
0109    * when this class is dynamically loaded.
0110    */
0111   static void Init();
0112 
0113   /**
0114    * Standard clone method.
0115    */
0116   virtual EIPtr clone() const { return new_ptr(*this); }
0117 
0118 private:
0119 
0120   /**
0121    * The set of colour lines to which a particle is attached.
0122    */
0123   list<cColinePtr> theColourLines;
0124 
0125   /**
0126    * The set of anti-colour lines to which a particle is attached.
0127    */
0128   list<cColinePtr> theAntiColourLines;
0129 
0130 private:
0131 
0132   /**
0133    * The static object used to initialize the description of this class.
0134    * Indicates that this is a concrete class with persistent data.
0135    */
0136   static ClassDescription<MultiColour> initMultiColour;
0137 
0138   /**
0139    * The assignment operator is private and must never be called.
0140    * In fact, it should not even be implemented.
0141    */
0142   MultiColour & operator=(const MultiColour &) = delete;
0143 
0144 };
0145 
0146 }
0147 
0148 #include "ThePEG/Utilities/ClassTraits.h"
0149 
0150 namespace ThePEG {
0151 
0152 /** @cond TRAITSPECIALIZATIONS */
0153 
0154 /** This template specialization informs ThePEG about the
0155  *  base classes of MultiColour. */
0156 template <>
0157 struct BaseClassTrait<MultiColour,1> {
0158   /** Typedef of the first base class of MultiColour. */
0159   typedef ColourBase NthBase;
0160 };
0161 
0162 /** This template specialization informs ThePEG about the name of
0163  *  the MultiColour class and the shared object where it is defined. */
0164 template <>
0165 struct ClassTraits<MultiColour>
0166   : public ClassTraitsBase<MultiColour> {
0167   /** Return a platform-independent class name */
0168   static string className() { return "ThePEG::MultiColour"; }
0169   /**
0170    * The name of a file containing the dynamic library where the class
0171    * MultiColour is implemented. It may also include several, space-separated,
0172    * libraries if the class MultiColour depends on other classes (base classes
0173    * excepted). In this case the listed libraries will be dynamically
0174    * linked in the order they are specified.
0175    */
0176   static string library() { return "MultiColour.so"; }
0177 };
0178 
0179 /** @endcond */
0180 
0181 }
0182 
0183 #endif /* THEPEG_MultiColour_H */