]>
Commit | Line | Data |
---|---|---|
8c1c76e9 | 1 | void CorrectForEfficiencypp(const char *filedata,const char *fileMC); |
2 | void CorrectForEfficiencyBeauty(const char *filedata,const char *fileMC, const char *fileMCbg); | |
3 | TList *GetResults(const Char_t *testfile,const Char_t *plus=""); | |
4 | TList *GetQA(const Char_t *testfile,const Char_t *plus=""); | |
5 | TObject* GetSpectrum(AliCFContainer *c, Int_t step); | |
6 | THnSparseF* GetHadronEffbyIPcut(TList *hfeqa); | |
7 | void CorrectFromTheWidth(TH1D *h1); | |
8 | ||
9 | ||
10 | void CorrectForEfficiencypp(const char *filedata,const char *fileMC) { | |
11 | ||
12 | /////////////////////////////////////////////////////////////////////////////////////////////////////// | |
13 | // Will produce finalSpectrum.root with results inside | |
14 | // TGraphErrors UnfoldingCorrectedSpectrum -> unfolding procedure (doesn't work in 2D with trunk) | |
15 | // TGraphErrors AlltogetherSpectrum -> corrected spectrum with other method | |
16 | // TH1D RatioUnfoldingAlltogetherSpectrum | |
17 | // THnSparseF UnfoldingCorrectedNotNormalizedSpectrum -> unfolding procedure not yet normalized | |
18 | // AliCFDataGrid AlltogetherCorrectedNotNormalizedSpectrum -> other method not yet normalized | |
19 | /////////////////////////////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | gStyle->SetPalette(1); | |
22 | gStyle->SetOptStat(1111); | |
23 | gStyle->SetPadBorderMode(0); | |
24 | gStyle->SetCanvasColor(10); | |
25 | gStyle->SetPadLeftMargin(0.13); | |
26 | gStyle->SetPadRightMargin(0.13); | |
27 | ||
28 | ///////////////////// | |
29 | // Take the stuff | |
30 | ///////////////////// | |
31 | ||
32 | TList *resultsdata = GetResults(filedata,"_PID2"); | |
33 | //TList *resultsdata = GetResults(filedata); | |
34 | if(!resultsdata){ | |
35 | printf("No output objects for data: Calculation will terminate here\n"); | |
36 | return; | |
37 | } | |
38 | ||
39 | /////////////////////////////////////////////////////////// | |
40 | // Event container for the normalization to CINB1 | |
41 | // Take the number of events as function of z and number of contributors | |
42 | // For those without primary vertex from tracks, take the fraction in the z range from MC | |
43 | // For 10cm: LHC10f6a (88.0756%), LHC10f6 (86.7461%) | |
44 | //////////////////////////////////////////////////////////// | |
45 | ||
46 | AliCFContainer *containerdata = (AliCFContainer *) resultsdata->FindObject("eventContainer"); | |
47 | if(!containerdata) { | |
48 | printf("No container \n"); | |
49 | return; | |
50 | } | |
51 | AliCFDataGrid *dataGrid = (AliCFDataGrid *) GetSpectrum(containerdata,AliHFEcuts::kEventStepZRange); | |
52 | TH2D *spectrum_zrange = (TH2D *) dataGrid->Project(0,2); | |
53 | TH1D *spectrum1Da = (TH1D *) spectrum_zrange->ProjectionX("bin0",1,1); | |
54 | TH1D *spectrum1Db = (TH1D *) spectrum_zrange->ProjectionX("bin>0",2,12); | |
55 | TH1D *spectrum1Dc = (TH1D *) spectrum_zrange->ProjectionX("total"); | |
56 | Double_t nbinbin0 = spectrum1Da->Integral(); | |
57 | Double_t nbinnobin0 = spectrum1Db->Integral(); | |
58 | Double_t nbintotal = spectrum1Dc->Integral(); | |
59 | ||
60 | ||
61 | Float_t numberofentries = nbinnobin0+nbinbin0*0.880756; | |
62 | printf("Number in bin0 %f, number out %f, total %f, normalized %f\n",nbinbin0,nbinnobin0,nbintotal,numberofentries); | |
63 | ||
64 | ||
65 | ////////////////////////////// | |
66 | // Take more stuff | |
67 | /////////////////////////////// | |
68 | ||
69 | ||
70 | TList *resultsmc = GetResults(fileMC,"_PID2"); | |
71 | //TList *resultsmc = GetResults(fileMC); | |
72 | if(!resultsmc){ | |
73 | printf("No output objects for mc: Calculation will terminate here\n"); | |
74 | return; | |
75 | } | |
76 | ||
77 | AliHFEcontainer *datahfecontainer = (AliHFEcontainer *) resultsdata->FindObject("trackContainer"); | |
78 | if(!datahfecontainer) { | |
79 | printf("No container for data \n"); | |
80 | return; | |
81 | } | |
82 | AliCFContainer *sumcontainer = datahfecontainer->GetCFContainer("recTrackContReco"); | |
83 | ||
84 | ||
85 | //////////////////////////////////////////// | |
86 | //Plot raw spectrum for TPC TOF scenario | |
87 | //////////////////////////////////////////// | |
88 | AliCFDataGrid *dataGrida = (AliCFDataGrid *) GetSpectrum(sumcontainer,AliHFEcuts::kStepHFEcutsTRD + 2); | |
89 | TH1D *spectrumpt = (TH1D *) dataGrida->Project(0); | |
90 | CorrectFromTheWidth(spectrumpt); | |
91 | ||
92 | TH1D *total = new TH1D("total","",1,0.3,4.3); | |
93 | total->SetMaximum(1.0e+07); | |
94 | total->SetMinimum(1000); | |
95 | total->SetXTitle("p_{T} [GeV/c]"); | |
96 | total->SetYTitle("dN/dp_{T}[GeV/c]^{-1}"); | |
97 | total->SetTitleOffset(1.5,"Y"); | |
98 | //total->Scale(0.9); | |
99 | total->GetXaxis()->SetRangeUser(0.38,4.3); | |
100 | ||
101 | ||
102 | TCanvas *c1test = new TCanvas("rawspectrum","rawspectrum",800,800); | |
103 | c1test->cd(1); | |
104 | gPad->SetLeftMargin(0.13); | |
105 | gPad->SetLogy(); | |
106 | gPad->SetTicks(); | |
107 | //gPad->SetGridx(); | |
108 | //gPad->SetGridy(); | |
109 | gPad->SetFillColor(10); | |
110 | gPad->SetFrameFillColor(10); | |
111 | gStyle->SetOptStat(0); | |
112 | gStyle->SetOptFit(1111); | |
113 | gStyle->SetOptTitle(0); | |
114 | total->SetStats(0); | |
115 | spectrumpt->SetStats(0); | |
116 | total->Draw(); | |
117 | spectrumpt->Draw("same"); | |
118 | TPaveText* t1=new TPaveText(0.49,0.45,0.79,0.52,"NDC"); | |
119 | t1->SetFillStyle(0); | |
120 | t1->SetBorderSize(0); | |
121 | t1->AddText(0.,0.,"pp, #sqrt{s} = 7 TeV"); | |
122 | t1->SetTextColor(kRed); | |
123 | //t1->SetTextSize(20); | |
124 | t1->SetTextFont(42); | |
125 | t1->Draw(); | |
126 | TPaveText* t2=new TPaveText(0.49,0.35,0.79,0.42,"NDC"); | |
127 | t2->SetFillStyle(0); | |
128 | t2->SetBorderSize(0); | |
129 | t2->AddText(0.,0.,"L = 2.6 nb^{-1}"); | |
130 | t2->SetTextColor(kRed); | |
131 | //t1->SetTextSize(20); | |
132 | t2->SetTextFont(42); | |
133 | t2->Draw(); | |
134 | TPaveText* t3=new TPaveText(0.49,0.35,0.79,0.42,"NDC"); | |
135 | t3->SetFillStyle(0); | |
136 | t3->SetBorderSize(0); | |
137 | t3->AddText(0.,0.,"|#eta| < 0.8"); | |
138 | t3->SetTextColor(kRed); | |
139 | //t1->SetTextSize(20); | |
140 | t3->SetTextFont(42); | |
141 | t3->Draw(); | |
142 | ||
143 | ///////////////////////////// | |
144 | // Check number of events | |
145 | ///////////////////////////// | |
146 | ||
147 | ||
148 | Int_t numberOfEventsafterallcuts = (Int_t) datahfecontainer->GetNumberOfEvents(); | |
149 | ||
150 | printf("Number of events not corrected %d\n",numberOfEventsafterallcuts); | |
151 | printf("Number of events corrected %f\n",numberofentries); | |
152 | ||
153 | AliHFEcontainer *mchfecontainer = (AliHFEcontainer *) resultsmc->FindObject("trackContainer"); | |
154 | if(!mchfecontainer) { | |
155 | printf("No mc container \n"); | |
156 | return; | |
157 | } | |
158 | ||
159 | printf("Find the container V0\n"); | |
160 | AliHFEcontainer *containerhfeV0 = (AliHFEcontainer *) resultsdata->FindObject("containerV0"); | |
161 | if(!containerhfeV0) { | |
162 | printf("No hfe container \n"); | |
163 | return; | |
164 | } | |
165 | ||
166 | ////////////// | |
167 | // Correct | |
168 | ///////////// | |
169 | ||
170 | AliHFEspectrum *spectrum = new AliHFEspectrum("HFEspectrum"); | |
171 | spectrum->SetNbDimensions(2); | |
172 | // If you want to correct positive (0) or negative (1) separately | |
173 | //spectrum->SetChargeChoosen(0); | |
174 | spectrum->SetUnSetCorrelatedErrors(kTRUE); | |
175 | spectrum->SetDebugLevel(1); | |
176 | spectrum->SetNumberOfEvents((Int_t)numberofentries); | |
177 | spectrum->SetDumpToFile(kTRUE); | |
178 | // True step in MC (events in range +- 10 cm and no pile up) | |
179 | spectrum->SetMCTruthStep(AliHFEcuts::kStepMCGeneratedZOutNoPileUpCentralityFine); | |
180 | // Step where we correct from MC (tracking + TOF) | |
181 | spectrum->SetMCEffStep(AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kStepHFEcutsTRD + 1); | |
182 | // Step from data we correct for | |
183 | spectrum->SetStepToCorrect(AliHFEcuts::kStepHFEcutsTRD + 2); | |
184 | // Steps to be corrected with V0 (TPC PID only) | |
185 | spectrum->SetStepBeforeCutsV0(AliHFEcuts::kStepHFEcutsTRD + 1); | |
186 | spectrum->SetStepAfterCutsV0(AliHFEcuts::kStepHFEcutsTRD + 2); | |
187 | ||
188 | // Place for a correction as an efficiency parametrized as function of pt of pt,eta,phi or p=pt | |
189 | //TF1 *hEfficiency = new TF1("efficiency", "[0]", 0., 20.); | |
190 | //hEfficiency->SetParameter(0, 0.5); | |
191 | //spectrum->SetEfficiencyFunction(hEfficiency); | |
192 | ||
193 | // Give everything (data container, mc container and V0 data container) | |
194 | spectrum->Init(datahfecontainer,mchfecontainer,containerhfeV0); | |
195 | ||
196 | // kTRUE means subtract hadron background, kFALSE means do not subtract hadron background | |
197 | spectrum->Correct(kTRUE); | |
198 | ||
199 | ||
200 | } | |
201 | ||
202 | //_____________________________________________________________________ | |
203 | void CorrectForEfficiencyBeauty(const char *filedata,const char *fileMC, const char *fileMCbg) { | |
204 | ||
205 | /////////////////////////////////////////////////////////////////////////////////////////////////////// | |
206 | // Will produce finalSpectrum.root with results inside | |
207 | // TGraphErrors UnfoldingCorrectedSpectrum -> unfolding procedure (doesn't work in 2D with trunk) | |
208 | // TGraphErrors AlltogetherSpectrum -> corrected spectrum with other method | |
209 | // TH1D RatioUnfoldingAlltogetherSpectrum | |
210 | // THnSparseF UnfoldingCorrectedNotNormalizedSpectrum -> unfolding procedure not yet normalized | |
211 | // AliCFDataGrid AlltogetherCorrectedNotNormalizedSpectrum -> other method not yet normalized | |
212 | /////////////////////////////////////////////////////////////////////////////////////////////////////// | |
213 | ||
214 | gStyle->SetPalette(1); | |
215 | gStyle->SetOptStat(1111); | |
216 | gStyle->SetPadBorderMode(0); | |
217 | gStyle->SetCanvasColor(10); | |
218 | gStyle->SetPadLeftMargin(0.13); | |
219 | gStyle->SetPadRightMargin(0.13); | |
220 | ||
221 | ///////////////////// | |
222 | // Take the stuff | |
223 | ///////////////////// | |
224 | ||
225 | TList *resultsdata = GetResults(filedata,"_PID2"); | |
226 | //TList *resultsdata = GetResults(filedata); | |
227 | if(!resultsdata){ | |
228 | printf("No output objects for data: Calculation will terminate here\n"); | |
229 | return; | |
230 | } | |
231 | /////////////////////////////////////////////////////////// | |
232 | // Event container for the normalization to CINB1 | |
233 | // Take the number of events as function of z and number of contributors | |
234 | // For those without primary vertex from tracks, take the fraction in the z range from MC | |
235 | // For 10cm: LHC10f6a (88.0756%), LHC10f6 (86.7461%) | |
236 | //////////////////////////////////////////////////////////// | |
237 | ||
238 | AliCFContainer *containerdata = (AliCFContainer *) resultsdata->FindObject("eventContainer"); | |
239 | if(!containerdata) { | |
240 | printf("No container \n"); | |
241 | return; | |
242 | } | |
243 | AliCFDataGrid *dataGrid = (AliCFDataGrid *) GetSpectrum(containerdata,AliHFEcuts::kEventStepZRange); | |
244 | TH2D *spectrum_zrange = (TH2D *) dataGrid->Project(0,2); | |
245 | TH1D *spectrum1Da = (TH1D *) spectrum_zrange->ProjectionX("bin0",1,1); | |
246 | TH1D *spectrum1Db = (TH1D *) spectrum_zrange->ProjectionX("bin>0",2,12); | |
247 | TH1D *spectrum1Dc = (TH1D *) spectrum_zrange->ProjectionX("total"); | |
248 | Double_t nbinbin0 = spectrum1Da->Integral(); | |
249 | Double_t nbinnobin0 = spectrum1Db->Integral(); | |
250 | Double_t nbintotal = spectrum1Dc->Integral(); | |
251 | ||
252 | Float_t numberofentries = nbinnobin0+nbinbin0*0.880756; | |
253 | printf("Number in bin0 %f, number out %f, total %f, normalized %f\n",nbinbin0,nbinnobin0,nbintotal,numberofentries); | |
254 | ||
255 | ||
256 | AliHFEcontainer *datahfecontainer = (AliHFEcontainer *) resultsdata->FindObject("trackContainer"); | |
257 | if(!datahfecontainer) { | |
258 | printf("No container for data \n"); | |
259 | return; | |
260 | } | |
261 | ||
262 | ||
263 | ////////////////////////////// | |
264 | // Check MC # of events | |
265 | /////////////////////////////// | |
266 | ||
267 | TList *resultsmc = GetResults(fileMC,"_PID2"); | |
268 | if(!resultsmc){ | |
269 | printf("No output objects for mc: Calculation will terminate here\n"); | |
270 | return; | |
271 | } | |
272 | ||
273 | AliCFContainer *containermc = (AliCFContainer *) resultsmc->FindObject("eventContainer"); | |
274 | if(!containermc) { | |
275 | printf("No container \n"); | |
276 | return; | |
277 | } | |
278 | AliCFDataGrid *mcGrid = (AliCFDataGrid *) GetSpectrum(containermc,AliHFEcuts::kEventStepZRange); | |
279 | TH2D *spectrum_zrangemc = (TH2D *) mcGrid->Project(0,2); | |
280 | TH1D *spectrum1Damc = (TH1D *) spectrum_zrangemc->ProjectionX("bin0",1,1); | |
281 | TH1D *spectrum1Dbmc = (TH1D *) spectrum_zrangemc->ProjectionX("bin>0",2,12); | |
282 | TH1D *spectrum1Dcmc = (TH1D *) spectrum_zrangemc->ProjectionX("total"); | |
283 | Double_t nbinbin0mc = spectrum1Damc->Integral(); | |
284 | Double_t nbinnobin0mc = spectrum1Dbmc->Integral(); | |
285 | Double_t nbintotalmc = spectrum1Dcmc->Integral(); | |
286 | ||
287 | Float_t numberofentriesmc = nbinnobin0mc+nbinbin0mc*0.880756; | |
288 | printf("MC: Number in bin0 %f, number out %f, total %f, normalized %f\n",nbinbin0mc,nbinnobin0mc,nbintotalmc,numberofentriesmc); | |
289 | ||
290 | ||
291 | ||
292 | ///////////////////////////// | |
293 | // Check number of events | |
294 | ///////////////////////////// | |
295 | ||
296 | Int_t numberOfEventsafterallcuts = (Int_t) datahfecontainer->GetNumberOfEvents(); | |
297 | ||
298 | printf("Number of events not corrected %d\n",numberOfEventsafterallcuts); | |
299 | printf("Number of events corrected %f\n",numberofentries); | |
300 | ||
301 | AliHFEcontainer *mchfecontainer = (AliHFEcontainer *) resultsmc->FindObject("trackContainer"); | |
302 | if(!mchfecontainer) { | |
303 | printf("No mc container \n"); | |
304 | return; | |
305 | } | |
306 | ||
307 | printf("Find the container V0\n"); | |
308 | AliHFEcontainer *containerhfeV0 = (AliHFEcontainer *) resultsdata->FindObject("containerV0"); | |
309 | if(!containerhfeV0) { | |
310 | printf("No hfe container \n"); | |
311 | return; | |
312 | } | |
313 | ||
314 | // nonHFE backgrounds | |
315 | TList *resultsmcbg = GetResults(fileMCbg,"_PID2"); | |
316 | if(!resultsmcbg){ | |
317 | printf("No output objects for mc: Calculation will terminate here\n"); return; | |
318 | } | |
319 | AliHFEcontainer *mcbghfecontainer = (AliHFEcontainer *) resultsmcbg->FindObject("trackContainer"); | |
320 | if(!mcbghfecontainer) { | |
321 | printf("No mc container \n"); | |
322 | return; | |
323 | } | |
324 | ||
325 | AliCFContainer *containermcbg = (AliCFContainer *) resultsmcbg->FindObject("eventContainer"); | |
326 | if(!containermcbg) { | |
327 | printf("No container \n"); | |
328 | return; | |
329 | } | |
330 | ||
331 | AliCFDataGrid *mcbgGrid = (AliCFDataGrid *) GetSpectrum(containermcbg,AliHFEcuts::kEventStepZRange); | |
332 | TH2D *spectrum_zrangemcbg = (TH2D *) mcbgGrid->Project(0,2); | |
333 | TH1D *spectrum1Damcbg = (TH1D *) spectrum_zrangemcbg->ProjectionX("bin0",1,1); | |
334 | TH1D *spectrum1Dbmcbg = (TH1D *) spectrum_zrangemcbg->ProjectionX("bin>0",2,12); | |
335 | TH1D *spectrum1Dcmcbg = (TH1D *) spectrum_zrangemcbg->ProjectionX("total"); | |
336 | Double_t nbinbin0mcbg = spectrum1Damcbg->Integral(); | |
337 | Double_t nbinnobin0mcbg = spectrum1Dbmcbg->Integral(); | |
338 | Double_t nbintotalmcbg = spectrum1Dcmcbg->Integral(); | |
339 | ||
340 | Float_t numberofentriesmcbg = nbinnobin0mcbg+nbinbin0mcbg*0.880756; | |
341 | printf("MCbg: Number in bin0 %f, number out %f, total %f, normalized %f\n",nbinbin0mcbg,nbinnobin0mcbg,nbintotalmcbg,numberofentriesmcbg); | |
342 | ||
343 | ||
344 | // hadron contamination after IP cuts | |
345 | TList *hfeqa = GetQA(fileMC,"_PID2"); | |
346 | THnSparseF* hsHadronEffbyIPcut = (THnSparseF* )GetHadronEffbyIPcut(hfeqa); | |
347 | ||
348 | ////////////// | |
349 | // Correct | |
350 | ///////////// | |
351 | ||
352 | AliHFEspectrum *spectrum = new AliHFEspectrum("HFEspectrum"); | |
353 | ||
354 | spectrum->SetBeautyAnalysis(); | |
355 | // Enable background subtraction | |
356 | spectrum->EnableIPanaHadronBgSubtract(); | |
357 | spectrum->EnableIPanaCharmBgSubtract(); | |
358 | spectrum->EnableIPanaConversionBgSubtract(); | |
359 | spectrum->EnableIPanaNonHFEBgSubtract(); | |
360 | //spectrum->SetNonHFEBackground2ndMethod(); | |
361 | ||
362 | spectrum->SetNbDimensions(1); | |
363 | // If you want to correct positive (0) or negative (1) separately | |
364 | //spectrum->SetChargeChoosen(0); | |
365 | spectrum->SetDebugLevel(1); | |
366 | spectrum->SetNumberOfEvents((Int_t)numberofentries); | |
367 | spectrum->SetNumberOfMCEvents((Int_t)numberofentriesmc); | |
368 | spectrum->SetNumberOfMC2Events((Int_t)numberofentriesmcbg); | |
369 | spectrum->SetDumpToFile(kTRUE); | |
370 | // True step in MC (events in range +- 10 cm and no pile up) | |
371 | spectrum->SetMCTruthStep(AliHFEcuts::kStepMCGeneratedZOutNoPileUpCentralityFine); | |
372 | // Step where we correct from MC (tracking + TOF) | |
373 | spectrum->SetMCEffStep(AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kStepHFEcutsTRD + 1); | |
374 | // Step from data we correct for | |
375 | spectrum->SetStepToCorrect(AliHFEcuts::kStepHFEcutsTRD + 3); // +3 = tracking + TOF + TPC + IPcut | |
376 | // Steps to be corrected with V0 (TPC PID only) | |
377 | spectrum->SetStepBeforeCutsV0(AliHFEcuts::kStepHFEcutsTRD + 1); | |
378 | spectrum->SetStepAfterCutsV0(AliHFEcuts::kStepHFEcutsTRD + 2); | |
379 | ||
380 | spectrum->SetHadronEffbyIPcut(hsHadronEffbyIPcut); | |
381 | // Give everything (data container, mc container and V0 data container) | |
382 | spectrum->Init(datahfecontainer,mchfecontainer,containerhfeV0,mcbghfecontainer); | |
383 | ||
384 | // kTRUE means subtract hadron background, kFALSE means do not subtract hadron background | |
385 | spectrum->CorrectBeauty(kTRUE); | |
386 | ||
387 | } | |
388 | ||
389 | //_____________________________________________________________________ | |
390 | TList *GetResults(const Char_t *testfile,const Char_t *plus){ | |
391 | // | |
392 | // read output | |
393 | // | |
394 | TFile *f = TFile::Open(testfile); | |
395 | if(!f || f->IsZombie()){ | |
396 | printf("File not readable\n"); | |
397 | return 0x0; | |
398 | } | |
399 | TString name("HFE_Results"); | |
400 | name += plus; | |
401 | printf("Name of TList %s\n",(const char*)name); | |
402 | TList *l = dynamic_cast<TList *>(f->Get((const char*)name)); | |
403 | if(!l){ | |
404 | printf("Results list was not found\n"); | |
405 | f->Close(); delete f; | |
406 | return 0x0; | |
407 | } | |
408 | TList *returnlist = dynamic_cast<TList *>(l->Clone()); | |
409 | f->Close(); delete f; | |
410 | return returnlist; | |
411 | } | |
412 | ||
413 | //_____________________________________________________________________ | |
414 | TList *GetQA(const Char_t *testfile,const Char_t *plus){ | |
415 | // | |
416 | // read output | |
417 | // | |
418 | TFile *f = TFile::Open(testfile); | |
419 | if(!f || f->IsZombie()){ | |
420 | printf("File not readable\n"); | |
421 | return 0x0; | |
422 | } | |
423 | TString name("HFE_QA"); | |
424 | name += plus; | |
425 | printf("Name of TList %s\n",(const char*)name); | |
426 | TList *l = dynamic_cast<TList *>(f->Get((const char*)name)); | |
427 | if(!l){ | |
428 | printf("QA list was not found\n"); | |
429 | f->Close(); delete f; | |
430 | return 0x0; | |
431 | } | |
432 | TList *returnlist = dynamic_cast<TList *>(l->Clone()); | |
433 | f->Close(); delete f; | |
434 | return returnlist; | |
435 | } | |
436 | ||
437 | //_____________________________________________________________________ | |
438 | THnSparseF* GetHadronEffbyIPcut(TList *hfeqa){ | |
439 | ||
440 | ||
441 | // get hadron reduction factors due to the IP cuts | |
442 | TList* tl=(TList*)hfeqa->FindObject("list_TaskQA"); | |
443 | TH1F* hbefore=(TH1F*)tl->FindObject("hadronsBeforeIPcut"); | |
444 | TH1F* hafter=(TH1F*)tl->FindObject("hadronsAfterIPcut"); | |
445 | TH1F* hreduction= (TH1F*)hafter->Clone("hreduction"); | |
446 | hbefore->Sumw2(); | |
447 | hafter->Sumw2(); | |
448 | hreduction->Sumw2(); | |
449 | hreduction->Divide(hbefore); | |
450 | ||
451 | Double_t* binEdges[0]; | |
452 | Int_t hnBin = hreduction->GetNbinsX(); | |
453 | Int_t nBin[1] = {hnBin}; | |
454 | ||
455 | for(int i=0; i<nBin[0]; i++){ | |
456 | binEdges[0][i] = hreduction->GetBinLowEdge(i+1); | |
457 | } | |
458 | binEdges[0][nBin[0]] = hreduction->GetBinLowEdge(nBin[0]) + hreduction->GetBinWidth(nBin[0]); | |
459 | ||
460 | THnSparseF* hsreduction = new THnSparseF("hadroncontamin", "hadroncontamin; pt[GeV/c]", 1, nBin); | |
461 | hsreduction->SetBinEdges(0, binEdges[0]); | |
462 | ||
463 | Double_t dataE[1]; | |
464 | Double_t yval; | |
465 | for(int i=0; i<nBin[0]; i++){ | |
466 | dataE[0]=hreduction->GetBinCenter(i+1); | |
467 | yval=hreduction->GetBinContent(i+1); | |
468 | hsreduction->Fill(dataE,yval); | |
469 | } | |
470 | ||
471 | Int_t* ibins; | |
472 | ibins = new Int_t[nBin[0] + 1]; | |
473 | hsreduction->SetBinError(ibins,0); | |
474 | ||
475 | ||
476 | return hsreduction; | |
477 | } | |
478 | ||
479 | //_________________________________________________________________________ | |
480 | TObject* GetSpectrum(AliCFContainer *c, Int_t step) { | |
481 | AliCFDataGrid* data = new AliCFDataGrid("data","",*c,step); | |
482 | //data->SetMeasured(step); | |
483 | return data; | |
484 | } | |
485 | //___________________________________________________________________________ | |
486 | void CorrectFromTheWidth(TH1D *h1) { | |
487 | // | |
488 | // Correct from the width of the bins --> dN/dp_{T} (GeV/c)^{-1} | |
489 | // | |
490 | ||
491 | TAxis *axis = h1->GetXaxis(); | |
492 | Int_t nbinX = h1->GetNbinsX(); | |
493 | ||
494 | for(Int_t i = 1; i <= nbinX; i++) { | |
495 | ||
496 | Double_t width = axis->GetBinWidth(i); | |
497 | Double_t content = h1->GetBinContent(i); | |
498 | Double_t error = h1->GetBinError(i); | |
499 | h1->SetBinContent(i,content/width); | |
500 | h1->SetBinError(i,error/width); | |
501 | } | |
502 | ||
503 | } |