#include int xft_turnon(Char_t* filename="119632.hbk") { //Clear out variables on the stack (avoids much grief) gROOT->Reset(); gROOT->LoadMacro("xft_effCalc.C"); gStyle->SetHistLineWidth(1); gStyle->SetPadGridX(true); gStyle->SetPadGridY(true); gStyle->SetLabelSize(0.05,"XY"); gStyle->SetTitleSize(0.08, "XY"); gStyle->SetTitleOffset(0.4, "XY"); gStyle->SetFuncColor(6); gStyle->SetFuncWidth(6.); gStyle->SetOptStat(1110); //Integral, Overflow, Underflow, RMS, Mean, Nent, Name gStyle->SetOptFit(1111); //probability, Chi2, errors, name/values of parameters // gStyle->SetStatX(0.995); //Stat box x position (top right hand corner) // gStyle->SetStatY(0.995); //Stat box y position // gStyle->SetStatW(0.20); //Stat box width as fraction of pad size // gStyle->SetStatH(0.17); //Size of each line in stat box gStyle->SetTextFont(62); gStyle->SetTextColor(4); gStyle->SetTextSize(0.06); gStyle->SetTextAlign(12); //Open histogram file cout << "filename is "<< filename << endl; TFile* f= new TFile(filename); //Open file in which to store pictures TPostScript *ps = new TPostScript("XFT_turnon.ps",111); //Open Canvas TCanvas *myc = new TCanvas("MyC","Test Canvas",700,700); //-------------------------------------------------------------- printf("\n Any holes/spikes in phi?"); ps->NewPage(); myc->Clear(); myc->Divide(1,3); myc->cd(1); xftphi_cem_nomatch4->SetTitle("CEM0_PT4 Trigger (CEM4_PT4 shaded)"); xftphi_cem_nomatch4->Draw(""); xftphi_cem_match->SetFillColor(4); xftphi_cem_match->Draw("same"); myc->cd(2); xftphi_cmu_nomatch8->SetTitle("CMU6_PT8 Trigger (CMU6_PT8 shaded"); xftphi_cmu_nomatch8->Draw(""); xftphi_cmu_match->SetFillColor(4); xftphi_cmu_match->Draw("same"); myc->cd(3); xftphi_jet->SetTitle("Jet5 Trigger"); xftphi_jet->Draw(""); myc->Update(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- ps->NewPage(); myc->Clear(); myc->Divide(1,4); printf("\n Check trigger bits are really set"); myc->cd(1); xftPtBin->SetXTitle("XFT pT bin"); xftPtBin->SetYTitle("Tracks"); xftPtBin->Draw(); xftpt_cem_nomatch4->SetFillColor(4); xftpt_cem_nomatch4->Draw("same"); leg= new TLegend(.6,0.6,.9,0.9,""); leg->AddEntry(xftPtBin,"xft track"); leg->AddEntry(xftpt_cem_nomatch4,"Event has CEM0_PT4 bit set too"); leg->SetFillColor(0); leg->Draw(); myc->cd(2); xftPtBin->SetXTitle("XFT pT bin"); xftPtBin->SetYTitle("Tracks"); xftPtBin->Draw(); xftpt_cmu_nomatch8->SetFillColor(4); xftpt_cmu_nomatch8->Draw("same"); leg= new TLegend(.6,0.6,.9,0.9,""); leg->AddEntry(xftPtBin,"xft track"); leg->AddEntry(xftpt_cmu_nomatch8,"Event has CMU0_PT8 bit set too"); leg->SetFillColor(0); leg->Draw(); myc->cd(3); xftAbsPhi4->SetXTitle("XFT phi (radians)"); xftAbsPhi4->SetYTitle("Tracks"); xftAbsPhi4->Draw(); xftphi_cem_nomatch4->SetFillColor(4); xftphi_cem_nomatch4->Draw("same"); myc->cd(4); xftAbsPhi8->SetXTitle("XFT phi (radians)"); xftAbsPhi8->SetYTitle("Tracks"); xftAbsPhi8->Draw(); xftphi_cmu_nomatch8->SetFillColor(4); xftphi_cmu_nomatch8->Draw("same"); myc->Update(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- ps->NewPage(); myc->Clear(); myc->Divide(1,4); printf("\n Check trigger bits are really set"); myc->cd(1); TH1F* xbit4set = xftPtBin->Clone(); xft_effCalc(xftpt_cem_nomatch4,xftPtBin,xbit4set); xbit4set->SetTitle("xft track has CEM0_PT4 bit set"); xbit4set->Draw(""); myc->cd(2); TH1F* xbit8set = xftPtBin->Clone(); xft_effCalc(xftpt_cmu_nomatch8,xftPtBin,xbit8set); xbit8set->SetTitle("xft track has CMU0_PT8 bit set"); xbit8set->Draw(""); myc->cd(3); TH1F* xbit4setphi = xftAbsPhi4->Clone(); xft_effCalc(xftphi_cem_nomatch4,xftAbsPhi4,xbit4setphi); xbit4setphi->SetTitle("xft track has CEM0_PT4 bit set"); xbit4setphi->Draw(""); xtrp_problemhunt(xftphi_cem_nomatch4,xftAbsPhi4); myc->cd(4); TH1F* xbit8setphi = xftAbsPhi8->Clone(); xft_effCalc(xftphi_cmu_nomatch8,xftAbsPhi8,xbit8setphi); xbit8setphi->SetTitle("xft track has CMU0_PT8 bit set"); xbit8setphi->Draw(""); xtrp_problemhunt(xftphi_cmu_nomatch8,xftAbsPhi8); myc->Update(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- ps->NewPage(); myc->Clear(); myc->Divide(1,3); myc->cd(1); turnon1p5->SetXTitle("L3 pT (GeV/c)"); turnon1p5->SetYTitle("Efficiency"); turnon1p5->GetXaxis()->SetRange(50,200); turnon1p5->Draw(); TText *t = new TText(); 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"); myc->cd(2); turnon4->SetXTitle("L3 pT (GeV/c)"); turnon4->SetYTitle("Efficiency"); turnon4->Draw(); myc->cd(3); turnon8->SetXTitle("L3 pT (GeV/c)"); turnon8->SetYTitle("Efficiency"); turnon8->Draw(); myc->Update(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- ps->NewPage(); myc->Clear(); myc->Divide(1,3); myc->cd(1); mturnon1p5->SetXTitle("L3 pT (GeV/c)"); mturnon1p5->SetYTitle("Efficiency"); mturnon1p5->GetXaxis()->SetRange(50,200); mturnon1p5->Draw(); pturnon1p5->SetLineColor(2); pturnon1p5->SetMarkerColor(2); pturnon1p5->GetXaxis()->SetRange(50,200); pturnon1p5->Draw("same"); leg= new TLegend(.6,0.2,.9,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->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"); myc->cd(2); mturnon4->SetXTitle("L3 pT (GeV/c)"); mturnon4->SetYTitle("Efficiency"); mturnon4->Draw(); pturnon4->SetLineColor(2); pturnon4->SetMarkerColor(2); pturnon4->Draw("same"); myc->cd(3); mturnon8->SetXTitle("L3 pT (GeV/c)"); mturnon8->SetYTitle("Efficiency"); mturnon8->Draw(); pturnon8->SetLineColor(2); pturnon8->SetMarkerColor(2); pturnon8->Draw("same"); myc->Update(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- ps->NewPage(); myc->Clear(); myc->Divide(1,3); myc->cd(1); iturnon1p5->SetXTitle("L3 inverse pT (1/GeV/c)"); iturnon1p5->SetYTitle("Efficiency"); iturnon1p5->Draw("e0"); TText *t = new TText(); t->SetTextSize(0.06); t->SetNDC(); t->DrawText(0.25,.55,"Numerator is offline tracks with match to XFT track"); t->DrawText(0.25,.45,"Denominator is all offline tracks"); myc->cd(2); iturnon4->SetXTitle("L3 inverse pT (1/GeV/c)"); iturnon4->SetYTitle("Efficiency"); iturnon4->Draw("e0"); myc->cd(3); iturnon8->SetXTitle("L3 inverse pT (1/GeV/c)"); iturnon8->SetYTitle("Efficiency"); iturnon8->Draw("e0"); myc->Update(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); //----------------------------------------------------------------------------- ps->NewPage(); myc->Clear(); myc->Divide(1,2); myc->cd(1); gPad->SetLogy(true); offPtTriggerAll1p5->SetXTitle("L3 pT (GeV/c)"); offPtTriggerAll1p5->SetYTitle("Tracks"); offPtTriggerAll1p5->Draw("e0"); offPtTrigger1p5->SetLineColor(2); offPtTrigger1p5->SetMarkerColor(2); offPtTrigger1p5->Draw("e0same"); offPtTrigger4->SetLineColor(3); offPtTrigger4->SetMarkerColor(3); offPtTrigger4->Draw("e0same"); offPtTrigger8->SetLineColor(6); offPtTrigger8->SetMarkerColor(6); offPtTrigger8->Draw("e0same"); leg= new TLegend(.6,0.6,.9,0.9,""); leg->AddEntry(offPtTriggerAll1p5,"All tracks above 1.2 GeV/c"); leg->AddEntry(offPtTrigger1p5,"Matched to xft track"); leg->AddEntry(offPtTrigger4,"Matched to xft track above 4 GeV/c"); leg->AddEntry(offPtTrigger8,"Matched to xft track above 8 GeV/c"); leg->SetFillColor(0); leg->Draw(); myc->cd(2); offInvPtTriggerAll->SetXTitle("L3 inverse pT (1/GeV/c)"); offInvPtTriggerAll->SetYTitle("Tracks"); offInvPtTriggerAll->Draw("e0"); offInvPtTrigger1p5->SetLineColor(2); offInvPtTrigger1p5->SetMarkerColor(2); offInvPtTrigger1p5->Draw("e0same"); offInvPtTrigger4->SetLineColor(3); offInvPtTrigger4->SetMarkerColor(3); offInvPtTrigger4->Draw("e0same"); offInvPtTrigger8->SetLineColor(6); offInvPtTrigger8->SetMarkerColor(6); offInvPtTrigger8->Draw("e0same"); myc->Update(); ps->Close(); char *ch = new char[1]; printf("Hit Enter to continue"); gets(ch); return 0; } int xtrp_problemhunt(TH1* triggerseen, TH1* trackseen){ Int_t nx = trackseen->GetNbinsX(); for (Int_t i=0; i < nx; i++){ // Note well that i=0 is underflow, i=nx+1 is overflow Float_t tracks = trackseen->GetBinContent(i+1); Float_t triggers = triggerseen->GetBinContent(i+1); if(triggers != tracks && tracks > 0 ){ Float_t eff = triggers/tracks; Float_t err = sqrt( eff*(1.-eff)/tracks ); printf("\n TRIGGER MISSED! Triggers %6.0f Tracks %6.0f",triggers,tracks); printf(" Efficiency %6.2f +- %6.2f",eff*100.,err*100.); Double_t degrees = 360.*i/288.; Double_t radians = degrees *3.1416/180.; Int_t link_chip = i%12; Int_t xtrp_wedge = i/12; printf(" XTRP Wedge %2d-%2d",xtrp_wedge,link_chip); printf(" (%5.1f deg, %5.3f rad)", degrees, radians); } } return 0; }