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
EvtHelAmp.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/EvtHelAmp.hh
"
22
23
#include "
EvtGenBase/EvtConst.hh
"
24
#include "
EvtGenBase/EvtEvalHelAmp.hh
"
25
#include "
EvtGenBase/EvtGenKine.hh
"
26
#include "
EvtGenBase/EvtId.hh
"
27
#include "
EvtGenBase/EvtPDL.hh
"
28
#include "
EvtGenBase/EvtParticle.hh
"
29
#include "
EvtGenBase/EvtReport.hh
"
30
31
#include <string>
32
#include <vector>
33
using
std::endl;
34
35
std::string
EvtHelAmp::getName
()
const
36
{
37
return
"HELAMP"
;
38
}
39
40
EvtDecayBase
*
EvtHelAmp::clone
()
const
41
{
42
return
new
EvtHelAmp
;
43
}
44
45
void
EvtHelAmp::init
()
46
{
47
checkNDaug
( 2 );
48
49
//find out how many states each particle have
50
int
_nA =
EvtSpinType::getSpinStates
(
EvtPDL::getSpinType
(
getParentId
() ) );
51
int
_nB =
EvtSpinType::getSpinStates
(
EvtPDL::getSpinType
(
getDaug
( 0 ) ) );
52
int
_nC =
EvtSpinType::getSpinStates
(
EvtPDL::getSpinType
(
getDaug
( 1 ) ) );
53
54
if
(
verbose
() ) {
55
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
56
<<
"_nA,_nB,_nC:"
<< _nA <<
","
<< _nB <<
","
<< _nC << endl;
57
}
58
59
//find out what 2 times the spin is
60
int
_JA2 =
EvtSpinType::getSpin2
(
EvtPDL::getSpinType
(
getParentId
() ) );
61
int
_JB2 =
EvtSpinType::getSpin2
(
EvtPDL::getSpinType
(
getDaug
( 0 ) ) );
62
int
_JC2 =
EvtSpinType::getSpin2
(
EvtPDL::getSpinType
(
getDaug
( 1 ) ) );
63
64
if
(
verbose
() ) {
65
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
66
<<
"_JA2,_JB2,_JC2:"
<< _JA2 <<
","
<< _JB2 <<
","
<< _JC2 << endl;
67
}
68
69
//allocate memory
70
std::vector<int> _lambdaA2( _nA );
71
std::vector<int> _lambdaB2( _nB );
72
std::vector<int> _lambdaC2( _nC );
73
74
EvtComplexPtr
* _HBC =
new
EvtComplexPtr
[_nB];
75
for
(
int
ib = 0; ib < _nB; ib++ ) {
76
_HBC[ib] =
new
EvtComplex
[_nC];
77
}
78
79
int
i;
80
//find the allowed helicities (actually 2*times the helicity!)
81
82
fillHelicity
( _lambdaA2.data(), _nA, _JA2,
getParentId
() );
83
fillHelicity
( _lambdaB2.data(), _nB, _JB2,
getDaug
( 0 ) );
84
fillHelicity
( _lambdaC2.data(), _nC, _JC2,
getDaug
( 1 ) );
85
86
if
(
verbose
() ) {
87
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
88
<<
"Helicity states of particle A:"
<< endl;
89
for
( i = 0; i < _nA; i++ ) {
90
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) << _lambdaA2[i] << endl;
91
}
92
93
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
94
<<
"Helicity states of particle B:"
<< endl;
95
for
( i = 0; i < _nB; i++ ) {
96
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) << _lambdaB2[i] << endl;
97
}
98
99
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
100
<<
"Helicity states of particle C:"
<< endl;
101
for
( i = 0; i < _nC; i++ ) {
102
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
) << _lambdaC2[i] << endl;
103
}
104
}
105
106
//now read in the helicity amplitudes
107
108
int
argcounter = 0;
109
110
for
(
int
ib = 0; ib < _nB; ib++ ) {
111
for
(
int
ic = 0; ic < _nC; ic++ ) {
112
_HBC[ib][ic] = 0.0;
113
if
(
abs
( _lambdaB2[ib] - _lambdaC2[ic] ) <= _JA2 )
114
argcounter += 2;
115
}
116
}
117
118
checkNArg
( argcounter );
119
120
argcounter = 0;
121
122
for
(
int
ib = 0; ib < _nB; ib++ ) {
123
for
(
int
ic = 0; ic < _nC; ic++ ) {
124
if
(
abs
( _lambdaB2[ib] - _lambdaC2[ic] ) <= _JA2 ) {
125
_HBC[ib][ic] =
getArg
( argcounter ) *
126
exp
(
EvtComplex
( 0.0,
getArg
( argcounter + 1 ) ) );
127
;
128
argcounter += 2;
129
if
(
verbose
() ) {
130
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
131
<<
"_HBC["
<< ib <<
"]["
<< ic <<
"]="
<< _HBC[ib][ic]
132
<< endl;
133
}
134
}
135
}
136
}
137
138
m_evalHelAmp
= std::make_unique<EvtEvalHelAmp>(
getParentId
(),
getDaug
( 0 ),
139
getDaug
( 1 ), _HBC );
140
141
// Note: these are not class data members but local variables.
142
for
(
int
ib = 0; ib < _nB; ib++ ) {
143
delete
[] _HBC[ib];
144
}
145
delete
[] _HBC;
// _HBC is copied in ctor of EvtEvalHelAmp above.
146
}
147
148
void
EvtHelAmp::initProbMax
()
149
{
150
double
maxprob =
m_evalHelAmp
->probMax();
151
152
if
(
verbose
() ) {
153
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
154
<<
"Calculated probmax"
<< maxprob << endl;
155
}
156
157
setProbMax
( maxprob );
158
}
159
160
void
EvtHelAmp::decay
(
EvtParticle
* p )
161
{
162
//first generate simple phase space
163
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
() );
164
165
m_evalHelAmp
->evalAmp( p,
m_amp2
);
166
}
167
168
void
EvtHelAmp::fillHelicity
(
int
* lambda2,
int
n,
int
J2,
EvtId
id
)
169
{
170
int
i;
171
172
//photon is special case!
173
if
( n == 2 && J2 == 2 ) {
174
lambda2[0] = 2;
175
lambda2[1] = -2;
176
return
;
177
}
178
179
//and so is the neutrino!
180
if
( n == 1 && J2 == 1 ) {
181
if
(
EvtPDL::getStdHep
(
id
) > 0 ) {
182
//particle i.e. lefthanded
183
lambda2[0] = -1;
184
}
else
{
185
//anti particle i.e. righthanded
186
lambda2[0] = 1;
187
}
188
return
;
189
}
190
191
assert( n == J2 + 1 );
192
193
for
( i = 0; i < n; i++ ) {
194
lambda2[i] = n - i * 2 - 1;
195
}
196
197
return
;
198
}
exp
EvtComplex exp(const EvtComplex &c)
Definition
EvtComplex.hh:242
EvtComplexPtr
EvtComplex * EvtComplexPtr
Definition
EvtComplex.hh:78
abs
double abs(const EvtComplex &c)
Definition
EvtComplex.hh:203
EvtConst.hh
EvtEvalHelAmp.hh
EvtGenKine.hh
EvtHelAmp.hh
EvtId.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
EvtComplex
Definition
EvtComplex.hh:29
EvtDecayAmp::m_amp2
EvtAmp m_amp2
Definition
EvtDecayAmp.hh:73
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::setProbMax
void setProbMax(double prbmx)
Definition
EvtDecayBase.cpp:295
EvtDecayBase::getParentId
EvtId getParentId() const
Definition
EvtDecayBase.hh:60
EvtDecayBase::verbose
bool verbose() const
Definition
EvtDecayBase.hh:81
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::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
EvtHelAmp
Definition
EvtHelAmp.hh:35
EvtHelAmp::decay
void decay(EvtParticle *p) override
Definition
EvtHelAmp.cpp:160
EvtHelAmp::m_evalHelAmp
std::unique_ptr< EvtEvalHelAmp > m_evalHelAmp
Definition
EvtHelAmp.hh:48
EvtHelAmp::initProbMax
void initProbMax() override
Definition
EvtHelAmp.cpp:148
EvtHelAmp::fillHelicity
void fillHelicity(int *lambda2, int n, int J2, EvtId id)
Definition
EvtHelAmp.cpp:168
EvtHelAmp::init
void init() override
Definition
EvtHelAmp.cpp:45
EvtHelAmp::getName
std::string getName() const override
Definition
EvtHelAmp.cpp:35
EvtHelAmp::clone
EvtDecayBase * clone() const override
Definition
EvtHelAmp.cpp:40
EvtId
Definition
EvtId.hh:27
EvtPDL::getSpinType
static EvtSpinType::spintype getSpinType(EvtId i)
Definition
EvtPDL.cpp:371
EvtPDL::getStdHep
static int getStdHep(EvtId id)
Definition
EvtPDL.cpp:356
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
EvtSpinType::getSpin2
static int getSpin2(spintype stype)
Definition
EvtSpinType.cpp:25
EvtSpinType::getSpinStates
static int getSpinStates(spintype stype)
Definition
EvtSpinType.cpp:56
Generated by
1.17.0