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
EvtSingleParticle.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/EvtSingleParticle.hh
"
22
23
#include "
EvtGenBase/EvtConst.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
using
std::endl;
32
33
std::string
EvtSingleParticle::getName
()
const
34
{
35
return
"SINGLE"
;
36
}
37
38
EvtDecayBase
*
EvtSingleParticle::clone
()
const
39
{
40
return
new
EvtSingleParticle
();
41
}
42
43
void
EvtSingleParticle::initProbMax
()
44
{
45
noProbMax
();
46
}
47
48
void
EvtSingleParticle::init
()
49
{
50
//turn off checks for charge conservation
51
disableCheckQ
();
52
53
if
( (
getNArg
() == 6 ) || (
getNArg
() == 4 ) || (
getNArg
() == 2 ) ) {
54
if
(
getNArg
() == 6 ) {
55
//copy the arguments into eaiser to remember names!
56
57
m_pmin
=
getArg
( 0 );
58
m_pmax
=
getArg
( 1 );
59
60
m_cthetamin
=
getArg
( 2 );
61
m_cthetamax
=
getArg
( 3 );
62
63
m_phimin
=
getArg
( 4 );
64
m_phimax
=
getArg
( 5 );
65
}
66
67
if
(
getNArg
() == 4 ) {
68
//copy the arguments into eaiser to remember names!
69
70
m_pmin
=
getArg
( 0 );
71
m_pmax
=
getArg
( 1 );
72
73
m_cthetamin
=
getArg
( 2 );
74
m_cthetamax
=
getArg
( 3 );
75
76
m_phimin
= 0.0;
77
m_phimax
=
EvtConst::twoPi
;
78
}
79
80
if
(
getNArg
() == 2 ) {
81
//copy the arguments into eaiser to remember names!
82
83
m_pmin
=
getArg
( 0 );
84
m_pmax
=
getArg
( 1 );
85
86
m_cthetamin
= -1.0;
87
m_cthetamax
= 1.0;
88
89
m_phimin
= 0.0;
90
m_phimax
=
EvtConst::twoPi
;
91
}
92
93
}
else
{
94
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
95
<<
"EvtSingleParticle generator expected "
96
<<
" 6, 4, or 2 arguments but found:"
<<
getNArg
() << endl;
97
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
98
<<
"Will terminate execution!"
<< endl;
99
::abort();
100
}
101
102
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
103
<<
"The single particle generator has been configured:"
<< endl;
104
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
105
<<
m_pmax
<<
" > p > "
<<
m_pmin
<< endl;
106
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
107
<<
m_cthetamax
<<
" > costheta > "
<<
m_cthetamin
<< endl;
108
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
109
<<
m_phimax
<<
" > phi > "
<<
m_phimin
<< endl;
110
}
111
112
void
EvtSingleParticle::decay
(
EvtParticle
* p )
113
{
114
EvtParticle
* d;
115
EvtVector4R
p4;
116
117
double
mass =
EvtPDL::getMass
(
getDaug
( 0 ) );
118
119
p->
makeDaughters
(
getNDaug
(),
getDaugs
() );
120
d = p->
getDaug
( 0 );
121
122
//generate flat distribution in p
123
//we are now in the parents restframe! This means the
124
//restframe of the e+e- collison.
125
double
pcm =
EvtRandom::Flat
(
m_pmin
,
m_pmax
);
126
//generate flat distribution in phi.
127
double
phi =
EvtRandom::Flat
(
m_phimin
,
m_phimax
);
128
129
double
cthetalab;
130
131
do
{
132
//generate flat distribution in costheta
133
double
ctheta =
EvtRandom::Flat
(
m_cthetamin
,
m_cthetamax
);
134
double
stheta = sqrt( 1.0 - ctheta * ctheta );
135
p4.
set
( sqrt( mass * mass + pcm * pcm ), pcm * cos( phi ) * stheta,
136
pcm * sin( phi ) * stheta, pcm * ctheta );
137
138
d->
init
(
getDaug
( 0 ), p4 );
139
140
//get 4 vector in the lab frame!
141
EvtVector4R
p4lab = d->
getP4Lab
();
142
cthetalab = p4lab.
get
( 3 ) / p4lab.
d3mag
();
143
}
while
( cthetalab >
m_cthetamax
|| cthetalab <
m_cthetamin
);
144
145
return
;
146
}
EvtConst.hh
EvtPDL.hh
EvtParticle.hh
EvtRandom.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_INFO
@ EVTGEN_INFO
Definition
EvtReport.hh:52
EVTGEN_ERROR
@ EVTGEN_ERROR
Definition
EvtReport.hh:49
EvtSingleParticle.hh
EvtConst::twoPi
static const double twoPi
Definition
EvtConst.hh:27
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::disableCheckQ
void disableCheckQ()
Definition
EvtDecayBase.hh:62
EvtDecayBase::getDaug
EvtId getDaug(int i) const
Definition
EvtDecayBase.hh:66
EvtDecayBase::getDaugs
const EvtId * getDaugs() const
Definition
EvtDecayBase.hh:65
EvtPDL::getMass
static double getMass(EvtId i)
Definition
EvtPDL.cpp:311
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::init
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle::getDaug
EvtParticle * getDaug(const int i)
Definition
EvtParticle.hh:173
EvtParticle::getP4Lab
EvtVector4R getP4Lab() const
Definition
EvtParticle.cpp:756
EvtParticle::makeDaughters
void makeDaughters(size_t ndaug, const EvtId *id)
Definition
EvtParticle.cpp:1235
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
EvtSingleParticle
Definition
EvtSingleParticle.hh:30
EvtSingleParticle::m_phimax
double m_phimax
Definition
EvtSingleParticle.hh:44
EvtSingleParticle::clone
EvtDecayBase * clone() const override
Definition
EvtSingleParticle.cpp:38
EvtSingleParticle::m_pmax
double m_pmax
Definition
EvtSingleParticle.hh:42
EvtSingleParticle::initProbMax
void initProbMax() override
Definition
EvtSingleParticle.cpp:43
EvtSingleParticle::m_phimin
double m_phimin
Definition
EvtSingleParticle.hh:44
EvtSingleParticle::init
void init() override
Definition
EvtSingleParticle.cpp:48
EvtSingleParticle::m_cthetamin
double m_cthetamin
Definition
EvtSingleParticle.hh:43
EvtSingleParticle::m_pmin
double m_pmin
Definition
EvtSingleParticle.hh:42
EvtSingleParticle::decay
void decay(EvtParticle *p) override
Definition
EvtSingleParticle.cpp:112
EvtSingleParticle::getName
std::string getName() const override
Definition
EvtSingleParticle.cpp:33
EvtSingleParticle::m_cthetamax
double m_cthetamax
Definition
EvtSingleParticle.hh:43
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:163
EvtVector4R::d3mag
double d3mag() const
Definition
EvtVector4R.cpp:192
EvtVector4R::set
void set(int i, double d)
Definition
EvtVector4R.hh:168
Generated by
1.17.0