3 #include "SaveCanvas.C"
4 #include "sPhenixStyle.C"
7 #include <TDatabasePDG.h>
15 #include <TLorentzVector.h>
19 #include <TVirtualFitter.h>
39 TH3 *LayerChipMultiplicity = (TH3 *) file->GetObjectChecked(
"LayerChipMultiplicity",
"TH3");
41 TCanvas *c1 =
new TCanvas(
"MakeChipMultiplicitySet",
"MakeChipMultiplicitySet", 1800, 960);
42 c1->Divide(9, 3, 0, 0);
48 for (
int ilayer = 1; ilayer <= LayerChipMultiplicity->GetNbinsX(); ++ilayer)
50 vector<TH1 *> chipMultiplicityLayer;
52 for (
int ichip = 1; ichip <= LayerChipMultiplicity->GetNbinsY(); ++ichip)
54 p = (TPad *) c1->cd(idx++);
58 LayerChipMultiplicity->GetXaxis()->SetRange(ilayer, ilayer);
59 LayerChipMultiplicity->GetYaxis()->SetRange(ichip, ichip);
61 TString histname(Form(
"ChipMultiplicity_Layer%dChip%d", ilayer - 1, ichip - 1));
62 TH1 *
h = LayerChipMultiplicity->Project3D(
"z");
63 h->SetTitle(
";Chip Multiplicity [pixel];Count");
69 h->SetDirectory(NULL);
70 h->ComputeIntegral(
true);
72 chipMultiplicityLayer.push_back(h);
75 chipMultiplicitySet.push_back(chipMultiplicityLayer);
78 SaveCanvas(c1, TString(file->GetName()) + TString(c1->GetName()),
false);
80 c1 =
new TCanvas(
"MakeChipMultiplicitySetChip4",
"MakeChipMultiplicitySetChip4", 1200, 960);
82 TH1 *LayerMultiplicityLayer0 = chipMultiplicitySet[0][4];
83 TH1 *LayerMultiplicityLayer1 = chipMultiplicitySet[1][4];
84 TH1 *LayerMultiplicityLayer2 = chipMultiplicitySet[2][4];
86 LayerMultiplicityLayer0->SetLineColor(kRed + 2);
87 LayerMultiplicityLayer1->SetLineColor(kBlue + 2);
88 LayerMultiplicityLayer2->SetLineColor(kGreen + 2);
90 LayerMultiplicityLayer0->Draw();
91 LayerMultiplicityLayer1->Draw(
"same");
92 LayerMultiplicityLayer2->Draw(
"same");
94 LayerMultiplicityLayer0->SetTitle(
";Chip multiplicity [Pixel];Count");
96 TLegend *
leg =
new TLegend(.5, .5, .93, .93);
97 leg->AddEntry(
"",
"#it{#bf{sPHENIX}} Simulation",
"");
99 leg->AddEntry(LayerMultiplicityLayer0, Form(
"MVTX Layer0 Chip4, <hit> = %.1f", LayerMultiplicityLayer0->GetMean()),
"l");
100 leg->AddEntry(LayerMultiplicityLayer1, Form(
"MVTX Layer1 Chip4, <hit> = %.1f", LayerMultiplicityLayer1->GetMean()),
"l");
101 leg->AddEntry(LayerMultiplicityLayer2, Form(
"MVTX Layer2 Chip4, <hit> = %.1f", LayerMultiplicityLayer2->GetMean()),
"l");
104 SaveCanvas(c1, TString(file->GetName()) + TString(c1->GetName()),
false);
106 return chipMultiplicitySet;
113 TCanvas *c1 =
new TCanvas(
"Check",
"Check", 1800, 960);
118 p = (TPad *) c1->cd(idx++);
122 TH1 *
hNormalization = (TH1 *) file->GetObjectChecked(
"hNormalization",
"TH1");
123 hNormalization->Draw();
125 p = (TPad *) c1->cd(idx++);
129 TH1 *hNChEta = (TH1 *) file->GetObjectChecked(
"hNChEta",
"TH1");
131 double norm = hNChEta->GetBinWidth(1) * hNormalization->GetBinContent(2);
132 hNChEta->Scale(1. / norm);
135 hNChEta->GetYaxis()->SetTitle(
"dN_{Ch}/d#eta");
138 p = (TPad *) c1->cd(idx++);
140 TH1 *hVertexZ = (TH1 *) file->GetObjectChecked(
"hVertexZ",
"TH1");
143 p = (TPad *) c1->cd(idx++);
147 TH2 *LayerMultiplicity = (TH2 *) file->GetObjectChecked(
"LayerMultiplicity",
"TH2");
148 TH1 *LayerMultiplicityLayer0 =
149 LayerMultiplicity->ProjectionY(
"LayerMultiplicityLayer0", 1, 1);
150 TH1 *LayerMultiplicityLayer1 =
151 LayerMultiplicity->ProjectionY(
"LayerMultiplicityLayer1", 2, 2);
152 TH1 *LayerMultiplicityLayer2 =
153 LayerMultiplicity->ProjectionY(
"LayerMultiplicityLayer2", 3, 3);
155 LayerMultiplicityLayer0->SetLineColor(kRed + 2);
156 LayerMultiplicityLayer1->SetLineColor(kBlue + 2);
157 LayerMultiplicityLayer2->SetLineColor(kGreen + 2);
159 LayerMultiplicityLayer0->Draw();
160 LayerMultiplicityLayer1->Draw(
"same");
161 LayerMultiplicityLayer2->Draw(
"same");
163 LayerMultiplicityLayer0->SetTitle(
";Chip multiplicity [Pixel];Count");
165 TLegend *
leg =
new TLegend(.5, .5, .93, .93);
166 leg->AddEntry(
"",
"#it{#bf{sPHENIX}} Simulation",
"");
168 leg->AddEntry(LayerMultiplicityLayer0, Form(
"MVTX Layer0, <hit> = %.1f", LayerMultiplicityLayer0->GetMean()),
"l");
169 leg->AddEntry(LayerMultiplicityLayer1, Form(
"MVTX Layer1, <hit> = %.1f", LayerMultiplicityLayer1->GetMean()),
"l");
170 leg->AddEntry(LayerMultiplicityLayer2, Form(
"MVTX Layer2, <hit> = %.1f", LayerMultiplicityLayer2->GetMean()),
"l");
173 SaveCanvas(c1, TString(file->GetName()) + TString(c1->GetName()),
false);
180 TH1 *hCDF = (TH1 *) h->Clone(TString(
"CDF") + h->GetName());
181 hCDF->SetDirectory(NULL);
185 for (
int bin = h->GetNbinsX() + 1; bin >= 0; --bin)
187 integral += h->GetBinContent(bin);
188 hCDF->SetBinContent(bin, integral);
191 for (
int bin = h->GetNbinsX(); bin >= 1; --bin)
193 hCDF->SetBinContent(bin, hCDF->GetBinContent(bin) /
integral);
204 const static int MaxMultiplicity(2000);
206 for (
auto &
layer : cm_MB)
208 vector<TH1 *> chipMultiplicityLayer;
210 for (
auto &chip :
layer)
213 TString(
"Trigger") + chip->GetName(), TString(
"Trigger") + chip->GetName(),
214 MaxMultiplicity, -.5, MaxMultiplicity - .5);
217 h->SetDirectory(NULL);
218 h->GetXaxis()->SetTitle(chip->GetXaxis()->GetTitle());
219 h->GetYaxis()->SetTitle(chip->GetYaxis()->GetTitle());
222 chipMultiplicityLayer.push_back(h);
224 cm.push_back(chipMultiplicityLayer);
230 assert(n_Trigger >= 0 && n_Trigger <= 1);
234 const int NSample = 10000000;
235 for (
int i = 0;
i < NSample; ++
i)
237 if (
i % (NSample / 10) == 0)
239 cout <<
"TriggerMultiplicity - " <<
i << endl;
242 int n_MB = rnd.Poisson(mu_MB);
243 int n_Noise = rnd.Poisson(mu_Noise);
246 for (
auto &
layer : cm)
249 for (
auto &chip :
layer)
254 assert(ilayer < cm_Trigger.size());
256 assert(cm_Trigger[ilayer][ichip]);
259 double rndHit = cm_Trigger[ilayer][ichip]->GetRandom();
260 if (rndHit < .5) rndHit = 0;
266 assert(ilayer < cm_MB.size());
268 assert(cm_MB[ilayer][ichip]);
269 for (
int iMB = 0; iMB < n_MB; ++iMB)
271 double rndHit = cm_MB[ilayer][ichip]->GetRandom();
272 if (rndHit < .5) rndHit = 0;
286 TString UniqueName(Form(
"_muMB%.0f_nTrig%d_muNoise%.0f", mu_MB * 100, n_Trigger, mu_Noise));
289 TCanvas *c1 =
new TCanvas(
"TriggerMultiplicity" + UniqueName,
"TriggerMultiplicity" + UniqueName, 1800, 960);
290 c1->Divide(9, 3, 0, 0);
294 for (
auto &
layer : cm)
296 vector<TH1 *> chipMultiplicityLayer;
298 for (
auto &chip :
layer)
300 p = (TPad *) c1->cd(idx++);
304 chip->SetTitle(
";Chip Multiplicity [pixel];Count");
311 c1 =
new TCanvas(
"TriggerMultiplicityChip4" + UniqueName,
"TriggerMultiplicityChip4" + UniqueName, 1900, 750);
315 p = (TPad *) c1->cd(idx++);
319 TH1 *LayerMultiplicityLayer0 = cm[0][4];
320 TH1 *LayerMultiplicityLayer1 = cm[1][4];
321 TH1 *LayerMultiplicityLayer2 = cm[2][4];
323 LayerMultiplicityLayer0->SetLineColor(kRed + 2);
324 LayerMultiplicityLayer1->SetLineColor(kBlue + 2);
325 LayerMultiplicityLayer2->SetLineColor(kGreen + 2);
327 LayerMultiplicityLayer0->Draw();
328 LayerMultiplicityLayer1->Draw(
"same");
329 LayerMultiplicityLayer2->Draw(
"same");
331 LayerMultiplicityLayer0->SetTitle(
";Chip multiplicity [Pixel];Count");
333 TLegend *
leg =
new TLegend(.45, .55, .93, .93);
334 leg->AddEntry(
"",
"#it{#bf{sPHENIX}} Simulation",
"");
336 leg->AddEntry(
"", Form(
"#mu_{MB} = %.1f, N_{Trig} = %d, #mu_{Noise} = %.1f", mu_MB, n_Trigger, mu_Noise),
"");
337 leg->AddEntry(LayerMultiplicityLayer0, Form(
"MVTX Layer0 Chip4, <hit> = %.1f", LayerMultiplicityLayer0->GetMean()),
"l");
338 leg->AddEntry(LayerMultiplicityLayer1, Form(
"MVTX Layer1 Chip4, <hit> = %.1f", LayerMultiplicityLayer1->GetMean()),
"l");
339 leg->AddEntry(LayerMultiplicityLayer2, Form(
"MVTX Layer2 Chip4, <hit> = %.1f", LayerMultiplicityLayer2->GetMean()),
"l");
342 p = (TPad *) c1->cd(idx++);
346 p->DrawFrame(0, 1. / NSample, MaxMultiplicity, 1)->SetTitle(
";Chip multiplicity [Pixel];CCDF");
347 TLine *
line =
new TLine(0, 1
e-3, MaxMultiplicity, 1
e-3);
348 line->SetLineColor(kGray);
349 line->SetLineWidth(3);
352 MakeCDF(LayerMultiplicityLayer0)->Draw(
"same");
353 MakeCDF(LayerMultiplicityLayer1)->Draw(
"same");
354 MakeCDF(LayerMultiplicityLayer2)->Draw(
"same");
365 const TString
infile =
"/sphenix/user/jinhuang/HF-jet/MVTX_Multiplicity/AuAu200MB_30cmVZ_Iter5/AuAu200MB_30cmVZ_Iter5_SUM.xml_HFMLTriggerOccupancy.root",
366 const TString infile_trigger =
"/sphenix/user/jinhuang/HF-jet/MVTX_Multiplicity/AuAu200MB_10cmVZ_Iter5/AuAu200MB_10cmVZ_Iter5_SUM.xml_HFMLTriggerOccupancy.root",
367 const TString disc =
"Au+Au MB, #sqrt{s_{NN}} = 200 GeV"
371 TVirtualFitter::SetDefaultFitter(
"Minuit2");
377 assert(_file_trigger->IsOpen());
384 Check(_file_trigger);
389 200e3 * 10
e-6, 1, 1024 * 512 * 1
e-6 + 2);
392 200e3 * 15
e-6, 0, 1024 * 512 * 1
e-6 + 2);
395 200e3 * 10
e-6, 0, 1024 * 512 * 1
e-6 + 2);
398 200e3 * 5
e-6, 0, 1024 * 512 * 1
e-6 + 2);
401 100e3 * 5
e-6, 0, 1024 * 512 * 1
e-6 + 2);
404 50e3 * 5
e-6, 0, 1024 * 512 * 1
e-6 + 2);
407 200e3 * 15
e-6, 0, 1024 * 512 * 1
e-5 + 2);
410 200e3 * 10
e-6, 0, 1024 * 512 * 1
e-5 + 2);
413 200e3 * 5
e-6, 0, 1024 * 512 * 1
e-5 + 2);