BOSS
7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtFDC.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: EvtFDC.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/EvtFDC.hh
"
40
#include "
EvtGenBase/EvtRandom.hh
"
41
#include <string>
42
#include <cstdlib>
43
using namespace
std
;
//::endl;
44
45
extern
"C"
{
46
extern
void
setamp_
(
int
*);
47
}
48
49
extern
"C"
{
50
extern
void
init_fit_
();
51
}
52
53
extern
"C"
{
54
extern
void
initevtgen_
();
55
}
56
57
extern
"C"
{
58
extern
double
fdcevtgen_
(
double
*,
double
*,
double
*,
double
*);
59
}
60
61
EvtFDC::~EvtFDC
() {}
62
63
void
EvtFDC::getName
(std::string& model_name){
64
65
model_name=
"FDC"
;
66
67
}
68
69
EvtDecayBase
*
EvtFDC::clone
(){
70
71
return
new
EvtFDC
;
72
73
}
74
75
76
void
EvtFDC::init
(){
77
init_fit_
();
78
initevtgen_
();
79
int
ndiag = -1;
//Feyman diagram number, started from 1, if -1, generate all intermediate states including interference effects
80
if
(
getNArg
()==1) {
81
ndiag =
getArg
(0);
82
}
83
setamp_
( &ndiag );
84
85
EvtSpinType::spintype
parenttype =
EvtPDL::getSpinType
(
getParentId
());
86
}
87
void
EvtFDC::initProbMax
(){
88
noProbMax
();
89
90
}
91
92
93
static
int
nrun=1;
94
static
double
max_amps=0.0;
95
96
void
EvtFDC::setEvtMomentum
(
EvtVector4R
*
p4
){
97
for
(
int
i=0; i<_nd; i++){
98
e[i] = _p4[i].
get
(0);
99
px[i] = _p4[i].
get
(1);
100
py[i] = _p4[i].
get
(2);
101
pz[i] = _p4[i].
get
(3);
102
}
103
}
104
105
void
EvtFDC::decay
(
EvtParticle
*p ){
106
double
amps,SamAmps,rd1;
107
// calculated the max amplitude square in 20000 events, is it enough larger?
108
if
(nrun==1){
109
int
ir,nd;
110
std::cout<<
"Wait for a moment for calculation of maxiumal amplitude squared"
<<std::endl;
111
for
(ir=0;ir<=200000;ir++){
112
loop0:
113
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
());
114
int
nd=p->
getNDaug
();
115
_nd=nd;
116
for
(
int
i=0;i<=nd-1;i++){
117
_p4[i]=p->
getDaug
(i)->
getP4Lab
();
118
}
119
for
(
int
i=0; i<_nd; i++){
120
e[i] = _p4[i].
get
(0);
121
px[i] = _p4[i].
get
(1);
122
py[i] = _p4[i].
get
(2);
123
pz[i] = _p4[i].
get
(3);
124
}
125
//for debuging
126
amps =
fdcevtgen_
(e,px,py,pz);
127
//std::cout<<"nrun "<<nrun<<std::endl;
128
if
(amps<0)
goto
loop0;
129
if
(amps>max_amps) max_amps=amps*1.01;
130
nrun++;
131
}
132
}
133
if
(max_amps==0.0) {
report
(
ERROR
,
"EvtGen"
)<<
"The decay amplitude square should be positive number, but it is "
<<max_amps<<endl;abort();}
134
//cout<<"max_amp="<<max_amps<<endl;
135
136
137
loop:
138
p->
initializePhaseSpace
(
getNDaug
(),
getDaugs
());
139
int
i;
140
for
(i=0;i<=p->
getNDaug
()-1;i++){
141
_p4[i]=p->
getDaug
(i)->
getP4Lab
();
142
}
143
setEvtMomentum
(_p4);
144
// Put phase space results into the daughters.
145
amps =
fdcevtgen_
(e,px,py,pz);
146
if
(amps < 0)
goto
loop;
147
SamAmps=amps/max_amps;
148
rd1=
EvtRandom::Flat
(0.0, 1.0);
149
if
(rd1>=SamAmps)
goto
loop;
150
if
(amps>max_amps) max_amps=amps*1.01;
151
nrun++;
152
}
153
154
EvtDiracParticle.hh
setamp_
void setamp_(int *)
initevtgen_
void initevtgen_()
fdcevtgen_
double fdcevtgen_(double *, double *, double *, double *)
init_fit_
void init_fit_()
EvtFDC.hh
EvtGenKine.hh
EvtHighSpinParticle.hh
EvtNeutrinoParticle.hh
EvtPDL.hh
EvtParticle.hh
EvtPatches.hh
EvtPhotonParticle.hh
EvtRandom.hh
EvtRaritaSchwingerParticle.hh
report
ostream & report(Severity severity, const char *facility)
Definition
EvtReport.cc:36
EvtReport.hh
ERROR
@ ERROR
Definition
EvtReport.hh:49
EvtScalarParticle.hh
EvtStringParticle.hh
EvtTensor4C.hh
EvtTensorParticle.hh
EvtVector4C.hh
EvtVector4R.hh
EvtVectorParticle.hh
EvtDecayBase
Definition
EvtDecayBase.hh:33
EvtDecayBase::getArg
double getArg(int j)
Definition
EvtDecayBase.cc:564
EvtDecayBase::noProbMax
void noProbMax()
Definition
EvtDecayBase.cc:304
EvtDecayBase::getParentId
EvtId getParentId()
Definition
EvtDecayBase.hh:60
EvtDecayBase::getNDaug
int getNDaug()
Definition
EvtDecayBase.hh:64
EvtDecayBase::getNArg
int getNArg()
Definition
EvtDecayBase.hh:67
EvtDecayBase::getDaugs
EvtId * getDaugs()
Definition
EvtDecayBase.hh:65
EvtFDC::getName
void getName(std::string &name)
Definition
EvtFDC.cc:63
EvtFDC::init
void init()
Definition
EvtFDC.cc:76
EvtFDC::~EvtFDC
virtual ~EvtFDC()
Definition
EvtFDC.cc:61
EvtFDC::EvtFDC
EvtFDC()
Definition
EvtFDC.hh:33
EvtFDC::initProbMax
void initProbMax()
Definition
EvtFDC.cc:87
EvtFDC::setEvtMomentum
void setEvtMomentum(EvtVector4R *p4)
Definition
EvtFDC.cc:96
EvtFDC::clone
EvtDecayBase * clone()
Definition
EvtFDC.cc:69
EvtFDC::decay
void decay(EvtParticle *p)
Definition
EvtFDC.cc:105
EvtPDL::getSpinType
static EvtSpinType::spintype getSpinType(EvtId i)
Definition
EvtPDL.hh:61
EvtParticle
Definition
EvtParticle.hh:42
EvtParticle::getP4Lab
EvtVector4R getP4Lab()
Definition
EvtParticle.cc:684
EvtParticle::getNDaug
int getNDaug() const
Definition
EvtParticle.cc:124
EvtParticle::getDaug
EvtParticle * getDaug(int i)
Definition
EvtParticle.cc:84
EvtParticle::initializePhaseSpace
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
Definition
EvtParticle.cc:1070
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cc:74
EvtSpinType::spintype
spintype
Definition
EvtSpinType.hh:31
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:179
std
Definition
RootEventData/RootEventData_rootcint.cxx:38
p4
double double double * p4
Definition
qcdloop1.h:77
7.1.2
Generator
BesEvtGen
BesEvtGen-00-04-30
src
EvtGen
EvtGenModels
EvtFDC.cc
Generated by
1.12.0