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
EvtRelBreitWignerBarrierFact.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/EvtRelBreitWignerBarrierFact.hh
"
22
23
#include "
EvtGenBase/EvtAmpPdf.hh
"
24
#include "
EvtGenBase/EvtIntervalFlatPdf.hh
"
25
#include "
EvtGenBase/EvtMassAmp.hh
"
26
#include "
EvtGenBase/EvtPDL.hh
"
27
#include "
EvtGenBase/EvtPredGen.hh
"
28
#include "
EvtGenBase/EvtPropBreitWignerRel.hh
"
29
#include "
EvtGenBase/EvtSpinType.hh
"
30
#include "
EvtGenBase/EvtTwoBodyVertex.hh
"
31
32
#include <algorithm>
33
34
EvtRelBreitWignerBarrierFact::EvtRelBreitWignerBarrierFact
(
35
double
mass,
double
width,
double
maxRange,
EvtSpinType::spintype
sp ) :
36
EvtAbsLineShape
( mass, width, maxRange, sp )
37
{
// double mDaug1, double mDaug2, int l) {
38
39
m_includeDecayFact
=
true
;
40
m_includeBirthFact
=
true
;
41
m_mass
= mass;
42
m_width
= width;
43
m_spin
= sp;
44
m_blattDecay
= 3.0;
45
m_blattBirth
= 1.0;
46
m_maxRange
= maxRange;
47
m_errorCond
=
false
;
48
49
double
maxdelta = 15.0 * width;
50
51
if
( maxRange > 0.00001 ) {
52
m_massMax
= mass + maxdelta;
53
m_massMin
= mass - maxRange;
54
}
else
{
55
m_massMax
= mass + maxdelta;
56
m_massMin
= mass - 15.0 * width;
57
}
58
59
m_massMax
= mass + maxdelta;
60
if
(
m_massMin
< 0. ) {
61
if
(
m_width
> 0.0001 ) {
62
m_massMin
= 0.00011;
63
}
else
{
64
m_massMin
= 0.;
65
}
66
}
67
}
68
69
EvtRelBreitWignerBarrierFact::EvtRelBreitWignerBarrierFact
(
70
const
EvtRelBreitWignerBarrierFact
& x ) :
71
EvtAbsLineShape
( x )
72
{
73
m_massMax
= x.
m_massMax
;
74
m_massMin
= x.
m_massMin
;
75
m_blattDecay
= x.
m_blattDecay
;
76
m_blattBirth
= x.
m_blattBirth
;
77
m_maxRange
= x.
m_maxRange
;
78
m_includeDecayFact
= x.
m_includeDecayFact
;
79
m_includeBirthFact
= x.
m_includeBirthFact
;
80
m_errorCond
= x.
m_errorCond
;
81
}
82
83
EvtRelBreitWignerBarrierFact
&
EvtRelBreitWignerBarrierFact::operator=
(
84
const
EvtRelBreitWignerBarrierFact
& x )
85
{
86
m_mass
= x.
m_mass
;
87
m_width
= x.
m_width
;
88
m_spin
= x.
m_spin
;
89
m_massMax
= x.
m_massMax
;
90
m_massMin
= x.
m_massMin
;
91
m_blattDecay
= x.
m_blattDecay
;
92
m_blattBirth
= x.
m_blattBirth
;
93
m_maxRange
= x.
m_maxRange
;
94
m_includeDecayFact
= x.
m_includeDecayFact
;
95
m_includeBirthFact
= x.
m_includeBirthFact
;
96
m_errorCond
= x.
m_errorCond
;
97
98
return
*
this
;
99
}
100
101
EvtAbsLineShape
*
EvtRelBreitWignerBarrierFact::clone
()
102
{
103
return
new
EvtRelBreitWignerBarrierFact
( *
this
);
104
}
105
106
double
EvtRelBreitWignerBarrierFact::getMassProb
(
double
mass,
double
massPar,
107
int
nDaug,
double
* massDau )
108
{
109
m_errorCond
=
false
;
110
//return EvtAbsLineShape::getMassProb(mass,massPar,nDaug,massDau);
111
if
( nDaug != 2 )
112
return
EvtAbsLineShape::getMassProb
( mass, massPar, nDaug, massDau );
113
114
double
dTotMass = 0.;
115
116
int
i;
117
for
( i = 0; i < nDaug; i++ ) {
118
dTotMass += massDau[i];
119
}
120
//EvtGenReport(EVTGEN_INFO,"EvtGen") << mass << " " << massPar << " " << dTotMass << " "<< endl;
121
// if ( (mass-dTotMass)<0.0001 ) return 0.;
122
//EvtGenReport(EVTGEN_INFO,"EvtGen") << mass << " " << dTotMass << endl;
123
if
( ( mass < dTotMass ) )
124
return
0.;
125
126
if
(
m_width
< 0.0001 )
127
return
1.;
128
129
if
( massPar > 0.0000000001 ) {
130
if
( mass > massPar )
131
return
0.;
132
}
133
134
if
(
m_errorCond
)
135
return
0.;
136
137
// we did all the work in getRandMass
138
return
1.;
139
}
140
141
double
EvtRelBreitWignerBarrierFact::getRandMass
(
EvtId
* parId,
int
nDaug,
142
EvtId
* dauId,
EvtId
* othDaugId,
143
double
maxMass,
144
double
* dauMasses )
145
{
146
if
( nDaug != 2 )
147
return
EvtAbsLineShape::getRandMass
( parId, nDaug, dauId, othDaugId,
148
maxMass, dauMasses );
149
150
if
(
m_width
< 0.00001 )
151
return
m_mass
;
152
153
//first figure out L - take the lowest allowed.
154
155
EvtSpinType::spintype
spinD1 =
EvtPDL::getSpinType
( dauId[0] );
156
EvtSpinType::spintype
spinD2 =
EvtPDL::getSpinType
( dauId[1] );
157
158
int
t1 =
EvtSpinType::getSpin2
( spinD1 );
159
int
t2 =
EvtSpinType::getSpin2
( spinD2 );
160
int
t3 =
EvtSpinType::getSpin2
(
m_spin
);
161
162
int
Lmin = -10;
163
164
// the user has overridden the partial wave to use.
165
for
(
unsigned
int
vC = 0; vC <
m_userSetPW
.size(); vC++ ) {
166
if
( dauId[0] ==
m_userSetPWD1
[vC] && dauId[1] ==
m_userSetPWD2
[vC] ) {
167
Lmin = 2 *
m_userSetPW
[vC];
168
}
169
if
( dauId[0] ==
m_userSetPWD2
[vC] && dauId[1] ==
m_userSetPWD1
[vC] ) {
170
Lmin = 2 *
m_userSetPW
[vC];
171
}
172
}
173
174
// allow for special cases.
175
if
( Lmin < -1 ) {
176
//There are some things I don't know how to deal with
177
if
( t3 > 4 )
178
return
EvtAbsLineShape::getRandMass
( parId, nDaug, dauId, othDaugId,
179
maxMass, dauMasses );
180
if
( t1 > 4 )
181
return
EvtAbsLineShape::getRandMass
( parId, nDaug, dauId, othDaugId,
182
maxMass, dauMasses );
183
if
( t2 > 4 )
184
return
EvtAbsLineShape::getRandMass
( parId, nDaug, dauId, othDaugId,
185
maxMass, dauMasses );
186
187
//figure the min and max allowwed "spins" for the daughters state
188
Lmin = std::max( t3 - t2 - t1, std::max( t2 - t3 - t1, t1 - t3 - t2 ) );
189
if
( Lmin < 0 )
190
Lmin = 0;
191
assert( Lmin == 0 || Lmin == 2 || Lmin == 4 );
192
}
193
194
//double massD1=EvtPDL::getMeanMass(dauId[0]);
195
//double massD2=EvtPDL::getMeanMass(dauId[1]);
196
double
massD1 = dauMasses[0];
197
double
massD2 = dauMasses[1];
198
199
// I'm not sure how to define the vertex factor here - so retreat to nonRel code.
200
if
( ( massD1 + massD2 ) >
m_mass
)
201
return
EvtAbsLineShape::getRandMass
( parId, nDaug, dauId, othDaugId,
202
maxMass, dauMasses );
203
204
//parent vertex factor not yet implemented
205
double
massOthD = -10.;
206
double
massParent = -10.;
207
int
birthl = -10;
208
if
( othDaugId ) {
209
EvtSpinType::spintype
spinOth =
EvtPDL::getSpinType
( *othDaugId );
210
EvtSpinType::spintype
spinPar =
EvtPDL::getSpinType
( *parId );
211
212
int
tt1 =
EvtSpinType::getSpin2
( spinOth );
213
int
tt2 =
EvtSpinType::getSpin2
( spinPar );
214
int
tt3 =
EvtSpinType::getSpin2
(
m_spin
);
215
216
//figure the min and max allowwed "spins" for the daughters state
217
if
( ( tt1 <= 4 ) && ( tt2 <= 4 ) ) {
218
birthl = std::max( tt3 - tt2 - tt1,
219
std::max( tt2 - tt3 - tt1, tt1 - tt3 - tt2 ) );
220
if
( birthl < 0 )
221
birthl = 0;
222
223
massOthD =
EvtPDL::getMeanMass
( *othDaugId );
224
massParent =
EvtPDL::getMeanMass
( *parId );
225
}
226
227
// allow user to override
228
for
(
size_t
vC = 0; vC <
m_userSetBirthPW
.size(); vC++ ) {
229
if
( *othDaugId ==
m_userSetBirthOthD
[vC] &&
230
*parId ==
m_userSetBirthPar
[vC] ) {
231
birthl = 2 *
m_userSetBirthPW
[vC];
232
}
233
}
234
}
235
double
massM =
m_massMax
;
236
if
( ( maxMass > -0.5 ) && ( maxMass < massM ) )
237
massM = maxMass;
238
239
//special case... if the parent mass is _fixed_ we can do a little better
240
//and only for a two body decay as that seems to be where we have problems
241
242
// Define relativistic propagator amplitude
243
244
EvtTwoBodyVertex
vd( massD1, massD2,
m_mass
, Lmin / 2 );
245
vd.
set_f
(
m_blattDecay
);
246
EvtPropBreitWignerRel
bw(
m_mass
,
m_width
);
247
EvtMassAmp
amp( bw, vd );
248
249
if
(
m_includeDecayFact
) {
250
amp.
addDeathFact
();
251
amp.
addDeathFactFF
();
252
}
253
if
( massParent > -1. ) {
254
if
(
m_includeBirthFact
) {
255
EvtTwoBodyVertex
vb(
m_mass
, massOthD, massParent, birthl / 2 );
256
vb.
set_f
(
m_blattBirth
);
257
amp.
setBirthVtx
( vb );
258
amp.
addBirthFact
();
259
amp.
addBirthFactFF
();
260
}
261
}
262
263
EvtAmpPdf<EvtPoint1D>
pdf( amp );
264
265
// Estimate maximum and create predicate for accept reject
266
267
double
tempMaxLoc =
m_mass
;
268
if
( maxMass > -0.5 && maxMass <
m_mass
)
269
tempMaxLoc = maxMass;
270
double
tempMax =
m_massMax
;
271
if
( maxMass > -0.5 && maxMass <
m_massMax
)
272
tempMax = maxMass;
273
double
tempMinMass =
m_massMin
;
274
if
( massD1 + massD2 >
m_massMin
)
275
tempMinMass = massD1 + massD2;
276
277
//redo sanity check - is there a solution to our problem.
278
//if not return an error condition that is caught by the
279
//mass prob calculation above.
280
if
( tempMinMass > tempMax ) {
281
m_errorCond
=
true
;
282
return
tempMinMass;
283
}
284
285
if
( tempMaxLoc < tempMinMass )
286
tempMaxLoc = tempMinMass;
287
288
double
safetyFactor = 1.2;
289
290
EvtPdfMax<EvtPoint1D>
max(
291
safetyFactor *
292
pdf.
evaluate
(
EvtPoint1D
( tempMinMass, tempMax, tempMaxLoc ) ) );
293
294
EvtPdfPred<EvtPoint1D>
pred( pdf );
295
pred.
setMax
( max );
296
297
EvtIntervalFlatPdf
flat( tempMinMass, tempMax );
298
EvtPdfGen<EvtPoint1D>
gen( flat );
299
EvtPredGen<EvtPdfGen<EvtPoint1D>
,
EvtPdfPred<EvtPoint1D>
> predgen( gen, pred );
300
301
EvtPoint1D
point = predgen();
302
return
point.
value
();
303
}
EvtAmpPdf.hh
EvtIntervalFlatPdf.hh
EvtMassAmp.hh
EvtPDL.hh
EvtPredGen.hh
EvtPropBreitWignerRel.hh
EvtRelBreitWignerBarrierFact.hh
EvtSpinType.hh
EvtTwoBodyVertex.hh
EvtAbsLineShape::m_userSetBirthPW
std::vector< int > m_userSetBirthPW
Definition
EvtAbsLineShape.hh:92
EvtAbsLineShape::m_massMax
double m_massMax
Definition
EvtAbsLineShape.hh:79
EvtAbsLineShape::m_userSetBirthPar
std::vector< EvtId > m_userSetBirthPar
Definition
EvtAbsLineShape.hh:91
EvtAbsLineShape::m_includeBirthFact
bool m_includeBirthFact
Definition
EvtAbsLineShape.hh:76
EvtAbsLineShape::m_userSetPWD2
std::vector< EvtId > m_userSetPWD2
Definition
EvtAbsLineShape.hh:87
EvtAbsLineShape::getMassProb
virtual double getMassProb(double mass, double massPar, int nDaug, double *massDau)
Definition
EvtAbsLineShape.cpp:141
EvtAbsLineShape::EvtAbsLineShape
EvtAbsLineShape()=default
EvtAbsLineShape::m_userSetBirthOthD
std::vector< EvtId > m_userSetBirthOthD
Definition
EvtAbsLineShape.hh:91
EvtAbsLineShape::m_massMin
double m_massMin
Definition
EvtAbsLineShape.hh:78
EvtAbsLineShape::m_includeDecayFact
bool m_includeDecayFact
Definition
EvtAbsLineShape.hh:75
EvtAbsLineShape::getRandMass
virtual double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
Definition
EvtAbsLineShape.cpp:109
EvtAbsLineShape::m_spin
EvtSpinType::spintype m_spin
Definition
EvtAbsLineShape.hh:94
EvtAbsLineShape::m_userSetPW
std::vector< int > m_userSetPW
Definition
EvtAbsLineShape.hh:88
EvtAbsLineShape::m_width
double m_width
Definition
EvtAbsLineShape.hh:80
EvtAbsLineShape::m_mass
double m_mass
Definition
EvtAbsLineShape.hh:77
EvtAbsLineShape::m_userSetPWD1
std::vector< EvtId > m_userSetPWD1
Definition
EvtAbsLineShape.hh:87
EvtAbsLineShape::m_maxRange
double m_maxRange
Definition
EvtAbsLineShape.hh:81
EvtAmpPdf
Definition
EvtAmpPdf.hh:30
EvtId
Definition
EvtId.hh:27
EvtIntervalFlatPdf
Definition
EvtIntervalFlatPdf.hh:33
EvtMassAmp
Definition
EvtMassAmp.hh:34
EvtMassAmp::addDeathFactFF
void addDeathFactFF()
Definition
EvtMassAmp.hh:55
EvtMassAmp::setBirthVtx
void setBirthVtx(const EvtTwoBodyVertex &vb)
Definition
EvtMassAmp.hh:47
EvtMassAmp::addBirthFactFF
void addBirthFactFF()
Definition
EvtMassAmp.hh:54
EvtMassAmp::addBirthFact
void addBirthFact()
Definition
EvtMassAmp.hh:52
EvtMassAmp::addDeathFact
void addDeathFact()
Definition
EvtMassAmp.hh:53
EvtPDL::getSpinType
static EvtSpinType::spintype getSpinType(EvtId i)
Definition
EvtPDL.cpp:371
EvtPDL::getMeanMass
static double getMeanMass(EvtId i)
Definition
EvtPDL.cpp:306
EvtPdfGen
Definition
EvtPdf.hh:143
EvtPdfMax
Definition
EvtPdfMax.hh:31
EvtPdfPred
Definition
EvtPdf.hh:162
EvtPdfPred::setMax
void setMax(const EvtPdfMax< T > &max)
Definition
EvtPdf.hh:185
EvtPdf::evaluate
double evaluate(const T &p) const
Definition
EvtPdf.hh:79
EvtPoint1D
Definition
EvtPoint1D.hh:27
EvtPoint1D::value
double value() const
Definition
EvtPoint1D.hh:35
EvtPredGen
Definition
EvtPredGen.hh:33
EvtPropBreitWignerRel
Definition
EvtPropBreitWignerRel.hh:29
EvtRelBreitWignerBarrierFact::m_blattBirth
double m_blattBirth
Definition
EvtRelBreitWignerBarrierFact.hh:50
EvtRelBreitWignerBarrierFact::getMassProb
double getMassProb(double mass, double massPar, int nDaug, double *massDau) override
Definition
EvtRelBreitWignerBarrierFact.cpp:106
EvtRelBreitWignerBarrierFact::operator=
EvtRelBreitWignerBarrierFact & operator=(const EvtRelBreitWignerBarrierFact &x)
Definition
EvtRelBreitWignerBarrierFact.cpp:83
EvtRelBreitWignerBarrierFact::getRandMass
double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses) override
Definition
EvtRelBreitWignerBarrierFact.cpp:141
EvtRelBreitWignerBarrierFact::m_blattDecay
double m_blattDecay
Definition
EvtRelBreitWignerBarrierFact.hh:49
EvtRelBreitWignerBarrierFact::clone
EvtAbsLineShape * clone() override
Definition
EvtRelBreitWignerBarrierFact.cpp:101
EvtRelBreitWignerBarrierFact::EvtRelBreitWignerBarrierFact
EvtRelBreitWignerBarrierFact()=default
EvtRelBreitWignerBarrierFact::m_errorCond
bool m_errorCond
Definition
EvtRelBreitWignerBarrierFact.hh:51
EvtSpinType::getSpin2
static int getSpin2(spintype stype)
Definition
EvtSpinType.cpp:25
EvtSpinType::spintype
spintype
Definition
EvtSpinType.hh:29
EvtTwoBodyVertex
Definition
EvtTwoBodyVertex.hh:32
EvtTwoBodyVertex::set_f
void set_f(double R)
Definition
EvtTwoBodyVertex.cpp:66
Generated by
1.17.0