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
EvtDiracParticle.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
25#include "EvtGenBase/EvtPDL.hh"
29
30#include <iostream>
31#include <math.h>
32#include <stdlib.h>
33using std::endl;
34
35void EvtDiracParticle::init( EvtId part_n, const EvtVector4R& p4 )
36{
37 m_validP4 = true;
38 setp( p4 );
39 setpart_num( part_n );
40
41 if ( EvtPDL::getStdHep( part_n ) == 0 ) {
42 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
43 << "Error in EvtDiracParticle::init, part_n=" << part_n.getId()
44 << endl;
45 ::abort();
46 }
47
48 if ( EvtPDL::getStdHep( part_n ) > 0 ) {
49 m_spinorRest[0].set( EvtComplex( sqrt( 2.0 * mass() ), 0.0 ),
50 EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ),
51 EvtComplex( 0.0, 0.0 ) );
52 m_spinorRest[1].set( EvtComplex( 0.0, 0.0 ),
53 EvtComplex( sqrt( 2.0 * mass() ), 0.0 ),
54 EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ) );
55
56 m_spinorParent[0] = boostTo( m_spinorRest[0], p4 );
57 m_spinorParent[1] = boostTo( m_spinorRest[1], p4 );
58
59 } else {
60 m_spinorRest[0].set( EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ),
61 EvtComplex( sqrt( 2.0 * mass() ), 0.0 ),
62 EvtComplex( 0.0, 0.0 ) );
63 m_spinorRest[1].set( EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ),
64 EvtComplex( 0.0, 0.0 ),
65 EvtComplex( sqrt( 2.0 * mass() ), 0.0 ) );
66
67 m_spinorParent[0] = boostTo( m_spinorRest[0], p4 );
68 m_spinorParent[1] = boostTo( m_spinorRest[1], p4 );
69 }
70
72}
73
75 const EvtDiracSpinor& prod1,
76 const EvtDiracSpinor& prod2,
77 const EvtDiracSpinor& rest1,
78 const EvtDiracSpinor& rest2 )
79{
80 m_validP4 = true;
81 setp( p4 );
82 setpart_num( part_n );
83
84 if ( EvtPDL::getStdHep( part_n ) == 0 ) {
85 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
86 << "Error in EvtDiracParticle::init, part_n=" << part_n.getId()
87 << std::endl;
88 ::abort();
89 }
90 m_spinorRest[0] = rest1;
91 m_spinorRest[1] = rest2;
92 m_spinorParent[0] = prod1;
93 m_spinorParent[1] = prod2;
94
96}
97
99{
100 EvtDiracSpinor spplus;
101 EvtDiracSpinor spminus;
102
103 double sqmt2 = sqrt( 2. * ( getP4().mass() ) );
104
105 if ( EvtPDL::getStdHep( getId() ) > 0 ) {
106 spplus.set( 1.0, 0.0, 0.0, 0.0 );
107 spminus.set( 0.0, 1.0, 0.0, 0.0 );
108 } else {
109 spplus.set( 0.0, 0.0, 1.0, 0.0 );
110 spminus.set( 0.0, 0.0, 0.0, 1.0 );
111 }
112
114 R.setDim( 2 );
115
116 for ( int i = 0; i < 2; i++ ) {
117 R.set( 0, i, ( spplus * m_spinorRest[i] ) / sqmt2 );
118 R.set( 1, i, ( spminus * m_spinorRest[i] ) / sqmt2 );
119 }
120
121 return R;
122}
123
125 double gamma ) const
126{
127 EvtDiracSpinor spplus;
128 EvtDiracSpinor spminus;
129
130 double sqmt2 = sqrt( 2. * ( getP4().mass() ) );
131
132 if ( EvtPDL::getStdHep( getId() ) > 0 ) {
133 spplus.set( 1.0, 0.0, 0.0, 0.0 );
134 spminus.set( 0.0, 1.0, 0.0, 0.0 );
135 } else {
136 spplus.set( 0.0, 0.0, 1.0, 0.0 );
137 spminus.set( 0.0, 0.0, 0.0, 1.0 );
138 }
139
140 spplus.applyRotateEuler( alpha, beta, gamma );
141 spminus.applyRotateEuler( alpha, beta, gamma );
142
144 R.setDim( 2 );
145
146 for ( int i = 0; i < 2; i++ ) {
147 R.set( 0, i, ( spplus * m_spinorRest[i] ) / sqmt2 );
148 R.set( 1, i, ( spminus * m_spinorRest[i] ) / sqmt2 );
149 }
150
151 return R;
152}
EvtRaritaSchwinger boostTo(const EvtRaritaSchwinger &rs, const EvtVector4R p4)
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_ERROR
Definition EvtReport.hh:49
EvtSpinDensity rotateToHelicityBasis() const override
void init(EvtId part_n, const EvtVector4R &p4) override
EvtDiracSpinor m_spinorParent[2]
EvtDiracSpinor m_spinorRest[2]
void set(const EvtComplex &sp0, const EvtComplex &sp1, const EvtComplex &sp2, const EvtComplex &sp3)
void applyRotateEuler(double alpha, double beta, double gamma)
Definition EvtId.hh:27
int getId() const
Definition EvtId.hh:41
static int getStdHep(EvtId id)
Definition EvtPDL.cpp:356
EvtId getId() const
void setLifetime()
const EvtVector4R & getP4() const
void setp(double e, double px, double py, double pz)
double mass() const
void setpart_num(EvtId particle_number)
void setDim(int n)
void set(int i, int j, const EvtComplex &rhoij)