evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtSSD_DirectCP.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 
23 #include "EvtGenBase/EvtCPUtil.hh"
24 #include "EvtGenBase/EvtConst.hh"
25 #include "EvtGenBase/EvtGenKine.hh"
26 #include "EvtGenBase/EvtPDL.hh"
28 #include "EvtGenBase/EvtRandom.hh"
29 #include "EvtGenBase/EvtReport.hh"
32 
33 #include <stdlib.h>
34 #include <string>
35 
37 {
38  return "SSD_DirectCP";
39 }
40 
42 {
43  return new EvtSSD_DirectCP;
44 }
45 
47 {
48  // check that there is 1 argument and 2-body decay
49 
50  checkNArg( 1 );
51  checkNDaug( 2 );
52 
55 
56  if ( ( !( d1type == EvtSpinType::SCALAR || d2type == EvtSpinType::SCALAR ) ) ||
57  ( !( ( d2type == EvtSpinType::SCALAR ) ||
58  ( d2type == EvtSpinType::VECTOR ) ||
59  ( d2type == EvtSpinType::TENSOR ) ) ) ||
60  ( !( ( d1type == EvtSpinType::SCALAR ) ||
61  ( d1type == EvtSpinType::VECTOR ) ||
62  ( d1type == EvtSpinType::TENSOR ) ) ) ) {
63  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
64  << "EvtSSD_DirectCP generator expected "
65  << "one of the daugters to be a scalar, "
66  << "the other either scalar, vector, or tensor, "
67  << "found:" << EvtPDL::name( getDaug( 0 ) ).c_str() << " and "
68  << EvtPDL::name( getDaug( 1 ) ).c_str() << std::endl;
69  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
70  << "Will terminate execution!" << std::endl;
71  ::abort();
72  }
73 
74  _acp = getArg( 0 ); // A_CP defined as A_CP = (BR(fbar)-BR(f))/(BR(fbar)+BR(f))
75 }
76 
78 {
79  double theProbMax = 1.;
80 
83  if ( d1type == EvtSpinType::TENSOR || d2type == EvtSpinType::TENSOR )
84  theProbMax *= 10;
85 
86  setProbMax( theProbMax );
87 }
88 
90 {
91  bool flip = false;
92  EvtId daugs[2];
93 
94  // decide it is B or Bbar:
95  if ( EvtRandom::Flat( 0., 1. ) < ( ( 1. - _acp ) / 2. ) ) {
96  // it is a B
97  if ( EvtPDL::getStdHep( getParentId() ) < 0 )
98  flip = true;
99  } else {
100  // it is a Bbar
101  if ( EvtPDL::getStdHep( getParentId() ) > 0 )
102  flip = true;
103  }
104 
105  if ( flip ) {
106  if ( ( isB0Mixed( p ) ) || ( isBsMixed( p ) ) ) {
107  p->getParent()->setId( EvtPDL::chargeConj( p->getParent()->getId() ) );
108  p->setId( EvtPDL::chargeConj( p->getId() ) );
109  } else {
110  p->setId( EvtPDL::chargeConj( p->getId() ) );
111  }
112  }
113 
114  if ( !flip ) {
115  daugs[0] = getDaug( 0 );
116  daugs[1] = getDaug( 1 );
117  } else {
118  daugs[0] = EvtPDL::chargeConj( getDaug( 0 ) );
119  daugs[1] = EvtPDL::chargeConj( getDaug( 1 ) );
120  }
121 
122  EvtParticle* d;
123  p->initializePhaseSpace( 2, daugs );
124 
125  EvtVector4R p4_parent = p->getP4Restframe();
126  double m_parent = p4_parent.mass();
127 
129 
130  EvtVector4R momv;
131  EvtVector4R moms;
132 
133  if ( d2type == EvtSpinType::SCALAR ) {
134  d2type = EvtPDL::getSpinType( getDaug( 0 ) );
135  d = p->getDaug( 0 );
136  momv = d->getP4();
137  moms = p->getDaug( 1 )->getP4();
138  } else {
139  d = p->getDaug( 1 );
140  momv = d->getP4();
141  moms = p->getDaug( 0 )->getP4();
142  }
143 
144  if ( d2type == EvtSpinType::SCALAR ) {
145  vertex( 1. );
146  }
147 
148  if ( d2type == EvtSpinType::VECTOR ) {
149  double norm = momv.mass() / ( momv.d3mag() * p->mass() );
150 
151  vertex( 0, norm * p4_parent * ( d->epsParent( 0 ) ) );
152  vertex( 1, norm * p4_parent * ( d->epsParent( 1 ) ) );
153  vertex( 2, norm * p4_parent * ( d->epsParent( 2 ) ) );
154  }
155 
156  if ( d2type == EvtSpinType::TENSOR ) {
157  double norm = d->mass() * d->mass() /
158  ( m_parent * d->getP4().d3mag() * d->getP4().d3mag() );
159 
160  vertex( 0, norm * d->epsTensorParent( 0 ).cont1( p4_parent ) * p4_parent );
161  vertex( 1, norm * d->epsTensorParent( 1 ).cont1( p4_parent ) * p4_parent );
162  vertex( 2, norm * d->epsTensorParent( 2 ).cont1( p4_parent ) * p4_parent );
163  vertex( 3, norm * d->epsTensorParent( 3 ).cont1( p4_parent ) * p4_parent );
164  vertex( 4, norm * d->epsTensorParent( 4 ).cont1( p4_parent ) * p4_parent );
165  }
166 }
167 
169 {
170  if ( !( p->getParent() ) )
171  return false;
172 
173  static EvtId B0 = EvtPDL::getId( "B0" );
174  static EvtId B0B = EvtPDL::getId( "anti-B0" );
175 
176  if ( ( p->getId() != B0 ) && ( p->getId() != B0B ) )
177  return false;
178 
179  if ( ( p->getParent()->getId() == B0 ) || ( p->getParent()->getId() == B0B ) )
180  return true;
181 
182  return false;
183 }
184 
186 {
187  if ( !( p->getParent() ) )
188  return false;
189 
190  static EvtId BS0 = EvtPDL::getId( "B_s0" );
191  static EvtId BSB = EvtPDL::getId( "anti-B_s0" );
192 
193  if ( ( p->getId() != BS0 ) && ( p->getId() != BSB ) )
194  return false;
195 
196  if ( ( p->getParent()->getId() == BS0 ) || ( p->getParent()->getId() == BSB ) )
197  return true;
198 
199  return false;
200 }
201 
202 std::string EvtSSD_DirectCP::getParamName( int i )
203 {
204  switch ( i ) {
205  case 0:
206  return "ACP";
207  default:
208  return "";
209  }
210 }
virtual EvtTensor4C epsTensorParent(int i) const
static std::string name(EvtId i)
Definition: EvtPDL.cpp:382
EvtParticle * getParent() const
Definition: EvtParticle.cpp:96
double getArg(unsigned int j)
static EvtSpinType::spintype getSpinType(EvtId i)
Definition: EvtPDL.cpp:377
EvtDecayBase * clone() override
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
void decay(EvtParticle *p) override
double mass() const
Definition: EvtVector4R.cpp:49
bool isB0Mixed(EvtParticle *p)
EvtVector4C cont1(const EvtVector4C &v4) const
EvtId getId() const
void setProbMax(double prbmx)
Definition: EvtId.hh:27
EvtId getParentId() const
Definition: EvtDecayBase.hh:61
void vertex(const EvtComplex &amp)
Definition: EvtDecayAmp.hh:37
void setId(EvtId id)
Definition: EvtParticle.hh:385
bool isBsMixed(EvtParticle *p)
double initializePhaseSpace(unsigned int numdaughter, EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
virtual EvtVector4C epsParent(int i) const
void checkNDaug(int d1, int d2=-1)
static double Flat()
Definition: EvtRandom.cpp:72
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
static EvtId getId(const std::string &name)
Definition: EvtPDL.cpp:287
const EvtVector4R & getP4() const
void init() override
double mass() const
double d3mag() const
std::string getName() override
std::string getParamName(int i) override
EvtParticle * getDaug(int i)
Definition: EvtParticle.cpp:91
EvtVector4R getP4Restframe() const
void initProbMax() override
static EvtId chargeConj(EvtId id)
Definition: EvtPDL.cpp:207
static int getStdHep(EvtId id)
Definition: EvtPDL.cpp:362
EvtId getDaug(int i) const
Definition: EvtDecayBase.hh:67