12 #include <TGraphAsymmErrors.h>
13 #include <TGraphErrors.h>
20 #include "SaveCanvas.C"
21 #include "sPhenixStyle.C"
40 "/phenix/u/jinhuang/links/sPHENIX_work/EIC/DAQ/pythia8_FixedTarget5/pythia8_FixedTarget5_3333.cfg_output/G4EICDetector.root_DSTReader.root",
46 gStyle->SetOptStat(0);
47 gStyle->SetOptFit(1111);
48 TVirtualFitter::SetDefaultFitter(
"Minuit2");
50 gSystem->Load(
"libg4eval.so");
54 TString chian_str =
infile;
55 chian_str.ReplaceAll(
"ALL",
"*");
57 TChain *
t =
new TChain(
"T");
58 const int n = t->Add(chian_str);
60 cout <<
"Loaded " << n <<
" root files with " << chian_str << endl;
68 const double lumi = 1e33;
69 const double event_rate = (xsection * 1
e-3 * 1
e-24) * lumi;
73 cout <<
"Config summary: " << endl;
74 cout <<
"lumi = " << lumi <<
"/cm2/s" << endl;
75 cout <<
"xsection = " << xsection <<
" mb" << endl;
76 cout <<
"event_rate = " << event_rate <<
" hz" << endl;
77 cout <<
"total_event = " <<
total_event <<
"" << endl;
78 cout <<
"time = " << time <<
"s" << endl;
80 T->SetAlias(
"p_Q2",
"PHG4Particle.fpx**2 + PHG4Particle.fpy**2 + (PHG4Particle.fpz+20)**2 - (PHG4Particle.fe-20)**2");
81 T->SetAlias(
"PHG4Particle_p",
82 "1*sqrt(PHG4Particle.fpx**2+PHG4Particle.fpy**2+PHG4Particle.fpz**2)");
83 T->SetAlias(
"PHG4Particle_pT",
84 "1*sqrt(PHG4Particle.fpx**2+PHG4Particle.fpy**2)");
86 "0.5*log((PHG4Particle_p+PHG4Particle.fpz)/(PHG4Particle_p-PHG4Particle.fpz))");
87 T->SetAlias(
"p_rapidity",
88 "0.5*log((PHG4Particle.fe+PHG4Particle.fpz)/(PHG4Particle.fe - PHG4Particle.fpz))");
89 T->SetAlias(
"PrimVertex",
"Sum$(PHG4VtxPoint[].vz * (PHG4VtxPoint[].t0==0))/Sum$(PHG4VtxPoint[].t0==0)");
91 T->SetAlias(
"SVTXHitLength",
92 "1*sqrt((G4HIT_SVTX.get_x(0) - G4HIT_SVTX.get_x(1))**2 + (G4HIT_SVTX.get_y(0) - G4HIT_SVTX.get_y(1))**2 + (G4HIT_SVTX.get_z(0) - G4HIT_SVTX.get_z(1))**2)");
105 TCanvas *c1 =
new TCanvas(
"TrackerRate",
106 "TrackerRate", 1900, 600);
108 c1->Divide(3, 1, 0, 0);
112 p = (TPad *) c1->cd(idx++);
116 T->Draw(
"Sum$(G4HIT_MAPS.edep>0)>>hMAPSHit(2000,-.5,1999.5)");
117 TH1 *
h = (TH1 *) gDirectory->Get(
"hMAPSHit");
119 h->SetTitle(
";# of MAPS vertex tracker hit per event;Count [A.U.]");
120 h->SetMaximum(h->GetMaximum() * 10);
121 h->GetXaxis()->SetRangeUser(0, 200);
123 double meanhit = h->GetMean();
125 TLegend *
leg =
new TLegend(.2, .70, .95, .93);
126 leg->AddEntry(
"",
"#it{#bf{EIC-sPHENIX}} Simualtion",
"");
127 leg->AddEntry(
"",
"e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV",
"");
128 leg->AddEntry(h, Form(
"Average MAPS hit / event = %.1f", meanhit),
"l");
131 p = (TPad *) c1->cd(idx++);
135 T->Draw(
"Sum$(G4HIT_SVTX.edep>1e-7 && SVTXHitLength>1)>>hSVTXHit(2000,-.5,1999.5)");
136 TH1 *h = (TH1 *) gDirectory->Get(
"hSVTXHit");
137 h->SetTitle(
";# of TPC hit per event;Count [A.U.]");
138 h->SetMaximum(h->GetMaximum() * 10);
139 h->GetXaxis()->SetRangeUser(0, 1000);
140 double meanhit = h->GetMean();
142 TLegend *leg =
new TLegend(.1, .80, .95, .93);
145 leg->AddEntry(h, Form(
"Average TPC cluster / event = %.1f", meanhit),
"l");
149 p = (TPad *) c1->cd(idx++);
152 p->SetRightMargin(.05);
154 T->Draw(
"Sum$(G4HIT_EGEM_1.edep>1e-7)+Sum$(G4HIT_FGEM_1.edep>1e-7)+Sum$(G4HIT_FGEM_2.edep>1e-7)+Sum$(G4HIT_FGEM_3.edep>1e-7)+Sum$(G4HIT_FGEM_4.edep>1e-7)>>hGEMHit(1000,-.5,999.5)");
156 TH1 *h = (TH1 *) gDirectory->Get(
"hGEMHit");
157 h->SetTitle(
";Total GEM hit per event (E>0.1 keV);Count [A.U.]");
158 h->SetMaximum(h->GetMaximum() * 10);
159 h->GetXaxis()->SetRangeUser(0, 400);
160 double meanhit = h->GetMean();
162 TLegend *leg =
new TLegend(.1, .80, .95, .93);
165 leg->AddEntry(h, Form(
"Average GEM hit / event = %.1f", meanhit),
"l");
169 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);
175 TCanvas *c1 =
new TCanvas(
"CentralCalorimeterRate_Energy",
176 "CentralCalorimeterRate_Energy", 1900, 425);
178 c1->Divide(3, 1, 0, 0);
182 p = (TPad *) c1->cd(idx++);
186 T->Draw(
"TOWER_SIM_CEMC.energy/0.026>>hEMCalADC(210,0,20)");
187 TH1 *
h = (TH1 *) gDirectory->Get(
"hEMCalADC");
189 h->SetTitle(
";Central EMCal Tower Energy [GeV];Count [A.U.]");
190 h->SetMaximum(h->GetMaximum() * 10);
192 TLegend *
leg =
new TLegend(.2, .70, .95, .93);
193 leg->AddEntry(
"",
"#it{#bf{EIC-sPHENIX}} Simualtion",
"");
194 leg->AddEntry(
"",
"e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV",
"");
195 leg->AddEntry(h, Form(
"Central EMCal Energy/Tower"),
"l");
198 p = (TPad *) c1->cd(idx++);
202 T->Draw(
"TOWER_SIM_HCALIN.energy/ 0.162166>>hHCalInADC(210,0,20)");
203 TH1 *h = (TH1 *) gDirectory->Get(
"hHCalInADC");
205 h->SetTitle(
";Central Inner HCal Tower Energy [GeV];Count [A.U.]");
206 h->SetMaximum(h->GetMaximum() * 10);
208 TLegend *leg =
new TLegend(.1, .80, .95, .93);
211 leg->AddEntry(h, Form(
"Central Inner HCal Energy/Tower"),
"l");
214 p = (TPad *) c1->cd(idx++);
216 p->SetRightMargin(.05);
219 T->Draw(
"TOWER_SIM_HCALOUT.energy/3.38021e-02>>hHCalOutADC(210,0,20)");
220 TH1 *h = (TH1 *) gDirectory->Get(
"hHCalOutADC");
222 h->SetTitle(
";Central Outer HCal Tower Energy [GeV];Count [A.U.]");
223 h->SetMaximum(h->GetMaximum() * 10);
225 TLegend *leg =
new TLegend(.1, .80, .95, .93);
228 leg->AddEntry(h, Form(
"Central Outer HCal Energy/Tower"),
"l");
232 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);
234 c1 =
new TCanvas(
"CentralCalorimeterRate_Multiplicity",
235 "CentralCalorimeterRate_Multiplicity", 1900, 425);
237 c1->Divide(3, 1, 0, 0);
241 p = (TPad *) c1->cd(idx++);
245 T->Draw(
"Sum$(TOWER_SIM_CEMC.energy/0.026>0.03)>>hCEMCHit(200,-.5,199.5)");
246 TH1 *h = (TH1 *) gDirectory->Get(
"hCEMCHit");
248 h->SetTitle(
";# of CEMC tower per event (E>30 MeV);Count [A.U.]");
249 h->SetMaximum(h->GetMaximum() * 10);
250 h->GetXaxis()->SetRangeUser(0, 100);
251 double meanhit = h->GetMean();
253 TLegend *leg =
new TLegend(.2, .70, .95, .93);
254 leg->AddEntry(
"",
"#it{#bf{EIC-sPHENIX}} Simualtion",
"");
255 leg->AddEntry(
"",
"e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV",
"");
256 leg->AddEntry(h, Form(
"Average CEMC tower / event = %.1f", meanhit),
"l");
259 p = (TPad *) c1->cd(idx++);
262 T->Draw(
"Sum$(TOWER_SIM_HCALIN.energy/ 0.162166>0.03)>>hHCALINHit(200,-.5,199.5)");
263 TH1 *h = (TH1 *) gDirectory->Get(
"hHCALINHit");
265 h->SetTitle(
";# of Inner HCal tower per event (E>30 MeV);Count [A.U.]");
266 h->SetMaximum(h->GetMaximum() * 10);
267 h->GetXaxis()->SetRangeUser(0, 100);
268 double meanhit = h->GetMean();
270 TLegend *leg =
new TLegend(.1, .80, .95, .93);
273 leg->AddEntry(h, Form(
"Average Inner HCal tower / event = %.1f", meanhit),
"l");
276 p = (TPad *) c1->cd(idx++);
279 p->SetRightMargin(.05);
281 T->Draw(
"Sum$(TOWER_SIM_HCALOUT.energy/3.38021e-02>0.03)>>hHCALOUTHit(200,-.5,199.5)");
282 TH1 *h = (TH1 *) gDirectory->Get(
"hHCALOUTHit");
284 h->SetTitle(
";# of Outer HCal tower per event (E>30 MeV);Count [A.U.]");
285 h->SetMaximum(h->GetMaximum() * 10);
286 h->GetXaxis()->SetRangeUser(0, 100);
287 double meanhit = h->GetMean();
289 TLegend *leg =
new TLegend(.1, .80, .95, .93);
292 leg->AddEntry(h, Form(
"Average Outer HCal tower / event = %.1f", meanhit),
"l");
296 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);
302 TCanvas *c1 =
new TCanvas(
"ForwardCalorimeterRate_Energy",
303 "ForwardCalorimeterRate_Energy", 1900, 425);
305 c1->Divide(3, 1, 0, 0);
309 p = (TPad *) c1->cd(idx++);
313 T->Draw(
"TOWER_SIM_EEMC.energy>>hEEMCal(801,0,20)");
314 TH1 *
h = (TH1 *) gDirectory->Get(
"hEEMCal");
316 h->SetTitle(
";e-going EMCal Tower Energy [GeV];Count [A.U.]");
317 h->SetMaximum(h->GetMaximum() * 10);
319 TLegend *
leg =
new TLegend(.2, .70, .95, .93);
320 leg->AddEntry(
"",
"#it{#bf{EIC-sPHENIX}} Simualtion",
"");
321 leg->AddEntry(
"",
"e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV",
"");
322 leg->AddEntry(h, Form(
"e-going EMCal Energy/Tower"),
"l");
325 p = (TPad *) c1->cd(idx++);
329 T->Draw(
"TOWER_SIM_FEMC.energy/0.249>>hFEMCal(801,0,200)");
330 TH1 *h = (TH1 *) gDirectory->Get(
"hFEMCal");
332 h->SetTitle(
";h-going EMCal Tower Energy [GeV];Count [A.U.]");
333 h->SetMaximum(h->GetMaximum() * 10);
335 TLegend *leg =
new TLegend(.1, .80, .95, .93);
338 leg->AddEntry(h, Form(
"h-going EMCal Energy/Tower"),
"l");
341 p = (TPad *) c1->cd(idx++);
343 p->SetRightMargin(.05);
346 T->Draw(
"TOWER_SIM_FHCAL.energy/0.03898>>hFHCAL(801,0,200)");
347 TH1 *h = (TH1 *) gDirectory->Get(
"hFHCAL");
349 h->SetTitle(
";h-going HCal Tower Energy [GeV];Count [A.U.]");
350 h->SetMaximum(h->GetMaximum() * 10);
352 TLegend *leg =
new TLegend(.1, .80, .95, .93);
355 leg->AddEntry(h, Form(
"h-going HCal Energy/Tower"),
"l");
359 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);
361 c1 =
new TCanvas(
"ForwardCalorimeterRate_Multiplicity",
362 "ForwardCalorimeterRate_Multiplicity", 1900, 425);
364 c1->Divide(3, 1, 0, 0);
368 p = (TPad *) c1->cd(idx++);
372 T->Draw(
"Sum$(TOWER_SIM_EEMC.energy>0.03)>>hEEMCHit(400,-.5,399.5)");
373 TH1 *h = (TH1 *) gDirectory->Get(
"hEEMCHit");
375 h->SetTitle(
";# of e-going EMCal tower per event (E>30 MeV);Count [A.U.]");
376 h->SetMaximum(h->GetMaximum() * 10);
377 h->GetXaxis()->SetRangeUser(0, 100);
378 double meanhit = h->GetMean();
380 TLegend *leg =
new TLegend(.2, .70, .95, .93);
381 leg->AddEntry(
"",
"#it{#bf{EIC-sPHENIX}} Simualtion",
"");
382 leg->AddEntry(
"",
"e+p, 20+250 GeV/c, #sqrt{s_{ep}}=140 GeV",
"");
383 leg->AddEntry(h, Form(
"Average e-going EMCal tower / event = %.1f", meanhit),
"l");
386 p = (TPad *) c1->cd(idx++);
390 T->Draw(
"Sum$(TOWER_SIM_FEMC.energy/0.249>0.03)>>hHEMCHit(800,-.5,799.5)");
391 TH1 *h = (TH1 *) gDirectory->Get(
"hHEMCHit");
393 h->SetTitle(
";# of h-going EMCal tower per event (E>30 MeV);Count [A.U.]");
394 h->SetMaximum(h->GetMaximum() * 10);
395 h->GetXaxis()->SetRangeUser(0, 300);
396 double meanhit = h->GetMean();
398 TLegend *leg =
new TLegend(.1, .80, .95, .93);
401 leg->AddEntry(h, Form(
"Average h-going EMCal tower / event = %.1f", meanhit),
"l");
404 p = (TPad *) c1->cd(idx++);
406 p->SetRightMargin(.05);
409 T->Draw(
"Sum$(TOWER_SIM_FHCAL.energy/0.03898>0.03)>>hHHCalHit(400,-.5,399.5)");
410 TH1 *h = (TH1 *) gDirectory->Get(
"hHHCalHit");
412 h->SetTitle(
";# of h-going HCal tower per event (E>30 MeV);Count [A.U.]");
413 h->SetMaximum(h->GetMaximum() * 10);
414 h->GetXaxis()->SetRangeUser(0, 100);
415 double meanhit = h->GetMean();
417 TLegend *leg =
new TLegend(.1, .80, .95, .93);
420 leg->AddEntry(h, Form(
"Average h-going HCal tower / event = %.1f", meanhit),
"l");
424 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);
430 TCanvas *c1 =
new TCanvas(
"KinematicsChecks",
431 "KinematicsChecks", 1900, 500);
437 p = (TPad *) c1->cd(idx++);
440 T->Draw(
"p_Q2>>hQ2_inc(400,0,100)",
"PHG4Particle.fpid==11 && PHG4Particle[].trkid>=0");
441 hQ2_inc->SetTitle(
";Q2 from truth electron [(GeV/c)^2];Count / bin");
443 p = (TPad *) c1->cd(idx++);
446 T->Draw(
"p_eta>>hp_eta(100,-5,5)",
"PHG4Particle_pT>0.01 && PHG4Particle[].trkid>=0");
447 TH1 *hp_eta = (TH1 *) gDirectory->GetObjectChecked(
"hp_eta",
"TH1");
448 hp_eta->SetTitle(
";#eta for primary particle with p_{T}>10 MeV;dN/d#eta/Event");
449 hp_eta->Scale(1. /
total_event / hp_eta->GetXaxis()->GetBinWidth(1));
451 p = (TPad *) c1->cd(idx++);
454 T->Draw(
"p_rapidity>>hp_rapidity(200,-10,10)",
"PHG4Particle_pT>0.01 && PHG4Particle[].trkid>=0");
455 TH1 *hp_rapidity = (TH1 *) gDirectory->GetObjectChecked(
"hp_rapidity",
"TH1");
456 hp_rapidity->SetTitle(
";y for primary particle with p_{T}>10 MeV;dN/dy /Event");
457 hp_rapidity->Scale(1. /
total_event / hp_rapidity->GetXaxis()->GetBinWidth(1));
460 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);
466 TCanvas *c1 =
new TCanvas(
"VertexChecks",
467 "VertexChecks", 1900, 1100);
473 p = (TPad *) c1->cd(idx++);
476 T->Draw(
"PrimVertex>>hVertexPrim(900,-500,500)",
"");
477 hVertexPrim->SetTitle(
";Vertex position [cm]");
479 p = (TPad *) c1->cd(idx++);
482 T->Draw(
"PrimVertex>>hVertexPrimTPC(900,-500,500)",
"Sum$(G4HIT_SVTX.edep>1e-7 && SVTXHitLength>1)");
483 hVertexPrimTPC->SetTitle(
";TPC hit weighted vertex position [cm];Event * hit");
485 p = (TPad *) c1->cd(idx++);
488 T->Draw(
"PrimVertex>>hVertexPrimFGEM4(900,-500,500)",
"Sum$(G4HIT_FGEM_4.edep>1e-7)");
489 hVertexPrimFGEM4->SetTitle(
";Last-FGEM hit weighted vertex position [cm];Event * hit");
491 p = (TPad *) c1->cd(idx++);
494 T->Draw(
"PrimVertex>>hVertexPrimEEMC(900,-500,500)",
"Sum$(TOWER_SIM_EEMC.energy>0.03)");
495 hVertexPrimEEMC->SetTitle(
";EEMC hit weighted vertex position [cm];Event * Tower hit");
497 p = (TPad *) c1->cd(idx++);
500 T->Draw(
"PrimVertex>>hVertexPrimCEMC(900,-500,500)",
"Sum$(TOWER_SIM_CEMC.energy>0.03)");
501 hVertexPrimCEMC->SetTitle(
";CEMC hit weighted vertex position [cm];Event * Tower hit");
503 p = (TPad *) c1->cd(idx++);
506 T->Draw(
"PrimVertex>>hVertexPrimFEMC(900,-500,500)",
"Sum$(TOWER_SIM_FEMC.energy>0.03)");
507 hVertexPrimFEMC->SetTitle(
";FEMC hit weighted vertex position [cm];Event * Tower hit");
510 TString(
_file0->GetName()) + TString(
"_Draw_EICRate_") + TString(c1->GetName()),
true);