BOSS
7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtIntervalDecayAmp.hh
Go to the documentation of this file.
1
//-----------------------------------------------------------------------
2
// File and Version Information:
3
// $Id: EvtIntervalDecayAmp.hh,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
4
//
5
// Environment:
6
// This software is part of the EvtGen package developed jointly
7
// for the BaBar and CLEO collaborations. If you use all or part
8
// of it, please give an appropriate acknowledgement.
9
//
10
// Copyright Information:
11
// Copyright (C) 1998 Caltech, UCSB
12
//
13
// Module creator:
14
// Alexei Dvoretskii, Caltech, 2001-2002.
15
//-----------------------------------------------------------------------
16
17
// Decay model that uses the "amplitude on an interval"
18
// templatization
19
20
#ifndef EVT_INTERVAL_DECAY_AMP
21
#define EVT_INTERVAL_DECAY_AMP
22
23
#define VERBOSE true
24
#include <iostream>
25
#include <vector>
26
#include <string>
27
#include "
EvtGenBase/EvtDecayAmp.hh
"
28
#include "
EvtGenBase/EvtParticle.hh
"
29
#include "
EvtGenBase/EvtMacros.hh
"
30
#include "
EvtGenBase/EvtPdf.hh
"
31
#include "
EvtGenBase/EvtAmpFactory.hh
"
32
#include "
EvtGenBase/EvtMultiChannelParser.hh
"
33
#include "
EvtGenBase/EvtAmpPdf.hh
"
34
#include "
EvtGenBase/EvtCPUtil.hh
"
35
#include "
EvtGenBase/EvtPDL.hh
"
36
#include "
EvtGenBase/EvtCyclic3.hh
"
37
38
template
<
class
T>
39
class
EvtIntervalDecayAmp
:
public
EvtDecayAmp
{
40
41
public
:
42
43
EvtIntervalDecayAmp
()
44
:
_probMax
(0.),
_nScan
(0),
_fact
(0)
45
{}
46
47
EvtIntervalDecayAmp
(
const
EvtIntervalDecayAmp<T>
& other)
48
:
_probMax
(other.
_probMax
),
_nScan
(other.
_nScan
),
49
COPY_PTR
(
_fact
)
50
{}
51
52
virtual
~EvtIntervalDecayAmp
()
53
{
54
delete
_fact
;
55
}
56
57
58
// Initialize model
59
60
virtual
void
init
()
61
{
62
// Collect model parameters and parse them
63
64
vector<std::string> args;
65
int
i;
66
for
(i=0;i<
getNArg
();i++) args.push_back(
getArgStr
(i));
67
EvtMultiChannelParser
parser;
68
parser.
parse
(args);
69
70
// Create factory and interval
71
72
if
(
VERBOSE
)
report
(
INFO
,
"EvtGen"
) <<
"Create factory and interval"
<< std::endl;
73
_fact
=
createFactory
(parser);
74
75
76
// Maximum PDF value over the Dalitz plot can be specified, or a scan
77
// can be performed.
78
79
_probMax
= parser.
pdfMax
();
80
_nScan
= parser.
nScan
();
81
if
(
VERBOSE
)
report
(
INFO
,
"EvtGen"
) <<
"Pdf maximum "
<<
_probMax
<< std::endl;
82
if
(
VERBOSE
)
report
(
INFO
,
"EvtGen"
) <<
"Scan number "
<<
_nScan
<< std::endl;
83
}
84
85
86
virtual
void
initProbMax
()
87
{
88
if
(0 ==
_nScan
) {
89
90
if
(
_probMax
> 0)
setProbMax
(
_probMax
);
91
else
assert(0);
92
}
93
else
{
94
95
double
factor = 1.2;
// increase maximum probability by 20%
96
EvtAmpPdf<T>
pdf(*
_fact
->getAmp());
97
EvtPdfSum<T>
* pc =
_fact
->getPC();
98
EvtPdfDiv<T>
pdfdiv(pdf,*pc);
99
printf(
"Sampling %d points to find maximum\n"
,
_nScan
);
100
EvtPdfMax<T>
x
= pdfdiv.
findMax
(*pc,
_nScan
);
101
_probMax
= factor *
x
.value();
102
printf(
"Found maximum %f\n"
,
x
.value());
103
printf(
"Increase to %f\n"
,
_probMax
);
104
setProbMax
(
_probMax
);
105
}
106
}
107
108
virtual
void
decay
(
EvtParticle
*p)
109
{
110
// Set things up in most general way
111
112
static
EvtId
B0=
EvtPDL::getId
(
"B0"
);
113
static
EvtId
B0B=
EvtPDL::getId
(
"anti-B0"
);
114
double
t
;
115
EvtId
other_b;
116
EvtComplex
ampl(0.,0.);
117
118
// Sample using pole-compensator pdf
119
120
EvtPdfSum<T>
* pc =
getPC
();
121
_x
= pc->
randomPoint
();
122
123
if
(
_fact
->isCPModel()) {
124
125
EvtCPUtil::OtherB
(p,
t
,other_b);
126
EvtComplex
A =
_fact
->getAmp()->evaluate(
_x
);
127
EvtComplex
Abar =
_fact
->getAmpConj()->evaluate(
_x
);
128
double
dm =
_fact
->dm();
129
130
if
(other_b==B0B) ampl=A*
cos
(dm*
t
/(2*
EvtConst::c
))+Abar*
sin
(dm*
t
/(2*
EvtConst::c
));
131
if
(other_b==B0) ampl=A*
cos
(dm*
t
/(2*
EvtConst::c
))-Abar*
sin
(dm*
t
/(2*
EvtConst::c
));
132
}
133
else
{
134
135
ampl =
amplNonCP
(
_x
);
136
}
137
138
// Pole-compensate
139
140
double
comp = sqrt(pc->
evaluate
(
_x
));
141
assert(comp > 0);
142
vertex
(ampl/comp);
143
144
// Now generate random angles, rotate and setup
145
// the daughters
146
147
std::vector<EvtVector4R>
v
=
initDaughters
(
_x
);
148
149
int
N = p->
getNDaug
();
150
if
(
v
.size() != N) {
151
152
report
(
INFO
,
"EvtGen"
) <<
"Number of daughters "
<< N << std::endl;
153
report
(
INFO
,
"EvtGen"
) <<
"Momentum vector size "
<<
v
.size() << std::endl;
154
assert(0);
155
}
156
157
int
i;
158
for
(i=0;i<N;i++){
159
160
p->
getDaug
(i)->
init
(
getDaugs
()[i],
v
[i]);
161
}
162
}
163
164
virtual
EvtAmpFactory<T>
*
createFactory
(
const
EvtMultiChannelParser
& parser) = 0;
165
virtual
std::vector<EvtVector4R>
initDaughters
(
const
T& p)
const
= 0;
166
167
// provide access to the decay point and to the amplitude of any decay point.
168
// this is used by EvtBtoKD3P:
169
const
T &
x
()
const
{
return
_x
;}
170
EvtComplex
amplNonCP
(
const
T &
x
) {
return
_fact
->getAmp()->evaluate(
x
);}
171
EvtPdfSum<T>
*
getPC
() {
return
_fact
->getPC();}
172
173
protected
:
174
double
_probMax
;
// Maximum probability
175
int
_nScan
;
// Number of points for max prob DP scan
176
T
_x
;
// Decay point
177
178
EvtAmpFactory<T>
*
_fact
;
// factory
179
};
180
181
182
#endif
183
184
185
186
sin
double sin(const BesAngle a)
Definition:
BesAngle.h:210
cos
double cos(const BesAngle a)
Definition:
BesAngle.h:213
EvtAmpFactory.hh
EvtAmpPdf.hh
EvtCPUtil.hh
EvtCyclic3.hh
EvtDecayAmp.hh
VERBOSE
#define VERBOSE
Definition:
EvtIntervalDecayAmp.hh:23
EvtMacros.hh
COPY_PTR
#define COPY_PTR(X)
Definition:
EvtMacros.hh:15
EvtMultiChannelParser.hh
EvtPDL.hh
EvtParticle.hh
EvtPdf.hh
report
ostream & report(Severity severity, const char *facility)
Definition:
EvtReport.cc:36
INFO
@ INFO
Definition:
EvtReport.hh:52
v
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition:
KarLud.h:35
t
TTree * t
Definition:
binning.cxx:23
EvtAmpFactory
Definition:
EvtAmpFactory.hh:32
EvtAmpPdf
Definition:
EvtAmpPdf.hh:19
EvtCPUtil::OtherB
static void OtherB(EvtParticle *p, double &t, EvtId &otherb)
Definition:
EvtCPUtil.cc:229
EvtComplex
Definition:
EvtComplex.hh:28
EvtConst::c
static const double c
Definition:
EvtConst.hh:32
EvtDecayAmp
Definition:
EvtDecayAmp.hh:27
EvtDecayAmp::vertex
void vertex(const EvtComplex &)
Definition:
EvtDecayAmp.hh:37
EvtDecayBase::setProbMax
void setProbMax(double prbmx)
Definition:
EvtDecayBase.cc:297
EvtDecayBase::getNArg
int getNArg()
Definition:
EvtDecayBase.hh:67
EvtDecayBase::getDaugs
EvtId * getDaugs()
Definition:
EvtDecayBase.hh:65
EvtDecayBase::getArgStr
std::string getArgStr(int j)
Definition:
EvtDecayBase.hh:75
EvtId
Definition:
EvtId.hh:27
EvtIntervalDecayAmp
Definition:
EvtIntervalDecayAmp.hh:39
EvtIntervalDecayAmp::EvtIntervalDecayAmp
EvtIntervalDecayAmp(const EvtIntervalDecayAmp< T > &other)
Definition:
EvtIntervalDecayAmp.hh:47
EvtIntervalDecayAmp::init
virtual void init()
Definition:
EvtIntervalDecayAmp.hh:60
EvtIntervalDecayAmp::x
const T & x() const
Definition:
EvtIntervalDecayAmp.hh:169
EvtIntervalDecayAmp::initProbMax
virtual void initProbMax()
Definition:
EvtIntervalDecayAmp.hh:86
EvtIntervalDecayAmp::decay
virtual void decay(EvtParticle *p)
Definition:
EvtIntervalDecayAmp.hh:108
EvtIntervalDecayAmp::getPC
EvtPdfSum< T > * getPC()
Definition:
EvtIntervalDecayAmp.hh:171
EvtIntervalDecayAmp::~EvtIntervalDecayAmp
virtual ~EvtIntervalDecayAmp()
Definition:
EvtIntervalDecayAmp.hh:52
EvtIntervalDecayAmp::_fact
EvtAmpFactory< T > * _fact
Definition:
EvtIntervalDecayAmp.hh:178
EvtIntervalDecayAmp::amplNonCP
EvtComplex amplNonCP(const T &x)
Definition:
EvtIntervalDecayAmp.hh:170
EvtIntervalDecayAmp::createFactory
virtual EvtAmpFactory< T > * createFactory(const EvtMultiChannelParser &parser)=0
EvtIntervalDecayAmp::EvtIntervalDecayAmp
EvtIntervalDecayAmp()
Definition:
EvtIntervalDecayAmp.hh:43
EvtIntervalDecayAmp::initDaughters
virtual std::vector< EvtVector4R > initDaughters(const T &p) const =0
EvtIntervalDecayAmp::_nScan
int _nScan
Definition:
EvtIntervalDecayAmp.hh:175
EvtIntervalDecayAmp::_x
T _x
Definition:
EvtIntervalDecayAmp.hh:176
EvtIntervalDecayAmp::_probMax
double _probMax
Definition:
EvtIntervalDecayAmp.hh:174
EvtMultiChannelParser
Definition:
EvtMultiChannelParser.hh:31
EvtMultiChannelParser::nScan
int nScan() const
Definition:
EvtMultiChannelParser.hh:49
EvtMultiChannelParser::pdfMax
double pdfMax() const
Definition:
EvtMultiChannelParser.hh:48
EvtMultiChannelParser::parse
void parse(const char *file, const char *model)
Definition:
EvtMultiChannelParser.cc:74
EvtPDL::getId
static EvtId getId(const std::string &name)
Definition:
EvtPDL.cc:287
EvtParticle
Definition:
EvtParticle.hh:42
EvtParticle::init
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle::getNDaug
int getNDaug() const
Definition:
EvtParticle.cc:124
EvtParticle::getDaug
EvtParticle * getDaug(int i)
Definition:
EvtParticle.cc:84
EvtPdfDiv
Definition:
EvtPdf.hh:200
EvtPdfMax
Definition:
EvtPdfMax.hh:20
EvtPdfSum
Definition:
EvtPdfSum.hh:21
EvtPdfSum::randomPoint
virtual T randomPoint()
Definition:
EvtPdfSum.hh:118
EvtPdf::evaluate
double evaluate(const T &p) const
Definition:
EvtPdf.hh:65
EvtPdf::findMax
EvtPdfMax< T > findMax(const EvtPdf< T > &pc, int N)
Definition:
EvtPdf.hh:230
source
Generator
BesEvtGen
BesEvtGen-00-04-26
src
EvtGen
EvtGenModels
EvtIntervalDecayAmp.hh
Generated by
1.9.6