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

alpha.C

Go to the documentation of this file.
00001 void alpha()
00002 {
00003 
00004   TGraphErrors  * graph = new TGraphErrors;
00005   graph->SetName("calibration");
00006 
00007   TH1F *alpha = new TH1F("alpha","",500,-1.0,2.0);
00008   TH1F *h = new TH1F("h","",200,-1,1);
00009   TF1 *fT = new TF1("fT","[0]*3/8.*(1+x**2)",-1,1);
00010   TF1 *fL= new TF1("fL","[0]*3/4.*(1-x**2)",-1,1);
00011   fT->SetParameter(0,1);
00012   fL->SetParameter(0,1); 
00013  
00014       
00015   TF1 *f2 = new TF1("f2","[0]*([1]*(3/4)*(1-x**2)+(3/8)*(1-[1])*(1+x**2))",-1,1);
00016       
00017   double alphavalue = 0.0;
00018   int ipoint=0;
00019   while (alphavalue<=1.0)
00020     {
00021       int i = 0;
00022       alpha->Reset();
00023             
00024       for(i = 0; i<1000; i++)
00025         {
00026           h->Reset();
00027           h->FillRandom("fT",floor((1-alphavalue)*10000.));
00028           h->FillRandom("fL",floor(alphavalue*10000.));
00029           //h->Draw();
00030           
00031           f2->FixParameter(0,h->Integral("bin width"));
00032           h->Fit("f2","Nq","");
00033           double alphafit = f2->GetParameter(1);
00034           alpha->Fill(alphafit);
00035         }
00036       
00037       
00038       // TCanvas * c3 = new TCanvas("c3","**",800,800);
00039       //      alpha->Draw();
00040       double mean = alpha->GetMean(1);
00041       double rms = alpha->GetRMS(1);
00042       cout <<"input value of alpha : "<<alphavalue<<endl;
00043       cout<<"The mean of alpha is: "<<mean<<endl;
00044       cout<<"The RMS of alpha is: "<<rms<<endl;
00045       
00046       double mean_error = rms/sqrt(h->GetEntries());
00047       cout <<"error on the mean : "<<mean_error<<endl;
00048 
00049       graph->SetPoint(ipoint,alphavalue,mean);
00050       graph->SetPointError(ipoint++,0,mean_error);
00051 
00052       alphavalue+=0.01;
00053     }
00054 TCanvas * c3 = new TCanvas("c3","**",800,800);
00055  graph->Draw("apl"); 
00056 
00057 
00058 }

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