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.
EvtBtoXsgamma.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/EvtReport.hh"
29 
34 
35 #include <stdlib.h>
36 #include <string>
37 using std::endl;
38 
40 {
41  return "BTOXSGAMMA";
42 }
43 
45 {
46  return new EvtBtoXsgamma;
47 }
48 
50 {
51  //Arguments:
52  // 0: Ali-Greub model = 1, Kagan model = 2
53  //No more arguments for Ali-Greub model
54  // 1:
55  // 2:
56  // 3:
57 
58  // check that at least one b->sg model has been selected
59  if ( getNArg() == 0 ) {
60  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
61  << "EvtBtoXsgamma generator expected "
62  << " at least 1 argument but found: " << getNArg() << endl;
63  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
64  << "Will terminate execution!" << endl;
65  ::abort();
66  }
67 }
68 
70 {
71  noProbMax();
72 }
73 
75 {
76  //initialize here. -- its too damn slow otherwise.
77 
78  if ( _model == 0 ) {
79  if ( getArg( 0 ) == 1 )
80  _model = std::make_unique<EvtBtoXsgammaAliGreub>();
81  else if ( getArg( 0 ) == 2 )
82  _model = std::make_unique<EvtBtoXsgammaKagan>();
83  else if ( getArg( 0 ) == 3 )
84  _model = std::make_unique<EvtBtoXsgammaFixedMass>();
85  else if ( getArg( 0 ) == 4 )
86  _model = std::make_unique<EvtBtoXsgammaFlatEnergy>();
87  else {
88  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
89  << "No valid EvtBtoXsgamma generator model selected "
90  << "Set arg(0) to 1 for Ali-Greub model or 2 for "
91  << " Kagan model or 3 for a fixed mass" << endl;
92  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
93  << "Will terminate execution!" << endl;
94  ::abort();
95  }
96  _model->init( getNArg(), getArgs() );
97  }
98 
99  // if ( p->getNDaug() != 0 ) {
100  //Will end up here because maxrate multiplies by 1.2
101  // EvtGenReport(EVTGEN_DEBUG,"EvtGen") << "In EvtBtoXsgamma: X_s daughters should not be here!"<<endl;
102  // return;
103  //}
104 
105  double m_b;
106  int i;
107  p->makeDaughters( getNDaug(), getDaugs() );
108  EvtParticle* pdaug[MAX_DAUG];
109 
110  for ( i = 0; i < getNDaug(); i++ ) {
111  pdaug[i] = p->getDaug( i );
112  }
113 
114  static EvtVector4R p4[MAX_DAUG];
115  static double mass[MAX_DAUG];
116 
117  m_b = p->mass();
118 
119  mass[1] = EvtPDL::getMass( getDaug( 1 ) );
120 
121  int Xscode = EvtPDL::getStdHep( getDaug( 0 ) );
122 
123  mass[0] = _model->GetMass( Xscode );
124 
125  EvtGenKine::PhaseSpace( getNDaug(), mass, p4, m_b );
126 
127  for ( i = 0; i < getNDaug(); i++ ) {
128  pdaug[i]->init( getDaugs()[i], p4[i] );
129  }
130 }
double * getArgs()
std::unique_ptr< EvtBtoXsgammaAbsModel > _model
double getArg(unsigned int j)
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
void makeDaughters(unsigned int ndaug, EvtId *id)
void initProbMax() override
EvtDecayBase * clone() override
EvtId * getDaugs()
Definition: EvtDecayBase.hh:66
void decay(EvtParticle *p) 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
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
int getNArg() const
Definition: EvtDecayBase.hh:68
static int getStdHep(EvtId id)
Definition: EvtPDL.cpp:362
std::string getName() override
EvtId getDaug(int i) const
Definition: EvtDecayBase.hh:67