44 static thread_local EvtCPUtil* theCPUtil =
nullptr;
57 double beta,
double& fract )
65 double ratio = 1 / ( 1 + 0.65 * 0.65 );
69 rf =
EvtComplex( cos( 2.0 * beta ), sin( 2.0 * beta ) ) * Abarf / Af;
73 double Abar2 =
real( Abarf ) *
real( Abarf ) +
imag( Abarf ) *
imag( Abarf );
76 double rbarf2 =
real( rbarf ) *
real( rbarf ) +
imag( rbarf ) *
imag( rbarf );
78 fract = ( Abar2 * ( 1 + rbarf2 + ( 1 - rbarf2 ) * ratio ) ) /
79 ( Abar2 * ( 1 + rbarf2 + ( 1 - rbarf2 ) * ratio ) +
80 A2 * ( 1 + rf2 + ( 1 - rf2 ) * ratio ) );
85 EvtComplex Abarfbar,
double deltam,
double beta,
86 int flip,
double& fract )
99 double gamma_B = deltam / xd;
100 double IAf, IAfbar, IAbarf, IAbarfbar;
102 double rf2, rfbar2, rbarf2, rbarfbar2;
103 double Af2, Afbar2, Abarf2, Abarfbar2;
105 rf =
EvtComplex( cos( 2.0 * beta ), sin( 2.0 * beta ) ) * Abarf / Af;
106 rfbar =
EvtComplex( cos( 2.0 * beta ), sin( 2.0 * beta ) ) * Abarfbar / Afbar;
107 rbarf =
EvtComplex( cos( -2.0 * beta ), sin( -2.0 * beta ) ) * Af / Abarf;
108 rbarfbar =
EvtComplex( cos( -2.0 * beta ), sin( -2.0 * beta ) ) * Afbar /
114 rbarfbar2 =
real( rbarfbar ) *
real( rbarfbar ) +
115 imag( rbarfbar ) *
imag( rbarfbar );
120 Abarfbar2 =
real( Abarfbar ) *
real( Abarfbar ) +
121 imag( Abarfbar ) *
imag( Abarfbar );
127 IAf = ( Af2 / ( 2 * gamma_B ) ) * ( 1 + rf2 + ( 1 - rf2 ) / ( 1 + xd * xd ) );
128 IAfbar = ( Afbar2 / ( 2 * gamma_B ) ) *
129 ( 1 + rfbar2 + ( 1 - rfbar2 ) / ( 1 + xd * xd ) );
130 IAbarf = ( Abarf2 / ( 2 * gamma_B ) ) *
131 ( 1 + rbarf2 + ( 1 - rbarf2 ) / ( 1 + xd * xd ) );
132 IAbarfbar = ( Abarfbar2 / ( 2 * gamma_B ) ) *
133 ( 1 + rbarfbar2 + ( 1 - rbarfbar2 ) / ( 1 + xd * xd ) );
137 fract = IAbarf / ( IAbarf + IAf ) + flip * IAbarfbar / ( IAfbar + IAbarfbar );
156 static thread_local int entryCount = 0;
179 bool incoherentmix =
false;
181 if ( ( parent !=
nullptr ) &&
182 ( parent->
getId() == B0 || parent->
getId() == B0B ||
183 parent->
getId() == BS || parent->
getId() == BSB ) ) {
184 incoherentmix =
true;
190 if ( parent ==
nullptr || parent->
getId() != UPS4S ) {
195 if ( parent !=
nullptr ) {
200 assert( parent == 0 );
203 bool needToChargeConj =
false;
204 if ( p->
getId() == B0B && isB0 )
205 needToChargeConj =
true;
206 if ( p->
getId() == B0 && !isB0 )
207 needToChargeConj =
true;
208 if ( p->
getId() == BSB && isB0 )
209 needToChargeConj =
true;
210 if ( p->
getId() == BS && !isB0 )
211 needToChargeConj =
true;
213 if ( needToChargeConj ) {
215 if ( incoherentmix ) {
225 if ( parent->
getDaug( 0 ) != p ) {
234 if ( parent !=
nullptr ) {
241 if ( other->getId().isAlias() ) {
247 if ( entryCount == 1 ) {
250 bool decayed = other->isDecayed();
258 scalar_part->
init( B0, p_init );
260 scalar_part->
init( B0B, p_init );
264 other->setDiagonalSpinDensity();
274 otherb = other->getId();
276 other->setLifetime();
279 otherb = other->getId();
283 <<
"We have an error here!!!!" << endl;
284 otherb =
EvtId( -1, -1 );
300 if ( ( p->
getId() != BS0 ) && ( p->
getId() != BSB ) )
318 if ( ( p->
getId() != B0 ) && ( p->
getId() != B0B ) )
382 if ( p->
getId() == BS0 || p->
getId() == BSB ) {
385 static const double ctau = ctauL < ctauH ? ctauH : ctauL;
388 if ( parent !=
nullptr &&
389 ( parent->
getId() == BS0 || parent->
getId() == BSB ) ) {
390 if ( parent->
getId() == BS0 )
392 if ( parent->
getId() == BSB )
397 if ( p->
getId() == BS0 )
399 if ( p->
getId() == BSB )
405 if ( p->
getId() == D0 || p->
getId() == D0B ) {
408 static const double ctau = ctauL < ctauH ? ctauH : ctauL;
411 if ( parent !=
nullptr &&
412 ( parent->
getId() == D0 || parent->
getId() == D0B ) ) {
413 if ( parent->
getId() == D0 )
415 if ( parent->
getId() == D0B )
420 if ( p->
getId() == D0 )
422 if ( p->
getId() == D0B )
434 if ( parent ==
nullptr || parent->
getId() != UPS4 ) {
438 if ( p->
getId() == B0 )
440 if ( p->
getId() == B0B )
442 if ( p->
getId() == BS0 )
444 if ( p->
getId() == BSB )
448 if ( parent->
getDaug( 0 ) != p ) {
466 stdHepNum =
abs( stdHepNum );
471 std::string hname = partName + std::string(
"H" );
472 std::string lname = partName + std::string(
"L" );
481 const double ctau = 2.0 * ( ctauL * ctauH ) / ( ctauL + ctauH );
486 const double y = ( ctauH - ctauL ) / ( ctauH + ctauL );
490 std::string qoverpParmName = std::string(
"qoverp_incohMix_" ) + partName;
491 std::string mdParmName = std::string(
"dm_incohMix_" ) + partName;
498 if (
id == partId ) {
499 fac = 1.0 / ( qoverp * qoverp );
501 fac = qoverp * qoverp;
504 double mixprob = ( x * x + y * y ) /
505 ( x * x + y * y + fac * ( 2.0 + x * x - y * y ) );
514 const double ctaulong = ctauL <= ctauH ? ctauH : ctauL;
519 prob = 1.0 +
exp( -2.0 * fabs( y ) * t / ctau ) +
520 mixsign * 2.0 *
exp( -fabs( y ) * t / ctau ) * cos( x * t / ctau );
534 stdHepNum =
abs( stdHepNum );
538 std::string hname = partName + std::string(
"H" );
539 std::string lname = partName + std::string(
"L" );
547 double dGamma = ( 1 / ctauL - 1 / ctauH ) *
EvtConst::c;
554 stdHepNum =
abs( stdHepNum );
558 std::string parmName = std::string(
"dm_incohMix_" ) + partName;
double imag(const EvtComplex &c)
double real(const EvtComplex &c)
EvtComplex exp(const EvtComplex &c)
double abs(const EvtComplex &c)
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
bool isBsMixed(EvtParticle *)
void OtherIncoherentB(EvtParticle *p, double &t, EvtId &otherb, double probB0)
static EvtCPUtil * getInstance()
void OtherCoherentB(EvtParticle *p, double &t, EvtId &otherb, double probB0)
void fractB0nonCP(EvtComplex Af, EvtComplex Abarf, EvtComplex Afbar, EvtComplex Abarfbar, double deltam, double beta, int flip, double &fract)
double getDeltaM(const EvtId id)
bool isB0Mixed(EvtParticle *)
EvtCPUtil(int mixingType)
void fractB0CP(EvtComplex Af, EvtComplex Abarf, double deltam, double beta, double &fract)
void incoherentMix(const EvtId id, double &t, int &mix)
double getDeltaGamma(const EvtId id)
void OtherB(EvtParticle *p, double &t, EvtId &otherb)
static int getStdHep(EvtId id)
static EvtId evtIdFromStdHep(int stdhep)
static std::string name(EvtId i)
static EvtId chargeConj(EvtId id)
static double getctau(EvtId i)
static EvtId getId(const std::string &name)
void insertDaugPtr(int idaug, EvtParticle *partptr)
void setLifetime(double tau)
EvtParticle * getDaug(const int i)
double getLifetime() const
EvtParticle * getParent() const
void init(EvtId part_n, double e, double px, double py, double pz)
static std::string get(const std::string &name, int &ierr)