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
EvtGenModels
EvtIntervalDecayAmp.hh
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
21
#ifndef EVT_INTERVAL_DECAY_AMP
22
#define EVT_INTERVAL_DECAY_AMP
23
24
#define VERBOSE true
25
#include "
EvtGenBase/EvtAmpFactory.hh
"
26
#include "
EvtGenBase/EvtAmpPdf.hh
"
27
#include "
EvtGenBase/EvtCPUtil.hh
"
28
#include "
EvtGenBase/EvtCyclic3.hh
"
29
#include "
EvtGenBase/EvtDecayAmp.hh
"
30
#include "
EvtGenBase/EvtMacros.hh
"
31
#include "
EvtGenBase/EvtMultiChannelParser.hh
"
32
#include "
EvtGenBase/EvtPDL.hh
"
33
#include "
EvtGenBase/EvtParticle.hh
"
34
#include "
EvtGenBase/EvtPdf.hh
"
35
#include "
EvtGenBase/EvtReport.hh
"
36
37
#include <iostream>
38
#include <string>
39
#include <vector>
40
41
// Decay model that uses the "amplitude on an interval"
42
// templatization
43
44
template
<
class
T>
45
class
EvtIntervalDecayAmp
:
public
EvtDecayAmp
{
46
public
:
47
EvtIntervalDecayAmp
() :
m_probMax
( 0. ),
m_nScan
( 0 ),
m_fact
( nullptr ) {}
48
49
EvtIntervalDecayAmp
(
const
EvtIntervalDecayAmp<T>
& other ) :
50
m_probMax
( other.
m_probMax
),
m_nScan
( other.
m_nScan
),
COPY_PTR
(
m_fact
)
51
{
52
}
53
54
virtual
~EvtIntervalDecayAmp
() {
delete
m_fact
; }
55
56
// Initialize model
57
58
void
init
()
override
59
{
60
// Collect model parameters and parse them
61
62
vector<std::string> args;
63
int
i;
64
for
( i = 0; i <
getNArg
(); i++ )
65
args.push_back(
getArgStr
( i ) );
66
EvtMultiChannelParser
parser;
67
parser.
parse
( args );
68
69
// Create factory and interval
70
71
if
(
VERBOSE
)
72
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
73
<<
"Create factory and interval"
<< std::endl;
74
m_fact
=
createFactory
( parser );
75
76
// Maximum PDF value over the Dalitz plot can be specified, or a scan
77
// can be performed.
78
79
m_probMax
= parser.
pdfMax
();
80
m_nScan
= parser.
nScan
();
81
if
(
VERBOSE
)
82
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
83
<<
"Pdf maximum "
<<
m_probMax
<< std::endl;
84
if
(
VERBOSE
)
85
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
86
<<
"Scan number "
<<
m_nScan
<< std::endl;
87
}
88
89
void
initProbMax
()
override
90
{
91
if
( 0 ==
m_nScan
) {
92
if
(
m_probMax
> 0 )
93
setProbMax
(
m_probMax
);
94
else
95
assert( 0 );
96
}
else
{
97
double
factor = 1.2;
// increase maximum probability by 20%
98
EvtAmpPdf<T>
pdf( *
m_fact
->getAmp() );
99
EvtPdfSum<T>
* pc =
m_fact
->getPC();
100
EvtPdfDiv<T>
pdfdiv( pdf, *pc );
101
printf(
"Sampling %d points to find maximum\n"
,
m_nScan
);
102
EvtPdfMax<T>
x
= pdfdiv.
findMax
( *pc,
m_nScan
);
103
m_probMax
= factor *
x
.value();
104
printf(
"Found maximum %f\n"
,
x
.value() );
105
printf(
"Increase to %f\n"
,
m_probMax
);
106
setProbMax
(
m_probMax
);
107
}
108
}
109
110
void
decay
(
EvtParticle
* p )
override
111
{
112
// Set things up in most general way
113
114
static
EvtId
B0 =
EvtPDL::getId
(
"B0"
);
115
static
EvtId
B0B =
EvtPDL::getId
(
"anti-B0"
);
116
double
t;
117
EvtId
other_b;
118
EvtComplex
ampl( 0., 0. );
119
120
// Sample using pole-compensator pdf
121
122
EvtPdfSum<T>
* pc =
getPC
();
123
m_x
= pc->
randomPoint
();
124
125
if
(
m_fact
->isCPModel() ) {
126
// Time-dependent Dalitz plot changes
127
// Dec 2005 (ddujmic@slac.stanford.edu)
128
129
EvtComplex
A =
m_fact
->getAmp()->evaluate(
m_x
);
130
EvtComplex
Abar =
m_fact
->getAmpConj()->evaluate(
m_x
);
131
132
EvtCPUtil::getInstance
()->
OtherB
( p, t, other_b );
133
134
double
dm =
m_fact
->dm();
135
double
mixAmpli =
m_fact
->mixAmpli();
136
double
mixPhase =
m_fact
->mixPhase();
137
EvtComplex
qoverp( cos( mixPhase ) * mixAmpli,
138
sin( mixPhase ) * mixAmpli );
139
EvtComplex
poverq( cos( mixPhase ) / mixAmpli,
140
-sin( mixPhase ) / mixAmpli );
141
142
if
( other_b == B0B )
143
ampl = A * cos( dm * t / ( 2 *
EvtConst::c
) ) +
144
EvtComplex
( 0., 1. ) * Abar *
145
sin( dm * t / ( 2 *
EvtConst::c
) ) * qoverp;
146
if
( other_b == B0 )
147
ampl = Abar * cos( dm * t / ( 2 *
EvtConst::c
) ) +
148
EvtComplex
( 0., 1. ) * A *
149
sin( dm * t / ( 2 *
EvtConst::c
) ) * poverq;
150
151
}
else
{
152
ampl =
amplNonCP
(
m_x
);
153
}
154
155
// Pole-compensate
156
157
double
comp = sqrt( pc->
evaluate
(
m_x
) );
158
assert( comp > 0 );
159
vertex
( ampl / comp );
160
161
// Now generate random angles, rotate and setup
162
// the daughters
163
164
std::vector<EvtVector4R> v =
initDaughters
(
m_x
);
165
166
size_t
N = p->
getNDaug
();
167
if
( v.size() != N ) {
168
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
169
<<
"Number of daughters "
<< N << std::endl;
170
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
171
<<
"Momentum vector size "
<< v.size() << std::endl;
172
assert( 0 );
173
}
174
175
for
(
size_t
i = 0; i < N; i++ ) {
176
p->
getDaug
( i )->
init
(
getDaugs
()[i], v[i] );
177
}
178
}
179
180
virtual
EvtAmpFactory<T>
*
createFactory
(
181
const
EvtMultiChannelParser
& parser ) = 0;
182
virtual
std::vector<EvtVector4R>
initDaughters
(
const
T& p )
const
= 0;
183
184
// provide access to the decay point and to the amplitude of any decay point.
185
// this is used by EvtBtoKD3P:
186
const
T&
x
()
const
{
return
m_x
; }
187
EvtComplex
amplNonCP
(
const
T&
x
)
188
{
189
return
m_fact
->getAmp()->evaluate(
x
);
190
}
191
EvtPdfSum<T>
*
getPC
() {
return
m_fact
->getPC(); }
192
193
protected
:
194
double
m_probMax
;
// Maximum probability
195
int
m_nScan
;
// Number of points for max prob DP scan
196
T
m_x
;
// Decay point
197
198
EvtAmpFactory<T>
*
m_fact
;
// factory
199
};
200
201
#endif
EvtAmpFactory.hh
EvtAmpPdf.hh
EvtCPUtil.hh
EvtCyclic3.hh
EvtDecayAmp.hh
VERBOSE
#define VERBOSE
Definition
EvtIntervalDecayAmp.hh:24
EvtMacros.hh
COPY_PTR
#define COPY_PTR(X)
Definition
EvtMacros.hh:26
EvtMultiChannelParser.hh
EvtPDL.hh
EvtParticle.hh
EvtPdf.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_INFO
@ EVTGEN_INFO
Definition
EvtReport.hh:52
EvtAmpFactory
Definition
EvtAmpFactory.hh:40
EvtAmpPdf
Definition
EvtAmpPdf.hh:30
EvtCPUtil::getInstance
static EvtCPUtil * getInstance()
Definition
EvtCPUtil.cpp:42
EvtCPUtil::OtherB
void OtherB(EvtParticle *p, double &t, EvtId &otherb)
Definition
EvtCPUtil.cpp:372
EvtComplex
Definition
EvtComplex.hh:29
EvtConst::c
static const double c
Definition
EvtConst.hh:30
EvtDecayAmp
Definition
EvtDecayAmp.hh:29
EvtDecayAmp::vertex
void vertex(const EvtComplex &)
Definition
EvtDecayAmp.hh:37
EvtDecayBase::getNArg
int getNArg() const
Definition
EvtDecayBase.hh:67
EvtDecayBase::setProbMax
void setProbMax(double prbmx)
Definition
EvtDecayBase.cpp:295
EvtDecayBase::getArgStr
std::string getArgStr(int j) const
Definition
EvtDecayBase.hh:77
EvtDecayBase::getDaugs
const EvtId * getDaugs() const
Definition
EvtDecayBase.hh:65
EvtId
Definition
EvtId.hh:27
EvtIntervalDecayAmp::EvtIntervalDecayAmp
EvtIntervalDecayAmp(const EvtIntervalDecayAmp< T > &other)
Definition
EvtIntervalDecayAmp.hh:49
EvtIntervalDecayAmp::m_x
T m_x
Definition
EvtIntervalDecayAmp.hh:196
EvtIntervalDecayAmp::m_probMax
double m_probMax
Definition
EvtIntervalDecayAmp.hh:194
EvtIntervalDecayAmp::x
const T & x() const
Definition
EvtIntervalDecayAmp.hh:186
EvtIntervalDecayAmp::getPC
EvtPdfSum< T > * getPC()
Definition
EvtIntervalDecayAmp.hh:191
EvtIntervalDecayAmp::decay
void decay(EvtParticle *p) override
Definition
EvtIntervalDecayAmp.hh:110
EvtIntervalDecayAmp::init
void init() override
Definition
EvtIntervalDecayAmp.hh:58
EvtIntervalDecayAmp::~EvtIntervalDecayAmp
virtual ~EvtIntervalDecayAmp()
Definition
EvtIntervalDecayAmp.hh:54
EvtIntervalDecayAmp::amplNonCP
EvtComplex amplNonCP(const T &x)
Definition
EvtIntervalDecayAmp.hh:187
EvtIntervalDecayAmp::m_nScan
int m_nScan
Definition
EvtIntervalDecayAmp.hh:195
EvtIntervalDecayAmp::createFactory
virtual EvtAmpFactory< T > * createFactory(const EvtMultiChannelParser &parser)=0
EvtIntervalDecayAmp::EvtIntervalDecayAmp
EvtIntervalDecayAmp()
Definition
EvtIntervalDecayAmp.hh:47
EvtIntervalDecayAmp::initDaughters
virtual std::vector< EvtVector4R > initDaughters(const T &p) const =0
EvtIntervalDecayAmp::initProbMax
void initProbMax() override
Definition
EvtIntervalDecayAmp.hh:89
EvtIntervalDecayAmp::m_fact
EvtAmpFactory< T > * m_fact
Definition
EvtIntervalDecayAmp.hh:198
EvtMultiChannelParser
Definition
EvtMultiChannelParser.hh:40
EvtMultiChannelParser::nScan
int nScan() const
Definition
EvtMultiChannelParser.hh:56
EvtMultiChannelParser::pdfMax
double pdfMax() const
Definition
EvtMultiChannelParser.hh:55
EvtMultiChannelParser::parse
void parse(const char *file, const char *model)
Definition
EvtMultiChannelParser.cpp:77
EvtPDL::getId
static EvtId getId(const std::string &name)
Definition
EvtPDL.cpp:283
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::init
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle::getDaug
EvtParticle * getDaug(const int i)
Definition
EvtParticle.hh:173
EvtParticle::getNDaug
size_t getNDaug() const
Definition
EvtParticle.cpp:154
EvtPdfDiv
Definition
EvtPdf.hh:228
EvtPdfMax
Definition
EvtPdfMax.hh:31
EvtPdfSum
Definition
EvtPdfSum.hh:32
EvtPdfSum::randomPoint
T randomPoint() override
Definition
EvtPdfSum.hh:129
EvtPdf::evaluate
double evaluate(const T &p) const
Definition
EvtPdf.hh:79
EvtPdf::findMax
EvtPdfMax< T > findMax(const EvtPdf< T > &pc, int N)
Definition
EvtPdf.hh:260
Generated by
1.16.1