JHUGen MELA  JHUGen v7.5.6, MELA v2.4.2
Matrix element calculations as used in JHUGen.
MELAHXSWidth.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <cstdlib>
3 #include <cmath>
4 #include <fstream>
5 #include "MELAHXSWidth.h"
6 #include "TROOT.h"
7 #include "TF1.h"
8 #include "MELAStreamHelpers.hh"
9 
10 
11 using namespace std;
12 using namespace MELAStreamHelpers;
13 
14 
15 MELAHXSWidth::MELAHXSWidth(std::string fileLoc, std::string strAppend, TVar::VerbosityLevel verbosity_) :
16  xmhW(nullptr),
17  sigW(nullptr),
18  graphW(nullptr),
19  gsW(nullptr),
20  verbosity(verbosity_)
21 {
22  fileName = fileLoc + "/HiggsTotalWidth_" + strAppend + ".txt";
23  build();
24 }
26  fileName(other.fileName),
27  xmhW(nullptr),
28  sigW(nullptr),
29  graphW(nullptr),
30  gsW(nullptr),
31  verbosity(other.verbosity)
32 {
33  build();
34 }
36  if (verbosity>=TVar::DEBUG) MELAout << "MELAHXSWidth::build: Cross section file path: " << fileName.data() << endl;
37  ifstream file;
38  file.open(fileName.c_str());
39  while (!file.eof()){
40  double mass=0, br=0;
41  file >> mass >> br;
42  if (mass>0. && br>0.){
43  mass_BR.push_back(mass);
44  BR.push_back(br);
45  }
46  }
47  file.close();
48  const unsigned int indexW = mass_BR.size();
49  if (indexW>1){
50  xmhW = new double[indexW];
51  sigW = new double[indexW];
52  for (unsigned int ix=0; ix<indexW; ix++){
53  xmhW[ix] = mass_BR.at(ix);
54  sigW[ix] = BR.at(ix);
55  }
56  double dbegin = (sigW[1]-sigW[0])/(xmhW[1]-xmhW[0]);
57  double cB = (sigW[indexW-1]-sigW[indexW-2])/(pow(xmhW[indexW-1], 3)-pow(xmhW[indexW-2], 3));
58  double dend = 3.*cB*pow(xmhW[indexW-1], 2);
59  graphW = new TGraph(indexW, xmhW, sigW);
60  gsW = new TSpline3("gsW", graphW, "b1e1", dbegin, dend);
61  }
62 }
63 
64 
66  delete gsW; gsW=nullptr;
67  delete graphW; graphW=nullptr;
68  delete[] xmhW; xmhW=nullptr;
69  delete[] sigW; sigW=nullptr;
70 }
71 
72 double MELAHXSWidth::HiggsWidth(double mH) const{
73  double result = 0;
74  const unsigned int indexW = mass_BR.size();
75  if (gsW){
76  if (mH<xmhW[indexW-1]) result = (double)gsW->Eval(mH);
77  else{
78  double cB = (sigW[indexW-1]-sigW[indexW-2])/(pow(xmhW[indexW-1], 3)-pow(xmhW[indexW-2], 3));
79  double cA = sigW[indexW-1] - cB*pow(xmhW[indexW-1], 3);
80  result = cA + cB*pow(mH, 3);
81  }
82  }
83  return result;
84 }
85 
MELAHXSWidth::xmhW
double * xmhW
Definition: MELAHXSWidth.h:21
TVar::VerbosityLevel
VerbosityLevel
Definition: TVar.hh:47
MELAHXSWidth
Definition: MELAHXSWidth.h:10
MELAHXSWidth::sigW
double * sigW
Definition: MELAHXSWidth.h:22
MELAStreamHelpers::MELAout
MELAOutputStreamer MELAout
MELAHXSWidth::build
void build()
Definition: MELAHXSWidth.cc:35
MELAHXSWidth::MELAHXSWidth
MELAHXSWidth(std::string fileLoc="../txtFiles", std::string strAppend="YR3", TVar::VerbosityLevel verbosity_=TVar::ERROR)
Definition: MELAHXSWidth.cc:15
MELAHXSWidth.h
MELAHXSWidth::HiggsWidth
double HiggsWidth(double mH) const
Definition: MELAHXSWidth.cc:72
MELAHXSWidth::mass_BR
std::vector< double > mass_BR
Definition: MELAHXSWidth.h:19
MELAHXSWidth::fileName
std::string fileName
Definition: MELAHXSWidth.h:18
MELAHXSWidth::graphW
TGraph * graphW
Definition: MELAHXSWidth.h:23
modparameters::br
real(8), public br
Definition: mod_Parameters.F90:1067
MELAStreamHelpers
Definition: MELAStreamHelpers.hh:7
MELAHXSWidth::gsW
TSpline3 * gsW
Definition: MELAHXSWidth.h:24
TVar::DEBUG
@ DEBUG
Definition: TVar.hh:51
MELAStreamHelpers.hh
MELAHXSWidth::BR
std::vector< double > BR
Definition: MELAHXSWidth.h:20
MELAHXSWidth::verbosity
TVar::VerbosityLevel verbosity
Definition: MELAHXSWidth.h:26
MELAHXSWidth::~MELAHXSWidth
~MELAHXSWidth()
Definition: MELAHXSWidth.cc:65