/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/BesEvtGen/BesEvtGen-00-03-58/src/EvtGen/EvtGenModels/EvtPHOTOS.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: EvtPHOTOS.cc
00012 //
00013 // Description: This routine takes the particle *p and applies
00014 //              the PHOTOS package to generate final state radiation
00015 //              on the produced mesons.
00016 //
00017 // Modification history:
00018 //
00019 //    RYD     October 1, 1997        Module created
00020 //
00021 //------------------------------------------------------------------------
00022 // 
00023 #include "EvtGenBase/EvtPatches.hh"
00024 #include "EvtGenBase/EvtPatches.hh"
00025 #include "EvtGenBase/EvtIdSet.hh"
00026 #include "EvtGenBase/EvtParticle.hh"
00027 #include "EvtGenBase/EvtPhotonParticle.hh"
00028 #include "EvtGenBase/EvtPDL.hh"
00029 #include "EvtGenModels/EvtPHOTOS.hh"
00030 
00031 extern "C" void begevtgenstorex_(int *,int *,int *,int *,
00032                                 int *,int *,int *,int *,
00033                                 double *,double *,double *, 
00034                                 double *,double *,double *, 
00035                                 double *,double *,double *);
00036 
00037 extern "C" void begevtgengetx_(int *,int *,int *,int *,
00038                               int *,int *,int *,int *,
00039                               double *,double *,double *, 
00040                               double *,double *,double *, 
00041                               double *,double *,double *);
00042 
00043 extern "C" void heplst_(int *);
00044 
00045 extern "C" void photos_(int *);
00046 
00047 extern "C" void phoini_();
00048 
00049 
00050 void EvtPHOTOS::doRadCorr( EvtParticle *p){
00051 
00052   static int first=1;
00053 
00054   //added by Lange Jan4,2000
00055   static EvtId GAMM=EvtPDL::getId("gammaFSR");  //pingrg, 2009/02/19
00056 
00057   if (first) {
00058 
00059     first=0;
00060     phoini_();
00061   }
00062 
00063   int entry,eventnum,numparticle,istat,partnum,mother;
00064   int daugfirst,dauglast;
00065 
00066   int numparticlephotos;
00067 
00068   double px,py,pz,e,m,x,y,z,t;
00069 
00070   static EvtId dq=EvtPDL::getId("d");
00071   static EvtId adq=EvtPDL::getId("anti-d");
00072   static EvtId uq=EvtPDL::getId("u");
00073   static EvtId auq=EvtPDL::getId("anti-u");
00074   static EvtId sq=EvtPDL::getId("s");
00075   static EvtId asq=EvtPDL::getId("anti-s");
00076   static EvtId cq=EvtPDL::getId("c");
00077   static EvtId acq=EvtPDL::getId("anti-c");
00078   static EvtId bq=EvtPDL::getId("b");
00079   static EvtId abq=EvtPDL::getId("anti-b");
00080   static EvtId tq=EvtPDL::getId("t");
00081   static EvtId atq=EvtPDL::getId("anti-t");
00082   static EvtIdSet quarks(dq,adq,uq,auq,sq,asq,cq,acq,bq,abq,tq,atq);\
00083 
00084   px=0.0;
00085   py=0.0;
00086   pz=0.0;
00087   e=p->mass();
00088   m=p->mass();
00089   x=0.0;
00090   y=0.0;
00091   z=0.0;
00092   t=0.0;
00093   
00094   entry=1;
00095   eventnum=1;
00096   numparticle=1;
00097   istat=2;
00098   partnum=EvtPDL::getStdHep(p->getId());
00099   mother=0;
00100   daugfirst=2;
00101   dauglast=1+p->getNDaug();
00102 
00103   begevtgenstorex_(&entry,&eventnum,&numparticle,&istat,&partnum,
00104                   &mother,&daugfirst,&dauglast,
00105                   &px,&py,&pz,&e,&m,&x,&y,&z,&t);
00106 
00107   int i;
00108   //  std::cout << EvtPDL::name(p->getId()) <<" " ;
00109   for(i=0;i<p->getNDaug();i++){
00110 
00111     //No quarks to photos
00112     if (quarks.contains(p->getDaug(i)->getId())==1) continue;
00113 
00114     px=p->getDaug(i)->getP4().get(1);
00115     py=p->getDaug(i)->getP4().get(2);
00116     pz=p->getDaug(i)->getP4().get(3);
00117     e=p->getDaug(i)->getP4().get(0);
00118     m=p->getDaug(i)->mass();
00119     x=0.0;
00120     y=0.0;
00121     z=0.0;
00122     t=0.0;
00123 
00124     //    std::cout << EvtPDL::name(p->getDaug(i)->getId()) << " " ;
00125     entry+=1;
00126     eventnum=1;
00127     numparticle+=1;
00128     istat=1;
00129     partnum=EvtPDL::getStdHep(p->getDaug(i)->getId());
00130     mother=1;
00131     daugfirst=0;
00132     dauglast=0;    
00133 
00134     begevtgenstorex_(&entry,&eventnum,&numparticle,&istat,&partnum,
00135                     &mother,&daugfirst,&dauglast,
00136                     &px,&py,&pz,&e,&m,&x,&y,&z,&t);
00137     
00138 
00139   }
00140   //  std::cout << std::endl;
00141   //can't use heplst since the common block used by the BaBar
00142   //implementation of PHOTOS  is renamed due to real*4 vs real*8
00143   //problems.
00144 
00145   //int mlst=1;
00146 
00147   //heplst_(&mlst);
00148 
00149   entry=1;
00150 
00151   //  report(INFO,"EvtGen") << "Doing photos " << EvtPDL::name(p->getId()) << endl;
00152   photos_(&entry);
00153   //  report(INFO,"EvtGen") << "done\n";
00154   begevtgengetx_(&entry,&eventnum,&numparticlephotos,&istat,&partnum,
00155                     &mother,&daugfirst,&dauglast,
00156                     &px,&py,&pz,&e,&m,&x,&y,&z,&t);
00157     
00158 
00159   //report(INFO,"EvtGen") << "numparticlephotos:"<<numparticlephotos<<endl;
00160   
00161   if (numparticle==numparticlephotos) return;
00162 
00163   EvtVector4R new4mom;
00164 
00165   int np;
00166 
00167   for(i=0;i<p->getNDaug();i++){
00168 
00169     entry=i+2;
00170 
00171     begevtgengetx_(&entry,&eventnum,&np,&istat,&partnum,
00172                     &mother,&daugfirst,&dauglast,
00173                     &px,&py,&pz,&e,&m,&x,&y,&z,&t);
00174 
00175     //this is needed to ensure that photos does not
00176     //change the masses. But it will violate energy conservation!
00177     double mp=p->getDaug(i)->mass();
00178     e=sqrt(mp*mp+px*px+py*py+pz*pz);
00179         
00180     new4mom.set(e,px,py,pz);
00181 
00182     p->getDaug(i)->setP4(new4mom);
00183 
00184   }
00185 
00186   for(entry=numparticle+1;entry<=numparticlephotos;entry++){
00187 
00188     begevtgengetx_(&entry,&eventnum,&np,&istat,&partnum,
00189                     &mother,&daugfirst,&dauglast,
00190                     &px,&py,&pz,&e,&m,&x,&y,&z,&t);
00191         
00192     new4mom.set(e,px,py,pz);
00193 
00194     //new4mom.dump();
00195 
00196     EvtPhotonParticle* gamma;
00197     gamma=new EvtPhotonParticle;
00198     gamma->init(GAMM,new4mom);
00199     //    report(INFO,"EvtGen") << gamma << " " << p << " "<< px << " " << py << " " << pz << " " << p->getNDaug() << " " << EvtPDL::name(p->getId())<<" " << entry << " " <<numparticlephotos<<endl;
00200     gamma->addDaug(p);
00201 
00202 //    p->getDaug(i)->set_type(EvtSpinType::PHOTON);
00203 
00204   }
00205   return ;
00206 }
00207 

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