herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
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 
31 double Nc;
32 
37 double TR;
38 
41 double CF;
42 
53 bool full_CF;
54 
55 
56 public:
57 
60  : Nc(3.0), TR(0.5), CF(4.0/3.0), full_CF( false ) {}
61 
64 void set_Nc( double n) {
65  Nc = n;
66  CF = TR*(Nc*Nc-1.)/Nc;
67 }
68 
71 void set_TR( double tr) {
72  CF *= tr/TR;
73  TR = tr;
74 }
75 
78 void set_CF( double cf) {
79  CF = cf;
80 }
81 
83 void set_full_CF( bool is_full ) { full_CF = is_full; }
84 
86 double get_Nc() const { return Nc; }
87 
90 double get_TR() const { return TR; }
91 
93 double get_CF() const { return CF; }
94 
96 bool get_full_CF() const { return full_CF; }
97 
98 
99 /****************** Functions for leading terms *************************/
100 // The functions called leading(...) depend on the variable full_CF.
101 // As it would be messy to let each Polynomial carry around
102 // its own full_CF, these functions are kept here.
103 
106 int leading_Nc_pow( const Polynomial & Poly ) const;
107 
109 int leading_Nc_pow( const Poly_vec & Pv ) const;
110 
111 /*
114 int leading_Nc_pow( const std::vector< shared_ptr<Polynomial> > & Pvp) const;
115 */
116 
120 Polynomial leading( const Polynomial & Poly ) const;
121 
129 // Used only by Poly_matr version of leading
130 Poly_vec leading( const Poly_vec & Pv ) const;
131 
138 // Used only once in Col_basis
139 Poly_matr leading( const Poly_matr & Pm ) const;
140 
141 /*
144 // Currently never used
145 Poly_vec leading( const std::vector<shared_ptr<Polynomial> > & Pvp) const;
146 
150 // used only by scalar_product_matrix_mem in Col_functions
151 dmatr leading( const std::vector< std::vector< shared_ptr<Polynomial> > > & Pm ) const;
152 */
153 
154 /********************* Functions for numerical evaluation *************************/
155 // These functions has to be kept in Col_functions class as they need numerical
156 // values for evaluation. Letting each Polynomial carry around its own Nc etc.
157 // would be messy.
158 
159 
161 cnum cnum_num( const Monomial & Mon ) const;
162 
164 cnum cnum_num( const Polynomial & Poly ) const;
165 
168 cvec cnum_num( const Poly_vec & Pv ) const;
169 
172 cmatr cnum_num( const Poly_matr & Pm ) const;
173 
175 double double_num( const Monomial & Mon ) const;
176 
178 double double_num( const Polynomial & Poly ) const;
179 
182 dvec double_num( const Poly_vec & Pv ) const;
183 
186 dmatr double_num( const Poly_matr & Pm ) const;
187 
188 /*
190 dvec double_num( const std::vector<std::shared_ptr<Polynomial> > & Pv ) const;
191 
193 // (not used 14 06 08)
194 dmatr double_num( const std::vector<std::vector<std::shared_ptr<Polynomial> > > & Pm ) const;
195 
197 // (not used 14 06 08)
198 std::map< std::string, double > double_num( std::map< std::string, std::shared_ptr<Polynomial> > mem_map ) const;
199 
201 // (not used 14 06 08)
202 std::map< std::string, double > double_num( std::map< std::string, Polynomial > mem_map ) const;
203 */
204 
207 Polynomial Polynomial_cnum_num( const Polynomial & Poly ) const;
208 
212 Poly_vec Poly_vec_cnum_num( const Poly_vec & Pv ) const;
213 
216 Poly_matr Poly_matr_cnum_num( const Poly_matr & Pm ) const;
217 
218 
219 /****************** Functions for scalar products *************************/
220 
223 Polynomial scalar_product( const Col_amp & Ca1, const Col_amp & Ca2 ) const;
224 
227 Polynomial scalar_product( const Col_str & Cs1, const Col_str & Cs2 ) const;
228 
229 
230 /****************** Functions for gluon emission exchange, and splitting *************/
231 
235 Col_amp emit_gluon( const Col_str & in_Col_str, int emitter, int g_new ) const;
236 
240 Col_amp emit_gluon( const Col_amp & Ca_in, int emitter, int g_new ) const;
241 
243 Col_amp split_gluon( const Col_str & in_Col_str, int g_old, int q_new, int qbar_new ) const;
244 
246 Col_amp split_gluon( const Col_amp & in_Col_amp, int g_old, int q_new, int qbar_new ) const;
247 
248 
252 Col_amp exchange_gluon( const Col_str & Cs, int p1, int p2 ) const;
253 
258 Col_amp exchange_gluon( const Col_amp & Ca, int p1, int p2 ) const;
259 
267 Polynomial color_correlator( const Col_amp Ca, int i, int j ) const;
268 
269 
270 /********************* Other functions *************************/
271 
272 // As dvec and dmatr are not classes some read and write functions
273 // are contained here.
274 
279 dvec read_in_dvec( std::string filename ) const;
280 
287 dmatr read_in_dmatr( std::string filename ) const;
288 
291 void write_out_dvec( const dvec & dv, std::string filename ) const;
292 
295 void write_out_dmatr( const dmatr & matr, std::string filename ) const;
296 
298 int factorial( int i ) const;
299 
306 std::map<int, int> default_parton_numbers( const Col_str &, int g_old, int q_new, int qbar_new ) const;
307 
308 
313 Col_str rename_partons( const Col_str &, const std::map <int, int> replacements ) const;
314 
315 
320 Col_amp rename_partons( const Col_amp &, const std::map <int, int> replacements ) const;
321 
322 
323 }; // end class Col_functions
324 
325 
327 
329 std::list<int>::iterator operator+( std::list<int>::iterator x, int n );
330 
331 std::list<int>::iterator operator-( std::list<int>::iterator x, int n );
332 
334 std::list< Quark_line >::iterator operator+( std::list < Quark_line >::iterator x, int n );
335 
336 col_str::iterator operator-( col_str::iterator x, int n );
337 
339 std::ostream& operator<<( std::ostream& out, const std::vector<int> & vec );
340 
342 std::ostream& operator<<( std::ostream& out, const cvec & cv );
343 
345 std::ostream& operator<<( std::ostream& out, const dvec & dv );
346 
348 std::ostream& operator<<( std::ostream& out, const cmatr & cm );
349 
351 std::ostream& operator<<( std::ostream& out, const dmatr & matr );
352 
354 std::ostream& operator<<( std::ostream& out, std::pair<int, int> pair );
355 } // end namespace ColorFull
356 
357 #endif /* COLORFULL_Col_functions_h */
cnum cnum_num(const Monomial &Mon) const
Numerically evaluates a Monomial using the Nc, TR and CF data members.
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
Returns the normalization of the generators, tr(t^a t^b)=TR*delta^{a,b}.
Definition: Col_functions.h:90
Class for containing vector of Polynomials, and functions for Polynomial vectors. ...
Definition: Poly_vec.h:25
bool get_full_CF() const
Returns true, if full CF is used.
Definition: Col_functions.h:96
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:37
Library class containing functions for index contraction and numerical evaluation.
Definition: Col_functions.h:25
double double_num(const Monomial &Mon) const
Numerically evaluates a Monomial to a double using the Nc, TR and CF data members.
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.
std::map< int, int > default_parton_numbers(const Col_str &, int g_old, int q_new, int qbar_new) const
Function that finds the default parton numbers for a Col_str.
bool full_CF
While evaluating leading terms one may want to keep the full value of CF for TR(Nc^2-1)/Nc, or only keep the leading Nc term =TR*Nc (default).
Definition: Col_functions.h:53
double CF
The value of CF=TR*Nc-TR/Nc, changed by using set_CF.
Definition: Col_functions.h:41
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.
Col_amp split_gluon(const Col_str &in_Col_str, int g_old, int q_new, int qbar_new) const
Function for splitting the gluon g_old in a Col_str to a qqbar pair.
void set_Nc(double n)
Set the number of colors.
Definition: Col_functions.h:64
Polynomial Polynomial_cnum_num(const Polynomial &Poly) const
Numerically evaluates a Polynomial using the value of the data member Nc, and stores in the format of...
double get_Nc() const
Returns the number of colors.
Definition: Col_functions.h:86
double Nc
The number of colors, used in numerical results, changed by using set_Nc.
Definition: Col_functions.h:31
void set_full_CF(bool is_full)
Switch on/off full_CF.
Definition: Col_functions.h:83
Polynomial scalar_product(const Col_amp &Ca1, const Col_amp &Ca2) const
Function for calculating the 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.
Polynomial color_correlator(const Col_amp Ca, int i, int j) const
Calculates < M | T_i T_j | M >, the "color correlator" relevant for coherent gluon emission of gluon ...
Col_str rename_partons(const Col_str &, const std::map< int, int > replacements) const
Function that renames the partons in a Col_str using a map where, in each pair, the first number is t...
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
Reads in a numerical matrix 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
Returns the value of CF.
Definition: Col_functions.h:93
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:71
void set_CF(double cf)
Set the value of CF.
Definition: Col_functions.h:78
Col_functions()
Default constructor.
Definition: Col_functions.h:59
int factorial(int i) const
The factorial of an int, 0! is defined as 1.
dvec read_in_dvec(std::string filename) const
Reads in a numerical vector and save it as a double vector, dvec.