Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F7879713
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Subscribers
None
View Options
diff --git a/include/HEJ/Tensor.hh b/include/HEJ/Tensor.hh
index 2f6dcfb..b92794f 100644
--- a/include/HEJ/Tensor.hh
+++ b/include/HEJ/Tensor.hh
@@ -1,186 +1,186 @@
/** \file
* \brief Tensor Template Class declaration.
*
* This file contains the declaration of the Tensor Template class. This
* is used to calculate some of the more complex currents within the
* W+Jets implementation particularly.
*
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#pragma once
#include <array>
#include <complex>
#include <valarray>
namespace CLHEP {
class HepLorentzVector;
}
class CCurrent;
typedef std::complex<double> COM;
///@TODO put in some namespace
template <unsigned int N>
class Tensor{
public:
//! Constructor
Tensor();
- Tensor(COM x);
+ explicit Tensor(COM x);
//! Rank of Tensor
int rank(){
return N;
};
//! total number of entries
int len(){
return size;
};
/**
* @{
* @TODO these functions are a mess and dangerous (out of bound)
* better something like <code> COM at(std::array<int, N> idx) </code>
* maybe in combination with <code> std::gslice <code>
*/
//! Value of rank 1 Tensor for given i value.
COM at(int i);
//! Value of rank 2 Tensor for given (i,j) value.
COM at(int i, int j);
//! Value of rank 3 Tensor for given (i,j,k) value.
COM at(int i, int j, int k);
//! Value of rank 4 Tensor for given (i,j,k,l) value.
COM at(int i, int j, int k, int l);
//! Value of rank 3 Tensor for given (i,j,k,l,m) value.
COM at(int i, int j, int k, int l, int m);
//! Set all entries to x
void Fill(COM x);
//! Set value of rank 1 Tensor for given i value to x.
void Set(int i, COM x);
//! Set value of rank 2 Tensor for given i,j value to x.
void Set(int i, int j, COM x);
//! Set value of rank 3 Tensor for given i,j,k value to x.
void Set(int i, int j, int k, COM x);
//! Set value of rank 4 Tensor for given i,j,k,l value to x.
void Set(int i, int j, int k, int l, COM x);
//! Set value of rank 5 Tensor for given i,j,k,l,m value to x.
void Set(int i, int j, int k, int l, int m, COM x);
//!@}
Tensor<N> operator*(const double x);
Tensor<N> operator*(const COM x);
Tensor<N> operator/(const double x);
Tensor<N> operator/(const COM x);
Tensor<N> operator+(const Tensor<N> T2);
Tensor<N> operator-(const Tensor<N> T2);
void operator+=(const Tensor<N> T2);
void operator-=(const Tensor<N> T2);
/**
* \brief Multiply Tensor from Right: T1^(mu1...mk..mN-1)T2_(muN)
* @param T2 Tensor of Rank 1 to multiply from right with with.
* @returns T1.contract(T2,1) -> T1^(mu,nu,rho...)T2^sigma
*/
Tensor<N+1> rightprod(const Tensor<1> T2);
/**
* \brief Multiply Tensor from Left: T2_(muN)T1^(mu1...mk..mN-1)
* @param T2 Tensor of Rank 1 to multiply from left with with.
* @returns T1.contract(T2,1) -> T2^sigma T1^(mu,nu,rho...)
*/
Tensor<N+1> leftprod(const Tensor<1> T2);
/**
* \brief T^(mu1...mk..mN)T2_(muk) contract kth index, where k member of [1,N]
* @param T2 Tensor of Rank 1 to contract with.
* @param k int to contract Tensor T2 with from original Tensor.
* @returns T1.contract(T2,1) -> T1^(mu,nu,rho...)T2_mu
*/
Tensor<N-1> contract(const Tensor<1> T2, int k);
std::valarray<COM> components;
private:
int size;
COM sign(unsigned int i);
};
/**
* \brief Returns diag(+---) Metric
* @returns Metric {(1,0,0,0),(0,-1,0,0),(0,0,-1,0),(0,0,0,-1)}
*/
Tensor<2> Metric();
/**
* \brief Calculates current <p1|mu|p2>
* @param p1 Momentum of Particle 1
* @param h1 Helicity of Particle 1 (Boolean, False = -h, True = +h)
* @param p2 Momentum of Particle 2
* @param h2 Helicity of Particle 2 (Boolean, False = -h, True = +h)
* @returns Tensor T^mu = <p1|mu|p2>
*
* @note in/out configuration considered in calculation
*/
Tensor<1> TCurrent(CLHEP::HepLorentzVector p1, bool h1,
CLHEP::HepLorentzVector p2, bool h2);
/**
* \brief Calculates current <p1|mu nu rho|p2>
* @param p1 Momentum of Particle 1
* @param h1 Helicity of Particle 1 (Boolean, False = -h, True = +h)
* @param p2 Momentum of Particle 2
* @param h2 Helicity of Particle 2 (Boolean, False = -h, True = +h)
* @returns Tensor T^mu^nu^rho = <p1|mu nu rho|p2>
*
* @note in/out configuration considered in calculation
*/
Tensor<3> T3Current(CLHEP::HepLorentzVector p1, bool h1,
CLHEP::HepLorentzVector p2, bool h2);
/**
* \brief Calculates current <p1|mu nu rho tau sigma|p2>
* @param p1 Momentum of Particle 1
* @param h1 Helicity of Particle 1 (Boolean, False = -h, True = +h)
* @param p2 Momentum of Particle 2
* @param h2 Helicity of Particle 2 (Boolean, False = -h, True = +h)
* @returns Tensor T^mu^nu^rho = <p1|mu nu rho tau sigma|p2>
*
* @note in/out configuration considered in calculation
*/
Tensor<5> T5Current(CLHEP::HepLorentzVector p1, bool h1,
CLHEP::HepLorentzVector p2, bool h2);
/**
* \brief Convert from CCurrent class
* @param j Current in CCurrent format
* @returns Current in Tensor Format
*/
Tensor<1> Construct1Tensor(CCurrent j);
/**
* \brief Convert from HLV class
* @param p Current in HLV format
* @returns Current in Tensor Format
*/
Tensor<1> Construct1Tensor(CLHEP::HepLorentzVector p);
/**
* \brief Construct Epsilon (Polarisation) Tensor
* @param k Momentum of incoming/outgoing boson
* @param ref Reference momentum for calculation
* @param pol Polarisation of boson
* @returns Polarisation Tensor E^mu
*/
Tensor<1> eps(CLHEP::HepLorentzVector k, CLHEP::HepLorentzVector ref, bool pol);
//! Initialises Tensor values by iterating over permutations of gamma matrices.
bool init_sigma_index();
// implementation of template functions
#include "HEJ/detail/Tensor_impl.hh"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 19, 8:44 PM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3806144
Default Alt Text
(6 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment