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
EvtIncoherentMixing.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/EvtIncoherentMixing.hh
"
22
23
#include "
EvtGenBase/EvtId.hh
"
24
#include "
EvtGenBase/EvtPDL.hh
"
25
#include "
EvtGenBase/EvtRandom.hh
"
26
27
#include <stdlib.h>
28
29
//-----------------------------------------------------------------------------
30
// Implementation file for class : EvtIncoherentMixing
31
//
32
// 2003-10-09 : Patrick Robbe
33
//-----------------------------------------------------------------------------
34
35
bool
EvtIncoherentMixing::m_doB0Mixing
=
false
;
36
bool
EvtIncoherentMixing::m_doBsMixing
=
false
;
37
bool
EvtIncoherentMixing::m_enableFlip
=
false
;
38
double
EvtIncoherentMixing::m_dGammad
= 0.;
39
double
EvtIncoherentMixing::m_deltamd
= 0.502e12;
40
// dGamma_s corresponds to DeltaGamma / Gamma = 10 %
41
double
EvtIncoherentMixing::m_dGammas
= 6.852e10;
42
double
EvtIncoherentMixing::m_deltams
= 20.e12;
43
44
//=============================================================================
45
// Standard constructor, initializes variables
46
//=============================================================================
47
EvtIncoherentMixing::EvtIncoherentMixing
()
48
{
49
m_doB0Mixing
=
false
;
50
m_doBsMixing
=
false
;
51
m_dGammad
= 0.;
52
// dGammas corresponds to DeltaGamma / Gamma = 10 %
53
m_dGammas
= 6.852e10;
54
m_deltamd
= 0.502e12;
55
m_deltams
= 20.e12;
56
m_enableFlip
=
false
;
57
}
58
//=============================================================================
59
void
EvtIncoherentMixing::incoherentB0Mix
(
const
EvtId
id
,
double
& t,
int
& mix )
60
{
61
static
const
EvtId
B0 =
EvtPDL::getId
(
"B0"
);
62
static
const
EvtId
B0B =
EvtPDL::getId
(
"anti-B0"
);
63
64
if
( ( B0 !=
id
) && ( B0B !=
id
) ) {
65
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
66
<<
"Bad configuration in incoherentB0Mix"
<< std::endl;
67
::abort();
68
}
69
70
double
x =
getdeltamd
() *
EvtPDL::getctau
( B0 ) /
EvtConst::c
;
71
72
double
y =
getdGammad
() * (
EvtPDL::getctau
( B0 ) /
EvtConst::c
) / 2.;
73
74
double
fac = 1.;
// No CP violation
75
76
double
mixprob = ( x * x + y * y ) /
77
( x * x + y * y + ( 1. / fac ) * ( 2. + x * x - y * y ) );
78
79
int
mixsign;
80
81
// decide if state is mixed
82
mixsign = ( mixprob >
EvtRandom::Flat
( 0., 1. ) ) ? -1 : 1;
83
84
double
prob;
85
86
do
{
87
t = -log(
EvtRandom::Flat
() ) *
EvtPDL::getctau
( B0 ) / ( 1. - y );
88
prob = ( 1. +
exp
( -2. * y * t /
EvtPDL::getctau
( B0 ) ) +
89
mixsign * 2. *
exp
( -y * t /
EvtPDL::getctau
( B0 ) ) *
90
cos(
getdeltamd
() * t /
EvtConst::c
) ) /
91
2.;
92
}
while
( prob < 2. *
EvtRandom::Flat
() );
93
94
mix = 0;
95
if
( mixsign == -1 )
96
mix = 1;
97
98
return
;
99
}
100
// ============================================================================
101
void
EvtIncoherentMixing::incoherentBsMix
(
const
EvtId
id
,
double
& t,
int
& mix )
102
{
103
static
const
EvtId
BS =
EvtPDL::getId
(
"B_s0"
);
104
static
const
EvtId
BSB =
EvtPDL::getId
(
"anti-B_s0"
);
105
106
if
( ( BS !=
id
) && ( BSB !=
id
) ) {
107
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
108
<<
"Bad configuration in incoherentBsMix"
<< std::endl;
109
::abort();
110
}
111
112
double
x =
getdeltams
() *
EvtPDL::getctau
( BS ) /
EvtConst::c
;
113
114
double
y =
getdGammas
() * (
EvtPDL::getctau
( BS ) /
EvtConst::c
) / 2.;
115
116
double
fac = 1.;
// No CP violation
117
118
double
mixprob = ( x * x + y * y ) /
119
( x * x + y * y + ( 1. / fac ) * ( 2. + x * x - y * y ) );
120
121
int
mixsign;
122
123
// decide if state is mixed
124
mixsign = ( mixprob >
EvtRandom::Flat
( 0., 1. ) ) ? -1 : 1;
125
126
double
prob;
127
128
do
{
129
t = -log(
EvtRandom::Flat
() ) *
EvtPDL::getctau
( BS ) / ( 1. - y );
130
prob = ( 1. +
exp
( -2. * y * t /
EvtPDL::getctau
( BS ) ) +
131
mixsign * 2. *
exp
( -y * t /
EvtPDL::getctau
( BS ) ) *
132
cos(
getdeltams
() * t /
EvtConst::c
) ) /
133
2.;
134
}
while
( prob < 2. *
EvtRandom::Flat
() );
135
136
mix = 0;
137
if
( mixsign == -1 )
138
mix = 1;
139
140
return
;
141
}
142
143
// ========================================================================
144
bool
EvtIncoherentMixing::isBsMixed
(
EvtParticle
* p )
145
{
146
if
( !( p->
getParent
() ) )
147
return
false
;
148
149
static
const
EvtId
BS0 =
EvtPDL::getId
(
"B_s0"
);
150
static
const
EvtId
BSB =
EvtPDL::getId
(
"anti-B_s0"
);
151
152
if
( ( p->
getId
() != BS0 ) && ( p->
getId
() != BSB ) )
153
return
false
;
154
155
if
( ( p->
getParent
()->
getId
() == BS0 ) || ( p->
getParent
()->
getId
() == BSB ) )
156
return
true
;
157
158
return
false
;
159
}
160
161
// ========================================================================
162
bool
EvtIncoherentMixing::isB0Mixed
(
EvtParticle
* p )
163
{
164
if
( !( p->
getParent
() ) )
165
return
false
;
166
167
static
const
EvtId
B0 =
EvtPDL::getId
(
"B0"
);
168
static
const
EvtId
B0B =
EvtPDL::getId
(
"anti-B0"
);
169
170
if
( ( p->
getId
() != B0 ) && ( p->
getId
() != B0B ) )
171
return
false
;
172
173
if
( ( p->
getParent
()->
getId
() == B0 ) || ( p->
getParent
()->
getId
() == B0B ) )
174
return
true
;
175
176
return
false
;
177
}
178
//============================================================================
179
// Return the tag of the event (ie the anti-flavour of the produced
180
// B meson). Flip the flavour of the event with probB probability
181
//============================================================================
182
void
EvtIncoherentMixing::OtherB
(
EvtParticle
* p,
double
& t,
EvtId
& otherb,
183
double
probB )
184
{
185
//if(p->getId() == B0 || p->getId() == B0B)
186
//added by liming Zhang
187
enableFlip
();
188
if
( (
isB0Mixed
( p ) ) || (
isBsMixed
( p ) ) ) {
189
p->
getParent
()->
setLifetime
();
190
t = p->
getParent
()->
getLifetime
();
191
}
else
{
192
p->
setLifetime
();
193
t = p->
getLifetime
();
194
}
195
196
if
(
flipIsEnabled
() ) {
197
//std::cout << " liming << flipIsEnabled " << std::endl;
198
// Flip the flavour of the particle with probability probB
199
bool
isFlipped = (
EvtRandom::Flat
( 0., 1. ) < probB );
200
201
if
( isFlipped ) {
202
if
( (
isB0Mixed
( p ) ) || (
isBsMixed
( p ) ) ) {
203
p->
getParent
()->
setId
(
204
EvtPDL::chargeConj
( p->
getParent
()->
getId
() ) );
205
p->
setId
(
EvtPDL::chargeConj
( p->
getId
() ) );
206
}
else
{
207
p->
setId
(
EvtPDL::chargeConj
( p->
getId
() ) );
208
}
209
}
210
}
211
212
if
( (
isB0Mixed
( p ) ) || (
isBsMixed
( p ) ) ) {
213
// if B has mixed, tag flavour is charge conjugate of parent of B-meson
214
otherb =
EvtPDL::chargeConj
( p->
getParent
()->
getId
() );
215
}
else
{
216
// else it is opposite flavour than this B hadron
217
otherb =
EvtPDL::chargeConj
( p->
getId
() );
218
}
219
220
return
;
221
}
222
//============================================================================
223
// Return the tag of the event (ie the anti-flavour of the produced
224
// B meson). No flip
225
//============================================================================
226
void
EvtIncoherentMixing::OtherB
(
EvtParticle
* p,
double
& t,
EvtId
& otherb )
227
{
228
if
( (
isB0Mixed
( p ) ) || (
isBsMixed
( p ) ) ) {
229
p->
getParent
()->
setLifetime
();
230
t = p->
getParent
()->
getLifetime
();
231
}
else
{
232
p->
setLifetime
();
233
t = p->
getLifetime
();
234
}
235
236
if
( (
isB0Mixed
( p ) ) || (
isBsMixed
( p ) ) ) {
237
// if B has mixed, tag flavour is charge conjugate of parent of B-meson
238
otherb =
EvtPDL::chargeConj
( p->
getParent
()->
getId
() );
239
}
else
{
240
// else it is opposite flavour than this B hadron
241
otherb =
EvtPDL::chargeConj
( p->
getId
() );
242
}
243
244
return
;
245
}
246
247
// activate or desactivate the Bs mixing
248
void
EvtIncoherentMixing::setB0Mixing
()
249
{
250
m_doB0Mixing
=
true
;
251
}
252
void
EvtIncoherentMixing::unsetB0Mixing
()
253
{
254
m_doB0Mixing
=
false
;
255
}
256
257
// activate or desactivate the B0 mixing
258
void
EvtIncoherentMixing::setBsMixing
()
259
{
260
m_doBsMixing
=
true
;
261
}
262
void
EvtIncoherentMixing::unsetBsMixing
()
263
{
264
m_doBsMixing
=
false
;
265
}
266
267
// is mixing activated ?
268
bool
EvtIncoherentMixing::doB0Mixing
()
269
{
270
return
m_doB0Mixing
;
271
}
272
bool
EvtIncoherentMixing::doBsMixing
()
273
{
274
return
m_doBsMixing
;
275
}
276
277
// set values for the mixing
278
void
EvtIncoherentMixing::setdGammad
(
double
value )
279
{
280
m_dGammad
= value;
281
}
282
void
EvtIncoherentMixing::setdeltamd
(
double
value )
283
{
284
m_deltamd
= value;
285
}
286
void
EvtIncoherentMixing::setdGammas
(
double
value )
287
{
288
m_dGammas
= value;
289
}
290
void
EvtIncoherentMixing::setdeltams
(
double
value )
291
{
292
m_deltams
= value;
293
}
294
295
// get parameters for mixing
296
double
EvtIncoherentMixing::getdGammad
()
297
{
298
return
m_dGammad
;
299
}
300
double
EvtIncoherentMixing::getdeltamd
()
301
{
302
return
m_deltamd
;
303
}
304
double
EvtIncoherentMixing::getdGammas
()
305
{
306
return
m_dGammas
;
307
}
308
double
EvtIncoherentMixing::getdeltams
()
309
{
310
return
m_deltams
;
311
}
312
313
bool
EvtIncoherentMixing::flipIsEnabled
()
314
{
315
return
m_enableFlip
;
316
}
317
void
EvtIncoherentMixing::enableFlip
()
318
{
319
m_enableFlip
=
true
;
320
}
321
void
EvtIncoherentMixing::disableFlip
()
322
{
323
m_enableFlip
=
false
;
324
}
exp
EvtComplex exp(const EvtComplex &c)
Definition
EvtComplex.hh:242
EvtId.hh
EvtIncoherentMixing.hh
EvtPDL.hh
EvtRandom.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_ERROR
@ EVTGEN_ERROR
Definition
EvtReport.hh:49
EvtConst::c
static const double c
Definition
EvtConst.hh:30
EvtId
Definition
EvtId.hh:27
EvtIncoherentMixing::m_enableFlip
static bool m_enableFlip
Definition
EvtIncoherentMixing.hh:92
EvtIncoherentMixing::disableFlip
static void disableFlip()
Definition
EvtIncoherentMixing.cpp:321
EvtIncoherentMixing::m_doB0Mixing
static bool m_doB0Mixing
Definition
EvtIncoherentMixing.hh:86
EvtIncoherentMixing::m_doBsMixing
static bool m_doBsMixing
Definition
EvtIncoherentMixing.hh:87
EvtIncoherentMixing::setdeltams
static void setdeltams(double value)
Definition
EvtIncoherentMixing.cpp:290
EvtIncoherentMixing::setdGammad
static void setdGammad(double value)
Definition
EvtIncoherentMixing.cpp:278
EvtIncoherentMixing::getdeltamd
static double getdeltamd()
Definition
EvtIncoherentMixing.cpp:300
EvtIncoherentMixing::getdGammas
static double getdGammas()
Definition
EvtIncoherentMixing.cpp:304
EvtIncoherentMixing::isB0Mixed
static bool isB0Mixed(EvtParticle *)
Definition
EvtIncoherentMixing.cpp:162
EvtIncoherentMixing::doB0Mixing
static bool doB0Mixing()
Definition
EvtIncoherentMixing.cpp:268
EvtIncoherentMixing::m_dGammad
static double m_dGammad
Definition
EvtIncoherentMixing.hh:88
EvtIncoherentMixing::unsetBsMixing
static void unsetBsMixing()
Definition
EvtIncoherentMixing.cpp:262
EvtIncoherentMixing::setdGammas
static void setdGammas(double value)
Definition
EvtIncoherentMixing.cpp:286
EvtIncoherentMixing::getdeltams
static double getdeltams()
Definition
EvtIncoherentMixing.cpp:308
EvtIncoherentMixing::setdeltamd
static void setdeltamd(double value)
Definition
EvtIncoherentMixing.cpp:282
EvtIncoherentMixing::getdGammad
static double getdGammad()
Definition
EvtIncoherentMixing.cpp:296
EvtIncoherentMixing::isBsMixed
static bool isBsMixed(EvtParticle *)
Definition
EvtIncoherentMixing.cpp:144
EvtIncoherentMixing::flipIsEnabled
static bool flipIsEnabled()
Definition
EvtIncoherentMixing.cpp:313
EvtIncoherentMixing::setBsMixing
static void setBsMixing()
Definition
EvtIncoherentMixing.cpp:258
EvtIncoherentMixing::m_dGammas
static double m_dGammas
Definition
EvtIncoherentMixing.hh:90
EvtIncoherentMixing::m_deltams
static double m_deltams
Definition
EvtIncoherentMixing.hh:91
EvtIncoherentMixing::OtherB
static void OtherB(EvtParticle *p, double &t, EvtId &otherb, double probB)
Definition
EvtIncoherentMixing.cpp:182
EvtIncoherentMixing::setB0Mixing
static void setB0Mixing()
Definition
EvtIncoherentMixing.cpp:248
EvtIncoherentMixing::incoherentBsMix
static void incoherentBsMix(const EvtId id, double &t, int &mix)
Definition
EvtIncoherentMixing.cpp:101
EvtIncoherentMixing::m_deltamd
static double m_deltamd
Definition
EvtIncoherentMixing.hh:89
EvtIncoherentMixing::doBsMixing
static bool doBsMixing()
Definition
EvtIncoherentMixing.cpp:272
EvtIncoherentMixing::unsetB0Mixing
static void unsetB0Mixing()
Definition
EvtIncoherentMixing.cpp:252
EvtIncoherentMixing::EvtIncoherentMixing
EvtIncoherentMixing()
Standard constructor.
Definition
EvtIncoherentMixing.cpp:47
EvtIncoherentMixing::incoherentB0Mix
static void incoherentB0Mix(const EvtId id, double &t, int &mix)
Definition
EvtIncoherentMixing.cpp:59
EvtIncoherentMixing::enableFlip
static void enableFlip()
Definition
EvtIncoherentMixing.cpp:317
EvtPDL::chargeConj
static EvtId chargeConj(EvtId id)
Definition
EvtPDL.cpp:201
EvtPDL::getctau
static double getctau(EvtId i)
Definition
EvtPDL.cpp:351
EvtPDL::getId
static EvtId getId(const std::string &name)
Definition
EvtPDL.cpp:283
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::getId
EvtId getId() const
Definition
EvtParticle.cpp:124
EvtParticle::setLifetime
void setLifetime(double tau)
Definition
EvtParticle.cpp:95
EvtParticle::getLifetime
double getLifetime() const
Definition
EvtParticle.cpp:107
EvtParticle::setId
void setId(EvtId id)
Definition
EvtParticle.hh:389
EvtParticle::getParent
EvtParticle * getParent() const
Definition
EvtParticle.cpp:90
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
Generated by
1.17.0