22#include "EvtGenBase/EvtPatches.hh"
23#include "EvtGenBase/EvtPatches.hh"
24#include "EvtGenBase/EvtParticle.hh"
25#include "EvtGenBase/EvtStringParticle.hh"
26#include "EvtGenBase/EvtDecayTable.hh"
27#include "EvtGenBase/EvtPDL.hh"
28#include "EvtGenModels/EvtTauola.hh"
29#include "EvtGenBase/EvtReport.hh"
30#include "EvtGenBase/EvtDecayBase.hh"
32#include "EvtGenBase/EvtId.hh"
44using std::resetiosflags;
45using std::setiosflags;
49int EvtTauola::ntauoladecays=0;
51int EvtTauola::ntable=0;
53int EvtTauola::ncommand=0;
54int EvtTauola::lcommand=0;
55std::string* EvtTauola::commands=0;
59 extern void dectes_(
int *,
int *,
int *,
int *,
int *,
60 double *,
double *,
double *,
double *);
74 if (ntauoladecays==0) {
80 for(i=0;i<ntauoladecays;i++){
81 if (tauoladecays[i]==
this){
82 tauoladecays[i]=tauoladecays[ntauoladecays-1];
84 if (ntauoladecays==0) {
92 report(
ERROR,
"EvtGen") <<
"Error in destroying Tauola model!"<<endl;
124 report(
ERROR,
"EvtGen") <<
"EvtTauola finds that you are decaying the"<<endl
125 <<
" aliased particle "
127 <<
" with the Tauola model"<<endl
128 <<
" this does not work, please modify decay table."
130 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
143 return std::string(
"TauolaPar");
149 if (ncommand==lcommand){
151 lcommand=10+2*lcommand;
153 std::string* newcommands=
new std::string[lcommand];
157 for(i=0;i<ncommand;i++){
158 newcommands[i]=commands[i];
163 commands=newcommands;
167 commands[ncommand]=cmd;
177 static int iniflag=0;
198 EvtId evtnumstable[20],evtnumparton[20];
199 int stableindex[20],partonindex[20];
205 static double px[20],py[20],pz[20],e[20];
208 if (iniflag==0)
dectes_(&iniflag,&idtau,&ndaugjs,kf,km,px,py,pz,e);
217 dectes_(&iniflag,&idtau,&ndaugjs,kf,km,px,py,pz,e);
222 for(i=0;i<ndaugjs;i++){
226 report(
ERROR,
"EvtGen") <<
"Tauola returned particle:"<<kf[i]<<endl;
227 report(
ERROR,
"EvtGen") <<
"This can not be translated to evt number"<<endl;
228 report(
ERROR,
"EvtGen") <<
"and the decay will be rejected!"<<endl;
229 report(
ERROR,
"EvtGen") <<
"The decay was of particle:"<<idtau<<endl;
234 if (
abs(kf[i])<=6||kf[i]==21){
235 partonindex[numparton]=i;
240 stableindex[numstable]=i;
250 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
252 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000001;
256 p4[i].
set(e[i],px[i],py[i],pz[i]);
269 }
while( more && (
count<10000) );
272 report(
INFO,
"EvtGen") <<
"Too many loops in EvtTauola!!!"<<endl;
274 for(i=0;i<numstable;i++){
286 for(i=0;i<numstable;i++){
287 p->
getDaug(i)->
init(evtnumstable[i],p4[stableindex[i]]);
290 if ( ndaugFound == 0 ) {
291 report(
ERROR,
"EvtGen") <<
"Tauola has failed to do a decay ";
307 for(i=0;i<numparton;i++){
308 p4string+=p4[partonindex[i]];
313 for(i=0;i<numstable;i++){
314 if (km[stableindex[i]]==0){
315 type[nprimary++]=evtnumstable[i];
325 for(i=0;i<numparton;i++){
326 p4partons[i]=p4[partonindex[i]];
335 for(i=0;i<numstable;i++){
337 if (km[stableindex[i]]==0){
338 p->
getDaug(nprimary++)->
init(evtnumstable[i],p4[stableindex[i]]);
344 for(i=0;i<numstable;i++){
345 if (km[stableindex[i]]!=0){
346 type[nsecond++]=evtnumstable[i];
353 EvtVector4R p4stringboost(p4string.get(0),-p4string.get(1),
354 -p4string.get(2),-p4string.get(3));
357 for(i=0;i<numstable;i++){
358 if (km[stableindex[i]]!=0){
359 p4[stableindex[i]]=
boostTo(p4[stableindex[i]],p4stringboost);
367 if ( nsecond == 0 ) {
368 report(
ERROR,
"EvtGen") <<
"Jetset has failed to do a decay ";
392 for(i=0;i<ndaug;i++){
408 double beta=acos(p4Psi.
get(3)/p4Psi.
d3mag());
421 if (ntauoladecays==ntable){
425 for(i=0;i<ntable;i++){
426 newtauoladecays[i]=tauoladecays[i];
429 delete [] tauoladecays;
430 tauoladecays=newtauoladecays;
433 tauoladecays[ntauoladecays++]=jsdecay;
void dectes_(int *, int *, int *, int *, int *, double *, double *, double *, double *)
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
ostream & report(Severity severity, const char *facility)
DOUBLE_PRECISION count[3]
void dectes_(int *, int *, int *, int *, int *, double *, double *, double *, double *)
void setDaughterSpinDensity(int daughter)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static int getStdHep(EvtId id)
static EvtId evtIdFromStdHep(int stdhep)
static std::string name(EvtId i)
static EvtId getId(const std::string &name)
void setSpinDensityForwardHelicityBasis(const EvtSpinDensity &rho)
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void setDiagonalSpinDensity()
const EvtVector4R & getP4() const
EvtParticle * getDaug(int i)
void deleteDaughters(bool keepChannel=false)
void Set(int i, int j, const EvtComplex &rhoij)
std::string commandName()
void getName(std::string &name)
void command(std::string cmd)
void decay(EvtParticle *p)
void set(int i, double d)