void view1(int id){ gStyle->SetOptFit(1); char locdir[128] = "rootfiles_fcalcut65"; char f1[128]; char pifile[128]; char omegafile[128]; TText *t1; if (id==1){ sprintf(f1, "%s/newroot_2017_lowint.root",locdir); sprintf(pifile, "%s/pi0_2017_lowint.pdf",locdir); sprintf(omegafile, "%s/omega_2017_lowint.pdf",locdir); t1 = new TText(0.25,0.5,"2017 Low Int."); t1->SetNDC(); t1->SetTextSize(0.03); } if (id==2){ sprintf(f1, "%s/newroot_2017_higint.root",locdir); sprintf(pifile, "%s/pi0_2017_higint.pdf",locdir); sprintf(omegafile, "%s/omega_2017_higint.pdf",locdir); t1 = new TText(0.25,0.5,"2017 High Int."); t1->SetNDC(); t1->SetTextSize(0.03); } if (id==3){ sprintf(f1, "%s/newroot_2016_golden.root",locdir); sprintf(pifile, "%s/pi0_2016_golden.pdf",locdir); sprintf(omegafile, "%s/omega_2016_golden.pdf",locdir); t1 = new TText(0.25,0.5,"2016 golden"); t1->SetNDC(); t1->SetTextSize(0.03); } TFile *RF = new TFile(f1, "READ"); TH1D *hpi = (TH1D*)RF->Get("TwoPhotonOnlyInvMassAndTimeCutAndPhiCutAndMMCut2"); // gausian parametrized by area double binwidth = hpi->GetXaxis()->GetBinWidth(1); char func[256]; sprintf(func,"[0]/([2]/%f)/sqrt(2 * 3.14159265358)*exp(-(x-[1])*(x-[1])/2/[2]/[2])",binwidth); TF1 *f_gaus = new TF1("f_gaus",func, 0.106, 0.154); f_gaus->SetParameters(100., 0.135, 0.01); f_gaus->SetParName(0,"area"); f_gaus->SetParName(1,"mean"); f_gaus->SetParName(2,"sigma"); hpi->GetXaxis()->SetRangeUser(0., 1.); hpi->Fit("f_gaus","","R", 0.106, 0.154); gPad->SetGrid(); t1->Draw(); gPad->Update(); gPad->SaveAs(pifile); getchar(); TH1D *homega = (TH1D*)RF->Get("Pi0GammaInvMassAndTimeCutAndPhiCutAndMMCut2"); homega->GetXaxis()->SetRangeUser(0., 1.); f_gaus->SetParameters(100., 0.775, 0.03); homega->Fit("f_gaus","","R", 0.7, 0.84); gPad->SetGrid(); t1->Draw(); gPad->SaveAs(omegafile); }