evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtMultibody.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 
23 #include "EvtGenBase/EvtConst.hh"
24 #include "EvtGenBase/EvtGenKine.hh"
25 #include "EvtGenBase/EvtKine.hh"
26 #include "EvtGenBase/EvtPDL.hh"
28 #include "EvtGenBase/EvtPatches.hh"
29 #include "EvtGenBase/EvtReport.hh"
33 
35 {
36  if ( _decayTree != NULL )
37  delete _decayTree;
38  _decayTree = NULL;
39  if ( _ilist != NULL )
40  delete[] _ilist;
41  _ilist = NULL;
42 }
43 
44 std::string EvtMultibody::getName()
45 {
46  return "D_MULTIBODY";
47 }
48 
50 {
51  return new EvtMultibody;
52 }
53 
55 {
56  int N = getNArg();
57 
58  _decayTree = new EvtMTree( getDaugs(), getNDaug() );
59  _ilist = new int[getNDaug() + 1];
60 
61  for ( int i = 0; i < N - 1; ++i ) {
62  if ( getArgStr( i ) == "RESONANCE" ) {
63  _decayTree->addtree( getArgStr( ++i ) );
64  } else {
65  EvtGenReport( EVTGEN_ERROR, "EvtGen" )
66  << "Syntax error at " << getArgStr( i ) << std::endl;
67  ::abort();
68  }
69  }
70 }
71 
72 // Set the maximum probability amplitude - if function is left blank then the
73 // program will search for it. This however is not deterministic and therefore
74 // in the release cannot be in place.
76 {
77  // setProbMax(1.0);
78 }
79 
81 {
82  // Initialize the phase space before doing anything else!
84 
85  EvtSpinAmp amp = _decayTree->amplitude( p );
86 
87  vector<int> index = amp.iterallowedinit();
88  vector<unsigned int> spins = amp.dims();
89 
90  do {
91  for ( size_t i = 0; i < index.size(); ++i ) {
92  _ilist[i] = index[i] + spins[i];
93  }
94 
95  vertex( _ilist, amp( index ) );
96  } while ( amp.iterateallowed( index ) );
97 }
bool iterateallowed(vector< int > &index) const
Definition: EvtSpinAmp.cpp:442
std::string getArgStr(int j) const
Definition: EvtDecayBase.hh:78
vector< int > iterallowedinit() const
Definition: EvtSpinAmp.cpp:452
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
void initProbMax() override
const vector< unsigned int > & dims() const
Definition: EvtSpinAmp.hh:84
EvtId * getDaugs()
Definition: EvtDecayBase.hh:66
void vertex(const EvtComplex &amp)
Definition: EvtDecayAmp.hh:37
void addtree(const string &)
Definition: EvtMTree.cpp:404
double initializePhaseSpace(unsigned int numdaughter, EvtId *daughters, bool forceResetMasses=false, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
EvtDecayBase * clone() override
int getNDaug() const
Definition: EvtDecayBase.hh:65
void decay(EvtParticle *p) override
std::string getName() override
EvtMTree * _decayTree
Definition: EvtMultibody.hh:46
void init() override
int getNArg() const
Definition: EvtDecayBase.hh:68
EvtSpinAmp amplitude(EvtParticle *) const
Definition: EvtMTree.cpp:437