Difference between revisions of "Lmd eta three pion hlu"

From Lmdwiki
Jump to navigationJump to search
Line 32: Line 32:
  
 
source code:
 
source code:
<pre
+
<pre>
 
test(){
 
test(){
   TH1D* h1=new TH1D("test","test",50,-5,+5);
+
  const float NEvent=1e7;
   h1->FillRandom("gaus",1e7);
+
  const int NBin=50;
 +
  const float Low=-5;
 +
  const float High=5;
 +
  const float BinWidth=(High-Low)/NBin;
 +
   TH1D* h1=new TH1D("test","test",NBin,Low,High);
 +
   h1->FillRandom("gaus",NEvent);
 
   TH1D* h2=h1->Clone("subtracted");
 
   TH1D* h2=h1->Clone("subtracted");
 
   for(int i=2;i<100;i++){
 
   for(int i=2;i<100;i++){
Line 47: Line 52:
 
   }
 
   }
  
   TF1* func=new TF1("fit","-0.2*0.2/2*(-gaus(0)/[2]/[2]+(x-[1])*(x-[1])*gaus(0)/([2]**4))");
+
   TF1* func=new TF1("fit","-[3]*[3]/2*(-gaus(0)/[2]/[2]+(x-[1])*(x-[1])*gaus(0)/([2]**4))");
 +
 
 
   func->FixParameter(2,1);
 
   func->FixParameter(2,1);
   func->FixParameter(0,1e7/sqrt(2*3.1416)/1*(10.0/50.0));
+
   func->FixParameter(0,NEvent/sqrt(2*3.1416)/1*BinWidth);
 
   func->FixParameter(1,0);
 
   func->FixParameter(1,0);
 +
  func->FixParameter(3,BinWidth);
 +
 
   h2->Fit("fit");
 
   h2->Fit("fit");
 
   TCanvas* c1=new TCanvas("c1","c1",696,474);
 
   TCanvas* c1=new TCanvas("c1","c1",696,474);
Line 58: Line 66:
 
   h1->Draw();
 
   h1->Draw();
 
}
 
}
 +
 +
 
</pre>
 
</pre>
  
 
==reference==
 
==reference==

Revision as of 14:57, 14 March 2014

Statistics

Fit missing mass of proton

Error creating thumbnail: File missing
fit missing mass of proton with linear background from g11 data. ~1.3M events
Error creating thumbnail: File missing
fit missing mass of proton with linear background from g12 data. ~1.5M events

More

File:Eta and eta prime two pion.pdf

Form of side-band subtraction histograms

Question: Suppose there is an original function (e.g. Gaussian), what is the form of the function after bin-by-bin side-band subtraction

Answer: Suppose the function is y=f(x). The side-band subtraction makes a new function:

Formula.gif

Test of the formula

10M events of Gaussian distribution were generated for a histograms:

Standard gaussian fit.png

side-band subtracted and plot together with the function:

Side band subtracted standard gaussian fit.png

source code:

test(){
  const float NEvent=1e7;
  const int NBin=50;
  const float Low=-5;
  const float High=5;
  const float BinWidth=(High-Low)/NBin;
  TH1D* h1=new TH1D("test","test",NBin,Low,High);
  h1->FillRandom("gaus",NEvent);
  TH1D* h2=h1->Clone("subtracted");
  for(int i=2;i<100;i++){
    float middle=h1->GetBinContent(i);
    float left=h1->GetBinContent(i-1);
    float right=h1->GetBinContent(i+1);
    float result=middle-(left+right)/2.0;
    float error=sqrt(middle+left/2.0+right/2.0);
    h2->SetBinContent(i,result);
    h2->SetBinError(i,error);
  }

  TF1* func=new TF1("fit","-[3]*[3]/2*(-gaus(0)/[2]/[2]+(x-[1])*(x-[1])*gaus(0)/([2]**4))");

  func->FixParameter(2,1);
  func->FixParameter(0,NEvent/sqrt(2*3.1416)/1*BinWidth);
  func->FixParameter(1,0);
  func->FixParameter(3,BinWidth);

  h2->Fit("fit");
  TCanvas* c1=new TCanvas("c1","c1",696,474);
  h2->Draw();
  TCanvas* c2=new TCanvas("c2","c2",696,474);
  h1->Fit("gaus");
  h1->Draw();
}


reference