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

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------  
00002 //   
00003 // Environment:  
00004 //      This software is part of models developed at BES collaboration  
00005 //      based on the EvtGen framework.  If you use all or part  
00006 //      of it, please give an appropriate acknowledgement.  
00007 //        
00008 // Copyright Information: See EvtGen/BesCopyright  
00009 //      Copyright (A) 2006      Ping Rong-Gang @IHEP  
00010 //        
00011 // Module: EvtPhokhara.cc
00012 //         the necessary file: phokharar.F
00013 //                             fist.inc,gen.inc  mix.inc  stdhep.inc
00014 // Description: Modified Lund model at tau-charm energy level, see
00015 //               PHYSICAL REVIEW D, VOLUME 62, 034003
00016 // Modification history:
00017 //   
00018 //   Ping R.-G.    Jan.25, 2010       Module created    
00019 //   The random engine RLU0 is unified with RLU for BesEvtGen
00020 //------------------------------------------------------------------------
00021 // 
00022 #include "EvtGenBase/EvtPatches.hh"
00023 #include "EvtGenBase/EvtPatches.hh"
00024 #include "EvtGenBase/EvtParticle.hh"
00025 #include "EvtGenBase/EvtStringParticle.hh"
00026 #include "EvtGenBase/EvtDecayTable.hh"
00027 #include "EvtGenBase/EvtPDL.hh"
00028 #include "EvtGenModels/EvtPhokhara_4pi.hh"
00029 #include "EvtGenModels/EvtPhokharaDef.hh"
00030 #include "EvtGenBase/EvtReport.hh"
00031 #include <string>
00032 #include "EvtGenBase/EvtId.hh"
00033 #include <iostream>
00034 #include <iomanip>
00035 #include <fstream>
00036 #include <string.h>
00037 #include <stdlib.h>
00038 #include <unistd.h>
00039 #include <stdio.h>
00040 
00041 #include "GeneratorObject/McGenEvent.h"
00042 #include "BesKernel/IBesRndmGenSvc.h"
00043 #include "CLHEP/Random/RandomEngine.h"
00044 #include "cfortran/cfortran.h"
00045 
00046 using namespace std;
00047 using namespace CLHEP;
00048 
00049 using std::endl;
00050 using std::fstream;
00051 using std::ios;
00052 using std::ofstream;
00053 using std::resetiosflags;
00054 using std::setiosflags;
00055 using std::setw;
00056 
00057 int EvtPhokhara_4pi::nevtgen=0;
00058 int EvtPhokhara_4pi::nphokharadecays=0;
00059 EvtDecayBasePtr* EvtPhokhara_4pi::phokharadecays=0; 
00060 int EvtPhokhara_4pi::ntable=0;
00061 
00062 int EvtPhokhara_4pi::ncommand=0;
00063 int EvtPhokhara_4pi::lcommand=0;
00064 std::string* EvtPhokhara_4pi::commands=0;
00065 int EvtPhokhara_4pi::nevt=0;
00066 
00067 EvtPhokhara_4pi::EvtPhokhara_4pi(){}
00068 EvtPhokhara_4pi::~EvtPhokhara_4pi(){
00069   int i;
00070   //the deletion of commands is really uggly!
00071 
00072   if (nphokharadecays==0) {
00073     delete [] commands;
00074     commands=0;
00075     return;
00076   }
00077 
00078   for(i=0;i<nphokharadecays;i++){
00079     if (phokharadecays[i]==this){
00080       phokharadecays[i]=phokharadecays[nphokharadecays-1];
00081       nphokharadecays--;
00082       if (nphokharadecays==0) {
00083         delete [] commands;
00084         commands=0;
00085       }
00086       return;
00087     }
00088   }
00089 
00090   report(ERROR,"EvtGen") << "Error in destroying Phokhara model!"<<endl;
00091  
00092 }
00093 
00094 
00095 void EvtPhokhara_4pi::getName(std::string& model_name){
00096 
00097   model_name="PHOKHARA_4pi";     
00098 
00099 }
00100 
00101 EvtDecayBase* EvtPhokhara_4pi::clone(){
00102 
00103   return new EvtPhokhara_4pi;
00104 
00105 }
00106 
00107 
00108 void EvtPhokhara_4pi::initProbMax(){
00109 
00110   noProbMax();
00111 
00112 }
00113 
00114 
00115 void EvtPhokhara_4pi::init_mode(EvtParticle* p){
00116  m_pion=3; 
00117  // mu+mu-(0),pi+pi-(1),2pi0pi+pi-(2),
00118  // 2pi+2pi-(3),ppbar(4),nnbar(5),
00119  // K+K-(6),K0K0bar(7),pi+pi-pi0(8), 
00120  // Lamb Lambbar->pi-pi+ppbar(9) 
00121   if(m_pion<0 || m_pion>9){std::cout<<"mode index for phokhar 0~9, but you give "<<m_pion<<std::endl;abort();}
00122   EvtId myvpho=EvtPDL::getId("vpho");
00123   m_E = p->mass();//EvtPDL::getMeanMass(myvpho);
00125   init_pars();
00126   // --- input parameter initialization -----------
00127   m_initSeed = 123456789;
00128   RLXDINIT(1, m_initSeed);
00129   maxima_.iprint = 0;
00130   flags_.nlo = m_nlo;
00131   flags_.pion = m_pion;
00132   flags_.fsr = m_fsr;
00133   flags_.fsrnlo = m_fsrnlo;
00134   flags_.ivac = m_ivac;
00135   flags_.FF_pion  = m_FF_Pion;
00136   flags_.f0_model = m_f0_model;
00137   flags_.FF_kaon  = m_FF_Kaon;
00138   flags_.narr_res = m_NarrowRes;
00139 
00140   ctes_.Sp = m_E*m_E;        ;
00141 
00142   cuts_.w = m_w;
00143   cuts_.q2min = m_q2min;
00144   cuts_.q2_min_c = m_q2_min_c;
00145   cuts_.q2_max_c = m_q2_max_c;
00146   cuts_.gmin = m_gmin;
00147   cuts_.phot1cut = m_phot1cut;
00148   cuts_.phot2cut = m_phot2cut;
00149   cuts_.pi1cut = m_pi1cut;
00150   cuts_.pi2cut = m_pi2cut;
00151 
00152   INPUT();
00153 
00154   // --- print run data ------------------------------
00155   cout << "-------------------------------------------------------------" << endl;
00156   if (flags_.pion == 0)
00157     cout << "     PHOKHARA 7.0 : e^+ e^- -> mu^+ mu^- gamma" << endl;
00158   else if (flags_.pion == 1)
00159     cout << "     PHOKHARA 7.0: e^+ e^- -> pi^+ pi^- gamma" << endl;
00160   else if (flags_.pion == 2)
00161     cout << "   PHOKHARA 7.0: e^+ e^- -> pi^+ pi^- 2pi^0 gamma" << endl;
00162   else if (flags_.pion == 3)
00163     cout << "   PHOKHARA 7.0: e^+ e^- -> 2pi^+ 2pi^- gamma" << endl;
00164   else if (flags_.pion == 4)
00165     cout << "   PHOKHARA 7.0: e^+ e^- -> p pbar gamma" << endl;
00166   else if (flags_.pion == 5)
00167     cout << "   PHOKHARA 7.0: e^+ e^- -> n nbar gamma" << endl;
00168   else if (flags_.pion == 6)
00169     cout << "   PHOKHARA 7.0: e^+ e^- -> K^+ K^- gamma" << endl;
00170   else if (flags_.pion == 7)
00171    cout << "   PHOKHARA 7.0: e^+ e^- -> K_0 K_0bar gamma" << endl;
00172   else if (flags_.pion == 8)
00173     cout << "   PHOKHARA 7.0: e^+ e^- -> pi^+ pi^- pi^0 gamma" << endl;
00174   else if (flags_.pion == 9) {
00175     cout <<  "PHOKHARA 7.0 : e^+ e^- ->" << endl;
00176     cout << "  Lambda (-> pi^- p) Lambda bar (-> pi^+ pbar) gamma" << endl;
00177   } else
00178     cout <<  "     PHOKHARA 7.0: not yet implemented" << endl;
00179 
00180   // --------------------------------
00181   cout <<  "--------------------------------------------------------------" << endl;
00182   printf(" %s %f %s\n","cms total energy                       = ",sqrt(ctes_.Sp)," GeV  ");
00183   
00184   //if((cuts_.gmin/2.0/ctes_.ebeam) < 0.000098){
00185   if(cuts_.gmin<0.001){
00186     cerr << " minimal missing energy set too small, abort" << endl;
00187     abort();
00188   }
00189   printf(" %s %f %s\n","minimal tagged photon energy           = ",cuts_.gmin," GeV  ");
00190   printf(" %s %f,%f\n","angular cuts on tagged photon          = ",cuts_.phot1cut,cuts_.phot2cut);
00191   
00192   // --------------------------------
00193   if (flags_.pion == 0)
00194     printf(" %s %f,%f\n","angular cuts on muons                  = ",cuts_.pi1cut,cuts_.pi2cut);
00195   else if (flags_.pion == 4)
00196     printf(" %s %f,%f\n","angular cuts on protons                = ",cuts_.pi1cut,cuts_.pi2cut);
00197   else if (flags_.pion == 5)
00198     printf(" %s %f,%f\n","angular cuts on neutrons               = ", cuts_.pi1cut,cuts_.pi2cut);
00199   else if ((flags_.pion == 6)||(flags_.pion == 7))
00200     printf(" %s %f,%f\n","angular cuts on kaons                  = ", cuts_.pi1cut,cuts_.pi2cut);
00201   else if (flags_.pion == 9)
00202     printf(" %s %f,%f\n","angular cuts on pions and protons      = ", cuts_.pi1cut,cuts_.pi2cut);
00203   else
00204     printf(" %s %f,%f\n","angular cuts on pions                  = ", cuts_.pi1cut,cuts_.pi2cut);
00205     if (flags_.pion == 0)
00206       printf(" %s %f %s\n","min. muons-tagged photon inv.mass^2    = ", cuts_.q2min," GeV^2");
00207     else if (flags_.pion == 4)
00208       printf(" %s %f %s\n","min. protons-tagged photon inv.mass^2  = ", cuts_.q2min," GeV^2" );
00209     else if (flags_.pion == 5)
00210       printf(" %s %f %s\n","min. neutrons-tagged photon inv.mass^2 = ", cuts_.q2min," GeV^2" );
00211     else if ((flags_.pion == 6)||(flags_.pion == 7))
00212       printf(" %s %f %s\n","min. kaons-tagged photon inv.mass^2    = ", cuts_.q2min," GeV^2" );
00213     else if (flags_.pion == 9)
00214       printf(" %s %f %s\n"," min. lambdas-tagged photon inv.mass^2 = ", cuts_.q2min," GeV^2" );
00215     else
00216       printf(" %s %f %s\n","min. pions-tagged photon inv.mass^2    = ", cuts_.q2min," GeV^2" );
00217     cos1min = cos(cuts_.phot2cut*ctes_.pi/180.0);     // photon1 angle cuts in the 
00218     cos1max = cos(cuts_.phot1cut*ctes_.pi/180.0);     // LAB rest frame   
00219       cos2min = -1.0;                        // photon2 angle limits      
00220       cos2max =  1.0;                        //                           
00221       cos3min = -1.0;                        // hadrons/muons angle limits    
00222       cos3max =  1.0;                        // in their rest frame            
00223       if (flags_.pion == 0)                   // virtual photon energy cut 
00224         qqmin = 4.0*ctes_.mmu*ctes_.mmu;
00225       else if (flags_.pion == 1)
00226         qqmin = 4.0*ctes_.mpi*ctes_.mpi;
00227       else if (flags_.pion == 2)
00228         qqmin = 4.0*(ctes_.mpi+ctes_.mpi0)*(ctes_.mpi+ctes_.mpi0);
00229       else if (flags_.pion == 3)
00230         qqmin = 16.0*ctes_.mpi*ctes_.mpi;
00231       else if (flags_.pion == 4)
00232         qqmin = 4.0*ctes_.mp*ctes_.mp;
00233       else if (flags_.pion == 5)
00234         qqmin = 4.0*ctes_.mnt*ctes_.mnt;
00235       else if (flags_.pion == 6)
00236         qqmin = 4.0*ctes_.mKp*ctes_.mKp;
00237       else if (flags_.pion == 7)
00238         qqmin = 4.0*ctes_.mKn*ctes_.mKn;
00239       else if (flags_.pion == 8)
00240         qqmin = (2.0*ctes_.mpi+ctes_.mpi0)*(2.0*ctes_.mpi+ctes_.mpi0);
00241       else if (flags_.pion == 9)
00242         qqmin = 4.0*ctes_.mlamb*ctes_.mlamb;
00243       qqmax = ctes_.Sp-2.0*sqrt(ctes_.Sp)*cuts_.gmin;         // if only one photon 
00244       if (cuts_.q2_max_c < qqmax)
00245         qqmax=cuts_.q2_max_c;      // external cuts      
00246 
00247       // -------------------
00248       if ( (cuts_.q2_min_c > qqmin) && (cuts_.q2_min_c < (ctes_.Sp*(1.0-2.0*(cuts_.gmin/sqrt(ctes_.Sp)+cuts_.w))) ) )
00249         qqmin = cuts_.q2_min_c;
00250       else {
00251         cerr << "------------------------------" << endl;
00252         cerr << " Q^2_min TOO SMALL" << endl;
00253         cerr << " Q^2_min CHANGED BY PHOKHARA = " << qqmin << " GeV^2" << endl;
00254         cerr << "------------------------------" << endl;
00255       }
00256       // -------------------
00257       if(qqmax <= qqmin){
00258         cerr << " Q^2_max to small " << endl;
00259         cerr << " Q^2_max = " << qqmax << endl;
00260         cerr << " Q^2_min = " << qqmin << endl;
00261         abort();
00262       }
00263 
00264       // -------------------
00265       if (flags_.pion == 0) {
00266         printf(" %s %f %s\n", "minimal muon-pair invariant mass^2     = ", qqmin," GeV^2");
00267         printf(" %s %f %s\n", "maximal muon-pair invariant mass^2     = ", qqmax," GeV^2");
00268       } else if (flags_.pion == 1) {
00269         printf(" %s %f %s\n", "minimal pion-pair invariant mass^2     = ", qqmin," GeV^2");
00270         printf(" %s %f %s\n", "maximal pion-pair invariant mass^2     = ", qqmax," GeV^2");
00271       } else if (flags_.pion == 4) {
00272         printf(" %s %f %s\n", "minimal proton-pair invariant mass^2   = ", qqmin," GeV^2");
00273         printf(" %s %f %s\n", "maximal proton-pair invariant mass^2   = ", qqmax," GeV^2");
00274       } else if (flags_.pion == 5) {
00275         printf(" %s %f %s\n", "minimal neutron-pair invariant mass^2  = ", qqmin," GeV^2");
00276         printf(" %s %f %s\n", "maximal neutron-pair invariant mass^2  = ", qqmax," GeV^2");
00277       } else if ((flags_.pion == 6) || (flags_.pion == 7)) {
00278         printf(" %s %f %s\n", "minimal kaon-pair invariant mass^2     = ", qqmin," GeV^2");
00279         printf(" %s %f %s\n", "maximal kaon-pair invariant mass^2     = ", qqmax," GeV^2");
00280       } else if(flags_.pion == 8){
00281         printf(" %s %f %s\n", "minimal three-pion invariant mass^2    = ", qqmin," GeV^2");
00282         printf(" %s %f %s\n", "maximal three-pion invariant mass^2    = ", qqmax," GeV^2");
00283       } else if(flags_.pion == 9){
00284         printf(" %s %f %s\n", "minimal lambda-pair invariant mass^2  = ", qqmin," GeV^2");
00285         printf(" %s %f %s\n", "maximal lambda-pair invariant mass^2  = ", qqmax," GeV^2");
00286       } else {
00287         printf(" %s %f %s\n", "minimal four-pion invariant mass^2     = ", qqmin," GeV^2" );
00288         printf(" %s %f %s\n", "maximal four-pion invariant mass^2     = ", qqmax," GeV^2");
00289       }
00290       // -------------------
00291       if (flags_.nlo == 0) {
00292         cout <<  "Born" << endl;
00293          if(flags_.fsrnlo != 0){
00294            cerr << "WRONG FSRNLO flag - only fsrnlo=0 allowed for Born" << endl;
00295            abort();
00296          }
00297       }
00298       // -------------------
00299       if((flags_.pion == 9) && (flags_.nlo != 0)) {
00300         cerr << "WRONG NLO flag - only Born allowed for Lambdas"<< endl;
00301         cerr << "If you feel that you need NLO"<< endl;
00302         cerr << "please contact the authors"<< endl;
00303         abort();
00304       }
00305       // -------------------
00306       if (flags_.nlo == 1) printf(" %s %f\n", "NLO:    soft photon cutoff w           = ",cuts_.w);
00307       if ((flags_.pion <= 1) || (flags_.pion == 6))
00308         {
00309 
00310           if( ! ((flags_.fsr == 1) || (flags_.fsr == 2) || (flags_.fsrnlo == 0)
00311               || (flags_.fsr == 1) || (flags_.fsrnlo == 1)
00312                  || (flags_.fsr == 0) || (flags_.fsrnlo == 0))) {
00313             cerr << "WRONG combination of FSR, FSRNLO flags" <<endl;
00314             abort();
00315           }
00316          // ------------------
00317           if (flags_.fsr == 0)
00318             cout << "ISR only" << endl;
00319           else if (flags_.fsr == 1)
00320             cout << "ISR+FSR" << endl;
00321           else if (flags_.fsr == 2) {
00322             if (flags_.nlo == 0)
00323               cout << "ISR+INT+FSR" << endl;
00324             else {
00325               cerr << "WRONG FSR flag: interference is included only for nlo=0" << endl;
00326               abort();
00327             }
00328           }
00329           else {
00330             cerr << "WRONG FSR flag" << flags_.fsr << endl;
00331             abort();
00332           }
00333           if(flags_.fsrnlo == 1)
00334             cout << "IFSNLO included" << endl;
00335         }
00336       else
00337         {
00338           if((flags_.fsr == 0) && (flags_.fsrnlo == 0))
00339             cout << "ISR only" << endl;
00340           else {
00341             cerr << "FSR is implemented only for pi+pi-, mu+mu- and K+K- modes" << endl;
00342             abort();
00343           }
00344         }
00345      // ------------------
00346       if(flags_.ivac == 0){
00347         cout << "Vacuum polarization is NOT included" << endl;}
00348         else if(flags_.ivac == 1){
00349         cout << "Vacuum polarization  by Fred Jegerlehner (http://www-com.physik.hu-berlin.de/fjeger/alphaQEDn.uu)"  << endl;}
00350         else if(flags_.ivac == 2){
00351         cout << "Vacuum polarization (VP_HLMNT_v1_3nonr) by Daisuke Nomura and Thomas Teubner" << endl;}
00352         else {
00353         cout << "WRONG vacuum polarization switch" << endl;
00354         abort();
00355         }
00356 
00357 // -----------------
00358       if(flags_.pion == 1){
00359         if(flags_.FF_pion == 0)
00360           cout << "Kuhn-Santamaria PionFormFactor" << endl;
00361         else if(flags_.FF_pion == 1)
00362           cout << "Gounaris-Sakurai PionFormFactor old" << endl;
00363         else if(flags_.FF_pion == 2)
00364           cout << "Gounaris-Sakurai PionFormFactor new" << endl;
00365         else {
00366           cout << "WRONG PionFormFactor switch" << endl;
00367           abort();
00368         }
00369          if(flags_.fsr != 0){
00370          if(flags_.f0_model == 0)
00371            cout << "f0+f0(600): K+K- model" << endl;
00372          else if(flags_.f0_model == 1)
00373            cout << "f0+f0(600): \"no structure\" model" << endl;
00374          else if(flags_.f0_model == 2)
00375            cout << "NO f0+f0(600)" << endl;
00376          else if(flags_.f0_model == 3)
00377            cout << "only f0, KLOE: Cesare Bini-private communication" << endl;
00378          else {
00379            cout << "WRONG f0+f0(600) switch" << endl;
00380            abort();
00381          }
00382         }
00383       }
00384 //-------
00385       if((flags_.pion == 6) || (flags_.pion==7)){
00386         if(flags_.FF_kaon == 0)
00387           cout << "constrained KaonFormFactor" << endl;
00388         else if(flags_.FF_kaon == 1) {
00389           cout << "unconstrained KaonFormFactor" << endl;}
00390         else if(flags_.FF_kaon == 2) {
00391           cout << "Kuhn-Khodjamirian-Bruch KaonFormFactor" << endl;}
00392         else{
00393           cout << "WRONG KaonFormFactor switch" << endl;
00394           abort();
00395         }
00396       }
00397 // --------------------
00398      if((flags_.pion == 0) || (flags_.pion==1) || (flags_.pion == 6) || (flags_.pion == 7)){
00399         if(flags_.narr_res == 1){
00400           cout << "THE NARROW RESONANCE J/PSI INCLUDED" << endl;}
00401         else if(flags_.narr_res == 2){
00402           cout << "THE NARROW RESONANCE PSI(2S) INCLUDED" << endl;}
00403         else if(flags_.narr_res != 0){
00404           cout << "wrong flag narr_res: only 0, 1 or 2 allowed" << endl;
00405           abort();
00406         }
00407        }
00408 // ------
00409   cout << "--------------------------------------------------------------" << endl;
00410 //
00411  // =================================================
00412 // --- finding the maximum -------------------------
00413       for(int i = 0; i<2; i++)
00414         {
00415           maxima_.Mmax[i] = 1.0;
00416           maxima_.gross[i] = 0.0;
00417           maxima_.klein[i] = 0.0;
00418         }
00419 
00420       if (flags_.nlo == 0)
00421         maxima_.Mmax[1]=0.0;   // only 1 photon events generated
00422 
00423       maxima_.tr[0] = 0.0;
00424       maxima_.tr[1] = 0.0;
00425       maxima_.count[0] = 0.0;
00426       maxima_.count[1] = 0.0;
00427 
00428       // =================================================
00429       // --- beginning the MC loop event generation ------
00430       for(int j = 1; j <= m_nm; j++)
00431         {
00432           RANLXDF(Ar_r,1);
00433           Ar[1] = Ar_r[0];
00434           if (Ar[1] <= (maxima_.Mmax[0]/(maxima_.Mmax[0]+maxima_.Mmax[1]))) {
00435             maxima_.count[0] = maxima_.count[0]+1.0;
00436             GEN_1PH(1,qqmin,qqmax,cos1min,cos1max,cos3min,cos3max);
00437           }
00438           else {
00439             maxima_.count[1] = maxima_.count[1]+1.0;
00440             GEN_2PH(1,qqmin,cos1min,cos1max,cos2min,cos2max,cos3min,cos3max);
00441           }
00442         }
00443       // --- end of the MC loop --------------------------
00444       // =================================================
00445       // --- for the second run ---
00446       maxima_.Mmax[0] = maxima_.gross[0]+.05*sqrt(maxima_.gross[0]*maxima_.gross[0]);
00447       maxima_.Mmax[1] = maxima_.gross[1]+(.03+.02*ctes_.Sp)*sqrt(maxima_.gross[1]*maxima_.gross[1]);
00448       theMmax0=maxima_.Mmax[0];
00449       theMmax1=maxima_.Mmax[1]; 
00450       if((flags_.pion == 1) && (flags_.fsrnlo == 1))
00451         maxima_.Mmax[1]=maxima_.Mmax[1]*1.5;
00452       if((flags_.pion == 0) && (flags_.fsrnlo == 1))
00453         maxima_.Mmax[1]=maxima_.Mmax[1]*1.5;
00454 
00455       if((flags_.pion == 0) && (flags_.fsr == 1) && (flags_.fsrnlo == 0))
00456         maxima_.Mmax[1]=maxima_.Mmax[1]*1.2;
00457 
00458       if((flags_.pion == 2) || (flags_.pion == 3)){
00459         maxima_.Mmax[0]=maxima_.Mmax[0]*1.1;
00460         maxima_.Mmax[1]=maxima_.Mmax[1]*1.1;
00461       }
00462 
00463       if(flags_.pion == 8){
00464         maxima_.Mmax[0]=maxima_.Mmax[0]*1.08;
00465         maxima_.Mmax[1]=maxima_.Mmax[1]*1.1;
00466       }
00467 // --- end of the second run -----------------------
00468 
00469       maxima_.tr[0] = 0.0;
00470       maxima_.tr[1] = 0.0;
00471       maxima_.count[0] = 0.0;
00472       maxima_.count[1] = 0.0;
00473 }
00474 
00475 
00476 
00477 void EvtPhokhara_4pi::init(){
00478   checkNArg(0);
00479 
00480   std::string locvp=getenv("BESEVTGENROOT");
00481   system("cat $BESEVTGENROOT/share/phokhara.param>phokhara.param");
00482 
00483   
00484   if (getParentId().isAlias()){
00485     
00486     report(ERROR,"EvtGen") << "EvtPhokhara finds that you are decaying the"<<endl
00487                            << " aliased particle "
00488                            << EvtPDL::name(getParentId()).c_str()
00489                            << " with the Phokhara model"<<endl
00490                            << " this does not work, please modify decay table."
00491                            << endl;
00492     report(ERROR,"EvtGen") << "Will terminate execution!"<<endl;
00493     ::abort();
00494 
00495   }
00496 
00497   store(this);
00498 
00499 }
00500 
00501 
00502 std::string EvtPhokhara_4pi::commandName(){
00503      
00504   return std::string("PhokharaPar");
00505   
00506 }
00507 
00508 void EvtPhokhara_4pi::command(std::string cmd){
00509 
00510   if (ncommand==lcommand){
00511 
00512     lcommand=10+2*lcommand;
00513 
00514     std::string* newcommands=new std::string[lcommand];
00515     
00516     int i;
00517 
00518     for(i=0;i<ncommand;i++){
00519       newcommands[i]=commands[i];
00520     }
00521     
00522     delete [] commands;
00523 
00524     commands=newcommands;
00525 
00526   }
00527 
00528   commands[ncommand]=cmd;
00529 
00530   ncommand++;
00531 
00532 }
00533 
00534 
00535 
00536 void EvtPhokhara_4pi::decay( EvtParticle *p){
00537   EvtId myvpho=EvtPDL::getId("vpho");
00538   if(p->getId()!=myvpho) {std::cout<<"Parent particle is required to be vpho for Phokhara model"<<std::endl;abort();}
00539   if(nevtgen==0) {init_mode(p);}
00540   else{init_evt(p);}
00541  std::cout<<"PHOKHARA :  2(pi+pi-)  mode "<<std::endl;
00542 
00543 
00544   int istdheppar=EvtPDL::getStdHep(p->getId());
00545   int ntrials = 0;
00546   int tr_old[2];
00547   tr_old[0] = (int)maxima_.tr[0];
00548   tr_old[1] = (int)maxima_.tr[1];
00549 
00550   while( ntrials < 10000)
00551     {
00552       ievent++;
00553       RANLXDF(Ar_r,1);
00554       Ar[1] = Ar_r[0];
00555       
00556       if (Ar[1] <= (maxima_.Mmax[0]/(maxima_.Mmax[0]+maxima_.Mmax[1]))) {
00557         maxima_.count[0] = maxima_.count[0]+1.0;
00558         GEN_1PH(2,qqmin,qqmax,cos1min,cos1max,cos3min,cos3max);
00559       }
00560       else {
00561         maxima_.count[1] = maxima_.count[1]+1.0;
00562         GEN_2PH(2,qqmin,cos1min,cos1max,cos2min,cos2max,cos3min,cos3max);
00563       }
00564       
00565       if( ((int)maxima_.tr[0]+(int)maxima_.tr[1]) > (tr_old[0]+tr_old[1]) ) // event accepted after cuts
00566         {
00567           goto storedEvents;
00568         }
00569       ntrials ++;
00570     }
00571   
00572   std::cout <<"FATAL: Could not satisfy cuts after " << ntrials << "trials. Terminate." <<std::endl;
00573   //----
00574  storedEvents:
00575   int more=0;
00576   int numstable=0;
00577   int numparton=0;
00578   EvtId evtnumstable[100];//
00579   EvtVector4R p4[20];
00580 
00581   // except ISR photos, products depending on channel
00582   if (flags_.pion == 0) { // mu+ mu-
00583     // mu+
00584     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-13);
00585     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00586     numstable++;
00587     // mu -
00588     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(13);
00589     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00590     numstable++;
00591   }
00592   if (flags_.pion == 1) { // pi+ pi-
00593     // pi+
00594     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(211);
00595     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00596     numstable++;
00597     // pi -
00598     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-211);
00599     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00600     numstable++;
00601   }
00602   if (flags_.pion == 2) { // pi+ pi-2pi0
00603     // pi0
00604     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(111);
00605     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00606     numstable++;
00607     // pi0
00608     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(111);
00609     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00610     numstable++;
00611     // pi-
00612     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-211);
00613     p4[numstable].set(ctes_.momenta[0][7],ctes_.momenta[1][7], ctes_.momenta[2][7], ctes_.momenta[3][7]);     
00614     numstable++;
00615     // pi +
00616     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(211);
00617     p4[numstable].set(ctes_.momenta[0][8],ctes_.momenta[1][8], ctes_.momenta[2][8], ctes_.momenta[3][8]);     
00618     numstable++;
00619   }   
00620   if (flags_.pion == 3) { // 2(pi+ pi-)
00621     // pi+
00622     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(211);
00623     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00624     numstable++;
00625     // pi-
00626     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-211);
00627     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00628     numstable++;
00629     // pi+
00630     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-211);
00631     p4[numstable].set(ctes_.momenta[0][7],ctes_.momenta[1][7], ctes_.momenta[2][7], ctes_.momenta[3][7]);     
00632     numstable++;
00633     // pi -
00634     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(211);
00635     p4[numstable].set(ctes_.momenta[0][8],ctes_.momenta[1][8], ctes_.momenta[2][8], ctes_.momenta[3][8]);     
00636     numstable++;
00637   }   
00638   if (flags_.pion == 4) { // ppbar
00639     // pbar
00640     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-2212);
00641     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00642     numstable++;
00643     // p
00644     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(2212);
00645     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00646     numstable++;
00647   }
00648   if (flags_.pion == 5) { // nnbar
00649     // pbar
00650     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-2112);
00651     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00652     numstable++;
00653     // p
00654     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(2112);
00655     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00656     numstable++;
00657   }
00658   if (flags_.pion == 6) { // K+ K-
00659     // K+
00660     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(321);
00661     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00662     numstable++;
00663     // K -
00664     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-321);
00665     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00666     numstable++;
00667   }
00668   if (flags_.pion == 7) { // K0K0bar
00669     // Kbar
00670     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(311);
00671     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00672     numstable++;
00673     // K0
00674     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-311);
00675     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00676     numstable++;
00677   }
00678   if (flags_.pion == 8) { // pi+ pi-pi0
00679     // pi+
00680     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(211);
00681     p4[numstable].set(ctes_.momenta[0][5],ctes_.momenta[1][5], ctes_.momenta[2][5], ctes_.momenta[3][5]);     
00682     numstable++;
00683     // pi-
00684     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-211);
00685     p4[numstable].set(ctes_.momenta[0][6],ctes_.momenta[1][6], ctes_.momenta[2][6], ctes_.momenta[3][6]);     
00686     numstable++;
00687     // pi0
00688     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(111);
00689     p4[numstable].set(ctes_.momenta[0][7],ctes_.momenta[1][7], ctes_.momenta[2][7], ctes_.momenta[3][7]);     
00690     numstable++;
00691   } 
00692   if (flags_.pion == 9) { //Lambda Lambdabar-> pi+ pi- ppbar
00693     // pi+
00694     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(211);
00695     p4[numstable].set(ctes_.momenta[0][7],ctes_.momenta[1][7], ctes_.momenta[2][7], ctes_.momenta[3][7]);     
00696     numstable++;
00697     // pbar
00698     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-2212);
00699     p4[numstable].set(ctes_.momenta[0][8],ctes_.momenta[1][8], ctes_.momenta[2][8], ctes_.momenta[3][8]);     
00700     numstable++;
00701     // pi-
00702     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(-211);
00703     p4[numstable].set(ctes_.momenta[0][9],ctes_.momenta[1][9], ctes_.momenta[2][9], ctes_.momenta[3][9]);     
00704     numstable++; 
00705     // p
00706     evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(2212);
00707     p4[numstable].set(ctes_.momenta[0][10],ctes_.momenta[1][10], ctes_.momenta[2][10], ctes_.momenta[3][10]);     
00708     numstable++;
00709   }   
00710   
00711  // ISR gamma      
00712   evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(22);
00713   p4[numstable].set(ctes_.momenta[0][2],ctes_.momenta[1][2], ctes_.momenta[2][2], ctes_.momenta[3][2]);     
00714   numstable++;
00715   if( ctes_.momenta[0][3] != 0 ) // second photon exists
00716     {
00717       evtnumstable[numstable]=EvtPDL::evtIdFromStdHep(22);
00718       p4[numstable].set(ctes_.momenta[0][3],ctes_.momenta[1][3], ctes_.momenta[2][3], ctes_.momenta[3][3]);     
00719       numstable++;
00720     }
00721   
00722   int channel=EvtDecayTable::inChannelList(p->getId(),numstable,evtnumstable);
00723   more=(channel!=-1);
00724   if(more) {std::cout<<"Existence of mode "<<channel<<" in exclusive decay list has the same final state as this one"<<std::endl;abort(); }
00725   
00726   p->makeDaughters(numstable,evtnumstable);
00727   //double weight = p->initializePhaseSpace(getNDaug(),getDaugs());
00728 
00729   int ndaugFound=0;
00730   EvtVector4R SUMP4(0,0,0,0);
00731   for(int i=0;i<numstable;i++){
00732     p->getDaug(i)->init(evtnumstable[i],p4[i]);
00733     ndaugFound++;
00734   }
00735   if ( ndaugFound == 0 ) {
00736     report(ERROR,"EvtGen") << "Phokhara has failed to do a decay ";
00737     report(ERROR,"EvtGen") << EvtPDL::name(p->getId()).c_str() << " " << p->mass()<<endl;
00738     assert(0);
00739   }
00740 
00741   nevtgen++;  
00742   return ;
00743   
00744 }
00745 
00746 
00747 
00748 void EvtPhokhara_4pi::store(EvtDecayBase* jsdecay){
00749 
00750   if (nphokharadecays==ntable){
00751 
00752     EvtDecayBasePtr* newphokharadecays=new EvtDecayBasePtr[2*ntable+10];
00753     int i;
00754     for(i=0;i<ntable;i++){
00755       newphokharadecays[i]=phokharadecays[i];
00756     }
00757     ntable=2*ntable+10;
00758     delete [] phokharadecays;
00759     phokharadecays=newphokharadecays;
00760   }
00761 
00762   phokharadecays[nphokharadecays++]=jsdecay;
00763 
00764 
00765 
00766 }
00767 
00768 
00769 void EvtPhokhara_4pi::PhokharaInit(int dummy){
00770   static int first=1;
00771   if (first){
00772     
00773     first=0;
00774     //for(int i=0;i<ncommand;i++)
00775     // lugive0_(commands[i].c_str(),strlen(commands[i].c_str()));
00776   }
00777   
00778 }
00779 
00780 
00781 
00782 void EvtPhokhara_4pi::init_evt(EvtParticle* p){
00783  m_pion=3; 
00784  // mu+mu-(0),pi+pi-(1),2pi0pi+pi-(2),
00785  // 2pi+2pi-(3),ppbar(4),nnbar(5),
00786  // K+K-(6),K0K0bar(7),pi+pi-pi0(8), 
00787  // Lamb Lambbar->pi-pi+ppbar(9) 
00788   if(m_pion<0 || m_pion>9){std::cout<<"mode index for phokhar 0~9, but you give "<<m_pion<<std::endl;abort();}
00789   EvtId myvpho=EvtPDL::getId("vpho");
00790   m_E = p->mass();//EvtPDL::getMeanMass(myvpho);
00792   init_pars();
00793 // --- input parameter initialization -----------
00794   maxima_.iprint = 0;
00795   flags_.nlo = m_nlo;
00796   flags_.pion = m_pion;
00797   flags_.fsr = m_fsr;
00798   flags_.fsrnlo = m_fsrnlo;
00799   flags_.ivac = m_ivac;
00800   flags_.FF_pion  = m_FF_Pion;
00801   flags_.f0_model = m_f0_model;
00802   flags_.FF_kaon  = m_FF_Kaon;
00803   flags_.narr_res = m_NarrowRes;
00804 
00805   ctes_.Sp = m_E*m_E;        ;
00806 
00807   cuts_.w = m_w;
00808   cuts_.q2min = m_q2min;
00809   cuts_.q2_min_c = m_q2_min_c;
00810   cuts_.q2_max_c = m_q2_max_c;
00811   cuts_.gmin = m_gmin;
00812   cuts_.phot1cut = m_phot1cut;
00813   cuts_.phot2cut = m_phot2cut;
00814   cuts_.pi1cut = m_pi1cut;
00815   cuts_.pi2cut = m_pi2cut;
00816 
00817   INPUT();
00818 
00819     cos1min = cos(cuts_.phot2cut*ctes_.pi/180.0);     // photon1 angle cuts in the 
00820     cos1max = cos(cuts_.phot1cut*ctes_.pi/180.0);     // LAB rest frame   
00821       cos2min = -1.0;                        // photon2 angle limits      
00822       cos2max =  1.0;                        //                           
00823       cos3min = -1.0;                        // hadrons/muons angle limits    
00824       cos3max =  1.0;                        // in their rest frame            
00825       if (flags_.pion == 0)                   // virtual photon energy cut 
00826         qqmin = 4.0*ctes_.mmu*ctes_.mmu;
00827       else if (flags_.pion == 1)
00828         qqmin = 4.0*ctes_.mpi*ctes_.mpi;
00829       else if (flags_.pion == 2)
00830         qqmin = 4.0*(ctes_.mpi+ctes_.mpi0)*(ctes_.mpi+ctes_.mpi0);
00831       else if (flags_.pion == 3)
00832         qqmin = 16.0*ctes_.mpi*ctes_.mpi;
00833       else if (flags_.pion == 4)
00834         qqmin = 4.0*ctes_.mp*ctes_.mp;
00835       else if (flags_.pion == 5)
00836         qqmin = 4.0*ctes_.mnt*ctes_.mnt;
00837       else if (flags_.pion == 6)
00838         qqmin = 4.0*ctes_.mKp*ctes_.mKp;
00839       else if (flags_.pion == 7)
00840         qqmin = 4.0*ctes_.mKn*ctes_.mKn;
00841       else if (flags_.pion == 8)
00842         qqmin = (2.0*ctes_.mpi+ctes_.mpi0)*(2.0*ctes_.mpi+ctes_.mpi0);
00843       else if (flags_.pion == 9)
00844         qqmin = 4.0*ctes_.mlamb*ctes_.mlamb;
00845       qqmax = ctes_.Sp-2.0*sqrt(ctes_.Sp)*cuts_.gmin;         // if only one photon 
00846       if (cuts_.q2_max_c < qqmax)
00847         qqmax=cuts_.q2_max_c;      // external cuts      
00848 
00849       // -------------------
00850       if ( (cuts_.q2_min_c > qqmin) && (cuts_.q2_min_c < (ctes_.Sp*(1.0-2.0*(cuts_.gmin/sqrt(ctes_.Sp)+cuts_.w))) ) )
00851         qqmin = cuts_.q2_min_c;
00852       else {
00853       }
00854 
00855 
00856  // =================================================
00857 // --- finding the maximum -------------------------
00858       for(int i = 0; i<2; i++)
00859         {
00860           maxima_.Mmax[i] = 1.0;
00861           maxima_.gross[i] = 0.0;
00862           maxima_.klein[i] = 0.0;
00863         }
00864       if (flags_.nlo == 0)
00865         maxima_.Mmax[1]=0.0;   // only 1 photon events generated
00866 
00867       maxima_.tr[0] = 0.0;
00868       maxima_.tr[1] = 0.0;
00869       maxima_.count[0] = 0.0;
00870       maxima_.count[1] = 0.0;
00871 
00872       // =================================================
00873       // --- for the second run ---
00874       maxima_.Mmax[0] = theMmax0; 
00875       maxima_.Mmax[1] = theMmax1; 
00876       if((flags_.pion == 1) && (flags_.fsrnlo == 1))
00877         maxima_.Mmax[1]=maxima_.Mmax[1]*1.5;
00878       if((flags_.pion == 0) && (flags_.fsrnlo == 1))
00879         maxima_.Mmax[1]=maxima_.Mmax[1]*1.5;
00880 
00881       if((flags_.pion == 0) && (flags_.fsr == 1) && (flags_.fsrnlo == 0))
00882         maxima_.Mmax[1]=maxima_.Mmax[1]*1.2;
00883 
00884       if((flags_.pion == 2) || (flags_.pion == 3)){
00885         maxima_.Mmax[0]=maxima_.Mmax[0]*1.1;
00886         maxima_.Mmax[1]=maxima_.Mmax[1]*1.1;
00887       }
00888 
00889       if(flags_.pion == 8){
00890         maxima_.Mmax[0]=maxima_.Mmax[0]*1.08;
00891         maxima_.Mmax[1]=maxima_.Mmax[1]*1.1;
00892       }
00893 // --- end of the second run -----------------------
00894 
00895       maxima_.tr[0] = 0.0;
00896       maxima_.tr[1] = 0.0;
00897       maxima_.count[0] = 0.0;
00898       maxima_.count[1] = 0.0;
00899 }
00900 
00901 
00902 void EvtPhokhara_4pi::init_pars(){
00903   m_tagged = 0;
00904   m_nm = 50000 ; // # of events to determine the maximum
00905   m_nlo = 1;     // Born(0), NLO(1)
00906   m_w = 0.00001;  // soft photon cutoff
00907   m_fsr = 0;     // ISR only(0), ISR+FSR(1), ISR+INT+FSR(2)
00908   m_fsrnlo = 0 ; // yes(1), no(0)
00909   m_NarrowRes = 0 ;// none(0) jpsi(1) psip(2)
00910   m_FF_Kaon = 1 ;  // constrained (0), unconstrained (1), Kuhn-Khodjamirian-Bruch (2)
00911   m_ivac = 0;      // yes(1), no(0)
00912   m_FF_Pion = 0 ;  // KS Pionformfactor(0), GS Pionformfactor old(1) and new(2)
00913   m_f0_model = 0 ; // f0+f0(600): KK model(0), no structure(1),  no f0+f0(600)(2), f0 KLOE(3)
00914   m_q2min    = (4*0.135)*(4*0.135); // minimal  hadrons(muons)-gamma-inv mass squared (GeV^2)
00915   m_q2_min_c =  m_q2min ; // minimal inv. mass squared of the hadrons(muons)(GeV^2)
00916   m_q2_max_c = m_E*m_E;    // maximal inv. mass squared of the hadrons(muons)(GeV^2)
00917   m_gmin = 0.001;       // minimal photon energy/missing energy   (GeV) //total Ecm will reduce m_gmin
00918   m_phot1cut = 0.0;     // maximal photon angle/missing momentum angle (grad)
00919   m_phot2cut = 180.0;   // maximal photon angle/missing momentum angle (grad)
00920   m_pi1cut = 0.0 ;      // minimal hadrons(muons) angle (grad)
00921   m_pi2cut = 180.0;     // maximal hadrons(muons) angle (grad)
00922   if(!(m_pion==0 || m_pion==1 || m_pion==6)){m_fsr = 0;  m_fsrnlo = 0 ;}
00923   if( m_pion==9 ){m_nlo = 0 ;}
00924 }

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