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);
238 lundcrm_(&iniflag,&istdheppar,&xmp,&ndaugjs,kf,km,px,py,pz,e, &myflag);
248 for(i=0;i<ndaugjs;i++){
255 report(
ERROR,
"EvtGen") <<
"LundCharm returned particle:"<<kf[i]<<endl;
256 report(
ERROR,
"EvtGen") <<
"This can not be translated to evt number"<<endl;
257 report(
ERROR,
"EvtGen") <<
"and the decay will be rejected!"<<endl;
258 report(
ERROR,
"EvtGen") <<
"The decay was of particle:"<<ip<<endl;
263 if (
abs(kf[i])<=6||kf[i]==21){
264 partonindex[numparton]=i;
269 stableindex[numstable]=i;
279 if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
281 e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000001;
285 p4[i].
set(e[i],px[i],py[i],pz[i]);
302 if(parityi!=0 && parityf!=0){
303 pflag=(parityi!=parityf);
306 bool eck = fabs(xmp-totEn)>0.01;
308 more=(channel!=-1 || pflag ==1 || eck);
318 }
while( more && (count<10000) );
328 report(
INFO,
"EvtGen") <<
"Too many loops in EvtLundCharm!!!"<<endl;
330 for(i=0;i<numstable;i++){
342 for(i=0;i<numstable;i++){
343 p->
getDaug(i)->
init(evtnumstable[i],p4[stableindex[i]]);
346 if ( ndaugFound == 0 ) {
347 report(
ERROR,
"EvtGen") <<
"Lundcharm has failed to do a decay ";
363 for(i=0;i<numparton;i++){
364 p4string+=p4[partonindex[i]];
369 for(i=0;i<numstable;i++){
370 if (km[stableindex[i]]==0){
371 type[nprimary++]=evtnumstable[i];
381 for(i=0;i<numparton;i++){
382 p4partons[i]=p4[partonindex[i]];
391 for(i=0;i<numstable;i++){
393 if (km[stableindex[i]]==0){
394 p->
getDaug(nprimary++)->
init(evtnumstable[i],p4[stableindex[i]]);
400 for(i=0;i<numstable;i++){
401 if (km[stableindex[i]]!=0){
402 type[nsecond++]=evtnumstable[i];
410 -p4string.
get(2),-p4string.
get(3));
413 for(i=0;i<numstable;i++){
414 if (km[stableindex[i]]!=0){
415 p4[stableindex[i]]=
boostTo(p4[stableindex[i]],p4stringboost);
423 if ( nsecond == 0 ) {
424 report(
ERROR,
"EvtGen") <<
"Jetset has failed to do a decay ";
437void EvtLundCharm::fixPolarizations(
EvtParticle *p){
447 for(i=0;i<ndaug;i++){
468 double beta=acos(p4Psi.
get(3)/p4Psi.
d3mag());
481 if (nlundcharmdecays==ntable){
485 for(i=0;i<ntable;i++){
486 newlundcharmdecays[i]=lundcharmdecays[i];
489 delete [] lundcharmdecays;
490 lundcharmdecays=newlundcharmdecays;
493 lundcharmdecays[nlundcharmdecays++]=jsdecay;
505 for(
int i=0;i<ncommand;i++)
506 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 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 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)