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
EvtDMix.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
24#include "EvtGenBase/EvtPDL.hh"
28
29#include <stdlib.h>
30#include <string>
31
32std::string EvtDMix::getName() const
33{
34 return "DMIX";
35}
36
38{
39 return new EvtDMix;
40}
41
43{
44 // check arguments
45 checkNArg( 3 );
46 m_rd = getArg( 0 );
47 m_xpr = getArg( 1 );
48 m_ypr = getArg( 2 );
49}
50
52{
53 noProbMax();
54}
55
57{
58 //unneeded - lange - may13-02
59 //if ( p->getNDaug() != 0 ) {
60 //Will end up here because maxrate multiplies by 1.2
61 // EvtGenReport(EVTGEN_DEBUG,"EvtGen") << "In EvtDMix: has "
62 // <<" daugthers should not be here!"<<endl;
63 // return;
64 //}
65
67
68 double ctau = EvtPDL::getctau( p->getId() );
69 if ( ctau == 0. )
70 return;
71
72 double pdf, random, gt, weight;
73
74 double maxPdf = m_rd + sqrt( m_rd ) * m_ypr * 50. +
75 2500.0 * ( m_xpr * m_xpr + m_ypr * m_ypr ) / 4.0;
76 bool keepGoing = true;
77 while ( keepGoing ) {
78 random = EvtRandom::Flat();
79 gt = -log( random );
80 weight = random;
81 pdf = m_rd + sqrt( m_rd ) * m_ypr * gt +
82 gt * gt * ( m_xpr * m_xpr + m_ypr * m_ypr ) / 4.0;
83 pdf *= exp( -1.0 * gt );
84 pdf /= weight;
85 if ( pdf > maxPdf )
86 std::cout << pdf << " " << weight << " " << maxPdf << " " << gt
87 << std::endl;
88 if ( pdf > maxPdf * EvtRandom::Flat() )
89 keepGoing = false;
90 }
91
92 p->setLifetime( gt * ctau );
93
94 return;
95}
EvtComplex exp(const EvtComplex &c)
double m_ypr
Definition EvtDMix.hh:43
double m_rd
Definition EvtDMix.hh:41
void init() override
Definition EvtDMix.cpp:42
double m_xpr
Definition EvtDMix.hh:42
std::string getName() const override
Definition EvtDMix.cpp:32
void decay(EvtParticle *p) override
Definition EvtDMix.cpp:56
void initProbMax() override
Definition EvtDMix.cpp:51
EvtDecayBase * clone() const override
Definition EvtDMix.cpp:37
EvtDecayBase()=default
int getNDaug() const
double getArg(unsigned int j)
void checkNArg(int a1, int a2=-1, int a3=-1, int a4=-1)
const EvtId * getDaugs() const
static double getctau(EvtId i)
Definition EvtPDL.cpp:351
double initializePhaseSpace(size_t numdaughter, const EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
EvtId getId() const
void setLifetime(double tau)
static double Flat()
Definition EvtRandom.cpp:95