1 //-----------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: EvtPto3PAmpFactory.cc,v 1.22 2009/02/19 03:22:30 ryd Exp $
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.
10 // Copyright Information:
11 // Copyright (C) 1998 Caltech, UCSB
14 // Alexei Dvoretskii, Caltech, 2001-2002.
15 //-----------------------------------------------------------------------
16 #include "EvtGenBase/EvtPatches.hh"
18 // AmpFactory for building a P -> 3P decay
19 // (pseudoscalar to three pseudoscalars)
26 #include "EvtGenBase/EvtId.hh"
27 #include "EvtGenBase/EvtPDL.hh"
28 #include "EvtGenBase/EvtConst.hh"
29 #include "EvtGenBase/EvtComplex.hh"
30 #include "EvtGenBase/EvtCyclic3.hh"
31 #include "EvtGenBase/EvtSpinType.hh"
32 #include "EvtGenBase/EvtPto3PAmp.hh"
33 #include "EvtGenBase/EvtNonresonantAmp.hh"
34 #include "EvtGenBase/EvtFlatAmp.hh"
35 #include "EvtGenBase/EvtLASSAmp.hh"
36 #include "EvtGenBase/EvtPto3PAmpFactory.hh"
37 #include "EvtGenBase/EvtPropBreitWigner.hh"
38 #include "EvtGenBase/EvtPropFlatte.hh"
39 #include "EvtGenBase/EvtPropBreitWignerRel.hh"
40 #include "EvtGenBase/EvtDalitzResPdf.hh"
41 #include "EvtGenBase/EvtDalitzFlatPdf.hh"
43 using namespace EvtCyclic3;
46 void EvtPto3PAmpFactory::processAmp(EvtComplex c, std::vector<std::string> vv, bool conj)
50 printf("Make %samplitude\n",conj ? "CP conjugate" : "");
52 for(i=0;i<vv.size();i++) printf("%s\n",vv[i].c_str());
56 EvtAmplitude<EvtDalitzPoint>* amp = 0;
57 EvtPdf<EvtDalitzPoint>* pdf = 0;
63 Experimental amplitudes
65 if(vv[0] == "PHASESPACE") {
67 pdf = new EvtDalitzFlatPdf(_dp);
68 amp = new EvtFlatAmp<EvtDalitzPoint>();
71 else if (!vv[0].find("NONRES")) {
73 EvtPto3PAmp::NumType typeNRes=EvtPto3PAmp::NONRES;
74 if (vv[0]=="NONRES_LIN") {
75 typeNRes=EvtPto3PAmp::NONRES_LIN;
76 pairRes=strToPair(vv[1].c_str());
78 else if (vv[0]=="NONRES_EXP") {
79 typeNRes=EvtPto3PAmp::NONRES_EXP;
80 pairRes = strToPair(vv[1].c_str());
81 alpha = strtod(vv[2].c_str(),0);
84 pdf = new EvtDalitzFlatPdf(_dp);
85 amp = new EvtNonresonantAmp( &_dp, typeNRes, pairRes, alpha);
87 else if (vv[0]=="LASS") {
88 pairRes = strToPair(vv[1].c_str());
89 double m0 = strtod(vv[2].c_str(),0);
90 double g0 = strtod(vv[3].c_str(),0);
91 double a = strtod(vv[4].c_str(),0);
92 double r = strtod(vv[5].c_str(),0);
93 double cutoff = strtod(vv[6].c_str(),0);
94 pdf = new EvtDalitzResPdf(_dp,m0,g0,pairRes);
95 amp = new EvtLASSAmp( &_dp, pairRes, m0, g0, a, r, cutoff);
101 else if(vv[0] == "RESONANCE") {
102 EvtPto3PAmp* partAmp = 0;
106 pairRes = strToPair(vv[1].c_str());
107 EvtSpinType::spintype spinR;
110 EvtId resId = EvtPDL::getId(vv[2]);
111 if(_verbose) printf("Particles %s form %sresonance %s\n",
112 vv[1].c_str(),vv[2].c_str(), conj ? "(conj) " : "");
114 // If no valid particle name is given, assume that
115 // it is the spin, the mass and the width of the particle.
117 if(resId.getId() == -1) {
119 switch(atoi(vv[2].c_str())) {
121 case 0: { spinR = EvtSpinType::SCALAR; break; }
122 case 1: { spinR = EvtSpinType::VECTOR; break; }
123 case 2: { spinR = EvtSpinType::TENSOR; break; }
124 case 3: { spinR = EvtSpinType::SPIN3; break; }
125 case 4: { spinR = EvtSpinType::SPIN4; break; }
126 default: { assert(0); break; }
129 mR = strtod(vv[3].c_str(),0);
130 gR = strtod(vv[4].c_str(),0);
135 // For a valid particle get spin, mass and width
137 spinR = EvtPDL::getSpinType(resId);
138 mR = EvtPDL::getMeanMass(resId);
139 gR = EvtPDL::getWidth(resId);
142 // It's possible to specify mass and width of a particle
145 if(vv[3] != "ANGULAR") {
148 printf("Setting m(%s)=%s g(%s)=%s\n",
149 vv[2].c_str(),vv[3].c_str(),vv[2].c_str(),vv[4].c_str());
151 mR = strtod(vv[3].c_str(),0);
152 gR = strtod(vv[4].c_str(),0);
159 if(vv[++i] != "ANGULAR") {
161 printf("%s instead of ANGULAR\n",vv[i].c_str());
164 Pair pairAng = strToPair(vv[++i].c_str());
165 if(_verbose) printf("Angle is measured between particles %s\n",vv[i].c_str());
169 assert(vv[++i] == "TYPE");
170 std::string type = vv[++i];
171 if(_verbose) printf("Propagator type %s\n",vv[i].c_str());
175 EvtPropBreitWigner prop(mR,gR);
176 partAmp = new EvtPto3PAmp(_dp,pairAng,pairRes,spinR,prop,EvtPto3PAmp::NBW);
178 else if(type == "RBW_ZEMACH") {
180 EvtPropBreitWignerRel prop(mR,gR);
181 partAmp = new EvtPto3PAmp(_dp,pairAng,pairRes,spinR,prop,EvtPto3PAmp::RBW_ZEMACH);
183 else if(type == "RBW_KUEHN") {
185 EvtPropBreitWignerRel prop(mR,gR);
186 partAmp = new EvtPto3PAmp(_dp,pairAng,pairRes,spinR,prop,EvtPto3PAmp::RBW_KUEHN);
188 else if(type == "RBW_CLEO") {
190 EvtPropBreitWignerRel prop(mR,gR);
191 partAmp = new EvtPto3PAmp(_dp,pairAng,pairRes,spinR,prop,EvtPto3PAmp::RBW_CLEO);
193 else if(type == "FLATTE") {
195 double m1a = _dp.m( first(pairRes) );
196 double m1b = _dp.m( second(pairRes) );
198 double g2 = strtod(vv[++i].c_str(),0);
199 double m2a = strtod(vv[++i].c_str(),0);
200 double m2b = strtod(vv[++i].c_str(),0);
201 EvtPropFlatte prop( mR, gR, m1a, m1b, g2, m2a, m2b );
202 partAmp = new EvtPto3PAmp(_dp,pairAng,pairRes,spinR,prop,EvtPto3PAmp::FLATTE);
206 // Optional DVFF, BVFF stanzas
208 if(i < vv.size() - 1) {
209 if(vv[i+1] == "DVFF") {
211 if(vv[++i] == "BLATTWEISSKOPF") {
213 double R = strtod(vv[++i].c_str(),0);
220 if(i < vv.size() - 1) {
221 if(vv[i+1] == "BVFF") {
223 if(vv[++i] == "BLATTWEISSKOPF") {
225 if(_verbose) printf("BVFF=%s\n",vv[i].c_str());
226 double R = strtod(vv[++i].c_str(),0);
233 const int minwidths=5;
234 //Optional resonance minimum and maximum
235 if(i < vv.size() - 1) {
236 if(vv[i+1] == "CUTOFF") {
238 if(vv[i+1] == "MIN") {
240 double min = strtod(vv[++i].c_str(),0);
241 if(_verbose) std::cout<<"CUTOFF MIN = "<<min<<std::endl;
242 //ensure against cutting off too close to the resonance
243 assert( min<(mR-minwidths*gR) );
244 partAmp->setmin(min);
246 else if (vv[i+1] == "MAX") {
248 double max = strtod(vv[++i].c_str(),0);
249 if(_verbose) std::cout<<"CUTOFF MAX = "<<max<<std::endl;
250 //ensure against cutting off too close to the resonance
251 assert( max>(mR+minwidths*gR) );
252 partAmp->setmax(max);
258 //2nd iteration in case min and max are both specified
259 if(i < vv.size() - 1) {
260 if(vv[i+1] == "CUTOFF") {
262 if(vv[i+1] == "MIN") {
264 double min = strtod(vv[++i].c_str(),0);
265 if(_verbose) std::cout<<"CUTOFF MIN = "<<min<<std::endl;
266 //ensure against cutting off too close to the resonance
267 assert( min<(mR-minwidths*gR) );
268 partAmp->setmin(min);
270 else if (vv[i+1] == "MAX") {
272 double max = strtod(vv[++i].c_str(),0);
273 if(_verbose) std::cout<<"CUTOFF MAX = "<<max<<std::endl;
274 //ensure against cutting off too close to the resonance
275 assert( max>(mR+minwidths*gR) );
276 partAmp->setmax(max);
285 pdf = new EvtDalitzResPdf(_dp,mR,gR,pairRes);
293 _amp->addOwnedTerm(c,amp);
296 _ampConj->addOwnedTerm(c,amp);
299 double scale = matchIsobarCoef(_amp, pdf, pairRes);
300 _pc->addOwnedTerm(abs2(c)*scale,pdf);
302 _names.push_back(name);
305 double EvtPto3PAmpFactory::matchIsobarCoef(EvtAmplitude<EvtDalitzPoint>* amp,
306 EvtPdf<EvtDalitzPoint>* pdf,
307 EvtCyclic3::Pair ipair) {
309 // account for differences in the definition of amplitudes by matching
310 // Integral( c'*pdf ) = Integral( c*|A|^2 )
311 // to improve generation efficiency ...
313 double Ipdf = pdf->compute_integral(10000).value();
317 EvtCyclic3::Pair jpair = EvtCyclic3::next(ipair);
318 EvtCyclic3::Pair kpair = EvtCyclic3::next(jpair);
320 // Trapezoidal integral
323 double di = (_dp.qAbsMax(ipair) - _dp.qAbsMin(ipair))/((double) N);
325 double siMin = _dp.qAbsMin(ipair);
327 double s[3]; // playing with fire
328 for(int i=1; i<N; i++) {
330 s[ipair] = siMin + di*i;
331 s[jpair] = _dp.q(jpair, 0.9999, ipair, s[ipair]);
332 s[kpair] = _dp.bigM()*_dp.bigM() - s[ipair] - s[jpair]
333 + _dp.mA()*_dp.mA() + _dp.mB()*_dp.mB() + _dp.mC()*_dp.mC();
335 EvtDalitzPoint point( _dp.mA(), _dp.mB(), _dp.mC(),
336 s[EvtCyclic3::AB], s[EvtCyclic3::BC], s[EvtCyclic3::CA]);
338 if (!point.isValid()) continue;
340 double p = point.p(other(ipair), ipair);
341 double q = point.p(first(ipair), ipair);
343 double itg = abs2( amp->evaluate(point) )*di*4*q*p;
347 if (_verbose) std::cout << "integral = " << Iamp2 << " pdf="<<Ipdf << std::endl;
349 assert(Ipdf>0 && Iamp2>0);