5 Double_t Red[5] = { 0.5,1.00,,0,0, 0 };
6 Double_t Green[5] = { 0.1, 0.3, 1., 0., 0.};
7 Double_t Blue[5] = { 0.1, 0.35, 0.65,0.8,1.0 };
8 Double_t Length[5] = { 0.00, 0.3, 0.5, 0.85, 1.00 };
10 TColor::CreateGradientColorTable(5,Length,Red,Green,Blue,nb);
13 TDirectory *TRACKING = (TDirectory*)gROOT->FindObject(
"TRACKING");
14 if(TRACKING)TRACKING->cd();
17 TTree *
trkeff = (TTree*)gROOT->FindObject(
"trkeff");
20 TH2D *np =
new TH2D(
"np",
"Numerator", 70,0,140,70,-0.05,6.95);
21 TH2D *
dp =
new TH2D(
"dp",
"Denominator",70,0,140,70,-0.05,6.95);
22 TH2D *npcut =
new TH2D(
"npcut",
"numerator",70,0,140,70,-0.05,6.95);
24 trkeff->Project(
"np",
"F.pthrown.Mag():180./3.14159*F.pthrown.Theta()",
"F.trktb.Nfdc>0 || F.trktb.Ncdc>0");
25 trkeff->Project(
"dp",
"F.pthrown.Mag():180/3.14159*F.pthrown.Theta()",
"");
26 trkeff->Project(
"npcut",
"F.pthrown.Mag():180./3.14159*F.pthrown.Theta()",
"(F.trktb.Nfdc>0 || F.trktb.Ncdc>0) && TMath::Prob(F.trktb.trk_chisq,F.trktb.trk_Ndof)>0.01");
28 TH2D *effp = np->Clone(
"effp");
30 TCanvas *
c1 =
new TCanvas(
"c1");
34 effp->SetMarkerStyle(2);
39 effp->SetTitle(
"Pion reconstruction efficiency");
41 effp->SetTitle(
"Proton reconstruction efficiency");
42 effp->SetAxisRange(0,88,
"X");
43 effp->SetAxisRange(0,2,
"Y");
45 effp->SetXTitle(
"#theta [degrees]");
46 effp->SetYTitle(
"p [GeV/c]");
50 TH2D *ridge =
new TH2D(
"ridge",
"ridge", 70,0,140,70,-0.05,6.95);
51 for (
unsigned int i=2;i<65;i++){
52 for (
unsigned int j=2;j<70;j++){
53 double frac=effp->GetBinContent(i,j);
55 double min_weight=exp(-(0.8-0.5)*(0.8-0.5)/1);
56 double weight=exp(-(frac-0.5)*(frac-0.5)/1);
57 if (weight>min_weight){
58 ridge->SetBinContent(i,j,1000.*(weight-min_weight));
67 TF1 *
f1=ridge->GetFunction(
"pol3");
68 f1->GetParameters(par);
69 f1->SetRange(0.95,130.5);
74 if (pid==14) pmax=2.05;
75 double p1=par[0]+par[1]+par[2]+par[3];
76 double p2=par[0]+par[1]*130.+par[2]*130.*130.+par[3]*130.*130.*130.;
77 TLine *line1 =
new TLine(1,p1,1,pmax);
78 line1->SetLineColor(5);
79 line1->SetLineWidth(2);
82 TLine *line2 =
new TLine(130,p2,130,pmax);
83 line2->SetLineColor(5);
84 line2->SetLineWidth(2);
87 if (pid==9) c1->SaveAs(
"pion_efficiency.png");
88 else c1->SaveAs(
"proton_efficiency.png");
91 TH2D *effpcut = npcut->Clone(
"effpcut");
93 TCanvas *
c2 =
new TCanvas(
"c2");
97 effpcut->SetMarkerStyle(2);
101 effpcut->SetContour(nb);
103 effpcut->SetTitle(
"Pion reconstruction efficiency, P(#chi^2)>0.01");
105 effpcut->SetTitle(
"Proton reconstruction efficiency, P(#chi^2)>0.01");
106 effpcut->SetAxisRange(0,88,
"X");
107 effpcut->SetAxisRange(0,2,
"Y");
109 effpcut->SetXTitle(
"#theta [degrees]");
110 effpcut->SetYTitle(
"p [GeV/c]");
111 effpcut->Draw(
"colz");
114 if (pid==9) line2->Draw();
116 if (pid==9) c2->SaveAs(
"pion_efficiency_with_chi2_cut.png");
117 else c2->SaveAs(
"proton_efficiency_with_chi2_cut.png");
120 ofstream ofile(
"pion.txt");
121 ofile <<
"<html>" <<endl;
122 ofile<<
"<h1>Single track reconstruction</h1>" <<endl;
123 ofile<<
"<p> Yellow lines indicate recommended fiducial cuts </p>"
125 ofile<<
"<h2>Pion events</h6>" <<endl;
128 ofstream ofile(
"proton.txt");
129 ofile<<
"<h2>Proton events</h6>" <<endl;
131 double eff = np->GetEntries()/dp->GetEntries();
132 ofile <<
"<p>Overall efficiency = "<<eff<<
"<br/>"<<endl;
133 double effcut = npcut->GetEntries()/dp->GetEntries();
134 ofile <<
" Efficiency (Prob>0.01) = "<<effcut<<
"<br/>" << endl;
135 ofile <<
"Momentum cut: p=" << par[0] <<
" + "
136 << par[1] <<
" θ + "
137 << par[2] <<
" θ<sup>2</sup> + " << par[3]
138 <<
" θ<sup>3</sup></p>" <<endl;
140 ofile <<
"<img src=\"pion_efficiency.png\">" <<endl;
141 ofile <<
"<img src=\"pion_efficiency_with_chi2_cut.png\">" <<endl;
144 ofile <<
"<img src=\"proton_efficiency.png\">" <<endl;
145 ofile <<
"<img src=\"proton_efficiency_with_chi2_cut.png\">" <<endl;
146 ofile <<
"</html>" <<endl;