herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
Col_amp.h
1 // -*- C++ -*-
2 
3 /*
4  * Col_amp.h
5  * Contains the declarations of the class Col_amp, related types and operators
6  * Created on: Jul 7, 2010
7  * Author: Malin Sjodahl
8  */
9 
10 #ifndef COLORFULL_Col_amp_h
11 #define COLORFULL_Col_amp_h
12 
13 #include "Col_str.h"
14 
15 namespace ColorFull {
16 
19 typedef std::vector<Col_str> col_amp;
20 
21 
24 class Col_amp {
25 
26 public:
27 
29  Col_amp() {Scalar = Scalar * 0;}
30 
38  Col_amp( const std::string str ){Col_amp_of_str( str );}
39 
41  Col_amp( Col_str Cs ) {
42  Scalar = Scalar * 0;
43  ca.push_back(Cs);
44  }
45 
48  col_amp ca;
49 
55 
59  void read_in_Col_amp( std::string filename );
60 
63  void write_out_Col_amp( std::string filename ) const;
64 
66  const Col_str & at( int i ) const{ return ca.at(i); }
67 
69  Col_str & at( int i ) {return ca.at(i);}
70 
72  uint size() const {return ca.size();}
73 
75  bool empty() const { return ca.empty(); }
76 
78  void clear() { ca.clear(); }
79 
81  void erase( int i );
82 
84  void append( col_amp ca_in );
85 
86  // Functions for probing the Col_amp
87 
89  bool gluons_only() const;
90 
94  int n_gluon() const;
95 
99  int n_quark() const;
100 
103  int n_quark_check() const;
104 
107  int n_gluon_check() const;
108 
110  int longest_quark_line() const;
111 
112  // Functions for manipulating the Col_amp
113 
115  void remove_1_rings();
116 
118  void remove_0_rings();
119 
123  void remove_empty_Col_strs();
124 
127  void collect_col_strs();
128 
130  void normal_order_col_strs();
131 
135  void normal_order();
136 
142  void simplify();
143 
147  void conjugate();
148 
152 
157  void contract_2_rings( );
158 
164 
167  void contract_a_gluon( );
168 
171  void contract_all_gluons( );
172 
175  void contract_quarks( const Col_amp & Ca1, const Col_amp & Ca2 );
176 
177 private:
178 
179 
183  void contract_a_gluon( Col_str & Cs );
184 
191 
199  void contract_Quark_line_gluons( Col_str & Cs );
200 
205  void contract_all_gluons( Col_str & Cs );
206 
213  void Col_amp_of_str( const std::string str );
214 
215 };
216 
217 // Define operators involving Col_amp
218 
220 std::ostream& operator<<( std::ostream& out, const col_amp & ca );
221 
223 std::ostream& operator<<( std::ostream& out, const Col_amp & Ca );
224 
226 bool operator==( const Col_amp & Ca1, const Col_amp & Ca2 );
227 
229 bool operator!=( const Col_amp & Ca1, const Col_amp & Ca2 );
230 
232 Col_amp operator+( const Col_amp & Ca, const Col_str & Cs );
233 
235 Col_amp operator+( const Col_str & Cs, const Col_amp & Ca );
236 
239 Col_amp operator+( const Col_amp & Ca1, const Col_amp & Ca2 );
240 
242 Col_amp operator+=( Col_amp & Ca1, const Col_amp & Ca2 );
243 
246 Col_amp operator-( const Col_amp & Ca1, const Col_amp & Ca2 );
247 
249 Col_amp operator*( const Col_amp & Ca, const int i );
250 
252 Col_amp operator*( const int i, const Col_amp & Ca );
253 
255 Col_amp operator*( const Col_amp & Ca, const cnum c );
256 
258 Col_amp operator*( const cnum c, const Col_amp & Ca );
259 
261 Col_amp operator*( const Col_amp & Ca, const double d );
262 
264 Col_amp operator*( const double d, const Col_amp & Ca );
265 
267 Col_amp operator*( const Col_amp & Ca, const Monomial & Mon );
268 
270 Col_amp operator*( const Monomial & Mon, const Col_amp & Ca );
271 
273 Col_amp operator*( const Col_amp & Ca, const Polynomial & Poly );
274 
276 Col_amp operator*( const Polynomial & Poly, const Col_amp & Ca );
277 
279 Col_amp operator*( const Col_amp & Ca, const Col_str & Cs );
280 
282 Col_amp operator*( const Col_str & Cs, const Col_amp & Ca );
283 
285 Col_amp operator*( const Col_amp & Ca1, const Col_amp & Ca2 );
286 
288 Col_amp operator*=( Col_amp & Ca1, const Col_amp & Ca2 );
289 
290 }// end namespace ColorFull
291 
292 #endif /* COLORFULL_Col_amp_h */
void contract_quarks(const Col_amp &Ca1, const Col_amp &Ca2)
Function for contracting the (anti-)quarks in Ca1 with those in Ca2.
uint size() const
The size of the col_amp ca.
Definition: Col_amp.h:72
void collect_col_strs()
Compares col_strs in a Col_amp, to collect similar col_strs, and only store once in ca...
void simplify()
Function for simplifying an amplitude, removes 0 and 1-rings, compares col_strs, removes Col_strs mul...
void append(col_amp ca_in)
Appends the Col_strs in ca_in to the col_amp member ca.
Col_str & at(int i)
Returns the Col_str at place i.
Definition: Col_amp.h:69
int n_quark_check() const
Returns the number of quarks in the Col_amp after checking that each Col_str has the same number of q...
int n_gluon_check() const
Returns the number of gluons in the Col_amp after checking that each Col_str has the same number of g...
void conjugate()
Function for taking the conjugate of the Col_amp by conjugating each Col_str in ca and the Polynomial...
bool gluons_only() const
Checks if the Col_amp only contains gluons, i.e., if all Quark_lines are closed.
bool operator==(const LorentzVector< Value > &a, const LorentzVector< Value > &b)
void Col_amp_of_str(const std::string str)
Converts a text string to a Col_amp, used by string constructor, and by read_in_Col_amp.
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
Generator< Sum< Density1, Density2 > > operator+(const Generator< Density1 > &first, const Generator< Density2 > &second)
Construct the sum of two densities.
Col_amp(Col_str Cs)
Constructor converting a Col_str to a Col_amp.
Definition: Col_amp.h:41
void normal_order_col_strs()
Normal orders all col_strs in ca.
void remove_1_rings()
Remove Col_strs with quark_lines with just 1 gluon, they are 0 as Tr[t^a]=0.
bool empty() const
Is the col_amp empty?
Definition: Col_amp.h:75
int n_quark() const
Returns the number of quarks in the Col_amp as the number of quarks in the first Col_str.
void remove_empty_Col_strs()
Removes empty Col_strs, an empty Col_str means that all indices have been contracted, so the Col_str is equal to its Polynomial, which is moved to the scalar part of the Col_amp.
void clear()
Erase information in col_amp.
Definition: Col_amp.h:78
void contract_a_gluon()
Contracts one gluon, the first gluon in first Quark_line (in each Col_str), only intended for closed ...
void normal_order()
Normal orders the individual col_strs and then orders the Col_strs using the order defined in the Col...
void contract_2_rings()
Contract closed Quark_lines with only 2 gluons in each Quark_line in each Col_str in the Col_amp...
void contract_next_neighboring_gluons()
Contracts up to next to neighboring gluons in each Quark_line in each Col_str in each Col_amp...
void contract_Quark_line_gluons()
Function for contracting gluon indices within the Quark_lines.
void contract_all_gluons()
Function for contracting all gluon indices in a Col_amp, only intended for closed Quark_lines...
col_amp ca
To actually contain the info of the Col_strs, ca=Cs1+Cs2+Cs3+...
Definition: Col_amp.h:48
void erase(int i)
Erases the Col_str at place i.
void read_in_Col_amp(std::string filename)
Reads in the Col_amp to the member ca from the file filename.
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 write_out_Col_amp(std::string filename) const
Function for writing out the Col_amp to a file with name filename.
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 remove_0_rings()
Remove quark_lines with no gluons, they are N if closed, and defined to be 1 if open.
BinaryOpTraits< ValueA, ValueB >::MulT operator*(const ThreeVector< ValueA > &a, const ThreeVector< ValueB > &b)
The full color amplitude is Scalar + Cs1+Cs2+Cs3...
Definition: Col_amp.h:24
int n_gluon() const
Returns the number of gluons in the Col_amp as the number of gluons in the first Col_str.
int longest_quark_line() const
Returns the length of the longest Quark_line in any Col_str.
const Col_str & at(int i) const
Returns the Col_str at place i.
Definition: Col_amp.h:66
Col_amp(const std::string str)
Constructor taking a string as argument.
Definition: Col_amp.h:38
Col_amp()
Default constructor.
Definition: Col_amp.h:29
Polynomial Scalar
Scalar is Polynomial for collecting color factors when the color structure has been fully contracted...
Definition: Col_amp.h:54