thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.4
ColourSinglet.h
1 // -*- C++ -*-
2 //
3 // ColourSinglet.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_ColourSinglet_H
10 #define ThePEG_ColourSinglet_H
11 
13 
14 namespace ThePEG {
15 
32 
33 public:
34 
36  typedef deque<tcPPtr> StringPiece;
38  typedef StringPiece::size_type Index;
40  typedef pair<Index,Index> Junction;
41 
42 public:
43 
48 
54 
55 protected:
56 
62  ColourSinglet(const ColourSinglet & cs, Index si);
63 
64 public:
65 
69  tcPVector & partons() { return thePartons; }
70 
74  const tcPVector & partons() const { return thePartons; }
75 
79  tcPPtr parton(tcPVector::size_type i) const { return thePartons[i]; }
80 
84  LorentzMomentum momentum() const;
85 
89  Index nPieces() const { return thePieces.size(); }
90 
95  StringPiece & piece(Index i) { return thePieces[i - 1]; }
96 
101  const StringPiece & piece(Index i) const { return thePieces[i - 1]; }
102 
107  Junction & junction(Index i, bool forward) {
108  return forward ? sink(i) : source(i);
109  }
110 
115  const Junction & junction(Index i, bool forward) const {
116  return forward ? sink(i) : source(i);
117  }
118 
123  Junction & sink(Index i) { return theSinks[i - 1]; }
124 
129  const Junction & sink(Index i) const { return theSinks[i - 1]; }
130 
135  Junction & source(Index i) { return theSources[i - 1]; }
140  const Junction & source(Index i) const { return theSources[i - 1]; }
141 
147  static vector<ColourSinglet> getSinglets(tcParticleSet & left);
148 
153  template <typename Iterator>
154  static vector<ColourSinglet>
155  getSinglets(Iterator first, Iterator last) {
156  tcParticleSet pset(first, last);
157  return getSinglets(pset);
158  }
159 
164  tcPDVector getTripletData() const;
165 
175  ColourSinglet splitInternal(Index sp = 0);
176 
186  ColourSinglet splitInternal(Index sp, Index sa, Index sc,
187  const vector<bool> & assing);
188 
200  splitDiQuarkJunction(Index sp, tcPPtr diq, tcPPair qq,
201  const vector<bool> & assign = vector<bool>());
202 
215  const vector<bool> & assign = vector<bool>());
216 
220  void swap(ColourSinglet & x) {
221  thePartons.swap(x.thePartons);
222  thePieces.swap(x.thePieces);
223  theSources.swap(x.theSources);
224  theSinks.swap(x.theSinks);
225  }
226 
227 private:
228 
236  bool fill(Index s0, bool forward, tcColinePtr first, tcParticleSet & left);
237 
243  void fill(Index i0, bool forward, const ColourSinglet & cs, Index i1);
244 
248  Index addPiece() {
249  thePieces.push_back(StringPiece());
250  theSinks.push_back(Junction());
251  theSources.push_back(Junction());
252  return nPieces();
253  }
254 
260  Junction addJunction(Index s0, bool forward);
261 
262 public:
263 
267  class ColourSingletException: public Exception {};
270 private:
271 
276 
280  vector<StringPiece> thePieces;
281 
285  vector<Junction> theSources;
286 
290  vector<Junction> theSinks;
291 
292 };
293 
294 }
295 
296 #endif /* ThePEG_ColourSinglet_H */
const Junction & junction(Index i, bool forward) const
Return the sink (or source if forward is false) neighbors of a string piece with index i (note that t...
Index nPieces() const
Return the number of string pieces.
Definition: ColourSinglet.h:89
bool fill(Index s0, bool forward, tcColinePtr first, tcParticleSet &left)
Fill a string piece.
StringPiece::size_type Index
An integer type used as index in a string pieece.
Definition: ColourSinglet.h:38
static vector< ColourSinglet > getSinglets(tcParticleSet &left)
Extract colour-singlet strings/clusters of partons from the given set.
This is the main config header file for the Event classes.
tcPVector & partons()
Access the vector of partons.
Definition: ColourSinglet.h:69
vector< tcPDPtr > tcPDVector
A vector of transient pointers to const ParticleData objects.
Definition: Containers.h:42
Junction & source(Index i)
Return the sink or source neighbors of a string piece with index i (note that the indices starts with...
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
const Junction & source(Index i) const
Return the sink or source neighbors of a string piece with index i (note that the indices starts with...
const tcPVector & partons() const
Access the vector of partons.
Definition: ColourSinglet.h:74
Index addPiece()
Add a new string piece and return its index.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
static vector< ColourSinglet > getSinglets(Iterator first, Iterator last)
Extract colour-singlet strings/clusters of partons from the given range of particles.
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
Definition: std.h:159
pair< Index, Index > Junction
Representaion of a junction.
Definition: ColourSinglet.h:40
pair< tcPPtr, tcPPtr > tcPPair
A pair of transient pointers to const Particle objects.
Definition: Containers.h:136
tcPVector thePartons
The vector of all partons.
set< tcPPtr, less< tcPPtr > > tcParticleSet
A set of transient pointers to const Particle.
Definition: EventConfig.h:80
ColourSinglet splitInternal(Index sp=0)
Split a junction string.
vector< tcPPtr > tcPVector
A vector of transient pointers to const Particle objects.
Definition: Containers.h:85
A ColourSinglet object represents a set of colour-connected partons in a total colour-singlet state...
Definition: ColourSinglet.h:31
vector< StringPiece > thePieces
The different string pieces.
void swap(ColourSinglet &x)
Swap this colour singlet for the argument.
ColourSinglet()
Default constructor.
Definition: ColourSinglet.h:47
vector< Junction > theSources
The source neighbours of the string pieces.
Junction & sink(Index i)
Return the sink or source neighbors of a string piece with index i (note that the indices starts with...
Exception is the base class for all exceptions to be used in ThePEG.
Definition: Exception.h:44
tcPDVector getTripletData() const
Return a vector with data objects corresponding to all triplet partons in this singlet.
ColourSinglet splitDiDiQuark(tcPPair qq1, tcPPair qq2, const vector< bool > &assign=vector< bool >())
Split a di-quark string.
const StringPiece & piece(Index i) const
Return the partons belonging to string piece with index i (note that the indices starts with 1)...
Junction & junction(Index i, bool forward)
Return the sink (or source if forward is false) neighbors of a string piece with index i (note that t...
LorentzMomentum momentum() const
Return the total momentum for the partons in the colour singlet.
ColourSinglet splitDiQuarkJunction(Index sp, tcPPtr diq, tcPPair qq, const vector< bool > &assign=vector< bool >())
Split a junction string.
deque< tcPPtr > StringPiece
A piece of string.
Definition: ColourSinglet.h:36
StringPiece & piece(Index i)
Return the partons belonging to string piece with index i (note that the indices starts with 1)...
Definition: ColourSinglet.h:95
tcPPtr parton(tcPVector::size_type i) const
Access a parton giving an index.
Definition: ColourSinglet.h:79
const Junction & sink(Index i) const
Return the sink or source neighbors of a string piece with index i (note that the indices starts with...
Junction addJunction(Index s0, bool forward)
Add a junction which is a source (or sink if forward) to the string piece s0.
vector< Junction > theSinks
The sink neighbours of the string pieces.