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
src
EvtGenModels
EvtDMix.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/EvtDMix.hh
"
22
23
#include "
EvtGenBase/EvtGenKine.hh
"
24
#include "
EvtGenBase/EvtPDL.hh
"
25
#include "
EvtGenBase/EvtParticle.hh
"
26
#include "
EvtGenBase/EvtRandom.hh
"
27
#include "
EvtGenBase/EvtReport.hh
"
28
29
#include <stdlib.h>
30
#include <string>
31
32
std::string
EvtDMix::getName
()
const
33
{
34
return
"DMIX"
;
35
}
36
37
EvtDecayBase
*
EvtDMix::clone
()
const
38
{
39
return
new
EvtDMix
;
40
}
41
42
void
EvtDMix::init
()
43
{
44
// check arguments
45
checkNArg
( 3 );
46
m_rd
=
getArg
( 0 );
47
m_xpr
=
getArg
( 1 );
48
m_ypr
=
getArg
( 2 );
49
}
50
51
void
EvtDMix::initProbMax
()
52
{
53
noProbMax
();
54
}
55
56
void
EvtDMix::decay
(
EvtParticle
* p )
57
{
58
//unneeded - lange - may13-02
59
//if ( p->getNDaug() != 0 ) {
60
//Will end up here because maxrate multiplies by 1.2
61
// EvtGenReport(EVTGEN_DEBUG,"EvtGen") << "In EvtDMix: has "
62
// <<" daugthers should not be here!"<<endl;
63
// return;
64
//}
65
66
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
() );
67
68
double
ctau =
EvtPDL::getctau
( p->
getId
() );
69
if
( ctau == 0. )
70
return
;
71
72
double
pdf, random, gt, weight;
73
74
double
maxPdf =
m_rd
+ sqrt(
m_rd
) *
m_ypr
* 50. +
75
2500.0 * (
m_xpr
*
m_xpr
+
m_ypr
*
m_ypr
) / 4.0;
76
bool
keepGoing =
true
;
77
while
( keepGoing ) {
78
random =
EvtRandom::Flat
();
79
gt = -log( random );
80
weight = random;
81
pdf =
m_rd
+ sqrt(
m_rd
) *
m_ypr
* gt +
82
gt * gt * (
m_xpr
*
m_xpr
+
m_ypr
*
m_ypr
) / 4.0;
83
pdf *=
exp
( -1.0 * gt );
84
pdf /= weight;
85
if
( pdf > maxPdf )
86
std::cout << pdf <<
" "
<< weight <<
" "
<< maxPdf <<
" "
<< gt
87
<< std::endl;
88
if
( pdf > maxPdf *
EvtRandom::Flat
() )
89
keepGoing =
false
;
90
}
91
92
p->
setLifetime
( gt * ctau );
93
94
return
;
95
}
exp
EvtComplex exp(const EvtComplex &c)
Definition
EvtComplex.hh:242
EvtDMix.hh
EvtGenKine.hh
EvtPDL.hh
EvtParticle.hh
EvtRandom.hh
EvtReport.hh
EvtDMix
Definition
EvtDMix.hh:28
EvtDMix::m_ypr
double m_ypr
Definition
EvtDMix.hh:43
EvtDMix::m_rd
double m_rd
Definition
EvtDMix.hh:41
EvtDMix::init
void init() override
Definition
EvtDMix.cpp:42
EvtDMix::m_xpr
double m_xpr
Definition
EvtDMix.hh:42
EvtDMix::getName
std::string getName() const override
Definition
EvtDMix.cpp:32
EvtDMix::decay
void decay(EvtParticle *p) override
Definition
EvtDMix.cpp:56
EvtDMix::initProbMax
void initProbMax() override
Definition
EvtDMix.cpp:51
EvtDMix::clone
EvtDecayBase * clone() const override
Definition
EvtDMix.cpp:37
EvtDecayBase::EvtDecayBase
EvtDecayBase()=default
EvtDecayBase::getNDaug
int getNDaug() const
Definition
EvtDecayBase.hh:64
EvtDecayBase::getArg
double getArg(unsigned int j)
Definition
EvtDecayBase.cpp:578
EvtDecayBase::noProbMax
void noProbMax()
Definition
EvtDecayBase.cpp:301
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
EvtPDL::getctau
static double getctau(EvtId i)
Definition
EvtPDL.cpp:351
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::initializePhaseSpace
double initializePhaseSpace(size_t numdaughter, const EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
Definition
EvtParticle.cpp:1100
EvtParticle::getId
EvtId getId() const
Definition
EvtParticle.cpp:124
EvtParticle::setLifetime
void setLifetime(double tau)
Definition
EvtParticle.cpp:95
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
Generated by
1.16.1