herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
Col_str.h
1 // -*- C++ -*-
2 /*
3  * Col_str.h
4  * Contains declaration of the class Col_str and associated types and operators.
5  * Created on: Jul 7, 2010
6  * Author: Malin Sjodahl
7  */
8 
9 #ifndef COLORFULL_Col_str_h
10 #define COLORFULL_Col_str_h
11 
12 #include "Quark_line.h"
13 
14 namespace ColorFull {
15 
20 typedef std::vector < Quark_line > col_str;
21 
22 
26 class Col_str {
27 public:
28 
30  Col_str(){};
31 
38  Col_str( const std::string str );
39 
41  Col_str( Quark_line Ql ) {cs.push_back(Ql);}
42 
46  col_str cs;
47 
50 
52  const Quark_line & at( int i ) const {return cs.at(i);}
53 
55  Quark_line & at( int i ) {return cs.at(i);}
56 
58  int at( int i, int j ) const;
59 
61  uint size() const{ return cs.size(); }
62 
64  bool empty() const { return cs.empty(); }
65 
67  void clear() { cs.clear(); }
68 
70  void erase( int i );
71 
73  void erase( int i, int j );
74 
76  void erase(std::pair<int, int> place);
77 
79  void append( Quark_line Ql ) { cs.push_back( Ql ); }
80 
83  void insert( int i, int j, int part_num );
84 
86  void append( col_str cs_in );
87 
89  void read_in_Col_str( std::string filename );
90 
93  void write_out_Col_str( std::string filename ) const;
94 
96  std::pair<int, int> find_parton( int part_num ) const;
97 
99  bool neighbor( int p1, int p2 ) const;
100 
102  bool right_neighbor( int p1, int p2 ) const;
103 
105  bool left_neighbor( int p1, int p2 ) const;
106 
108  void replace( int old_ind, int new_ind );
109 
115  std::string find_kind( int p ) const;
116 
118  bool gluons_only() const;
119 
122  int n_gluon() const;
123 
126  int n_quark() const;
127 
133  void normal_order();
134 
148  int smallest( const Col_str & Cs1, const Col_str & Cs2 ) const;
149 
151  int longest_quark_line() const;
152 
154  void remove_1_rings();
155 
157  void remove_0_rings();
158 
163  void simplify();
164 
167  void conjugate();
168 
173 
178  void contract_2_rings( );
179 
182  void contract_quarks( const Col_str Cs1, const Col_str Cs2 );
183 
184 
185 private:
186 
191  int compare_quark_lines( int i1, int i2 ) const;
192 
195  void Col_str_of_str( const std::string str );
196 
200  void col_str_of_str( std::string );
201 
202 }; //end class Col_str
203 
204 
210 bool operator==(const col_str & cs1, const col_str & cs2);
211 
214 bool operator!=(const col_str & cs1, const col_str & cs2);
215 
217 std::ostream& operator<<( std::ostream& out, const col_str & cs );
218 
220 Col_str operator*( const Col_str & Cs, const int i );
221 
223 Col_str operator*( const int i, const Col_str & Cs );
224 
226 Col_str operator*( const Col_str & Cs, const double d );
227 
229 Col_str operator*( const double d, const Col_str & Cs );
230 
232 Col_str operator*( const Col_str & Cs, const cnum c);
233 
235 Col_str operator*( const cnum c, const Col_str & Cs );
236 
238 Col_str operator*( const Col_str & Cs, const Monomial & Mon );
239 
241 Col_str operator*( const Monomial & Mon, const Col_str & Cs);
242 
244 Col_str operator*( const Col_str & Cs, const Polynomial & Poly );
245 
247 Col_str operator*( const Polynomial & Poly, const Col_str & Cs );
248 
250 Col_str operator*( const Col_str & Cs, const Quark_line & Ql);
251 
253 Col_str operator*( const Quark_line & Ql, const Col_str & Cs );
254 
256 Col_str operator*( const Col_str & Cs1, const Col_str & Cs2 );
257 
260 Col_str operator*( const Quark_line & Ql1, const Quark_line & Ql2 );
261 
263 std::ostream& operator<<(std::ostream& out, const Col_str & Cs);
264 
269 bool operator==( const Col_str & Cs1, const Col_str & Cs2 );
270 
273 bool operator!=( const Col_str & Cs1, const Col_str & Cs2 );
274 
275 }
276 
277 #endif /* COLORFULL_Col_str_h */
void Col_str_of_str(const std::string str)
Function to allow setting the color structure by using a string.
void write_out_Col_str(std::string filename) const
Function for writing out the Col_str to a file with name filename.
auto operator*(const ThreeVector< ValueA > &a, const ThreeVector< ValueB > &b) -> decltype(a.x() *b.x())
int smallest(const Col_str &Cs1, const Col_str &Cs2) const
Finds out the "smallest" Col_str of two Col_strs, i.e.
uint size() const
The size of the col_str.
Definition: Col_str.h:61
col_str cs
For containing the information about the color structure, a direct product of Quark_lines, contained in a vector of quark-lines.
Definition: Col_str.h:46
Col_str()
Default constructor, leaves cs empty.
Definition: Col_str.h:30
void clear()
Erase information in col_str.
Definition: Col_str.h:67
bool operator==(const LorentzVector< Value > &a, const LorentzVector< Value > &b)
void erase(int i)
Erases the Quark_line at place i.
int at(int j) const
Returns the parton at place j.
For containing a Polynomial (in Nc, CF and TR), as a sum of Monomials.
Definition: Polynomial.h:30
A class to contain ONE color structure, a direct product of Quark_lines, multiplying a Polynomial...
Definition: Col_str.h:26
Quark_line & at(int i)
Returns the Quark_line at place i.
Definition: Col_str.h:55
int n_gluon() const
Counts the number of gluons in a Col_str.
Polynomial Poly
Polynomial factor multiplying the whole product of quark-lines.
Definition: Col_str.h:49
bool right_neighbor(int p1, int p2) const
Function for telling if parton p2 stands to the right of parton p1.
Col_str(Quark_line Ql)
Make a Col_str of a Quark_line.
Definition: Col_str.h:41
void read_in_Col_str(std::string filename)
Function for reading in the Col_str from the file filename.
int n_quark() const
Counts the number of quarks (=number of anti-quarks) in a Col_str.
void insert(int i, int j, int part_num)
To insert the parton part_num in quark_line i at place j.
void col_str_of_str(std::string)
Setting the col_str member cs (i.e.
bool left_neighbor(int p1, int p2) const
Function for telling if parton p2 stands to the left of parton p1.
void normal_order()
Normal orders the Col_str by first normal order individual Quark_lines and then normal order differen...
bool gluons_only() const
Checks if the amplitude only has gluons, i.e. if all Quark_lines are closed.
void conjugate()
Function for conjugating the Col_str by conjugating each Quark_line in cs, as well as the Polynomial ...
void contract_2_rings()
Function for contracting gluon indices in closed Quark_lines with only 2 gluons.
A class to contain one quark-line with gluons attached multiplying a Polynomial, Poly.
Definition: Quark_line.h:31
const Quark_line & at(int i) const
Returns the Quark_line at place i.
Definition: Col_str.h:52
void remove_0_rings()
Removes Quark_lines without partons, equal to Nc (closed) or 1 (open).
void contract_quarks(const Col_str Cs1, const Col_str Cs2)
Function for contracting quarks between two color structures Cs1 and Cs2.
void simplify()
Removes 0 and 1-rings, moves factors multiplying the individual Quark_lines to multiply the col_str i...
void append(Quark_line Ql)
Appends a Quark_line to data member cs.
Definition: Col_str.h:79
bool neighbor(int p1, int p2) const
Function for telling if the partons p1 and p2 are neighbors.
A class to contain the factor of form TR^a*Nc^b*CF^c*int_part*cnum_part, where the powers a...
Definition: Monomial.h:23
vector< T > & operator<<(vector< T > &tv, const U &u)
void replace(int old_ind, int new_ind)
Replaces the parton index old_ind with new_ind.
int compare_quark_lines(int i1, int i2) const
Function to tell which quark_line should stand first in normal order.
int longest_quark_line() const
Returns the length of the longest Quark_line in the Col_str.
void remove_1_rings()
Removes Quark_lines with only one gluon as Tr(t^a)=0.
std::string find_kind(int p) const
Finds out if a parton is a quark, anti-quark or a gluon, returns "q", "qbar" or "g" respectively...
std::pair< int, int > find_parton(int part_num) const
Locates the parton with number part_num in a Col_str.
void contract_next_neighboring_gluons()
Contracts neighboring and next to neighboring gluons in each Quark_line in the Col_str, starting with contracting neighbors.
bool empty() const
Is the col_str empty?
Definition: Col_str.h:64