Root version: 4.04/02g from source
OS: Linux
Problem: After a fit a region from the data in a TGraphErrors object and run gStyle->SetOptFit(0111) , the chi-square information is not in the fit box. However, if I do 1111 instead, I see the chi-square fit with the probability information. Here is what I am seeing with the chi^sqaure bit set and the probability bit unset:
Here is the macro file that is run as a binary by root -b filename+:
#include <TGraphErrors.h>
#include <TChain.h>
#include <TCanvas.h>
#include <TStyle.h>
#include <TF1.h>
#include <vector>
#include <iostream>
#include <RAT_DS.hh>
void graph_abs_cal(){
TChain *TC = new TChain("T");
TC->Add("/home/xichimos/data/abslength_scint_*.root",0);
// TC->SetBranchStatus("mc",0);
TC->SetBranchStatus("ev.pmt",0);
TC->SetBranchStatus("ev.posfit",0);
TCanvas *c1 = new TCanvas("c1");
// Change root defaults / make plots presentable
gROOT->SetStyle("Plain");
gStyle->GetAttDate()->SetTextColor(1);
gStyle->SetLabelFont(132,"XYZ");
gStyle->SetTextFont(132);
gStyle->SetTitleFont(132,"XYZ");
gStyle->SetStatH(0.12);
gStyle->SetStatW(0.15);
gStyle->SetOptFit(0111);
gStyle->SetOptTitle(1);
gStyle->SetOptStat(000000);
gROOT->ForceStyle();
map<Float_t, Int_t>accept;
map<Float_t, Int_t>total;
RAT_DS *ds=new RAT_DS();
TC->SetBranchAddress("ds",&ds);
Int_t nevent = (Int_t)TC->GetEntries();
Float_t c;
cout<<"Number of events: "<<nevent<<"\n";
for(Int_t i=0;i<nevent;i++){
TC->GetEvent(i);
c=ds->userDouble1; // I use userDouble1 as the absorbtion scale variable
total[c]++;
if(ds->ev.size() > 1){
if(ds->ev[0].efit[0].ke>0.5){
if(ds->ev[1].efit[0].ke>5){
accept[c]++;
}
}
}
}
TGraphErrors *gr = new TGraphErrors(accept.size());
gr->SetTitle("IBD events in scintillator");
gr->Draw("AP");
Float_t x, y, ey;
map<Float_t,int>::const_iterator iter;
int i=0;
for(iter= accept.begin(); iter != accept.end(); ++iter){
x=iter->first;
if(total[x] == 0){
continue;
}
y=((float)accept[x])/total[x];
ey=sqrt(y*(1-y))/sqrt(((Float_t)total[x])); // sqrt(binomial variance)
cout<<"x: "<<x<<" y: "<<y<<" ey: "<<ey<<endl;
gr->SetPoint(i, x, y);
gr->SetPointError(i,0,ey);
++i;
}
//Fit small range
TF1 *f1= new TF1("f1", "pol1", 8, 25);
gr->Fit("f1","R");
gr->GetHistogram()->SetYTitle("IBD event detection efficiency after cuts");
gr->GetHistogram()->SetXTitle("Scintillator absorption length (m)");
c1->Update();
c1->Modified();
c1->Print("calibration_absorbtion.eps");
c1->Print("calibration_absorbtion.pdf");
c1->Print("calibration_absorbtion.jpg");
}
Thanks for any help