EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenModels
EvtThreeBodyPhsp.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
21
#include "
EvtGenModels/EvtThreeBodyPhsp.hh
"
22
23
#include "
EvtGenBase/EvtConst.hh
"
24
#include "
EvtGenBase/EvtGenKine.hh
"
25
#include "
EvtGenBase/EvtParticle.hh
"
26
#include "
EvtGenBase/EvtRandom.hh
"
27
#include "
EvtGenBase/EvtReport.hh
"
28
29
#include <algorithm>
30
#include <cmath>
31
#include <iostream>
32
33
std::string
EvtThreeBodyPhsp::getName
()
const
34
{
35
return
"THREEBODYPHSP"
;
36
}
37
38
EvtDecayBase
*
EvtThreeBodyPhsp::clone
()
const
39
{
40
return
new
EvtThreeBodyPhsp
;
41
}
42
43
void
EvtThreeBodyPhsp::init
()
44
{
45
// check correct number of arguments
46
checkNArg
( 2, 4 );
47
// check number of daughters
48
checkNDaug
( 3 );
49
// Get box size
50
m_m12SqMin
=
getArg
( 0 );
51
m_m12SqMax
=
getArg
( 1 );
52
if
(
getNArg
() > 2 ) {
53
m_m23SqMin
=
getArg
( 2 );
54
m_m23SqMax
=
getArg
( 3 );
55
}
else
{
56
m_m23SqMin
= 0;
57
m_m23SqMax
= 1e10;
58
}
59
}
60
61
void
EvtThreeBodyPhsp::initProbMax
()
62
{
63
noProbMax
();
64
}
65
66
void
EvtThreeBodyPhsp::decay
(
EvtParticle
* p )
67
{
68
p->
makeDaughters
(
getNDaug
(),
getDaugs
() );
69
p->
generateMassTree
();
70
const
double
mParent = p->
mass
();
71
EvtParticle
* daug1 = p->
getDaug
( 0 );
72
EvtParticle
* daug2 = p->
getDaug
( 1 );
73
EvtParticle
* daug3 = p->
getDaug
( 2 );
74
const
double
mDaug1 = daug1->
mass
();
75
const
double
mDaug2 = daug2->
mass
();
76
const
double
mDaug3 = daug3->
mass
();
77
78
const
double
m12borderMin = mDaug1 + mDaug2;
79
const
double
m12borderMax = mParent - mDaug3;
80
const
double
m12Min = std::max(
m_m12SqMin
, m12borderMin * m12borderMin );
81
const
double
m12Max = std::min(
m_m12SqMax
, m12borderMax * m12borderMax );
82
83
const
double
m23borderMin = mDaug2 + mDaug3;
84
const
double
m23borderMax = mParent - mDaug1;
85
const
double
m23Min = std::max(
m_m23SqMin
, m23borderMin * m23borderMin );
86
const
double
m23Max = std::min(
m_m23SqMax
, m23borderMax * m23borderMax );
87
88
const
int
nMaxTrials = 1000;
89
int
iTrial = 0;
90
bool
goodEvent =
false
;
91
double
m12Sq, m23Sq, m23LowLimit, m23HighLimit;
92
do
{
93
m12Sq =
EvtRandom::Flat
( m12Min, m12Max );
94
m23Sq =
EvtRandom::Flat
( m23Min, m23Max );
95
// By definition, m12Sq is always within Dalitz plot, but need to check
96
// that also m23Sq is in
97
double
E2st = 0.5 * ( m12Sq - mDaug1 * mDaug1 + mDaug2 * mDaug2 ) /
98
std::sqrt( m12Sq );
99
double
E3st = 0.5 * ( mParent * mParent - m12Sq - mDaug3 * mDaug3 ) /
100
std::sqrt( m12Sq );
101
double
p2st = std::sqrt( E2st * E2st - mDaug2 * mDaug2 );
102
double
p3st = std::sqrt( E3st * E3st - mDaug3 * mDaug3 );
103
m23HighLimit = ( E2st + E3st ) * ( E2st + E3st ) -
104
( p2st - p3st ) * ( p2st - p3st );
105
m23LowLimit = ( E2st + E3st ) * ( E2st + E3st ) -
106
( p2st + p3st ) * ( p2st + p3st );
107
if
( m23Sq > m23LowLimit && m23Sq < m23HighLimit ) {
108
goodEvent =
true
;
109
}
110
++iTrial;
111
}
while
( goodEvent ==
false
&& iTrial < nMaxTrials );
112
if
( !goodEvent ) {
113
EvtGenReport
(
EVTGEN_WARNING
,
"EvtThreeBodyPhsp"
)
114
<<
"Failed to generate m12Sq and m23Sq. Taking last m12Sq and midpoint of allowed m23Sq.\n"
;
115
m23Sq = 0.5 * ( m23LowLimit + m23HighLimit );
116
}
117
118
// At this moment we have valid invariant masses squared
119
EvtGenKine::ThreeBodyKine
( m12Sq, m23Sq, p );
120
121
return
;
122
}
EvtConst.hh
EvtGenKine.hh
EvtParticle.hh
EvtRandom.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_WARNING
@ EVTGEN_WARNING
Definition
EvtReport.hh:50
EvtThreeBodyPhsp.hh
EvtDecayBase::EvtDecayBase
EvtDecayBase()=default
EvtDecayBase::getNDaug
int getNDaug() const
Definition
EvtDecayBase.hh:64
EvtDecayBase::getNArg
int getNArg() const
Definition
EvtDecayBase.hh:67
EvtDecayBase::getArg
double getArg(unsigned int j)
Definition
EvtDecayBase.cpp:578
EvtDecayBase::noProbMax
void noProbMax()
Definition
EvtDecayBase.cpp:301
EvtDecayBase::checkNDaug
void checkNDaug(int d1, int d2=-1)
Definition
EvtDecayBase.cpp:516
EvtDecayBase::checkNArg
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
Definition
EvtDecayBase.cpp:492
EvtDecayBase::getDaugs
const EvtId * getDaugs() const
Definition
EvtDecayBase.hh:65
EvtGenKine::ThreeBodyKine
static void ThreeBodyKine(const double m12Sq, const double m23Sq, EvtParticle *p)
Definition
EvtGenKine.cpp:350
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::getDaug
EvtParticle * getDaug(const int i)
Definition
EvtParticle.hh:173
EvtParticle::mass
double mass() const
Definition
EvtParticle.cpp:159
EvtParticle::generateMassTree
bool generateMassTree()
Definition
EvtParticle.cpp:509
EvtParticle::makeDaughters
void makeDaughters(size_t ndaug, const EvtId *id)
Definition
EvtParticle.cpp:1235
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
EvtThreeBodyPhsp
Definition
EvtThreeBodyPhsp.hh:32
EvtThreeBodyPhsp::m_m12SqMax
double m_m12SqMax
Definition
EvtThreeBodyPhsp.hh:46
EvtThreeBodyPhsp::m_m12SqMin
double m_m12SqMin
Definition
EvtThreeBodyPhsp.hh:45
EvtThreeBodyPhsp::decay
void decay(EvtParticle *p) override
Definition
EvtThreeBodyPhsp.cpp:66
EvtThreeBodyPhsp::clone
EvtDecayBase * clone() const override
Definition
EvtThreeBodyPhsp.cpp:38
EvtThreeBodyPhsp::initProbMax
void initProbMax() override
Definition
EvtThreeBodyPhsp.cpp:61
EvtThreeBodyPhsp::m_m23SqMin
double m_m23SqMin
Definition
EvtThreeBodyPhsp.hh:47
EvtThreeBodyPhsp::m_m23SqMax
double m_m23SqMax
Definition
EvtThreeBodyPhsp.hh:48
EvtThreeBodyPhsp::init
void init() override
Definition
EvtThreeBodyPhsp.cpp:43
EvtThreeBodyPhsp::getName
std::string getName() const override
Definition
EvtThreeBodyPhsp.cpp:33
Generated by
1.17.0