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
EvtHelAmp.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#include "EvtGenBase/EvtId.hh"
27#include "EvtGenBase/EvtPDL.hh"
30
31#include <string>
32#include <vector>
33using std::endl;
34
35std::string EvtHelAmp::getName() const
36{
37 return "HELAMP";
38}
39
41{
42 return new EvtHelAmp;
43}
44
46{
47 checkNDaug( 2 );
48
49 //find out how many states each particle have
53
54 if ( verbose() ) {
55 EvtGenReport( EVTGEN_INFO, "EvtGen" )
56 << "_nA,_nB,_nC:" << _nA << "," << _nB << "," << _nC << endl;
57 }
58
59 //find out what 2 times the spin is
63
64 if ( verbose() ) {
65 EvtGenReport( EVTGEN_INFO, "EvtGen" )
66 << "_JA2,_JB2,_JC2:" << _JA2 << "," << _JB2 << "," << _JC2 << endl;
67 }
68
69 //allocate memory
70 std::vector<int> _lambdaA2( _nA );
71 std::vector<int> _lambdaB2( _nB );
72 std::vector<int> _lambdaC2( _nC );
73
74 EvtComplexPtr* _HBC = new EvtComplexPtr[_nB];
75 for ( int ib = 0; ib < _nB; ib++ ) {
76 _HBC[ib] = new EvtComplex[_nC];
77 }
78
79 int i;
80 //find the allowed helicities (actually 2*times the helicity!)
81
82 fillHelicity( _lambdaA2.data(), _nA, _JA2, getParentId() );
83 fillHelicity( _lambdaB2.data(), _nB, _JB2, getDaug( 0 ) );
84 fillHelicity( _lambdaC2.data(), _nC, _JC2, getDaug( 1 ) );
85
86 if ( verbose() ) {
87 EvtGenReport( EVTGEN_INFO, "EvtGen" )
88 << "Helicity states of particle A:" << endl;
89 for ( i = 0; i < _nA; i++ ) {
90 EvtGenReport( EVTGEN_INFO, "EvtGen" ) << _lambdaA2[i] << endl;
91 }
92
93 EvtGenReport( EVTGEN_INFO, "EvtGen" )
94 << "Helicity states of particle B:" << endl;
95 for ( i = 0; i < _nB; i++ ) {
96 EvtGenReport( EVTGEN_INFO, "EvtGen" ) << _lambdaB2[i] << endl;
97 }
98
99 EvtGenReport( EVTGEN_INFO, "EvtGen" )
100 << "Helicity states of particle C:" << endl;
101 for ( i = 0; i < _nC; i++ ) {
102 EvtGenReport( EVTGEN_INFO, "EvtGen" ) << _lambdaC2[i] << endl;
103 }
104 }
105
106 //now read in the helicity amplitudes
107
108 int argcounter = 0;
109
110 for ( int ib = 0; ib < _nB; ib++ ) {
111 for ( int ic = 0; ic < _nC; ic++ ) {
112 _HBC[ib][ic] = 0.0;
113 if ( abs( _lambdaB2[ib] - _lambdaC2[ic] ) <= _JA2 )
114 argcounter += 2;
115 }
116 }
117
118 checkNArg( argcounter );
119
120 argcounter = 0;
121
122 for ( int ib = 0; ib < _nB; ib++ ) {
123 for ( int ic = 0; ic < _nC; ic++ ) {
124 if ( abs( _lambdaB2[ib] - _lambdaC2[ic] ) <= _JA2 ) {
125 _HBC[ib][ic] = getArg( argcounter ) *
126 exp( EvtComplex( 0.0, getArg( argcounter + 1 ) ) );
127 ;
128 argcounter += 2;
129 if ( verbose() ) {
130 EvtGenReport( EVTGEN_INFO, "EvtGen" )
131 << "_HBC[" << ib << "][" << ic << "]=" << _HBC[ib][ic]
132 << endl;
133 }
134 }
135 }
136 }
137
138 m_evalHelAmp = std::make_unique<EvtEvalHelAmp>( getParentId(), getDaug( 0 ),
139 getDaug( 1 ), _HBC );
140
141 // Note: these are not class data members but local variables.
142 for ( int ib = 0; ib < _nB; ib++ ) {
143 delete[] _HBC[ib];
144 }
145 delete[] _HBC; // _HBC is copied in ctor of EvtEvalHelAmp above.
146}
147
149{
150 double maxprob = m_evalHelAmp->probMax();
151
152 if ( verbose() ) {
153 EvtGenReport( EVTGEN_INFO, "EvtGen" )
154 << "Calculated probmax" << maxprob << endl;
155 }
156
157 setProbMax( maxprob );
158}
159
161{
162 //first generate simple phase space
164
165 m_evalHelAmp->evalAmp( p, m_amp2 );
166}
167
168void EvtHelAmp::fillHelicity( int* lambda2, int n, int J2, EvtId id )
169{
170 int i;
171
172 //photon is special case!
173 if ( n == 2 && J2 == 2 ) {
174 lambda2[0] = 2;
175 lambda2[1] = -2;
176 return;
177 }
178
179 //and so is the neutrino!
180 if ( n == 1 && J2 == 1 ) {
181 if ( EvtPDL::getStdHep( id ) > 0 ) {
182 //particle i.e. lefthanded
183 lambda2[0] = -1;
184 } else {
185 //anti particle i.e. righthanded
186 lambda2[0] = 1;
187 }
188 return;
189 }
190
191 assert( n == J2 + 1 );
192
193 for ( i = 0; i < n; i++ ) {
194 lambda2[i] = n - i * 2 - 1;
195 }
196
197 return;
198}
EvtComplex exp(const EvtComplex &c)
EvtComplex * EvtComplexPtr
Definition EvtComplex.hh:78
double abs(const EvtComplex &c)
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_INFO
Definition EvtReport.hh:52
EvtAmp m_amp2
EvtDecayBase()=default
int getNDaug() const
double getArg(unsigned int j)
void setProbMax(double prbmx)
EvtId getParentId() const
bool verbose() const
EvtId getDaug(int i) const
void checkNDaug(int d1, int d2=-1)
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
const EvtId * getDaugs() const
void decay(EvtParticle *p) override
std::unique_ptr< EvtEvalHelAmp > m_evalHelAmp
Definition EvtHelAmp.hh:48
void initProbMax() override
void fillHelicity(int *lambda2, int n, int J2, EvtId id)
void init() override
Definition EvtHelAmp.cpp:45
std::string getName() const override
Definition EvtHelAmp.cpp:35
EvtDecayBase * clone() const override
Definition EvtHelAmp.cpp:40
Definition EvtId.hh:27
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.cpp:371
static int getStdHep(EvtId id)
Definition EvtPDL.cpp:356
double initializePhaseSpace(size_t numdaughter, const EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
static int getSpin2(spintype stype)
static int getSpinStates(spintype stype)