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
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
32#include "EvtGenBase/EvtPDL.hh"
34#include "EvtGenBase/EvtPdf.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
44template <class T>
46 public:
47 EvtIntervalDecayAmp() : m_probMax( 0. ), m_nScan( 0 ), m_fact( nullptr ) {}
48
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 ) );
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 )
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 );
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
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; }
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
199};
200
201#endif
#define VERBOSE
#define COPY_PTR(X)
Definition EvtMacros.hh:26
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_INFO
Definition EvtReport.hh:52
static EvtCPUtil * getInstance()
Definition EvtCPUtil.cpp:42
void OtherB(EvtParticle *p, double &t, EvtId &otherb)
static const double c
Definition EvtConst.hh:30
void vertex(const EvtComplex &amp)
int getNArg() const
void setProbMax(double prbmx)
std::string getArgStr(int j) const
const EvtId * getDaugs() const
Definition EvtId.hh:27
EvtIntervalDecayAmp(const EvtIntervalDecayAmp< T > &other)
EvtPdfSum< T > * getPC()
void decay(EvtParticle *p) override
EvtComplex amplNonCP(const T &x)
virtual EvtAmpFactory< T > * createFactory(const EvtMultiChannelParser &parser)=0
virtual std::vector< EvtVector4R > initDaughters(const T &p) const =0
void initProbMax() override
EvtAmpFactory< T > * m_fact
void parse(const char *file, const char *model)
static EvtId getId(const std::string &name)
Definition EvtPDL.cpp:283
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle * getDaug(const int i)
size_t getNDaug() const
T randomPoint() override
Definition EvtPdfSum.hh:129
double evaluate(const T &p) const
Definition EvtPdf.hh:79
EvtPdfMax< T > findMax(const EvtPdf< T > &pc, int N)
Definition EvtPdf.hh:260