File indexing completed on 2025-08-03 08:13:11
0001 #include <TH2D.h>
0002 #include <TFile.h>
0003 #include <TF1.h>
0004 #include <TF2.h>
0005 #include <TGraph.h>
0006 #include <TCanvas.h>
0007 #include <TROOT.h>
0008 #include <TStyle.h>
0009 #include <TLegend.h>
0010 #include <TLatex.h>
0011 #include <TLine.h>
0012 #include <TColor.h>
0013
0014 #include "sPhenixStyle.C"
0015
0016 void plot_comparisons_purity()
0017 {
0018
0019 SetsPhenixStyle();
0020
0021
0022
0023
0024
0025
0026
0027
0028 bool toymodel = false;
0029
0030 static const int NPLOTS = 2;
0031 double hptmax = 40.0;
0032
0033 TFile *fin[NPLOTS];
0034
0035 char label[NPLOTS][500];
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 fin[0] = new TFile("root_files/look_purity_out_100pions_80ns_baseline_noMVTX.root");
0051 fin[1] = new TFile("root_files/look_purity_out_central_167khz_80ns_1-5");
0052 sprintf(label[0], "100pions");
0053 sprintf(label[1], "Central+store average lumi+100pions");
0054
0055
0056
0057
0058
0059 TGraph *gdca[NPLOTS];
0060 TGraph *gdcaZ[NPLOTS];
0061 TGraph *geff[NPLOTS];
0062 TGraph *grdpt[NPLOTS];
0063
0064 int col[3] = {kRed, kBlue, kBlack};
0065
0066 for(int i=0;i<NPLOTS;i++)
0067 {
0068 if(!fin[i])
0069 {
0070 cout << "Did not find file " << i << " quit!" << endl;
0071 exit(1);
0072 }
0073
0074 fin[i]->GetObject("single_track_efficiency",geff[i]);
0075 fin[i]->GetObject("dca2d_resolution",gdca[i]);
0076 fin[i]->GetObject("dcaZ_resolution",gdcaZ[i]);
0077 fin[i]->GetObject("pt_resolution",grdpt[i]);
0078
0079 if(!geff[i])
0080 {
0081 cout << "Failed to find geff for " << i << endl;
0082
0083 }
0084
0085 if(!gdca[i])
0086 {
0087 cout << "Failed to find gdca for " << i << endl;
0088 exit(1);
0089 }
0090 if(!gdcaZ[i])
0091 {
0092 cout << "Failed to find gdcaZ for " << i << endl;
0093 exit(1);
0094 }
0095 if(!grdpt[i])
0096 {
0097 cout << "Failed to find grdpt for " << i << endl;
0098 exit(1);
0099 }
0100 }
0101
0102
0103 char lab[500];
0104
0105
0106 sprintf(lab,"100 pion events");
0107
0108
0109 TCanvas *ceff = new TCanvas("ceff","ceff",50,50,800,800);
0110
0111
0112 TH1F *hd = new TH1F("hd","hd",100, 0.0, hptmax);
0113 hd->SetMinimum(0.0);
0114 hd->SetMaximum(1.1);
0115 hd->GetXaxis()->SetTitle("p_{T} (GeV/c)");
0116 hd->GetXaxis()->SetTitleOffset(1.15);
0117 hd->GetYaxis()->SetTitle("Single track efficiency");
0118 hd->GetYaxis()->SetTitleOffset(1.3);
0119 hd->Draw();
0120
0121 for(int i=0;i<NPLOTS;i++)
0122 {
0123 geff[i]->SetMarkerColor(col[i]);
0124
0125 if(i==0)
0126 geff[i]->Draw("p");
0127 else
0128 geff[i]->Draw("same p");
0129 }
0130
0131 TLegend *lpd = new TLegend(0.30, 0.45, 0.95, 0.65, "", "NDC");
0132 lpd->SetBorderSize(0);
0133 lpd->SetFillColor(0);
0134 lpd->SetFillStyle(0);
0135 for(int i=0;i<NPLOTS;i++)
0136 {
0137 lpd->AddEntry(geff[i],label[i], "p");
0138 }
0139 lpd->Draw();
0140
0141 TLine *unit = new TLine(0,1.0,40,1.0);
0142 unit->SetLineStyle(3);
0143 unit->SetLineWidth(1);
0144 unit->Draw();
0145
0146
0147
0148
0149 TCanvas *cdca = new TCanvas("cdca","cdca",50,50,800,800);
0150
0151
0152
0153 TH1F *hdca = new TH1F("hdca","hdca",100, 0.0, hptmax);
0154 hdca->SetMinimum(0.0003);
0155 hdca->SetMaximum(0.02);
0156 hdca->GetXaxis()->SetTitle("p_{T} (GeV/c)");
0157 hdca->GetXaxis()->SetTitleOffset(1.25);
0158 hdca->GetYaxis()->SetTitle("DCA(r#phi) resolution (cm)");
0159 hdca->GetYaxis()->SetTitleOffset(1.4);
0160 hdca->Draw();
0161
0162 gPad->SetLogy(1);
0163
0164 for(int i=0;i<NPLOTS;i++)
0165 {
0166 gdca[i]->SetMarkerColor(col[i]);
0167
0168 if(i==0)
0169 gdca[i]->Draw("p");
0170 else
0171 gdca[i]->Draw("same p");
0172 }
0173
0174 TLegend *lpd1 = new TLegend(0.30, 0.7, 0.95, 0.92, "", "NDC");
0175 lpd1->SetBorderSize(0);
0176 lpd1->SetFillColor(0);
0177 lpd1->SetFillStyle(0);
0178 for(int i=0;i<NPLOTS;i++)
0179 {
0180 lpd1->AddEntry(gdca[i],label[i], "p");
0181 }
0182
0183 lpd1->Draw();
0184
0185 TCanvas *cdcaz = new TCanvas("cdcaz","cdcaz",50,50,800,800);
0186
0187
0188 TH1F *hdcaz = new TH1F("hdcaz","hdcaz",100, 0.0, hptmax);
0189 hdcaz->SetMinimum(0.0003);
0190 hdcaz->SetMaximum(0.02);
0191 hdcaz->GetXaxis()->SetTitle("p_{T} (GeV/c)");
0192 hdcaz->GetXaxis()->SetTitleOffset(1.25);
0193 hdcaz->GetYaxis()->SetTitle("DCA(Z) resolution (cm)");
0194 hdcaz->GetYaxis()->SetTitleOffset(1.4);
0195 hdcaz->Draw();
0196
0197 gPad->SetLogy(1);
0198
0199 for(int i=0;i<NPLOTS;i++)
0200 {
0201 gdcaZ[i]->SetMarkerColor(col[i]);
0202
0203 if(i==0)
0204 gdcaZ[i]->Draw("p");
0205 else
0206 gdcaZ[i]->Draw("same p");
0207 }
0208
0209 TLegend *lpd1z = new TLegend(0.30, 0.70, 0.95, 0.92, "", "NDC");
0210 lpd1z->SetBorderSize(0);
0211 lpd1z->SetFillColor(0);
0212 lpd1z->SetFillStyle(0);
0213 lpd1z->AddEntry(geff[0],label[0], "p");
0214 lpd1z->AddEntry(geff[1], label[1], "p");
0215 lpd1z->Draw();
0216
0217
0218 double hdptmax = 40.0;
0219
0220
0221 TCanvas *crdpt = new TCanvas("crdpt","crdpt",50,50,800,800);
0222
0223
0224 TH1F *hrdpt = new TH1F("hrdpt","hrdpt",100, 0.0, hdptmax);
0225 hrdpt->SetMinimum(0.0);
0226 hrdpt->SetMaximum(0.11);
0227 hrdpt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
0228 hrdpt->GetXaxis()->SetTitleOffset(1.25);
0229 hrdpt->GetYaxis()->SetTitle("#Delta p_{T} / p_{T}");
0230 hrdpt->GetYaxis()->SetTitleOffset(1.5);
0231 hrdpt->Draw();
0232
0233 for(int i=0;i<NPLOTS;i++)
0234 {
0235 grdpt[i]->SetMarkerColor(col[i]);
0236
0237 if(i==0)
0238 grdpt[i]->Draw("p");
0239 else
0240 grdpt[i]->Draw("same p");
0241 }
0242
0243 TLegend *lpd2 = new TLegend(0.15, 0.72, 0.85, 0.87, "", "NDC");
0244 lpd2->SetBorderSize(0);
0245 lpd2->SetFillColor(0);
0246 lpd2->SetFillStyle(0);
0247 lpd2->AddEntry(grdpt[0], label[0], "p");
0248 lpd2->AddEntry(grdpt[1], label[1], "p");
0249 lpd2->Draw();
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330 }