File indexing completed on 2025-08-05 08:12:15
0001 #include <cmath>
0002 #include <TFile.h>
0003 #include <TString.h>
0004 #include <TLine.h>
0005 #include <TTree.h>
0006 #include <cassert>
0007 #include "SaveCanvas.C"
0008 #include "SetOKStyle.C"
0009 using namespace std;
0010
0011 void
0012 DrawEcal(void)
0013 {
0014 SetOKStyle();
0015 gStyle->SetOptStat(0);
0016 gStyle->SetOptFit(1111);
0017 TVirtualFitter::SetDefaultFitter("Minuit2");
0018 gSystem->Load("libg4eval.so");
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 }
0063
0064 void
0065 DrawEnergyDensity(
0066 const TString infile =
0067 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm_ALL.root_EMCalAna.root",
0068 const TString title = "HIJING Au+Au 0-10% C + Geant4")
0069 {
0070 TH1 * EMCalAna_h_CEMC_RZ = DrawTower_Load(infile, "EMCalAna_h_CEMC_RZ");
0071 TH1 * EMCalAna_h_HCALIN_RZ = DrawTower_Load(infile, "EMCalAna_h_HCALIN_RZ");
0072 TH1 * EMCalAna_h_HCALOUT_RZ = DrawTower_Load(infile, "EMCalAna_h_HCALOUT_RZ");
0073
0074 EMCalAna_h_CEMC_RZ->Add(EMCalAna_h_HCALIN_RZ);
0075 EMCalAna_h_CEMC_RZ->Add(EMCalAna_h_HCALOUT_RZ);
0076
0077 for (int r = 1; r <= EMCalAna_h_CEMC_RZ->GetNbinsY(); r++)
0078 {
0079 const double radius = EMCalAna_h_CEMC_RZ->GetYaxis()->GetBinCenter(r);
0080 const double circ = 2 * TMath::Pi() * radius;
0081 for (int z = 1; z <= EMCalAna_h_CEMC_RZ->GetNbinsX(); z++)
0082 {
0083
0084 EMCalAna_h_CEMC_RZ->SetBinContent(z, r,
0085 EMCalAna_h_CEMC_RZ->GetBinContent(z, r) / circ);
0086 }
0087 }
0088
0089 TCanvas *c1 = new TCanvas("DrawEnergyDensity", "DrawEnergyDensity", 1800,
0090 900);
0091 c1->Divide(1, 1);
0092 int idx = 1;
0093 TPad * p;
0094 p = (TPad *) c1->cd(idx++);
0095 c1->Update();
0096 p->SetLogz();
0097
0098
0099
0100 EMCalAna_h_CEMC_RZ->SetTitle(";Z (cm);Radius (cm)");
0101 EMCalAna_h_CEMC_RZ->Draw("colz");
0102
0103 t = new TText(.5, .95, (title));
0104 t->SetNDC();
0105 t->SetTextAlign(22);
0106 t->Draw();
0107
0108 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0109 kTRUE);
0110 }
0111
0112 void
0113 DrawEnergyDensityXY(
0114 const TString infile =
0115 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm_ALL.root_EMCalAna.root",
0116 const TString title = "HIJING Au+Au 0-10% C + Geant4")
0117 {
0118 TH1 * EMCalAna_h_CEMC_RZ = DrawTower_Load(infile, "EMCalAna_h_CEMC_XY");
0119 TH1 * EMCalAna_h_HCALIN_RZ = DrawTower_Load(infile, "EMCalAna_h_HCALIN_XY");
0120 TH1 * EMCalAna_h_HCALOUT_RZ = DrawTower_Load(infile, "EMCalAna_h_HCALOUT_XY");
0121
0122 EMCalAna_h_CEMC_RZ->Add(EMCalAna_h_HCALIN_RZ);
0123 EMCalAna_h_CEMC_RZ->Add(EMCalAna_h_HCALOUT_RZ);
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 TCanvas *c1 = new TCanvas("DrawEnergyDensityXY", "DrawEnergyDensityXY", 900,
0138 900);
0139 c1->Divide(1, 1);
0140 int idx = 1;
0141 TPad * p;
0142 p = (TPad *) c1->cd(idx++);
0143 c1->Update();
0144 p->SetLogz();
0145
0146
0147
0148 EMCalAna_h_CEMC_RZ->SetTitle(";X (cm);Y (cm)");
0149 EMCalAna_h_CEMC_RZ->Draw("colz");
0150
0151 TText *
0152 t = new TText(.5, .95, (title));
0153 t->SetNDC();
0154 t->SetTextSize(0.03);
0155 t->SetTextAlign(22);
0156 t->Draw();
0157
0158 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0159 kTRUE);
0160 }
0161
0162 void
0163 DrawTower_EMCTrigEff(
0164 const TString infile =
0165 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/")
0166 {
0167 TH1F * rej_EMCalAna_h_CEMC_TOWER_4x4_max = DrawTower_Load(
0168 infile
0169 + "/pythia8/spacal2d/G4Hits_sPHENIX_pythia8-ALL.root_EMCalAna.root",
0170 "EMCalAna_h_CEMC_TOWER_4x4_max");
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181 TH1F * sig_EMCalAna_h_CEMC_TOWER_4x4_max =
0182 DrawTower_Load(
0183 infile
0184 + "../test_production/Upsilon/spacal2d/fieldon/SimALL_PythiaUpsilon.root_EMCalAna.root",
0185 "EMCalAna_h_CEMC_TOWER_4x4_max");
0186
0187 TH1F * rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC = DrawTower_Load(
0188 infile
0189 + "/pythia8/spacal2d/G4Hits_sPHENIX_pythia8-ALL.root_EMCalAna.root",
0190 "EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC");
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201 TH1F * sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC =
0202 DrawTower_Load(
0203 infile
0204 + "../test_production/Upsilon/spacal2d/fieldon/SimALL_PythiaUpsilon.root_EMCalAna.root",
0205 "EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC");
0206
0207 TGraphErrors* ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max = Distribution2Efficiency(
0208 rej_EMCalAna_h_CEMC_TOWER_4x4_max);
0209 TGraphErrors* ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max = Distribution2Efficiency(
0210 sig_EMCalAna_h_CEMC_TOWER_4x4_max);
0211
0212 TGraphErrors* ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC = Distribution2Efficiency(
0213 rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC);
0214 TGraphErrors* ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC = Distribution2Efficiency(
0215 sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC);
0216
0217 TCanvas *c1 = new TCanvas("DrawTower_EMCTrigEff", "DrawTower_EMCTrigEff",
0218 1800, 900);
0219 c1->Divide(2, 2);
0220 int idx = 1;
0221 TPad * p;
0222
0223 p = (TPad *) c1->cd(idx++);
0224 c1->Update();
0225 p->SetLogy();
0226 rej_EMCalAna_h_CEMC_TOWER_4x4_max->Draw();
0227 rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("same");
0228 rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineColor(kRed);
0229 rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetMarkerColor(kRed);
0230
0231 p = (TPad *) c1->cd(idx++);
0232 c1->Update();
0233 p->SetLogy();
0234 sig_EMCalAna_h_CEMC_TOWER_4x4_max->Draw();
0235 sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("same");
0236 sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineColor(kRed);
0237 sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetMarkerColor(kRed);
0238
0239 p = (TPad *) c1->cd(idx++);
0240 c1->Update();
0241 p->SetLogy();
0242 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("AP*");
0243 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("P");
0244 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineColor(kRed);
0245 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetMarkerColor(kRed);
0246
0247 p = (TPad *) c1->cd(idx++);
0248 c1->Update();
0249 p->SetLogy();
0250 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("AP*");
0251 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("P");
0252 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineColor(kRed);
0253 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetMarkerColor(kRed);
0254
0255 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0256 kTRUE);
0257
0258 TGraphErrors* reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max =
0259 (TGraphErrors*) ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Clone(
0260 "reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max");
0261
0262 TGraphErrors* reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC =
0263 (TGraphErrors*) ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Clone(
0264 "reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC");
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278 const double y_min = 1;
0279 const double y_max = 1e5;
0280 const double y_min2 = .8;
0281 const double y_max2 = 1;
0282
0283 TGraphErrors* plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max =
0284 (TGraphErrors*) reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Clone(
0285 "plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max");
0286 TGraphErrors* plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max =
0287 (TGraphErrors*) ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->Clone(
0288 "plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max");
0289
0290
0291 TGraphErrors* plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC =
0292 (TGraphErrors*) reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Clone(
0293 "plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC");
0294 TGraphErrors* plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC =
0295 (TGraphErrors*) ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Clone(
0296 "plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC");
0297
0298 for (int i = 0; i < plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->GetN(); ++i)
0299 {
0300 (plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i] =1./(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i];
0301 }
0302
0303 for (int i = 0; i < plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->GetN(); ++i)
0304 {
0305 (plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i] = exp(
0306
0307 ((plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i] - y_min2)/(y_max2 - y_min2)*(log(y_max) - log(y_min)) + log(y_min)
0308
0309 );
0310 }
0311
0312
0313 for (int i = 0; i < plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->GetN(); ++i)
0314 {
0315 (plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->GetY())[i] =1./(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->GetY())[i];
0316 }
0317
0318 for (int i = 0; i < plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->GetN(); ++i)
0319 {
0320 (plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->GetY())[i] = exp(
0321
0322 ((plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->GetY())[i] - y_min2)/(y_max2 - y_min2)*(log(y_max) - log(y_min)) + log(y_min)
0323
0324 );
0325 }
0326
0327
0328 TCanvas *c1 = new TCanvas("DrawTower_EMCTrigEff_Compile",
0329 "DrawTower_EMCTrigEff_Compile", 1800, 900);
0330
0331 int idx = 1;
0332 TPad * p;
0333
0334 p = (TPad *) c1->cd(idx++);
0335 c1->Update();
0336 p->SetLogy();
0337 p->SetGridx(0);
0338 p->SetGridy(0);
0339 p->SetTicky(0);
0340
0341 p->DrawFrame(0, y_min, 5.5, y_max,
0342 ";EMCal trigger #Sigma_{4x4}[ E_{Tower} ] requirement (GeV);Rejection factor for MB events");
0343
0344 TGaxis * a = new TGaxis(5.5,y_min,5.5, y_max,y_min2,y_max2,510,"+L");
0345 a->SetTitle("Trigger efficiency for inclusive Upsilon (1S)");
0346 a->SetLabelColor(kRed);
0347 a->SetTitleColor(kRed);
0348 a->SetLineColor(kRed);
0349 a->SetTextFont(42);
0350 a->Draw();
0351
0352 TLine * l = new TLine(4.3,y_min,4.3,y_max);
0353 l->SetLineColor(kGray);
0354 l->SetLineWidth(5);
0355 l->Draw();
0356
0357 TLatex * t = new TLatex(0, y_max*1.1,"PYTHIA8 p+p #sqrt{s} = 200 GeV + Geant4 + Trigger Emulator");
0358 t->Draw();
0359
0360 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetFillColor(kRed);
0361 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineColor(kRed);
0362 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineWidth(3);
0363 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineStyle(kDashed);
0364
0365 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("lx");
0366
0367 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetFillColor(kBlack);
0368 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineColor(kBlack);
0369 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineWidth(3);
0370 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineStyle(kDashed);
0371
0372 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("lx");
0373
0374
0375 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetFillColor(kRed);
0376 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineColor(kRed);
0377 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineWidth(3);
0378 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("3");
0379 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("lx");
0380
0381 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetFillColor(kBlack);
0382 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineColor(kBlack);
0383 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->SetLineWidth(3);
0384 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("3");
0385 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC->Draw("lx");
0386
0387 TLegend * legd = new TLegend(0.13,0.5,0.5,0.9);
0388
0389 TLegendEntry * le =
0390 legd->AddEntry(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC, "Rej. for MB (8-bit truncated)", "lx");
0391 le->SetTextFont(42);
0392 TLegendEntry * le =
0393 legd->AddEntry(plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max_trigger_ADC, "Eff. for #Upsilon (8-bit truncated)", "lx");
0394 le->SetTextFont(42);
0395 le->SetTextColor(kRed);
0396 TLegendEntry * le =
0397 legd->AddEntry(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max, "Rej. for MB (full bit ADC)", "lx");
0398 le->SetTextFont(42);
0399 TLegendEntry * le =
0400 legd->AddEntry(plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max, "Eff. for #Upsilon (full bit ADC)", "lx");
0401 le->SetTextFont(42);
0402 le->SetTextColor(kRed);
0403
0404 legd->Draw();
0405
0406 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0407 kTRUE);
0408 }
0409
0410
0411 void
0412 DrawTower_EMCTrigEff_SlideingWindow2(
0413 const TString infile =
0414 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/")
0415 {
0416 TH1F * rej_EMCalAna_h_CEMC_TOWER_4x4_max = DrawTower_Load(
0417 infile
0418 + "/pythia8/spacal2d/G4Hits_sPHENIX_pythia8-ALL.root_EMCalAna.root",
0419 "EMCalAna_h_CEMC_TOWER_4x4_max");
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430 TH1F * sig_EMCalAna_h_CEMC_TOWER_4x4_max =
0431 DrawTower_Load(
0432 infile
0433 + "../test_production/Upsilon/spacal2d/fieldon/SimALL_PythiaUpsilon.root_EMCalAna.root",
0434 "EMCalAna_h_CEMC_TOWER_4x4_max");
0435
0436 TH1F * rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC = DrawTower_Load(
0437 infile
0438 + "/pythia8/spacal2d/G4Hits_sPHENIX_pythia8-ALL.root_EMCalAna.root",
0439 "EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC");
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450 TH1F * sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC =
0451 DrawTower_Load(
0452 infile
0453 + "../test_production/Upsilon/spacal2d/fieldon/SimALL_PythiaUpsilon.root_EMCalAna.root",
0454 "EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC");
0455
0456 TGraphErrors* ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max = Distribution2Efficiency(
0457 rej_EMCalAna_h_CEMC_TOWER_4x4_max);
0458 TGraphErrors* ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max = Distribution2Efficiency(
0459 sig_EMCalAna_h_CEMC_TOWER_4x4_max);
0460
0461 TGraphErrors* ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC = Distribution2Efficiency(
0462 rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC);
0463 TGraphErrors* ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC = Distribution2Efficiency(
0464 sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC);
0465
0466 TCanvas *c1 = new TCanvas("DrawTower_EMCTrigEff_SlideingWindow2", "DrawTower_EMCTrigEff_SlideingWindow2",
0467 1800, 900);
0468 c1->Divide(2, 2);
0469 int idx = 1;
0470 TPad * p;
0471
0472 p = (TPad *) c1->cd(idx++);
0473 c1->Update();
0474 p->SetLogy();
0475 rej_EMCalAna_h_CEMC_TOWER_4x4_max->Draw();
0476 rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("same");
0477 rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineColor(kRed);
0478 rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetMarkerColor(kRed);
0479
0480 p = (TPad *) c1->cd(idx++);
0481 c1->Update();
0482 p->SetLogy();
0483 sig_EMCalAna_h_CEMC_TOWER_4x4_max->Draw();
0484 sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("same");
0485 sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineColor(kRed);
0486 sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetMarkerColor(kRed);
0487
0488 p = (TPad *) c1->cd(idx++);
0489 c1->Update();
0490 p->SetLogy();
0491 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("AP*");
0492 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("P");
0493 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineColor(kRed);
0494 ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetMarkerColor(kRed);
0495
0496 p = (TPad *) c1->cd(idx++);
0497 c1->Update();
0498 p->SetLogy();
0499 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("AP*");
0500 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("P");
0501 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineColor(kRed);
0502 ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetMarkerColor(kRed);
0503
0504 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0505 kTRUE);
0506
0507 TGraphErrors* reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max =
0508 (TGraphErrors*) ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Clone(
0509 "reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max");
0510
0511 TGraphErrors* reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC =
0512 (TGraphErrors*) ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Clone(
0513 "reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC");
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527 const double y_min = 1;
0528 const double y_max = 1e5;
0529 const double y_min2 = .8;
0530 const double y_max2 = 1;
0531
0532 TGraphErrors* plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max =
0533 (TGraphErrors*) reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Clone(
0534 "plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max");
0535 TGraphErrors* plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max =
0536 (TGraphErrors*) ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->Clone(
0537 "plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max");
0538
0539
0540 TGraphErrors* plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC =
0541 (TGraphErrors*) reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Clone(
0542 "plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC");
0543 TGraphErrors* plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC =
0544 (TGraphErrors*) ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Clone(
0545 "plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC");
0546
0547 for (int i = 0; i < plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->GetN(); ++i)
0548 {
0549 (plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i] =1./(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i];
0550 }
0551
0552 for (int i = 0; i < plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->GetN(); ++i)
0553 {
0554 (plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i] = exp(
0555
0556 ((plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->GetY())[i] - y_min2)/(y_max2 - y_min2)*(log(y_max) - log(y_min)) + log(y_min)
0557
0558 );
0559 }
0560
0561
0562 for (int i = 0; i < plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->GetN(); ++i)
0563 {
0564 (plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->GetY())[i] =1./(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->GetY())[i];
0565 }
0566
0567 for (int i = 0; i < plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->GetN(); ++i)
0568 {
0569 (plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->GetY())[i] = exp(
0570
0571 ((plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->GetY())[i] - y_min2)/(y_max2 - y_min2)*(log(y_max) - log(y_min)) + log(y_min)
0572
0573 );
0574 }
0575
0576
0577 TCanvas *c1 = new TCanvas("DrawTower_EMCTrigEff_SlideingWindow2_Compile",
0578 "DrawTower_EMCTrigEff_SlideingWindow2_Compile", 1800, 900);
0579
0580 int idx = 1;
0581 TPad * p;
0582
0583 p = (TPad *) c1->cd(idx++);
0584 c1->Update();
0585 p->SetLogy();
0586 p->SetGridx(0);
0587 p->SetGridy(0);
0588 p->SetTicky(0);
0589
0590 p->DrawFrame(0, y_min, 5.5, y_max,
0591 ";EMCal trigger #Sigma_{4x4}[ E_{Tower} ] requirement (GeV);Rejection factor for MB events");
0592
0593 TGaxis * a = new TGaxis(5.5,y_min,5.5, y_max,y_min2,y_max2,510,"+L");
0594 a->SetTitle("Trigger efficiency for inclusive Upsilon (1S)");
0595 a->SetLabelColor(kRed);
0596 a->SetTitleColor(kRed);
0597 a->SetLineColor(kRed);
0598 a->SetTextFont(42);
0599 a->Draw();
0600
0601 TLine * l = new TLine(4.3,y_min,4.3,y_max);
0602 l->SetLineColor(kGray);
0603 l->SetLineWidth(5);
0604 l->Draw();
0605
0606 TLatex * t = new TLatex(0, y_max*1.1,"PYTHIA8 p+p #sqrt{s} = 200 GeV + Geant4 + Trigger Emulator");
0607 t->Draw();
0608
0609 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetFillColor(kRed);
0610 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineColor(kRed);
0611 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineWidth(3);
0612 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineStyle(kDashed);
0613
0614 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("lx");
0615
0616 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetFillColor(kBlack);
0617 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineColor(kBlack);
0618 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineWidth(3);
0619 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->SetLineStyle(kDashed);
0620
0621 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max->Draw("lx");
0622
0623
0624 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetFillColor(kRed);
0625 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineColor(kRed);
0626 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineWidth(3);
0627 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("3");
0628 plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("lx");
0629
0630 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetFillColor(kBlack);
0631 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineColor(kBlack);
0632 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->SetLineWidth(3);
0633 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("3");
0634 plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC->Draw("lx");
0635
0636 TLegend * legd = new TLegend(0.13,0.5,0.6,0.9);
0637
0638 TLegendEntry * le =
0639 legd->AddEntry(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC, "Rej. for MB (8-bit truncated 2x2 Sum)", "lx");
0640 le->SetTextFont(42);
0641 TLegendEntry * le =
0642 legd->AddEntry(plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_slide2_max_trigger_ADC, "Eff. for #Upsilon (8-bit truncated 2x2 Sum)", "lx");
0643 le->SetTextFont(42);
0644 le->SetTextColor(kRed);
0645 TLegendEntry * le =
0646 legd->AddEntry(plot_ge_rej_EMCalAna_h_CEMC_TOWER_4x4_max, "Rej. for MB (full ADC info)", "lx");
0647 le->SetTextFont(42);
0648 TLegendEntry * le =
0649 legd->AddEntry(plot_reg_ge_sig_EMCalAna_h_CEMC_TOWER_4x4_max, "Eff. for #Upsilon (full ADC info)", "lx");
0650 le->SetTextFont(42);
0651 le->SetTextColor(kRed);
0652
0653 legd->Draw();
0654
0655 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0656 kTRUE);
0657 }
0658
0659
0660
0661 TGraphErrors *
0662 Distribution2Efficiency(TH1F * hCEMC3_Max)
0663 {
0664 double threshold[10000] =
0665 { 0 };
0666 double eff[10000] =
0667 { 0 };
0668 double eff_err[10000] =
0669 { 0 };
0670
0671 assert(hCEMC3_Max->GetNbinsX()<10000);
0672
0673 const double n = hCEMC3_Max->GetSum();
0674 double pass = 0;
0675 int cnt = 0;
0676 for (int i = hCEMC3_Max->GetNbinsX(); i >= 1; i--)
0677 {
0678 pass += hCEMC3_Max->GetBinContent(i);
0679
0680 const double pp = pass / n;
0681
0682 const double z = 1.;
0683
0684 const double A = z * sqrt(1. / n * pp * (1 - pp) + z * z / 4 / n / n);
0685 const double B = 1 / (1 + z * z / n);
0686
0687 threshold[cnt] = hCEMC3_Max->GetBinCenter(i);
0688 eff[cnt] = (pp + z * z / 2 / n) * B;
0689 eff_err[cnt] = A * B;
0690
0691 cout << threshold[cnt] << ": " << "CL " << eff[cnt] << "+/-"
0692 << eff_err[cnt] << endl;
0693 cnt++;
0694 }
0695 TGraphErrors * ge = new TGraphErrors(cnt, threshold, eff, NULL, eff_err);
0696
0697 return ge;
0698 }
0699
0700 void
0701 DrawTower_EMCDistribution(
0702 const TString infile =
0703 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm_ALL.root_EMCalAna.root",
0704 const TString title = "HIJING Au+Au 0-10% C + Geant4 + Digi.")
0705 {
0706 TH1F * hCEMC1 = DrawTower_Load(infile, "EMCalAna_h_CEMC_TOWER_1x1");
0707 TH1F * hCEMC3 = DrawTower_Load(infile, "EMCalAna_h_CEMC_TOWER_3x3");
0708
0709 hCEMC1->Scale(1. / hCEMC1->GetSum());
0710 const double mean1 = hCEMC1->GetMean();
0711 hCEMC3->Scale(1. / hCEMC3->GetSum());
0712 const double mean3 = hCEMC3->GetMean();
0713
0714 TCanvas *c1 = new TCanvas("DrawTower_EMCDistribution",
0715 "DrawTower_EMCDistribution", 1800, 900);
0716 c1->Divide(2, 1);
0717 int idx = 1;
0718 TPad * p;
0719 p = (TPad *) c1->cd(idx++);
0720 c1->Update();
0721 p->SetLogy();
0722 p->SetGridx(0);
0723 p->SetGridy(0);
0724
0725 hCEMC1->GetXaxis()->SetRangeUser(0, .6);
0726 hCEMC1->SetTitle(";EMCal Single Tower Energy [GeV];A.U.");
0727 hCEMC1->SetLineColor(kBlue + 2);
0728 hCEMC1->SetLineWidth(3);
0729 hCEMC1->Draw();
0730
0731 TText * t;
0732 t = new TText(.6, .8, Form("Tower Mean = %.0f MeV", mean1 * 1000));
0733 t->SetNDC();
0734 t->SetTextAlign(22);
0735 t->Draw();
0736 t = new TText(.5, .95, (title));
0737 t->SetNDC();
0738 t->SetTextAlign(22);
0739 t->Draw();
0740
0741 p = (TPad *) c1->cd(idx++);
0742 c1->Update();
0743 p->SetLogy();
0744 p->SetGridx(0);
0745 p->SetGridy(0);
0746
0747 hCEMC3->GetXaxis()->SetRangeUser(0, 2);
0748 hCEMC3->SetTitle(";EMCal 3x3 Tower Energy Sum [GeV];A.U.");
0749 hCEMC3->SetLineColor(kRed + 2);
0750 hCEMC3->SetLineWidth(3);
0751 hCEMC3->Draw();
0752
0753 t = new TText(.6, .8, Form("3x3 Tower Mean = %.0f MeV", mean3 * 1000));
0754 t->SetNDC();
0755 t->SetTextAlign(22);
0756 t->Draw();
0757
0758 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0759 kTRUE);
0760 }
0761
0762 void
0763 DrawTower_EMCDistribution5x5(
0764 const TString infile =
0765 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm_ALL.root_EMCalAna.root",
0766 const TString title = "HIJING Au+Au 0-10% C + Geant4 + Digi.")
0767 {
0768 TH1F * hCEMC1 = DrawTower_Load(infile, "EMCalAna_h_CEMC_TOWER_1x1");
0769 TH1F * hCEMC3 = DrawTower_Load(infile, "EMCalAna_h_CEMC_TOWER_5x5");
0770
0771 hCEMC1->Scale(1. / hCEMC1->GetSum());
0772 const double mean1 = hCEMC1->GetMean();
0773 hCEMC3->Scale(1. / hCEMC3->GetSum());
0774 const double mean3 = hCEMC3->GetMean();
0775
0776 TCanvas *c1 = new TCanvas("DrawTower_EMCDistribution5x5",
0777 "DrawTower_EMCDistribution5x5", 1800, 900);
0778 c1->Divide(2, 1);
0779 int idx = 1;
0780 TPad * p;
0781 p = (TPad *) c1->cd(idx++);
0782 c1->Update();
0783 p->SetLogy();
0784 p->SetGridx(0);
0785 p->SetGridy(0);
0786
0787 hCEMC1->GetXaxis()->SetRangeUser(0, .6);
0788 hCEMC1->SetTitle(";EMCal Single Tower Energy [GeV];A.U.");
0789 hCEMC1->SetLineColor(kBlue + 2);
0790 hCEMC1->SetLineWidth(3);
0791 hCEMC1->Draw();
0792
0793 TText * t;
0794 t = new TText(.6, .8, Form("Tower Mean = %.0f MeV", mean1 * 1000));
0795 t->SetNDC();
0796 t->SetTextAlign(22);
0797 t->Draw();
0798 t = new TText(.5, .95, (title));
0799 t->SetNDC();
0800 t->SetTextAlign(22);
0801 t->Draw();
0802
0803 p = (TPad *) c1->cd(idx++);
0804 c1->Update();
0805 p->SetLogy();
0806 p->SetGridx(0);
0807 p->SetGridy(0);
0808
0809 hCEMC3->GetXaxis()->SetRangeUser(0, 2);
0810 hCEMC3->SetTitle(";EMCal 5x5 Tower Energy Sum [GeV];A.U.");
0811 hCEMC3->SetLineColor(kRed + 2);
0812 hCEMC3->SetLineWidth(3);
0813 hCEMC3->Draw();
0814
0815 t = new TText(.6, .8, Form("5x5 Tower Mean = %.0f MeV", mean3 * 1000));
0816 t->SetNDC();
0817 t->SetTextAlign(22);
0818 t->Draw();
0819
0820 SaveCanvas(c1, infile + TString("_DrawEcal_") + TString(c1->GetName()),
0821 kTRUE);
0822 }
0823
0824 TH1 *
0825 DrawTower_Load(
0826 const TString infile =
0827 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/sHijing/spacal2d/G4Hits_sPHENIX_sHijing-0-4.4fm_ALL.root_EMCalAna.root",
0828 const TString hist_name = "EMCalAna_h_CEMC_TOWER_1x1")
0829 {
0830 TString chian_str = infile;
0831 chian_str.ReplaceAll("ALL", "*");
0832
0833 TChain * t = new TChain("T_Index");
0834 const int n = t->Add(chian_str);
0835
0836 cout << "Loaded " << n << " root files with " << chian_str << endl;
0837 assert(n>0);
0838
0839 TH1 * h_sum = NULL;
0840
0841 TObjArray *fileElements = t->GetListOfFiles();
0842 TIter next(fileElements);
0843 TChainElement *chEl = 0;
0844 while ((chEl = (TChainElement*) next()))
0845 {
0846
0847 cout << "DrawTower_Load - processing " << chEl->GetTitle() << endl;
0848 TFile * f = new TFile(chEl->GetTitle());
0849 assert(f);
0850
0851 TH1 * h = (TH1 *) f->GetObjectChecked(hist_name, "TH1");
0852 assert(h);
0853
0854 if (!h_sum)
0855 {
0856 gDirectory->cd("/");
0857 h_sum = (TH1 *) h->Clone();
0858 h_sum->ResetBit(kMustCleanup);
0859 assert(h_sum);
0860 }
0861 else
0862 {
0863 h_sum->Add(h);
0864 delete f;
0865 }
0866 }
0867
0868 return h_sum;
0869 }
0870
0871 void
0872 DrawCluster_Linearality(
0873 const TString base =
0874 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/",
0875 const TString config = "")
0876 {
0877 gStyle->SetOptStat(0);
0878 gStyle->SetOptFit(0);
0879
0880
0881
0882
0883
0884
0885
0886
0887
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898
0899
0900 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
0901 base + "/spacal2d/zerofield/G4Hits_sPHENIX", "gamma_eta0", true);
0902 TGraphErrors * gamma_eta9 = DrawCluster_AnaP(
0903 base + "/spacal2d/zerofield/G4Hits_sPHENIX", "gamma_eta0.90", true);
0904
0905 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
0906 base + "/spacal1d/zerofield/G4Hits_sPHENIX", "gamma_eta0", true);
0907 TGraphErrors * gamma_eta9_1d = DrawCluster_AnaP(
0908 base + "/spacal1d/zerofield/G4Hits_sPHENIX", "gamma_eta0.90", true);
0909
0910 TCanvas *c1 = new TCanvas("DrawCluster_Linearality",
0911 "DrawCluster_Linearality", 1100, 900);
0912 c1->Divide(1, 1);
0913 int idx = 1;
0914 TPad * p;
0915
0916 p = (TPad *) c1->cd(idx++);
0917 c1->Update();
0918
0919 p->SetGridx(0);
0920 p->SetGridy(0);
0921
0922 p->DrawFrame(0, 0, 55, 55,
0923 ";Incoming Energy (GeV);Reconstructed cluster energy, E_{reco} (GeV)");
0924 TLine * l = new TLine(0, 0, 55, 55);
0925 l->SetLineColor(kGray);
0926 l->Draw();
0927
0928 TLegend * lg = new TLegend(1, 42, 44, 53, NULL, "br");
0929 TLegend * lg2 = new TLegend(12, 40 - 40, 43 + 12, 51 - 40, NULL, "br");
0930
0931 p = (TPad *) c1->cd(idx);
0932 c1->Update();
0933
0934 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "pol2", 0.5, 60);
0935 gamma_eta0->Fit(f_calo, "RM0");
0936
0937 double * Ys = gamma_eta0->GetY();
0938 for (int i = 0; i < gamma_eta0->GetN(); i++)
0939 {
0940 Ys[i] /= f_calo->GetParameter(1);
0941 }
0942 gamma_eta0->Fit(f_calo, "RM0");
0943
0944 gamma_eta0->SetLineColor(kRed + 1);
0945 gamma_eta0->SetMarkerColor(kRed + 1);
0946 gamma_eta0->SetLineWidth(2);
0947 gamma_eta0->SetMarkerStyle(kFullSquare);
0948 gamma_eta0->SetMarkerSize(2);
0949 f_calo->SetLineColor(kRed + 1);
0950 f_calo->SetLineWidth(2);
0951
0952 gamma_eta0->Draw("p");
0953 f_calo->Draw("same");
0954
0955 TString ltitle = Form(
0956 "2D-proj., #eta = 0.0-0.1, E_{reco} ~ %.2f E + %.1e E^{2} ",
0957 f_calo->GetParameter(1), f_calo->GetParameter(2));
0958 lg->AddEntry(gamma_eta0, ltitle.Data(), "pl");
0959
0960 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "pol2", 0.5, 60);
0961 gamma_eta9->Fit(f_calo, "RM0");
0962 double * Ys = gamma_eta9->GetY();
0963 for (int i = 0; i < gamma_eta9->GetN(); i++)
0964 {
0965 Ys[i] /= f_calo->GetParameter(1);
0966 }
0967 gamma_eta9->Fit(f_calo, "RM0");
0968
0969 gamma_eta9->SetLineColor(kRed + 3);
0970 gamma_eta9->SetMarkerColor(kRed + 3);
0971 gamma_eta9->SetLineWidth(2);
0972 gamma_eta9->SetMarkerStyle(kFullCircle);
0973 gamma_eta9->SetMarkerSize(2);
0974 f_calo->SetLineColor(kRed + 3);
0975 f_calo->SetLineWidth(2);
0976
0977 gamma_eta9->Draw("p");
0978 f_calo->Draw("same");
0979
0980 TString ltitle = Form(
0981 "2D-proj., #eta = 0.9-1.0, E_{reco} ~ %.2f E + %.1e E^{2} ",
0982 f_calo->GetParameter(1), f_calo->GetParameter(2));
0983 lg->AddEntry(gamma_eta9, ltitle.Data(), "pl");
0984 cout << "Title = " << ltitle << endl;
0985
0986
0987
0988 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "pol2", 0.5, 60);
0989 gamma_eta0_1d->Fit(f_calo, "RM0");
0990 double * Ys = gamma_eta0_1d->GetY();
0991 for (int i = 0; i < gamma_eta0_1d->GetN(); i++)
0992 {
0993 Ys[i] /= f_calo->GetParameter(1);
0994 }
0995 gamma_eta0_1d->Fit(f_calo, "RM0");
0996
0997 gamma_eta0_1d->SetLineColor(kBlue + 1);
0998 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
0999 gamma_eta0_1d->SetLineWidth(2);
1000 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
1001 gamma_eta0_1d->SetMarkerSize(2);
1002 f_calo->SetLineColor(kBlue + 1);
1003 f_calo->SetLineWidth(2);
1004
1005 gamma_eta0_1d->Draw("p");
1006 f_calo->Draw("same");
1007
1008 TString ltitle = Form(
1009 "1D-proj., #eta = 0.0-0.1, E_{reco} ~ %.2f E + %.1e E^{2} ",
1010 f_calo->GetParameter(1), f_calo->GetParameter(2));
1011 lg2->AddEntry(gamma_eta0_1d, ltitle.Data(), "pl");
1012
1013
1014
1015 TF1 * f_calo = new TF1("f_calo_gamma_eta9_1d", "pol2", 0.5, 60);
1016 gamma_eta9_1d->Fit(f_calo, "RM0");
1017 double * Ys = gamma_eta9_1d->GetY();
1018 for (int i = 0; i < gamma_eta9_1d->GetN(); i++)
1019 {
1020 Ys[i] /= f_calo->GetParameter(1);
1021 }
1022 gamma_eta9_1d->Fit(f_calo, "RM0");
1023
1024 gamma_eta9_1d->SetLineColor(kBlue + 3);
1025 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
1026 gamma_eta9_1d->SetLineWidth(2);
1027 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
1028 gamma_eta9_1d->SetMarkerSize(2);
1029 f_calo->SetLineColor(kBlue + 3);
1030 f_calo->SetLineWidth(2);
1031
1032 gamma_eta9_1d->Draw("p");
1033 f_calo->Draw("same");
1034
1035 TString ltitle = Form(
1036 "1D-proj., #eta = 0.9-1.0, E_{reco} ~ %.2f E + %.1e E^{2} ",
1037 f_calo->GetParameter(1), f_calo->GetParameter(2));
1038 lg2->AddEntry(gamma_eta9_1d, ltitle.Data(), "pl");
1039 cout << "Title = " << ltitle << endl;
1040
1041 lg->Draw();
1042 lg2->Draw();
1043
1044 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
1045 }
1046
1047 void
1048 DrawCluster_Res_2Fit(
1049 const TString base =
1050 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/",
1051 const TString config = "")
1052 {
1053 gStyle->SetOptStat(0);
1054 gStyle->SetOptFit(0);
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
1068 base + "/spacal2d/zerofield/G4Hits_sPHENIX", "gamma_eta0", false);
1069 TGraphErrors * gamma_eta9 = DrawCluster_AnaP(
1070 base + "/spacal2d/zerofield/G4Hits_sPHENIX", "gamma_eta0.90", false);
1071
1072 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
1073 base + "/spacal1d/zerofield/G4Hits_sPHENIX", "gamma_eta0", false);
1074 TGraphErrors * gamma_eta9_1d = DrawCluster_AnaP(
1075 base + "/spacal1d/zerofield/G4Hits_sPHENIX", "gamma_eta0.90", false);
1076
1077 TCanvas *c1 = new TCanvas("DrawCluster_Res_2Fit", "DrawCluster_Res_2Fit",
1078 1100, 900);
1079 c1->Divide(1, 1);
1080 int idx = 1;
1081 TPad * p;
1082
1083 p = (TPad *) c1->cd(idx++);
1084 c1->Update();
1085
1086 p->SetGridx(0);
1087 p->SetGridy(0);
1088
1089 p->DrawFrame(0, 0, 35, 20e-2,
1090 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
1091
1092 TLegend * lg = new TLegend(2, 9.6e-2, 17, 19.6e-2, NULL, "br");
1093 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
1094
1095 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
1096 0.5, 60);
1097 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
1098 60);
1099 gamma_eta0->Fit(f_calo, "RM0");
1100 gamma_eta0->Fit(f_calo_l, "RM0");
1101
1102 gamma_eta0->SetLineColor(kRed + 1);
1103 gamma_eta0->SetMarkerColor(kRed + 1);
1104 gamma_eta0->SetLineWidth(2);
1105 gamma_eta0->SetMarkerStyle(kFullSquare);
1106 gamma_eta0->SetMarkerSize(2);
1107 f_calo->SetLineColor(kRed + 1);
1108 f_calo->SetLineWidth(2);
1109 f_calo_l->SetLineColor(kRed + 1);
1110 f_calo_l->SetLineWidth(2);
1111 f_calo_l->SetLineStyle(kDashed);
1112
1113 f_calo->Draw("same");
1114 f_calo_l->Draw("same");
1115 gamma_eta0->Draw("p");
1116
1117 lg->AddEntry(gamma_eta0,
1118 Form("2D-proj., #eta = 0.0-0.1", f_calo->GetParameter(0),
1119 f_calo->GetParameter(1)), "p");
1120 lg2->AddEntry(f_calo,
1121 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1122 f_calo->GetParameter(1)), "l");
1123 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1124 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1125 f_calo_l->GetParameter(1)), "l");
1126 entry->SetTextColor(kGray + 1);
1127
1128 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "sqrt([0]*[0]+[1]*[1]/x)/100",
1129 0.5, 60);
1130 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta9", "([0]+[1]/sqrt(x))/100", 0.5,
1131 60);
1132 gamma_eta9->Fit(f_calo, "RM0");
1133 gamma_eta9->Fit(f_calo_l, "RM0");
1134
1135 gamma_eta9->SetLineColor(kRed + 3);
1136 gamma_eta9->SetMarkerColor(kRed + 3);
1137 gamma_eta9->SetLineWidth(2);
1138 gamma_eta9->SetMarkerStyle(kFullCircle);
1139 gamma_eta9->SetMarkerSize(2);
1140 f_calo->SetLineColor(kRed + 3);
1141 f_calo->SetLineWidth(2);
1142 f_calo_l->SetLineColor(kRed + 3);
1143 f_calo_l->SetLineWidth(2);
1144 f_calo_l->SetLineStyle(kDashed);
1145
1146 f_calo->Draw("same");
1147 f_calo_l->Draw("same");
1148 gamma_eta9->Draw("p");
1149
1150 TString ltitle = Form("2D-proj., #eta = 0.9-1.0", f_calo->GetParameter(0),
1151 f_calo->GetParameter(1));
1152 lg->AddEntry(gamma_eta9, ltitle.Data(), "p");
1153 lg2->AddEntry(f_calo,
1154 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1155 f_calo->GetParameter(1)), "l");
1156 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1157 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1158 f_calo_l->GetParameter(1)), "l");
1159 entry->SetTextColor(kGray + 1);
1160 cout << "Title = " << ltitle << endl;
1161
1162 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1163 0.5, 60);
1164 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1165 0.5, 60);
1166 gamma_eta0_1d->Fit(f_calo, "RM0");
1167 gamma_eta0_1d->Fit(f_calo_l, "RM0");
1168
1169 gamma_eta0_1d->SetLineColor(kBlue + 1);
1170 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
1171 gamma_eta0_1d->SetLineWidth(2);
1172 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
1173 gamma_eta0_1d->SetMarkerSize(2);
1174 f_calo->SetLineColor(kBlue + 1);
1175 f_calo->SetLineWidth(2);
1176 f_calo_l->SetLineColor(kBlue + 1);
1177 f_calo_l->SetLineWidth(2);
1178 f_calo_l->SetLineStyle(kDashed);
1179
1180 f_calo->Draw("same");
1181 f_calo_l->Draw("same");
1182 gamma_eta0_1d->Draw("p");
1183
1184 TString ltitle = Form("1D-proj., #eta = 0.0-0.1", f_calo->GetParameter(0),
1185 f_calo->GetParameter(1));
1186 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
1187 lg2->AddEntry(f_calo,
1188 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1189 f_calo->GetParameter(1)), "l");
1190 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1191 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1192 f_calo_l->GetParameter(1)), "l");
1193 entry->SetTextColor(kGray + 1);
1194
1195 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1196 0.5, 60);
1197 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1198 0.5, 60);
1199 gamma_eta9_1d->Fit(f_calo, "RM0");
1200 gamma_eta9_1d->Fit(f_calo_l, "RM0");
1201
1202 gamma_eta9_1d->SetLineColor(kBlue + 3);
1203 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
1204 gamma_eta9_1d->SetLineWidth(2);
1205 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
1206 gamma_eta9_1d->SetMarkerSize(2);
1207 f_calo->SetLineColor(kBlue + 3);
1208 f_calo->SetLineWidth(2);
1209 f_calo_l->SetLineColor(kBlue + 3);
1210 f_calo_l->SetLineWidth(2);
1211 f_calo_l->SetLineStyle(kDashed);
1212
1213 f_calo->Draw("same");
1214 f_calo_l->Draw("same");
1215 gamma_eta9_1d->Draw("p");
1216
1217 TString ltitle = Form("1D-proj., #eta = 0.9-1.0", f_calo->GetParameter(0),
1218 f_calo->GetParameter(1));
1219 lg->AddEntry(gamma_eta9_1d, ltitle.Data(), "p");
1220 lg2->AddEntry(f_calo,
1221 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1222 f_calo->GetParameter(1)), "l");
1223 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1224 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1225 f_calo_l->GetParameter(1)), "l");
1226 entry->SetTextColor(kGray + 1);
1227 cout << "Title = " << ltitle << endl;
1228
1229 lg->Draw();
1230 lg2->Draw();
1231
1232 TLatex * t = new TLatex(0, 0.205,"Single photon in full sPHENIX detector");
1233 t->Draw();
1234
1235 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
1236 }
1237
1238
1239 void
1240 DrawCluster_Res_2Fit_Electron_NoSVX(
1241 const TString base =
1242 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/",
1243 const TString config = "")
1244 {
1245 gStyle->SetOptStat(0);
1246 gStyle->SetOptFit(0);
1247
1248 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
1249 base + "/nosvtx/spacal2d/fieldmap/G4Hits_sPHENIX", "e-_eta0", false);
1250 TGraphErrors * gamma_eta9 = DrawCluster_AnaP(
1251 base + "/nosvtx/spacal2d/fieldmap/G4Hits_sPHENIX", "e-_eta0.90", false);
1252
1253 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
1254 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0", false);
1255 TGraphErrors * gamma_eta9_1d = DrawCluster_AnaP(
1256 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0.90", false);
1257
1258
1259 TCanvas *c1 = new TCanvas("DrawCluster_Res_2Fit_Electron_NoSVX", "DrawCluster_Res_2Fit_Electron_NoSVX",
1260 1100, 900);
1261 c1->Divide(1, 1);
1262 int idx = 1;
1263 TPad * p;
1264
1265 p = (TPad *) c1->cd(idx++);
1266 c1->Update();
1267
1268 p->SetGridx(0);
1269 p->SetGridy(0);
1270
1271 p->DrawFrame(0, 0, 35, 20e-2,
1272 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
1273
1274 TLegend * lg = new TLegend(2, 9.6e-2, 17, 19.6e-2, NULL, "br");
1275 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
1276
1277 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
1278 0.5, 60);
1279 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
1280 60);
1281 gamma_eta0->Fit(f_calo, "RM0");
1282 gamma_eta0->Fit(f_calo_l, "RM0");
1283
1284 gamma_eta0->SetLineColor(kRed + 1);
1285 gamma_eta0->SetMarkerColor(kRed + 1);
1286 gamma_eta0->SetLineWidth(2);
1287 gamma_eta0->SetMarkerStyle(kFullSquare);
1288 gamma_eta0->SetMarkerSize(2);
1289 f_calo->SetLineColor(kRed + 1);
1290 f_calo->SetLineWidth(2);
1291 f_calo_l->SetLineColor(kRed + 1);
1292 f_calo_l->SetLineWidth(2);
1293 f_calo_l->SetLineStyle(kDashed);
1294
1295 f_calo->Draw("same");
1296 f_calo_l->Draw("same");
1297 gamma_eta0->Draw("p");
1298
1299 lg->AddEntry(gamma_eta0,
1300 Form("2D-proj., #eta = 0.0-0.1", f_calo->GetParameter(0),
1301 f_calo->GetParameter(1)), "p");
1302 lg2->AddEntry(f_calo,
1303 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1304 f_calo->GetParameter(1)), "l");
1305 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1306 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1307 f_calo_l->GetParameter(1)), "l");
1308 entry->SetTextColor(kGray + 1);
1309
1310 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "sqrt([0]*[0]+[1]*[1]/x)/100",
1311 0.5, 60);
1312 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta9", "([0]+[1]/sqrt(x))/100", 0.5,
1313 60);
1314 gamma_eta9->Fit(f_calo, "RM0");
1315 gamma_eta9->Fit(f_calo_l, "RM0");
1316
1317 gamma_eta9->SetLineColor(kRed + 3);
1318 gamma_eta9->SetMarkerColor(kRed + 3);
1319 gamma_eta9->SetLineWidth(2);
1320 gamma_eta9->SetMarkerStyle(kFullCircle);
1321 gamma_eta9->SetMarkerSize(2);
1322 f_calo->SetLineColor(kRed + 3);
1323 f_calo->SetLineWidth(2);
1324 f_calo_l->SetLineColor(kRed + 3);
1325 f_calo_l->SetLineWidth(2);
1326 f_calo_l->SetLineStyle(kDashed);
1327
1328 f_calo->Draw("same");
1329 f_calo_l->Draw("same");
1330 gamma_eta9->Draw("p");
1331
1332 TString ltitle = Form("2D-proj., #eta = 0.9-1.0", f_calo->GetParameter(0),
1333 f_calo->GetParameter(1));
1334 lg->AddEntry(gamma_eta9, ltitle.Data(), "p");
1335 lg2->AddEntry(f_calo,
1336 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1337 f_calo->GetParameter(1)), "l");
1338 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1339 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1340 f_calo_l->GetParameter(1)), "l");
1341 entry->SetTextColor(kGray + 1);
1342 cout << "Title = " << ltitle << endl;
1343
1344 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1345 0.5, 60);
1346 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1347 0.5, 60);
1348 gamma_eta0_1d->Fit(f_calo, "RM0");
1349 gamma_eta0_1d->Fit(f_calo_l, "RM0");
1350
1351 gamma_eta0_1d->SetLineColor(kBlue + 1);
1352 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
1353 gamma_eta0_1d->SetLineWidth(2);
1354 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
1355 gamma_eta0_1d->SetMarkerSize(2);
1356 f_calo->SetLineColor(kBlue + 1);
1357 f_calo->SetLineWidth(2);
1358 f_calo_l->SetLineColor(kBlue + 1);
1359 f_calo_l->SetLineWidth(2);
1360 f_calo_l->SetLineStyle(kDashed);
1361
1362 f_calo->Draw("same");
1363 f_calo_l->Draw("same");
1364 gamma_eta0_1d->Draw("p");
1365
1366 TString ltitle = Form("1D-proj., #eta = 0.0-0.1", f_calo->GetParameter(0),
1367 f_calo->GetParameter(1));
1368 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
1369 lg2->AddEntry(f_calo,
1370 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1371 f_calo->GetParameter(1)), "l");
1372 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1373 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1374 f_calo_l->GetParameter(1)), "l");
1375 entry->SetTextColor(kGray + 1);
1376
1377 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1378 0.5, 60);
1379 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1380 0.5, 60);
1381 gamma_eta9_1d->Fit(f_calo, "RM0");
1382 gamma_eta9_1d->Fit(f_calo_l, "RM0");
1383
1384 gamma_eta9_1d->SetLineColor(kBlue + 3);
1385 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
1386 gamma_eta9_1d->SetLineWidth(2);
1387 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
1388 gamma_eta9_1d->SetMarkerSize(2);
1389 f_calo->SetLineColor(kBlue + 3);
1390 f_calo->SetLineWidth(2);
1391 f_calo_l->SetLineColor(kBlue + 3);
1392 f_calo_l->SetLineWidth(2);
1393 f_calo_l->SetLineStyle(kDashed);
1394
1395 f_calo->Draw("same");
1396 f_calo_l->Draw("same");
1397 gamma_eta9_1d->Draw("p");
1398
1399 TString ltitle = Form("1D-proj., #eta = 0.9-1.0", f_calo->GetParameter(0),
1400 f_calo->GetParameter(1));
1401 lg->AddEntry(gamma_eta9_1d, ltitle.Data(), "p");
1402 lg2->AddEntry(f_calo,
1403 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1404 f_calo->GetParameter(1)), "l");
1405 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1406 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1407 f_calo_l->GetParameter(1)), "l");
1408 entry->SetTextColor(kGray + 1);
1409 cout << "Title = " << ltitle << endl;
1410
1411 lg->Draw();
1412 lg2->Draw();
1413
1414
1415 TLatex * t = new TLatex(0, 0.205,"Single electron in sPHENIX calorimetry (no tracker)");
1416 t->Draw();
1417
1418
1419 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
1420 }
1421
1422
1423 void
1424 DrawCluster_Res_2Fit_1DSpacalNoSVX(
1425 const TString base =
1426 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/",
1427 const TString config = "")
1428 {
1429 gStyle->SetOptStat(0);
1430 gStyle->SetOptFit(0);
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
1454 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0", false);
1455 TGraphErrors * gamma_eta9 = DrawCluster_AnaP(
1456 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0.90", false);
1457
1458 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
1459 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "gamma_eta0", false);
1460 TGraphErrors * gamma_eta9_1d = DrawCluster_AnaP(
1461 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "gamma_eta0.90",
1462 false);
1463 TCanvas *c1 = new TCanvas("DrawCluster_Res_2Fit_1DSpacalNoSVX",
1464 "DrawCluster_Res_2Fit_1DSpacalNoSVX", 1100, 900);
1465 c1->Divide(1, 1);
1466 int idx = 1;
1467 TPad * p;
1468
1469 p = (TPad *) c1->cd(idx++);
1470 c1->Update();
1471
1472 p->SetGridx(0);
1473 p->SetGridy(0);
1474
1475 p->DrawFrame(0, 0, 35, 20e-2,
1476 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
1477
1478 TLegend * lg = new TLegend(2, 9.6e-2, 17, 19.6e-2, NULL, "br");
1479 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
1480
1481 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
1482 0.5, 60);
1483 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
1484 60);
1485 gamma_eta0->Fit(f_calo, "RM0");
1486 gamma_eta0->Fit(f_calo_l, "RM0");
1487
1488 gamma_eta0->SetLineColor(kRed + 1);
1489 gamma_eta0->SetMarkerColor(kRed + 1);
1490 gamma_eta0->SetLineWidth(2);
1491 gamma_eta0->SetMarkerStyle(kFullSquare);
1492 gamma_eta0->SetMarkerSize(2);
1493 f_calo->SetLineColor(kRed + 1);
1494 f_calo->SetLineWidth(2);
1495 f_calo_l->SetLineColor(kRed + 1);
1496 f_calo_l->SetLineWidth(2);
1497 f_calo_l->SetLineStyle(kDashed);
1498
1499 f_calo->Draw("same");
1500 f_calo_l->Draw("same");
1501 gamma_eta0->Draw("p");
1502
1503 lg->AddEntry(gamma_eta0,
1504 Form("Electrons, #eta = 0.0-0.1", f_calo->GetParameter(0),
1505 f_calo->GetParameter(1)), "p");
1506 lg2->AddEntry(f_calo,
1507 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1508 f_calo->GetParameter(1)), "l");
1509 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1510 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1511 f_calo_l->GetParameter(1)), "l");
1512 entry->SetTextColor(kGray + 1);
1513
1514 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "sqrt([0]*[0]+[1]*[1]/x)/100",
1515 0.5, 60);
1516 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta9", "([0]+[1]/sqrt(x))/100", 0.5,
1517 60);
1518 gamma_eta9->Fit(f_calo, "RM0");
1519 gamma_eta9->Fit(f_calo_l, "RM0");
1520
1521 gamma_eta9->SetLineColor(kRed + 3);
1522 gamma_eta9->SetMarkerColor(kRed + 3);
1523 gamma_eta9->SetLineWidth(2);
1524 gamma_eta9->SetMarkerStyle(kFullCircle);
1525 gamma_eta9->SetMarkerSize(2);
1526 f_calo->SetLineColor(kRed + 3);
1527 f_calo->SetLineWidth(2);
1528 f_calo_l->SetLineColor(kRed + 3);
1529 f_calo_l->SetLineWidth(2);
1530 f_calo_l->SetLineStyle(kDashed);
1531
1532 f_calo->Draw("same");
1533 f_calo_l->Draw("same");
1534 gamma_eta9->Draw("p");
1535
1536 TString ltitle = Form("Electrons, #eta = 0.9-1.0", f_calo->GetParameter(0),
1537 f_calo->GetParameter(1));
1538 lg->AddEntry(gamma_eta9, ltitle.Data(), "p");
1539 lg2->AddEntry(f_calo,
1540 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1541 f_calo->GetParameter(1)), "l");
1542 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1543 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1544 f_calo_l->GetParameter(1)), "l");
1545 entry->SetTextColor(kGray + 1);
1546 cout << "Title = " << ltitle << endl;
1547
1548 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1549 0.5, 60);
1550 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1551 0.5, 60);
1552 gamma_eta0_1d->Fit(f_calo, "RM0");
1553 gamma_eta0_1d->Fit(f_calo_l, "RM0");
1554
1555 gamma_eta0_1d->SetLineColor(kBlue + 1);
1556 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
1557 gamma_eta0_1d->SetLineWidth(2);
1558 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
1559 gamma_eta0_1d->SetMarkerSize(2);
1560 f_calo->SetLineColor(kBlue + 1);
1561 f_calo->SetLineWidth(2);
1562 f_calo_l->SetLineColor(kBlue + 1);
1563 f_calo_l->SetLineWidth(2);
1564 f_calo_l->SetLineStyle(kDashed);
1565
1566 f_calo->Draw("same");
1567 f_calo_l->Draw("same");
1568 gamma_eta0_1d->Draw("p");
1569
1570 TString ltitle = Form("Photons, #eta = 0.0-0.1", f_calo->GetParameter(0),
1571 f_calo->GetParameter(1));
1572 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
1573 lg2->AddEntry(f_calo,
1574 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1575 f_calo->GetParameter(1)), "l");
1576 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1577 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1578 f_calo_l->GetParameter(1)), "l");
1579 entry->SetTextColor(kGray + 1);
1580
1581 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1582 0.5, 60);
1583 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1584 0.5, 60);
1585 gamma_eta9_1d->Fit(f_calo, "RM0");
1586 gamma_eta9_1d->Fit(f_calo_l, "RM0");
1587
1588 gamma_eta9_1d->SetLineColor(kBlue + 3);
1589 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
1590 gamma_eta9_1d->SetLineWidth(2);
1591 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
1592 gamma_eta9_1d->SetMarkerSize(2);
1593 f_calo->SetLineColor(kBlue + 3);
1594 f_calo->SetLineWidth(2);
1595 f_calo_l->SetLineColor(kBlue + 3);
1596 f_calo_l->SetLineWidth(2);
1597 f_calo_l->SetLineStyle(kDashed);
1598
1599 f_calo->Draw("same");
1600 f_calo_l->Draw("same");
1601 gamma_eta9_1d->Draw("p");
1602
1603 TString ltitle = Form("Photons, #eta = 0.9-1.0", f_calo->GetParameter(0),
1604 f_calo->GetParameter(1));
1605 lg->AddEntry(gamma_eta9_1d, ltitle.Data(), "p");
1606 lg2->AddEntry(f_calo,
1607 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1608 f_calo->GetParameter(1)), "l");
1609 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1610 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1611 f_calo_l->GetParameter(1)), "l");
1612 entry->SetTextColor(kGray + 1);
1613 cout << "Title = " << ltitle << endl;
1614
1615 lg->Draw();
1616 lg2->Draw();
1617
1618 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
1619 }
1620
1621 void
1622 DrawCluster_Res_2Fit_1DSpacalNoSVX_Eta3(
1623 const TString base =
1624 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/",
1625 const TString config = "")
1626 {
1627 gStyle->SetOptStat(0);
1628 gStyle->SetOptFit(0);
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
1652 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0.30", false);
1653
1654 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
1655 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "gamma_eta0.30",
1656 false);
1657 TCanvas *c1 = new TCanvas("DrawCluster_Res_2Fit_1DSpacalNoSVX_Eta3",
1658 "DrawCluster_Res_2Fit_1DSpacalNoSVX_Eta3", 1100, 900);
1659 c1->Divide(1, 1);
1660 int idx = 1;
1661 TPad * p;
1662
1663 p = (TPad *) c1->cd(idx++);
1664 c1->Update();
1665
1666 p->SetGridx(0);
1667 p->SetGridy(0);
1668
1669 p->DrawFrame(0, 0, 35, 20e-2,
1670 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
1671
1672 TLegend * lg = new TLegend(2, 10e-2, 17, 20e-2, NULL, "br");
1673 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
1674
1675 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
1676 0.5, 60);
1677 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
1678 60);
1679 gamma_eta0->Fit(f_calo, "RM0");
1680 gamma_eta0->Fit(f_calo_l, "RM0");
1681
1682 gamma_eta0->SetLineColor(kRed + 1);
1683 gamma_eta0->SetMarkerColor(kRed + 1);
1684 gamma_eta0->SetLineWidth(2);
1685 gamma_eta0->SetMarkerStyle(kFullSquare);
1686 gamma_eta0->SetMarkerSize(2);
1687 f_calo->SetLineColor(kRed + 1);
1688 f_calo->SetLineWidth(2);
1689 f_calo_l->SetLineColor(kRed + 1);
1690 f_calo_l->SetLineWidth(2);
1691 f_calo_l->SetLineStyle(kDashed);
1692
1693 f_calo->Draw("same");
1694 f_calo_l->Draw("same");
1695 gamma_eta0->Draw("p");
1696
1697 lg->AddEntry(gamma_eta0,
1698 Form("Electrons, #eta = 0.3-0.4", f_calo->GetParameter(0),
1699 f_calo->GetParameter(1)), "p");
1700 lg2->AddEntry(f_calo,
1701 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1702 f_calo->GetParameter(1)), "l");
1703 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1704 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1705 f_calo_l->GetParameter(1)), "l");
1706 entry->SetTextColor(kGray + 1);
1707
1708 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1709 0.5, 60);
1710 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1711 0.5, 60);
1712 gamma_eta0_1d->Fit(f_calo, "RM0");
1713 gamma_eta0_1d->Fit(f_calo_l, "RM0");
1714
1715 gamma_eta0_1d->SetLineColor(kBlue + 1);
1716 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
1717 gamma_eta0_1d->SetLineWidth(2);
1718 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
1719 gamma_eta0_1d->SetMarkerSize(2);
1720 f_calo->SetLineColor(kBlue + 1);
1721 f_calo->SetLineWidth(2);
1722 f_calo_l->SetLineColor(kBlue + 1);
1723 f_calo_l->SetLineWidth(2);
1724 f_calo_l->SetLineStyle(kDashed);
1725
1726 f_calo->Draw("same");
1727 f_calo_l->Draw("same");
1728 gamma_eta0_1d->Draw("p");
1729
1730 TString ltitle = Form("Photons, #eta = 0.3-0.4", f_calo->GetParameter(0),
1731 f_calo->GetParameter(1));
1732 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
1733 lg2->AddEntry(f_calo,
1734 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1735 f_calo->GetParameter(1)), "l");
1736 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1737 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1738 f_calo_l->GetParameter(1)), "l");
1739 entry->SetTextColor(kGray + 1);
1740
1741 lg->Draw();
1742 lg2->Draw();
1743
1744 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
1745 }
1746
1747 void
1748 DrawCluster_Res_2Fit_2DSpacalNoSVX(
1749 const TString base =
1750 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/",
1751 const TString config = "")
1752 {
1753 gStyle->SetOptStat(0);
1754 gStyle->SetOptFit(0);
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
1778 base + "/nosvtx/spacal2d/fieldmap/G4Hits_sPHENIX", "e-_eta0", false);
1779 TGraphErrors * gamma_eta9 = DrawCluster_AnaP(
1780 base + "/nosvtx/spacal2d/fieldmap/G4Hits_sPHENIX", "e-_eta0.90", false);
1781
1782 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
1783 base + "/nosvtx/spacal2d/fieldmap/G4Hits_sPHENIX", "gamma_eta0", false);
1784 TGraphErrors * gamma_eta9_1d = DrawCluster_AnaP(
1785 base + "/nosvtx/spacal2d/fieldmap/G4Hits_sPHENIX", "gamma_eta0.90",
1786 false);
1787 TCanvas *c1 = new TCanvas("DrawCluster_Res_2Fit_2DSpacalNoSVX",
1788 "DrawCluster_Res_2Fit_2DSpacalNoSVX", 1100, 900);
1789 c1->Divide(1, 1);
1790 int idx = 1;
1791 TPad * p;
1792
1793 p = (TPad *) c1->cd(idx++);
1794 c1->Update();
1795
1796 p->SetGridx(0);
1797 p->SetGridy(0);
1798
1799 p->DrawFrame(0, 0, 35, 20e-2,
1800 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
1801
1802 TLegend * lg = new TLegend(2, 9.6e-2, 17, 19.6e-2, NULL, "br");
1803 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
1804
1805 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
1806 0.5, 60);
1807 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
1808 60);
1809 gamma_eta0->Fit(f_calo, "RM0");
1810 gamma_eta0->Fit(f_calo_l, "RM0");
1811
1812 gamma_eta0->SetLineColor(kRed + 1);
1813 gamma_eta0->SetMarkerColor(kRed + 1);
1814 gamma_eta0->SetLineWidth(2);
1815 gamma_eta0->SetMarkerStyle(kFullSquare);
1816 gamma_eta0->SetMarkerSize(2);
1817 f_calo->SetLineColor(kRed + 1);
1818 f_calo->SetLineWidth(2);
1819 f_calo_l->SetLineColor(kRed + 1);
1820 f_calo_l->SetLineWidth(2);
1821 f_calo_l->SetLineStyle(kDashed);
1822
1823 f_calo->Draw("same");
1824 f_calo_l->Draw("same");
1825 gamma_eta0->Draw("p");
1826
1827 lg->AddEntry(gamma_eta0,
1828 Form("Electrons, #eta = 0.0-0.1", f_calo->GetParameter(0),
1829 f_calo->GetParameter(1)), "p");
1830 lg2->AddEntry(f_calo,
1831 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1832 f_calo->GetParameter(1)), "l");
1833 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1834 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1835 f_calo_l->GetParameter(1)), "l");
1836 entry->SetTextColor(kGray + 1);
1837
1838 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "sqrt([0]*[0]+[1]*[1]/x)/100",
1839 0.5, 60);
1840 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta9", "([0]+[1]/sqrt(x))/100", 0.5,
1841 60);
1842 gamma_eta9->Fit(f_calo, "RM0");
1843 gamma_eta9->Fit(f_calo_l, "RM0");
1844
1845 gamma_eta9->SetLineColor(kRed + 3);
1846 gamma_eta9->SetMarkerColor(kRed + 3);
1847 gamma_eta9->SetLineWidth(2);
1848 gamma_eta9->SetMarkerStyle(kFullCircle);
1849 gamma_eta9->SetMarkerSize(2);
1850 f_calo->SetLineColor(kRed + 3);
1851 f_calo->SetLineWidth(2);
1852 f_calo_l->SetLineColor(kRed + 3);
1853 f_calo_l->SetLineWidth(2);
1854 f_calo_l->SetLineStyle(kDashed);
1855
1856 f_calo->Draw("same");
1857 f_calo_l->Draw("same");
1858 gamma_eta9->Draw("p");
1859
1860 TString ltitle = Form("Electrons, #eta = 0.9-1.0", f_calo->GetParameter(0),
1861 f_calo->GetParameter(1));
1862 lg->AddEntry(gamma_eta9, ltitle.Data(), "p");
1863 lg2->AddEntry(f_calo,
1864 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1865 f_calo->GetParameter(1)), "l");
1866 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1867 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1868 f_calo_l->GetParameter(1)), "l");
1869 entry->SetTextColor(kGray + 1);
1870 cout << "Title = " << ltitle << endl;
1871
1872 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1873 0.5, 60);
1874 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1875 0.5, 60);
1876 gamma_eta0_1d->Fit(f_calo, "RM0");
1877 gamma_eta0_1d->Fit(f_calo_l, "RM0");
1878
1879 gamma_eta0_1d->SetLineColor(kBlue + 1);
1880 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
1881 gamma_eta0_1d->SetLineWidth(2);
1882 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
1883 gamma_eta0_1d->SetMarkerSize(2);
1884 f_calo->SetLineColor(kBlue + 1);
1885 f_calo->SetLineWidth(2);
1886 f_calo_l->SetLineColor(kBlue + 1);
1887 f_calo_l->SetLineWidth(2);
1888 f_calo_l->SetLineStyle(kDashed);
1889
1890 f_calo->Draw("same");
1891 f_calo_l->Draw("same");
1892 gamma_eta0_1d->Draw("p");
1893
1894 TString ltitle = Form("Photons, #eta = 0.0-0.1", f_calo->GetParameter(0),
1895 f_calo->GetParameter(1));
1896 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
1897 lg2->AddEntry(f_calo,
1898 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1899 f_calo->GetParameter(1)), "l");
1900 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1901 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1902 f_calo_l->GetParameter(1)), "l");
1903 entry->SetTextColor(kGray + 1);
1904
1905 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
1906 0.5, 60);
1907 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
1908 0.5, 60);
1909 gamma_eta9_1d->Fit(f_calo, "RM0");
1910 gamma_eta9_1d->Fit(f_calo_l, "RM0");
1911
1912 gamma_eta9_1d->SetLineColor(kBlue + 3);
1913 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
1914 gamma_eta9_1d->SetLineWidth(2);
1915 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
1916 gamma_eta9_1d->SetMarkerSize(2);
1917 f_calo->SetLineColor(kBlue + 3);
1918 f_calo->SetLineWidth(2);
1919 f_calo_l->SetLineColor(kBlue + 3);
1920 f_calo_l->SetLineWidth(2);
1921 f_calo_l->SetLineStyle(kDashed);
1922
1923 f_calo->Draw("same");
1924 f_calo_l->Draw("same");
1925 gamma_eta9_1d->Draw("p");
1926
1927 TString ltitle = Form("Photons, #eta = 0.9-1.0", f_calo->GetParameter(0),
1928 f_calo->GetParameter(1));
1929 lg->AddEntry(gamma_eta9_1d, ltitle.Data(), "p");
1930 lg2->AddEntry(f_calo,
1931 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
1932 f_calo->GetParameter(1)), "l");
1933 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
1934 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
1935 f_calo_l->GetParameter(1)), "l");
1936 entry->SetTextColor(kGray + 1);
1937 cout << "Title = " << ltitle << endl;
1938
1939 lg->Draw();
1940 lg2->Draw();
1941
1942 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
1943 }
1944
1945 void
1946 DrawCluster_Res(
1947 const TString base =
1948 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/",
1949 const TString config = "")
1950 {
1951 gStyle->SetOptStat(0);
1952 gStyle->SetOptFit(0);
1953
1954 TGraphErrors * gamma_eta0 = DrawCluster_AnaP(
1955 base + "/spacal2d/zerofield/G4Hits_sPHENIX", "gamma_eta0", false);
1956 TGraphErrors * gamma_eta9 = DrawCluster_AnaP(
1957 base + "/spacal2d/zerofield/G4Hits_sPHENIX", "gamma_eta0.90", false);
1958
1959 TGraphErrors * gamma_eta0_1d = DrawCluster_AnaP(
1960 base + "/spacal1d_1dtower/zerofield/G4Hits_sPHENIX", "gamma_eta0", false);
1961 TGraphErrors * gamma_eta9_1d = DrawCluster_AnaP(
1962 base + "/spacal1d_1dtower/zerofield/G4Hits_sPHENIX", "gamma_eta0.90",
1963 false);
1964
1965 TCanvas *c1 = new TCanvas("DrawCluster_Res", "DrawCluster_Res", 1100, 900);
1966 c1->Divide(1, 1);
1967 int idx = 1;
1968 TPad * p;
1969
1970 p = (TPad *) c1->cd(idx++);
1971 c1->Update();
1972
1973 p->SetGridx(0);
1974 p->SetGridy(0);
1975
1976 p->DrawFrame(0, 0, 35, 20e-2,
1977 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
1978
1979 TLegend * lg = new TLegend(2, 10e-2, 33, 18e-2, NULL, "br");
1980
1981 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
1982 0.5, 60);
1983 gamma_eta0->Fit(f_calo, "RM0");
1984
1985 gamma_eta0->SetLineColor(kRed + 1);
1986 gamma_eta0->SetMarkerColor(kRed + 1);
1987 gamma_eta0->SetLineWidth(2);
1988 gamma_eta0->SetMarkerStyle(kFullSquare);
1989 gamma_eta0->SetMarkerSize(2);
1990 f_calo->SetLineColor(kRed + 1);
1991 f_calo->SetLineWidth(2);
1992
1993 gamma_eta0->Draw("p");
1994 f_calo->Draw("same");
1995
1996 TString ltitle = Form(
1997 "2D-proj., #eta = 0.0-0.1, #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
1998 f_calo->GetParameter(0), f_calo->GetParameter(1));
1999 lg->AddEntry(gamma_eta0, ltitle.Data(), "pl");
2000
2001 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "sqrt([0]*[0]+[1]*[1]/x)/100",
2002 0.5, 60);
2003 gamma_eta9->Fit(f_calo, "RM0");
2004
2005 gamma_eta9->SetLineColor(kRed + 3);
2006 gamma_eta9->SetMarkerColor(kRed + 3);
2007 gamma_eta9->SetLineWidth(2);
2008 gamma_eta9->SetMarkerStyle(kFullCircle);
2009 gamma_eta9->SetMarkerSize(2);
2010 f_calo->SetLineColor(kRed + 3);
2011 f_calo->SetLineWidth(2);
2012
2013 gamma_eta9->Draw("p");
2014 f_calo->Draw("same");
2015
2016 TString ltitle = Form(
2017 "2D-proj., #eta = 0.9-1.0, #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
2018 f_calo->GetParameter(0), f_calo->GetParameter(1));
2019 lg->AddEntry(gamma_eta9, ltitle.Data(), "pl");
2020 cout << "Title = " << ltitle << endl;
2021
2022 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
2023 0.5, 60);
2024 gamma_eta0_1d->Fit(f_calo, "RM0");
2025
2026 gamma_eta0_1d->SetLineColor(kBlue + 1);
2027 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
2028 gamma_eta0_1d->SetLineWidth(2);
2029 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
2030 gamma_eta0_1d->SetMarkerSize(2);
2031 f_calo->SetLineColor(kBlue + 1);
2032 f_calo->SetLineWidth(2);
2033
2034 gamma_eta0_1d->Draw("p");
2035 f_calo->Draw("same");
2036
2037 TString ltitle = Form(
2038 "1D-proj., #eta = 0.0-0.1, #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
2039 f_calo->GetParameter(0), f_calo->GetParameter(1));
2040 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "pl");
2041
2042 TF1 * f_calo = new TF1("f_calo_gamma_eta9_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
2043 0.5, 60);
2044 gamma_eta9_1d->Fit(f_calo, "RM0");
2045
2046 gamma_eta9_1d->SetLineColor(kBlue + 3);
2047 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
2048 gamma_eta9_1d->SetLineWidth(2);
2049 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
2050 gamma_eta9_1d->SetMarkerSize(2);
2051 f_calo->SetLineColor(kBlue + 3);
2052 f_calo->SetLineWidth(2);
2053
2054 gamma_eta9_1d->Draw("p");
2055 f_calo->Draw("same");
2056
2057 TString ltitle = Form(
2058 "1D-proj., #eta = 0.9-1.0, #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
2059 f_calo->GetParameter(0), f_calo->GetParameter(1));
2060 lg->AddEntry(gamma_eta9_1d, ltitle.Data(), "pl");
2061 cout << "Title = " << ltitle << endl;
2062
2063 lg->Draw();
2064
2065 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
2066 }
2067
2068 TGraphErrors *
2069 DrawCluster_AnaP(
2070 const TString config =
2071
2072 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/spacal1d_1dtower/zerofield/G4Hits_sPHENIX",
2073 const TString particle = "gamma_eta0.90", bool mean_or_res = false)
2074 {
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086 const int N = 10;
2087 double es[100] =
2088 { 1, 2, 4, 8, 10, 16, 24, 32, 40, 50 };
2089 double mean[100] =
2090 { 0 };
2091 double mean_err[100] =
2092 { 0 };
2093 double res[100] =
2094 { 0 };
2095 double res_err[100] =
2096 { 0 };
2097
2098 TCanvas *c1 = new TCanvas(config, config);
2099 c1->Print(config + ".pdf[");
2100
2101 for (int i = 0; i < N; ++i)
2102 {
2103 TVectorD fit(4);
2104
2105 fit = DrawCluster_SingleE(config, particle, es[i]);
2106
2107 mean[i] = fit[0];
2108 mean_err[i] = fit[1];
2109 res[i] = fit[2] / mean[i];
2110 res_err[i] = fit[3] / mean[i];
2111 }
2112 c1->Print(config + ".pdf]");
2113 cout << "DrawCluster_AnaP - save to " << config << ".pdf" << endl;
2114
2115 if (mean_or_res)
2116 {
2117 TGraphErrors * ge = new TGraphErrors(N, es, mean, 0, mean_err);
2118 ge->Print();
2119 return ge;
2120 }
2121 else
2122 {
2123 TGraphErrors * ge = new TGraphErrors(N, es, res, 0, res_err);
2124 ge->Print();
2125 return ge;
2126 }
2127
2128 }
2129
2130 TVectorD
2131 DrawCluster_SingleE(
2132 const TString config =
2133 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/spacal2d/zerofield/G4Hits_sPHENIX",
2134 const TString particle = "gamma_eta0", const double e = 8)
2135 {
2136
2137
2138 const TString e_GeV = Form("%.0fGeV", e);
2139
2140 const TString file_name = config + "_" + particle + "_" + e_GeV
2141 + ".root_g4cemc_eval.root";
2142 +".root_hist.root";
2143 cout << "DrawCluster_SingleE - lead " << file_name << endl;
2144
2145 TFile *f = new TFile(file_name);
2146 assert(f);
2147 TTree * ntp_cluster = (TTree *) f->GetObjectChecked("ntp_cluster", "TTree");
2148 assert(ntp_cluster);
2149
2150 const TString h_cluster_E_name = TString("h_cluster_E_") + particle + e_GeV;
2151 TH1F * h_cluster_E = new TH1F(h_cluster_E_name, file_name, 200, 0, e * 1.5);
2152
2153 TCanvas *c1 = new TCanvas(file_name, file_name);
2154 ntp_cluster->Draw("e>>" + h_cluster_E_name, "gparticleID==1 && e>0.2");
2155
2156 const double mean = h_cluster_E->GetMean();
2157 const double rms = h_cluster_E->GetRMS();
2158
2159
2160
2161 TF1 * f_gaus_pilot = new TF1("f_gaus_pilot" + h_cluster_E_name, "gaus",
2162 e * 0.5, e * 1.5);
2163 f_gaus_pilot->SetParameters(1, mean, rms);
2164 f_gaus_pilot->SetLineColor(kRed);
2165 h_cluster_E->Fit(f_gaus_pilot, "MRQS0");
2166 f_gaus_pilot->Draw("same");
2167
2168 TF1 * f_gaus = new TF1("f_gaus" + h_cluster_E_name, "gaus",
2169 f_gaus_pilot->GetParameter(1) - 1.5 * f_gaus_pilot->GetParameter(2),
2170 f_gaus_pilot->GetParameter(1) + 4 * f_gaus_pilot->GetParameter(2));
2171 f_gaus->SetParameters(f_gaus_pilot->GetParameter(0),
2172 f_gaus_pilot->GetParameter(1), f_gaus_pilot->GetParameter(2));
2173
2174 h_cluster_E->Fit(f_gaus, "MRQS0");
2175 f_gaus->Draw("same");
2176
2177 cout << "load_SF - result = " << f_gaus->GetParameter(1) << "+/-"
2178 << f_gaus->GetParError(1) << endl;
2179
2180 TVectorD ret(4);
2181 ret[0] = f_gaus->GetParameter(1);
2182 ret[1] = f_gaus->GetParError(1);
2183 ret[2] = f_gaus->GetParameter(2);
2184 ret[3] = f_gaus->GetParError(2);
2185
2186 c1->Print(config + ".pdf");
2187
2188 return ret;
2189 }
2190
2191 void
2192 DrawTowerSum_Res_2Fit_1DSpacalNoSVX(
2193 const TString base =
2194 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/",
2195 const TString config = "")
2196 {
2197 gStyle->SetOptStat(0);
2198 gStyle->SetOptFit(0);
2199
2200 TGraphErrors * gamma_eta0 = DrawTowerSum_AnaP(
2201 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0", false);
2202 TGraphErrors * gamma_eta9 = DrawTowerSum_AnaP(
2203 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0.90", false);
2204
2205 TGraphErrors * gamma_eta0_1d = DrawTowerSum_AnaP(
2206 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "gamma_eta0", false);
2207 TGraphErrors * gamma_eta9_1d = DrawTowerSum_AnaP(
2208 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "gamma_eta0.90",
2209 false);
2210
2211 TCanvas *c1 = new TCanvas("DrawTowerSum_Res_2Fit_1DSpacalNoSVX",
2212 "DrawTowerSum_Res_2Fit_1DSpacalNoSVX", 1100, 900);
2213 c1->Divide(1, 1);
2214 int idx = 1;
2215 TPad * p;
2216
2217 p = (TPad *) c1->cd(idx++);
2218 c1->Update();
2219
2220 p->SetGridx(0);
2221 p->SetGridy(0);
2222
2223 p->DrawFrame(0, 0, 35, 20e-2,
2224 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
2225
2226 TLegend * lg = new TLegend(2, 9.6e-2, 17, 19.6e-2, NULL, "br");
2227 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
2228
2229 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
2230 0.5, 60);
2231 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
2232 60);
2233 gamma_eta0->Fit(f_calo, "RM0");
2234 gamma_eta0->Fit(f_calo_l, "RM0");
2235
2236 gamma_eta0->SetLineColor(kRed + 1);
2237 gamma_eta0->SetMarkerColor(kRed + 1);
2238 gamma_eta0->SetLineWidth(2);
2239 gamma_eta0->SetMarkerStyle(kFullSquare);
2240 gamma_eta0->SetMarkerSize(2);
2241 f_calo->SetLineColor(kRed + 1);
2242 f_calo->SetLineWidth(2);
2243 f_calo_l->SetLineColor(kRed + 1);
2244 f_calo_l->SetLineWidth(2);
2245 f_calo_l->SetLineStyle(kDashed);
2246
2247 f_calo->Draw("same");
2248 f_calo_l->Draw("same");
2249 gamma_eta0->Draw("p");
2250
2251 lg->AddEntry(gamma_eta0,
2252 Form("Electrons, #eta = 0.0-0.1", f_calo->GetParameter(0),
2253 f_calo->GetParameter(1)), "p");
2254 lg2->AddEntry(f_calo,
2255 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
2256 f_calo->GetParameter(1)), "l");
2257 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
2258 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
2259 f_calo_l->GetParameter(1)), "l");
2260 entry->SetTextColor(kGray + 1);
2261
2262 TF1 * f_calo = new TF1("f_calo_gamma_eta9", "sqrt([0]*[0]+[1]*[1]/x)/100",
2263 0.5, 60);
2264 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta9", "([0]+[1]/sqrt(x))/100", 0.5,
2265 60);
2266 gamma_eta9->Fit(f_calo, "RM0");
2267 gamma_eta9->Fit(f_calo_l, "RM0");
2268
2269 gamma_eta9->SetLineColor(kRed + 3);
2270 gamma_eta9->SetMarkerColor(kRed + 3);
2271 gamma_eta9->SetLineWidth(2);
2272 gamma_eta9->SetMarkerStyle(kFullCircle);
2273 gamma_eta9->SetMarkerSize(2);
2274 f_calo->SetLineColor(kRed + 3);
2275 f_calo->SetLineWidth(2);
2276 f_calo_l->SetLineColor(kRed + 3);
2277 f_calo_l->SetLineWidth(2);
2278 f_calo_l->SetLineStyle(kDashed);
2279
2280 f_calo->Draw("same");
2281 f_calo_l->Draw("same");
2282 gamma_eta9->Draw("p");
2283
2284 TString ltitle = Form("Electrons, #eta = 0.9-1.0", f_calo->GetParameter(0),
2285 f_calo->GetParameter(1));
2286 lg->AddEntry(gamma_eta9, ltitle.Data(), "p");
2287 lg2->AddEntry(f_calo,
2288 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
2289 f_calo->GetParameter(1)), "l");
2290 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
2291 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
2292 f_calo_l->GetParameter(1)), "l");
2293 entry->SetTextColor(kGray + 1);
2294 cout << "Title = " << ltitle << endl;
2295
2296 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
2297 0.5, 60);
2298 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
2299 0.5, 60);
2300 gamma_eta0_1d->Fit(f_calo, "RM0");
2301 gamma_eta0_1d->Fit(f_calo_l, "RM0");
2302
2303 gamma_eta0_1d->SetLineColor(kBlue + 1);
2304 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
2305 gamma_eta0_1d->SetLineWidth(2);
2306 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
2307 gamma_eta0_1d->SetMarkerSize(2);
2308 f_calo->SetLineColor(kBlue + 1);
2309 f_calo->SetLineWidth(2);
2310 f_calo_l->SetLineColor(kBlue + 1);
2311 f_calo_l->SetLineWidth(2);
2312 f_calo_l->SetLineStyle(kDashed);
2313
2314 f_calo->Draw("same");
2315 f_calo_l->Draw("same");
2316 gamma_eta0_1d->Draw("p");
2317
2318 TString ltitle = Form("Photons, #eta = 0.0-0.1", f_calo->GetParameter(0),
2319 f_calo->GetParameter(1));
2320 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
2321 lg2->AddEntry(f_calo,
2322 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
2323 f_calo->GetParameter(1)), "l");
2324 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
2325 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
2326 f_calo_l->GetParameter(1)), "l");
2327 entry->SetTextColor(kGray + 1);
2328
2329 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
2330 0.5, 60);
2331 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
2332 0.5, 60);
2333 gamma_eta9_1d->Fit(f_calo, "RM0");
2334 gamma_eta9_1d->Fit(f_calo_l, "RM0");
2335
2336 gamma_eta9_1d->SetLineColor(kBlue + 3);
2337 gamma_eta9_1d->SetMarkerColor(kBlue + 3);
2338 gamma_eta9_1d->SetLineWidth(2);
2339 gamma_eta9_1d->SetMarkerStyle(kOpenCircle);
2340 gamma_eta9_1d->SetMarkerSize(2);
2341 f_calo->SetLineColor(kBlue + 3);
2342 f_calo->SetLineWidth(2);
2343 f_calo_l->SetLineColor(kBlue + 3);
2344 f_calo_l->SetLineWidth(2);
2345 f_calo_l->SetLineStyle(kDashed);
2346
2347 f_calo->Draw("same");
2348 f_calo_l->Draw("same");
2349 gamma_eta9_1d->Draw("p");
2350
2351 TString ltitle = Form("Photons, #eta = 0.9-1.0", f_calo->GetParameter(0),
2352 f_calo->GetParameter(1));
2353 lg->AddEntry(gamma_eta9_1d, ltitle.Data(), "p");
2354 lg2->AddEntry(f_calo,
2355 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
2356 f_calo->GetParameter(1)), "l");
2357 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
2358 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
2359 f_calo_l->GetParameter(1)), "l");
2360 entry->SetTextColor(kGray + 1);
2361 cout << "Title = " << ltitle << endl;
2362
2363 lg->Draw();
2364 lg2->Draw();
2365
2366 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
2367 }
2368
2369 void
2370 DrawTowerSum_Res_2Fit_1DSpacalNoSVX_Eta3(
2371 const TString base =
2372 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/",
2373 const TString config = "")
2374 {
2375 gStyle->SetOptStat(0);
2376 gStyle->SetOptFit(0);
2377
2378 TGraphErrors * gamma_eta0 = DrawTowerSum_AnaP(
2379 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "e-_eta0.30", false);
2380
2381
2382
2383 TGraphErrors * gamma_eta0_1d = DrawTowerSum_AnaP(
2384 base + "/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX", "gamma_eta0.30",
2385 false);
2386
2387
2388
2389
2390 TCanvas *c1 = new TCanvas("DrawTowerSum_Res_2Fit_1DSpacalNoSVX_Eta3",
2391 "DrawTowerSum_Res_2Fit_1DSpacalNoSVX_Eta3", 1100, 900);
2392 c1->Divide(1, 1);
2393 int idx = 1;
2394 TPad * p;
2395
2396 p = (TPad *) c1->cd(idx++);
2397 c1->Update();
2398
2399 p->SetGridx(0);
2400 p->SetGridy(0);
2401
2402 p->DrawFrame(0, 0, 35, 20e-2,
2403 ";Incoming Energy (GeV);Relative energy resolution, #DeltaE/E");
2404
2405 TLegend * lg = new TLegend(2, 9.6e-2, 17, 19.6e-2, NULL, "br");
2406 TLegend * lg2 = new TLegend(16, 9e-2, 33, 19e-2, NULL, "br");
2407
2408 TF1 * f_calo = new TF1("f_calo_gamma_eta0", "sqrt([0]*[0]+[1]*[1]/x)/100",
2409 0.5, 60);
2410 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0", "([0]+[1]/sqrt(x))/100", 0.5,
2411 60);
2412 gamma_eta0->Fit(f_calo, "RM0");
2413 gamma_eta0->Fit(f_calo_l, "RM0");
2414
2415 gamma_eta0->SetLineColor(kRed + 1);
2416 gamma_eta0->SetMarkerColor(kRed + 1);
2417 gamma_eta0->SetLineWidth(2);
2418 gamma_eta0->SetMarkerStyle(kFullSquare);
2419 gamma_eta0->SetMarkerSize(2);
2420 f_calo->SetLineColor(kRed + 1);
2421 f_calo->SetLineWidth(2);
2422 f_calo_l->SetLineColor(kRed + 1);
2423 f_calo_l->SetLineWidth(2);
2424 f_calo_l->SetLineStyle(kDashed);
2425
2426 f_calo->Draw("same");
2427 f_calo_l->Draw("same");
2428 gamma_eta0->Draw("p");
2429
2430 lg->AddEntry(gamma_eta0,
2431 Form("Electrons, #eta = 0.3-0.4", f_calo->GetParameter(0),
2432 f_calo->GetParameter(1)), "p");
2433 lg2->AddEntry(f_calo,
2434 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
2435 f_calo->GetParameter(1)), "l");
2436 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
2437 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
2438 f_calo_l->GetParameter(1)), "l");
2439 entry->SetTextColor(kGray + 1);
2440
2441 TF1 * f_calo = new TF1("f_calo_gamma_eta0_1d", "sqrt([0]*[0]+[1]*[1]/x)/100",
2442 0.5, 60);
2443 TF1 * f_calo_l = new TF1("f_calo_l_gamma_eta0_1d", "([0]+[1]/sqrt(x))/100",
2444 0.5, 60);
2445 gamma_eta0_1d->Fit(f_calo, "RM0");
2446 gamma_eta0_1d->Fit(f_calo_l, "RM0");
2447
2448 gamma_eta0_1d->SetLineColor(kBlue + 1);
2449 gamma_eta0_1d->SetMarkerColor(kBlue + 1);
2450 gamma_eta0_1d->SetLineWidth(2);
2451 gamma_eta0_1d->SetMarkerStyle(kOpenSquare);
2452 gamma_eta0_1d->SetMarkerSize(2);
2453 f_calo->SetLineColor(kBlue + 1);
2454 f_calo->SetLineWidth(2);
2455 f_calo_l->SetLineColor(kBlue + 1);
2456 f_calo_l->SetLineWidth(2);
2457 f_calo_l->SetLineStyle(kDashed);
2458
2459 f_calo->Draw("same");
2460 f_calo_l->Draw("same");
2461 gamma_eta0_1d->Draw("p");
2462
2463 TString ltitle = Form("Photons, #eta = 0.3-0.4", f_calo->GetParameter(0),
2464 f_calo->GetParameter(1));
2465 lg->AddEntry(gamma_eta0_1d, ltitle.Data(), "p");
2466 lg2->AddEntry(f_calo,
2467 Form("#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}", f_calo->GetParameter(0),
2468 f_calo->GetParameter(1)), "l");
2469 TLegendEntry * entry = lg2->AddEntry(f_calo_l,
2470 Form("#DeltaE/E = %.1f%% + %.1f%%/#sqrt{E}", f_calo_l->GetParameter(0),
2471 f_calo_l->GetParameter(1)), "l");
2472 entry->SetTextColor(kGray + 1);
2473
2474 lg->Draw();
2475 lg2->Draw();
2476
2477 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
2478 }
2479
2480 TGraphErrors *
2481 DrawTowerSum_AnaP(
2482 const TString config =
2483 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX",
2484 const TString particle = "e-_eta0", bool mean_or_res = false)
2485 {
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497 const int N = 10;
2498 double es[100] =
2499 { 1, 2, 4, 8, 10, 16, 24, 32, 40, 50 };
2500 double mean[100] =
2501 { 0 };
2502 double mean_err[100] =
2503 { 0 };
2504 double res[100] =
2505 { 0 };
2506 double res_err[100] =
2507 { 0 };
2508
2509 TCanvas *c1 = new TCanvas(config, config);
2510 c1->Print(config + ".pdf[");
2511
2512 for (int i = 0; i < N; ++i)
2513 {
2514 TVectorD fit(4);
2515
2516 fit = DrawTowerSum_SingleE(config, particle, es[i]);
2517
2518 mean[i] = fit[0];
2519 mean_err[i] = fit[1];
2520 res[i] = fit[2] / mean[i];
2521 res_err[i] = fit[3] / mean[i];
2522 }
2523 c1->Print(config + ".pdf]");
2524 cout << "DrawTowerSum_AnaP - save to " << config << ".pdf" << endl;
2525
2526 if (mean_or_res)
2527 {
2528 TGraphErrors * ge = new TGraphErrors(N, es, mean, 0, mean_err);
2529 ge->Print();
2530 return ge;
2531 }
2532 else
2533 {
2534 TGraphErrors * ge = new TGraphErrors(N, es, res, 0, res_err);
2535 ge->Print();
2536 return ge;
2537 }
2538
2539 }
2540
2541 TVectorD
2542 DrawTowerSum_SingleE(
2543 const TString config =
2544 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/production_analysis/emcstudies/nosvtx/spacal1d/fieldmap/G4Hits_sPHENIX",
2545 const TString particle = "e-_eta0", const double e = 8)
2546 {
2547
2548
2549 const TString e_GeV = Form("%.0fGeV", e);
2550
2551 const TString file_name = config + "_" + particle + "_" + e_GeV
2552 + ".root_DSTReader.root";
2553 cout << "DrawTowerSum_SingleE - lead " << file_name << endl;
2554
2555 TFile *f = new TFile(file_name);
2556 assert(f);
2557 TTree * T = (TTree *) f->GetObjectChecked("T", "TTree");
2558 assert(T);
2559
2560 const TString h_cluster_E_name = TString("h_cluster_E_") + particle + e_GeV;
2561 TH1F * h_cluster_E = new TH1F(h_cluster_E_name, file_name, 200, 0, e * 1.5);
2562
2563 TCanvas *c1 = new TCanvas(file_name, file_name);
2564 T->Draw("Sum$(TOWER_SIM_CEMC.energy)/ 2.36081e-02>>" + h_cluster_E_name, "");
2565
2566 const double mean = h_cluster_E->GetMean();
2567 const double rms = h_cluster_E->GetRMS();
2568
2569
2570
2571 TF1 * f_gaus_pilot = new TF1("f_gaus_pilot" + h_cluster_E_name, "gaus",
2572 e * 0.5, e * 1.5);
2573 f_gaus_pilot->SetParameters(1, mean, rms);
2574 f_gaus_pilot->SetLineColor(kRed);
2575 h_cluster_E->Fit(f_gaus_pilot, "MRQS0");
2576 f_gaus_pilot->Draw("same");
2577
2578 TF1 * f_gaus = new TF1("f_gaus" + h_cluster_E_name, "gaus",
2579 f_gaus_pilot->GetParameter(1) - 1.5 * f_gaus_pilot->GetParameter(2),
2580 f_gaus_pilot->GetParameter(1) + 4 * f_gaus_pilot->GetParameter(2));
2581 f_gaus->SetParameters(f_gaus_pilot->GetParameter(0),
2582 f_gaus_pilot->GetParameter(1), f_gaus_pilot->GetParameter(2));
2583
2584 h_cluster_E->Fit(f_gaus, "MRQS0");
2585 f_gaus->Draw("same");
2586
2587 cout << "load_SF - result = " << f_gaus->GetParameter(1) << "+/-"
2588 << f_gaus->GetParError(1) << endl;
2589
2590 TVectorD ret(4);
2591 ret[0] = f_gaus->GetParameter(1);
2592 ret[1] = f_gaus->GetParError(1);
2593 ret[2] = f_gaus->GetParameter(2);
2594 ret[3] = f_gaus->GetParError(2);
2595
2596 c1->Print(config + ".pdf");
2597
2598 return ret;
2599 }
2600
2601 void
2602 DrawSF(
2603 const TString base =
2604 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/",
2605 const TString config = "")
2606 {
2607 gStyle->SetOptStat(0);
2608 gStyle->SetOptFit(0);
2609
2610 TCanvas *c1 = new TCanvas("DrawSF", "DrawSF", 1800, 900);
2611 c1->Divide(1, 1);
2612 int idx = 1;
2613 TPad * p;
2614
2615 p = (TPad *) c1->cd(idx++);
2616 c1->Update();
2617
2618 p->SetGridx(0);
2619 p->SetGridy(0);
2620
2621 p->DrawFrame(-0.1, 2e-2, 1.2, 3.0e-2,
2622 ";Pseudorapidity;EMCal Sampling fraction");
2623
2624 TLegend * lg = new TLegend(0, 2.55e-2, 0.6, 2.9e-2, NULL, "br");
2625
2626 TGraphErrors * ge = Load_CurveSet(
2627 base + "/spacal2d/zerofield/G4Hits_sPHENIX_gamma", "24GeV");
2628 ge->SetLineColor(kRed + 3);
2629 ge->SetMarkerColor(kRed + 3);
2630 ge->SetLineWidth(2);
2631 ge->SetMarkerStyle(kFullSquare);
2632 ge->SetMarkerSize(2);
2633 ge->Draw("lep");
2634 lg->AddEntry(ge, "24 GeV #gamma in 2D-proj. SPACAL", "lp");
2635
2636 TGraphErrors * ge = Load_CurveSet(
2637 base + "/spacal1d/zerofield/G4Hits_sPHENIX_gamma", "24GeV");
2638 ge->SetLineColor(kBlue + 3);
2639 ge->SetMarkerColor(kBlue + 3);
2640 ge->SetLineStyle(kDashed);
2641 ge->SetLineWidth(2);
2642 ge->SetMarkerStyle(kOpenSquare);
2643 ge->SetMarkerSize(2);
2644 ge->Draw("lep");
2645 lg->AddEntry(ge, "24 GeV #gamma in 1D-proj. SPACAL", "lp");
2646
2647 TGraphErrors * ge = Load_CurveSet(
2648 base + "/spacal2d/zerofield/G4Hits_sPHENIX_e-", "4GeV");
2649 ge->SetLineColor(kRed + 3);
2650 ge->SetMarkerColor(kRed + 3);
2651 ge->SetLineWidth(2);
2652 ge->SetMarkerStyle(kFullCircle);
2653 ge->SetMarkerSize(2);
2654 ge->Draw("lep");
2655 lg->AddEntry(ge, "4 GeV e^{-} in 2D-proj. SPACAL", "lp");
2656
2657 TGraphErrors * ge = Load_CurveSet(
2658 base + "/spacal1d/zerofield/G4Hits_sPHENIX_e-", "4GeV");
2659 ge->SetLineColor(kBlue + 3);
2660 ge->SetMarkerColor(kBlue + 3);
2661 ge->SetLineStyle(kDashed);
2662 ge->SetLineWidth(2);
2663 ge->SetMarkerStyle(kOpenCircle);
2664 ge->SetMarkerSize(2);
2665 ge->Draw("lep");
2666 lg->AddEntry(ge, "4 GeV e^{-} in 1D-proj. SPACAL", "lp");
2667
2668 lg->Draw();
2669
2670 SaveCanvas(c1, base + "DrawEcal_" + TString(c1->GetName()), true);
2671 }
2672
2673 TGraphErrors *
2674 Load_CurveSet(
2675 const TString config =
2676 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/spacal2d/zerofield/G4Hits_sPHENIX_gamma",
2677 const TString energy = "24GeV")
2678 {
2679 double etas[100] =
2680 { 0 };
2681 double SFs[100] =
2682 { 0 };
2683 double SF_Errs[100] =
2684 { 0 };
2685
2686 int n = 0;
2687 TVectorD SF(2);
2688
2689 etas[n] = 0 + 0.05;
2690 SF = Load_SF("eta0", config, energy);
2691 SFs[n] = SF[0];
2692 SF_Errs[n] = SF[1];
2693 n++;
2694
2695 etas[n] = 0.3 + 0.05;
2696 SF = Load_SF("eta0.30", config, energy);
2697 SFs[n] = SF[0];
2698 SF_Errs[n] = SF[1];
2699 n++;
2700
2701 etas[n] = 0.6 + 0.05;
2702 SF = Load_SF("eta0.60", config, energy);
2703 SFs[n] = SF[0];
2704 SF_Errs[n] = SF[1];
2705 n++;
2706
2707 etas[n] = 0.9 + 0.05;
2708 SF = Load_SF("eta0.90", config, energy);
2709 SFs[n] = SF[0];
2710 SF_Errs[n] = SF[1];
2711 n++;
2712
2713 TGraphErrors * ge = new TGraphErrors(n, etas, SFs, 0, SF_Errs);
2714
2715 return ge;
2716
2717 }
2718
2719 TVectorD
2720 Load_SF(const TString eta_bin = "eta0",
2721 const TString config =
2722 "/direct/phenix+sim02/phnxreco/ePHENIX/jinhuang/sPHENIX_work/single_particle/spacal1d/zerofield/G4Hits_sPHENIX_gamma",
2723 const TString energy = "24GeV")
2724 {
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734 const TString file_name = config + "_" + eta_bin + "_" + energy
2735 + ".root_EMCalAna.root";
2736 cout << "load_SF - lead " << file_name << endl;
2737
2738 TFile *f = new TFile(file_name);
2739 assert(f);
2740 TH1F * EMCalAna_h_CEMC_SF = (TH1F *) f->GetObjectChecked("EMCalAna_h_CEMC_SF",
2741 "TH1F");
2742 assert(EMCalAna_h_CEMC_SF);
2743
2744 const double mean = EMCalAna_h_CEMC_SF->GetMean();
2745 const double rms = EMCalAna_h_CEMC_SF->GetRMS();
2746
2747 TF1 * f_gaus = new TF1("f_gaus" + eta_bin, "gaus", mean - 2 * rms,
2748 mean + 2 * rms);
2749 f_gaus->SetParameters(1, mean, rms);
2750
2751 EMCalAna_h_CEMC_SF->Fit(f_gaus, "MRQS0");
2752
2753 cout << "load_SF - result = " << f_gaus->GetParameter(1) << "+/-"
2754 << f_gaus->GetParError(1) << endl;
2755
2756 TVectorD ret(2);
2757 ret[0] = f_gaus->GetParameter(1);
2758 ret[1] = f_gaus->GetParError(1);
2759
2760 return ret;
2761 }