Plots.cxx

00001 #include "Plots.h"
00002 #include <iostream>
00003 #include <fstream>
00004 #include <math.h>
00005 using namespace std;
00006 
00007 namespace Tauolapp
00008 {
00009 
00010 Plots::Plots():
00011     m_incoming_pdg_id(1),
00012     m_cosTheta       (-0.2),
00013     m_n_plot_points  (1000)
00014 {
00015 }
00016 
00017 void Plots::SANCtest1(){
00018 
00019   cout<<"SANC plot 1 (short)..."<<endl;
00020 
00021   double smin = log(6.*6.)+0.0001;
00022   double smax = log(17000.*17000.);
00023   double step = (smax-smin)/(m_n_plot_points-1);
00024 
00025   ofstream f1,f2,f3;
00026   f1.open("f-sanc.txt");
00027   f2.open("f-born.txt");
00028   f3.open("f-plzap0.txt");
00029   for(int i=0; i<m_n_plot_points; i++)
00030   {
00031     double s = exp(smin+i*step);
00032 
00033     // Write SANC value
00034     t_pair.recalculateRij(m_incoming_pdg_id,15,s,m_cosTheta);
00035     f1<<sqrt(s)<<" "<<t_pair.m_R[0][3]<<endl;
00036 
00037     // Write Born-level value
00038     // (assuming table 11 is filled with born-level data)
00039     t_pair.recalculateRij(11,15,s,m_cosTheta);
00040     f2<<sqrt(s)<<" "<<t_pair.m_R[0][3]<<endl;
00041 
00042     int outgoing_pdg_id = 15;
00043 
00044     // Write PLZAP0 value
00045     double pz = 1-plzap0_(&m_incoming_pdg_id,&outgoing_pdg_id,&s, &m_cosTheta);
00046     t_pair.m_R[0][3]=2*pz-1;
00047     f3<<sqrt(s)<<" "<<t_pair.m_R[0][3]<<endl;
00048   }
00049   f1.close();
00050   f2.close();
00051   f3.close();
00052 }
00053 
00054 void Plots::SANCtest2(){
00055 
00056   cout<<"SANC plot 2 (short)..."<<endl;
00057 
00058   double smin = log(6.*6.)+0.0001;
00059   double smax = log(17000.*17000.);
00060   double step = (smax-smin)/(m_n_plot_points-1);
00061 
00062   ofstream f1,f2,f3;
00063   f1.open("f-w-single-point.txt");
00064   f2.open("f-w0-single-point.txt");
00065   f3.open("f-ww0-single-point.txt");
00066 
00067   for(int i=0; i<m_n_plot_points; i++){
00068 
00069     double s=exp(smin+i*step);
00070     t_pair.recalculateRij(m_incoming_pdg_id,15,s,m_cosTheta);
00071 
00072     // Write w, w0 and w/w0
00073     f1<<sqrt(s)<<" "<<Tauola::getEWwt()<<endl;
00074     f2<<sqrt(s)<<" "<<Tauola::getEWwt0()<<endl;
00075     f3<<sqrt(s)<<" "<<Tauola::getEWwt()/Tauola::getEWwt0()<<endl;
00076   }
00077   f1.close();
00078   f2.close();
00079   f3.close();
00080 }
00081 
00082 void Plots::SANCtest3(){
00083 
00084   cout<<"SANC plot 3 (long)..."<<endl;
00085 
00086   double smin = log(6.*6.)+0.0001;
00087   double smax = log(17000.*17000.);
00088   double step = (smax-smin)/(m_n_plot_points-1);
00089 
00090   ofstream f1;
00091   f1.open("f-err.txt");
00092   double costheta=-1.;
00093 
00094   for(int i=0; i<m_n_plot_points; i++){
00095 
00096     double buf=0.,err=0.;
00097 
00098     for(int j=0; j<m_n_plot_points; j++){
00099 
00100       double s = exp(smin+j*step);
00101 
00102       // Get value from SANC table
00103       t_pair.recalculateRij(m_incoming_pdg_id,15,s,costheta);
00104       buf = t_pair.m_R[0][3];
00105       t_pair.recalculateRij(11,15,s,costheta);
00106 
00107       // Calculate error between SANC and Born-level
00108       err += (buf-t_pair.m_R[0][3])*(buf-t_pair.m_R[0][3]);
00109     }
00110 
00111     f1<<costheta<<" "<<err/m_n_plot_points<<endl;
00112     err=0.;
00113     costheta+=2./m_n_plot_points;
00114   }
00115 
00116   f1.close();
00117 }
00118 
00119 void Plots::SANCtest4(){
00120 
00121   cout<<"SANC plot 4 (medium)..."<<endl;
00122 
00123   double smin = log(6.*6.);
00124   double smax = log(17000.*17000.);
00125   double step = (smax-smin)/(m_n_plot_points-1);
00126 
00127   ofstream f1,f2,f3;
00128   f1.open("f-cross.txt");
00129   f2.open("f-w.txt");
00130   f3.open("f-w0.txt");
00131 
00132   for(int i=0; i<m_n_plot_points; i++){
00133 
00134     double s        =  exp(smin+i*step);
00135     double sumEWwt  =  0.;
00136     double sumEWwt0 =  0.;
00137     double costheta = -1.;
00138     int    NCOS     =  21;
00139 
00140     // Calculate sum of w/w0 for all cosTheta
00141     for(int j=0; j<NCOS; j++){
00142 
00143       costheta = -1. + 1.0/NCOS + j*2./NCOS;
00144       
00145       t_pair.recalculateRij(m_incoming_pdg_id,15,s,costheta);
00146 
00147       sumEWwt +=Tauola::getEWwt();
00148       sumEWwt0+=Tauola::getEWwt0();
00149     }
00150 
00151     f1<<sqrt(s)<<" "<<sumEWwt/sumEWwt0/m_n_plot_points<<endl;
00152     f2<<sqrt(s)<<" "<< 2./NCOS * sumEWwt  <<endl;
00153     f3<<sqrt(s)<<" "<< 2./NCOS * sumEWwt0 <<endl;
00154   }
00155 
00156   f1.close();
00157   f2.close();
00158   f3.close();
00159 }
00160 
00161 void Plots::setSancVariables(int incoming, double cosTheta) {
00162   m_incoming_pdg_id = incoming;
00163   m_cosTheta        = cosTheta;
00164 }
00165 
00166 } // namespace Tauolapp
Generated on Sun Oct 20 20:24:09 2013 for C++InterfacetoTauola by  doxygen 1.6.3