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