herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
Col_functions.h
1 // -*- C++ -*-
2 /*
3  * Col_functions.h
4  * Contains declarations of the class Col_str and associated types and operators
5  * Author: Malin Sjodahl
6  */
7 
8 #ifndef COLORFULL_Col_functions_h
9 #define COLORFULL_Col_functions_h
10 
11 
12 #include "Col_amp.h"
13 #include "Poly_matr.h"
14 #include <list>
15 #include <map>
16 #include <memory>
17 
18 namespace ColorFull {
19 
20 using std::shared_ptr;
21 
26 
27 private:
28 
30 double Nc;
31 
35 double TR;
36 
39 double CF;
40 
51 bool full_CF;
52 
53 
54 public:
55 
58  : Nc(3.0), TR(0.5), CF(4.0/3.0), full_CF( false ) {}
59 
62 void set_Nc( double n) {
63  Nc = n;
64  CF = TR*(Nc*Nc-1.)/Nc;
65 }
66 
69 void set_TR( double tr) {
70  CF *= tr/TR;
71  TR = tr;
72 }
73 
76 void set_CF( double cf) {
77  CF = cf;
78 }
79 
81 void set_full_CF( bool is_full ) { full_CF = is_full; }
82 
84 double get_Nc() const { return Nc; }
85 
86 // Returns the normalization of the generators,
88 double get_TR() const { return TR; }
89 
91 double get_CF() const { return CF; }
92 
94 bool get_full_CF() const { return full_CF; }
95 
96 
97 /****************** Functions for leading terms *************************/
98 // The functions called leading(...) depend on the variable full_CF.
99 // As it would be messy to let each Polynomial carry around
100 // its own full_CF, these functions are kept here.
101 
104 int leading_Nc_pow( const Polynomial & Poly ) const;
105 
107 int leading_Nc_pow( const Poly_vec & Pv ) const;
108 
111 int leading_Nc_pow( const std::vector< shared_ptr<Polynomial> > & Pvp) const;
112 
116 Polynomial leading( const Polynomial & Poly ) const;
117 
125 // Used only by Poly_matr version of leading
126 Poly_vec leading( const Poly_vec & Pv ) const;
127 
134 // Used only once in Col_basis
135 Poly_matr leading( const Poly_matr & Pm ) const;
136 
139 // Currently never used
140 Poly_vec leading( const std::vector<shared_ptr<Polynomial> > & Pvp) const;
141 
145 // used only by scalar_product_matrix_mem in Col_functions
146 dmatr leading( const std::vector< std::vector< shared_ptr<Polynomial> > > & Pm ) const;
147 
149 // used only on Col_functions by scalar product_matrix_mem_2 and radiation_amplitude_matrix
150 std::map< std::string, Polynomial > leading( const std::map< std::string, Polynomial > & mem_map ) const;
151 
152 
153 /********************* Functions for numerical evaluation *************************/
154 // These functions has to be kept in Col_functions class as they need numerical
155 // values for evaluation. Letting each Polynomial carry around its own Nc etc.
156 // would be messy.
157 
159 std::map< std::string, double > double_num( const std::map< std::string, shared_ptr<Polynomial> > & mem_map ) const;
160 
162 cnum cnum_num( const Monomial & Mon ) const;
163 
164 // Numerically evaluates a Monomial to a double.
165 double double_num( const Monomial & Mon ) const;
166 
168 cnum cnum_num( const Polynomial & Poly ) const;
169 
171 double double_num( const Polynomial & Poly ) const;
172 
174 std::map< std::string, double > double_num(const std::map< std::string, Polynomial > & mem_map) const;
175 
177 dvec double_num( const Poly_vec & Pv ) const;
178 
180 dvec double_num( const std::vector<shared_ptr<Polynomial> > & Pv ) const;
181 
183 dmatr double_num( const std::vector<std::vector<shared_ptr<Polynomial> > > & Pm ) const;
184 
187 Polynomial Polynomial_cnum_num( const Polynomial & Poly ) const;
188 
191 cvec cnum_num( const Poly_vec & Pv ) const;
192 
196 Poly_vec Poly_vec_cnum_num( const Poly_vec & Pv ) const;
197 
200 Poly_matr Poly_matr_cnum_num( const Poly_matr & Pm ) const;
201 
204 cmatr cnum_num( const Poly_matr & Pm ) const;
205 
207 dmatr double_num( const Poly_matr & Pm ) const;
208 
209 /****************** Functions for scalar products *************************/
210 
213 Polynomial scalar_product( const Col_amp & Ca1, const Col_amp & Ca2 ) const;
214 
217 Polynomial scalar_product( const Col_str & Cs1, const Col_str & Cs2 ) const;
218 
219 
220 /****************** Functions for gluon emission and exchange *************/
221 
225 Col_amp emit_gluon( const Col_str & in_Col_str, int emitter, int g_new ) const;
226 
230 Col_amp emit_gluon( const Col_amp & Ca_in, int emitter, int g_new ) const;
231 
235 Col_amp exchange_gluon( const Col_str & Cs, int p1, int p2 ) const;
236 
242 Col_amp exchange_gluon( const Col_amp & Ca, int p1, int p2 ) const;
243 
251 Polynomial color_correlator( const Col_amp Ca, int i, int j, int g_new ) const;
252 
253 
254 /********************* Other functions *************************/
255 
256 // As dvec and dmatr are not classes some read and write functions
257 // are contained here.
258 
262 dvec read_in_dvec( std::string filename ) const;
263 
270 dmatr read_in_dmatr( std::string filename ) const;
271 
274 void write_out_dvec( const dvec & dv, std::string filename ) const;
275 
278 void write_out_dmatr( const dmatr & matr, std::string filename ) const;
279 
281 int factorial( int i ) const;
282 
283 }; // end class Col_functions
284 
285 
287 
289 std::list<int>::iterator operator+( std::list<int>::iterator x, int n );
290 
291 std::list<int>::iterator operator-( std::list<int>::iterator x, int n );
292 
294 std::list< Quark_line >::iterator operator+( std::list < Quark_line >::iterator x, int n );
295 
296 col_str::iterator operator-( col_str::iterator x, int n );
297 
299 std::ostream& operator<<( std::ostream& out, const std::vector<int> & vec );
300 
302 std::ostream& operator<<( std::ostream& out, const cvec & cv );
303 
305 std::ostream& operator<<( std::ostream& out, const dvec & dv );
306 
308 std::ostream& operator<<( std::ostream& out, const cmatr & cm );
309 
311 std::ostream& operator<<( std::ostream& out, const dmatr & matr );
312 
314 std::ostream& operator<<( std::ostream& out, std::pair<int, int> pair );
315 } // end namespace ColorFull
316 
317 #endif /* COLORFULL_Col_functions_h */
cnum cnum_num(const Monomial &Mon) const
Numerically evaluates a Monomial using the Nc and CF variables;.
Poly_vec Poly_vec_cnum_num(const Poly_vec &Pv) const
Numerically evaluates a Poly_vec (vector of Polynomial) and stores in the form of a Poly_vec...
double get_TR() const
tr(t^a t^b)=TR*delta^{a,b}.
Definition: Col_functions.h:88
Class for containing vector of Polynomials, and functions for Polynomial vectors. ...
Definition: Poly_vec.h:25
bool get_full_CF() const
Return true, if full CF is used.
Definition: Col_functions.h:94
Class for containing a Polynomial matrix, and functions for Polynomial matrices.
Definition: Poly_matr.h:26
Col_amp exchange_gluon(const Col_str &Cs, int p1, int p2) const
Function for exchanging a gluon between the partons p1 and p2 in the Col_str Cs.
double TR
The trace convention Tr( t^a t^a )=TR (no sum).
Definition: Col_functions.h:35
Library class containing functions for index contraction and numerical evaluation.
Definition: Col_functions.h:25
std::map< std::string, double > double_num(const std::map< std::string, shared_ptr< Polynomial > > &mem_map) const
To take the numerical value of a map.
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.
bool full_CF
While evaluating leading terms one may want to keep the full value of CF for Nc=3, (TR(Nc^2-1)/Nc), or only keep the leading Nc term =TR*Nc (default).
Definition: Col_functions.h:51
double CF
The value of CF=TR (Nc^2-1)/(Nc).
Definition: Col_functions.h:39
Col_amp emit_gluon(const Col_str &in_Col_str, int emitter, int g_new) const
Function for emitting a gluon from a Col_str.
void set_Nc(double n)
Set the number of colors.
Definition: Col_functions.h:62
Polynomial Polynomial_cnum_num(const Polynomial &Poly) const
Numerically evaluates a Polynomial for Nc=3, and stores in the format of a Polynomial with only one t...
Polynomial color_correlator(const Col_amp Ca, int i, int j, int g_new) const
Calculates < M | T^(i) T^(j) | M >, the "color correlator" relevant for coherent gluon emission of gl...
double get_Nc() const
Get the number of colors.
Definition: Col_functions.h:84
double Nc
The number of colors, used in numerical results. Change here for different value. ...
Definition: Col_functions.h:30
void set_full_CF(bool is_full)
Switch on/off full_CF.
Definition: Col_functions.h:81
Polynomial scalar_product(const Col_amp &Ca1, const Col_amp &Ca2) const
Function for calculating scalar products between Col_amps.
void write_out_dmatr(const dmatr &matr, std::string filename) const
Writes out the double version of a (scalar product) matrix to the file filename.
int leading_Nc_pow(const Polynomial &Poly) const
Function for finding the leading power of Nc in a Poly_vec, i.e., the power of Nc plus the power of C...
dmatr read_in_dmatr(std::string filename) const
Read in a numerical matrix from filename and save it as a double matrix, dmatr.
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
double get_CF() const
Get the number of colors.
Definition: Col_functions.h:91
vector< T > & operator<<(vector< T > &tv, const U &u)
void write_out_dvec(const dvec &dv, std::string filename) const
Function for writing out a numerical vector, to the file filename.
Polynomial leading(const Polynomial &Poly) const
Takes the leading Nc terms of a Polynonmial, i.e.
Poly_matr Poly_matr_cnum_num(const Poly_matr &Pm) const
Numerically evaluates a Poly_matr (vector of Poly_vec) and stores in the form of a Poly_matr...
The full color amplitude is Scalar + Cs1+Cs2+Cs3...
Definition: Col_amp.h:24
void set_TR(double tr)
Set the normalization of the generators.
Definition: Col_functions.h:69
void set_CF(double cf)
Set the value of CF.
Definition: Col_functions.h:76
Col_functions()
Default constructor.
Definition: Col_functions.h:57
int factorial(int i) const
The factorial of an int, 0! is defined as 1.
dvec read_in_dvec(std::string filename) const
Read in a numerical matrix from filename and save it as a double matrix, dmatr.