]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdEta/dNdEtaAnalysis.cxx
Calling the V0 and cascade finders from AliReconstruction, and the possibility to...
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / dNdEtaAnalysis.cxx
CommitLineData
dc740de4 1/* $Id$ */
2
75ec0f41 3#include "dNdEtaAnalysis.h"
4
ceb5d1b5 5#include <TFile.h>
45e97e28 6#include <TH3F.h>
74fd10b3 7#include <TH2F.h>
8#include <TH1F.h>
ceb5d1b5 9#include <TMath.h>
10#include <TCanvas.h>
7029240a 11#include <TCollection.h>
12#include <TIterator.h>
13#include <TList.h>
fcf2fb36 14#include <TLegend.h>
74fd10b3 15#include <TLine.h>
fcf2fb36 16
45e97e28 17#include "AlidNdEtaCorrection.h"
74fd10b3 18#include <AliCorrection.h>
19#include <AliPWG0Helper.h>
20#include <AliCorrectionMatrix2D.h>
21#include <AliCorrectionMatrix3D.h>
ceb5d1b5 22
75ec0f41 23//____________________________________________________________________
b7f4a1fd 24ClassImp(dNdEtaAnalysis)
75ec0f41 25
1afae8ff 26//____________________________________________________________________
27dNdEtaAnalysis::dNdEtaAnalysis() :
28 TNamed(),
29 fData(0),
1afae8ff 30 fPtDist(0)
31{
32 // default constructor
33
34 for (Int_t i=0; i<kVertexBinning; ++i)
35 {
36 fdNdEta[i] = 0;
37 fdNdEtaPtCutOffCorrected[i] = 0;
38 }
39}
40
75ec0f41 41//____________________________________________________________________
7029240a 42dNdEtaAnalysis::dNdEtaAnalysis(Char_t* name, Char_t* title) :
16e24ca3 43 TNamed(name, title),
45e97e28 44 fData(0),
1afae8ff 45 fPtDist(0)
7029240a 46{
6bf0714d 47 // constructor
4dd2ad81 48
74fd10b3 49 Float_t binLimitsPt[] = {0.0, 0.05, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5, 2.0, 5.0, 10.0, 100.0};
6bf0714d 50
74fd10b3 51 fData = new AliCorrection("Analysis", Form("%s Analysis", title));
45e97e28 52
74fd10b3 53 // do not add this hists to the directory
54 Bool_t oldStatus = TH1::AddDirectoryStatus();
55 TH1::AddDirectory(kFALSE);
1afae8ff 56
74fd10b3 57 fdNdEta[0] = new TH1F("dNdEta", "dN_{ch}/d#eta;#eta;dN_{ch}/d#eta", 20, -2, 2);
58
59 fdNdEtaPtCutOffCorrected[0] = dynamic_cast<TH1F*> (fdNdEta[0]->Clone(Form("%s_corrected", fdNdEta[0]->GetName())));
1afae8ff 60
45e97e28 61 for (Int_t i=1; i<kVertexBinning; ++i)
7029240a 62 {
74fd10b3 63 fdNdEta[i] = dynamic_cast<TH1F*> (fdNdEta[0]->Clone(Form("%s_%d", fdNdEta[0]->GetName(), i)));
64 fdNdEtaPtCutOffCorrected[i] = dynamic_cast<TH1F*> (fdNdEtaPtCutOffCorrected[0]->Clone(Form("%s_%d", fdNdEtaPtCutOffCorrected[0]->GetName(), i)));
7029240a 65 }
75ec0f41 66
74fd10b3 67 fPtDist = new TH1F("Pt", "p_{T} distribution;p_{T} [GeV/c];#frac{dN}{d#eta dp_{T}} [c/GeV]", 28, binLimitsPt);
68
69 TH1::AddDirectory(oldStatus);
75ec0f41 70}
71
16e24ca3 72//____________________________________________________________________
73dNdEtaAnalysis::~dNdEtaAnalysis()
74{
75 // destructor
76
0ab29cfa 77 if (fData)
78 {
79 delete fData;
80 fData = 0;
81 }
16e24ca3 82
16e24ca3 83 for (Int_t i=0; i<kVertexBinning; ++i)
84 {
0ab29cfa 85 if (fdNdEta[i])
86 {
87 delete fdNdEta[i];
88 fdNdEta[i] = 0;
89 }
90 if (fdNdEtaPtCutOffCorrected[i])
91 {
92 delete fdNdEtaPtCutOffCorrected[i];
93 fdNdEtaPtCutOffCorrected[i] = 0;
94 }
16e24ca3 95 }
1afae8ff 96
0ab29cfa 97 if (fPtDist)
98 {
99 delete fPtDist;
100 fPtDist = 0;
101 }
16e24ca3 102}
103
104//_____________________________________________________________________________
105dNdEtaAnalysis::dNdEtaAnalysis(const dNdEtaAnalysis &c) :
106 TNamed(c),
45e97e28 107 fData(0),
1afae8ff 108 fPtDist(0)
16e24ca3 109{
110 //
111 // dNdEtaAnalysis copy constructor
112 //
113
114 ((dNdEtaAnalysis &) c).Copy(*this);
115}
116
117//_____________________________________________________________________________
118dNdEtaAnalysis &dNdEtaAnalysis::operator=(const dNdEtaAnalysis &c)
119{
120 //
121 // Assignment operator
122 //
123
124 if (this != &c) ((dNdEtaAnalysis &) c).Copy(*this);
125 return *this;
126}
127
128//_____________________________________________________________________________
129void dNdEtaAnalysis::Copy(TObject &c) const
130{
131 //
132 // Copy function
133 //
134
135 dNdEtaAnalysis& target = (dNdEtaAnalysis &) c;
136
74fd10b3 137 target.fData = dynamic_cast<AliCorrection*> (fData->Clone());
16e24ca3 138
139 for (Int_t i=0; i<kVertexBinning; ++i)
1afae8ff 140 {
74fd10b3 141 target.fdNdEta[i] = dynamic_cast<TH1F*> (fdNdEta[i]->Clone());
142 target.fdNdEtaPtCutOffCorrected[i] = dynamic_cast<TH1F*> (fdNdEtaPtCutOffCorrected[i]->Clone());
1afae8ff 143 }
16e24ca3 144
74fd10b3 145 target.fPtDist = dynamic_cast<TH1F*> (fPtDist->Clone());
45e97e28 146
16e24ca3 147 TNamed::Copy((TNamed &) c);
148}
149
75ec0f41 150//____________________________________________________________________
74fd10b3 151void dNdEtaAnalysis::FillTrack(Float_t vtx, Float_t eta, Float_t pt)
6bf0714d 152{
153 // fills a track into the histograms
154
74fd10b3 155 fData->GetTrackCorrection()->FillMeas(vtx, eta, pt);
75ec0f41 156}
157
158//____________________________________________________________________
74fd10b3 159void dNdEtaAnalysis::FillEvent(Float_t vtx, Float_t n)
6bf0714d 160{
161 // fills an event into the histograms
162
74fd10b3 163 fData->GetEventCorrection()->FillMeas(vtx, n);
75ec0f41 164}
165
166//____________________________________________________________________
74fd10b3 167void dNdEtaAnalysis::Finish(AlidNdEtaCorrection* correction, Float_t ptCut, AlidNdEtaCorrection::CorrectionType correctionType)
fcf2fb36 168{
74fd10b3 169 //
170 // correct with the given correction values and calculate dNdEta and pT distribution
171 // the corrections that are applied can be steered by the flag correctionType
172 //
173
174 // TODO put tag somewhere which corrections have been applied
175
176 // set corrections to 1
177 fData->SetCorrectionToUnity();
178
179 if (correction && correctionType != AlidNdEtaCorrection::kNone)
180 {
181 TH3F* trackCorr = fData->GetTrackCorrection()->GetCorrectionHistogram();
182 TH2F* eventCorr = fData->GetEventCorrection()->GetCorrectionHistogram();
183
184 if (correctionType >= AlidNdEtaCorrection::kTrack2Particle)
185 trackCorr->Multiply(correction->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetCorrectionHistogram());
6bf0714d 186
74fd10b3 187 if (correctionType >= AlidNdEtaCorrection::kVertexReco)
188 {
189 trackCorr->Multiply(correction->GetVertexRecoCorrection()->GetTrackCorrection()->GetCorrectionHistogram());
190 eventCorr->Multiply(correction->GetVertexRecoCorrection()->GetEventCorrection()->GetCorrectionHistogram());
191 }
192
193 switch (correctionType)
194 {
195 case AlidNdEtaCorrection::kINEL :
196 {
197 trackCorr->Multiply(correction->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetCorrectionHistogram());
198 eventCorr->Multiply(correction->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetCorrectionHistogram());
199 break;
200 }
201 case AlidNdEtaCorrection::kNSD :
202 {
203 trackCorr->Multiply(correction->GetTriggerBiasCorrectionNSD()->GetTrackCorrection()->GetCorrectionHistogram());
204 eventCorr->Multiply(correction->GetTriggerBiasCorrectionNSD()->GetEventCorrection()->GetCorrectionHistogram());
205 break;
206 }
207 case AlidNdEtaCorrection::kND :
208 {
209 trackCorr->Multiply(correction->GetTriggerBiasCorrectionND()->GetTrackCorrection()->GetCorrectionHistogram());
210 eventCorr->Multiply(correction->GetTriggerBiasCorrectionND()->GetEventCorrection()->GetCorrectionHistogram());
211 break;
212 }
213 default : break;
214 }
215 }
216 else
fcf2fb36 217 printf("INFO: No correction applied\n");
218
74fd10b3 219 fData->Multiply();
220
221 TH3F* dataHist = fData->GetTrackCorrection()->GetGeneratedHistogram();
222
223 // integrate multiplicity axis out (include under/overflow bins!!!)
224 TH2F* tmp = fData->GetEventCorrection()->GetGeneratedHistogram();
225 TH1D* vertexHist = tmp->ProjectionX("_px", 0, tmp->GetNbinsY() + 1, "e");
fcf2fb36 226
1afae8ff 227 // create pt hist
228 {
229 // reset all ranges
74fd10b3 230 dataHist->GetXaxis()->SetRange(0, 0);
231 dataHist->GetYaxis()->SetRange(0, 0);
232 dataHist->GetZaxis()->SetRange(0, 0);
1afae8ff 233
234 // vtx cut
74fd10b3 235 Int_t vertexBinBegin = dataHist->GetXaxis()->FindBin(-5);
236 Int_t vertexBinEnd = dataHist->GetXaxis()->FindBin(5);
237 dataHist->GetXaxis()->SetRange(vertexBinBegin, vertexBinEnd);
238 Float_t nEvents = vertexHist->Integral(vertexBinBegin, vertexBinEnd);
1afae8ff 239
74fd10b3 240 if (nEvents > 0)
241 {
242 // eta cut
243 dataHist->GetYaxis()->SetRange(dataHist->GetYaxis()->FindBin(-0.8), dataHist->GetYaxis()->FindBin(0.8));
244 Float_t etaWidth = 1.6;
1afae8ff 245
74fd10b3 246 TH1D* ptHist = dynamic_cast<TH1D*> (dataHist->Project3D("ze"));
1afae8ff 247
74fd10b3 248 for (Int_t i=1; i<=fPtDist->GetNbinsX(); ++i)
249 {
250 Float_t binSize = fPtDist->GetBinWidth(i);
251 fPtDist->SetBinContent(i, ptHist->GetBinContent(i) / binSize / nEvents / etaWidth);
252 fPtDist->SetBinError(i, ptHist->GetBinError(i) / binSize / nEvents / etaWidth);
253 }
1afae8ff 254
74fd10b3 255 delete ptHist;
256 }
257 else
258 printf("ERROR: nEvents is 0!\n");
1afae8ff 259 }
260
261 // reset all ranges
74fd10b3 262 dataHist->GetXaxis()->SetRange(0, 0);
263 dataHist->GetYaxis()->SetRange(0, 0);
264 dataHist->GetZaxis()->SetRange(0, 0);
1afae8ff 265
847489f7 266 // integrate over pt (with pt cut)
1afae8ff 267 Int_t ptLowBin = 1;
268 if (ptCut > 0)
74fd10b3 269 ptLowBin = dataHist->GetZaxis()->FindBin(ptCut);
1afae8ff 270
74fd10b3 271 dataHist->GetZaxis()->SetRange(ptLowBin, dataHist->GetZaxis()->GetNbins());
272 printf("range %d %d\n", ptLowBin, dataHist->GetZaxis()->GetNbins());
273 TH2D* vtxVsEta = dynamic_cast<TH2D*> (dataHist->Project3D("yx2e"));
274
275 dataHist->GetZaxis()->SetRange(0, 0);
276 vtxVsEta->GetXaxis()->SetTitle(dataHist->GetXaxis()->GetTitle());
277 vtxVsEta->GetYaxis()->SetTitle(dataHist->GetYaxis()->GetTitle());
1afae8ff 278
847489f7 279 if (vtxVsEta == 0)
280 {
281 printf("ERROR: pt integration failed\n");
282 return;
fcf2fb36 283 }
284
74fd10b3 285 for (Int_t iEta=1; iEta<=vtxVsEta->GetNbinsY(); iEta++)
5af55649 286 {
7029240a 287 // do we have several histograms for different vertex positions?
74fd10b3 288 Int_t vertexBinWidth = vertexHist->GetNbinsX() / (kVertexBinning-1);
7029240a 289 for (Int_t vertexPos=0; vertexPos<kVertexBinning; ++vertexPos)
290 {
5af55649 291 Int_t vertexBinBegin = 1;
74fd10b3 292 Int_t vertexBinEnd = vertexHist->GetNbinsX() + 1;
fcf2fb36 293
294 // the first histogram is always for the whole vertex range
295 if (vertexPos > 0)
296 {
5af55649 297 vertexBinBegin = 1 + vertexBinWidth * (vertexPos-1);
fcf2fb36 298 vertexBinEnd = vertexBinBegin + vertexBinWidth;
299 }
7029240a 300
74fd10b3 301 Float_t totalEvents = vertexHist->Integral(vertexBinBegin, vertexBinEnd - 1);
5af55649 302 if (totalEvents == 0)
303 {
304 printf("WARNING: No events for hist %d %d %d\n", vertexPos, vertexBinBegin, vertexBinEnd);
305 continue;
7029240a 306 }
7029240a 307
5af55649 308 Float_t sum = 0;
309 Float_t sumError2 = 0;
310 for (Int_t iVtx = vertexBinBegin; iVtx < vertexBinEnd; iVtx++)
311 {
847489f7 312 if (vtxVsEta->GetBinContent(iVtx, iEta) != 0)
5af55649 313 {
847489f7 314 sum = sum + vtxVsEta->GetBinContent(iVtx, iEta);
315 sumError2 = sumError2 + TMath::Power(vtxVsEta->GetBinError(iVtx, iEta),2);
5af55649 316 }
317 }
7029240a 318
1afae8ff 319 Float_t ptCutOffCorrection = 1;
74fd10b3 320 if (correction && ptCut > 0)
321 ptCutOffCorrection = correction->GetMeasuredFraction(correctionType, ptCut, vtxVsEta->GetYaxis()->GetBinCenter(iEta));
1afae8ff 322
847489f7 323 if (ptCutOffCorrection <= 0)
324 {
325 printf("UNEXPECTED: ptCutOffCorrection is %f for hist %d %d %d\n", ptCutOffCorrection, vertexPos, vertexBinBegin, vertexBinEnd);
326 continue;
327 }
328
74fd10b3 329 printf("Eta: %d Vertex Range: %d %d, Event Count %f, Track Sum: %f, Track Sum corrected: %f\n", iEta, vertexBinBegin, vertexBinEnd, totalEvents, sum, sum / ptCutOffCorrection);
330
1afae8ff 331 Float_t dndeta = sum / totalEvents;
332 Float_t error = TMath::Sqrt(sumError2) / totalEvents;
7029240a 333
6bf0714d 334 dndeta = dndeta/fdNdEta[vertexPos]->GetBinWidth(iEta);
335 error = error/fdNdEta[vertexPos]->GetBinWidth(iEta);
7029240a 336
6bf0714d 337 fdNdEta[vertexPos]->SetBinContent(iEta, dndeta);
338 fdNdEta[vertexPos]->SetBinError(iEta, error);
1afae8ff 339
340 dndeta /= ptCutOffCorrection;
341 error /= ptCutOffCorrection;
342
343 fdNdEtaPtCutOffCorrected[vertexPos]->SetBinContent(iEta, dndeta);
344 fdNdEtaPtCutOffCorrected[vertexPos]->SetBinError(iEta, error);
75ec0f41 345 }
847489f7 346 }
75ec0f41 347}
348
75ec0f41 349//____________________________________________________________________
6bf0714d 350void dNdEtaAnalysis::SaveHistograms()
351{
352 // save the histograms to a directory with the name of this class (retrieved from TNamed)
75ec0f41 353
7029240a 354 gDirectory->mkdir(GetName());
355 gDirectory->cd(GetName());
5fbd0b17 356
1afae8ff 357 if (fData)
358 {
74fd10b3 359 fData->SaveHistograms();
1afae8ff 360 }
361 else
362 printf("dNdEtaAnalysis::SaveHistograms: UNEXPECTED: fData is 0\n");
363
d09fb536 364 if (fPtDist)
365 fPtDist ->Write();
366 else
367 printf("dNdEtaAnalysis::SaveHistograms: UNEXPECTED: fPtDist is 0\n");
368
7029240a 369 for (Int_t i=0; i<kVertexBinning; ++i)
1afae8ff 370 {
371 if (fdNdEta[i])
372 fdNdEta[i]->Write();
373 else
374 printf("dNdEtaAnalysis::SaveHistograms: UNEXPECTED: fdNdEta[%d] is 0\n", i);
375
376 if (fdNdEtaPtCutOffCorrected[i])
377 fdNdEtaPtCutOffCorrected[i]->Write();
378 else
379 printf("dNdEtaAnalysis::SaveHistograms: UNEXPECTED: fdNdEtaPtCutOffCorrected[%d] is 0\n", i);
380 }
75ec0f41 381
382 gDirectory->cd("../");
383}
384
74fd10b3 385void dNdEtaAnalysis::LoadHistograms(const Char_t* dir)
5fbd0b17 386{
6bf0714d 387 // loads the histograms from a directory with the name of this class (retrieved from TNamed)
388
74fd10b3 389 if (!dir)
390 dir = GetName();
5fbd0b17 391
74fd10b3 392 gDirectory->cd(dir);
5fbd0b17 393
74fd10b3 394 fData->LoadHistograms();
5fbd0b17 395
396 for (Int_t i=0; i<kVertexBinning; ++i)
1afae8ff 397 {
74fd10b3 398 fdNdEta[i] = dynamic_cast<TH1F*> (gDirectory->Get(fdNdEta[i]->GetName()));
399 fdNdEtaPtCutOffCorrected[i] = dynamic_cast<TH1F*> (gDirectory->Get(fdNdEtaPtCutOffCorrected[i]->GetName()));
1afae8ff 400 }
5fbd0b17 401
74fd10b3 402 fPtDist = dynamic_cast<TH1F*> (gDirectory->Get(fPtDist->GetName()));
0ab29cfa 403
5fbd0b17 404 gDirectory->cd("../");
405}
406
ceb5d1b5 407//____________________________________________________________________
74fd10b3 408void dNdEtaAnalysis::DrawHistograms(Bool_t simple)
ceb5d1b5 409{
6bf0714d 410 // draws the histograms
74fd10b3 411
412 if (!simple)
413 {
414 if (fData)
415 fData->DrawHistograms(GetName());
6bf0714d 416
74fd10b3 417 TCanvas* canvas = new TCanvas(Form("%s_dNdEtaAnalysis", GetName()), Form("%s_dNdEtaAnalysis", GetName()), 800, 400);
418 canvas->Divide(2, 1);
ceb5d1b5 419
74fd10b3 420 canvas->cd(1);
421 if (fdNdEtaPtCutOffCorrected[0])
422 fdNdEtaPtCutOffCorrected[0]->Draw();
ceb5d1b5 423
74fd10b3 424 if (fdNdEta[0])
425 {
426 fdNdEta[0]->SetLineColor(kRed);
427 fdNdEta[0]->Draw("SAME");
428 }
1afae8ff 429
74fd10b3 430 canvas->cd(2);
431 if (fPtDist)
432 fPtDist->Draw();
1afae8ff 433 }
434
fcf2fb36 435 // histograms for different vertices?
436 if (kVertexBinning > 0)
437 {
438 // doesnt work, but i dont get it, giving up...
74fd10b3 439 TCanvas* canvas2 = new TCanvas(Form("%s_dNdEtaAnalysisVtx", GetName()), Form("%s_dNdEtaAnalysisVtx", GetName()), 450, 450);
440 TCanvas* canvas3 = 0;
441 if (!simple)
442 canvas3 = new TCanvas(Form("%s_dNdEtaAnalysisVtx_noptcutoff", GetName()), Form("%s_dNdEtaAnalysisVtx_noptcutoff", GetName()), 450, 450);
443
fcf2fb36 444 //Int_t yPads = (Int_t) TMath::Ceil(((Double_t) kVertexBinning - 1) / 2);
445 //printf("%d\n", yPads);
446 //canvas2->Divide(2, yPads);
447
74fd10b3 448 TLegend* legend = new TLegend(0.4, 0.7, 0.6, 0.9);
fcf2fb36 449
5af55649 450 for (Int_t i=0; i<kVertexBinning; ++i)
fcf2fb36 451 {
1afae8ff 452 if (fdNdEtaPtCutOffCorrected[i])
fcf2fb36 453 {
74fd10b3 454 canvas2->cd();
455
1afae8ff 456 fdNdEtaPtCutOffCorrected[i]->SetLineColor(i+1);
457 fdNdEtaPtCutOffCorrected[i]->Draw((i == 0) ? "" : "SAME");
458 legend->AddEntry(fdNdEtaPtCutOffCorrected[i], (i == 0) ? "Vtx All" : Form("Vtx Bin %d", i-1));
fcf2fb36 459 }
74fd10b3 460 if (canvas3 && fdNdEta[i])
461 {
462 canvas3->cd();
463
464 fdNdEta[i]->SetLineColor(i+1);
465 fdNdEta[i]->Draw((i == 0) ? "" : "SAME");
466 }
fcf2fb36 467 }
468
74fd10b3 469 canvas2->cd();
fcf2fb36 470 legend->Draw();
74fd10b3 471 canvas2->SaveAs(Form("%s_%s.gif", canvas2->GetName(), GetName()));
472
473 if (canvas3)
474 {
475 canvas3->cd();
476 legend->Draw();
477 }
fcf2fb36 478 }
74fd10b3 479
480 if (kVertexBinning == 3)
481 {
482 TH1* clone = dynamic_cast<TH1*> (fdNdEtaPtCutOffCorrected[1]->Clone("clone"));
483 TH1* clone2 = dynamic_cast<TH1*> (fdNdEtaPtCutOffCorrected[2]->Clone("clone2"));
484
485 if (clone && clone2)
486 {
487 TCanvas* canvas4 = new TCanvas(Form("%s_dNdEtaAnalysisVtxRatios", GetName()), Form("%s_dNdEtaAnalysisVtxRatios", GetName()), 450, 450);
488
489 clone->Divide(fdNdEtaPtCutOffCorrected[0]);
490 clone->GetYaxis()->SetRangeUser(0.95, 1.05);
491 clone->Draw();
492
493 clone2->Divide(fdNdEtaPtCutOffCorrected[0]);
494 clone2->Draw("SAME");
495
496 TLine* line = new TLine(-1, 1, 1, 1);
497 line->Draw();
498
499 canvas4->SaveAs(Form("%s_%s.gif", canvas4->GetName(), GetName()));
500 }
501 }
7029240a 502}
503
504Long64_t dNdEtaAnalysis::Merge(TCollection* list)
505{
506 // Merges a list of dNdEtaAnalysis objects with this one.
507 // This is needed for PROOF.
508 // Returns the number of merged objects (including this)
509
510 if (!list)
511 return 0;
512
513 if (list->IsEmpty())
514 return 1;
515
516 TIterator* iter = list->MakeIterator();
517 TObject* obj;
518
519 // sub collections
74fd10b3 520 const Int_t nCollections = 2 * kVertexBinning + 2; // 2 standalone hists, two arrays of size kVertexBinning
7029240a 521 TList* collections[nCollections];
522 for (Int_t i=0; i<nCollections; ++i)
523 collections[i] = new TList;
524
525 Int_t count = 0;
526 while ((obj = iter->Next()))
527 {
528 dNdEtaAnalysis* entry = dynamic_cast<dNdEtaAnalysis*> (obj);
529 if (entry == 0)
530 continue;
531
45e97e28 532 collections[0]->Add(entry->fData);
74fd10b3 533 collections[1]->Add(entry->fPtDist);
7029240a 534
535 for (Int_t i=0; i<kVertexBinning; ++i)
1afae8ff 536 {
74fd10b3 537 collections[2+i]->Add(entry->fdNdEta[i]);
538 collections[2+kVertexBinning+i]->Add(entry->fdNdEtaPtCutOffCorrected[i]);
1afae8ff 539 }
7029240a 540
541 ++count;
542 }
543
45e97e28 544 fData->Merge(collections[0]);
74fd10b3 545 fPtDist->Merge(collections[1]);
7029240a 546 for (Int_t i=0; i<kVertexBinning; ++i)
1afae8ff 547 {
74fd10b3 548 fdNdEta[i]->Merge(collections[2+i]);
549 fdNdEta[i]->Merge(collections[2+kVertexBinning+i]);
1afae8ff 550 }
7029240a 551
552 for (Int_t i=0; i<nCollections; ++i)
553 delete collections[i];
554
555 return count+1;
ceb5d1b5 556}