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
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
22
26
27#include <iostream>
28#include <math.h>
29#include <stdlib.h>
30using std::endl;
31
32void 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
37void 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
45 setAttribute( "FSR", 0 );
46}
47
49{
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
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
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
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
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
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}
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_ERROR
Definition EvtReport.hh:49
Definition EvtId.hh:27
void setAttribute(std::string attName, int attValue)
void setLifetime()
const EvtVector4R & getP4() const
void setp(double e, double px, double py, double pz)
virtual EvtVector4C eps(int i) const
void setpart_num(EvtId particle_number)
EvtVector4C epsPhoton(int i) const override
EvtSpinDensity rotateToHelicityBasis() const override
void init(EvtId part_n, double e, double px, double py, double pz)
EvtVector4C epsParentPhoton(int i) const override
void setDim(int n)
void set(int i, int j, const EvtComplex &rhoij)
void applyRotateEuler(double alpha, double beta, double gamma)
EvtVector4C conj() const
double get(int i) const