]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/AliComparisonDCA.cxx
Update in the Comparison tasks
[u/mrichter/AliRoot.git] / PWG1 / AliComparisonDCA.cxx
CommitLineData
3baa4bfd 1//------------------------------------------------------------------------------
2// Implementation of AliComparisonDCA class. It keeps information from
3// comparison of reconstructed and MC particle tracks. In addtion,
4// it keeps selection cuts used during comparison. The comparison
5// information is stored in the ROOT histograms. Analysis of these
6// histograms can be done by using Analyse() class function. The result of
7// the analysis (histograms/graphs) are stored in the folder
8// which is a data member of AliComparisonDCA.
9//
10// Author: J.Otwinowski 04/02/2008
11//------------------------------------------------------------------------------
12
13/*
14
15 // after running comparison task, read the file, and get component
b4126c69 16 gROOT->LoadMacro("$ALICE_ROOT/PWG1/Macros/LoadMyLibs.C");
17 LoadMyLibs();
3baa4bfd 18 TFile f("Output.root");
35771050 19 //AliComparisonDCA * compObj = (AliComparisonDCA*)f.Get("AliComparisonDCA");
20 AliComparisonDCA * compObj = (AliComparisonDCA*)cOutput->FindObject("AliComparisonDCA");
3baa4bfd 21
b4126c69 22 // Analyse comparison data
3baa4bfd 23 compObj->Analyse();
24
25 // the output histograms/graphs will be stored in the folder "folderDCA"
26 compObj->GetAnalysisFolder()->ls("*");
27
28 // user can save whole comparison object (or only folder with anlysed histograms)
29 // in the seperate output file (e.g.)
30 TFile fout("Analysed_DCA.root","recreate");
31 compObj->Write(); // compObj->GetAnalysisFolder()->Write();
32 fout.Close();
33
34*/
35
36#include <iostream>
37
38#include "TFile.h"
3baa4bfd 39#include "TH3F.h"
40#include "TH2F.h"
41#include "TF1.h"
42#include "TProfile.h"
43#include "TProfile2D.h"
44#include "TGraph2D.h"
45#include "TCanvas.h"
46#include "TGraph.h"
47//
48#include "AliTracker.h"
49#include "AliESDEvent.h"
50#include "AliESD.h"
51#include "AliESDfriend.h"
52#include "AliESDfriendTrack.h"
53#include "AliRecInfoCuts.h"
54#include "AliMCInfoCuts.h"
55#include "AliLog.h"
56#include "AliESDVertex.h"
57//
58#include "AliMathBase.h"
59#include "AliTreeDraw.h"
60
61#include "AliMCInfo.h"
62#include "AliESDRecInfo.h"
63#include "AliComparisonDCA.h"
64
65using namespace std;
66
67ClassImp(AliComparisonDCA)
68
69//_____________________________________________________________________________
70AliComparisonDCA::AliComparisonDCA():
3baa4bfd 71 AliComparisonObject("AliComparisonDCA"),
72
73 // DCA histograms
35771050 74 fD0TanSPtTPCITS(0),
75 fD1TanSPtTPCITS(0),
76 fD0TanSPt(0),
77 fD1TanSPt(0),
78 fD0TanSPtTPC(0),
79 fD1TanSPtTPC(0),
3baa4bfd 80
81 // Cuts
82 fCutsRC(0),
83 fCutsMC(0),
84
85 // histogram folder
86 fAnalysisFolder(0)
87{
88 Init();
3baa4bfd 89}
90
91//_____________________________________________________________________________
92AliComparisonDCA::~AliComparisonDCA()
93{
94 //
35771050 95 if(fD0TanSPtTPCITS) delete fD0TanSPtTPCITS; fD0TanSPtTPCITS=0;
96 if(fD1TanSPtTPCITS) delete fD1TanSPtTPCITS; fD1TanSPtTPCITS=0;
97 if(fD0TanSPt) delete fD0TanSPt; fD0TanSPt=0;
98 if(fD1TanSPt) delete fD1TanSPt; fD1TanSPt=0;
99 if(fD0TanSPtTPC) delete fD0TanSPtTPC; fD0TanSPtTPC=0;
100 if(fD1TanSPtTPC) delete fD1TanSPtTPC; fD1TanSPtTPC=0;
3baa4bfd 101 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
102
103}
104
105//_____________________________________________________________________________
106void AliComparisonDCA::Init()
107{
108 // DCA histograms
35771050 109 fD0TanSPtTPCITS = new TH3F("DCAyTanSPtTPCITS","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
110 fD0TanSPtTPCITS->SetXTitle("tan(#theta)");
111 fD0TanSPtTPCITS->SetYTitle("#sqrt{p_{t}(GeV)}");
112 fD0TanSPtTPCITS->SetZTitle("DCA_{xy}");
113
114 fD1TanSPtTPCITS = new TH3F("DCAzTanSPtTPCITS","DCAzTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
115 fD1TanSPtTPCITS->SetXTitle("tan(#theta)");
116 fD1TanSPtTPCITS->SetYTitle("#sqrt(p_{t}(GeV))");
117 fD1TanSPtTPCITS->SetZTitle("DCA_{z}");
118
119 fD0TanSPt = new TH3F("DCAyTanSPt","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
120 fD0TanSPt->SetXTitle("tan(#theta)");
121 fD0TanSPt->SetYTitle("#sqrt{p_{t}(GeV)}");
122 fD0TanSPt->SetZTitle("DCA_{xy}");
123
124 fD1TanSPt = new TH3F("DCAzTanSPt","DCAzTanSPt",40,-2,2, 10,0.3,3, 100, -1,1);
125 fD1TanSPt->SetXTitle("tan(#theta)");
126 fD1TanSPt->SetYTitle("#sqrt{p_{t}(GeV)}");
127 fD1TanSPt->SetZTitle("DCA_{z}");
128
129 fD0TanSPtTPC = new TH3F("DCAyTanSPtTPC","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
130 fD0TanSPtTPC->SetXTitle("tan(#theta)");
131 fD0TanSPtTPC->SetYTitle("#sqrt{p_{t}(GeV)}");
132 fD0TanSPtTPC->SetZTitle("DCA_{xy}");
133
134 fD1TanSPtTPC = new TH3F("DCAzTanSPtTPC","DCAzTanSPt",40,-2,2, 10,0.3,3, 100, -1,1);
135 fD1TanSPtTPC->SetXTitle("tan(#theta)");
136 fD1TanSPtTPC->SetYTitle("#sqrt{p_{t}(GeV)}");
137 fD1TanSPtTPC->SetZTitle("DCA_{z}");
3baa4bfd 138
139 // init cuts
140 if(!fCutsMC)
141 AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
142 if(!fCutsRC)
143 AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
144
145 // init folder
146 fAnalysisFolder = CreateFolder("folderDCA","Analysis DCA Folder");
147}
148
149//_____________________________________________________________________________
150void AliComparisonDCA::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
151{
152 // Fill DCA comparison information
153 AliExternalTrackParam *track = 0;
154 Double_t field = AliTracker::GetBz(); // nominal Bz field [kG]
155 Double_t kMaxD = 123456.0; // max distance
156
157 Int_t clusterITS[200];
158 Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
decf0997 159 Float_t dca1[2], cov1[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
3baa4bfd 160
161 Float_t mcpt = infoMC->GetParticle().Pt();
162 Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
163 Float_t spt = TMath::Sqrt(mcpt);
164
165 // distance to Prim. vertex
166 const Double_t* dv = infoMC->GetVDist();
167
168 Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
169
170 // Check selection cuts
171 if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return;
172 if (!isPrim) return;
173 if (infoRC->GetStatus(1)!=3) return;
174 if (!infoRC->GetESDtrack()) return;
175 if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
176 if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
177
178 // calculate and set prim. vertex
35771050 179 AliESDVertex vertexMC;
180 vertexMC.SetXv( infoMC->GetParticle().Vx() - dv[0] );
181 vertexMC.SetYv( infoMC->GetParticle().Vy() - dv[1] );
182 vertexMC.SetZv( infoMC->GetParticle().Vz() - dv[2] );
3baa4bfd 183
184 // calculate track parameters at vertex
185 if (infoRC->GetESDtrack()->GetTPCInnerParam())
186 {
187 if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
188 {
35771050 189 Bool_t bDCAStatus = track->PropagateToDCA(&vertexMC,field,kMaxD,dca,cov);
3baa4bfd 190
191 if(bDCAStatus) {
35771050 192 fD0TanSPtTPC->Fill(tantheta,spt,dca[0]);
193 fD1TanSPtTPC->Fill(tantheta,spt,dca[1]);
3baa4bfd 194 }
195
196 delete track;
197 }
198 }
decf0997 199
decf0997 200 infoRC->GetESDtrack()->GetImpactParameters(dca1,cov1);
3baa4bfd 201
35771050 202 // ITS + TPC
203 if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()){
204 fD0TanSPtTPCITS->Fill(tantheta,spt,dca1[0]);
205 fD1TanSPtTPCITS->Fill(tantheta,spt,dca1[1]);
3baa4bfd 206 }
35771050 207 fD0TanSPt->Fill(tantheta,spt,dca1[0]);
208 fD1TanSPt->Fill(tantheta,spt,dca1[1]);
3baa4bfd 209}
210
211//_____________________________________________________________________________
212Long64_t AliComparisonDCA::Merge(TCollection* list)
213{
214 // Merge list of objects (needed by PROOF)
215
216 if (!list)
217 return 0;
218
219 if (list->IsEmpty())
220 return 1;
221
222 TIterator* iter = list->MakeIterator();
223 TObject* obj = 0;
224
225 // collection of generated histograms
226 Int_t count=0;
227 while((obj = iter->Next()) != 0)
228 {
229 AliComparisonDCA* entry = dynamic_cast<AliComparisonDCA*>(obj);
230 if (entry == 0) continue;
231
232
35771050 233 fD0TanSPtTPCITS->Add(entry->fD0TanSPtTPCITS);
234 fD1TanSPtTPCITS->Add(entry->fD1TanSPtTPCITS);
235 fD0TanSPt->Add(entry->fD0TanSPt);
236 fD1TanSPt->Add(entry->fD1TanSPt);
237 fD0TanSPtTPC->Add(entry->fD0TanSPtTPC);
238 fD1TanSPtTPC->Add(entry->fD1TanSPtTPC);
3baa4bfd 239
240 count++;
241 }
242
243return count;
244}
245
246//_____________________________________________________________________________
247void AliComparisonDCA::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
248 // Process comparison information
249 Process(infoMC,infoRC);
250}
251
252//_____________________________________________________________________________
253void AliComparisonDCA::Analyse()
254{
255 //
256 // Analyse comparison information and store output histograms
257 // in the analysis folder "folderDCA"
258 //
259
260 TH1::AddDirectory(kFALSE);
261
35771050 262 TGraph * gr[8]= { 0,0,0,0,0,0,0,0 };
263 TGraph2D *gr2[8]= { 0,0,0,0,0,0,0,0};
3baa4bfd 264 AliComparisonDCA * comp=this;
b4126c69 265 TObjArray *aFolderObj = new TObjArray;
3baa4bfd 266
267 // write results in the folder
268 // Canvas to draw analysed histograms
269 TCanvas * c = new TCanvas("canDCA","DCA resolution");
decf0997 270 c->Divide(2,4);
3baa4bfd 271 //
272 // DCA resolution
273 //
decf0997 274 c->cd(1);
35771050 275 gr[0] = AliMathBase::MakeStat1D(comp->fD0TanSPtTPC,2,5);
decf0997 276 gr[0]->GetXaxis()->SetTitle("Tan(#theta)");
277 gr[0]->GetYaxis()->SetTitle("#sigmaDCA_xy (cm)");
35771050 278 gr[0]->SetName("DCAXYResolTanTPC");
279 gr[0]->SetTitle("resol. DCA_xy (TPC only)");
decf0997 280 gr[0]->Draw("Al*");
281
282 aFolderObj->Add(gr[0]);
283
3baa4bfd 284 c->cd(2);
35771050 285 gr[1] = AliMathBase::MakeStat1D(comp->fD1TanSPtTPC,2,5);
decf0997 286 gr[1]->GetXaxis()->SetTitle("Tan(#theta)");
287 gr[1]->GetYaxis()->SetTitle("#sigmaDCA_z (cm)");
35771050 288 gr[1]->SetName("DCAZResolTanTPC");
289 gr[1]->SetTitle("resol. DCA_z (TPC only)");
decf0997 290 gr[1]->Draw("Al*");
291
292 aFolderObj->Add(gr[1]);
293
decf0997 294 c->cd(3);
35771050 295 gr[2] = AliMathBase::MakeStat1D(comp->fD0TanSPtTPCITS,2,5);
decf0997 296 gr[2]->GetXaxis()->SetTitle("Tan(#theta)");
35771050 297 gr[2]->GetYaxis()->SetTitle("#sigmaDCA_xy (cm)");
298 gr[2]->SetName("DCAXYResolTanTPCITS");
299 gr[2]->SetTitle("resol. DCA_xy (TPC+ITS)");
decf0997 300 gr[2]->Draw("Al*");
301
302 aFolderObj->Add(gr[2]);
303
304 c->cd(4);
35771050 305 gr[3] = AliMathBase::MakeStat1D(comp->fD1TanSPtTPCITS,2,5);
decf0997 306 gr[3]->GetXaxis()->SetTitle("Tan(#theta)");
35771050 307 gr[3]->GetYaxis()->SetTitle("#sigmaDCA_z (cm)");
308 gr[3]->SetName("DCAZResolTanTPCITS");
309 gr[3]->SetTitle("resol. DCA_z (TPC+ITS)");
decf0997 310 gr[3]->Draw("Al*");
311
312 aFolderObj->Add(gr[3]);
313
35771050 314 //
315 // DCA mean value
316 //
decf0997 317 c->cd(5);
35771050 318 gr[4] = AliMathBase::MakeStat1D(comp->fD0TanSPtTPC,2,4);
319 gr[4]->GetXaxis()->SetTitle("Tan(#theta)");
320 gr[4]->GetYaxis()->SetTitle("mean DCA_xy (cm)");
321 gr[4]->SetName("DCAXYMeanTanTPC");
322 gr[4]->SetTitle("mean DCA_xy (TPC only)");
323 gr[4]->Draw("Al*");
324
325 aFolderObj->Add(gr[4]);
326
327 c->cd(6);
328 gr[5] = AliMathBase::MakeStat1D(comp->fD1TanSPtTPC,2,4);
329 gr[5]->GetXaxis()->SetTitle("Tan(#theta)");
330 gr[5]->GetYaxis()->SetTitle("mean DCA_z (cm)");
331 gr[5]->SetName("DCAZMeanTanTPC");
332 gr[5]->SetTitle("mean DCA_z (TPC only)");
333 gr[5]->Draw("Al*");
334
335 aFolderObj->Add(gr[5]);
336
337 c->cd(7);
338 gr[6] = AliMathBase::MakeStat1D(comp->fD0TanSPtTPCITS,2,4);
339 gr[6]->GetXaxis()->SetTitle("Tan(#theta)");
340 gr[6]->GetYaxis()->SetTitle("mean DCA_xy (cm)");
341 gr[6]->SetName("DCAXYMeanTanTPCITS");
342 gr[6]->SetTitle("mean DCA_xy (TPC+ITS)");
343 gr[6]->Draw("Al*");
344
345 aFolderObj->Add(gr[6]);
346
347 c->cd(8);
348 gr[7] = AliMathBase::MakeStat1D(comp->fD1TanSPtTPCITS,2,4);
349 gr[7]->GetXaxis()->SetTitle("Tan(#theta)");
350 gr[7]->GetYaxis()->SetTitle("mean DCA_z (cm)");
351 gr[7]->SetName("DCAZMeanTanTPCITS");
352 gr[7]->SetTitle("mean DCA_z (TPC+ITS)");
353 gr[7]->Draw("Al*");
354
355 aFolderObj->Add(gr[7]);
356
357 // 2D DCA resolution
358 TCanvas * c1 = new TCanvas("canDCA1","2D DCA resolution");
359 c1->Divide(2,4);
360
361 // TPC only
362 c1->cd(1);
363 gr2[0] = AliMathBase::MakeStat2D(comp->fD0TanSPtTPC,4,2,5);
decf0997 364 gr2[0]->GetXaxis()->SetTitle("Tan(#theta)");
35771050 365 gr2[0]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
decf0997 366 gr2[0]->GetZaxis()->SetTitle("#sigmaDCA_xy (cm)");
35771050 367 gr2[0]->SetName("DCAXYResolSPTTanTPC");
368 gr2[0]->SetTitle("#sigma DCA_xy (TPC only)");
decf0997 369 gr2[0]->GetHistogram()->Draw("colz");
370
35771050 371 gr2[0]->GetHistogram()->SetName("DCAXYResolSPTTanTPC");
decf0997 372 aFolderObj->Add(gr2[0]->GetHistogram());
373
35771050 374 c1->cd(2);
375 gr2[1] = AliMathBase::MakeStat2D(comp->fD1TanSPtTPC,4,2,5);
decf0997 376 gr2[1]->GetXaxis()->SetTitle("Tan(#theta)");
35771050 377 gr2[1]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
decf0997 378 gr2[1]->GetZaxis()->SetTitle("#sigmaDCA_z (cm)");
35771050 379 gr2[1]->SetName("DCAZResolSPTTanTPC");
380 gr2[1]->SetTitle("#sigma DCA_z (TPC only)");
decf0997 381 gr2[1]->GetHistogram()->Draw("colz");
382
35771050 383 gr2[1]->GetHistogram()->SetName("DCAZResolSPTTanTPC");
decf0997 384 aFolderObj->Add(gr2[1]->GetHistogram());
385
35771050 386 // TPC+ITS
387 c1->cd(3);
388 gr2[2] = AliMathBase::MakeStat2D(comp->fD0TanSPtTPCITS,4,2,5);
decf0997 389 gr2[2]->GetXaxis()->SetTitle("Tan(#theta)");
35771050 390 gr2[2]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
391 gr2[2]->GetZaxis()->SetTitle("#sigmaDCA_xy (cm)");
392 gr2[2]->SetName("DCAXYResolSPTTanTPCITS");
393 gr2[2]->SetTitle("#sigma DCA_xy (TPC+ITS)");
decf0997 394 gr2[2]->GetHistogram()->Draw("colz");
395
35771050 396 gr2[2]->GetHistogram()->SetName("DCAXYResolSPTTanTPCITS");
decf0997 397 aFolderObj->Add(gr2[2]->GetHistogram());
398
35771050 399 c1->cd(4);
400 gr2[3] = AliMathBase::MakeStat2D(comp->fD1TanSPtTPCITS,4,2,5);
decf0997 401 gr2[3]->GetXaxis()->SetTitle("Tan(#theta)");
35771050 402 gr2[3]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
403 gr2[3]->GetZaxis()->SetTitle("#sigmaDCA_z (cm)");
404 gr2[3]->SetName("DCAZResolSPTTanTPCITS");
405 gr2[3]->SetTitle("#sigma DCA_z (TPC+ITS)");
decf0997 406 gr2[3]->GetHistogram()->Draw("colz");
407
35771050 408 gr2[3]->GetHistogram()->SetName("DCAZResolSPTTanTPCITS");
decf0997 409 aFolderObj->Add(gr2[3]->GetHistogram());
b4126c69 410
35771050 411 // 2D DCA mean value
412 c1->cd(5);
413 gr2[4] = AliMathBase::MakeStat2D(comp->fD0TanSPtTPC,4,2,4);
414 gr2[4]->GetXaxis()->SetTitle("Tan(#theta)");
415 gr2[4]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
416 gr2[4]->GetZaxis()->SetTitle("mean DCA_xy (cm)");
417 gr2[4]->SetName("DCAXYMeanSPTTanTPC");
418 gr2[4]->SetTitle("mean DCA_xy (TPC only)");
419 gr2[4]->GetHistogram()->Draw("colz");
420
421 gr2[4]->GetHistogram()->SetName("DCAXYMeanSPTTanTPC");
422 aFolderObj->Add(gr2[4]->GetHistogram());
423
424 c1->cd(6);
425 gr2[5] = AliMathBase::MakeStat2D(comp->fD1TanSPtTPC,4,2,4);
426 gr2[5]->GetXaxis()->SetTitle("Tan(#theta)");
427 gr2[5]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
428 gr2[5]->GetZaxis()->SetTitle("mean DCA_z (cm)");
429 gr2[5]->SetName("DCAZMeanSPTTanTPC");
430 gr2[5]->SetTitle("mean DCA_z (TPC only)");
431 gr2[5]->GetHistogram()->Draw("colz");
432
433 gr2[5]->GetHistogram()->SetName("DCAZMeanSPTTanTPC");
434 aFolderObj->Add(gr2[5]->GetHistogram());
435
436 c1->cd(7);
437 gr2[6] = AliMathBase::MakeStat2D(comp->fD0TanSPtTPCITS,4,2,4);
438 gr2[6]->GetXaxis()->SetTitle("Tan(#theta)");
439 gr2[6]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
440 gr2[6]->GetZaxis()->SetTitle("mean DCA_xy (cm)");
441 gr2[6]->SetName("DCAXYMeanSPTTanTPCITS");
442 gr2[6]->SetTitle("mean DCA_xy (TPC+ITS)");
443 gr2[6]->GetHistogram()->Draw("colz");
444
445 gr2[6]->GetHistogram()->SetName("DCAXYMeanSPTTanTPCITS");
446 aFolderObj->Add(gr2[6]->GetHistogram());
447
448 c1->cd(8);
449 gr2[7] = AliMathBase::MakeStat2D(comp->fD1TanSPtTPCITS,4,2,4);
450 gr2[7]->GetXaxis()->SetTitle("Tan(#theta)");
451 gr2[7]->GetYaxis()->SetTitle("#sqrt{p_{t}(GeV)}");
452 gr2[7]->GetZaxis()->SetTitle("mean DCA_z (cm)");
453 gr2[7]->SetName("DCAZMeanSPTTanTPCITS");
454 gr2[7]->SetTitle("mean DCA_z (TPC+ITS)");
455 gr2[7]->GetHistogram()->Draw("colz");
456
457 gr2[7]->GetHistogram()->SetName("DCAZMeanSPTTanTPCITS");
458 aFolderObj->Add(gr2[7]->GetHistogram());
459
b4126c69 460 // export objects to analysis folder
461 fAnalysisFolder = ExportToFolder(aFolderObj);
3baa4bfd 462
b4126c69 463 // delete only TObjArray
464 if(aFolderObj) delete aFolderObj;
3baa4bfd 465}
466
b4126c69 467//_____________________________________________________________________________
468TFolder* AliComparisonDCA::ExportToFolder(TObjArray * array)
469{
470 // recreate folder avery time and export objects to new one
471 //
472 AliComparisonDCA * comp=this;
473 TFolder *folder = comp->GetAnalysisFolder();
474
475 TString name, title;
476 TFolder *newFolder = 0;
477 Int_t i = 0;
478 Int_t size = array->GetSize();
479
480 if(folder) {
481 // get name and title from old folder
482 name = folder->GetName();
483 title = folder->GetTitle();
484
485 // delete old one
486 delete folder;
487
488 // create new one
489 newFolder = CreateFolder(name.Data(),title.Data());
490 newFolder->SetOwner();
491
492 // add objects to folder
493 while(i < size) {
494 newFolder->Add(array->At(i));
495 i++;
496 }
497 }
498
499return newFolder;
500}
501
502
3baa4bfd 503//_____________________________________________________________________________
504TFolder* AliComparisonDCA::CreateFolder(TString name,TString title) {
505// create folder for analysed histograms
506TFolder *folder = 0;
507 folder = new TFolder(name.Data(),title.Data());
508
509 return folder;
510}