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
EvtGenExternal
EvtPythia.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 "
EvtGenExternal/EvtPythia.hh
"
22
23
#include "
EvtGenBase/EvtDecayBase.hh
"
24
#include "
EvtGenBase/EvtId.hh
"
25
#include "
EvtGenBase/EvtPDL.hh
"
26
#include "
EvtGenBase/EvtParticle.hh
"
27
#include "
EvtGenBase/EvtSpinDensity.hh
"
28
29
#include "
EvtGenModels/EvtAbsExternalGen.hh
"
30
31
#include "
EvtGenExternal/EvtExternalGenFactory.hh
"
32
33
#include <cmath>
34
#include <iostream>
35
36
std::string
EvtPythia::getName
()
const
37
{
38
return
"PYTHIA"
;
39
}
40
41
EvtDecayBase
*
EvtPythia::clone
()
const
42
{
43
return
new
EvtPythia
();
44
}
45
46
void
EvtPythia::init
()
47
{
48
// Do not check for any arguments. The PythiaEngine will check
49
// to see if there is an integer specifying the decay physics,
50
// otherwise it just uses phase-space.
51
}
52
53
void
EvtPythia::initProbMax
()
54
{
55
noProbMax
();
56
}
57
58
void
EvtPythia::decay
(
EvtParticle
* p )
59
{
60
// We have to initialise the Pythia engine after the decay.dec files have been read in,
61
// since we will be modifying Pythia data tables, and that is only possible once we have
62
// defined all Pythia-type decays we want to use.
63
// We check to see if the engine has been created before doing the decay.
64
// This should only create the full Pythia engine once, and all clones will point to the same engine.
65
66
if
( !
m_pythiaEngine
) {
67
m_pythiaEngine
=
EvtExternalGenFactory::getInstance
().
getGenerator
(
68
EvtExternalGenFactory::GenId::PythiaGenId
);
69
}
70
71
if
(
m_pythiaEngine
) {
72
m_pythiaEngine
->doDecay( p );
73
}
74
75
this->
fixPolarisations
( p );
76
}
77
78
void
EvtPythia::fixPolarisations
(
EvtParticle
* p )
79
{
80
// Special case to handle the J/psi polarisation
81
82
if
( !p ) {
83
return
;
84
}
85
86
int
nDaug = p->
getNDaug
();
87
int
i( 0 );
88
89
static
const
EvtId
Jpsi =
EvtPDL::getId
(
"J/psi"
);
90
91
for
( i = 0; i < nDaug; i++ ) {
92
EvtParticle
* theDaug = p->
getDaug
( i );
93
94
if
( theDaug ) {
95
if
( theDaug->
getId
() == Jpsi ) {
96
EvtSpinDensity
rho;
97
98
rho.
setDim
( 3 );
99
rho.
set
( 0, 0, 0.5 );
100
rho.
set
( 0, 1, 0.0 );
101
rho.
set
( 0, 2, 0.0 );
102
103
rho.
set
( 1, 0, 0.0 );
104
rho.
set
( 1, 1, 1.0 );
105
rho.
set
( 1, 2, 0.0 );
106
107
rho.
set
( 2, 0, 0.0 );
108
rho.
set
( 2, 1, 0.0 );
109
rho.
set
( 2, 2, 0.5 );
110
111
EvtVector4R
p4Psi = theDaug->
getP4
();
112
113
double
alpha = atan2( p4Psi.
get
( 2 ), p4Psi.
get
( 1 ) );
114
double
beta = acos( p4Psi.
get
( 3 ) / p4Psi.
d3mag
() );
115
116
theDaug->
setSpinDensityForwardHelicityBasis
( rho, alpha, beta,
117
0.0 );
118
setDaughterSpinDensity
( i );
119
}
120
}
121
}
122
}
123
124
std::string
EvtPythia::commandName
()
125
{
126
// Allow backward compatibility for decay.dec files
127
// having JetSetPar parameters. They are obsolete for Pythia 8,
128
// since the JetSet-type array variables do not exist.
129
// Need to think about including user defined parameters in
130
// EvtPythiaEngine::updatePhysicsParameters().
131
return
std::string(
"JetSetPar"
);
132
}
133
134
void
EvtPythia::command
( std::string cmd )
135
{
136
// Locally store commands in a vector
137
m_commandList
.push_back( cmd );
138
}
EvtAbsExternalGen.hh
EvtDecayBase.hh
EvtExternalGenFactory.hh
EvtId.hh
EvtPDL.hh
EvtParticle.hh
EvtPythia.hh
EvtSpinDensity.hh
EvtDecayBase::EvtDecayBase
EvtDecayBase()=default
EvtDecayBase::noProbMax
void noProbMax()
Definition
EvtDecayBase.cpp:301
EvtDecayIncoherent::setDaughterSpinDensity
void setDaughterSpinDensity(int daughter)
Definition
EvtDecayIncoherent.hh:37
EvtExternalGenFactory::getInstance
static EvtExternalGenFactory & getInstance()
Definition
EvtExternalGenFactory.cpp:36
EvtExternalGenFactory::getGenerator
EvtAbsExternalGen * getGenerator(const GenId genId)
Definition
EvtExternalGenFactory.cpp:89
EvtExternalGenFactory::GenId::PythiaGenId
@ PythiaGenId
Definition
EvtExternalGenFactory.hh:36
EvtId
Definition
EvtId.hh:27
EvtPDL::getId
static EvtId getId(const std::string &name)
Definition
EvtPDL.cpp:283
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::setSpinDensityForwardHelicityBasis
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
Definition
EvtParticle.cpp:190
EvtParticle::getId
EvtId getId() const
Definition
EvtParticle.cpp:124
EvtParticle::getP4
const EvtVector4R & getP4() const
Definition
EvtParticle.cpp:144
EvtParticle::getDaug
EvtParticle * getDaug(const int i)
Definition
EvtParticle.hh:173
EvtParticle::getNDaug
size_t getNDaug() const
Definition
EvtParticle.cpp:154
EvtPythia::decay
void decay(EvtParticle *p) override
Definition
EvtPythia.cpp:58
EvtPythia::clone
EvtDecayBase * clone() const override
Definition
EvtPythia.cpp:41
EvtPythia::getName
std::string getName() const override
Definition
EvtPythia.cpp:36
EvtPythia::command
void command(std::string) override
Definition
EvtPythia.cpp:134
EvtPythia::m_pythiaEngine
EvtAbsExternalGen * m_pythiaEngine
Definition
EvtPythia.hh:57
EvtPythia::commandName
std::string commandName() override
Definition
EvtPythia.cpp:124
EvtPythia::init
void init() override
Definition
EvtPythia.cpp:46
EvtPythia::fixPolarisations
void fixPolarisations(EvtParticle *p)
Definition
EvtPythia.cpp:78
EvtPythia::initProbMax
void initProbMax() override
Definition
EvtPythia.cpp:53
EvtPythia::m_commandList
std::vector< std::string > m_commandList
Definition
EvtPythia.hh:59
EvtPythia::EvtPythia
EvtPythia()=default
EvtSpinDensity
Definition
EvtSpinDensity.hh:28
EvtSpinDensity::setDim
void setDim(int n)
Definition
EvtSpinDensity.cpp:79
EvtSpinDensity::set
void set(int i, int j, const EvtComplex &rhoij)
Definition
EvtSpinDensity.cpp:106
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
Generated by
1.16.1