BOSS 8.0.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
34#include <iostream>
35#include <string>
36#include <vector>
37
38template <class T> class EvtIntervalDecayAmp : public EvtDecayAmp {
39
40public:
41 EvtIntervalDecayAmp() : _probMax( 0. ), _nScan( 0 ), _fact( 0 ) {}
42
45
46 virtual ~EvtIntervalDecayAmp() { delete _fact; }
47
48 // Initialize model
49
50 virtual void init() {
51 // Collect model parameters and parse them
52
53 vector<std::string> args;
54 int i;
55 for ( i = 0; i < getNArg(); i++ ) args.push_back( getArgStr( i ) );
57 parser.parse( args );
58
59 // Create factory and interval
60
61 if ( VERBOSE ) report( INFO, "EvtGen" ) << "Create factory and interval" << std::endl;
62 _fact = createFactory( parser );
63
64 // Maximum PDF value over the Dalitz plot can be specified, or a scan
65 // can be performed.
66
67 _probMax = parser.pdfMax();
68 _nScan = parser.nScan();
69 if ( VERBOSE ) report( INFO, "EvtGen" ) << "Pdf maximum " << _probMax << std::endl;
70 if ( VERBOSE ) report( INFO, "EvtGen" ) << "Scan number " << _nScan << std::endl;
71 }
72
73 virtual void initProbMax() {
74 if ( 0 == _nScan )
75 {
76
77 if ( _probMax > 0 ) setProbMax( _probMax );
78 else assert( 0 );
79 }
80 else
81 {
82
83 double factor = 1.2; // increase maximum probability by 20%
84 EvtAmpPdf<T> pdf( *_fact->getAmp() );
85 EvtPdfSum<T>* pc = _fact->getPC();
86 EvtPdfDiv<T> pdfdiv( pdf, *pc );
87 printf( "Sampling %d points to find maximum\n", _nScan );
88 EvtPdfMax<T> x = pdfdiv.findMax( *pc, _nScan );
89 _probMax = factor * x.value();
90 printf( "Found maximum %f\n", x.value() );
91 printf( "Increase to %f\n", _probMax );
93 }
94 }
95
96 virtual void decay( EvtParticle* p ) {
97 // Set things up in most general way
98
99 static EvtId B0 = EvtPDL::getId( "B0" );
100 static EvtId B0B = EvtPDL::getId( "anti-B0" );
101 double t;
102 EvtId other_b;
103 EvtComplex ampl( 0., 0. );
104
105 // Sample using pole-compensator pdf
106
107 EvtPdfSum<T>* pc = getPC();
108 _x = pc->randomPoint();
109
110 if ( _fact->isCPModel() )
111 {
112
113 EvtCPUtil::OtherB( p, t, other_b );
114 EvtComplex A = _fact->getAmp()->evaluate( _x );
115 EvtComplex Abar = _fact->getAmpConj()->evaluate( _x );
116 double dm = _fact->dm();
117
118 if ( other_b == B0B )
119 ampl = A * cos( dm * t / ( 2 * EvtConst::c ) ) +
120 Abar * sin( dm * t / ( 2 * EvtConst::c ) );
121 if ( other_b == B0 )
122 ampl = A * cos( dm * t / ( 2 * EvtConst::c ) ) -
123 Abar * sin( dm * t / ( 2 * EvtConst::c ) );
124 }
125 else { ampl = amplNonCP( _x ); }
126
127 // Pole-compensate
128
129 double comp = sqrt( pc->evaluate( _x ) );
130 assert( comp > 0 );
131 vertex( ampl / comp );
132
133 // Now generate random angles, rotate and setup
134 // the daughters
135
136 std::vector<EvtVector4R> v = initDaughters( _x );
137
138 int N = p->getNDaug();
139 if ( v.size() != N )
140 {
141
142 report( INFO, "EvtGen" ) << "Number of daughters " << N << std::endl;
143 report( INFO, "EvtGen" ) << "Momentum vector size " << v.size() << std::endl;
144 assert( 0 );
145 }
146
147 int i;
148 for ( i = 0; i < N; i++ ) { p->getDaug( i )->init( getDaugs()[i], v[i] ); }
149 }
150
152 virtual std::vector<EvtVector4R> initDaughters( const T& p ) const = 0;
153
154 // provide access to the decay point and to the amplitude of any decay point.
155 // this is used by EvtBtoKD3P:
156 const T& x() const { return _x; }
157 EvtComplex amplNonCP( const T& x ) { return _fact->getAmp()->evaluate( x ); }
158 EvtPdfSum<T>* getPC() { return _fact->getPC(); }
159
160protected:
161 double _probMax; // Maximum probability
162 int _nScan; // Number of points for max prob DP scan
163 T _x; // Decay point
164
166};
167
168#endif
#define VERBOSE
#define COPY_PTR(X)
Definition EvtMacros.hh:15
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ INFO
Definition EvtReport.hh:52
**********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
static void OtherB(EvtParticle *p, double &t, EvtId &otherb)
Definition EvtCPUtil.cc:225
static const double c
Definition EvtConst.hh:31
void vertex(const EvtComplex &amp)
void setProbMax(double prbmx)
EvtId * getDaugs()
std::string getArgStr(int j)
Definition EvtId.hh:27
EvtIntervalDecayAmp(const EvtIntervalDecayAmp< T > &other)
virtual void decay(EvtParticle *p)
EvtPdfSum< T > * getPC()
EvtAmpFactory< T > * _fact
EvtComplex amplNonCP(const T &x)
virtual EvtAmpFactory< T > * createFactory(const EvtMultiChannelParser &parser)=0
virtual std::vector< EvtVector4R > initDaughters(const T &p) const =0
void parse(const char *file, const char *model)
static EvtId getId(const std::string &name)
Definition EvtPDL.cc:272
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
int getNDaug() const
EvtParticle * getDaug(int i)
virtual T randomPoint()
Definition EvtPdfSum.hh:104
double evaluate(const T &p) const
Definition EvtPdf.hh:64
EvtPdfMax< T > findMax(const EvtPdf< T > &pc, int N)
Definition EvtPdf.hh:215
int t()
Definition t.c:1