dNdPt analysis
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtCutAnalysis.cxx
CommitLineData
0aaa8b91 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16#include <iostream>\r
17\r
18#include "TFile.h"\r
19#include "TCint.h"\r
20#include "TH1.h"\r
21#include "TH2.h"\r
22\r
23#include "AliHeader.h" \r
24#include "AliGenEventHeader.h" \r
25#include "AliStack.h" \r
26#include "AliESDEvent.h" \r
27#include "AliMCEvent.h" \r
28#include "AliESDtrackCuts.h" \r
29#include "AliLog.h" \r
30\r
31#include "AlidNdPtEventCuts.h"\r
32#include "AlidNdPtAcceptanceCuts.h"\r
33\r
34#include "AlidNdPtCutAnalysis.h"\r
35\r
36using namespace std;\r
37\r
38ClassImp(AlidNdPtCutAnalysis)\r
39\r
40//_____________________________________________________________________________\r
41 AlidNdPtCutAnalysis::AlidNdPtCutAnalysis(): AlidNdPt(),\r
42 fAnalysisFolder(0),\r
43 fRecEventHist(0),\r
44 fMCEventHist(0),\r
45 fRecMCEventHist(0),\r
46 fRecMCTrackHist(0)\r
47{\r
48 // default constructor\r
49 Init();\r
50}\r
51\r
52//_____________________________________________________________________________\r
53AlidNdPtCutAnalysis::AlidNdPtCutAnalysis(Char_t* name, Char_t* title): AlidNdPt(name,title),\r
54 fAnalysisFolder(0),\r
55 fRecEventHist(0),\r
56 fMCEventHist(0),\r
57 fRecMCEventHist(0),\r
58 fRecMCTrackHist(0)\r
59{\r
60 // constructor\r
61 Init();\r
62}\r
63\r
64//_____________________________________________________________________________\r
65AlidNdPtCutAnalysis::~AlidNdPtCutAnalysis() {\r
66 // \r
67 if(fRecEventHist) delete fRecEventHist; fRecEventHist=0;\r
68 if(fMCEventHist) delete fMCEventHist; fMCEventHist=0;\r
69 if(fRecMCEventHist) delete fRecMCEventHist; fRecMCEventHist=0;\r
70 if(fRecMCTrackHist) delete fRecMCTrackHist; fRecMCTrackHist=0;\r
71\r
72 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;\r
73}\r
74\r
75//_____________________________________________________________________________\r
76void AlidNdPtCutAnalysis::Init(){\r
77 //\r
78 // Init histograms\r
79 //\r
80 const Int_t ptNbins = 56; \r
81 const Double_t ptMin = 0.; \r
82 const Double_t ptMax = 16.; \r
83\r
84 Double_t binsPt[ptNbins+1] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0};\r
85\r
86 //Xv:Yv:Zv:ResZv:Mult\r
87 Int_t binsRecEventHist[5]={100,100,140,100,150};\r
88 Double_t minRecEventHist[5]={-3.,-3.,-35.,0.,0.}; \r
89 Double_t maxRecEventHist[5]={3.,3.,35.,10.,150.}; \r
90 fRecEventHist = new THnSparseF("fRecEventHist","Xv:Yv:Zv:ResZv:Mult",5,binsRecEventHist,minRecEventHist,maxRecEventHist);\r
91 fRecEventHist->GetAxis(0)->SetTitle("Xv (cm)");\r
92 fRecEventHist->GetAxis(1)->SetTitle("Yv (cm)");\r
93 fRecEventHist->GetAxis(2)->SetTitle("Zv (cm)");\r
94 fRecEventHist->GetAxis(3)->SetTitle("ResZv (cm)");\r
95 fRecEventHist->GetAxis(4)->SetTitle("Mult");\r
96 fRecEventHist->Sumw2();\r
97\r
98 //Xv:Yv:Zv\r
99 Int_t binsMCEventHist[3]={100,100,140};\r
100 Double_t minMCEventHist[3]={-0.1,-0.1,-35.}; \r
101 Double_t maxMCEventHist[3]={0.1,0.1,35.}; \r
102 fMCEventHist = new THnSparseF("fMCEventHist","mcXv:mcYv:mcZv",3,binsMCEventHist,minMCEventHist,maxMCEventHist);\r
103 fMCEventHist->GetAxis(0)->SetTitle("mcXv (cm)");\r
104 fMCEventHist->GetAxis(1)->SetTitle("mcYv (cm)");\r
105 fMCEventHist->GetAxis(2)->SetTitle("mcZv (cm)");\r
106 fMCEventHist->Sumw2();\r
107\r
108 //Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult\r
109 Int_t binsRecMCEventHist[4]={100,100,100,150};\r
110 Double_t minRecMCEventHist[4]={-10.0,-10.0,-10.0,0.}; \r
111 Double_t maxRecMCEventHist[4]={10.0,10.0,10.0,150.}; \r
112 fRecMCEventHist = new THnSparseF("fRecMCEventHist","mcXv-Xv:mcYv-Yv:mcZv-Zv:Mult",4,binsRecMCEventHist,minRecMCEventHist,maxRecMCEventHist);\r
113 fRecMCEventHist->GetAxis(0)->SetTitle("mcXv-Xv (cm)");\r
114 fRecMCEventHist->GetAxis(1)->SetTitle("mcYv-Yv (cm)");\r
115 fRecMCEventHist->GetAxis(2)->SetTitle("mcZv-Zv (cm)");\r
116 fRecMCEventHist->GetAxis(3)->SetTitle("Mult");\r
117 fRecMCEventHist->Sumw2();\r
118\r
119 //\r
120 // THnSparse track histograms\r
121 //\r
122\r
123 //nClust:chi2PerClust:nClust/nFindableClust:DCAy:DCAz:eta:phi:pt:isKink:isPrim\r
124 Int_t binsRecMCTrackHist[10]={160,100,100,100,100,30,90,ptNbins, 2,2};\r
125 Double_t minRecMCTrackHist[10]={0., 0., 0., -10.,-10.,-1.5, 0., ptMin, 0., 0.};\r
126 Double_t maxRecMCTrackHist[10]={160.,10.,1.2, 10.,10.,1.5, 2.*TMath::Pi(), ptMax, 2.,2.};\r
127\r
128 fRecMCTrackHist = new THnSparseF("fRecMCTrackHist","nClust:chi2PerClust:nClust/nFindableClust:DCAy:DCAz:eta:phi:pt:isKink:isPrim",10,binsRecMCTrackHist,minRecMCTrackHist,maxRecMCTrackHist);\r
129 fRecMCTrackHist->SetBinEdges(7,binsPt);\r
130\r
131 fRecMCTrackHist->GetAxis(0)->SetTitle("nClust");\r
132 fRecMCTrackHist->GetAxis(1)->SetTitle("chi2PerClust");\r
133 fRecMCTrackHist->GetAxis(2)->SetTitle("nClust/nFindableClust");\r
134 fRecMCTrackHist->GetAxis(3)->SetTitle("DCAy (cm)");\r
135 fRecMCTrackHist->GetAxis(4)->SetTitle("DCAz (cm)");\r
136 fRecMCTrackHist->GetAxis(5)->SetTitle("#eta");\r
137 fRecMCTrackHist->GetAxis(6)->SetTitle("#phi (rad)");\r
138 fRecMCTrackHist->GetAxis(7)->SetTitle("p_{T} (GeV/c)");\r
139 fRecMCTrackHist->GetAxis(8)->SetTitle("isKink");\r
140 fRecMCTrackHist->GetAxis(9)->SetTitle("isPrim");\r
141 fRecMCTrackHist->Sumw2();\r
142\r
143 // init output folder\r
144 fAnalysisFolder = CreateFolder("folderdNdPt","Analysis dNdPt Folder");\r
145\r
146}\r
147\r
148//_____________________________________________________________________________\r
149void AlidNdPtCutAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent)\r
150{\r
151 //\r
152 // Process real and/or simulated events\r
153 //\r
154 if(!esdEvent) {\r
155 AliDebug(AliLog::kError, "esdEvent not available");\r
156 return;\r
157 }\r
158\r
159 // trigger definition\r
160 Bool_t isEventTriggered = AlidNdPtHelper::IsEventTriggered(esdEvent->GetTriggerMask(), GetTrigger());\r
161 //if(!isEventTriggered) printf("no MB1 trigger ... \n");\r
162\r
163 // cuts\r
164 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
165 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
166 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
167\r
168 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
169 AliDebug(AliLog::kError, "cuts not available");\r
170 return;\r
171 }\r
172\r
173 // use MC information\r
174 AliHeader* header = 0;\r
175 AliGenEventHeader* genHeader = 0;\r
176 AliStack* stack = 0;\r
177 TArrayF vtxMC(3);\r
178 AlidNdPtHelper::MCProcessType evtType = AlidNdPtHelper::kInvalidProcess;\r
179\r
180 if(IsUseMCInfo())\r
181 {\r
182 if(!mcEvent) {\r
183 AliDebug(AliLog::kError, "mcEvent not available");\r
184 return;\r
185 }\r
186\r
187 // get MC event header\r
188 header = mcEvent->Header();\r
189 if (!header) {\r
190 AliDebug(AliLog::kError, "Header not available");\r
191 return;\r
192 }\r
193\r
194 // MC particle stack\r
195 stack = mcEvent->Stack();\r
196 if (!stack) {\r
197 AliDebug(AliLog::kError, "Stack not available");\r
198 return;\r
199 }\r
200\r
201 // get event type (ND=0x1, DD=0x2, SD=0x4)\r
202 evtType = AlidNdPtHelper::GetEventProcessType(header);\r
203 AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
204\r
205 // get MC vertex\r
206 genHeader = header->GenEventHeader();\r
207 if (!genHeader) {\r
208 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
209 return;\r
210 }\r
211 genHeader->PrimaryVertex(vtxMC);\r
212\r
213 // Fill MC event histogram\r
214 Double_t vMCEventHist[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
215 fMCEventHist->Fill(vMCEventHist);\r
216\r
217 } // end bUseMC\r
218\r
219 // get reconstructed vertex \r
220 const AliESDVertex* vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(), kFALSE, kTRUE, kTRUE); // redo TPC vertex & vertex constraints\r
221 if(!vtxESD) return; \r
222\r
223 Bool_t isRecVertex = AlidNdPtHelper::TestVertex(vtxESD, GetAnalysisMode(), kFALSE); // should be moved to AcceptEvent\r
224 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex;\r
225\r
226 TObjArray *allChargedTracks=0;\r
227 Int_t multAll=0;\r
228\r
229 // check event cuts\r
230 if(isEventOK && isEventTriggered)\r
231 {\r
232 // get all charged tracks\r
233 allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,vtxESD,GetAnalysisMode());\r
234 //allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
235 if(!allChargedTracks) return;\r
236\r
237 Int_t entries = allChargedTracks->GetEntries();\r
238 for(Int_t i=0; i<entries;++i) \r
239 {\r
240 AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
241 if(!track) continue;\r
242\r
243 FillHistograms(track, stack);\r
244 multAll++;\r
245 }\r
246 } \r
247\r
248 Double_t vRecEventHist[5] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv(),vtxESD->GetZRes(),multAll};\r
249 fRecEventHist->Fill(vRecEventHist);\r
250\r
251 if(IsUseMCInfo()) {\r
252 Double_t vRecMCEventHist[5] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2],multAll};\r
253 fRecMCEventHist->Fill(vRecMCEventHist);\r
254 }\r
255\r
256 if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
257}\r
258\r
259//_____________________________________________________________________________\r
260void AlidNdPtCutAnalysis::FillHistograms(AliESDtrack *const esdTrack, AliStack *const stack)\r
261{\r
262 //\r
263 // Fill ESD track and MC histograms \r
264 //\r
265 if(!esdTrack) return;\r
266\r
267 //Float_t q = esdTrack->Charge();\r
268 Float_t pt = esdTrack->Pt();\r
269 Float_t eta = esdTrack->Eta();\r
270 Float_t phi = esdTrack->Phi();\r
271 Int_t nClust = esdTrack->GetTPCclusters(0);\r
272 Int_t nFindableClust = esdTrack->GetTPCNclsF();\r
273\r
274 Float_t chi2PerCluster = 0.;\r
275 if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust);\r
276\r
277 Float_t clustPerFindClust = 0.;\r
278 if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust;\r
279\r
280 Float_t b[2], bCov[3];\r
281 esdTrack->GetImpactParameters(b,bCov);\r
282\r
283 // kink daughter\r
284 Bool_t isKink = kFALSE;\r
285 if(esdTrack->GetKinkIndex(0)>0) isKink=kTRUE;\r
286\r
287 //\r
288 // Fill rec vs MC information\r
289 //\r
290 if(!stack) return;\r
291 Int_t label = TMath::Abs(esdTrack->GetLabel()); \r
292 TParticle* particle = stack->Particle(label);\r
293 if(!particle) return;\r
294 Bool_t isPrim = stack->IsPhysicalPrimary(label);\r
295\r
296 // fill histo\r
297 Double_t vRecMCTrackHist[10] = {nClust,chi2PerCluster,clustPerFindClust,b[0],b[1],eta,phi,pt,isKink,isPrim}; \r
298 fRecMCTrackHist->Fill(vRecMCTrackHist);\r
299}\r
300\r
301//_____________________________________________________________________________\r
302Long64_t AlidNdPtCutAnalysis::Merge(TCollection* list) \r
303{\r
304 // Merge list of objects (needed by PROOF)\r
305\r
306 if (!list)\r
307 return 0;\r
308\r
309 if (list->IsEmpty())\r
310 return 1;\r
311\r
312 TIterator* iter = list->MakeIterator();\r
313 TObject* obj = 0;\r
314\r
315 // collection of generated histograms\r
316 Int_t count=0;\r
317 while((obj = iter->Next()) != 0) {\r
318 AlidNdPtCutAnalysis* entry = dynamic_cast<AlidNdPtCutAnalysis*>(obj);\r
319 if (entry == 0) continue; \r
320 \r
321 // event histo\r
322 fRecEventHist->Add(entry->fRecEventHist);\r
323 fRecMCEventHist->Add(entry->fRecMCEventHist);\r
324 fMCEventHist->Add(entry->fMCEventHist);\r
325\r
326 // track histo\r
327 fRecMCTrackHist->Add(entry->fRecMCTrackHist);\r
328 \r
329 count++;\r
330 }\r
331\r
332return count;\r
333}\r
334\r
335//_____________________________________________________________________________\r
336void AlidNdPtCutAnalysis::Analyse() \r
337{\r
338 //\r
339 // Analyse histograms\r
340 //\r
341 TH1::AddDirectory(kFALSE);\r
342 TObjArray *aFolderObj = new TObjArray;\r
343 TH1D *h1D = 0; \r
344 TH2D *h2D = 0; \r
345\r
346\r
347 //\r
348 // get cuts\r
349 //\r
350 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
351 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
352 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
353\r
354 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
355 Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
356 return;\r
357 }\r
358\r
359 //\r
360 // set min and max values\r
361 //\r
362 Double_t minPt = accCuts->GetMinPt();\r
363 Double_t maxPt = accCuts->GetMaxPt();\r
364 Double_t minEta = accCuts->GetMinEta();\r
365 Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
366\r
367 //\r
368 // Create rec. event histograms\r
369 //\r
370 h2D = (TH2D *)fRecEventHist->Projection(0,1);\r
371 h2D->SetName("rec_xv_vs_yv");\r
372 aFolderObj->Add(h2D);\r
373\r
374 h2D = (TH2D *)fRecEventHist->Projection(0,2);\r
375 h2D->SetName("rec_xv_vs_zv");\r
376 aFolderObj->Add(h2D);\r
377\r
378 h2D = (TH2D *)fRecEventHist->Projection(0,2);\r
379 h2D->SetName("rec_resZv_vs_Mult");\r
380 aFolderObj->Add(h2D);\r
381\r
382 //\r
383 // Create mc event histograms\r
384 //\r
385 h2D = (TH2D *)fMCEventHist->Projection(0,1);\r
386 h2D->SetName("mc_xv_vs_yv");\r
387 aFolderObj->Add(h2D);\r
388\r
389 h2D = (TH2D *)fMCEventHist->Projection(0,2);\r
390 h2D->SetName("mc_xv_vs_zv");\r
391 aFolderObj->Add(h2D);\r
392\r
393 //\r
394 // Create rec-mc event histograms\r
395 //\r
396 h2D = (TH2D *)fRecMCEventHist->Projection(0,3);\r
397 h2D->SetName("rec_mc_deltaXv_vs_mult");\r
398 aFolderObj->Add(h2D);\r
399\r
400 h2D = (TH2D *)fRecMCEventHist->Projection(1,3);\r
401 h2D->SetName("rec_mc_deltaYv_vs_mult");\r
402 aFolderObj->Add(h2D);\r
403\r
404 h2D = (TH2D *)fRecMCEventHist->Projection(2,3);\r
405 h2D->SetName("rec_mc_deltaZv_vs_mult");\r
406 aFolderObj->Add(h2D);\r
407\r
408 //\r
409 // Create rec-mc track track histograms \r
410 //\r
411\r
412 // DCA cuts\r
413 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-0.3,0.3);\r
414 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-0.3,0.3);\r
415 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minPt,maxPt); \r
416\r
417 h2D = (TH2D *)fRecMCTrackHist->Projection(0,5);\r
418 h2D->SetName("nClust_vs_eta");\r
419 aFolderObj->Add(h2D);\r
420\r
421 h2D = (TH2D *)fRecMCTrackHist->Projection(1,5);\r
422 h2D->SetName("chi2PerClust_vs_eta");\r
423 aFolderObj->Add(h2D);\r
424\r
425 h2D = (TH2D *)fRecMCTrackHist->Projection(2,5);\r
426 h2D->SetName("ratio_nClust_nFindableClust_vs_eta");\r
427 aFolderObj->Add(h2D);\r
428\r
429 //\r
430 h2D = (TH2D *)fRecMCTrackHist->Projection(0,6);\r
431 h2D->SetName("nClust_vs_phi");\r
432 aFolderObj->Add(h2D);\r
433\r
434 h2D = (TH2D *)fRecMCTrackHist->Projection(1,6);\r
435 h2D->SetName("chi2PerClust_vs_phi");\r
436 aFolderObj->Add(h2D);\r
437\r
438 h2D = (TH2D *)fRecMCTrackHist->Projection(2,6);\r
439 h2D->SetName("ratio_nClust_nFindableClust_vs_phi");\r
440 aFolderObj->Add(h2D);\r
441\r
442 //\r
443 fRecMCTrackHist->GetAxis(7)->SetRangeUser(0.0,maxPt); \r
444\r
445 h2D = (TH2D *)fRecMCTrackHist->Projection(0,7);\r
446 h2D->SetName("nClust_vs_pt");\r
447 aFolderObj->Add(h2D);\r
448\r
449 h2D = (TH2D *)fRecMCTrackHist->Projection(1,7);\r
450 h2D->SetName("chi2PerClust_vs_pt");\r
451 aFolderObj->Add(h2D);\r
452\r
453 h2D = (TH2D *)fRecMCTrackHist->Projection(2,7);\r
454 h2D->SetName("ratio_nClust_nFindableClust_vs_pt");\r
455 aFolderObj->Add(h2D);\r
456\r
457 // fiducial volume\r
458 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minEta,maxEta); \r
459 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minPt,maxPt); \r
460\r
461 // DCA cuts\r
462 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-0.3,0.3);\r
463 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-0.3,0.3);\r
464\r
465 h2D = (TH2D *)fRecMCTrackHist->Projection(0,1);\r
466 h2D->SetName("nClust_vs_chi2PerClust");\r
467 aFolderObj->Add(h2D);\r
468\r
469 h2D = (TH2D *)fRecMCTrackHist->Projection(0,2);\r
470 h2D->SetName("nClust_vs_ratio_nClust_nFindableClust");\r
471 aFolderObj->Add(h2D);\r
472\r
473 // DCAy cuts\r
474 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-10.0,10.0);\r
475 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-1.0,1.0);\r
476\r
477 // sec\r
478 fRecMCTrackHist->GetAxis(9)->SetRange(1,1);\r
479 h1D = (TH1D *)fRecMCTrackHist->Projection(3);\r
480 h1D->SetName("dcay_sec");\r
481 aFolderObj->Add(h1D);\r
482\r
483 // prim\r
484 fRecMCTrackHist->GetAxis(9)->SetRange(2,2);\r
485 h1D = (TH1D *)fRecMCTrackHist->Projection(3);\r
486 h1D->SetName("dcay_prim");\r
487 aFolderObj->Add(h1D);\r
488\r
489 // DCAz cuts\r
490 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-1.0,1.0);\r
491 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-10.0,10.0);\r
492\r
493 // sec\r
494 fRecMCTrackHist->GetAxis(9)->SetRange(1,1);\r
495 h1D = (TH1D *)fRecMCTrackHist->Projection(4);\r
496 h1D->SetName("dcaz_sec");\r
497 aFolderObj->Add(h1D);\r
498\r
499 // prim\r
500 fRecMCTrackHist->GetAxis(9)->SetRange(2,2);\r
501 h1D = (TH1D *)fRecMCTrackHist->Projection(4);\r
502 h1D->SetName("dcaz_prim");\r
503 aFolderObj->Add(h1D);\r
504\r
505\r
506 // export objects to analysis folder\r
507 fAnalysisFolder = ExportToFolder(aFolderObj);\r
508\r
509 // delete only TObjArray\r
510 if(aFolderObj) delete aFolderObj;\r
511}\r
512\r
513//_____________________________________________________________________________\r
514TFolder* AlidNdPtCutAnalysis::ExportToFolder(TObjArray * array) \r
515{\r
516 // recreate folder avery time and export objects to new one\r
517 //\r
518 AlidNdPtCutAnalysis * comp=this;\r
519 TFolder *folder = comp->GetAnalysisFolder();\r
520\r
521 TString name, title;\r
522 TFolder *newFolder = 0;\r
523 Int_t i = 0;\r
524 Int_t size = array->GetSize();\r
525\r
526 if(folder) { \r
527 // get name and title from old folder\r
528 name = folder->GetName(); \r
529 title = folder->GetTitle(); \r
530\r
531 // delete old one\r
532 delete folder;\r
533\r
534 // create new one\r
535 newFolder = CreateFolder(name.Data(),title.Data());\r
536 newFolder->SetOwner();\r
537\r
538 // add objects to folder\r
539 while(i < size) {\r
540 newFolder->Add(array->At(i));\r
541 i++;\r
542 }\r
543 }\r
544\r
545return newFolder;\r
546}\r
547\r
548//_____________________________________________________________________________\r
549TFolder* AlidNdPtCutAnalysis::CreateFolder(TString name,TString title) { \r
550// create folder for analysed histograms\r
551//\r
552TFolder *folder = 0;\r
553 folder = new TFolder(name.Data(),title.Data());\r
554\r
555 return folder;\r
556}\r