43using std::resetiosflags;
44using std::setiosflags;
48int EvtLunda::nlundadecays=0;
50int EvtLunda::ntable=0;
52int EvtLunda::ncommand=0;
53int EvtLunda::lcommand=0;
54std::string* EvtLunda::commands=0;
59 extern void lundar_(
int *,
int *,
float *,
int *,
int *,
int *,
60 double *,
double *,
double *,
double *);
68 extern void lugive_(
const char *cnfgstr,
int length);
94 if (nlundadecays==0) {
100 for(i=0;i<nlundadecays;i++){
101 if (lundadecays[i]==
this){
102 lundadecays[i]=lundadecays[nlundadecays-1];
104 if (nlundadecays==0) {
112 report(
ERROR,
"EvtGen") <<
"Error in destroying Lunda model!"<<endl;
140 std::string strpdg=getenv(
"BESEVTGENROOT");
141 strpdg +=
"/share/r_pdg.dat";
143 std::cout<<
"mypdg= "<<strpdg<<std::endl;
145 if(
getNArg()>2){std::cout<<
"Parameter can be 1 or 2, You have "<<
getNArg()<<std::endl; ::abort();}
149 report(
ERROR,
"EvtGen") <<
"EvtLunda finds that you are decaying the"<<endl
150 <<
" aliased particle "
152 <<
" with the Lunda model"<<endl
153 <<
" this does not work, please modify decay table."
155 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
167 return std::string(
"LundaPar");
173 if (ncommand==lcommand){
175 lcommand=10+2*lcommand;
177 std::string* newcommands=
new std::string[lcommand];
181 for(i=0;i<ncommand;i++){
182 newcommands[i]=commands[i];
187 commands=newcommands;
191 commands[ncommand]=cmd;
201 static int iniflag=0;
233 EvtId evtnumstable[100],evtnumparton[100];
234 int stableindex[100],partonindex[100];
243 static double px[100],py[100],pz[100],e[100];
244 if (iniflag==0)
lundar_(&isr,&iniflag,&xmp,&ndaugjs,kf,km,px,py,pz,e);
253 lundar_(&isr,&iniflag,&xmp,&ndaugjs,kf,km,px,py,pz,e);
258 for(i=0;i<ndaugjs;i++){
262 report(
ERROR,
"EvtGen") <<
"Lunda returned particle:"<<kf[i]<<endl;
263 report(
ERROR,
"EvtGen") <<
"This can not be translated to evt number"<<endl;
264 report(
ERROR,
"EvtGen") <<
"and the decay will be rejected!"<<endl;
265 report(
ERROR,
"EvtGen") <<
"The decay was of particle:"<<ip<<endl;
270 if (
abs(kf[i])<=6||kf[i]==21){
271 partonindex[numparton]=i;
276 stableindex[numstable]=i;
286 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
288 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000001;
292 p4[i].
set(e[i],px[i],py[i],pz[i]);
316 }
while( more && (count<10000) );
319 report(
INFO,
"EvtGen") <<
"Too many loops in EvtLunda!!!"<<endl;
321 for(i=0;i<numstable;i++){
333 for(i=0;i<numstable;i++){
334 p->
getDaug(i)->
init(evtnumstable[i],p4[stableindex[i]]);
337 if ( ndaugFound == 0 ) {
338 report(
ERROR,
"EvtGen") <<
"Lunda has failed to do a decay ";
354 for(i=0;i<numparton;i++){
355 p4string+=p4[partonindex[i]];
360 for(i=0;i<numstable;i++){
361 if (km[stableindex[i]]==0){
362 type[nprimary++]=evtnumstable[i];
372 for(i=0;i<numparton;i++){
373 p4partons[i]=p4[partonindex[i]];
382 for(i=0;i<numstable;i++){
384 if (km[stableindex[i]]==0){
385 p->
getDaug(nprimary++)->
init(evtnumstable[i],p4[stableindex[i]]);
391 for(i=0;i<numstable;i++){
392 if (km[stableindex[i]]!=0){
393 type[nsecond++]=evtnumstable[i];
401 -p4string.
get(2),-p4string.
get(3));
404 for(i=0;i<numstable;i++){
405 if (km[stableindex[i]]!=0){
406 p4[stableindex[i]]=
boostTo(p4[stableindex[i]],p4stringboost);
414 if ( nsecond == 0 ) {
415 report(
ERROR,
"EvtGen") <<
"Jetset has failed to do a decay ";
438 for(i=0;i<ndaug;i++){
459 double beta=acos(p4Psi.
get(3)/p4Psi.
d3mag());
472 if (nlundadecays==ntable){
476 for(i=0;i<ntable;i++){
477 newlundadecays[i]=lundadecays[i];
480 delete [] lundadecays;
481 lundadecays=newlundadecays;
484 lundadecays[nlundadecays++]=jsdecay;
497 for(
int i=0;i<ncommand;i++)
498 lugive_(commands[i].c_str(),strlen(commands[i].c_str()));
double abs(const EvtComplex &c)
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void lugive_(const char *cnfgstr, int length)
void lugive_(const char *cnfgstr, int length)
void lundar_(int *, int *, float *, int *, int *, int *, double *, double *, double *, double *)
ostream & report(Severity severity, const char *facility)
void setDaughterSpinDensity(int daughter)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
void LundaInit(int dummy)
std::string commandName()
void decay(EvtParticle *p)
void command(std::string cmd)
void getName(std::string &name)
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)
void set(int i, double d)