Belle II Software development
BSTD_calc_dgam.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include "generators/evtgen/EvtBSemiTauonicDecayRateCalculator.h"
10#include "generators/evtgen/models/EvtBSemiTauonicHelicityAmplitudeCalculator.h"
11
12#include <cstdlib>
13#include <iostream>
14#include <fstream>
15
16#include <unistd.h>
17
18using namespace Belle2;
19
20void usage()
21{
22 std::cout << "Usage: BSTD_calc_dgam [-hr] m_B m_D* m_D m_tau m_lep rho1^2 rhoA1^2 R1(1) R2(1) aS1 aR3 m_b m_c" << std::endl;
23 std::cout << "Calculate differential decay rate for each helicity state, " << std::endl;
24 std::cout << "the ratios R(D) and R(D*), " << std::endl;
25 std::cout << "and polarization P_tau and P_D* for B->D(*)taunu decays " << std::endl;
26 std::cout << "using the BSTD model." << std::endl;
27 std::cout << std::endl;
28 std::cout << "The results are written to " << std::endl;
29 std::cout << "dstar.{w,costau,2D}.dat, d.{w,costau,2D}.dat " << std::endl;
30 std::cout << "and r_pol.dat in the ASCII text format." << std::endl;
31 std::cout << std::endl;
32 std::cout << "Options: " << std::endl;
33 std::cout << " -h\tShow this usage." << std::endl;
34 std::cout << " -r\tCalculate only R and polarizations, without writing output files." << std::endl;
35}
36
38int main(int argc, char* argv[])
39{
40
41 bool calcROnly = false;
42
43 while (1) {
44 // get options
45 int c = getopt(argc, argv, "rh");
46 if (c == -1)break; //end of parameter.
47 switch (c) {
48 case 'h':
49 usage();
50 exit(0);
51 break;
52 case 'r':
53 calcROnly = true;
54 break;
55 default:
56 case '?':
57 std::cerr << "Unknown option" << std::endl;
58 usage();
59 exit(1);
60 }
61 }
62
63 const int narg = argc - optind;
64 if (narg != 13) {
65 usage();
66 exit(1);
67 }
68
69 const double m_B(atof(argv[optind++]));
70 const double m_Dst(atof(argv[optind++]));
71 const double m_D(atof(argv[optind++]));
72 const double m_tau(atof(argv[optind++]));
73 const double m_lep(atof(argv[optind++]));
74
75 const double rho12(atof(argv[optind++]));
76 const double rhoA12(atof(argv[optind++]));
77 const double ffR11(atof(argv[optind++]));
78 const double ffR21(atof(argv[optind++]));
79 const double aS1(atof(argv[optind++]));
80 const double aR3(atof(argv[optind++]));
81 const double m_b(atof(argv[optind++]));
82 const double m_c(atof(argv[optind++]));
83
84 // double m_tau(1.777),mB(5.2795),mDstar(2.01027),mD(1.86962); // B0
85 // double m_tau(1.777),mB(5.2791),mDstar(2.00697),mD(1.86484); // B+
86 double AbsCV1, ArgCV1, AbsCV2, ArgCV2, AbsCS1, ArgCS1, AbsCS2, ArgCS2, AbsCT, ArgCT;
87
88 std::cout << "Input Abs(CV1) Arg(CV1) Abs(CV2) Arg(CV2) Abs(CS1) Arg(CS1) Abs(CS2) Arg(CS2) Abs(CT) Arg(CT) >" << std::endl;
89 std::cin >> AbsCV1 >> ArgCV1 >> AbsCV2 >> ArgCV2 >> AbsCS1 >> ArgCS1 >> AbsCS2 >> ArgCS2 >> AbsCT >> ArgCT;
90 EvtComplex Coeffs[5];
91 Coeffs[0] = EvtComplex(AbsCV1 * cos(ArgCV1), AbsCV1 * sin(ArgCV1));
92 Coeffs[1] = EvtComplex(AbsCV2 * cos(ArgCV2), AbsCV2 * sin(ArgCV2));
93 Coeffs[2] = EvtComplex(AbsCS1 * cos(ArgCS1), AbsCS1 * sin(ArgCS1));
94 Coeffs[3] = EvtComplex(AbsCS2 * cos(ArgCS2), AbsCS2 * sin(ArgCS2));
95 Coeffs[4] = EvtComplex(AbsCT * cos(ArgCT), AbsCT * sin(ArgCT));
96
97 EvtBSemiTauonicHelicityAmplitudeCalculator BSTD(rho12, rhoA12, ffR11, ffR21, aS1, aR3, m_b, m_c,
98 Coeffs[0], Coeffs[1], Coeffs[2], Coeffs[3], Coeffs[4],
99 m_B, m_D, m_Dst);
101
102 std::cout << "tau mass: " << m_tau << std::endl;
103 std::cout << "light lepton mass: " << m_lep << std::endl;
104
105 if (!calcROnly) {
106 // calculate and write differential decay rate to files
107 const double totgamd = CalcDecayRate.GammaD(BSTD, m_tau);
108
109 const double totgamds = CalcDecayRate.GammaDstar(BSTD, m_tau);
110
111 int i_tauhel[2] = { -1, 1}; // left, right
112 int i_dhel[4] = { -1, 0, 1, 2};
113 double dgam[2][4];
114 double wmin = 1.0; //BSTD.wmin();
115 double wmax = 1.35; //BSTD.wmax(m_tau,1);
116 double dw = (wmax - wmin) / 70.;
117
118 // dGam/dw
119 std::cout << "Calculating dGam/dw ..." << std::endl;
120 std::ofstream ofile1("dstar.w.dat");
121 ofile1 << "# w dgamlm dgamrm dgaml0 dgamr0 dgamlp dgamrp total" << std::endl;
122 for (double w = wmin + dw / 2.;
123 w < wmax; w += dw) {
124 double tot(0);
125 for (int i = 0; i < 2; i++) {
126 for (int j = 0; j < 3; j++) {
127 dgam[i][j] = CalcDecayRate.dGammadw(BSTD, m_tau, i_tauhel[i], i_dhel[j], w) / totgamds * dw;
128 tot += dgam[i][j];
129 }
130 }
131 ofile1 << w
132 << " " << dgam[0][0] << " " << dgam[1][0]
133 << " " << dgam[0][1] << " " << dgam[1][1]
134 << " " << dgam[0][2] << " " << dgam[1][2]
135 << " " << tot << std::endl;
136 }
137
138 std::ofstream ofile2("d.w.dat");
139 ofile2 << "# w dgaml dgamr total" << std::endl;
140 wmin = 1.0; //BSTD.wmin();
141 wmax = 1.42; //BSTD.wmax(m_tau,2);
142 dw = (wmax - wmin) / 84;
143 for (double w = wmin + dw / 2.;
144 w < wmax; w += dw) {
145 double tot(0);
146 for (int i = 0; i < 2; i++) {
147 int j = 3;
148 dgam[i][j] = CalcDecayRate.dGammadw(BSTD, m_tau, i_tauhel[i], i_dhel[j], w) / totgamd * dw;
149 tot += dgam[i][j];
150 }
151 ofile2 << w
152 << " " << dgam[0][3] << " " << dgam[1][3]
153 << " " << tot << std::endl;
154 }
155
156 // dGam/dcostau
157 std::cout << "Calculating dGam/dcostau ..." << std::endl;
158 double dcostau = (1 - (-1)) / 100.;
159 std::ofstream ofilecostau1("dstar.costau.dat");
160 ofilecostau1 << "# costau dgamlm dgamrm dgaml0 dgamr0 dgamlp dgamrp total" << std::endl;
161 for (double costau = -1 + dcostau / 2.;
162 costau < 1; costau += dcostau) {
163 double tot(0);
164 for (int i = 0; i < 2; i++) {
165 for (int j = 0; j < 3; j++) {
166 dgam[i][j] = CalcDecayRate.dGammadcostau(BSTD, m_tau, i_tauhel[i], i_dhel[j], costau) / totgamds * dcostau;
167 tot += dgam[i][j];
168 }
169 }
170 ofilecostau1 << costau
171 << " " << dgam[0][0] << " " << dgam[1][0]
172 << " " << dgam[0][1] << " " << dgam[1][1]
173 << " " << dgam[0][2] << " " << dgam[1][2]
174 << " " << tot << std::endl;
175 }
176
177 std::ofstream ofilecostau2("d.costau.dat");
178 ofilecostau2 << "# costau dgaml dgamr total" << std::endl;
179 for (double costau = -1 + dcostau / 2.;
180 costau < 1; costau += dcostau) {
181 double tot(0);
182 for (int i = 0; i < 2; i++) {
183 int j = 3;
184 dgam[i][j] = CalcDecayRate.dGammadcostau(BSTD, m_tau, i_tauhel[i], i_dhel[j], costau) / totgamd * dcostau;
185 tot += dgam[i][j];
186 }
187 ofilecostau2 << costau
188 << " " << dgam[0][3] << " " << dgam[1][3]
189 << " " << tot << std::endl;
190 }
191
192 // 2D
193 std::cout << "Calculating dGam/dw/dcostau ..." << std::endl;
194 wmin = 1.0;
195 wmax = 1.35;
196 dw = (wmax - wmin) / 20.;
197 dcostau = (1 - (-1)) / 20.;
198 std::ofstream ofile2d1("dstar.2d.dat");
199 ofile2d1 << "# w costau dgamlm dgamrm dgaml0 dgamr0 dgamlp dgamrp total" << std::endl;
200 for (double w = wmin + dw / 2.; w < wmax; w += dw) {
201 for (double costau = -1 + dcostau / 2.; costau < 1; costau += dcostau) {
202 double tot(0);
203 for (int i = 0; i < 2; i++) {
204 for (int j = 0; j < 3; j++) {
205 dgam[i][j] = CalcDecayRate.dGammadwdcostau(BSTD, m_tau, i_tauhel[i], i_dhel[j], w, costau) / totgamds * dcostau * dw;
206 tot += dgam[i][j];
207 }
208 }
209 ofile2d1 << w << " " << costau
210 << " " << dgam[0][0] << " " << dgam[1][0]
211 << " " << dgam[0][1] << " " << dgam[1][1]
212 << " " << dgam[0][2] << " " << dgam[1][2]
213 << " " << tot << std::endl;
214 }
215 }
216
217 wmin = 1.0;
218 wmax = 1.42;
219 dw = (wmax - wmin) / 20.;
220 dcostau = (1 - (-1)) / 20.;
221 std::ofstream ofile2d2("d.2d.dat");
222 ofile2d2 << "# w costau dgaml dgamr total" << std::endl;
223 for (double w = wmin + dw / 2.; w < wmax; w += dw) {
224 for (double costau = -1 + dcostau / 2.; costau < 1; costau += dcostau) {
225 double tot(0);
226 for (int i = 0; i < 2; i++) {
227 int j = 3;
228 dgam[i][j] = CalcDecayRate.dGammadwdcostau(BSTD, m_tau, i_tauhel[i], i_dhel[j], w, costau) / totgamd * dcostau * dw;
229 tot += dgam[i][j];
230 }
231 ofile2d2 << w << " " << costau
232 << " " << dgam[0][3] << " " << dgam[1][3]
233 << " " << tot << std::endl;
234 }
235 }
236 }
237
238 // R and polarization data
239 /* cppcheck-suppress duplicateCondition */
240 if (!calcROnly) {
241 std::ofstream ofile3("r_pol.dat");
242 ofile3 << "# rgamd rgamds ptaud ptauds pds" << std::endl;
243 ofile3 << CalcDecayRate.RGammaD(BSTD, m_tau, m_lep) << " ";
244 ofile3 << CalcDecayRate.RGammaDstar(BSTD, m_tau, m_lep) << " ";
245 ofile3 << CalcDecayRate.PtauD(BSTD, m_tau) << " ";
246 ofile3 << CalcDecayRate.PtauDstar(BSTD, m_tau) << " ";
247 ofile3 << CalcDecayRate.PDstar(BSTD, m_tau);
248 ofile3 << std::endl;
249 }
250
251 std::cout << "# rgamd rgamds ptaud ptauds pds" << std::endl;
252 std::cout << CalcDecayRate.RGammaD(BSTD, m_tau, m_lep) << " ";
253 std::cout << CalcDecayRate.RGammaDstar(BSTD, m_tau, m_lep) << " ";
254 std::cout << CalcDecayRate.PtauD(BSTD, m_tau) << " ";
255 std::cout << CalcDecayRate.PtauDstar(BSTD, m_tau) << " ";
256 std::cout << CalcDecayRate.PDstar(BSTD, m_tau);
257 std::cout << std::endl;
258
259 return 0;
260}
261
Class to calculate the differential decay rate, R(D), R(D*), polarizations of tau and D* using BSTD m...
The class calculates the helicity amplitude of semi-tauonic B decays including new physics effects ba...
double dGammadwdcostau(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, double mtau, int tauhel, int Dhel, double w, double costau)
Function calculates the differential decay rate dGamma/dw/dcostau.
double RGammaD(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, const double mtau, const double mlep=0.0005110)
Function calculates the ratio of Br(B->Dtaunu)/Br(B->Dlnu), R(D).
double PDstar(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, const double mtau)
Function calculates the polarization of D*, longitudinal/(longitudinal + transverse),...
double GammaDstar(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, double mtau)
Function calculates the differential decay rate Gamma for D*taunu decay, integrated for w and costau ...
double dGammadw(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, double mtau, int tauhel, int Dhel, double w)
Function calculates the differential decay rate dGamma/dw, integrated for costau.
double RGammaDstar(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, const double mtau, const double mlep=0.0005110)
Function calculates the ratio of Br(B->Dtaunu)/Br(B->Dlnu), R(D*).
double PtauDstar(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, const double mtau)
Function calculates the polarization of tau, (RH - LH)/(LH + RH), in B->D*taunu decay.
double PtauD(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, const double mtau)
Function calculates the polarization of tau, (RH - LH)/(LH + RH), in B->Dtaunu decay.
double dGammadcostau(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, double mtau, int tauhel, int Dhel, double costau)
Function calculates the differential decay rate dGamma/dcostau, integrated for w.
double GammaD(const EvtBSemiTauonicHelicityAmplitudeCalculator &BSTD, double mtau)
Function calculates the decay rate Gamma for Dtaunu decay, integrated for w and costau and summed for...
Abstract base class for different kinds of events.