44using std::resetiosflags;
45using std::setiosflags;
49int EvtLundCharm::nlundcharmdecays=0;
51int EvtLundCharm::ntable=0;
53int EvtLundCharm::ncommand=0;
54int EvtLundCharm::lcommand=0;
55std::string* EvtLundCharm::commands=0;
56int EvtLundCharm::nevt=0;
64 extern void lundcrm_(
int *,
int *,
float *,
int *,
int *,
int *,
65 double *,
double *,
double *,
double *,
int *);
69 extern void lugive_(
const char *cnfgstr,
int length);
82 if (nlundcharmdecays==0) {
88 for(i=0;i<nlundcharmdecays;i++){
89 if (lundcharmdecays[i]==
this){
90 lundcharmdecays[i]=lundcharmdecays[nlundcharmdecays-1];
92 if (nlundcharmdecays==0) {
100 report(
ERROR,
"EvtGen") <<
"Error in destroying LundCharm model!"<<endl;
107 model_name=
"LUNDCHARM";
132 report(
ERROR,
"EvtGen") <<
"EvtLundCharm finds that you are decaying the"<<endl
133 <<
" aliased particle "
135 <<
" with the LundCharm model"<<endl
136 <<
" this does not work, please modify decay table."
138 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
150 return std::string(
"LundCharmPar");
156 if (ncommand==lcommand){
158 lcommand=10+2*lcommand;
160 std::string* newcommands=
new std::string[lcommand];
164 for(i=0;i<ncommand;i++){
165 newcommands[i]=commands[i];
170 commands=newcommands;
174 commands[ncommand]=cmd;
185 static int iniflag=0;
202 if(istdheppar != 443 && istdheppar != 100443 && istdheppar != 10441 &&istdheppar != 20443 &&istdheppar != 445 &&istdheppar != 10443 &&istdheppar != 441 &&istdheppar!= 30443){
203 std::cout<<
"EvtGen: EvtLundCharm cann't not decay the particle pid= "<<istdheppar<<endl;
218 EvtId evtnumstable[100],evtnumparton[100];
219 int stableindex[100],partonindex[100];
225 static double px[100],py[100],pz[100],e[100];
227 if (iniflag==0)
lundcrm_(&iniflag,&istdheppar,&xmp,&ndaugjs,kf,km,px,py,pz,e, &myflag);
239 lundcrm_(&iniflag,&istdheppar,&xmp,&ndaugjs,kf,km,px,py,pz,e, &myflag);
249 for(i=0;i<ndaugjs;i++){
256 report(
ERROR,
"EvtGen") <<
"LundCharm returned particle:"<<kf[i]<<endl;
257 report(
ERROR,
"EvtGen") <<
"This can not be translated to evt number"<<endl;
258 report(
ERROR,
"EvtGen") <<
"and the decay will be rejected!"<<endl;
259 report(
ERROR,
"EvtGen") <<
"The decay was of particle:"<<ip<<endl;
264 if (
abs(kf[i])<=6||kf[i]==21){
265 partonindex[numparton]=i;
270 stableindex[numstable]=i;
280 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
282 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000001;
286 p4[i].
set(e[i],px[i],py[i],pz[i]);
303 if(parityi!=0 && parityf!=0){
304 pflag=(parityi!=parityf);
307 bool eck = fabs(xmp-totEn)>0.01;
309 more=(channel!=-1 || pflag ==1 || eck );
319 }
while( more && (count<10000) );
329 report(
INFO,
"EvtGen") <<
"Too many loops in EvtLundCharm!!!"<<endl;
331 for(i=0;i<numstable;i++){
343 for(i=0;i<numstable;i++){
344 p->
getDaug(i)->
init(evtnumstable[i],p4[stableindex[i]]);
347 if ( ndaugFound == 0 ) {
348 report(
ERROR,
"EvtGen") <<
"Lundcharm has failed to do a decay ";
364 for(i=0;i<numparton;i++){
365 p4string+=p4[partonindex[i]];
370 for(i=0;i<numstable;i++){
371 if (km[stableindex[i]]==0){
372 type[nprimary++]=evtnumstable[i];
382 for(i=0;i<numparton;i++){
383 p4partons[i]=p4[partonindex[i]];
392 for(i=0;i<numstable;i++){
394 if (km[stableindex[i]]==0){
395 p->
getDaug(nprimary++)->
init(evtnumstable[i],p4[stableindex[i]]);
401 for(i=0;i<numstable;i++){
402 if (km[stableindex[i]]!=0){
403 type[nsecond++]=evtnumstable[i];
411 -p4string.
get(2),-p4string.
get(3));
414 for(i=0;i<numstable;i++){
415 if (km[stableindex[i]]!=0){
416 p4[stableindex[i]]=
boostTo(p4[stableindex[i]],p4stringboost);
424 if ( nsecond == 0 ) {
425 report(
ERROR,
"EvtGen") <<
"Jetset has failed to do a decay ";
438void EvtLundCharm::fixPolarizations(
EvtParticle *p){
448 for(i=0;i<ndaug;i++){
469 double beta=acos(p4Psi.
get(3)/p4Psi.
d3mag());
482 if (nlundcharmdecays==ntable){
486 for(i=0;i<ntable;i++){
487 newlundcharmdecays[i]=lundcharmdecays[i];
490 delete [] lundcharmdecays;
491 lundcharmdecays=newlundcharmdecays;
494 lundcharmdecays[nlundcharmdecays++]=jsdecay;
506 for(
int i=0;i<ncommand;i++)
507 lugive_(commands[i].c_str(),strlen(commands[i].c_str()));
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
void lugive_(const char *cnfgstr, int length)
void lugive_(const char *cnfgstr, int length)
void lundcrm_(int *, int *, float *, int *, int *, int *, double *, double *, double *, double *, int *)
ostream & report(Severity severity, const char *facility)
void setDaughterSpinDensity(int daughter)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
std::string commandName()
static void LundcrmInit(int f)
void getName(std::string &name)
void command(std::string cmd)
void decay(EvtParticle *p)
static int getStdHep(EvtId id)
static double getMeanMass(EvtId i)
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 setGeneratorFlag(int flag)
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)
static void readParityC()
static double getC(string parname)