Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FFBtoDBGLVar.cc
Go to the documentation of this file.
1 ///
2 /// @file FFBtoDBGLVar.cc
3 /// @brief \f$ B \rightarrow D \f$ BGL form factors with variations
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
13 #include "Hammer/IndexLabels.hh"
14 #include "Hammer/Math/Constants.hh"
15 #include "Hammer/Math/Utils.hh"
16 #include "Hammer/Particle.hh"
17 #include "Hammer/Tools/Pdg.hh"
19 #include <cmath>
20 
21 #include <iostream>
22 
23 using namespace std;
24 
25 namespace Hammer {
26 
27  namespace MD = MultiDimensional;
28 
29  FFBtoDBGLVar::FFBtoDBGLVar() {
30  // Create tensor rank and dimensions
31  vector<IndexType> dims = {4, 9}; // size is _FFErrNames + 1 to include central values in zeroth component
32  setGroup("BGLVar"); //override BGL base class FF group setting
33  string name{"FFBtoDBGLVar"};
34 
35  setPrefix("BtoD");
36  _FFErrLabel = FF_BD_VAR;
37  addProcessSignature(PID::BPLUS, {-PID::D0});
38  addTensor(Tensor{name, MD::makeEmptySparse(dims, {FF_BD, FF_BD_VAR})});
39 
40  addProcessSignature(PID::BZERO, {PID::DMINUS});
41  addTensor(Tensor{name, MD::makeEmptySparse(dims, {FF_BD, FF_BD_VAR})});
42 
43  setPrefix("BstoDs");
44  _FFErrLabel = FF_BSDS_VAR;
45  addProcessSignature(PID::BS, {PID::DSMINUS});
46  addTensor(Tensor{name, MD::makeEmptySparse(dims, {FF_BSDS, FF_BSDS_VAR})});
47 
48  setSignatureIndex();
49  }
50 
51  void FFBtoDBGLVar::defineSettings() {
52  _FFErrNames = {"delta_ap0","delta_ap1","delta_ap2","delta_ap3","delta_a00","delta_a01","delta_a02","delta_a03"};
53  setPath(getFFErrPrefixGroup().get());
54  setUnits("GeV");
55 
56  //Using 1606.08030
57  addSetting<double>("ChiT",5.131e-4); //GeV^-2
58  addSetting<double>("ChiL",6.332e-3);
59 
60  vector<double> apvec={0.01565,-0.0353,-0.043,0.194}; //GeV
61  vector<double> a0vec={0.07932,-0.214,0.17,-0.958}; //GeV
62  addSetting<vector<double>>("ap",apvec);
63  addSetting<vector<double>>("a0",a0vec);
64 
65  vector<double> BcStatesp={6.329, 6.920, 7.020};
66  vector<double> BcStates0={6.716, 7.121};
67  addSetting<vector<double>>("BcStatesp",BcStatesp);
68  addSetting<vector<double>>("BcStates0",BcStates0);
69 
70  //apa0 correlation matrix and set zero error eignenvectors
71  //Row basis is ap's then a0's!
72  vector<vector<double>> apa0mat{ {1., 0., 0., 0., 0., 0., 0., 0.},
73  {0., 1., 0., 0., 0., 0., 0., 0.},
74  {0., 0., 1., 0., 0., 0., 0., 0.},
75  {0., 0., 0., 1., 0., 0., 0., 0.},
76  {0., 0., 0., 0., 1., 0., 0., 0.},
77  {0., 0., 0., 0., 0., 1., 0., 0.},
78  {0., 0., 0., 0., 0., 0., 1., 0.},
79  {0., 0., 0., 0., 0., 0., 0., 1.}};
80  addSetting<vector<vector<double>>>("apa0matrix",apa0mat);
81 
82  for (auto elem : _FFErrNames) {
83  addSetting<double>(elem, 0.);
84  }
85 
86  initialized = true;
87  }
88 
89  void FFBtoDBGLVar::evalAtPSPoint(const vector<double>& point, const vector<double>& masses) {
90  Tensor& result = getTensor();
91  result.clearData();
92 
93  if(!initialized){
94  MSG_WARNING("Warning, Settings have not been defined!");
95  }
96 
97  double Mb = 0.;
98  double Mc = 0.;
99  double unitres = 1.;
100  if(masses.size() >= 2) {
101  Mb = masses[0];
102  Mc = masses[1];
103  unitres = _units;
104  }
105  else {
106  Mb = this->masses()[0];
107  Mc = this->masses()[1];
108  }
109  const double Sqq = point[0];
110  const double Mb2 = Mb*Mb;
111  const double Mc2 = Mc*Mc;
112  const double rC = Mc/Mb;
113  const double rC2 = rC*rC;
114  const double sqrC = sqrt(rC);
115 
116  double w = (Mb2 + Mc2 - Sqq) / (2. * Mb * Mc);
117  //safety measure if w==1.0
118  if(isZero(w - 1.0)) w += 1e-6;
119 
120  const size_t nmax = 4;
121  const double z = (sqrt(w+1) - sqrt2)/(sqrt(w+1)+sqrt2);
122  vector<double> zpow{1.};
123  for (size_t n = 1; n < nmax; ++n){
124  zpow.push_back(zpow[n-1]*z);
125  }
126 
127  const vector<double>& BcStatesp = (*getSetting<vector<double>>("BcStatesp"));
128  const vector<double>& BcStates0 = (*getSetting<vector<double>>("BcStates0"));
129 
130  const vector<double>& ap = (*getSetting<vector<double>>("ap"));
131  const vector<double>& a0 = (*getSetting<vector<double>>("a0"));
132 
133  const vector<vector<double>>& apa0mat = (*getSetting<vector<vector<double>>>("apa0matrix"));
134 
135  const double nc=2.6;
136  const double chiT=(*getSetting<double>("ChiT"))/(unitres*unitres);
137  const double chiL=(*getSetting<double>("ChiL"));
138  const double tp=(Mb+Mc)*(Mb+Mc)/Mb2;
139  const double tm=(Mb-Mc)*(Mb-Mc)/Mb2;
140  const double sqtptm = sqrt(tp - tm);
141 
142  double Pp = 1.;
143  for(size_t n = 0; n< BcStatesp.size(); ++n) {
144  double sqtpBc = sqrt(tp - pow(BcStatesp[n]*unitres/Mb,2));
145  Pp *= ((z-((sqtpBc-sqtptm)/(sqtpBc+sqtptm)))/(1-z*((sqtpBc-sqtptm)/(sqtpBc+sqtptm))));
146  }
147 
148  double P0 = 1.;
149  for(size_t n = 0; n< BcStates0.size(); ++n){
150  double sqtpBc = sqrt(tp-pow(BcStates0[n]*unitres/Mb,2));
151  P0 *= ((z-((sqtpBc-sqtptm)/(sqtpBc+sqtptm)))/(1-z*((sqtpBc-sqtptm)/(sqtpBc+sqtptm))));
152  }
153 
154  double phip = 32.*sqrt(nc/(6.*pi*chiT*Mb2))*rC2*pow(1+z,2)*pow(1-z,0.5)/pow((1+rC)*(1-z)+2*sqrC*(1+z),5);
155 
156  double phi0 = (1-rC2)*8.*sqrt(nc/(8.*pi*chiL))*rC*(1+z)*pow(1-z,1.5)/pow((1+rC)*(1-z)+2*sqrC*(1+z),4);
157 
158  //Compute central values, always in zeroth index
159  double Fp=0;
160  for(size_t n = 0; n< ap.size(); ++n) Fp += ap[n] * zpow[n];
161  Fp /= (Pp*phip);
162 
163  double F0=0;
164  for(size_t n = 0; n< a0.size(); ++n) F0 += a0[n] * zpow[n];
165  F0 /= (P0*phi0);
166 
167  // Fs (dim +1)
168  // result.element({0}) = 0;
169  // Fz (dim 0)
170  result.element({1, 0}) = F0;
171  // Fp (dim 0)
172  result.element({2, 0}) = Fp;
173  // Ft (dim -1)
174  // result.element({3}) = 0;
175 
176  //Now create remaining FF tensor entries
177  //Logic: FF^x = a^x_i z^i, a^x_i = M_{ij} delta_j, delta_j = {1, delta_...}
178  //n indexes rows of abcdmat; idx indexes the columns that contract with delta.
179  //fp: 1st 4 rows; f0: 2nd 4 rows;
180  //Sum over appropriate n to generate idx-th entries for each FF
181  for(IndexType idx = 0; idx < 8; ++idx){
182  double f0entry = 0.;
183  double fpentry = 0.;
184  for(size_t n = 0; n < 4; ++n){
185  f0entry += apa0mat[n+4][idx]*zpow[n]/(P0*phi0);
186  fpentry += apa0mat[n][idx]*zpow[n]/(Pp*phip);
187  }
188  if(!isZero(f0entry)) { result.element({1, static_cast<IndexType>(idx+1u)}) = f0entry; }
189  if(!isZero(fpentry)) { result.element({2, static_cast<IndexType>(idx+1u)}) = fpentry; }
190  }
191 
192  }
193 
194  unique_ptr<FormFactorBase> FFBtoDBGLVar::clone(const string& label) {
195  MAKE_CLONE(FFBtoDBGLVar, label);
196  }
197 
198 } // namespace Hammer
#define MSG_WARNING(x)
Definition: Logging.hh:366
TensorData makeEmptySparse(const IndexList &dimensions, const LabelsList &labels)
std::complex< double > & element(const IndexList &indices={})
access an element given its indices
Definition: Tensor.cc:67
Tensor indices label definitions.
uint16_t IndexType
static constexpr double sqrt2
Definition: Constants.hh:26
Sparse tensor data container.
Multidimensional tensor class with complex numbers as elements.
Definition: Tensor.hh:33
bool isZero(const std::complex< double > val)
Definition: Math/Utils.hh:25
void clearData()
sets all the elements to 0
Definition: Tensor.cc:229
Various numerical constants.
Hammer particle data class.
Hammer particle class.
#define MAKE_CLONE(OBJ, LABEL)
BGL form factors with variations
static constexpr double pi
Definition: Constants.hh:21