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
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
22
24#include "EvtGenBase/EvtId.hh"
25#include "EvtGenBase/EvtPDL.hh"
28
30
32
33#include <cmath>
34#include <iostream>
35
36std::string EvtPythia::getName() const
37{
38 return "PYTHIA";
39}
40
42{
43 return new EvtPythia();
44}
45
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
54{
55 noProbMax();
56}
57
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 ) {
69 }
70
71 if ( m_pythiaEngine ) {
72 m_pythiaEngine->doDecay( p );
73 }
74
75 this->fixPolarisations( p );
76}
77
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 ) {
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 );
119 }
120 }
121 }
122}
123
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
134void EvtPythia::command( std::string cmd )
135{
136 // Locally store commands in a vector
137 m_commandList.push_back( cmd );
138}
EvtDecayBase()=default
void setDaughterSpinDensity(int daughter)
static EvtExternalGenFactory & getInstance()
EvtAbsExternalGen * getGenerator(const GenId genId)
Definition EvtId.hh:27
static EvtId getId(const std::string &name)
Definition EvtPDL.cpp:283
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
EvtId getId() const
const EvtVector4R & getP4() const
EvtParticle * getDaug(const int i)
size_t getNDaug() const
void decay(EvtParticle *p) override
Definition EvtPythia.cpp:58
EvtDecayBase * clone() const override
Definition EvtPythia.cpp:41
std::string getName() const override
Definition EvtPythia.cpp:36
void command(std::string) override
EvtAbsExternalGen * m_pythiaEngine
Definition EvtPythia.hh:57
std::string commandName() override
void init() override
Definition EvtPythia.cpp:46
void fixPolarisations(EvtParticle *p)
Definition EvtPythia.cpp:78
void initProbMax() override
Definition EvtPythia.cpp:53
std::vector< std::string > m_commandList
Definition EvtPythia.hh:59
EvtPythia()=default
void setDim(int n)
void set(int i, int j, const EvtComplex &rhoij)
double get(int i) const
double d3mag() const