#include int xft_summary(Char_t* filename="119632.hbk") { //Nice plots for DOE review //Clear out variables on the stack (avoids much grief) gROOT->Reset(); //Set up the style gROOT->SetStyle("Plain"); gStyle->SetOptTitle(0); gStyle->SetTitleX(0.1); //Title box x position (top left-hand corner) gStyle->SetTitleY(0.995); //Title box y position (default value) gStyle->SetTitleW(0.0); //Title box width as fraction of pad size gStyle->SetTitleH(0.0); //Title box height as fraction of pad size gStyle->SetTickLength(0.03,"X"); gStyle->SetTickLength(0.03,"Y"); gStyle->SetHistLineWidth(1); gStyle->SetLabelOffset(0.0); gStyle->SetLabelFont(22); gStyle->SetLabelSize(0.05,"XY"); gStyle->SetTitleSize(0.05, "XY"); gStyle->SetTitleOffset(.9, "XY"); gStyle->SetTitleFont(22); gStyle->SetFuncColor(1); gStyle->SetFuncWidth(2.); gStyle->SetOptStat(0); //Integral, Overflow, Underflow, RMS, Mean, Nent, Name gStyle->SetOptFit(0); //probability, Chi2, errors, name/values of parameters gStyle->SetTextFont(22); gStyle->SetTextColor(1); gStyle->SetTextSize(0.06); gStyle->SetTextAlign(12); gStyle->SetMarkerStyle(20); gStyle->SetMarkerSize(0.6); gROOT->ForceStyle(); //Open histogram file cout << "filename is "<< filename << endl; TFile* f= new TFile(filename); cout << "a " <Get("dPtHist"); TH1F *h2002 = (TH1F*)f->Get("dPhiHist"); TH1F *h2011 = (TH1F*)f->Get("MdPtHist"); TH1F *h2012 = (TH1F*)f->Get("MdPhiHist"); TH1F *h2021 = (TH1F*)f->Get("PdPtHist"); TH1F *h2022 = (TH1F*)f->Get("PdPhiHist"); h2001->SetXTitle("Transverse momentum resolution (1/GeV/c)"); h2001->SetYTitle("Events"); h2001->SetTitle("(p_{T}^{XFT} - p_{T}^{offline}) / (p_{T}^{offline})^{2}"); h2002->SetTitle("#phi^{XFT}-#phi^{offline} "); h2002->SetXTitle(" Azimuthal resolution (radians)"); h2002->SetYTitle("Events"); //ps->NewPage(); myc->Clear(); myc->Divide(1,2); myc->cd(1); gPad->SetTicks(1,1); // h2002->Fit("gaus"); // h2001->GetXaxis()->SetRange(15,36); h2001->Fit("gaus","0"); h2011->Fit("gaus","0"); h2021->Fit("gaus","0"); h2001->SetLineStyle(1); h2001->GetFunction("gaus")->SetLineStyle(1); h2011->SetLineStyle(2); h2011->GetFunction("gaus")->SetLineStyle(2); h2021->SetLineStyle(3); h2021->GetFunction("gaus")->SetLineStyle(3); h2001->Draw("eh"); h2001->GetFunction("gaus")->Draw("same"); h2011->GetFunction("gaus")->Draw("same"); h2021->GetFunction("gaus")->Draw("same"); // h2011->Draw("same"); // h2021->Draw("same"); char unit[20], quantity[50]; sprintf(unit,"%%/GeV/c"); xft_showstats(h2001,unit,100); leg= new TLegend(.15,0.5,.4,0.85,""); leg->SetTextSize(0.05); leg->SetTextFont(22); leg->AddEntry(h2001,"Both charges"); leg->AddEntry(h2011->GetFunction("gaus"),"Negative charge"); leg->AddEntry(h2021->GetFunction("gaus"),"Positive charge"); leg->SetFillColor(0); leg->Draw(); TText *t = new TText(); t->SetTextFont(22); t->SetTextSize(0.045); t->SetNDC(); t->DrawText(0.85,.2,"(a)"); myc->cd(2); gPad->SetTicks(1,1); // h2002->Fit("gaus"); h2002->Fit("gaus","0"); h2012->Fit("gaus","0"); h2022->Fit("gaus","0"); h2002->SetLineStyle(1); h2002->GetFunction("gaus")->SetLineStyle(1); h2012->SetLineStyle(2); h2012->GetFunction("gaus")->SetLineStyle(2); h2022->SetLineStyle(3); h2022->GetFunction("gaus")->SetLineStyle(3); h2002->Draw("eh"); h2002->GetFunction("gaus")->Draw("same"); h2012->GetFunction("gaus")->Draw("same"); h2022->GetFunction("gaus")->Draw("same"); // h2012->Draw("same"); // h2022->Draw("same"); sprintf(unit,"mR"); xft_showstats(h2002,unit,1000); TText *t = new TText(); t->SetTextFont(22); t->SetTextSize(0.045); t->SetNDC(); t->DrawText(0.85,.2,"(b)"); myc->Update(); myc->Print("XFT_resolution.eps"); char *ch = new char[1]; printf(" Hit Enter to continue \n"); gets(ch); gStyle->SetStatX(0.995); //Stat box x position (top right hand corner) gStyle->SetStatY(0.995); //Stat box y position gStyle->SetStatW(0.09); //Stat box width as fraction of pad size gStyle->SetStatH(0.09); //Size of each line in stat box ///////////////////////////////////////////////////////////////// // // EFFICIENCY VERSUS PHI AND PT // ////////////////////////////////////////////////////////////////// //ps->NewPage(); myc->Clear(); myc->Divide(1,2); //Some numbers about efficiency Int_t mx = offPt->GetNbinsX(); Float_t mtotal = 0.,mmissed =0.; for(Int_t i=0;i<=mx+1;i++){ Float_t mc = offPt->GetBinCenter(i); Float_t mbin1 = offPt->GetBinContent(i); Float_t mbin2 = offPtMissed->GetBinContent(i); printf("\n bin %6d center %8.3f total %8.1f missed %8.1f",i,mc,mbin1,mbin2); if(mc>10.){ mtotal += mbin1; mmissed += mbin2; } } Float_t efficiency=0., error = 0.; if(mtotal > 1.){ efficiency = (mtotal - mmissed)/mtotal; error = sqrt( efficiency*(1.-efficiency)/mtotal ); } printf("\n L3 pt above 10 GeV/c"); printf("\n Number of good quality L3 tracks= %8.1f Number XFT missed = %8.1f",mtotal,mmissed); printf("\n XFT Efficiency= %8.3f +- %8.3f percent\n",efficiency*100.,error*100.); Int_t nx = offPhi->GetNbinsX(); Float_t ototal = offPhi->GetEntries(); Float_t omissed = offPhiMissed->GetEntries(); // Float_t efficiency=0., error = 0.; if(ototal > 1.){ efficiency = (ototal - omissed)/ototal; error = sqrt( efficiency*(1.-efficiency)/ototal ); } printf("\n L3 pt above 1.5GeV/c"); printf("\n Number of good quality L3 tracks= %8.1f Number XFT missed = %8.1f ",ototal,omissed); printf("\n XFT Efficiency= %8.3f +- %8.3f percent\n",efficiency*100.,error*100.); myc->cd(1); gPad->SetTicks(1,1); offPtEff->SetTitle("XFT Efficiency vs p_{T}^{offline}"); offPtEff->SetXTitle("Offline transverse momentum (GeV/c)"); offPtEff->SetYTitle("XFT Efficiency"); offPtEff->GetXaxis()->SetRange(16,100); offPtEff->SetMaximum(1.01); offPtEff->SetMinimum(.0); offPtEff->Draw("e0"); TText *t = new TText(); t->SetTextFont(22); t->SetTextSize(0.045); t->SetNDC(); t->DrawText(0.15,.2,"Note: XFT transverse momentum threshold is 1.5 GeV/c"); TText *u = new TText(); u->SetTextFont(22); u->SetTextSize(0.045); u->SetNDC(); u->DrawText(0.85,.2,"(a)"); myc->cd(2); gPad->SetTicks(1,1); offPhiEff->SetTitle("XFT Efficiency vs #phi^{offline}"); offPhiEff->SetXTitle("Offline azimuth (radians)"); offPhiEff->SetYTitle("XFT Efficiency"); offPhiEff->SetMaximum(1.01); offPhiEff->SetMinimum(.0); offPhiEff->Fit("pol0","Q"); TText *u = new TText(); u->SetTextFont(22); u->SetTextSize(0.045); u->SetNDC(); u->DrawText(0.85,.2,"(b)"); //a = new TArrow(4.,0.77,4.8,0.85,0.05,"|>"); //a->SetFillColor(2); //a->SetLineColor(2); //a->SetLineWidth(2); //a->Draw(); //TLatex *e = new TLatex(); //e->SetTextSize(0.06); // e->SetTextColor(2); //e->DrawLatex(2.,.75,"Effect of 5/12 dead wires in 1 COT cell"); //e->DrawLatex(2.,.72,"Can mask wires ON...see later"); myc->Update(); myc->Print("XFT_efficiency.eps"); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- //ps->NewPage(); myc->Clear(); myc->Divide(1,3); ///////////////////////////////////////////////////////////////// // // TURNON PLOTS // ////////////////////////////////////////////////////////////////// gStyle->SetLabelOffset(0.0); gStyle->SetLabelSize(0.06,"XY"); gStyle->SetTitleSize(0.06, "XY"); gStyle->SetTitleOffset(.8, "XY"); myc->cd(1); gPad->SetTicks(1,1); mturnon1p5->SetTitle("XFT p_{T} threshold at 1.5 GeV/c"); mturnon1p5->SetXTitle("Offline transverse momentum (GeV/c)"); mturnon1p5->SetYTitle("XFT Efficiency"); mturnon1p5->GetXaxis()->SetRange(50,200); mturnon1p5->SetMarkerStyle(23); mturnon1p5->Draw(); pturnon1p5->SetLineColor(1); pturnon1p5->SetMarkerColor(1); pturnon1p5->SetMarkerStyle(26); pturnon1p5->GetXaxis()->SetRange(50,200); pturnon1p5->Draw("same"); leg= new TLegend(.6,0.2,.8,0.4,""); leg->SetTextSize(0.06); leg->AddEntry(mturnon1p5,"Negative charge"); leg->AddEntry(pturnon1p5,"Positive charge"); leg->SetFillColor(0); leg->Draw(); TText *t = new TText(); t->SetTextFont(22); t->SetTextSize(0.06); t->SetNDC(); t->DrawText(0.35,.55,"Numerator is offline tracks with match to XFT track"); t->DrawText(0.35,.45,"Denominator is all offline tracks"); TText *u = new TText(); u->SetTextFont(22); u->SetTextSize(0.045); u->SetNDC(); u->DrawText(0.85,.2,"(a)"); myc->cd(2); gPad->SetTicks(1,1); mturnon4->SetTitle("XFT p_{T} threshold of 4.0 GeV/c"); mturnon4->SetXTitle("Offline transverse momentum (GeV/c)"); mturnon4->SetYTitle("XFT Efficiency"); mturnon4->SetMarkerStyle(23); mturnon4->Draw(); pturnon4->SetLineColor(1); pturnon4->SetMarkerColor(1); pturnon4->SetMarkerStyle(26); pturnon4->Draw("same"); TText *u = new TText(); u->SetTextFont(22); u->SetTextSize(0.045); u->SetNDC(); u->DrawText(0.85,.2,"(b)"); myc->cd(3); gPad->SetTicks(1,1); mturnon8->SetTitle("XFT p_{T} threshold of 8.0 GeV/c"); mturnon8->SetXTitle("Offline transverse momentum (GeV/c)"); mturnon8->SetYTitle("XFT Efficiency"); mturnon8->SetMarkerStyle(23); mturnon8->Draw(); pturnon8->SetLineColor(1); pturnon8->SetMarkerColor(1); pturnon8->SetMarkerStyle(26); pturnon8->Draw("same"); TText *u = new TText(); u->SetTextFont(22); u->SetTextSize(0.045); u->SetNDC(); u->DrawText(0.85,.2,"(c)"); myc->Update(); myc->Print("XFT_turnon.eps"); //ps->Close(); return 0; } int xft_showstats(TH1* h1, char* units, Float_t mult=1) { Double_t mean = mult * h1->GetFunction("gaus")->GetParameter(1); Double_t emean = mult * h1->GetFunction("gaus")->GetParError(1); Double_t res = mult * h1->GetFunction("gaus")->GetParameter(2); Double_t eres = mult * h1->GetFunction("gaus")->GetParError(2); TText *t = new TText(); t->SetNDC(); t->SetTextSize(0.045); t->SetTextFont(22); char toffset[100], tres[100]; sprintf(toffset,"%5.2f +- %6.3f %s",mean,emean,units); sprintf(tres,"%5.2f +- %6.3f %s",res,eres,units); t->DrawText(0.55,.85,"Offset"); t->DrawText(0.67,.85,toffset); t->DrawText(0.55,0.75,"Resolution"); t->DrawText(0.67,.75,tres); return 0; }