thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
ColourLine.h
1// -*- C++ -*-
2//
3// ColourLine.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_ColourLine_H
10#define ThePEG_ColourLine_H
11// This is the declaration of the ColourLine class.
12
13#include "EventConfig.h"
14#include "ThePEG/Utilities/ClassDescription.h"
15#include "ThePEG/EventRecord/ColourSinglet.h"
16
17namespace ThePEG {
18
37
38public:
39
46 static tColinePtr create(tPPtr col, tPPtr anti);
47
55 static tColinePtr create(tPPtr p, bool anti = false);
56
62 static tColinePtr createAnti(tPPtr p) { return create(p, true); }
63
71 tColinePtr sin1, tColinePtr sin2);
73
77 virtual ~ColourLine();
78
79public:
80
87 const tPVector & coloured() const { return theColoured; }
88
93 const tPVector & antiColoured() const { return theAntiColoured; }
94
102
109
111
118
124 void addColoured(tPPtr p, bool anti = false);
125
129 void addAntiColouredIndexed(tPPtr p, int index);
130
136 void addColouredIndexed(tPPtr p, int index, bool anti=false);
137
142
148 void removeColoured(tPPtr p, bool anti = false);
149
151
159
165 tColinePair sourceNeighbours(bool anti = false) const {
167 }
168
175 theSinkNeighbours.second = l1->theSinkNeighbours.second = l2;
176 l2->theSinkNeighbours.second = theSinkNeighbours.first = l1;
177 l1->theSinkNeighbours.first = l2->theSinkNeighbours.first = this;
178 }
179
186 theSourceNeighbours.second = l1->theSourceNeighbours.second = l2;
187 l2->theSourceNeighbours.second = theSourceNeighbours.first = l1;
188 l1->theSourceNeighbours.first = l2->theSourceNeighbours.first = this;
189 }
190
192
201 bool join(ColinePtr line);
202
207 template <typename Iterator>
208 typename std::iterator_traits<Iterator>::value_type
209 getColouredParticle(Iterator first, Iterator last, bool anti = false) const {
210 typedef typename std::iterator_traits<Iterator>::value_type ParticlePointer;
211 for ( ; first != last; ++first )
212 if ( (**first).coloured() && (**first).hasColourLine(this, anti) )
213 return *first;
214 return ParticlePointer();
215 }
216
220 void write(ostream & os, tcEventPtr event, bool anti) const;
221
222public:
223
228
233
234private:
235
241
247
253
259
265 vector<ColinePtr> orphanedConnectors;
266
267private:
268
273
277 ColourLine & operator=(const ColourLine &) = delete;
278
279};
280
281}
282
283
284namespace ThePEG {
285
292template <>
293struct BaseClassTrait<ColourLine,1>: public ClassTraitsType {
295 typedef EventRecordBase NthBase;
296};
297
302template <>
303struct ClassTraits<ColourLine>: public ClassTraitsBase<ColourLine> {
305 static string className() { return "ThePEG::ColourLine"; }
308 static string library() { return "ColourLine.so"; }
309};
310
313}
314
315#endif /* ThePEG_ColourLine_H */
This is the main config header file for the Event classes.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
The ColourLine class represents colour lines connecting Particles.
Definition: ColourLine.h:36
void addColoured(tPPtr p, bool anti=false)
Add a particle having this as a (anti-)colour line.
static tColinePtr create(tColinePtr son1, tColinePtr son2, tColinePtr sin1, tColinePtr sin2)
Create a coloue line which is a connector between two junctions, a source junction with neigboring co...
ColourLine & operator=(const ColourLine &)=delete
Private and non-existent assignment operator.
void removeAntiColoured(tPPtr)
Remove a particle having this as an anti-colour line.
bool join(ColinePtr line)
Join with the given ColourLine.
tPVector theColoured
The particles connecting to this colour line, following the incoming colour flow.
Definition: ColourLine.h:240
static ClassDescription< ColourLine > initColourLine
Describe a concrete class with persistent data.
Definition: ColourLine.h:272
std::iterator_traits< Iterator >::value_type getColouredParticle(Iterator first, Iterator last, bool anti=false) const
Return the first (anti-)coloured parton among the given range of particles which is on this colour li...
Definition: ColourLine.h:209
const tPVector & antiColoured() const
Return the vectors of particles connected to this line with their anti-colours.
Definition: ColourLine.h:93
static tColinePtr createAnti(tPPtr p)
Create a colour line.
Definition: ColourLine.h:62
void write(ostream &os, tcEventPtr event, bool anti) const
Write out information about this colour line to the stream.
void setSourceNeighbours(tColinePtr l1, tColinePtr l2)
Add two colour lines as neighbours to this line.
Definition: ColourLine.h:185
void setSinkNeighbours(tColinePtr l1, tColinePtr l2)
Add two colour lines as neighbours to this line.
Definition: ColourLine.h:174
void addAntiColouredIndexed(tPPtr p, int index)
Add a particle having this as a anti-colour line at a given index.
static tColinePtr create(tPPtr col, tPPtr anti)
Create a colour line.
vector< ColinePtr > orphanedConnectors
Colour lines which are connectors between two junctions do not have a particle which owns it,...
Definition: ColourLine.h:265
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
tPVector theAntiColoured
The particles connecting to this colour line, following the outgoing colour flow.
Definition: ColourLine.h:246
void addAntiColoured(tPPtr)
Add a particle having this as a anti-colour line.
void persistentInput(PersistentIStream &, int)
Standard function for reading from a persistent stream.
tColinePair sinkNeighbours() const
If this colour line ends in a colour sink, these two colour lines ends in the same.
Definition: ColourLine.h:158
tColinePair theSourceNeighbours
If this colour line stems from a colour source, these two colour lines stems from the same.
Definition: ColourLine.h:252
tPPtr endParticle() const
Return the last particle on this colour line.
virtual ~ColourLine()
Destructor.
void addColouredIndexed(tPPtr p, int index, bool anti=false)
Add a particle having this as a (anti-)colour line at a given index.
tColinePair theSinkNeighbours
If this colour line ends in a colour sink, these two colour lines ends in the same.
Definition: ColourLine.h:258
const tPVector & coloured() const
Return the vectors of particles connected to this line with their colours.
Definition: ColourLine.h:87
tColinePair sourceNeighbours(bool anti=false) const
If this colour line stems from a colour source (sink), these two colour lines stems from (ends in) th...
Definition: ColourLine.h:165
static tColinePtr create(tPPtr p, bool anti=false)
Create a colour line.
void removeColoured(tPPtr p, bool anti=false)
Remove a particle having this as a (anti-)colour line.
tPPtr startParticle() const
Return the first particle on this colour line.
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
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
Base EventRecordBase
EventRecordBase is the base class of all event record classes.
Definition: EventConfig.h:41
pair< tColinePtr, tColinePtr > tColinePair
A pair of transient pointers to ColourLine objects.
Definition: Containers.h:148
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
Define the base class from which all (polymorphic) classes in ThePEG are derived.
Definition: ThePEG.h:54
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
static string library()
The name of a file containing the dynamic library where the class T is implemented.
Definition: ClassTraits.h:85