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
EvtGenBase
EvtPhotonParticle.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 "
EvtGenBase/EvtPhotonParticle.hh
"
22
23
#include "
EvtGenBase/EvtComplex.hh
"
24
#include "
EvtGenBase/EvtReport.hh
"
25
#include "
EvtGenBase/EvtVector4C.hh
"
26
27
#include <iostream>
28
#include <math.h>
29
#include <stdlib.h>
30
using
std::endl;
31
32
void
EvtPhotonParticle::init
(
EvtId
part_n,
const
EvtVector4R
& p4 )
33
{
34
init
( part_n, p4.
get
( 0 ), p4.
get
( 1 ), p4.
get
( 2 ), p4.
get
( 3 ) );
35
}
36
37
void
EvtPhotonParticle::init
(
EvtId
part_n,
double
e,
double
px,
double
py,
38
double
pz )
39
{
40
m_validP4
=
true
;
41
setp
( e, px, py, pz );
42
setpart_num
( part_n );
43
44
setLifetime
();
45
setAttribute
(
"FSR"
, 0 );
46
}
47
48
EvtVector4C
EvtPhotonParticle::epsParentPhoton
(
int
i )
const
49
{
50
EvtVector4C
eps
;
51
52
switch
( i ) {
53
case
0:
54
eps
.set(
EvtComplex
( 0.0, 0.0 ),
55
EvtComplex
( -1.0 / sqrt( 2.0 ), 0.0 ),
56
EvtComplex
( 0.0, -1.0 / sqrt( 2.0 ) ),
57
EvtComplex
( 0.0, 0.0 ) );
58
break
;
59
case
1:
60
eps
.set(
EvtComplex
( 0.0, 0.0 ),
EvtComplex
( 1.0 / sqrt( 2.0 ), 0.0 ),
61
EvtComplex
( 0.0, -1.0 / sqrt( 2.0 ) ),
62
EvtComplex
( 0.0, 0.0 ) );
63
break
;
64
default
:
65
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
66
<<
"EvtPhotonParticle.cc: Asked "
67
<<
"for state:"
<< i << endl;
68
::abort();
69
break
;
70
}
71
// These are for photon along z axis. Rotate to get
72
// correct direction...
73
74
const
double
px = this->
getP4
().
get
( 1 );
75
const
double
py = this->
getP4
().
get
( 2 );
76
const
double
pz = this->
getP4
().
get
( 3 );
77
78
const
double
phi = atan2( py, px );
79
const
double
theta = acos( pz / sqrt( px * px + py * py + pz * pz ) );
80
eps
.applyRotateEuler( phi, theta, -phi );
81
82
return
eps
;
83
}
84
85
EvtVector4C
EvtPhotonParticle::epsPhoton
(
int
)
const
86
{
87
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
88
<<
"EvtPhotonParticle.cc: Can not get "
89
<<
"state in photons restframe."
<< endl;
90
;
91
::abort();
92
return
EvtVector4C
();
93
}
94
95
EvtSpinDensity
EvtPhotonParticle::rotateToHelicityBasis
()
const
96
{
97
const
EvtVector4C
eplus( 0.0, -1.0 / sqrt( 2.0 ),
98
EvtComplex
( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
99
const
EvtVector4C
eminus( 0.0, 1.0 / sqrt( 2.0 ),
100
EvtComplex
( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
101
102
const
EvtVector4C
e1 = this->
epsParentPhoton
( 0 );
103
const
EvtVector4C
e2 = this->
epsParentPhoton
( 1 );
104
105
EvtSpinDensity
R;
106
R.
setDim
( 2 );
107
108
R.
set
( 0, 0, ( eplus.
conj
() ) * e1 );
109
R.
set
( 0, 1, ( eplus.
conj
() ) * e2 );
110
111
R.
set
( 1, 0, ( eminus.
conj
() ) * e1 );
112
R.
set
( 1, 1, ( eminus.
conj
() ) * e2 );
113
114
return
R;
115
}
116
117
EvtSpinDensity
EvtPhotonParticle::rotateToHelicityBasis
(
double
alpha,
118
double
beta,
119
double
gamma )
const
120
{
121
EvtVector4C
eplus( 0.0, -1.0 / sqrt( 2.0 ),
122
EvtComplex
( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
123
EvtVector4C
eminus( 0.0, 1.0 / sqrt( 2.0 ),
124
EvtComplex
( 0.0, -1.0 / sqrt( 2.0 ) ), 0.0 );
125
126
eplus.
applyRotateEuler
( alpha, beta, gamma );
127
eminus.
applyRotateEuler
( alpha, beta, gamma );
128
129
const
EvtVector4C
e1 = this->
epsParentPhoton
( 0 );
130
const
EvtVector4C
e2 = this->
epsParentPhoton
( 1 );
131
132
EvtSpinDensity
R;
133
R.
setDim
( 2 );
134
135
R.
set
( 0, 0, ( eplus.
conj
() ) * e1 );
136
R.
set
( 0, 1, ( eplus.
conj
() ) * e2 );
137
138
R.
set
( 1, 0, ( eminus.
conj
() ) * e1 );
139
R.
set
( 1, 1, ( eminus.
conj
() ) * e2 );
140
141
return
R;
142
}
EvtComplex.hh
EvtPhotonParticle.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_ERROR
@ EVTGEN_ERROR
Definition
EvtReport.hh:49
EvtVector4C.hh
EvtComplex
Definition
EvtComplex.hh:29
EvtId
Definition
EvtId.hh:27
EvtParticle::setAttribute
void setAttribute(std::string attName, int attValue)
Definition
EvtParticle.hh:423
EvtParticle::setLifetime
void setLifetime()
Definition
EvtParticle.cpp:100
EvtParticle::getP4
const EvtVector4R & getP4() const
Definition
EvtParticle.cpp:144
EvtParticle::m_validP4
bool m_validP4
Definition
EvtParticle.hh:460
EvtParticle::setp
void setp(double e, double px, double py, double pz)
Definition
EvtParticle.hh:442
EvtParticle::eps
virtual EvtVector4C eps(int i) const
Definition
EvtParticle.cpp:623
EvtParticle::setpart_num
void setpart_num(EvtId particle_number)
Definition
EvtParticle.hh:454
EvtPhotonParticle::epsPhoton
EvtVector4C epsPhoton(int i) const override
Definition
EvtPhotonParticle.cpp:85
EvtPhotonParticle::rotateToHelicityBasis
EvtSpinDensity rotateToHelicityBasis() const override
Definition
EvtPhotonParticle.cpp:95
EvtPhotonParticle::init
void init(EvtId part_n, double e, double px, double py, double pz)
Definition
EvtPhotonParticle.cpp:37
EvtPhotonParticle::epsParentPhoton
EvtVector4C epsParentPhoton(int i) const override
Definition
EvtPhotonParticle.cpp:48
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
EvtVector4C
Definition
EvtVector4C.hh:30
EvtVector4C::applyRotateEuler
void applyRotateEuler(double alpha, double beta, double gamma)
Definition
EvtVector4C.cpp:128
EvtVector4C::conj
EvtVector4C conj() const
Definition
EvtVector4C.hh:204
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:163
Generated by
1.17.0