evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtBtoXsEtap.cpp
Go to the documentation of this file.
1 
2 /***********************************************************************
3 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4 * *
5 * This file is part of EvtGen. *
6 * *
7 * EvtGen is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * EvtGen is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19 ***********************************************************************/
20 
22 
23 #include "EvtGenBase/EvtConst.hh"
24 #include "EvtGenBase/EvtGenKine.hh"
25 #include "EvtGenBase/EvtPDL.hh"
27 #include "EvtGenBase/EvtPatches.hh"
28 #include "EvtGenBase/EvtRandom.hh"
29 #include "EvtGenBase/EvtReport.hh"
30 
31 #include <stdlib.h>
32 #include <string>
33 using std::endl;
34 
35 std::string EvtBtoXsEtap::getName()
36 {
37  return "BTOXSETAP";
38 }
39 
41 {
42  return new EvtBtoXsEtap;
43 }
44 
46 {
47  // check that there are no arguments
48 
49  checkNArg( 0 );
50 }
51 
53 {
54  noProbMax();
55 }
56 
58 {
59  // useless
60  // if ( p->getNDaug() != 0 ) {
61  // //Will end up here because maxrate multiplies by 1.2
62  // EvtGenReport(EVTGEN_DEBUG,"EvtGen") << "In EvtBtoXsEtap: X_s daughters should not be here!"<<endl;
63  // return;
64  //}
65 
66  double m_b;
67  int i;
68  p->makeDaughters( getNDaug(), getDaugs() );
69  EvtParticle* pdaug[MAX_DAUG];
70 
71  for ( i = 0; i < getNDaug(); i++ ) {
72  pdaug[i] = p->getDaug( i );
73  }
74 
75  static EvtVector4R p4[MAX_DAUG];
76  static double mass[MAX_DAUG];
77 
78  m_b = p->mass();
79 
80  // Prepare for phase space routine.
81 
82  mass[1] = EvtPDL::getMass( getDaug( 1 ) );
83 
84  double xbox, ybox, min, max, hichfit;
85  min = 0.493;
86  max = 4.3;
87  const double TwoPi = EvtConst::twoPi;
88  int Xscode = EvtPDL::getStdHep( getDaug( 0 ) );
89 
90  // A five parameters fit, the shape is taken from Atwood & Soni
91 
92  // double par[18];
93  double par[6];
94  if ( ( Xscode == 30343 ) || ( Xscode == -30343 ) || ( Xscode == 30353 ) ||
95  ( Xscode == -30353 ) ) { // Xsu or Xsd
96  min = 0.6373; // Just above K pi threshold for Xsd/u
97  //min=0.6333; // K pi threshold for neutral Xsd
98  // par[0]=-2057.2380371094;
99  par[0] = 2.36816;
100  // par[1]=2502.2556152344;
101  par[1] = 0.62325725;
102  // par[2]=1151.5632324219;
103  par[2] = 2.2;
104  // par[3]=0.82431584596634;
105  par[3] = -0.2109375;
106  // par[4]=-4110.5234375000;
107  par[4] = 2.7;
108  // par[5]=8445.6757812500;
109  par[5] = 0.54;
110  // par[6]=-3034.1894531250;
111  // par[7]=1.1557708978653;
112  // par[8]=1765.9311523438;
113  // par[9]=1.3730158805847;
114  // par[10]=0.51371538639069;
115  // par[11]=2.0056934356689;
116  // par[12]=37144.097656250;
117  // par[13]=-50296.781250000;
118  // par[14]=27319.095703125;
119  // par[15]=-7408.0678710938;
120  // par[16]=1000.8093261719;
121  // par[17]=-53.834449768066;
122  } else {
123  EvtGenReport( EVTGEN_DEBUG, "EvtGen" )
124  << "In EvtBtoXsEtap: Particle with id " << Xscode
125  << " is not a Xsd/u particle" << endl;
126  return;
127  }
128 
129  double boxheight = par[5];
130  double boxwidth = max - min;
131 
132  mass[0] = 0.0;
133  while ( ( mass[0] > max ) || ( mass[0] < min ) ) {
134  xbox = EvtRandom::Flat( boxwidth ) + min;
135  ybox = EvtRandom::Flat( boxheight );
136  if ( xbox < par[2] ) {
137  hichfit = ( 1 / sqrt( TwoPi * par[1] ) ) *
138  exp( -0.5 * pow( ( xbox - par[0] ) / par[1], 2 ) );
139  // alifit=par[0]+par[1]*xbox+par[2]*pow(xbox,2);
140  // } else if (xbox<par[7]) {
141  // alifit=par[4]+par[5]*xbox+par[6]*pow(xbox,2);
142  // } else if (xbox<par[11]) {
143  // alifit=par[8]*exp(-0.5*pow((xbox-par[9])/par[10],2));
144  } else {
145  hichfit = par[3] * pow( ( xbox - par[4] ), 2 ) + par[5];
146  // alifit=par[12]+par[13]*xbox+par[14]*pow(xbox,2)+par[15]*pow(xbox,3)+par[16]*pow(xbox,4)+par[17]*pow(xbox,5);
147  }
148  if ( ybox > hichfit ) {
149  mass[0] = 0.0;
150  } else {
151  mass[0] = xbox;
152  }
153  }
154 
155  // debug stuff: EvtGenReport(EVTGEN_INFO,"EvtGen") << "Xscode " << Xscode << " daughter 1 mass " << mass[0] << " daughter 2 mass " << mass[1] << endl;
156 
157  EvtGenKine::PhaseSpace( getNDaug(), mass, p4, m_b );
158 
159  for ( i = 0; i < getNDaug(); i++ ) {
160  pdaug[i]->init( getDaugs()[i], p4[i] );
161  }
162 
163  return;
164 }
void initProbMax() override
void decay(EvtParticle *p) override
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void init() override
static const double twoPi
Definition: EvtConst.hh:27
void makeDaughters(unsigned int ndaug, EvtId *id)
EvtId * getDaugs()
Definition: EvtDecayBase.hh:66
static double Flat()
Definition: EvtRandom.cpp:72
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
EvtDecayBase * clone() override
static double PhaseSpace(int ndaug, double mass[30], EvtVector4R p4[30], double mp)
Definition: EvtGenKine.cpp:46
double mass() const
int getNDaug() const
Definition: EvtDecayBase.hh:65
EvtComplex exp(const EvtComplex &c)
Definition: EvtComplex.hh:240
const int MAX_DAUG
Definition: EvtParticle.hh:42
EvtParticle * getDaug(int i)
Definition: EvtParticle.cpp:91
static double getMass(EvtId i)
Definition: EvtPDL.cpp:319
std::string getName() override
static int getStdHep(EvtId id)
Definition: EvtPDL.cpp:362
EvtId getDaug(int i) const
Definition: EvtDecayBase.hh:67