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
EvtFlatQ2.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/EvtFlatQ2.hh
"
22
23
#include "
EvtGenBase/EvtPDL.hh
"
24
#include "
EvtGenBase/EvtParticle.hh
"
25
#include "
EvtGenBase/EvtReport.hh
"
26
27
#include <fstream>
28
#include <string>
29
30
double
lambda
(
double
q,
double
m1,
double
m2 )
31
{
32
double
L( 1.0 );
33
double
mSum = m1 + m2;
34
double
mDiff = m1 - m2;
35
double
qSq = q * q;
36
37
if
( qSq > 0.0 ) {
38
double
prodTerm = ( qSq - mSum * mSum ) * ( qSq - mDiff * mDiff );
39
40
if
( prodTerm > 0.0 ) {
41
L = sqrt( prodTerm ) / qSq;
42
}
43
}
44
45
return
L;
46
}
47
48
std::string
EvtFlatQ2::getName
()
const
49
{
50
return
"FLATQ2"
;
51
}
52
53
EvtDecayBase
*
EvtFlatQ2::clone
()
const
54
{
55
return
new
EvtFlatQ2
;
56
}
57
58
void
EvtFlatQ2::initProbMax
()
59
{
60
setProbMax
( 100 );
61
}
62
63
void
EvtFlatQ2::init
()
64
{
65
// check that there are 3 daughters
66
checkNDaug
( 3 );
67
68
// We expect B -> X lepton lepton events
69
checkSpinParent
(
EvtSpinType::SCALAR
);
70
71
EvtSpinType::spintype
d1type =
EvtPDL::getSpinType
(
getDaug
( 1 ) );
72
EvtSpinType::spintype
d2type =
EvtPDL::getSpinType
(
getDaug
( 2 ) );
73
74
if
( !( d1type ==
EvtSpinType::DIRAC
|| d1type ==
EvtSpinType::NEUTRINO
) ) {
75
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
76
<<
"EvtFlatQ2 expects 2nd daughter to "
77
<<
"be a lepton"
<< std::endl;
78
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
79
<<
"Will terminate execution!"
<< std::endl;
80
::abort();
81
}
82
83
if
( !( d2type ==
EvtSpinType::DIRAC
|| d2type ==
EvtSpinType::NEUTRINO
) ) {
84
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
85
<<
"EvtFlatQ2 expects 3rd daughter to "
86
<<
"be a lepton"
<< std::endl;
87
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
88
<<
"Will terminate execution!"
<< std::endl;
89
::abort();
90
}
91
92
// Specify if we want to use the phase space factor
93
m_usePhsp
=
false
;
94
if
(
getNArg
() > 0 ) {
95
if
(
getArg
( 0 ) != 0 ) {
96
m_usePhsp
=
true
;
97
}
98
}
99
100
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
101
<<
"EvtFlatQ2 usePhsp = "
<< int(
m_usePhsp
) << std::endl;
102
}
103
104
void
EvtFlatQ2::decay
(
EvtParticle
* p )
105
{
106
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
() );
107
108
EvtVector4R
p4Xu = p->
getDaug
( 0 )->
getP4
();
109
110
EvtVector4R
p4ell1 = p->
getDaug
( 1 )->
getP4
();
111
EvtVector4R
p4ell2 = p->
getDaug
( 2 )->
getP4
();
112
113
double
pXu_x2 = p4Xu.
get
( 1 ) * p4Xu.
get
( 1 );
114
double
pXu_y2 = p4Xu.
get
( 2 ) * p4Xu.
get
( 2 );
115
double
pXu_z2 = p4Xu.
get
( 3 ) * p4Xu.
get
( 3 );
116
double
pXu = sqrt( pXu_x2 + pXu_y2 + pXu_z2 );
117
double
prob( 0.0 );
118
if
( fabs( pXu ) > 0.0 ) {
119
prob = 1 / pXu;
120
}
121
122
// Include the phase space factor if requested
123
if
(
m_usePhsp
) {
124
// Invariant mass of lepton pair
125
double
q = ( p4ell1 + p4ell2 ).mass();
126
// Rest masses of the leptons
127
double
m1 = p4ell1.
mass
();
128
double
m2 = p4ell2.
mass
();
129
// Phase space factor, which includes the various square roots
130
double
Lambda =
lambda
( q, m1, m2 );
131
if
( Lambda > 0.0 ) {
132
prob = prob / Lambda;
133
}
134
}
135
136
if
( pXu > 0.01 ) {
137
setProb
( prob );
138
}
139
140
return
;
141
}
lambda
double lambda(double q, double m1, double m2)
Definition
EvtFlatQ2.cpp:30
EvtFlatQ2.hh
EvtPDL.hh
EvtParticle.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
EvtDecayBase::EvtDecayBase
EvtDecayBase()=default
EvtDecayBase::getNDaug
int getNDaug() const
Definition
EvtDecayBase.hh:64
EvtDecayBase::checkSpinParent
void checkSpinParent(EvtSpinType::spintype sp)
Definition
EvtDecayBase.cpp:534
EvtDecayBase::getNArg
int getNArg() const
Definition
EvtDecayBase.hh:67
EvtDecayBase::getArg
double getArg(unsigned int j)
Definition
EvtDecayBase.cpp:578
EvtDecayBase::setProbMax
void setProbMax(double prbmx)
Definition
EvtDecayBase.cpp:295
EvtDecayBase::getDaug
EvtId getDaug(int i) const
Definition
EvtDecayBase.hh:66
EvtDecayBase::checkNDaug
void checkNDaug(int d1, int d2=-1)
Definition
EvtDecayBase.cpp:516
EvtDecayBase::getDaugs
const EvtId * getDaugs() const
Definition
EvtDecayBase.hh:65
EvtDecayProb::setProb
void setProb(double prob)
Definition
EvtDecayProb.hh:32
EvtFlatQ2
Definition
EvtFlatQ2.hh:30
EvtFlatQ2::initProbMax
void initProbMax() override
Definition
EvtFlatQ2.cpp:58
EvtFlatQ2::getName
std::string getName() const override
Definition
EvtFlatQ2.cpp:48
EvtFlatQ2::init
void init() override
Definition
EvtFlatQ2.cpp:63
EvtFlatQ2::clone
EvtDecayBase * clone() const override
Definition
EvtFlatQ2.cpp:53
EvtFlatQ2::m_usePhsp
bool m_usePhsp
Definition
EvtFlatQ2.hh:41
EvtFlatQ2::decay
void decay(EvtParticle *p) override
Definition
EvtFlatQ2.cpp:104
EvtPDL::getSpinType
static EvtSpinType::spintype getSpinType(EvtId i)
Definition
EvtPDL.cpp:371
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::getP4
const EvtVector4R & getP4() const
Definition
EvtParticle.cpp:144
EvtParticle::getDaug
EvtParticle * getDaug(const int i)
Definition
EvtParticle.hh:173
EvtSpinType::spintype
spintype
Definition
EvtSpinType.hh:29
EvtSpinType::NEUTRINO
@ NEUTRINO
Definition
EvtSpinType.hh:35
EvtSpinType::SCALAR
@ SCALAR
Definition
EvtSpinType.hh:30
EvtSpinType::DIRAC
@ DIRAC
Definition
EvtSpinType.hh:33
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::mass
double mass() const
Definition
EvtVector4R.cpp:48
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:163
Generated by
1.16.1