Belle II Software  release-08-01-10
EvtBSemiTauonicAmplitude.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 "EvtGenBase/EvtParticle.hh"
10 #include "EvtGenBase/EvtPDL.hh"
11 #include "EvtGenBase/EvtScalarParticle.hh"
12 #include "EvtGenBase/EvtDiracSpinor.hh"
13 #include "EvtGenBase/EvtId.hh"
14 #include "EvtGenBase/EvtAmp.hh"
15 
16 #include "generators/evtgen/models/EvtBSemiTauonicAmplitude.h"
17 #include "generators/evtgen/models/EvtBSemiTauonicHelicityAmplitudeCalculator.h"
18 
19 namespace Belle2 {
25  using std::endl;
26 
28  EvtVector4R p4boost)
29  {
30  // theta and phi of p momentum in p4boost rest frame
31  EvtVector4R p4Boosted = boostTo(p->getP4(), p4boost, true);
32  const double theta = acos(p4Boosted.get(3) / p4Boosted.d3mag());
33  const double phi = atan2(p4Boosted.get(2), p4Boosted.get(1));
34 
35  // here p must be EvtDiracParticle (if not EvtGen will abort)
36  EvtDiracSpinor spRest[2] = {p->sp(0), p->sp(1)};
37  EvtDiracSpinor sp[2];
38  sp[0] = boostTo(spRest[0], p4boost);
39  sp[1] = boostTo(spRest[1], p4boost);
40 
41  EvtDiracSpinor spplus;
42  EvtDiracSpinor spminus;
43 
44  double norm;
45 
46  if (EvtPDL::getStdHep(p->getId()) > 0) {
47  spplus.set(1.0, 0.0, 0.0, 0.0);
48  spminus.set(0.0, 1.0, 0.0, 0.0);
49  norm = sqrt(real(sp[0].get_spinor(0) * sp[0].get_spinor(0) + sp[0].get_spinor(1) * sp[0].get_spinor(1)));
50  } else {
51  spplus.set(0.0, 0.0, 0.0, 1.0);
52  spminus.set(0.0, 0.0, 1.0, 0.0);
53  norm = sqrt(real(sp[0].get_spinor(2) * sp[0].get_spinor(2) + sp[0].get_spinor(3) * sp[0].get_spinor(3)));
54  }
55 
56  spplus.applyRotateEuler(phi, theta, -phi);
57  spminus.applyRotateEuler(phi, theta, -phi);
58 
59  EvtSpinDensity R;
60  R.setDim(2);
61 
62  for (int i = 0; i < 2; i++) {
63  if (EvtPDL::getStdHep(p->getId()) > 0) {
64  R.set(0, i, (spplus * sp[i]) / norm);
65  R.set(1, i, (spminus * sp[i]) / norm);
66  } else {
67  R.set(0, i, (sp[i]*spplus) / norm);
68  R.set(1, i, (sp[i]*spminus) / norm);
69  }
70  }
71 
72  return R;
73 
74  }
75 
76 // copied from EvtSemileptonicAmp.cpp and modified for BSemiTauonic
77  double EvtBSemiTauonicAmplitude::CalcMaxProb(EvtId parent, EvtId meson,
78  EvtId lepton, EvtId nudaug,
80  {
81  //This routine takes the arguements parent, meson, and lepton
82  //number, and a form factor model, and returns a maximum
83  //probability for this semileptonic form factor model. A
84  //brute force method is used. The 2D cos theta lepton and
85  //q2 phase space is probed.
86 
87  //Start by declaring a particle at rest.
88 
89  //It only makes sense to have a scalar parent. For now.
90  //This should be generalized later.
91 
92  EvtScalarParticle* scalar_part;
93  EvtParticle* root_part;
94 
95  scalar_part = new EvtScalarParticle;
96 
97  //cludge to avoid generating random numbers!
98  scalar_part->noLifeTime();
99 
100  EvtVector4R p_init;
101 
102  p_init.set(EvtPDL::getMass(parent), 0.0, 0.0, 0.0);
103  scalar_part->init(parent, p_init);
104  //root_part = (EvtParticle*)scalar_part;
105  root_part = static_cast<EvtParticle*>(scalar_part);
106 
107  root_part->setDiagonalSpinDensity();
108 
109  EvtParticle* daughter, *lep, *trino;
110 
111  EvtAmp amp;
112 
113  EvtId listdaug[3];
114  listdaug[0] = meson;
115  listdaug[1] = lepton;
116  listdaug[2] = nudaug;
117 
118  amp.init(parent, 3, listdaug);
119 
120  root_part->makeDaughters(3, listdaug);
121  daughter = root_part->getDaug(0);
122  lep = root_part->getDaug(1);
123  trino = root_part->getDaug(2);
124 
125  //cludge to avoid generating random numbers!
126  daughter->noLifeTime();
127  lep->noLifeTime();
128  trino->noLifeTime();
129 
130 
131  //Initial particle is unpolarized, well it is a scalar so it is
132  //trivial
133  EvtSpinDensity rho;
134  rho.setDiag(root_part->getSpinStates());
135 
136  double mass[3];
137 
138  double m = root_part->mass();
139 
140  EvtVector4R p4meson, p4lepton, p4nu, p4w;
141 
142  double q2, elepton, plepton;
143  int i, j;
144  double erho, prho, costl;
145 
146  double maxfoundprob = 0.0;
147  double prob;
148  int massiter;
149 
150  for (massiter = 0; massiter < 3; massiter++) {
151 
152  mass[0] = EvtPDL::getMeanMass(meson);
153  mass[1] = EvtPDL::getMeanMass(lepton);
154  mass[2] = EvtPDL::getMeanMass(nudaug);
155  if (massiter == 1) {
156  mass[0] = EvtPDL::getMinMass(meson);
157  }
158  if (massiter == 2) {
159  mass[0] = EvtPDL::getMaxMass(meson);
160  if ((mass[0] + mass[1] + mass[2]) > m) mass[0] = m - mass[1] - mass[2] - 0.00001;
161  }
162 
163  double q2min = mass[1] * mass[1]; // limit to minimum=lepton mass square
164  double q2max = (m - mass[0]) * (m - mass[0]);
165  double dq2 = (q2max - q2min) / 25;
166 // std::cout<<"m: "<<m<<" mass[0]: "<<mass[0]<<" q2min: "<<q2min<<" q2max: "<<q2max<<std::endl;
167 
168  //loop over q2
169 
170  for (i = 0; i < 25; i++) {
171  q2 = q2min + (i + 0.5) * dq2; // <-- !! not start from unphysical q2=0 !!
172 
173  erho = (m * m + mass[0] * mass[0] - q2) / (2.0 * m);
174 
175  prho = sqrt(erho * erho - mass[0] * mass[0]);
176 
177  p4meson.set(erho, 0.0, 0.0, -1.0 * prho);
178  p4w.set(m - erho, 0.0, 0.0, prho);
179 
180 // std::cout<<"q2: "<<q2<<std::endl;
181 // std::cout<<"p4meson: "<<p4meson<<std::endl;
182 
183  //This is in the W rest frame
184  elepton = (q2 + mass[1] * mass[1]) / (2.0 * sqrt(q2));
185  plepton = sqrt(elepton * elepton - mass[1] * mass[1]);
186 // std::cout<<"elepton: "<<elepton<<" plepton: "<<plepton<<std::endl;
187 
188  double probctl[3];
189 
190  for (j = 0; j < 3; j++) {
191 
192  costl = 0.99 * (j - 1.0);
193 
194  //These are in the W rest frame. Need to boost out into
195  //the B frame.
196  p4lepton.set(elepton, 0.0,
197  plepton * sqrt(1.0 - costl * costl), plepton * costl);
198  p4nu.set(plepton, 0.0,
199  -1.0 * plepton * sqrt(1.0 - costl * costl), -1.0 * plepton * costl);
200 
201  EvtVector4R boost((m - erho), 0.0, 0.0, 1.0 * prho);
202  p4lepton = boostTo(p4lepton, boost);
203  p4nu = boostTo(p4nu, boost);
204 
205  //Now initialize the daughters...
206 
207  daughter->init(meson, p4meson);
208  lep->init(lepton, p4lepton);
209  trino->init(nudaug, p4nu);
210 
211  CalcAmp(root_part, amp, CalcHelAmp);
212 
213  //Now find the probability at this q2 and cos theta lepton point
214  //and compare to maxfoundprob.
215 
216  //Do a little magic to get the probability!!
217  prob = rho.normalizedProb(amp.getSpinDensity());
218 
219  probctl[j] = prob;
220  }
221 
222  //probclt contains prob at ctl=-1,0,1.
223  //prob=a+b*ctl+c*ctl^2
224 
225  double a = probctl[1];
226  double b = 0.5 * (probctl[2] - probctl[0]);
227  double c = 0.5 * (probctl[2] + probctl[0]) - probctl[1];
228 
229  prob = probctl[0];
230  if (probctl[1] > prob) prob = probctl[1];
231  if (probctl[2] > prob) prob = probctl[2];
232 
233  if (fabs(c) > 1e-20) {
234  double ctlx = -0.5 * b / c;
235  if (fabs(ctlx) < 1.0) {
236  double probtmp = a + b * ctlx + c * ctlx * ctlx;
237  if (probtmp > prob) prob = probtmp;
238  }
239 
240  }
241 
242  if (prob > maxfoundprob) {
243  maxfoundprob = prob;
244  }
245 
246  }
247  if (EvtPDL::getWidth(meson) <= 0.0) {
248  //if the particle is narrow dont bother with changing the mass.
249  massiter = 4;
250  }
251 
252  }
253  root_part->deleteTree();
254 
255  maxfoundprob *= 1.1;
256  return maxfoundprob;
257 
258  }
259 
261 } // Belle 2 Namespace
double R
typedef autogenerated by FFTW
virtual void CalcAmp(EvtParticle *parent, EvtAmp &amp, EvtBSemiTauonicHelicityAmplitudeCalculator *HelicityAmplitudeCalculator)=0
The function calculates the spin dependent amplitude.
The class calculates the helicity amplitude of semi-tauonic B decays including new physics effects ba...
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
EvtSpinDensity RotateToHelicityBasisInBoostedFrame(const EvtParticle *p, EvtVector4R p4boost)
The function calculates the rotation matrix to convert the spin basis to the helicity basis in the bo...
double CalcMaxProb(EvtId parent, EvtId meson, EvtId lepton, EvtId nudaug, EvtBSemiTauonicHelicityAmplitudeCalculator *HelicityAmplitudeCalculator)
The function calculates the maximum probability.
Abstract base class for different kinds of events.