6 gStyle->SetPalette(1,NULL);
9 TFile *
f =
new TFile(
"hd_root.root");
11 TTree *
trkeff = (TTree*)gROOT->FindObject(
"trkeff");
20 double sigma_pt_pull = 1.0;
21 double sigma_theta_pull = 1.0;
22 double sigma_phi_pull = 1.0;
24 TH1D *
h =
new TH1D(
"h",
"",200, -10.0, 10.0);
25 TCut cut1 =
"isreconstructable==1";
28 trkeff->Project(
"h",
"pt_pull", cut1);
30 sigma_pt_pull = h->GetFunction(
"gaus")->GetParameter(2);
33 trkeff->Project(
"h",
"theta_pull", cut1);
35 sigma_theta_pull = h->GetFunction(
"gaus")->GetParameter(2);
38 trkeff->Project(
"h",
"phi_pull", cut1);
40 sigma_phi_pull = h->GetFunction(
"gaus")->GetParameter(2);
42 cout<<
"sigma_pt_pull="<<sigma_pt_pull<<
" sigma_theta_pull="<<sigma_theta_pull<<
" sigma_phi_pull="<<sigma_phi_pull<<endl;
46 sprintf(chisq_str,
"((pow(pt_pull/%f,2.0) + pow(theta_pull/%f,2.0) + pow(phi_pull/%f,2.0))/3.0)", sigma_pt_pull, sigma_theta_pull, sigma_phi_pull);
47 sprintf(cut_str,
"%s<50.0", chisq_str);
50 TH2D *found_vs_pt_vs_theta =
new TH2D(
"found_vs_pt_vs_theta",
"", 80, 0.0, 160.0, 30, 0.0, 5.0);
51 TH2D *thrown_vs_pt_vs_theta = found_vs_pt_vs_theta->Clone(
"thrown_vs_pt_vs_theta");
52 TH2D *eff_vs_pt_vs_theta = found_vs_pt_vs_theta->Clone(
"eff_vs_pt_vs_theta");
54 trkeff->Project(
"found_vs_pt_vs_theta",
"E.pthrown.Perp():E.pthrown.Theta()*57.3", cut1 && cut2);
55 trkeff->Project(
"thrown_vs_pt_vs_theta",
"E.pthrown.Perp():E.pthrown.Theta()*57.3", cut1);
56 eff_vs_pt_vs_theta->Divide(found_vs_pt_vs_theta, thrown_vs_pt_vs_theta);
58 eff_vs_pt_vs_theta->SetStats(0);
59 eff_vs_pt_vs_theta->GetZaxis()->SetRangeUser(0.8, 1.0);
60 eff_vs_pt_vs_theta->Draw(
"colz");
62 int maxbin = eff_vs_pt_vs_theta->GetMaximumBin();
63 cout<<
"Maximum efficiency:"<<eff_vs_pt_vs_theta->GetBinContent(maxbin)<<endl;
sprintf(text,"Post KinFit Cut")