Main Page | Namespace List | Class List | Directories | File List | Class Members | File Members

dointegral.C

Go to the documentation of this file.
00001 #include "TGraph.h"
00002 #include "TCanvas.h"
00003 #include "TF1.h"
00004 #include "TAxis.h"
00005 #include <iostream>
00006 #include "TFile.h"
00007 using namespace std;
00008 
00009 const double GeV = 1.;
00010 const double TeV = 1000.;
00011 
00012 TGraph * PDF;
00013 TGraph  * ECM;
00014 TF1 * higgs_lineshape;
00015 
00016 double example(double *var ,double * par)
00017 {
00018   double x = var[0];
00019   double x2 = x*x;
00020   double normalisation = par[0];
00021   double alpha = par[1];
00022   double beta= 1-alpha;
00023 
00024   return normalisation*( alpha*3/4.*(1-x2) + (beta)*3/8.*(1+x2) );
00025   //  return par[0]*( par[1]*3/4.*(1-var[0]*var[0]) + (1-par[1])*3/8.*(1+var[0]*var[0]) );
00026 }
00027 
00028 double pdf_func(double * var , double * par)
00029 {
00030   return PDF->Eval(var[0]);
00031 }
00032 
00033 const double smax = 4*7.*TeV * 7*TeV;
00034 
00035 double integrand_func(double * var , double * par)
00036 {
00037   double s = par[0]*par[0];
00038   double xmin = par[1];
00039   double x1 = var[0];
00040   double x2 = s/(smax*x1);
00041 
00042   if (x1<xmin) return 0.;
00043   else return (1/x1)*pdf_func(&x1,par)*pdf_func(&x2,par);
00044 }
00045 
00046 double modified_higgs_lineshape_func(double  * var , double * par)
00047 {
00048   double roots=var[0];
00049   return ECM->Eval(roots) * higgs_lineshape->Eval(roots);
00050 }
00051 
00052 
00053 
00054 
00055 void  dointegral()
00056 {
00057   if (!PDF)
00058      PDF =(TGraph*) (TFile::Open("gluonpdf.root")->Get("PDF"));
00059   
00060   //  TF1 * f2 = new TF1("f2",example,-1,1,2);
00061   // equivalent to 
00062   // TF1 * f2 = new TF1("f2","[0]*( [1]*3/4.*(1-x*x) + (1-[1])*3/8.*(1+x*x))",1-,1);
00063 
00064   //  double epsilon = 1e-8;
00065   double epsilon = 1e-10;
00066   
00067   TF1 * pdf = new TF1("pdf",pdf_func,epsilon,1,0);
00068   
00069   TCanvas * c = new TCanvas("pdfcanvas","pdf distribution of gluon",400,400);
00070   c->Divide(1,1);
00071   c->cd()->SetGrid();
00072   c->cd()->SetLogy();
00073   pdf->GetXaxis()->SetTitle("x_{gluon}");
00074   pdf->GetYaxis()->SetTitle("xF(x,Q^{2})");
00075   pdf->Draw();
00076 
00077   TF1 * integrand = new TF1("integrand",integrand_func,epsilon,1,2);
00078   integrand->SetParName(0,"#sqrt{s}");
00079   integrand->SetParName(1,"integral lower limit");
00080   integrand->SetNpx(5000);
00081   integrand->SetParameter(0,7*TeV); //7Tev
00082   integrand->SetParameter(1,0);
00083   integrand->GetXaxis()->SetTitle("x_{gluon 1}");
00084 
00085   ECM = new TGraph;
00086   ECM->SetName("ECM");
00087   
00088 
00089   double roots=10*GeV;
00090   double roots_step = 10*GeV;
00091   double roots_max = 14*TeV;
00092   double 
00093 
00094   int nx =(int) floor( sqrt((roots_max - roots)/roots_step) )+1;
00095 
00096   //c = new TCanvas("integrand","integrand",300,300);
00097   c = new TCanvas("integrand","integrand",nx*300,nx*300);
00098   c->Divide(nx,nx);
00099 
00100   TFile * f = TFile::Open("/tmp/ECM.root","recreate");
00101   f->cd();
00102   int i=0;
00103 
00104   while(roots<roots_max)
00105     {
00106       c->cd(i+1)->SetGrid();
00107       //      c->cd(i+1)->SetLogy();
00108 
00109       integrand->SetParameter(0,roots);
00110       double integrand_lower_limit = roots**2/smax;
00111       integrand->SetParameter(1,integrand_lower_limit);
00112 
00113       cout <<"integrating at "<<roots<<endl;
00114 
00115       double value=integrand->Integral(epsilon,1,(double*)0,1e-7);
00116       cout <<"done "<<endl;
00117       ECM->SetPoint(i,roots,value);
00118       char title[100];
00119       sprintf(title,"#sqrt{s}_{g-g} = %5.0f [GeV]",roots);
00120       integrand->SetTitle(title);
00121 
00122       char grname[100];
00123       sprintf(grname,"integrand_%-5.0f",roots);
00124       integrand->SetRange(integrand_lower_limit,1.);
00125       TH1F * copy = (TH1F*) integrand->DrawCopy()->GetHistogram();
00126       copy->SetName(grname);
00127       copy->SetXTitle("x_{gluon 1}");
00128       copy->SetMinimum(integrand->GetMinimum());
00129       copy->Write();
00130 
00131       cout <<"done for "<<roots<<endl;
00132       roots+=roots_step;
00133       i++;
00134     }
00135    
00136 
00137   c = new TCanvas("ECMcanvas","gluon-gluon center of mass distribution",400,400);
00138   c->cd()->SetLogy();
00139   c->cd()->SetGrid();
00140   ECM->GetXaxis()->SetTitle("#sqrt{s}_{gluon-gluon}");
00141   //  ECM->GetYaxis()->SetTitle("P(#sqrt{s}_{gluon-gluon}");
00142   ECM->GetYaxis()->SetTitle("Arbitrary Unit");
00143   ECM->Draw("apl");
00144 
00145   ECM->Write();
00146   f->Close();
00147 }
00148 
00149 
00150 void multiply(  double massH = 500 *GeV, double widthH = 100 *GeV)
00151 {
00152   if (!ECM)
00153     ECM = (TGraph * )TFile::Open("ECM.root")->Get("ECM");
00154 
00155   TCanvas * c = new TCanvas("ECMcanvas","gluon-gluon center of mass distribution",350,1050);
00156   // c->Divide(1,3);
00157   // c->cd(1)->SetLogy(); 
00158   c->cd()->SetLogy();
00159   // c->cd(1)->SetGrid();
00160   c->cd()->SetGrid();
00161   ECM->GetXaxis()->SetTitle("#sqrt{s}_{gluon-gluon}");
00162   ECM->Draw("apl");
00163 
00164   // c->cd(2)->SetGrid();
00165 
00166   // higgs_lineshape = new TF1("higgs_lineshape","TMath::BreitWigner(x,[0],[1])",massH-4*widthH,massH+4*widthH);
00167   // higgs_lineshape->SetParameters(massH,widthH);
00168   // higgs_lineshape->SetNpx(5000);
00169   // higgs_lineshape->GetXaxis()->SetTitle("Higgs Mass [GeV]");
00170   // higgs_lineshape->Draw();
00171 
00172   // c->cd(3)->SetGrid();
00173   
00174   // TF1 * modified_higgs_lineshape = new TF1("modified_higgs_lineshape",modified_higgs_lineshape_func,massH-4*widthH,massH+4*widthH,0);
00175   // modified_higgs_lineshape->SetNpx(5000);
00176   // modified_higgs_lineshape->GetXaxis()->SetTitle("Generated Higgs Mass [GeV]");
00177   // modified_higgs_lineshape->Draw();
00178 }
00179 
00180 
00181 
00182    
00183   

Generated on Thu Jul 12 14:04:54 2007 for RebassooAnalysis by  doxygen 1.3.9.1