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.
EvtBtoXsgammaFlatEnergy.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/EvtPatches.hh"
24 #include "EvtGenBase/EvtRandom.hh"
25 #include "EvtGenBase/EvtReport.hh"
26 
28 
29 #include <fstream>
30 #include <stdlib.h>
31 using std::endl;
32 using std::fstream;
33 
34 void EvtBtoXsgammaFlatEnergy::init( int nArg, double* args )
35 {
36  if ( ( nArg ) > 3 || ( nArg > 1 && nArg < 3 ) ) {
37  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
38  << "EvtBtoXsgamma generator model "
39  << "EvtBtoXsgammaFlatEnergy expected "
40  << "either 1(default config) or two arguments but found: " << nArg
41  << endl;
42  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
43  << "Will terminate execution!" << endl;
44  ::abort();
45  }
46  _mB0 = 5.2794;
47  double mPi = 0.140;
48  double mK = 0.494;
49  if ( nArg == 1 ) {
50  _eMin = 1.7;
51  //Invariant mass of Xsd must be greater the m_pi+m_K leads to
52  //Egamma < (m_B**2-(m_pi+m_k)**2)/(2m_B)
53  _eMax = ( pow( _mB0, 2 ) - pow( mPi + mK, 2 ) ) / ( 2.0 * _mB0 );
54  } else {
55  _eMin = args[1];
56  _eMax = args[2];
57  }
58  if ( _eMax > ( pow( _mB0, 2 ) - pow( mPi + mK, 2 ) ) / ( 2.0 * _mB0 ) ) {
59  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
60  << "Emax greater than Kinematic limit" << endl;
61  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
62  << "Reset to the kinematic limit" << endl;
63  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
64  << "(m_B**2-(m_pi+m_k)**2)/(2m_B)" << endl;
65  _eMax = ( pow( _mB0, 2 ) - pow( mPi + mK, 2 ) ) / ( 2.0 * _mB0 );
66  }
67  _eRange = _eMax - _eMin;
68 }
69 
70 double EvtBtoXsgammaFlatEnergy::GetMass( int /*Xscode*/ )
71 {
72  double eGamma = EvtRandom::Flat( _eRange ) + _eMin;
73  double mH = sqrt( pow( _mB0, 2 ) - 2.0 * _mB0 * eGamma );
74  return mH;
75 }
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
void init(int, double *) override
double GetMass(int code) override
static double Flat()
Definition: EvtRandom.cpp:72