void DrawResults(){ double pbeam = 4.06; gROOT->Macro("/panda/pandaroot/macro/lmd/Style_Imported_Style.C"); TString storePath = "/panda/myResults/DPM_pixel/HIMster/all_15/results13122012"; TString in=storePath+"/sumAll.root"; TFile *f = new TFile(in,"READ"); TTree *tAll_sum = (TTree *)f->Get("tAll"); TTree *tSig_sum = (TTree *)f->Get("tSig"); TTree *tBkg_sum = (TTree *)f->Get("tBkg"); TNtuple *nmcall_sum = ( TNtuple *)f->Get("nmcall"); TTree *nsdshits_sum = (TTree *)f->Get("nsdshits"); TH2D *hpmcprec_sig = new TH2D("hpmcprec_sig","P_{mc} vs. P_{rec} (signal); P_{rec}, GeV/c; P_{mc}, GeV/c",1e3,pbeam-0.5,1.5*pbeam,1e3,pbeam-0.5,1.5*pbeam); TH2D *hpmcprec_bkg = new TH2D("hpmcprec_bkg","P_{mc} vs. P_{rec} (bkg); P_{rec}, GeV/c; P_{mc}, GeV/c",1e3,pbeam-0.5,1.5*pbeam,1e3,pbeam-0.5,1.5*pbeam); TH2D *hxrecsumid = new TH2D("hxrecsumid","X_{rec} vs. sum IDs; sum IDs; X_{rec}, cm",1.2e4,0,1.2e4,1e2,-400,400); TH2D *hxrecsumid_small = new TH2D("hxrecsumid_small","X_{rec} vs. sum IDs; sum IDs; X_{rec}, cm",1.2e4,0,1.2e4,1e2,-10,10); TH2D *hyrecsumid = new TH2D("hyrecsumid","Y_{rec} vs. sum IDs; sum IDs; Y_{rec}, cm",1.2e4,0,1.2e4,1e2,-400,400); TH2D *hyrecsumid_small = new TH2D("hyrecsumid_small","Y_{rec} vs. sum IDs; sum IDs; Y_{rec}, cm",1.2e4,0,1.2e4,1e2,-10,10); TH2D *hzrecsumid = new TH2D("hzrecsumid","Z_{rec} vs. sum IDs; sum IDs; Z_{rec}, cm",1.2e4,0,1.2e4,1e2,-400,400); TH2D *hzrecsumid_small = new TH2D("hzrecsumid_small","Z_{rec} vs. sum IDs; sum IDs; Z_{rec}, cm",1.2e4,0,1.2e4,1e2,-0.1,0.1); TH1F *htheta_sig = new TH1F("htheta_sig","#theta_{rec} (signal); #theta, rad",1e3,0,0.05); TH2F *htheta_sig_mcrec = new TH2F("htheta_sig_mcrec","#theta;#theta_{MC}, rad;#theta_{rec}, rad",1e3,0,0.05,1e3,0,0.05); TH1F *htheta_bkg = new TH1F("htheta_bkg","#theta_{rec} (bkg); #theta, rad",1e3,0,0.05); TH1F *hphi_sig = new TH1F("hphi_sig","#phi_{rec} (signal); #phi, rad",1e3,-3.15,3.15); TH1F *hphi_bkg = new TH1F("hphi_bkg","#phi_{rec} (bkg); #phi, rad",1e3,-3.15,3.15); TH1F *hxpca_bkg = new TH1F("hxpca_bkg","X_{PCA} (bkg); x, cm",1e3,-10.,10.); TH1F *hxpca_sig = new TH1F("hxpca_sig","X_{PCA} (sig); x, cm",1e3,-10.,10.); TH1F *hypca_bkg = new TH1F("hypca_bkg","Y_{PCA} (bkg); y, cm",1e3,-10.,10.); TH1F *hypca_sig = new TH1F("hypca_sig","Y_{PCA} (sig); y, cm",1e3,-10.,10.); TH1F *hzpca_bkg = new TH1F("hzpca_bkg","Z_{PCA} (bkg); z, cm",1e3,-1.,1.); TH1F *hzpca_sig = new TH1F("hzpca_sig","Z_{PCA} (sig); z, cm",1e3,-1.,1.); TH1F *hp_bkg = new TH1F("hp_bkg","momentum (bkg); p, GeV/c",1e3,pbeam-0.5,1.5*pbeam); TH1F *hp_sig = new TH1F("hp_sig","momentum (sig); p, GeV/c",1e3,pbeam-0.5,1.5*pbeam); TH1I *hnrectrks_sig = new TH1I("hnrectrks_sig","# of rec trk per event",10,0,10); TH1I *hnrectrks_bkg = new TH1I("hnrectrks_bkg","# of rec trk per event (bkg)",10,0,10); TH1I *hnrechits_sig = new TH1I("hnrechits_sig","# of rec hits per event",1000,0,1000); TH1I *hnrechits_bkg = new TH1I("hnrechits_bkg","# of rec hits per event (bkg)",1000,0,1000); tAll_sum->Project("hxrecsumid","x:sumid","abs(sumid)<1e6 && id<1e4"); tAll_sum->Project("hxrecsumid_small","x:sumid","abs(sumid)<1e6 && id<1e4"); tAll_sum->Project("hyrecsumid","y:sumid","abs(sumid)<1e6 && id<1e4"); tAll_sum->Project("hyrecsumid_small","y:sumid","abs(sumid)<1e6 && id<1e4"); tAll_sum->Project("hzrecsumid","z:sumid","abs(sumid)<1e6 && id<1e4"); tAll_sum->Project("hzrecsumid_small","z:sumid","abs(sumid)<1e6 && id<1e4"); tAll_sum->Project("hpmcprec_sig","pmc:p","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("hpmcprec_bkg","pmc:p","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("htheta_sig_mcrec","theta:thetamc","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("htheta_sig","theta","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("htheta_bkg","theta","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("hphi_sig","phi","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("hphi_bkg","phi","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("hxpca_bkg","x","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("hxpca_sig","x","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("hypca_bkg","y","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("hypca_sig","y","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("hzpca_bkg","z","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("hzpca_sig","z","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("hp_bkg","p","sumid<1e6 && id<1e4 && sumid!=4424"); tAll_sum->Project("hp_sig","p","sumid<1e6 && id<1e4 && sumid==4424"); tAll_sum->Project("hnrectrks_sig","nrectrks","sumid==4424"); int nsigtrks = tAll_sum->GetEntries("sumid==4424"); tAll_sum->Project("hnrectrks_bkg","nrectrks","sumid!=4424"); int nbkgtrks = tAll_sum->GetEntries("sumid!=4424"); ///TODO: read nsdshits with info about counting rate per plane\sensor nmcall_sum->Project("hnrechits_sig","nRecHitsEvent","sumpdgid==4424 && nRecHitsEvent>0"); int nsighits = nmcall_sum->GetEntries("sumpdgid==4424 && nRecHitsEvent>0"); nmcall_sum->Project("hnrechits_bkg","nRecHitsEvent","sumpdgid!=4424 && nRecHitsEvent>0"); int nbkghits = nmcall_sum->GetEntries("sumpdgid!=4424 && nRecHitsEvent>0"); TH1D *ht1 = new TH1D("ht1","time stamp;time, ns",1e2,0,1e2); TH1D *ht2 = new TH1D("ht2","time stamp;time, ns",1e2,0,1e2); TH1D *ht3 = new TH1D("ht3","time stamp;time, ns",1e2,0,1e2); TH1D *ht4 = new TH1D("ht4","time stamp;time, ns",1e2,0,1e2); nsdshits_sum->Project("ht1","time","z<1130. && pdgid==-2212 && motherID<0"); nsdshits_sum->Project("ht2","time","z>1140. && z<1150. && pdgid==-2212 && motherID<0"); nsdshits_sum->Project("ht3","time","z>1150. && z<1160. && pdgid==-2212 && motherID<0"); nsdshits_sum->Project("ht4","time","z>1160. && z<1170. && pdgid==-2212 && motherID<0"); TH1D *ht1bkg = new TH1D("ht1bkg","time stamp;time, ns",3.2e3,0,1.6e4); TH1D *ht2bkg = new TH1D("ht2bkg","time stamp;time, ns",3.2e3,0,1.6e4); TH1D *ht3bkg = new TH1D("ht3bkg","time stamp;time, ns",3.2e3,0,1.6e4); TH1D *ht4bkg = new TH1D("ht4bkg","time stamp;time, ns",3.2e3,0,1.6e4); nsdshits_sum->Project("ht1bkg","time","z<1130. && motherID>0"); nsdshits_sum->Project("ht2bkg","time","z>1140. && z<1150. && (motherID>0 || pdgid!=-2212)"); nsdshits_sum->Project("ht3bkg","time","z>1150. && z<1160. && (motherID>0 || pdgid!=-2212)"); nsdshits_sum->Project("ht4bkg","time","z>1160. && z<1170. && (motherID>0 || pdgid!=-2212)"); TCanvas *ctime = new TCanvas("ctime"); ctime->Divide(2,2); ctime->cd(1); ht1->SetLineWidth(2); ht1->SetLineColor(2); ht1->Draw(); ht2->Draw("same"); ht2->SetLineWidth(2); ht2->SetLineColor(3); ht3->Draw("same"); ht4->SetLineWidth(2); ht4->SetLineColor(4); ht4->Draw("same"); ctime->cd(2); TH1F *ht41 = (TH1F*)ht4->Clone("ht41"); ht41->Add(ht1,-1); ht41->SetTitle("t_{4}-t_{1}"); ht41->SetLineWidth(2); ht41->SetLineColor(2); ht41->Draw(); TH1F *ht42 = (TH1F*)ht4->Clone("ht42"); ht42->SetTitle("t_{4}-t_{2}"); ht42->Add(ht2,-1); ht42->SetLineWidth(2); ht42->SetLineColor(3); ht42->Draw("same"); TH1F *ht43 = (TH1F*)ht4->Clone("ht43"); ht43->SetTitle("t_{4}-t_{3}"); ht43->Add(ht3,-1); ht43->SetLineWidth(2); ht43->SetLineColor(4); ht43->Draw("same"); ctime->cd(3); ht1bkg->SetLineWidth(2); ht1bkg->SetLineColor(2); ht1bkg->Draw(); ht2bkg->Draw("same"); ht2bkg->SetLineWidth(2); ht2bkg->SetLineColor(3); ht3bkg->Draw("same"); ht4bkg->SetLineWidth(2); ht4bkg->SetLineColor(4); ht4bkg->Draw("same"); ctime->cd(4); TH1F *ht41bkg = (TH1F*)ht4bkg->Clone("ht41bkg"); TH1F *ht42bkg = (TH1F*)ht4bkg->Clone("ht42bkg"); TH1F *ht43bkg = (TH1F*)ht4bkg->Clone("ht43bkg"); ht41bkg->Add(ht1bkg,-1); ht41bkg->SetTitle("t_{4}-t_{1}"); ht41bkg->SetLineWidth(2); ht41bkg->SetLineColor(2); ht41bkg->Draw(); ht42bkg->SetTitle("t_{4}-t_{2}"); ht42bkg->Add(ht2bkg,-1); ht42bkg->SetLineWidth(2); ht42bkg->SetLineColor(3); ht42bkg->Draw("same"); ht43bkg->SetTitle("t_{4}-t_{3}"); ht43bkg->Add(ht3bkg,-1); ht43bkg->SetLineWidth(2); ht43bkg->SetLineColor(4); ht43bkg->Draw("same"); // ctime->Write(); TCanvas *ctheta_sig = new TCanvas("ctheta_sig"); htheta_sig->Draw(); // ctheta_sig->SaveAs(storePath+"/theta_sig.pdf"); TCanvas *ctheta_bkg = new TCanvas("ctheta_bkg"); htheta_bkg->Draw(); // ctheta_bkg->SaveAs(storePath+"/theta_bkg.pdf"); TCanvas *cphi_sig = new TCanvas("cphi_sig"); hphi_sig->Draw(); // cphi_sig->SaveAs(storePath+"/phi_sig.pdf"); TCanvas *cphi_bkg = new TCanvas("cphi_bkg"); hphi_bkg->Draw(); // cphi_bkg->SaveAs(storePath+"/phi_bkg.pdf"); TCanvas *cxpca_sig = new TCanvas("cxpca_sig"); hxpca_sig->Draw(); // cxpca_sig->SaveAs(storePath+"/xpca_sig.pdf"); TCanvas *cxpca_bkg = new TCanvas("cxpca_bkg"); hxpca_bkg->Draw(); // cxpca_bkg->SaveAs(storePath+"/xpca_bkg.pdf"); TCanvas *cypca_sig = new TCanvas("cypca_sig"); hypca_sig->Draw(); TCanvas *cypca_bkg = new TCanvas("cypca_bkg"); hypca_bkg->Draw(); TCanvas *czpca_sig = new TCanvas("czpca_sig"); hzpca_sig->Draw(); TCanvas *czpca_bkg = new TCanvas("czpca_bkg"); hzpca_bkg->Draw(); TCanvas *cp_sig = new TCanvas("cp_sig"); hp_sig->Draw(); TCanvas *cp_bkg = new TCanvas("cp_bkg"); hp_bkg->Draw(); TCanvas *ctrks_sig = new TCanvas("ctrks_sig"); hnrectrks_sig->SetLineColor(2); hnrectrks_sig->SetLineWidth(2); hnrectrks_bkg->SetLineColor(4); hnrectrks_bkg->SetLineWidth(2); hnrectrks_sig->Draw(); hnrectrks_bkg->Draw("same"); gStyle->SetOptStat(000000); ctrks_sig->SetLogy(1); TLatex text_count_rate_trk; text_count_rate_trk.SetTextSize(0.055); text_count_rate_trk.SetTextAlign(12); //align at center TString text_count_rate_sig_trk = "#it{#color[2]{p#bar{p}: "; text_count_rate_sig_trk+=nsigtrks; text_count_rate_sig_trk+=" trks}}"; text_count_rate_trk.DrawLatex(4,2e5,text_count_rate_sig_trk); TString text_count_rate_bkg_trk = "#it{#color[4]{inel.: "; text_count_rate_bkg_trk+=nbkgtrks; text_count_rate_bkg_trk+=" trks}}"; text_count_rate_trk.DrawLatex(4,4e4,text_count_rate_bkg_trk); text_count_rate_trk.DrawLatex(4,1e4,"(per 1s)"); ctrks_sig->SaveAs(storePath+"/trks_redSig_blueBkg.pdf"); TCanvas *ctrks_bkg = new TCanvas("ctrks_bkg"); hnrectrks_bkg->Draw(); ctrks_bkg->SetLogy(1); //gStyle->SetOptStat(111111); // ctrks_bkg->SaveAs(storePath+"/trks_bkg.pdf"); TCanvas *chits_sig = new TCanvas("chits_sig"); hnrechits_sig->SetLineColor(2); hnrechits_sig->SetLineWidth(2); hnrechits_bkg->SetLineColor(4); hnrechits_bkg->SetLineWidth(2); hnrechits_sig->Draw(); hnrechits_bkg->Draw("same"); chits_sig->SetLogy(1); chits_sig->SetLogx(1); TLatex text_count_rate; text_count_rate.SetTextSize(0.055); text_count_rate.SetTextAlign(12); //align at center TString text_count_rate_sig = "#it{#color[2]{p#bar{p}: "; text_count_rate_sig+=nsighits; text_count_rate_sig+=" hits}}"; text_count_rate.DrawLatex(10,7e4,text_count_rate_sig); TString text_count_rate_bkg = "#it{#color[4]{inel.: "; text_count_rate_bkg+=nbkghits; text_count_rate_bkg+=" hits}}"; text_count_rate.DrawLatex(10,2e4,text_count_rate_bkg); text_count_rate.DrawLatex(10,7e3,"(on all planes, per 1s)"); chits_sig->SaveAs(storePath+"/hits_redSig_blueBkg.pdf"); TString resname_pdf =storePath+"/summary.pdf"; TString resname_pdf_o = resname_pdf+"("; ctheta_sig->Print(resname_pdf_o); ctheta_bkg->Print(resname_pdf_o); cphi_sig->Print(resname_pdf_o); cphi_bkg->Print(resname_pdf_o); cxpca_sig->Print(resname_pdf_o); cxpca_bkg->Print(resname_pdf_o); cypca_sig->Print(resname_pdf_o); cypca_bkg->Print(resname_pdf_o); czpca_sig->Print(resname_pdf_o); czpca_bkg->Print(resname_pdf_o); cp_sig->Print(resname_pdf_o); cp_bkg->Print(resname_pdf_o); ctrks_sig->Print(resname_pdf_o); ctrks_bkg->Print(resname_pdf_o); ctime->Print(resname_pdf_o); TString resname_pdf_c = resname_pdf+")"; chits_sig->Print(resname_pdf_c); // cpmcprec_sig->Print(resname_pdf_o); // cpmcprec_bkg->Print(resname_pdf_o); // cxrecsumid->Print(resname_pdf_o); // cxrecsumid_small->Print(resname_pdf_o); // cyrecsumid->Print(resname_pdf_o); // cyrecsumid_small->Print(resname_pdf_o); // czrecsumid->Print(resname_pdf_o); // czrecsumid_small->Print(resname_pdf_o); // TString resname_pdf_c = resname_pdf+")"; // ctheta_sig_mcrec->Print(resname_pdf_c); ctheta_sig->Close(); ctheta_bkg->Close(); cphi_sig->Close(); cphi_bkg->Close(); cxpca_sig->Close(); cxpca_bkg->Close(); cypca_sig->Close(); cypca_bkg->Close(); czpca_sig->Close(); czpca_bkg->Close(); cp_sig->Close(); cp_bkg->Close(); ctrks_sig->Close(); ctrks_bkg->Close(); chits_sig->Close(); // cpmcprec_sig->Close(); // cpmcprec_bkg->Close(); // cxrecsumid->Close(); // cxrecsumid_small->Close(); // cyrecsumid->Close(); // cyrecsumid_small->Close(); // czrecsumid->Close(); // czrecsumid_small->Close(); // ctheta_sig_mcrec->Close(); }