Esempio n. 1
0
int main(int narg,char **arg)
{
  init_latpars();
  
  //read ensemble list, meson phiD and meson name
  FILE *an_input_file=open_file("analysis_pars","r");
  char ens_list_path[1024],meson_phi_file[1024],meson_name[1024];
  read_formatted_from_file_expecting(ens_list_path,an_input_file,"%s","ens_list_path");
  read_formatted_from_file_expecting(meson_phi_file,an_input_file,"%s","meson_phi_file");
  read_formatted_from_file_expecting(meson_name,an_input_file,"%s","meson_name");
  read_formatted_from_file_expecting((char*)&ghat_ave,an_input_file,"%lg","ghat");
  read_formatted_from_file((char*)&ghat_err,an_input_file,"%lg","ghat_err");
  fclose(an_input_file);
  
  //prepar the ghat
  ghat=boot(nboot,njack);
  ghat.fill_gauss(ghat_ave,ghat_err,25252352);
  
  //load ensembles list and parameters
  load_ensembles_list(base_corrs_path,ens_name,nens,T,ibeta,nmass,mass,iml_un,nlights,ens_list_path);
  
  //define ml and ref ml, and chiral logs
  ml=bvec(nens,nboot,njack);
  for(int iens=0;iens<nens;iens++)
    {
      int b=ibeta[iens],r=ref_ml_beta[b];
      //define ml
      cout<<iens<<" "<<b<<" "<<iml_un[iens]<<" "<<mass[iens][iml_un[iens]]<<endl;
      ml[iens]=mass[iens][iml_un[iens]]/lat[b]/Zp[b];
      
      //set the lighter mass
      if(r==-1||ml[r].med()>ml[iens].med()) ref_ml_beta[b]=iens;
    }
  cout<<"---"<<endl;
  for(int ib=0;ib<nbeta;ib++) if(ref_ml_beta[ib]!=-1) cout<<"Ref "<<ib<<" = "<<ref_ml_beta[ib]<<", "<<ml[ref_ml_beta[ib]]<<" MeV"<<endl;
  cout<<"---"<<endl;

  //load data
  phiD=bvec(nens,nboot,njack);
  phiD.load(meson_phi_file,0);  

  //perform the fit
  boot A(nboot,njack),B(nboot,njack),C(nboot,njack);
  fit(A,B,C,ml,phiD);
  cout<<endl;
  
  //chiral extrapolation
  boot phiD_chir[nbeta],phiD_chir_cont(nboot,njack);
  bvec phiD_estr_ml(nbeta,nboot,njack),fD_estr_ml(nbeta,nboot,njack);
  for(int ib=0;ib<nbeta;ib++)
    {
      phiD_chir[ib]=boot(nboot,njack);
      for(int iboot=0;iboot<nboot+1;iboot++)
	{
	  int r=ref_ml_beta[ib];
	  phiD_chir_cont.data[iboot]=fun_fit_phiD(A[iboot],B[iboot],C[iboot],ml_phys[iboot],0);
	  phiD_chir[ib].data[iboot]=fun_fit_phiD(A[iboot],B[iboot],C[iboot],ml_phys[iboot],lat[ib][iboot]);
	  
	  if(r!=-1) phiD_estr_ml.data[ib].data[iboot]=phiD[r][iboot]*fun_fit_phiD(A[iboot],B[iboot],C[iboot],ml_phys[iboot],0)/fun_fit_phiD(A[iboot],B[iboot],C[iboot],ml[r][iboot],0);
	}
    }
  boot temp(nboot,njack);
  temp.load("../chiral_cont_extrapol_M/MD");
  cout<<"Using for MD_phys the value: "<<temp<<endl;
  boot fD_chir_cont=phiD_chir_cont/sqrt(temp);
  
  for(int iens=0;iens<nens;iens++)
    cout<<(ml[iens]*db0).med()<<" "<<lat[ibeta[iens]].med()<<" "<<phiD[iens]<<endl;
  
  //chiral and continuum
  cout<<"phiD = ("<<phiD_chir_cont*1000<<") MeV"<<endl;
  cout<<"fD = ("<<fD_chir_cont*1000<<") MeV"<<endl;
  phiD_chir_cont.write_to_binfile("results_phiD");
  fD_chir_cont.write_to_binfile("results_fD");
  
  par_res_fit_phiD=bvec(3,nboot,njack);
  
  par_res_fit_phiD.data[0]=A;
  par_res_fit_phiD.data[1]=B;
  par_res_fit_phiD.data[2]=C;
  
  const char tag_ml[1024]="m\\sl\\N\\SMS,2GeV\\N (GeV)";
  const char tag_a2[1024]="a\\S2\\N (fm)";
  double lat_med_fm[4]={lat[0].med()/hc,lat[1].med()/hc,lat[2].med()/hc,lat[3].med()/hc};
  plot_funz_ml("phiD_funz_ml.xmg",meson_name,tag_ml,meson_name,ml,phiD,par_res_fit_phiD,ml_phys.med(),fun_fit_phiD,phiD_chir_cont);
  plot_funz_a2("phiD_funz_a2.xmg",meson_name,tag_a2,meson_name,lat_med_fm,phiD_estr_ml,par_res_fit_phiD,fun_fit_phiD,phiD_chir_cont);
  
  cout<<lat[0]<<endl;
  cout<<lat[1]<<endl;
  cout<<lat[2]<<endl;
  cout<<lat[3]<<endl;
  
  return 0;
}