Page MenuHomeHEPForge

DecayMatrixElement.icc
No OneTemporary

Size
8 KB
Referenced Files
None
Subscribers
None

DecayMatrixElement.icc

// -*- C++ -*-
//
// This is the implementation of the inlined member functions of
// the DecayMatrixElement class.
//
// Author: Peter Richardson
//
namespace Herwig {
using namespace ThePEG;
// default constructor
inline DecayMatrixElement::DecayMatrixElement() {}
// constructor for two body decay
inline DecayMatrixElement::DecayMatrixElement(PDT::Spin in,PDT::Spin out1,PDT::Spin out2)
{
_nout=2; _inspin=in;_outspin.push_back(out1);_outspin.push_back(out2);
setMESize();
}
// constructor for three body decay
inline DecayMatrixElement::DecayMatrixElement(PDT::Spin in,PDT::Spin out1,PDT::Spin out2,
PDT::Spin out3)
{
_nout=3; _inspin=in;_outspin.push_back(out1);_outspin.push_back(out2);
_outspin.push_back(out3);
setMESize();
}
// constructor for four body decay
inline DecayMatrixElement::DecayMatrixElement(PDT::Spin in,PDT::Spin out1,PDT::Spin out2,
PDT::Spin out3,PDT::Spin out4)
{
_nout=4; _inspin=in;_outspin.push_back(out1);_outspin.push_back(out2);
_outspin.push_back(out3);_outspin.push_back(out4);
setMESize();
}
// constructor for five body decay
inline DecayMatrixElement::DecayMatrixElement(PDT::Spin in,PDT::Spin out1,PDT::Spin out2,
PDT::Spin out3,PDT::Spin out4,
PDT::Spin out5)
{
_nout=5; _inspin=in;_outspin.push_back(out1);_outspin.push_back(out2);
_outspin.push_back(out3);_outspin.push_back(out4);_outspin.push_back(out5);
setMESize();
}
// constructor for six body decay
inline DecayMatrixElement::DecayMatrixElement(PDT::Spin in,PDT::Spin out1,PDT::Spin out2,
PDT::Spin out3,PDT::Spin out4,
PDT::Spin out5,PDT::Spin out6)
{
_nout=6; _inspin=in;_outspin.push_back(out1);_outspin.push_back(out2);
_outspin.push_back(out3);_outspin.push_back(out4);_outspin.push_back(out5);
_outspin.push_back(out6);
setMESize();
}
// constructor for arbitary body decay
inline DecayMatrixElement::DecayMatrixElement(PDT::Spin in,vector<PDT::Spin> out)
{_nout=out.size(); _inspin=in;_outspin=out;setMESize();}
// constructor for arbitray body decay
inline DecayMatrixElement::DecayMatrixElement(vector<PDT::Spin> out)
{
_nout=out.size();
_inspin=out[0];
_outspin=vector<PDT::Spin>(out.begin()+1,out.end());
setMESize();
}
// set the size of the vector containing the matrix element
inline void DecayMatrixElement::setMESize()
{
int isize=_inspin;
for(unsigned int ix=0;ix<_outspin.size();++ix){isize*=_outspin[ix];}
// zero the matrix element
_matrixelement.resize(isize,0.);
// set up the constants for the mapping of helicity to vector index
_constants.resize(_outspin.size()+2);
int temp=1;
for(unsigned int ix=_outspin.size();ix>0;--ix)
{
temp*=_outspin[ix-1];_constants[ix]=temp;
}
temp*=_inspin;_constants[0]=temp;
_constants[_outspin.size()+1]=1;
}
// reset the matrix element
inline void DecayMatrixElement::reset(const DecayMatrixElement & x) const
{
_nout = x._nout;
_inspin = x._inspin;
_outspin =x._outspin;
_matrixelement=x._matrixelement;
_constants=x._constants;
}
// get the spins of the incoming particles
inline PDT::Spin DecayMatrixElement::inspin(){return _inspin;}
// get the spins of the outgoing particles
inline vector<PDT::Spin> DecayMatrixElement::outspin(){return _outspin;}
// access a component for a two body decay
inline Complex DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic) const
{
vector<unsigned int> itemp(3);
itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;
return (*this)(itemp);
}
// access a component of a three body decay
inline Complex DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id) const
{
vector<unsigned int> itemp(4);
itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;itemp[3]=id;
return (*this)(itemp);
}
// access a component of a four body decay
inline Complex DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id,
unsigned int ie) const
{
vector<unsigned int> itemp(5);
itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;itemp[3]=id;itemp[4]=ie;
return (*this)(itemp);
}
// access a component of a five body decay
inline Complex DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id,
unsigned int ie,unsigned int ig) const
{
vector<unsigned int> itemp(6);
itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;
itemp[3]=id;itemp[4]=ie;itemp[5]=ig;
return (*this)(itemp);
}
// access a component of a six body decay
inline Complex DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id,
unsigned int ie,unsigned int ig,
unsigned int ih) const
{
vector<unsigned int> itemp(7);
itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;
itemp[3]=id;itemp[4]=ie;itemp[5]=ig;itemp[6]=ih;
return (*this)(itemp);
}
// access a component
inline Complex DecayMatrixElement::operator () (vector<unsigned int> in) const
{
if(in.size()!=_outspin.size()+1)
{
throw ThePEG::Helicity::HelicityConsistencyError()
<< "Requested the components of a " << in.size()-1
<< " body decay but this decay is " << _outspin.size()
<< Exception::abortnow;
return 0.;
}
// contribution for the incoming particle
unsigned int iloc(in[0]*_constants[1]);
// contributions for the outgoing particles
for(unsigned int ix=1;ix<in.size();++ix){iloc+=in[ix]*_constants[ix+1];}
if(iloc>=_matrixelement.size())
{
throw ThePEG::Helicity::HelicityConsistencyError() << "Invalid component of "
<< "decay matrix element "
<< "requested " << iloc
<< Exception::abortnow;
return 0.;
}
return _matrixelement[iloc];
}
// set a component for a two body decay
inline Complex & DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic)
{
vector<unsigned int> itemp(3);itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;
return (*this)(itemp);
}
// set a component of a three body decay
inline Complex & DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id)
{
vector<unsigned int> itemp(4);itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;itemp[3]=id;
return (*this)(itemp);
}
// set a component of a four body decay
inline Complex & DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id,
unsigned int ie)
{
vector<unsigned int> itemp(5);
itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;itemp[3]=id;itemp[4]=ie;
return (*this)(itemp);
}
// set a component of a five body decay
inline Complex & DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id,
unsigned int ie,unsigned int ig)
{
vector<unsigned int> itemp(6);itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;
itemp[3]=id;itemp[4]=ie;itemp[5]=ig;
return (*this)(itemp);
}
// set a component of a six body decay
inline Complex & DecayMatrixElement::operator() (unsigned int ia,unsigned int ib,
unsigned int ic,unsigned int id,
unsigned int ie,unsigned int ig,
unsigned int ih)
{
vector<unsigned int> itemp(7);itemp[0]=ia;itemp[1]=ib;itemp[2]=ic;
itemp[3]=id;itemp[4]=ie;itemp[5]=ig;itemp[6]=ih;
return (*this)(itemp);
}
// set a component
inline Complex & DecayMatrixElement::operator () (vector<unsigned int> in)
{
static Complex dummy=0.;
if(in.size()!=_outspin.size()+1)
{
throw ThePEG::Helicity::HelicityConsistencyError()
<< "Requested the components of a " << in.size()-1
<< " body decay but this decay is " << _outspin.size()
<< Exception::abortnow;
return dummy;
}
// contribution for the incoming particle
unsigned int iloc(in[0]*_constants[1]);
// contributions for the outgoing particles
for(unsigned int ix=1;ix<in.size();++ix){iloc+=in[ix]*_constants[ix+1];}
if(iloc>=_matrixelement.size())
{
throw ThePEG::Helicity::HelicityConsistencyError() << "Invalid component of "
<< "decay matrix element "
<< "requested " << iloc
<< Exception::abortnow;
return dummy;
}
return _matrixelement[iloc];
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Sep 30, 5:42 AM (2 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6413592
Default Alt Text
DecayMatrixElement.icc (8 KB)

Event Timeline