CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtDecayProb.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of the EvtGen package developed jointly
5// for the BaBar and CLEO collaborations. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/COPYRIGHT
9// Copyright (C) 1998 Caltech, UCSB
10//
11// Module: EvtGen/EvtDecayProb.cc
12//
13// Description:
14//
15// Modification history:
16//
17// DJL/RYD August 11, 1998 Module created
18//
19//------------------------------------------------------------------------
21
27#include "EvtGenBase/EvtPDL.hh"
29using std::endl;
30
32
33 int ntimes=10000;
34
35 double dummy;
36
37 do{
38 _weight=1.0;
40
41 decay(p);
42 //report(INFO,"EvtGen") << _weight << endl;
43 ntimes--;
44
45 _prob = _prob/_weight;
46
47 dummy=getProbMax(_prob)*EvtRandom::Flat();
48 p->setDecayProb(_prob/getProbMax(_prob));
49 // report(INFO,"EvtGen") << _prob <<" "<<dummy<<" "<<ntimes<<endl;
50 }while(ntimes&&(_prob<dummy));
51 //report(INFO,"EvtGen") << ntimes <<endl;
52 if (ntimes==0){
53 report(DEBUG,"EvtGen") << "Tried accept/reject:10000"
54 <<" times, and rejected all the times!"<<endl;
55 report(DEBUG,"EvtGen") << "Is therefore accepting the last event!"<<endl;
56 report(DEBUG,"EvtGen") << "Decay of particle:"<<
57 EvtPDL::name(p->getId()).c_str()<<"(channel:"<<
58 p->getChannel()<<") with mass "<<p->mass()<<endl;
59
60 int ii;
61 for(ii=0;ii<p->getNDaug();ii++){
62 report(DEBUG,"EvtGen") <<"Daughter "<<ii<<":"<<
63 EvtPDL::name(p->getDaug(ii)->getId()).c_str()<<" with mass "<<
64 p->getDaug(ii)->mass()<<endl;
65 }
66 }
67
68
70 rho.SetDiag(p->getSpinStates());
74 }
75
76
77 //Now decay the daughters.
79 int i;
80 for(i=0;i<p->getNDaug();i++){
81 //Need to set the spin density of the daughters to be
82 //diagonal.
83 rho.SetDiag(p->getDaug(i)->getSpinStates());
85
86 //Now decay the daughter. Really!
87 p->getDaug(i)->decay();
88 }
89 }
90
91}
92
93
94
95
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:36
@ DEBUG
Definition EvtReport.hh:53
virtual void decay(EvtParticle *p)=0
double getProbMax(double prob)
bool daugsDecayedByParentModel()
bool _daugsDecayedByParentModel
void makeDecay(EvtParticle *p)
static std::string name(EvtId i)
Definition EvtPDL.hh:64
void setSpinDensityBackward(const EvtSpinDensity &rho)
void setSpinDensityForward(const EvtSpinDensity &rho)
void setDecayProb(double p)
EvtId getId() const
int getSpinStates() const
int getNDaug() const
EvtParticle * getDaug(int i)
double mass() const
int getChannel() const
static bool alwaysRadCorr()
Definition EvtRadCorr.cc:65
static void doRadCorr(EvtParticle *p)
Definition EvtRadCorr.cc:52
static double Flat()
Definition EvtRandom.cc:73
void SetDiag(int n)