/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenModels/EvtJetSet.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 //
00003 // Environment:
00004 //      This software is part of the EvtGen package developed jointly
00005 //      for the BaBar and CLEO collaborations.  If you use all or part
00006 //      of it, please give an appropriate acknowledgement.
00007 //
00008 // Copyright Information: See EvtGen/COPYRIGHT
00009 //      Copyright (C) 1998      Caltech, UCSB
00010 //
00011 // Module: EvtJetSet.cc
00012 //
00013 // Description: Routine to use JetSet for decaying particles.
00014 //
00015 // Modification history:
00016 //
00017 //    RYD     July 24, 1997        Module created
00018 //
00019 //------------------------------------------------------------------------
00020 // 
00021 #include "EvtGenBase/EvtPatches.hh"
00022 #include "EvtGenBase/EvtPatches.hh"
00023 #include "EvtGenBase/EvtParticle.hh"
00024 #include "EvtGenBase/EvtStringParticle.hh"
00025 #include "EvtGenBase/EvtDecayTable.hh"
00026 #include "EvtGenBase/EvtPDL.hh"
00027 #include "EvtGenModels/EvtJetSet.hh"
00028 #include "EvtGenBase/EvtReport.hh"
00029 #include <string>
00030 #include "EvtGenBase/EvtId.hh"
00031 #include <iostream>
00032 #include <iomanip>
00033 #include <fstream>
00034 #include <string.h>
00035 #include <stdlib.h>
00036 #include <unistd.h>
00037 #include <stdio.h>
00038 using std::endl;
00039 using std::fstream;
00040 using std::ios;
00041 using std::ofstream;
00042 using std::resetiosflags;
00043 using std::setiosflags;
00044 using std::setw;
00045 
00046 
00047 int EvtJetSet::njetsetdecays=0;
00048   EvtDecayBasePtr* EvtJetSet::jetsetdecays=0; 
00049 int EvtJetSet::ntable=0;
00050 
00051 int EvtJetSet::ncommand=0;
00052 int EvtJetSet::lcommand=0;
00053 std::string* EvtJetSet::commands=0;
00054 
00055 extern "C" {
00056   extern void evtjetsetinit_(char* fname, int len);
00057 }
00058 
00059 
00060 extern "C" {
00061   extern void jetset1_(int *,double *,int *,int *,int *,
00062                        double *,double *,double *,double *);
00063 }
00064 
00065 extern "C" {
00066   extern void lugive_(const char *cnfgstr,int length);
00067 }
00068 
00069 extern "C" {
00070   extern int lucomp_(int* kf);
00071 }
00072 
00073 
00074 EvtJetSet::EvtJetSet(){}
00075 
00076 EvtJetSet::~EvtJetSet(){
00077 
00078 
00079   int i;
00080 
00081 
00082   //the deletion of commands is really uggly!
00083 
00084   if (njetsetdecays==0) {
00085     delete [] commands;
00086     commands=0;
00087     return;
00088   }
00089 
00090   for(i=0;i<njetsetdecays;i++){
00091     if (jetsetdecays[i]==this){
00092       jetsetdecays[i]=jetsetdecays[njetsetdecays-1];
00093       njetsetdecays--;
00094       if (njetsetdecays==0) {
00095         delete [] commands;
00096         commands=0;
00097       }
00098       return;
00099     }
00100   }
00101 
00102   report(ERROR,"EvtGen") << "Error in destroying JetSet model!"<<endl;
00103  
00104 }
00105 
00106 
00107 void EvtJetSet::getName(std::string& model_name){
00108 
00109   model_name="JETSET";     
00110 
00111 }
00112 
00113 EvtDecayBase* EvtJetSet::clone(){
00114 
00115   return new EvtJetSet;
00116 
00117 }
00118 
00119 
00120 void EvtJetSet::initProbMax(){
00121 
00122   noProbMax();
00123 
00124 }
00125 
00126 
00127 void EvtJetSet::init(){
00128 
00129   checkNArg(1);
00130 
00131 
00132   if (getParentId().isAlias()){
00133 
00134     report(ERROR,"EvtGen") << "EvtJetSet finds that you are decaying the"<<endl
00135                            << " aliased particle "
00136                            << EvtPDL::name(getParentId()).c_str()
00137                            << " with the JetSet model"<<endl
00138                            << " this does not work, please modify decay table."
00139                            << endl;
00140     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00141     ::abort();
00142 
00143   }
00144 
00145   store(this);
00146 
00147 }
00148 
00149 
00150 std::string EvtJetSet::commandName(){
00151 
00152   return std::string("JetSetPar");
00153   
00154 }
00155 
00156 
00157 void EvtJetSet::command(std::string cmd){
00158 
00159   if (ncommand==lcommand){
00160 
00161     lcommand=10+2*lcommand;
00162 
00163     std::string* newcommands=new std::string[lcommand];
00164     
00165     int i;
00166 
00167     for(i=0;i<ncommand;i++){
00168       newcommands[i]=commands[i];
00169     }
00170     
00171     delete [] commands;
00172 
00173     commands=newcommands;
00174 
00175   }
00176 
00177   commands[ncommand]=cmd;
00178 
00179   ncommand++;
00180 
00181 }
00182 
00183 
00184 
00185 void EvtJetSet::decay( EvtParticle *p){
00186 
00187 
00188   //added by Lange Jan4,2000
00189   static EvtId STRNG=EvtPDL::getId("string");
00190 
00191   int istdheppar=EvtPDL::getStdHep(p->getId());
00192 
00193   if (lucomp_(&istdheppar)==0){
00194     report(ERROR,"EvtGen") << "Jetset can not decay:"
00195       <<EvtPDL::name(p->getId()).c_str()<<endl;
00196     return;
00197   }
00198 
00199   double mp=p->mass();
00200 
00201   EvtVector4R p4[20];
00202   
00203   int i,more;
00204   int ip=EvtPDL::getStdHep(p->getId());
00205   int ndaugjs;
00206   int kf[100];
00207   EvtId evtnumstable[100],evtnumparton[100];
00208   int stableindex[100],partonindex[100];
00209   int numstable;
00210   int numparton;
00211   int km[100];
00212   EvtId type[MAX_DAUG];
00213 
00214   jetSetInit();
00215 
00216   double px[100],py[100],pz[100],e[100];
00217 
00218   if ( p->getNDaug() != 0 ) { p->deleteDaughters(true);}
00219 
00220   int count=0;
00221 
00222   do{
00223     //report(INFO,"EvtGen") << "calling jetset " << ip<< " " << mp <<endl;
00224     jetset1_(&ip,&mp,&ndaugjs,kf,km,px,py,pz,e);
00225     
00226 
00227     numstable=0;
00228     numparton=0;
00229     //report(INFO,"EvtGen") << "found some daughters " << ndaugjs << endl;
00230     for(i=0;i<ndaugjs;i++){
00231 
00232       if (EvtPDL::evtIdFromStdHep(kf[i])==EvtId(-1,-1)) {
00233         report(ERROR,"EvtGen") << "JetSet returned particle:"<<kf[i]<<endl;
00234         report(ERROR,"EvtGen") << "This can not be translated to evt number"<<endl;
00235         report(ERROR,"EvtGen") << "and the decay will be rejected!"<<endl;
00236         report(ERROR,"EvtGen") << "The decay was of particle:"<<ip<<endl;
00237 
00238       }
00239 
00240       //sort out the partons
00241       if (abs(kf[i])<=6||kf[i]==21){
00242         partonindex[numparton]=i;
00243         evtnumparton[numparton]=EvtPDL::evtIdFromStdHep(kf[i]);
00244         numparton++;
00245       }
00246       else{
00247         stableindex[numstable]=i;
00248         evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(kf[i]); 
00249         numstable++;
00250       }
00251 
00252 
00253       // have to protect against negative mass^2 for massless particles
00254       // i.e. neutrinos and photons.
00255       // this is uggly but I need to fix it right now....
00256 
00257       if (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]>=e[i]*e[i]){
00258 
00259         e[i]=sqrt(px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i])+0.0000000000001;
00260 
00261       }
00262 
00263       p4[i].set(e[i],px[i],py[i],pz[i]);
00264 
00265 
00266     }
00267 
00268     int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
00269 
00270 
00271    more=(channel!=-1);
00272 
00273    
00274 
00275 
00276   count++;
00277 
00278   }while( more && (count<10000) );
00279 
00280   if (count>9999) {
00281     report(INFO,"EvtGen") << "Too many loops in EvtJetSet!!!"<<endl;
00282     report(INFO,"EvtGen") << "Parent:"<<EvtPDL::name(getParentId()).c_str()<<endl;
00283     for(i=0;i<numstable;i++){
00284       report(INFO,"EvtGen") << "Daug("<<i<<")"<<EvtPDL::name(evtnumstable[i]).c_str()<<endl;
00285     }
00286 
00287   }
00288 
00289 
00290 
00291   if (numparton==0){
00292 
00293     p->makeDaughters(numstable,evtnumstable);
00294     int ndaugFound=0;
00295     for(i=0;i<numstable;i++){
00296       p->getDaug(i)->init(evtnumstable[i],p4[stableindex[i]]);
00297       ndaugFound++;
00298     }
00299     if ( ndaugFound == 0 ) {
00300       report(ERROR,"EvtGen") << "Jetset has failed to do a decay ";
00301       report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass()<<endl;
00302       assert(0);
00303     }
00304 
00305     fixPolarizations(p);
00306 
00307     return ;
00308    
00309   }
00310   else{
00311 
00312     //have partons in JETSET
00313 
00314     EvtVector4R p4string(0.0,0.0,0.0,0.0);
00315 
00316     for(i=0;i<numparton;i++){
00317       p4string+=p4[partonindex[i]];
00318     }
00319 
00320     int nprimary=1;
00321     type[0]=STRNG;
00322     for(i=0;i<numstable;i++){
00323       if (km[stableindex[i]]==0){
00324         type[nprimary++]=evtnumstable[i];
00325       }
00326     }
00327 
00328     p->makeDaughters(nprimary,type);
00329 
00330     p->getDaug(0)->init(STRNG,p4string);
00331 
00332     EvtVector4R p4partons[10];
00333 
00334     for(i=0;i<numparton;i++){
00335       p4partons[i]=p4[partonindex[i]];
00336     }
00337 
00338     ((EvtStringParticle*)p->getDaug(0))->initPartons(numparton,p4partons,evtnumparton);
00339 
00340 
00341 
00342     nprimary=1;
00343 
00344     for(i=0;i<numstable;i++){
00345 
00346       if (km[stableindex[i]]==0){
00347         p->getDaug(nprimary++)->init(evtnumstable[i],p4[stableindex[i]]);
00348       }
00349     }
00350 
00351 
00352     int nsecond=0;
00353     for(i=0;i<numstable;i++){
00354       if (km[stableindex[i]]!=0){
00355         type[nsecond++]=evtnumstable[i];
00356       }
00357     }
00358 
00359 
00360     p->getDaug(0)->makeDaughters(nsecond,type);
00361 
00362     EvtVector4R p4stringboost(p4string.get(0),-p4string.get(1),
00363                               -p4string.get(2),-p4string.get(3));
00364 
00365     nsecond=0;
00366     for(i=0;i<numstable;i++){
00367       if (km[stableindex[i]]!=0){
00368         p4[stableindex[i]]=boostTo(p4[stableindex[i]],p4stringboost);
00369         p->getDaug(0)->getDaug(nsecond)->init(evtnumstable[i],p4[stableindex[i]]);
00370         p->getDaug(0)->getDaug(nsecond)->setDiagonalSpinDensity();
00371         p->getDaug(0)->getDaug(nsecond)->decay();
00372         nsecond++;
00373       }
00374     }
00375 
00376     if ( nsecond == 0 ) {
00377       report(ERROR,"EvtGen") << "Jetset has failed to do a decay ";
00378       report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass() <<endl;
00379       assert(0);
00380     }
00381 
00382     fixPolarizations(p);
00383 
00384     return ;
00385 
00386   }
00387 
00388 }
00389 
00390 void EvtJetSet::fixPolarizations(EvtParticle *p){
00391 
00392   //special case for now to handle the J/psi polarization
00393 
00394   int ndaug=p->getNDaug();
00395   
00396   int i;
00397 
00398   static EvtId Jpsi=EvtPDL::getId("J/psi");
00399 
00400   for(i=0;i<ndaug;i++){
00401     if(p->getDaug(i)->getId()==Jpsi){
00402   
00403       EvtSpinDensity rho;
00404       
00405       rho.SetDim(3);
00406       rho.Set(0,0,0.5);
00407       rho.Set(0,1,0.0);
00408       rho.Set(0,2,0.0);
00409 
00410       rho.Set(1,0,0.0);
00411       rho.Set(1,1,1.0);
00412       rho.Set(1,2,0.0);
00413 
00414       rho.Set(2,0,0.0);
00415       rho.Set(2,1,0.0);
00416       rho.Set(2,2,0.5);
00417 
00418       EvtVector4R p4Psi=p->getDaug(i)->getP4();
00419 
00420       double alpha=atan2(p4Psi.get(2),p4Psi.get(1));
00421       double beta=acos(p4Psi.get(3)/p4Psi.d3mag());
00422 
00423 
00424       p->getDaug(i)->setSpinDensityForwardHelicityBasis(rho,alpha,beta,0.0);
00425       setDaughterSpinDensity(i);
00426 
00427     }
00428   }
00429 
00430 }
00431 
00432 void EvtJetSet::store(EvtDecayBase* jsdecay){
00433 
00434   if (njetsetdecays==ntable){
00435 
00436     EvtDecayBasePtr* newjetsetdecays=new EvtDecayBasePtr[2*ntable+10];
00437     int i;
00438     for(i=0;i<ntable;i++){
00439       newjetsetdecays[i]=jetsetdecays[i];
00440     }
00441     ntable=2*ntable+10;
00442     delete [] jetsetdecays;
00443     jetsetdecays=newjetsetdecays;
00444   }
00445 
00446   jetsetdecays[njetsetdecays++]=jsdecay;
00447 
00448 
00449 
00450 }
00451 
00452 
00453 void EvtJetSet::WriteJetSetEntryHeader(ofstream &outdec, int lundkc,
00454                                EvtId evtnum,std::string name,
00455                                int chg, int cchg, int spin2,double mass,
00456                                double width, double maxwidth,double ctau,
00457                                int stable,double rawbrfrsum){
00458 
00459 
00460   char sname[100];
00461 
00462   int namelength=8;
00463 
00464   int i,j;
00465   int temp;
00466   temp = spin2;
00467 
00468   if (ctau>1000000.0) ctau=0.0;
00469 
00470   strcpy(sname,name.c_str());
00471 
00472   i=0;
00473 
00474   while (sname[i]!=0){
00475     i++;
00476   }
00477 
00478   // strip up to two + or -
00479  
00480   if(evtnum.getId()>=0) {
00481     if (sname[i-1]=='+'||sname[i-1]=='-'){ 
00482       sname[i-1]=0;
00483       i--;
00484     }
00485     if (sname[i-1]=='+'||sname[i-1]=='-'){ 
00486       sname[i-1]=0;
00487       i--;
00488     }
00489     // strip 0 except for _0 and chi...0
00490     if (sname[i-1]=='0' && sname[i-2]!='_' && !(sname[0]=='c' && sname[1]=='h')){
00491       sname[i-1]=0;
00492       i--;
00493     }
00494   }
00495 
00496   if (i>namelength) {
00497     for(j=1;j<namelength;j++){
00498       sname[j]=sname[j+i-namelength];
00499     }
00500     sname[namelength]=0;
00501   }
00502 
00503   cchg=0;
00504 
00505   if(evtnum.getId()>=0) {
00506     if (abs(EvtPDL::getStdHep(evtnum))==21) cchg=2;
00507     if (abs(EvtPDL::getStdHep(evtnum))==90) cchg=-1;
00508     if ((abs(EvtPDL::getStdHep(evtnum))<=8)&&
00509         (abs(EvtPDL::getStdHep(evtnum))!=0)) cchg=1;
00510 
00511   }
00512 
00513   outdec << setw(5) << lundkc << "  ";
00514   outdec.width(namelength);
00515   outdec << setiosflags(ios::left) << sname << resetiosflags(ios::left);
00516   outdec << setw(3) << chg;
00517   outdec << setw(3) << cchg;
00518   outdec.width(3);
00519   if (evtnum.getId()>=0) {
00520     if (EvtPDL::chargeConj(evtnum)==evtnum) {
00521       outdec << 0;
00522     }
00523     else{
00524       outdec << 1;
00525     }
00526   }
00527   else{
00528     outdec << 0;
00529   }
00530   outdec.setf(ios::fixed);
00531   outdec.precision(5);
00532   outdec << setw(12) << mass;
00533   outdec << setw(12) << width;
00534   outdec.width(12);
00535   if (fabs(width)<0.0000000001) {
00536     outdec << 0.0 ;
00537   }
00538   else{
00539     outdec << maxwidth;
00540   }
00541   outdec << setw(14) << ctau;
00542   outdec.width(3);
00543   if (evtnum.getId()>=0) {
00544     if (ctau>1.0 || rawbrfrsum<0.000001) {  
00545       stable=0;
00546     }
00547   }
00548   outdec << stable;
00549   outdec << endl;
00550   outdec.width(0);
00551 
00552 }
00553 
00554 void EvtJetSet::WriteJetSetParticle(ofstream &outdec,EvtId ipar,
00555                                     EvtId iparname,int &first){
00556 
00557   int ijetset;
00558 
00559   double br_sum=0.0;
00560 
00561   for(ijetset=0;ijetset<njetsetdecays;ijetset++){
00562    
00563     if (jetsetdecays[ijetset]->getParentId()==ipar){
00564       br_sum+=jetsetdecays[ijetset]->getBranchingFraction();
00565     }
00566     if (jetsetdecays[ijetset]->getParentId()!=
00567         EvtPDL::chargeConj(jetsetdecays[ijetset]->getParentId())&&
00568         EvtPDL::chargeConj(jetsetdecays[ijetset]->getParentId())==ipar){
00569       br_sum+=jetsetdecays[ijetset]->getBranchingFraction();
00570     }
00571 
00572 
00573   }
00574 
00575   double br_sum_true=br_sum;
00576 
00577   if (br_sum<0.000001) br_sum=1.0;
00578 
00579   for(ijetset=0;ijetset<njetsetdecays;ijetset++){
00580     if (jetsetdecays[ijetset]->getParentId()==ipar){
00581 
00582       double br=jetsetdecays[ijetset]->getBranchingFraction();
00583     
00584       int i,daugs[5];
00585       EvtId cdaugs[5];
00586     
00587       for(i=0;i<5;i++){
00588       
00589         if(i<jetsetdecays[ijetset]->getNDaug()){
00590           daugs[i]=EvtPDL::getStdHep(
00591                          jetsetdecays[ijetset]->getDaugs()[i]);
00592           cdaugs[i]=EvtPDL::chargeConj(jetsetdecays[ijetset]->getDaugs()[i]);
00593         }
00594         else{
00595           daugs[i]=0;
00596         }
00597       }
00598 
00599       int channel;
00600 
00601       channel=EvtDecayTable::findChannel(EvtPDL::chargeConj(ipar),
00602                              jetsetdecays[ijetset]->getModelName(),
00603                              jetsetdecays[ijetset]->getNDaug(),
00604                              cdaugs,
00605                              jetsetdecays[ijetset]->getNArg(),
00606                              jetsetdecays[ijetset]->getArgsStr());     
00607 
00608       if (jetsetdecays[ijetset]->getModelName()=="JETSET"){
00609         
00610         if (first) {
00611           first=0;      
00612           WriteJetSetEntryHeader(outdec,
00613                                  EvtPDL::getLundKC(iparname),
00614                                  iparname,
00615                                  EvtPDL::name(iparname), 
00616                                  EvtPDL::chg3(iparname),
00617                                  0,0,EvtPDL::getMeanMass(ipar),
00618                                  EvtPDL::getWidth(ipar),
00619                                  EvtPDL::getMeanMass(ipar)-EvtPDL::getMinMass(ipar),
00620                                  EvtPDL::getctau(ipar),1,br_sum_true);
00621         }
00622         
00623         int dflag=2;
00624 
00625         if (EvtPDL::getStdHep(ipar)<0) {
00626           dflag=3;
00627           for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
00628             daugs[i]=EvtPDL::getStdHep(cdaugs[i]);
00629           }
00630 
00631         }
00632 
00633         //now lets check to make sure that jetset, lucomp, knows
00634         //about all particles!
00635         int unknown=0;
00636         for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
00637           if (lucomp_(&daugs[i])==0) {
00638             unknown=1;
00639             report(ERROR,"EvtGen") << "JetSet (lucomp) does not "
00640                                   << "know the particle:"<<
00641               EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i]).c_str()<<endl;
00642           }
00643         }
00644 
00645         int istdheppar=EvtPDL::getStdHep(ipar);
00646 
00647         if (lucomp_(&istdheppar)==0){
00648           unknown=1;
00649           report(ERROR,"EvtGen") << "JetSet (lucomp) does not "
00650                   << "know the particle:"<<
00651               EvtPDL::name(ipar).c_str()<<endl;
00652         }
00653 
00654 
00655 
00656         if (unknown){
00657           report(ERROR,"EvtGen") << "Therfore the decay:"<<endl;
00658           report(ERROR,"EvtGen") << EvtPDL::name(jetsetdecays[ijetset]->getParentId()).c_str()<<" -> ";
00659           for(i=0;i<jetsetdecays[ijetset]->getNDaug();i++){
00660             report(ERROR,"") << EvtPDL::name(jetsetdecays[ijetset]->getDaugs()[i]).c_str()<<" ";
00661           }
00662           report(ERROR,"")<<endl;
00663           report(ERROR,"EvtGen")<<"Will not be generated."<<endl;
00664           return;
00665         }
00666 
00667 
00668         if (EvtPDL::chargeConj(ipar)==ipar) {
00669           dflag=1;
00670           //report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because C(ipar)=ipar!"<<endl;
00671         }
00672 
00673 
00674         //if (channel>=0) {
00675         //  dflag=1;
00676           //report(INFO,"EvtGen") << EvtPDL::name(iparname) << " dflag=1 because channel>=0"<<endl;
00677         //}
00678  
00679         //      if (!(EvtPDL::getStdHep(ipar)<0&&channel>=0)){
00680         if (1){
00681 
00682           outdec.width(10);
00683           outdec <<dflag;
00684           outdec.width(5);
00685           outdec <<(int)jetsetdecays[ijetset]->getArgs()[0];
00686           outdec.width(12);
00687           if (fabs(br)<0.000000001) {
00688             outdec <<"0.00000";
00689           }
00690           else{
00691             outdec <<br/br_sum;
00692           }
00693           outdec.width(8);
00694           outdec <<daugs[0];
00695           outdec.width(8);
00696           outdec <<daugs[1];
00697           outdec.width(8);
00698           outdec <<daugs[2];
00699           outdec.width(8);
00700           outdec <<daugs[3];
00701           outdec.width(8);
00702           outdec <<daugs[4];
00703           outdec<<endl;
00704           outdec.width(0);
00705         }
00706       }
00707     }
00708   }
00709 }
00710 
00711 
00712 void EvtJetSet::MakeJetSetFile(char* fname){
00713   
00714   EvtId ipar;
00715   int lundkc;
00716   
00717   //int part_list[MAX_PART];
00718   
00719   ofstream outdec;
00720  
00721   outdec.open(fname);
00722   
00723   //outdec << ";"<<endl;
00724   //outdec << ";This decayfile has been automatically created by"<<endl;
00725   //outdec << ";EvtGen from the DECAY.DEC file"<<endl;
00726   //outdec << ";"<<endl;
00727 
00728   int nokcentry;
00729 
00730   for(lundkc=1;lundkc<=500;lundkc++){
00731 
00732     nokcentry=1;
00733 
00734     int iipar;
00735 
00736     for(iipar=0;iipar<EvtPDL::entries();iipar++){
00737 
00738       ipar=EvtId(iipar,iipar);
00739       //no aliased particles!
00740       std::string tempStr = EvtPDL::name(ipar);
00741       EvtId realId = EvtPDL::getId(tempStr);
00742       if ( realId.isAlias() != 0 ) continue;
00743       if (lundkc==EvtPDL::getLundKC(ipar)){
00744         
00745         nokcentry=0;
00746 
00747         int first=1;
00748     
00749         WriteJetSetParticle(outdec,ipar,ipar,first);
00750 
00751         
00752         EvtId ipar2=EvtPDL::chargeConj(ipar);
00753 
00754 
00755         if (ipar2!=ipar){
00756           WriteJetSetParticle(outdec,ipar2,ipar,first);
00757         }
00758 
00759         if (first){
00760           WriteJetSetEntryHeader(outdec, 
00761                                     EvtPDL::getLundKC(ipar),
00762                                     ipar,
00763                                     EvtPDL::name(ipar),
00764                                     EvtPDL::chg3(ipar),
00765                                     0,0,EvtPDL::getMeanMass(ipar),
00766                                     EvtPDL::getWidth(ipar),
00767                                     EvtPDL::getMeanMass(ipar)-EvtPDL::getMinMass(ipar),
00768                                     EvtPDL::getctau(ipar),0,0.0);
00769 
00770         }
00771       }
00772     }
00773     if (nokcentry){
00774 
00775       WriteJetSetEntryHeader(outdec, 
00776                                 lundkc,EvtId(-1,-1),"  ",
00777                                 0,0,0,EvtPDL::getMeanMass(ipar),0.0,0.0,
00778                                 EvtPDL::getctau(ipar),0,0.0);
00779 
00780     }
00781   }
00782     outdec.close();
00783 }
00784 
00785 void EvtJetSet::jetSetInit(){
00786 
00787   static int first=1;
00788 
00789   if (first){
00790 
00791     first=0;
00792 
00793     report(INFO,"EvtGen") << "Will initialize JetSet."<<endl;
00794 
00795     char fname[200];
00796 
00797     char hostBuffer[100];
00798     
00799     if ( gethostname( hostBuffer, 100 ) != 0 ){
00800       report(ERROR,"EvtGen") << " couldn't get hostname." << endl;
00801       strncpy( hostBuffer, "hostnameNotFound", 100 );
00802     }
00803 
00804     char pid[100];
00805 
00806     int thePid=getpid();
00807 
00808     if ( sprintf( pid, "%d", thePid ) == 0 ){
00809       report(ERROR,"EvtGen") << " couldn't get process ID." << endl;
00810       strncpy( pid, "666", 100 );
00811     }
00812 
00813     strcpy(fname,"jet.d-");
00814     strcat(fname,hostBuffer);
00815     strcat(fname,"-");
00816     strcat(fname,pid);
00817     
00818     MakeJetSetFile(fname);
00819     evtjetsetinit_(fname,strlen(fname));
00820 
00821     if (0==getenv("EVTSAVEJETD")){
00822       char delcmd[300];
00823       strcpy(delcmd,"rm -f ");
00824       strcat(delcmd,fname);
00825       system(delcmd);
00826     }
00827 
00828     int i;
00829 
00830     for(i=0;i<ncommand;i++){
00831       lugive_(commands[i].c_str(),strlen(commands[i].c_str()));
00832 
00833     }
00834 
00835     report(INFO,"EvtGen") << "Done initializing JetSet."<<endl;
00836 
00837 
00838   }
00839 
00840 }

Generated on Tue Nov 29 23:12:19 2016 for BOSS_7.0.2 by  doxygen 1.4.7