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
EvtDalitzTable.cpp
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
22
25#include "EvtGenBase/EvtPDL.hh"
29
30#include <sstream>
31#include <stdlib.h>
32
33using std::endl;
34using std::fstream;
35using std::ifstream;
36
42
48
49const EvtDalitzTable& EvtDalitzTable::getInstance( const std::string dec_name,
50 bool verbose )
51{
52 static thread_local EvtDalitzTable theDalitzTable;
53
54 if ( !theDalitzTable.fileHasBeenRead( dec_name ) ) {
55 theDalitzTable.readXMLDecayFile( dec_name, verbose );
56 }
57
58 return theDalitzTable;
59}
60
61bool EvtDalitzTable::fileHasBeenRead( const std::string dec_name ) const
62{
63 std::vector<std::string>::const_iterator i = m_readFiles.begin();
64 for ( ; i != m_readFiles.end(); i++ ) {
65 if ( ( *i ).compare( dec_name ) == 0 ) {
66 return true;
67 }
68 }
69 return false;
70}
71
72void EvtDalitzTable::readXMLDecayFile( const std::string dec_name, bool verbose )
73{
74 if ( verbose ) {
75 EvtGenReport( EVTGEN_INFO, "EvtGen" )
76 << "EvtDalitzTable: Reading in xml parameter file " << dec_name
77 << endl;
78 }
79
80 m_readFiles.push_back( dec_name );
81
82 EvtDalitzDecayInfo* dalitzDecay = nullptr;
83 double probMax = 0;
84 EvtId ipar;
85 std::string decayParent = "";
86 std::string daugStr = "";
87 EvtId daughter[3];
88
90 EvtComplex cAmp;
91 std::vector<std::pair<EvtCyclic3::Pair, EvtCyclic3::Pair>> angAndResPairs;
92 std::string shape( "" );
94 double mass( 0. ), width( 0. ), FFp( 0. ), FFr( 0. );
95 std::vector<EvtFlatteParam> flatteParams;
96 //Nonres parameters
97 double alpha( 0. );
98 //LASS parameters
99 double aLass( 0. ), rLass( 0. ), BLass( 0. ), phiBLass( 0. ), RLass( 0. ),
100 phiRLass( 0. ), cutoffLass( -1. );
101
102 EvtParserXml parser;
103 parser.open( dec_name );
104
105 bool endReached = false;
106
107 while ( parser.readNextTag() ) {
108 //TAGS FOUND UNDER DATA
109 if ( parser.getParentTagTitle() == "data" ) {
110 if ( parser.getTagTitle() == "dalitzDecay" ) {
111 int nDaughters = 0;
112
113 decayParent = parser.readAttribute( "particle" );
114 daugStr = parser.readAttribute( "daughters" );
115 probMax = parser.readAttributeDouble( "probMax", -1 );
116
117 checkParticle( decayParent );
118 ipar = EvtPDL::getId( decayParent );
119
120 std::istringstream daugStream( daugStr );
121
122 std::string daugh;
123 while ( std::getline( daugStream, daugh, ' ' ) ) {
124 checkParticle( daugh );
125 daughter[nDaughters++] = EvtPDL::getId( daugh );
126 }
127
128 if ( nDaughters != 3 ) {
129 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
130 << "Expected to find three daughters for dalitzDecay of "
131 << decayParent << " near line "
132 << parser.getLineNumber() << ", "
133 << "found " << nDaughters << endl;
134 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
135 << "Will terminate execution!" << endl;
136 ::abort();
137 }
138
139 double m_d1 = EvtPDL::getMass( daughter[0] ),
140 m_d2 = EvtPDL::getMass( daughter[1] ),
141 m_d3 = EvtPDL::getMass( daughter[2] ),
142 M = EvtPDL::getMass( ipar );
143
144 dp = EvtDalitzPlot( m_d1, m_d2, m_d3, M );
145
146 dalitzDecay = new EvtDalitzDecayInfo( daughter[0], daughter[1],
147 daughter[2] );
148
149 } else if ( parser.getTagTitle() == "copyDalitz" ) {
150 int nDaughters = 0;
151 int nCopyDaughters = 0;
152 EvtId copyDaughter[3];
153
154 decayParent = parser.readAttribute( "particle" );
155 daugStr = parser.readAttribute( "daughters" );
156
157 std::string copyParent = parser.readAttribute( "copy" );
158 std::string copyDaugStr = parser.readAttribute( "copyDaughters" );
159
160 checkParticle( decayParent );
161 ipar = EvtPDL::getId( decayParent );
162
163 checkParticle( copyParent );
164 EvtId copypar = EvtPDL::getId( copyParent );
165
166 std::istringstream daugStream( daugStr );
167 std::istringstream copyDaugStream( copyDaugStr );
168
169 std::string daugh;
170 while ( std::getline( daugStream, daugh, ' ' ) ) {
171 checkParticle( daugh );
172 daughter[nDaughters++] = EvtPDL::getId( daugh );
173 }
174 while ( std::getline( copyDaugStream, daugh, ' ' ) ) {
175 checkParticle( daugh );
176 copyDaughter[nCopyDaughters++] = EvtPDL::getId( daugh );
177 }
178
179 if ( nDaughters != 3 || nCopyDaughters != 3 ) {
180 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
181 << "Expected to find three daughters for copyDecay of "
182 << decayParent << " from " << copyParent
183 << " near line " << parser.getLineNumber() << ", "
184 << "found " << nDaughters << " and " << nCopyDaughters
185 << endl;
186 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
187 << "Will terminate execution!" << endl;
188 ::abort();
189 }
190
191 copyDecay( ipar, daughter, copypar, copyDaughter );
192
193 } else if ( parser.getTagTitle() == "/data" ) { //end of data
194 endReached = true;
195 parser.close();
196 break;
197 }
198 //TAGS FOUND UNDER DALITZDECAY
199 } else if ( parser.getParentTagTitle() == "dalitzDecay" ) {
200 if ( parser.getTagTitle() == "resonance" ) {
201 flatteParams.clear();
202
203 //Amplitude
204 EvtComplex ampFactor(
205 parser.readAttributeDouble( "ampFactorReal", 1. ),
206 parser.readAttributeDouble( "ampFactorImag", 0. ) );
207 double mag = parser.readAttributeDouble( "mag", -999. );
208 double phase = parser.readAttributeDouble( "phase", -999. );
209 double real = parser.readAttributeDouble( "real", -999. );
210 double imag = parser.readAttributeDouble( "imag", -999. );
211
212 if ( ( real != -999. || imag != -999. ) && mag == -999. &&
213 phase == -999. ) {
214 if ( real == -999. ) {
215 real = 0;
216 }
217 if ( imag == -999. ) {
218 imag = 0;
219 }
220 mag = sqrt( real * real + imag * imag );
221 phase = atan2( imag, real ) * EvtConst::radToDegrees;
222 }
223 if ( mag == -999. ) {
224 mag = 1.;
225 }
226 if ( phase == -999. ) {
227 phase = 0.;
228 }
229
230 cAmp = ampFactor *
231 EvtComplex( cos( phase * 1.0 / EvtConst::radToDegrees ),
232 sin( phase * 1.0 / EvtConst::radToDegrees ) ) *
233 mag;
234
235 //Resonance particle properties
236 mass = 0.;
237 width = 0.;
238 spinType = EvtSpinType::SCALAR;
239
240 std::string particle = parser.readAttribute( "particle" );
241 if ( particle != "" ) {
242 EvtId resId = EvtPDL::getId( particle );
243 if ( resId == EvtId( -1, -1 ) ) {
244 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
245 << "Unknown particle name:" << particle.c_str()
246 << endl;
247 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
248 << "Will terminate execution!" << endl;
249 ::abort();
250 } else {
251 mass = EvtPDL::getMeanMass( resId );
252 width = EvtPDL::getWidth( resId );
253 spinType = EvtPDL::getSpinType( resId );
254 }
255 }
256
257 width = parser.readAttributeDouble( "width", width );
258 mass = parser.readAttributeDouble( "mass", mass );
259 switch ( parser.readAttributeInt( "spin", -1 ) ) {
260 case -1: //not set here
261 break;
262 case 0:
263 spinType = EvtSpinType::SCALAR;
264 break;
265 case 1:
266 spinType = EvtSpinType::VECTOR;
267 break;
268 case 2:
269 spinType = EvtSpinType::TENSOR;
270 break;
271 default:
272 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
273 << "Unsupported spin near line "
274 << parser.getLineNumber() << " of XML file." << endl;
275 ::abort();
276 }
277
278 //Shape and form factors
279 shape = parser.readAttribute( "shape" );
280 FFp = parser.readAttributeDouble( "BlattWeisskopfFactorParent",
281 0.0 );
282 FFr = parser.readAttributeDouble( "BlattWeisskopfFactorResonance",
283 1.5 );
284
285 //Shape specific attributes
286 if ( shape == "NonRes_Exp" ) {
287 alpha = parser.readAttributeDouble( "alpha", 0.0 );
288 }
289 if ( shape == "LASS" ) {
290 aLass = parser.readAttributeDouble( "a", 2.07 );
291 rLass = parser.readAttributeDouble( "r", 3.32 );
292 BLass = parser.readAttributeDouble( "B", 1.0 );
293 phiBLass = parser.readAttributeDouble( "phiB", 0.0 );
294 RLass = parser.readAttributeDouble( "R", 1.0 );
295 phiRLass = parser.readAttributeDouble( "phiR", 0.0 );
296 cutoffLass = parser.readAttributeDouble( "cutoff", -1.0 );
297 }
298
299 //Daughter pairs for resonance
300 angAndResPairs.clear();
301
302 std::string resDaugStr = parser.readAttribute( "resDaughters" );
303 if ( resDaugStr != "" ) {
304 std::istringstream resDaugStream( resDaugStr );
305 std::string resDaug;
306 int nResDaug( 0 );
307 EvtId resDaughter[2];
308 while ( std::getline( resDaugStream, resDaug, ' ' ) ) {
309 checkParticle( resDaug );
310 resDaughter[nResDaug++] = EvtPDL::getId( resDaug );
311 }
312 if ( nResDaug != 2 ) {
313 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
314 << "Resonance must have exactly 2 daughters near line "
315 << parser.getLineNumber() << " of XML file." << endl;
316 ::abort();
317 }
318 int nRes = getDaughterPairs( resDaughter, daughter,
319 angAndResPairs );
320 if ( nRes == 0 ) {
321 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
322 << "Resonance daughters must match decay daughters near line "
323 << parser.getLineNumber() << " of XML file." << endl;
324 ::abort();
325 }
326 if ( parser.readAttributeBool( "normalise", true ) )
327 cAmp /= sqrt( nRes );
328 }
329 if ( angAndResPairs.empty() ) {
330 switch ( parser.readAttributeInt( "daughterPair" ) ) {
331 case 1:
332 angAndResPairs.push_back(
333 std::make_pair( EvtCyclic3::BC, EvtCyclic3::AB ) );
334 break;
335 case 2:
336 angAndResPairs.push_back(
337 std::make_pair( EvtCyclic3::CA, EvtCyclic3::BC ) );
338 break;
339 case 3:
340 angAndResPairs.push_back(
341 std::make_pair( EvtCyclic3::AB, EvtCyclic3::CA ) );
342 break;
343 default:
344 if ( shape ==
345 "NonRes" ) { //We don't expect a pair for non-resonant terms but add dummy values for convenience
346 angAndResPairs.push_back( std::make_pair(
348 break;
349 }
350 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
351 << "Daughter pair must be 1, 2 or 3 near line "
352 << parser.getLineNumber() << " of XML file."
353 << endl;
354 ::abort();
355 }
356 }
357
358 if ( parser.isTagInline() ) {
359 std::vector<std::pair<EvtCyclic3::Pair, EvtCyclic3::Pair>>::iterator
360 it = angAndResPairs.begin();
361 for ( ; it != angAndResPairs.end(); it++ ) {
362 std::pair<EvtCyclic3::Pair, EvtCyclic3::Pair> pairs = *it;
363 EvtDalitzReso resonance = getResonance(
364 shape, dp, pairs.first, pairs.second, spinType,
365 mass, width, FFp, FFr, alpha, aLass, rLass, BLass,
366 phiBLass, RLass, phiRLass, cutoffLass );
367 dalitzDecay->addResonance( cAmp, resonance );
368 }
369 }
370 } else if ( parser.getTagTitle() == "/dalitzDecay" ) {
371 if ( probMax < 0 ) {
372 EvtGenReport( EVTGEN_INFO, "EvtGen" )
373 << "probMax is not defined for " << decayParent
374 << " -> " << daugStr << endl;
375 EvtGenReport( EVTGEN_INFO, "EvtGen" )
376 << "Will now estimate probMax. This may take a while. Once probMax is calculated, update the XML file to skip this step in future."
377 << endl;
378 probMax = calcProbMax( dp, dalitzDecay );
379 }
380 dalitzDecay->setProbMax( probMax );
381 addDecay( ipar, *dalitzDecay );
382 delete dalitzDecay;
383 dalitzDecay = nullptr;
384 } else if ( verbose ) {
385 EvtGenReport( EVTGEN_INFO, "EvtGen" )
386 << "Unexpected tag " << parser.getTagTitle()
387 << " found in XML decay file near line "
388 << parser.getLineNumber() << ". Tag will be ignored."
389 << endl;
390 }
391 //TAGS FOUND UNDER RESONANCE
392 } else if ( parser.getParentTagTitle() == "resonance" ) {
393 if ( parser.getTagTitle() == "flatteParam" ) {
394 EvtFlatteParam param( parser.readAttributeDouble( "mass1" ),
395 parser.readAttributeDouble( "mass2" ),
396 parser.readAttributeDouble( "g" ) );
397 flatteParams.push_back( param );
398 } else if ( parser.getTagTitle() == "/resonance" ) {
399 std::vector<std::pair<EvtCyclic3::Pair, EvtCyclic3::Pair>>::iterator
400 it = angAndResPairs.begin();
401 for ( ; it != angAndResPairs.end(); it++ ) {
402 std::pair<EvtCyclic3::Pair, EvtCyclic3::Pair> pairs = *it;
403 EvtDalitzReso resonance = getResonance(
404 shape, dp, pairs.first, pairs.second, spinType, mass,
405 width, FFp, FFr, alpha, aLass, rLass, BLass, phiBLass,
406 RLass, phiRLass, cutoffLass );
407
408 std::vector<EvtFlatteParam>::iterator flatteIt =
409 flatteParams.begin();
410 for ( ; flatteIt != flatteParams.end(); flatteIt++ ) {
411 resonance.addFlatteParam( ( *flatteIt ) );
412 }
413
414 dalitzDecay->addResonance( cAmp, resonance );
415 }
416 }
417 }
418 }
419
420 if ( !endReached ) {
421 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
422 << "Either the decay file ended prematurely or the file is badly formed.\n"
423 << "Error occured near line" << parser.getLineNumber() << endl;
424 ::abort();
425 }
426}
427
428void EvtDalitzTable::checkParticle( std::string particle ) const
429{
430 if ( EvtPDL::getId( particle ) == EvtId( -1, -1 ) ) {
431 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
432 << "Unknown particle name:" << particle.c_str() << endl;
433 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
434 << "Will terminate execution!" << endl;
435 ::abort();
436 }
437}
438
440{
441 if ( m_dalitztable.find( parent ) != m_dalitztable.end() ) {
442 m_dalitztable[parent].push_back( dec );
443 } else {
444 m_dalitztable[parent].push_back( dec );
445 }
446}
447
448void EvtDalitzTable::copyDecay( EvtId parent, EvtId* daughters, EvtId copy,
449 EvtId* copyd )
450{
451 EvtDalitzDecayInfo decay( daughters[0], daughters[1], daughters[2] );
452 std::vector<EvtDalitzDecayInfo> copyTable = getDalitzTable( copy );
453 std::vector<EvtDalitzDecayInfo>::iterator i = copyTable.begin();
454 for ( ; i != copyTable.end(); i++ ) {
455 EvtId daughter1 = ( *i ).daughter1();
456 EvtId daughter2 = ( *i ).daughter2();
457 EvtId daughter3 = ( *i ).daughter3();
458
459 if ( ( copyd[0] == daughter1 && copyd[1] == daughter2 &&
460 copyd[2] == daughter3 ) ||
461 ( copyd[0] == daughter1 && copyd[1] == daughter3 &&
462 copyd[2] == daughter2 ) ||
463 ( copyd[0] == daughter2 && copyd[1] == daughter1 &&
464 copyd[2] == daughter3 ) ||
465 ( copyd[0] == daughter2 && copyd[1] == daughter3 &&
466 copyd[2] == daughter1 ) ||
467 ( copyd[0] == daughter3 && copyd[1] == daughter1 &&
468 copyd[2] == daughter2 ) ||
469 ( copyd[0] == daughter3 && copyd[1] == daughter2 &&
470 copyd[2] == daughter1 ) ) {
471 decay.setProbMax( ( *i ).getProbMax() );
472 std::vector<std::pair<EvtComplex, EvtDalitzReso>>::const_iterator j =
473 ( *i ).getResonances().begin();
474 for ( ; j != ( *i ).getResonances().end(); j++ ) {
475 decay.addResonance( ( *j ) );
476 }
477 addDecay( parent, decay );
478 return;
479 }
480 }
481 //if we get here then there was no match
482 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
483 << "Did not find dalitz decays for particle:" << copy << "\n";
484}
485
486std::vector<EvtDalitzDecayInfo> EvtDalitzTable::getDalitzTable(
487 const EvtId& parent ) const
488{
489 std::vector<EvtDalitzDecayInfo> table;
490
491 auto iter = m_dalitztable.find( parent );
492 if ( iter != m_dalitztable.end() ) {
493 table = iter->second;
494 }
495
496 if ( table.empty() ) {
497 EvtGenReport( EVTGEN_ERROR, "EvtGen" )
498 << "Did not find dalitz decays for particle:" << parent << "\n";
499 }
500
501 return table;
502}
503
505 std::string shape, EvtDalitzPlot dp, EvtCyclic3::Pair angPair,
506 EvtCyclic3::Pair resPair, EvtSpinType::spintype spinType, double mass,
507 double width, double FFp, double FFr, double alpha, double aLass,
508 double rLass, double BLass, double phiBLass, double RLass, double phiRLass,
509 double cutoffLass )
510{
511 if ( shape == "RBW" || shape == "RBW_CLEO" ) {
512 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
513 EvtDalitzReso::RBW_CLEO, FFp, FFr );
514 } else if ( shape == "RBW_CLEO_ZEMACH" ) {
515 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
517 } else if ( shape == "GS" || shape == "GS_CLEO" ) {
518 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
519 EvtDalitzReso::GS_CLEO, FFp, FFr );
520 } else if ( shape == "GS_CLEO_ZEMACH" ) {
521 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
523 } else if ( shape == "GAUSS" || shape == "GAUSS_CLEO" ) {
524 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
525 EvtDalitzReso::GAUSS_CLEO, FFp, FFr );
526 } else if ( shape == "GAUSS_CLEO_ZEMACH" ) {
527 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
529 } else if ( shape == "Flatte" ) {
530 return EvtDalitzReso( dp, resPair, mass );
531 } else if ( shape == "LASS" ) {
532 return EvtDalitzReso( dp, resPair, mass, width, aLass, rLass, BLass,
533 phiBLass, RLass, phiRLass, cutoffLass, true );
534 } else if ( shape == "NonRes" ) {
535 return EvtDalitzReso();
536 } else if ( shape == "NonRes_Linear" ) {
537 return EvtDalitzReso( dp, resPair, EvtDalitzReso::NON_RES_LIN );
538 } else if ( shape == "NonRes_Exp" ) {
539 return EvtDalitzReso( dp, resPair, EvtDalitzReso::NON_RES_EXP, alpha );
540 } else { //NBW
541 if ( shape != "NBW" )
542 EvtGenReport( EVTGEN_WARNING, "EvtGen" )
543 << "EvtDalitzTable: shape " << shape
544 << " is unknown. Defaulting to NBW." << endl;
545 return EvtDalitzReso( dp, angPair, resPair, spinType, mass, width,
546 EvtDalitzReso::NBW, FFp, FFr );
547 }
548}
549
551 EvtId* resDaughter, EvtId* daughter,
552 std::vector<std::pair<EvtCyclic3::Pair, EvtCyclic3::Pair>>& angAndResPairs )
553{
554 int n( 0 );
555 if ( resDaughter[0] == daughter[0] && resDaughter[1] == daughter[1] ) {
556 angAndResPairs.push_back(
557 std::make_pair( EvtCyclic3::BC, EvtCyclic3::AB ) );
558 n++;
559 } else if ( resDaughter[0] == daughter[1] && resDaughter[1] == daughter[0] ) {
560 angAndResPairs.push_back(
561 std::make_pair( EvtCyclic3::CA, EvtCyclic3::AB ) );
562 n++;
563 }
564
565 if ( resDaughter[0] == daughter[1] && resDaughter[1] == daughter[2] ) {
566 angAndResPairs.push_back(
567 std::make_pair( EvtCyclic3::CA, EvtCyclic3::BC ) );
568 n++;
569 } else if ( resDaughter[0] == daughter[2] && resDaughter[1] == daughter[1] ) {
570 angAndResPairs.push_back(
571 std::make_pair( EvtCyclic3::AB, EvtCyclic3::BC ) );
572 n++;
573 }
574
575 if ( resDaughter[0] == daughter[2] && resDaughter[1] == daughter[0] ) {
576 angAndResPairs.push_back(
577 std::make_pair( EvtCyclic3::AB, EvtCyclic3::CA ) );
578 n++;
579 } else if ( resDaughter[0] == daughter[0] && resDaughter[1] == daughter[2] ) {
580 angAndResPairs.push_back(
581 std::make_pair( EvtCyclic3::BC, EvtCyclic3::CA ) );
582 n++;
583 }
584
585 return n;
586}
587
589{
590 double factor = 1.2; //factor to increase our final answer by
591 int nStep( 1000 ); //number of steps - total points will be 3*nStep*nStep
592
593 double maxProb( 0 );
594 double min( 0 ), max( 0 ), step( 0 ), min2( 0 ), max2( 0 ), step2( 0 );
595
596 //first do AB, BC
597 min = dp.qAbsMin( EvtCyclic3::AB );
598 max = dp.qAbsMax( EvtCyclic3::AB );
599 step = ( max - min ) / nStep;
600 for ( int i = 0; i < nStep; ++i ) {
601 double qAB = min + i * step;
602 min2 = dp.qMin( EvtCyclic3::BC, EvtCyclic3::AB, qAB );
603 max2 = dp.qMax( EvtCyclic3::BC, EvtCyclic3::AB, qAB );
604 step2 = ( max2 - min2 ) / nStep;
605 for ( int j = 0; j < nStep; ++j ) {
606 double qBC = min2 + j * step2;
607 EvtDalitzCoord coord( EvtCyclic3::AB, qAB, EvtCyclic3::BC, qBC );
608 EvtDalitzPoint point( dp, coord );
609 double prob = calcProb( point, model );
610 if ( prob > maxProb )
611 maxProb = prob;
612 }
613 }
614
615 //next do BC, CA
616 min = dp.qAbsMin( EvtCyclic3::BC );
617 max = dp.qAbsMax( EvtCyclic3::BC );
618 step = ( max - min ) / nStep;
619 for ( int i = 0; i < nStep; ++i ) {
620 double qBC = min + i * step;
621 min2 = dp.qMin( EvtCyclic3::CA, EvtCyclic3::BC, qBC );
622 max2 = dp.qMax( EvtCyclic3::CA, EvtCyclic3::BC, qBC );
623 step2 = ( max2 - min2 ) / nStep;
624 for ( int j = 0; j < nStep; ++j ) {
625 double qCA = min2 + j * step2;
626 EvtDalitzCoord coord( EvtCyclic3::BC, qBC, EvtCyclic3::CA, qCA );
627 EvtDalitzPoint point( dp, coord );
628 double prob = calcProb( point, model );
629 if ( prob > maxProb )
630 maxProb = prob;
631 }
632 }
633
634 //finally do CA, AB
635 min = dp.qAbsMin( EvtCyclic3::CA );
636 max = dp.qAbsMax( EvtCyclic3::CA );
637 step = ( max - min ) / nStep;
638 for ( int i = 0; i < nStep; ++i ) {
639 double qCA = min + i * step;
640 min2 = dp.qMin( EvtCyclic3::AB, EvtCyclic3::CA, qCA );
641 max2 = dp.qMax( EvtCyclic3::AB, EvtCyclic3::CA, qCA );
642 step2 = ( max2 - min2 ) / nStep;
643 for ( int j = 0; j < nStep; ++j ) {
644 double qAB = min2 + j * step2;
645 EvtDalitzCoord coord( EvtCyclic3::CA, qCA, EvtCyclic3::AB, qAB );
646 EvtDalitzPoint point( dp, coord );
647 double prob = calcProb( point, model );
648 if ( prob > maxProb )
649 maxProb = prob;
650 }
651 }
652 EvtGenReport( EVTGEN_INFO, "EvtGen" )
653 << "Largest probability found was " << maxProb << endl;
654 EvtGenReport( EVTGEN_INFO, "EvtGen" )
655 << "Setting probMax to " << factor * maxProb << endl;
656 return factor * maxProb;
657}
658
660{
661 std::vector<std::pair<EvtComplex, EvtDalitzReso>> resonances =
662 model->getResonances();
663
664 EvtComplex amp( 0, 0 );
665 std::vector<std::pair<EvtComplex, EvtDalitzReso>>::iterator i =
666 resonances.begin();
667 for ( ; i != resonances.end(); i++ ) {
668 std::pair<EvtComplex, EvtDalitzReso> res = ( *i );
669 amp += res.first * res.second.evaluate( point );
670 }
671 return abs2( amp );
672}
double imag(const EvtComplex &c)
double real(const EvtComplex &c)
double abs2(const EvtComplex &c)
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_INFO
Definition EvtReport.hh:52
@ EVTGEN_WARNING
Definition EvtReport.hh:50
@ EVTGEN_ERROR
Definition EvtReport.hh:49
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
static const double radToDegrees
Definition EvtConst.hh:28
const std::vector< std::pair< EvtComplex, EvtDalitzReso > > & getResonances() const
void addResonance(EvtComplex amp, EvtDalitzReso res)
void setProbMax(double probMax)
double qAbsMin(EvtCyclic3::Pair i) const
double qMin(EvtCyclic3::Pair i, EvtCyclic3::Pair j, double q) const
double qAbsMax(EvtCyclic3::Pair i) const
double qMax(EvtCyclic3::Pair i, EvtCyclic3::Pair j, double q) const
void addFlatteParam(const EvtFlatteParam &param)
std::map< EvtId, std::vector< EvtDalitzDecayInfo > > m_dalitztable
double calcProbMax(EvtDalitzPlot dp, EvtDalitzDecayInfo *model)
std::vector< EvtDalitzDecayInfo > getDalitzTable(const EvtId &parent) const
void addDecay(EvtId parent, const EvtDalitzDecayInfo &dec)
void copyDecay(EvtId parent, EvtId *daughters, EvtId copy, EvtId *copyd)
double calcProb(EvtDalitzPoint point, EvtDalitzDecayInfo *model)
std::vector< std::string > m_readFiles
bool fileHasBeenRead(const std::string dec_name) const
void checkParticle(std::string particle) const
EvtDalitzReso getResonance(std::string shape, EvtDalitzPlot dp, EvtCyclic3::Pair angPair, EvtCyclic3::Pair resPair, EvtSpinType::spintype spinType, double mass, double width, double FFp, double FFr, double alpha, double aLass, double rLass, double BLass, double phiBLass, double RLass, double phiRLass, double cutoffLass)
int getDaughterPairs(EvtId *resDaughter, EvtId *daughter, std::vector< std::pair< EvtCyclic3::Pair, EvtCyclic3::Pair > > &angAndResPairs)
static const EvtDalitzTable & getInstance(const std::string dec_name="", bool verbose=true)
void readXMLDecayFile(const std::string dec_name, bool verbose=true)
Definition EvtId.hh:27
static double getWidth(EvtId i)
Definition EvtPDL.cpp:346
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.cpp:371
static double getMass(EvtId i)
Definition EvtPDL.cpp:311
static double getMeanMass(EvtId i)
Definition EvtPDL.cpp:306
static EvtId getId(const std::string &name)
Definition EvtPDL.cpp:283
std::string readAttribute(std::string attribute, std::string defaultValue="")
bool open(std::string filename)
int getLineNumber()
double readAttributeDouble(std::string attribute, double defaultValue=-1.)
bool readAttributeBool(std::string attribute, bool defaultValue=false)
std::string getParentTagTitle()
std::string getTagTitle()
int readAttributeInt(std::string attribute, int defaultValue=-1)
bool isTagInline()