BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
bak-BesEvtGen-00-04-08/src/EvtGen/EvtGenModels/EvtDIY.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2//
3// Environment:
4// This software is part of models developed at BES collaboration
5// based on the EvtGen framework. If you use all or part
6// of it, please give an appropriate acknowledgement.
7//
8// Copyright Information: See EvtGen/BesCopyright
9// Copyright (A) 2006 Ping Rong-Gang @IHEP
10//
11// Module: EvtDIY.cc
12//
13// Description: Model provided by user, see the mannual
14//
15// Modification history:
16//
17// Ping R.-G. December, 2006 Module created
18//
19//------------------------------------------------------------------------
20
21#include "EvtGenBase/EvtPatches.hh"
22#include <stdlib.h>
23#include "EvtGenBase/EvtParticle.hh"
24#include "EvtGenBase/EvtGenKine.hh"
25#include "EvtGenBase/EvtPDL.hh"
26#include "EvtGenBase/EvtVector4C.hh"
27#include "EvtGenBase/EvtVector4R.hh"
28#include "EvtGenBase/EvtTensor4C.hh"
29#include "EvtGenBase/EvtDiracParticle.hh"
30#include "EvtGenBase/EvtScalarParticle.hh"
31#include "EvtGenBase/EvtVectorParticle.hh"
32#include "EvtGenBase/EvtTensorParticle.hh"
33#include "EvtGenBase/EvtPhotonParticle.hh"
34#include "EvtGenBase/EvtNeutrinoParticle.hh"
35#include "EvtGenBase/EvtStringParticle.hh"
36#include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
37#include "EvtGenBase/EvtHighSpinParticle.hh"
38#include "EvtGenBase/EvtReport.hh"
39#include "EvtGenModels/EvtDIY.hh"
40#include "EvtGenBase/EvtRandom.hh"
41#include <string>
42using namespace std; //::endl;
43
45
46void EvtDIY::getName(std::string& model_name){
47
48 model_name="DIY";
49
50}
51
53
54 return new EvtDIY;
55
56}
57
58
60
61// check that there are 1 arguments:angular distribution parameter
62// checkNArg(0);
63// checkNDaug(2);
65// if ( parenttype == EvtSpinType::SCALAR ){
66// report(ERROR,"EvtGen")<<"Scalar decays with flat distribution"<<endl;
67// ::abort();
68// }
69}
71 noProbMax();
72
73}
74
75
76static int nrun=1;
77static double max_amps=0.0;
78
80
81double amps,SamAmps,rd1;
82// calculated the max amplitude square in 20000 events, is it enough larger?
83 if(nrun==1){
84 int ir,nd;
85 for(ir=0;ir<=200000;ir++){
86 loop0:
88 int nd=p->getNDaug(),i;
89 _nd=nd;
90 for(i=0;i<=nd-1;i++){
91 _p4Lab[i]=p->getDaug(i)->getP4Lab();
92 _p4CM[i]=p->getDaug(i)->getP4();
93 }
94 amps=AmplitudeSquare();
95 if(amps<0) goto loop0;
96 if(amps>max_amps) max_amps=amps*1.01;
97 nrun++;
98 }
99 }
100if(max_amps==0.0) {report(ERROR,"EvtGen")<<"The decay amplitude square should be positive number"<<endl;abort();}
101//cout<<"max_amp="<<max_amps<<endl;
102
103
104loop:
106 int i;
107 for(i=0;i<=p->getNDaug()-1;i++){
108 _p4Lab[i]=p->getDaug(i)->getP4Lab();
109 _p4CM[i]=p->getDaug(i)->getP4();
110 }
111// Put phase space results into the daughters.
112 amps=AmplitudeSquare();
113 if(amps < 0) goto loop;
114 SamAmps=amps/max_amps;
115 rd1=EvtRandom::Flat(0.0, 1.0);
116 if(rd1>=SamAmps) goto loop;
117 return ;
118}
119
120
ostream & report(Severity severity, const char *facility)
static EvtSpinType::spintype getSpinType(EvtId i)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)