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.
EvtBtoKD3P.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/EvtCyclic3.hh"
26 #include "EvtGenBase/EvtId.hh"
28 #include "EvtGenBase/EvtPatches.hh"
29 #include "EvtGenBase/EvtRandom.hh"
30 #include "EvtGenBase/EvtReport.hh"
31 
32 #include "EvtGenModels/EvtPto3P.hh"
33 
34 #include <assert.h>
35 using std::endl;
36 
37 //------------------------------------------------------------------
39 {
40  return new EvtBtoKD3P();
41 }
42 
43 //------------------------------------------------------------------
44 std::string EvtBtoKD3P::getName()
45 {
46  return "BTOKD3P";
47 }
48 
49 //------------------------------------------------------------------
51 {
52  checkNArg( 2 ); // r, phase
53  checkNDaug( 3 ); // K, D0(allowed), D0(suppressed).
54  // The last two daughters are really one particle
55 
56  // check that the mother and all daughters are scalars:
61 
62  // Check that the B dtr types are K D D:
63 
64  // get the parameters:
65  _r = getArg( 0 );
66  double phase = getArg( 1 );
67  _exp = EvtComplex( cos( phase ), sin( phase ) );
68 }
69 
70 //------------------------------------------------------------------
72 {
73  setProbMax( 1 ); // this is later changed in decay()
74 }
75 
76 //------------------------------------------------------------------
78 {
79  // tell the subclass that we decay the daughter:
81 
82  // the K is the 1st daughter of the B EvtParticle.
83  // The decay mode of the allowed D (the one produced in b->c decay) is 2nd
84  // The decay mode of the suppressed D (the one produced in b->u decay) is 3rd
85  const int KIND = 0;
86  const int D1IND = 1;
87  const int D2IND = 2;
88 
89  // generate kinematics of daughters (K and D):
90  EvtId tempDaug[2] = {getDaug( KIND ), getDaug( D1IND )};
91  p->initializePhaseSpace( 2, tempDaug );
92 
93  // Get the D daughter particle and the decay models of the allowed
94  // and suppressed D modes:
95  EvtParticle* theD = p->getDaug( D1IND );
96  EvtPto3P* model1 =
98 
99  // for the suppressed mode, re-initialize theD as the suppressed D alias:
100  theD->init( getDaug( D2IND ), theD->getP4() );
101  EvtPto3P* model2 =
103 
104  // on the first call:
105  if ( false == _decayedOnce ) {
106  _decayedOnce = true;
107 
108  // store the D decay model pointers:
109  _model1 = model1;
110  _model2 = model2;
111 
112  // check the decay models of the first 2 daughters and that they
113  // have the same final states:
114  std::string name1 = model1->getName();
115  std::string name2 = model2->getName();
116 
117  if ( name1 != "PTO3P" ) {
118  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
119  << "D daughters of EvtBtoKD3P decay must decay via the \"PTO3P\" model"
120  << endl
121  << " but found to decay via " << name1.c_str() << " or "
122  << name2.c_str() << ". Will terminate execution!" << endl;
123  assert( 0 );
124  }
125 
126  EvtId* daugs1 = model1->getDaugs();
127  EvtId* daugs2 = model2->getDaugs();
128 
129  bool idMatch = true;
130  int d;
131  for ( d = 0; d < 2; ++d ) {
132  if ( daugs1[d] != daugs2[d] ) {
133  idMatch = false;
134  }
135  }
136  if ( false == idMatch ) {
137  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
138  << "D daughters of EvtBtoKD3P decay must decay to the same final state"
139  << endl
140  << " particles in the same order (not CP-conjugate order),"
141  << endl
142  << " but they were found to decay to" << endl;
143  for ( d = 0; d < model1->getNDaug(); ++d ) {
145  << " " << EvtPDL::name( daugs1[d] ).c_str() << " ";
146  }
147  EvtGenReport( EVTGEN_ERROR, "" ) << endl;
148  for ( d = 0; d < model1->getNDaug(); ++d ) {
150  << " " << EvtPDL::name( daugs2[d] ).c_str() << " ";
151  }
153  << endl
154  << ". Will terminate execution!" << endl;
155  assert( 0 );
156  }
157 
158  // estimate the probmax. Need to know the probmax's of the 2
159  // models for this:
160  setProbMax(
161  model1->getProbMax( 0 ) + _r * _r * model2->getProbMax( 0 ) +
162  2 * _r * sqrt( model1->getProbMax( 0 ) * model2->getProbMax( 0 ) ) );
163 
164  } // end of things to do on the first call
165 
166  // make sure the models haven't changed since the first call:
167  if ( _model1 != model1 || _model2 != model2 ) {
168  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
169  << "D daughters of EvtBtoKD3P decay should have only 1 decay modes, "
170  << endl
171  << " but a new decay mode was found after the first call" << endl
172  << " Will terminate execution!" << endl;
173  assert( 0 );
174  }
175 
176  // get the cover function for each of the models and add them up.
177  // They are summed with coefficients 1 because we are willing to
178  // take a small inefficiency (~50%) in order to ensure that the
179  // cover function is large enough without getting into complications
180  // associated with the smallness of _r:
181  EvtPdfSum<EvtDalitzPoint>* pc1 = model1->getPC();
182  EvtPdfSum<EvtDalitzPoint>* pc2 = model2->getPC();
184  pc.addTerm( 1.0, *pc1 );
185  pc.addTerm( 1.0, *pc2 );
186 
187  // from this combined cover function, generate the Dalitz point:
188  EvtDalitzPoint x = pc.randomPoint();
189 
190  // get the aptitude for each of the models on this point and add them up:
191  EvtComplex amp1 = model1->amplNonCP( x );
192  EvtComplex amp2 = model2->amplNonCP( x );
193  EvtComplex amp = amp1 + amp2 * _r * _exp;
194 
195  // get the value of the cover function for this point and set the
196  // relative amplitude for this decay:
197 
198  double comp = sqrt( pc.evaluate( x ) );
199  vertex( amp / comp );
200 
201  // Make the daughters of theD:
202  bool massTreeOK = theD->generateMassTree();
203  if ( massTreeOK == false ) {
204  return;
205  }
206 
207  // Now generate the p4's of the daughters of theD:
208  std::vector<EvtVector4R> v = model2->initDaughters( x );
209 
210  if ( v.size() != theD->getNDaug() ) {
211  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
212  << "Number of daughters " << theD->getNDaug() << " != "
213  << "Momentum vector size " << v.size() << endl
214  << " Terminating execution." << endl;
215  assert( 0 );
216  }
217 
218  // Apply the new p4's to the daughters:
219  for ( unsigned int i = 0; i < theD->getNDaug(); ++i ) {
220  theD->getDaug( i )->init( model2->getDaugs()[i], v[i] );
221  }
222 }
std::string getName() override
Definition: EvtPto3P.hh:35
EvtComplex _exp
Definition: EvtBtoKD3P.hh:70
static std::string name(EvtId i)
Definition: EvtPDL.cpp:382
double getProbMax(double prob)
static EvtDecayTable * getInstance()
double evaluate(const T &p) const
Definition: EvtPdf.hh:79
bool _decayedOnce
Definition: EvtBtoKD3P.hh:75
double getArg(unsigned int j)
std::string getName() override
Definition: EvtBtoKD3P.cpp:44
EvtPdfSum< T > * getPC()
double _r
Definition: EvtBtoKD3P.hh:69
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
T randomPoint() override
Definition: EvtPdfSum.hh:129
const EvtDecayBase * _model2
Definition: EvtBtoKD3P.hh:74
EvtId * getDaugs()
Definition: EvtDecayBase.hh:66
void setProbMax(double prbmx)
Definition: EvtId.hh:27
size_t getNDaug() const
EvtDecayBase * getDecayFunc(EvtParticle *p)
bool _daugsDecayedByParentModel
bool generateMassTree()
void decay(EvtParticle *p) override
Definition: EvtBtoKD3P.cpp:77
void vertex(const EvtComplex &amp)
Definition: EvtDecayAmp.hh:37
void init() override
Definition: EvtBtoKD3P.cpp:50
double initializePhaseSpace(unsigned int numdaughter, EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
void checkNDaug(int d1, int d2=-1)
void checkSpinParent(EvtSpinType::spintype sp)
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
void initProbMax() override
Definition: EvtBtoKD3P.cpp:71
const EvtVector4R & getP4() const
void addTerm(double c, const EvtPdf< T > &pdf)
Definition: EvtPdfSum.hh:41
void checkSpinDaughter(int d1, EvtSpinType::spintype sp)
int getNDaug() const
Definition: EvtDecayBase.hh:65
EvtDecayBase * clone() override
Definition: EvtBtoKD3P.cpp:38
const EvtDecayBase * _model1
Definition: EvtBtoKD3P.hh:73
EvtParticle * getDaug(int i)
Definition: EvtParticle.cpp:91
std::vector< EvtVector4R > initDaughters(const EvtDalitzPoint &p) const override
Definition: EvtPto3P.cpp:62
EvtComplex amplNonCP(const T &x)
EvtId getDaug(int i) const
Definition: EvtDecayBase.hh:67