herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
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_str Cs ) {ca.push_back( Cs );}
85 
87  void append( col_amp ca_in );
88 
89 
90  // Functions for probing the Col_amp
91 
93  bool gluons_only() const;
94 
98  int n_gluon() const;
99 
103  int n_quark() const;
104 
107  int n_quark_check() const;
108 
111  int n_gluon_check() const;
112 
114  int longest_quark_line() const;
115 
116  // Functions for manipulating the Col_amp
117 
119  void remove_1_rings();
120 
122  void remove_0_rings();
123 
127  void remove_empty_Col_strs();
128 
131  void collect_col_strs();
132 
134  void normal_order_col_strs();
135 
139  void normal_order();
140 
146  void simplify();
147 
151  void conjugate();
152 
156 
162  void contract_2_rings( );
163 
167 
170  void contract_a_gluon( );
171 
174  void contract_all_gluons( );
175 
178  void contract_quarks( const Col_amp & Ca1, const Col_amp & Ca2 );
179 
180 private:
181 
182 
186  void contract_a_gluon( Col_str & Cs );
187 
194 
202  void contract_Quark_line_gluons( Col_str & Cs );
203 
208  void contract_all_gluons( Col_str & Cs );
209 
216  void Col_amp_of_str( const std::string str );
217 
218 };
219 
220 // Define operators involving Col_amp
221 
223 std::ostream& operator<<( std::ostream& out, const col_amp & ca );
224 
226 std::ostream& operator<<( std::ostream& out, const Col_amp & Ca );
227 
229 bool operator==( const Col_amp & Ca1, const Col_amp & Ca2 );
230 
232 bool operator!=( const Col_amp & Ca1, const Col_amp & Ca2 );
233 
235 Col_amp operator+( const Col_amp & Ca, const Col_str & Cs );
236 
238 Col_amp operator+( const Col_str & Cs, const Col_amp & Ca );
239 
242 Col_amp operator+( const Col_amp & Ca1, const Col_amp & Ca2 );
243 
245 Col_amp operator+=( Col_amp & Ca, const Col_str & Cs );
246 
248 Col_amp operator+=( Col_amp & Ca1, const Col_amp & Ca2 );
249 
252 Col_amp operator-( const Col_amp & Ca1, const Col_amp & Ca2 );
253 
255 Col_amp operator-( const Col_amp & Ca, const Col_str & Cs );
256 
258 Col_amp operator-( const Col_amp & Ca, const Col_str & Cs );
259 
261 Col_amp operator*( const Col_amp & Ca, const int i );
262 
264 Col_amp operator*( const int i, const Col_amp & Ca );
265 
267 Col_amp operator*( const Col_amp & Ca, const cnum c );
268 
270 Col_amp operator*( const cnum c, const Col_amp & Ca );
271 
273 Col_amp operator*( const Col_amp & Ca, const double d );
274 
276 Col_amp operator*( const double d, const Col_amp & Ca );
277 
279 Col_amp operator*( const Col_amp & Ca, const Monomial & Mon );
280 
282 Col_amp operator*( const Monomial & Mon, const Col_amp & Ca );
283 
285 Col_amp operator*( const Col_amp & Ca, const Polynomial & Poly );
286 
288 Col_amp operator*( const Polynomial & Poly, const Col_amp & Ca );
289 
291 Col_amp operator*( const Col_amp & Ca, const Quark_line & Ql );
292 
294 Col_amp operator*( const Quark_line & Ql, const Col_amp & Ca );
295 
297 Col_amp operator*( const Col_amp & Ca, const Col_str & Cs );
298 
300 Col_amp operator*( const Col_str & Cs, const Col_amp & Ca );
301 
303 Col_amp operator*( const Col_amp & Ca1, const Col_amp & Ca2 );
304 
306 Col_amp operator*=( Col_amp & Ca1, const Col_amp & Ca2 );
307 
308 }// end namespace ColorFull
309 
310 #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...
auto operator*(const ThreeVector< ValueA > &a, const ThreeVector< ValueB > &b) -> decltype(a.x() *b.x())
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()
Erases the information in the 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 information about 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 Nc if closed, and defined to be 1 if open.
The full color amplitude is Scalar + Cs1+Cs2+Cs3...
Definition: Col_amp.h:24
void append(Col_str Cs)
Appends a Col_str to the data member ca.
Definition: Col_amp.h:84
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, sets Scalar=0, and leaves ca empty.
Definition: Col_amp.h:29
Polynomial Scalar
Scalar is Polynomial for collecting color factors appearing when the color structure has been fully c...
Definition: Col_amp.h:54