cut analysis for PbPb
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / AlidNdPtCutAnalysisPbPb.cxx
CommitLineData
dac20c1b 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// AlidNdPtCutAnalysisPbPb class. \r
17//\r
18// a. functionality:\r
19// - fills generic cut histograms\r
20// - generates cuts (selection criteria)\r
21//\r
22// b. data members:\r
23// - generic cut histograms\r
24// - control histograms\r
25//\r
26// Author: J.Otwinowski 04/11/2008 \r
27//------------------------------------------------------------------------------\r
28#include "TH1.h"\r
29#include "TH2.h"\r
30\r
31#include "AliHeader.h" \r
32#include "AliGenEventHeader.h" \r
33#include "AliStack.h" \r
34#include "AliESDEvent.h" \r
35#include "AliMCEvent.h" \r
36#include "AliESDtrackCuts.h" \r
37#include "AliLog.h" \r
38#include "AliTracker.h" \r
39\r
40#include "AlidNdPtEventCuts.h"\r
41#include "AlidNdPtAcceptanceCuts.h"\r
42#include "AlidNdPtBackgroundCuts.h"\r
43#include "AlidNdPtAnalysis.h"\r
44#include "AliPhysicsSelection.h"\r
45\r
46#include "AliPWG0Helper.h"\r
47#include "AlidNdPtHelper.h"\r
48#include "AlidNdPtCutAnalysisPbPb.h"\r
49\r
50using namespace std;\r
51\r
52ClassImp(AlidNdPtCutAnalysisPbPb)\r
53\r
54//_____________________________________________________________________________\r
55 AlidNdPtCutAnalysisPbPb::AlidNdPtCutAnalysisPbPb(): AlidNdPt(),\r
56 fAnalysisFolder(0),\r
57 fEventCount(0),\r
58 fRecEventHist(0),\r
59 fMCEventHist(0),\r
60 fRecMCEventHist(0),\r
61 fRecMCTrackHist(0)\r
62{\r
63 // default constructor\r
64 Init();\r
65}\r
66\r
67//_____________________________________________________________________________\r
68AlidNdPtCutAnalysisPbPb::AlidNdPtCutAnalysisPbPb(Char_t* name, Char_t* title): AlidNdPt(name,title),\r
69 fAnalysisFolder(0),\r
70 fEventCount(0),\r
71 fRecEventHist(0),\r
72 fMCEventHist(0),\r
73 fRecMCEventHist(0),\r
74 fRecMCTrackHist(0)\r
75{\r
76 // constructor\r
77 Init();\r
78}\r
79\r
80//_____________________________________________________________________________\r
81AlidNdPtCutAnalysisPbPb::~AlidNdPtCutAnalysisPbPb() {\r
82 // \r
83 if(fEventCount) delete fEventCount; fEventCount=0;\r
84 if(fRecEventHist) delete fRecEventHist; fRecEventHist=0;\r
85 if(fMCEventHist) delete fMCEventHist; fMCEventHist=0;\r
86 if(fRecMCEventHist) delete fRecMCEventHist; fRecMCEventHist=0;\r
87 if(fRecMCTrackHist) delete fRecMCTrackHist; fRecMCTrackHist=0;\r
88\r
89 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;\r
90}\r
91\r
92//_____________________________________________________________________________\r
93void AlidNdPtCutAnalysisPbPb::Init(){\r
94 //\r
95 // Init histograms\r
96 //\r
97 const Int_t ptNbins = 56; \r
98 const Double_t ptMin = 0.; \r
99 const Double_t ptMax = 16.; \r
100\r
101 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
102\r
103 // \r
104 Int_t binsEventCount[2]={2,2};\r
105 Double_t minEventCount[2]={0,0}; \r
106 Double_t maxEventCount[2]={2,2}; \r
107 fEventCount = new THnSparseF("fEventCount","trig vs trig+vertex",2,binsEventCount,minEventCount,maxEventCount);\r
108 fEventCount->GetAxis(0)->SetTitle("trig");\r
109 fEventCount->GetAxis(1)->SetTitle("trig+vert");\r
110 fEventCount->Sumw2();\r
111\r
112 //Xv:Yv:Zv:ResZv:Mult\r
113 Double_t kFact = 1.0;\r
114\r
115 Int_t binsRecEventHist[5]={80,80,100,80,150};\r
116 Double_t minRecEventHist[5]={-3.*kFact,-3.*kFact,-35.,0.,0.}; \r
117 Double_t maxRecEventHist[5]={3.*kFact,3.*kFact,35.,10.,150.}; \r
118 fRecEventHist = new THnSparseF("fRecEventHist","Xv:Yv:Zv:ResZv:Mult",5,binsRecEventHist,minRecEventHist,maxRecEventHist);\r
119 fRecEventHist->GetAxis(0)->SetTitle("Xv (cm)");\r
120 fRecEventHist->GetAxis(1)->SetTitle("Yv (cm)");\r
121 fRecEventHist->GetAxis(2)->SetTitle("Zv (cm)");\r
122 fRecEventHist->GetAxis(3)->SetTitle("ResZv (cm)");\r
123 fRecEventHist->GetAxis(4)->SetTitle("Mult");\r
124 fRecEventHist->Sumw2();\r
125\r
126 //Xv:Yv:Zv\r
127 Int_t binsMCEventHist[3]={80,80,100};\r
128 Double_t minMCEventHist[3]={-0.1,-0.1,-35.}; \r
129 Double_t maxMCEventHist[3]={0.1,0.1,35.}; \r
130 fMCEventHist = new THnSparseF("fMCEventHist","mcXv:mcYv:mcZv",3,binsMCEventHist,minMCEventHist,maxMCEventHist);\r
131 fMCEventHist->GetAxis(0)->SetTitle("mcXv (cm)");\r
132 fMCEventHist->GetAxis(1)->SetTitle("mcYv (cm)");\r
133 fMCEventHist->GetAxis(2)->SetTitle("mcZv (cm)");\r
134 fMCEventHist->Sumw2();\r
135\r
136 //Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult\r
137 Int_t binsRecMCEventHist[4]={100,100,100,150};\r
138 Double_t minRecMCEventHist[4]={-1.0*kFact,-1.0*kFact,-1.0*kFact,0.}; \r
139 Double_t maxRecMCEventHist[4]={1.0*kFact,1.0*kFact,1.0*kFact,150.}; \r
140 fRecMCEventHist = new THnSparseF("fRecMCEventHist","Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult",4,binsRecMCEventHist,minRecMCEventHist,maxRecMCEventHist);\r
141 fRecMCEventHist->GetAxis(0)->SetTitle("Xv-mcXv (cm)");\r
142 fRecMCEventHist->GetAxis(1)->SetTitle("Yv-mcYv (cm)");\r
143 fRecMCEventHist->GetAxis(2)->SetTitle("Zv-mcZv (cm)");\r
144 fRecMCEventHist->GetAxis(3)->SetTitle("Mult");\r
145 fRecMCEventHist->Sumw2();\r
146\r
147 //\r
148 // THnSparse track histograms\r
149 //\r
150\r
151 //nClust:chi2PerClust:nClust/nFindableClust:DCAy:DCAz:eta:phi:pt:kinkIdx:isPrim:polarity\r
152 Int_t binsRecMCTrackHist[11]={160,80,80,100,100,90,90,ptNbins, 3, 2, 2};\r
153 Double_t minRecMCTrackHist[11]={0., 0., 0., -1.,-1.,-1.5, 0., ptMin, -1., 0., 0.};\r
154 Double_t maxRecMCTrackHist[11]={160.,10.,1.2, 1.,1.,1.5, 2.*TMath::Pi(), ptMax, 2., 2., 2.};\r
155\r
156 fRecMCTrackHist = new THnSparseF("fRecMCTrackHist","nClust:chi2PerClust:nClust/nFindableClust:DCAy:DCAz:eta:phi:pt:kinkIdx:isPrim:polarity",11,binsRecMCTrackHist,minRecMCTrackHist,maxRecMCTrackHist);\r
157 fRecMCTrackHist->SetBinEdges(7,binsPt);\r
158\r
159 fRecMCTrackHist->GetAxis(0)->SetTitle("nClust");\r
160 fRecMCTrackHist->GetAxis(1)->SetTitle("chi2PerClust");\r
161 fRecMCTrackHist->GetAxis(2)->SetTitle("nClust/nFindableClust");\r
162 fRecMCTrackHist->GetAxis(3)->SetTitle("DCAy (cm)");\r
163 fRecMCTrackHist->GetAxis(4)->SetTitle("DCAz (cm)");\r
164 fRecMCTrackHist->GetAxis(5)->SetTitle("#eta");\r
165 fRecMCTrackHist->GetAxis(6)->SetTitle("#phi (rad)");\r
166 fRecMCTrackHist->GetAxis(7)->SetTitle("p_{T} (GeV/c)");\r
167 fRecMCTrackHist->GetAxis(8)->SetTitle("kinkIdx"); // 0 - no kink, -1 - kink mother, 1 - kink daugther \r
168 fRecMCTrackHist->GetAxis(9)->SetTitle("isPrim");\r
169 fRecMCTrackHist->GetAxis(10)->SetTitle("polarity");\r
170 fRecMCTrackHist->Sumw2();\r
171\r
172 // init output folder\r
173 fAnalysisFolder = CreateFolder("folderdNdPt","Analysis dNdPt Folder");\r
174\r
175}\r
176\r
177//_____________________________________________________________________________\r
178void AlidNdPtCutAnalysisPbPb::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent)\r
179{\r
180 //\r
181 // Process real and/or simulated events\r
182 //\r
183 if(!esdEvent) {\r
184 AliDebug(AliLog::kError, "esdEvent not available");\r
185 return;\r
186 }\r
187\r
188 // get selection cuts\r
189 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
190 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
191 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
192\r
193 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
194 AliDebug(AliLog::kError, "cuts not available");\r
195 return;\r
196 }\r
197\r
198 // trigger selection\r
199 Bool_t isEventTriggered = kTRUE;\r
200 AliPhysicsSelection *trigSel = NULL;\r
201 AliTriggerAnalysis *trigAna = NULL; // needed for andV0\r
202\r
203 if(evtCuts->IsTriggerRequired()) \r
204 {\r
205 //\r
206 trigSel = GetPhysicsTriggerSelection();\r
207 if(!trigSel) {\r
208 printf("cannot get trigSel \n");\r
209 return;\r
210 }\r
211\r
212 //\r
213 if(IsUseMCInfo()) \r
214 { \r
215 trigSel->SetAnalyzeMC();\r
216\r
217 \r
218 isEventTriggered = trigSel->IsCollisionCandidate(esdEvent);\r
219 \r
220 if(GetTrigger() == AliTriggerAnalysis::kV0AND) \r
221 {\r
222 trigAna = trigSel->GetTriggerAnalysis();\r
223 if(!trigAna) \r
224 return;\r
225\r
226 isEventTriggered = trigAna->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
227 }//if(GetTrigger() == AliTriggerAnalysis::kV0AND)\r
228 }//if(IsUseMCInfo())\r
229 }//if(evtCuts->IsTriggerRequired())\r
230\r
231 // use MC information\r
232 AliHeader* header = 0;\r
233 AliGenEventHeader* genHeader = 0;\r
234 AliStack* stack = 0;\r
235 TArrayF vtxMC(3);\r
236\r
237 Int_t multMCTrueTracks = 0;\r
238 if(IsUseMCInfo())\r
239 {\r
240 //\r
241 if(!mcEvent) {\r
242 AliDebug(AliLog::kError, "mcEvent not available");\r
243 return;\r
244 }\r
245 // get MC event header\r
246 header = mcEvent->Header();\r
247 if (!header) {\r
248 AliDebug(AliLog::kError, "Header not available");\r
249 return;\r
250 }\r
251 // MC particle stack\r
252 stack = mcEvent->Stack();\r
253 if (!stack) {\r
254 AliDebug(AliLog::kError, "Stack not available");\r
255 return;\r
256 }\r
257\r
258 // get MC vertex\r
259 genHeader = header->GenEventHeader();\r
260 if (!genHeader) {\r
261 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
262 return;\r
263 }\r
264 genHeader->PrimaryVertex(vtxMC);\r
265\r
266 Double_t vMCEventHist[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
267 fMCEventHist->Fill(vMCEventHist);\r
268\r
269 // multipliticy of all MC primary tracks\r
270 // in Zv, pt and eta ranges)\r
271 multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);\r
272\r
273 } // end bUseMC\r
274\r
275 // get reconstructed vertex \r
276 const AliESDVertex* vtxESD = 0; \r
277 Bool_t isRecVertex = kTRUE;\r
278 if(evtCuts->IsRecVertexRequired()) \r
279 {\r
280// Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
281 //Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
282 //vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
283 //isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, esdEvent->GetPrimaryVertexSPD(), GetAnalysisMode(), kFALSE);\r
284 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {\r
285 vtxESD = esdEvent->GetPrimaryVertexTPC();\r
286 //isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, esdEvent->GetPrimaryVertexSPD(), GetAnalysisMode(), kFALSE);\r
287 }\r
288 }\r
289\r
290 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex; \r
291 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);\r
292 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());\r
293\r
294 TObjArray *allChargedTracks=0;\r
295 Int_t multAll=0;\r
296 \r
297 //\r
298 // event counter\r
299 // \r
300 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK,isEventTriggered);\r
301\r
302 Bool_t isTrigAndVertex = isEventTriggered && isEventOK;\r
303 Double_t vEventCount[2] = { isEventTriggered, isTrigAndVertex};\r
304 fEventCount->Fill(vEventCount);\r
305\r
306\r
307 // check event cuts\r
308 if(isEventOK && isEventTriggered)\r
309 {\r
310 // get all charged tracks\r
311 allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
312 if(!allChargedTracks) return;\r
313\r
314 Int_t entries = allChargedTracks->GetEntries();\r
315 for(Int_t i=0; i<entries;++i) \r
316 {\r
317 AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
318 if(!track) continue;\r
319\r
320 if(!esdTrackCuts->AcceptTrack(track)) continue;\r
321 FillHistograms(track, stack);\r
322 multAll++;\r
323 }\r
324\r
325 Double_t vRecEventHist[5] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv(),vtxESD->GetZRes(),multAll};\r
326 fRecEventHist->Fill(vRecEventHist);\r
327\r
328 if(IsUseMCInfo()) {\r
329 Double_t vRecMCEventHist[5] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2],multAll};\r
330 fRecMCEventHist->Fill(vRecMCEventHist);\r
331 }\r
332 }\r
333\r
334 if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
335\r
336}\r
337\r
338//_____________________________________________________________________________\r
339void AlidNdPtCutAnalysisPbPb::FillHistograms(AliESDtrack *const esdTrack, AliStack *const stack) const\r
340{\r
341 //\r
342 // Fill ESD track and MC histograms \r
343 //\r
344 if(!esdTrack) return;\r
345 if(esdTrack->Charge() == 0.) return;\r
346\r
347 Float_t pt = esdTrack->Pt();\r
348 Float_t eta = esdTrack->Eta();\r
349 Float_t phi = esdTrack->Phi();\r
350 //Int_t nClust = esdTrack->GetTPCclusters(0);\r
351 Int_t nClust = esdTrack->GetTPCNclsIter1();\r
352 Int_t nFindableClust = esdTrack->GetTPCNclsF();\r
353\r
354 Float_t chi2PerCluster = 0.;\r
355 //if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust);\r
356 if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2Iter1()/Float_t(nClust);\r
357\r
358 Float_t clustPerFindClust = 0.;\r
359 if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust;\r
360\r
361 Float_t b[2], bCov[3];\r
362 esdTrack->GetImpactParameters(b,bCov);\r
363\r
364 // kink idx\r
365 Int_t kinkIdx = 0;\r
366 //if(esdTrack->GetKinkIndex(0) > 0.) isKink = kTRUE;\r
367 if(esdTrack->GetKinkIndex(0) > 0) kinkIdx = 1; // kink daughter\r
368 else if(esdTrack->GetKinkIndex(0) < 0) kinkIdx = -1; // kink mother\r
369 else kinkIdx = 0; // not kink\r
370\r
371 //printf("esdTrack->GetKinkIndex(0) %d \n", esdTrack->GetKinkIndex(0));\r
372 //printf("esdTrack->GetKinkIndex(1) %d \n", esdTrack->GetKinkIndex(1));\r
373 //printf("esdTrack->GetKinkIndex(2) %d \n", esdTrack->GetKinkIndex(2));\r
374 //printf("kinkIdx %d \n", kinkIdx);\r
375\r
376 //\r
377 // Fill rec vs MC information\r
378 //\r
379 Bool_t isPrim = kTRUE;\r
380\r
381 if(IsUseMCInfo()) {\r
382 if(!stack) return;\r
383 Int_t label = TMath::Abs(esdTrack->GetLabel()); \r
384 TParticle* particle = stack->Particle(label);\r
385 if(!particle) return;\r
386 if(particle->GetPDG() && particle->GetPDG()->Charge()==0.) return;\r
387 isPrim = stack->IsPhysicalPrimary(label);\r
388\r
389 //if(isPrim && pt > 1.5 && kinkIdx == -1) printf("nClust %d \n", nClust);\r
390 }\r
391 \r
392 // fill histo\r
393 Int_t polarity = -2;\r
394 if (esdTrack->Charge() < 0.) polarity = 0; \r
395 else polarity = 1; \r
396 Double_t vRecMCTrackHist[11] = { nClust,chi2PerCluster,clustPerFindClust,b[0],b[1],eta,phi,pt,kinkIdx,isPrim, polarity }; \r
397 fRecMCTrackHist->Fill(vRecMCTrackHist);\r
398}\r
399\r
400//_____________________________________________________________________________\r
401Long64_t AlidNdPtCutAnalysisPbPb::Merge(TCollection* const list) \r
402{\r
403 // Merge list of objects (needed by PROOF)\r
404\r
405 if (!list)\r
406 return 0;\r
407\r
408 if (list->IsEmpty())\r
409 return 1;\r
410\r
411 TIterator* iter = list->MakeIterator();\r
412 TObject* obj = 0;\r
413\r
414 //TList *collPhysSelection = new TList;\r
415\r
416 // collection of generated histograms\r
417 Int_t count=0;\r
418 while((obj = iter->Next()) != 0) {\r
419 AlidNdPtCutAnalysisPbPb* entry = dynamic_cast<AlidNdPtCutAnalysisPbPb*>(obj);\r
420 if (entry == 0) continue; \r
421 \r
422 // event histo\r
423 fEventCount->Add(entry->fEventCount);\r
424 fRecEventHist->Add(entry->fRecEventHist);\r
425 fRecMCEventHist->Add(entry->fRecMCEventHist);\r
426 fMCEventHist->Add(entry->fMCEventHist);\r
427\r
428 // track histo\r
429 fRecMCTrackHist->Add(entry->fRecMCTrackHist);\r
430\r
431 // physics selection\r
432 //collPhysSelection->Add(entry->GetPhysicsTriggerSelection());\r
433 \r
434 count++;\r
435 }\r
436\r
437 //AliPhysicsSelection *trigSelection = GetPhysicsTriggerSelection();\r
438 //trigSelection->Merge(collPhysSelection);\r
439\r
440 //if(collPhysSelection) delete collPhysSelection;\r
441\r
442return count;\r
443}\r
444\r
445//_____________________________________________________________________________\r
446void AlidNdPtCutAnalysisPbPb::Analyse() \r
447{\r
448 //\r
449 // Analyse histograms\r
450 //\r
451 TH1::AddDirectory(kFALSE);\r
452 TObjArray *aFolderObj = new TObjArray;\r
453 TH1D *h1D = 0; \r
454 TH2D *h2D = 0; \r
455\r
456\r
457 //\r
458 // get cuts\r
459 //\r
460 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
461 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
462 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
463\r
464 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
465 Error("AlidNdPtCutAnalysisPbPb::Analyse()", "cuts not available");\r
466 return;\r
467 }\r
468\r
469 //\r
470 // set min and max values\r
471 //\r
472 Double_t minPt = accCuts->GetMinPt();\r
473 Double_t maxPt = accCuts->GetMaxPt();\r
474 Double_t minEta = accCuts->GetMinEta();\r
475 Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
476\r
477 Double_t maxDCAr = accCuts->GetMaxDCAr();\r
478\r
479 //\r
480 // Event counters\r
481 //\r
482 h2D = (TH2D*)fEventCount->Projection(0,1);\r
483 h2D->SetName("trig_vs_trigANDvertex");\r
484 aFolderObj->Add(h2D);\r
485\r
486 fEventCount->GetAxis(0)->SetRange(2,2); // triggered\r
487 h1D = (TH1D*)fEventCount->Projection(1);\r
488 h1D->SetTitle("rec. vertex for triggered events");\r
489 h1D->SetName("trigANDvertex");\r
490 aFolderObj->Add(h1D);\r
491\r
492 //\r
493 // Create rec. event histograms\r
494 //\r
495 h1D = (TH1D *)fRecEventHist->Projection(0);\r
496 h1D->SetName("rec_xv");\r
497 aFolderObj->Add(h1D);\r
498\r
499 h1D = (TH1D *)fRecEventHist->Projection(1);\r
500 h1D->SetName("rec_yv");\r
501 aFolderObj->Add(h1D);\r
502\r
503 h1D = (TH1D *)fRecEventHist->Projection(2);\r
504 h1D->SetName("rec_zv");\r
505 aFolderObj->Add(h1D);\r
506\r
507 h2D = (TH2D *)fRecEventHist->Projection(3,4);\r
508 h2D->SetName("rec_resZv_vs_Mult");\r
509 aFolderObj->Add(h2D);\r
510\r
511 h2D = (TH2D *)fRecEventHist->Projection(0,1);\r
512 h2D->SetName("rec_xv_vs_yv");\r
513 aFolderObj->Add(h2D);\r
514\r
515 h2D = (TH2D *)fRecEventHist->Projection(0,2);\r
516 h2D->SetName("rec_xv_vs_zv");\r
517 aFolderObj->Add(h2D);\r
518\r
519 h2D = (TH2D *)fRecEventHist->Projection(3,4);\r
520 h2D->SetName("rec_resZv_vs_Mult");\r
521 aFolderObj->Add(h2D);\r
522\r
523 //\r
524 // MC available\r
525 //\r
526 if(IsUseMCInfo()) {\r
527\r
528 //\r
529 // Create mc event histograms\r
530 //\r
531 h2D = (TH2D *)fMCEventHist->Projection(0,1);\r
532 h2D->SetName("mc_xv_vs_yv");\r
533 aFolderObj->Add(h2D);\r
534\r
535 h2D = (TH2D *)fMCEventHist->Projection(0,2);\r
536 h2D->SetName("mc_xv_vs_zv");\r
537 aFolderObj->Add(h2D);\r
538\r
539 //\r
540 // Create rec-mc event histograms\r
541 //\r
542 h2D = (TH2D *)fRecMCEventHist->Projection(0,3);\r
543 h2D->SetName("rec_mc_deltaXv_vs_mult");\r
544 aFolderObj->Add(h2D);\r
545\r
546 h2D = (TH2D *)fRecMCEventHist->Projection(1,3);\r
547 h2D->SetName("rec_mc_deltaYv_vs_mult");\r
548 aFolderObj->Add(h2D);\r
549\r
550 h2D = (TH2D *)fRecMCEventHist->Projection(2,3);\r
551 h2D->SetName("rec_mc_deltaZv_vs_mult");\r
552 aFolderObj->Add(h2D);\r
553\r
554 } // end use MC info \r
555\r
556\r
557\r
558 //\r
559 // Create rec-mc track track histograms \r
560 //\r
561\r
562 // DCA cuts\r
563 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-maxDCAr,maxDCAr);\r
564 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-maxDCAr,maxDCAr);\r
565\r
566 h2D = (TH2D *)fRecMCTrackHist->Projection(7,5);\r
567 h2D->SetName("pt_vs_eta");\r
568 aFolderObj->Add(h2D);\r
569\r
570 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minPt,maxPt); \r
571\r
572 h2D = (TH2D *)fRecMCTrackHist->Projection(0,5);\r
573 h2D->SetName("nClust_vs_eta");\r
574 aFolderObj->Add(h2D);\r
575\r
576 h2D = (TH2D *)fRecMCTrackHist->Projection(1,5);\r
577 h2D->SetName("chi2PerClust_vs_eta");\r
578 aFolderObj->Add(h2D);\r
579\r
580 h2D = (TH2D *)fRecMCTrackHist->Projection(2,5);\r
581 h2D->SetName("ratio_nClust_nFindableClust_vs_eta");\r
582 aFolderObj->Add(h2D);\r
583\r
584 h2D = (TH2D *)fRecMCTrackHist->Projection(5,6);\r
585 h2D->SetName("eta_vs_phi");\r
586 aFolderObj->Add(h2D);\r
587\r
588 //\r
589 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minEta,maxEta); \r
590\r
591 h2D = (TH2D *)fRecMCTrackHist->Projection(0,6);\r
592 h2D->SetName("nClust_vs_phi");\r
593 aFolderObj->Add(h2D);\r
594\r
595 h2D = (TH2D *)fRecMCTrackHist->Projection(1,6);\r
596 h2D->SetName("chi2PerClust_vs_phi");\r
597 aFolderObj->Add(h2D);\r
598\r
599 h2D = (TH2D *)fRecMCTrackHist->Projection(2,6);\r
600 h2D->SetName("ratio_nClust_nFindableClust_vs_phi");\r
601 aFolderObj->Add(h2D);\r
602\r
603 //\r
604 fRecMCTrackHist->GetAxis(7)->SetRangeUser(0.0,maxPt); \r
605\r
606 h2D = (TH2D *)fRecMCTrackHist->Projection(0,7);\r
607 h2D->SetName("nClust_vs_pt");\r
608 aFolderObj->Add(h2D);\r
609\r
610 h2D = (TH2D *)fRecMCTrackHist->Projection(1,7);\r
611 h2D->SetName("chi2PerClust_vs_pt");\r
612 aFolderObj->Add(h2D);\r
613\r
614 h2D = (TH2D *)fRecMCTrackHist->Projection(2,7);\r
615 h2D->SetName("ratio_nClust_nFindableClust_vs_pt");\r
616 aFolderObj->Add(h2D);\r
617\r
618 h2D = (TH2D *)fRecMCTrackHist->Projection(6,7);\r
619 h2D->SetName("phi_vs_pt");\r
620 aFolderObj->Add(h2D);\r
621\r
622\r
623 // fiducial volume\r
624 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minEta,maxEta); \r
625 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minPt,maxPt); \r
626\r
627 // DCA cuts\r
628 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-maxDCAr,maxDCAr);\r
629 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-maxDCAr,maxDCAr);\r
630\r
631 h2D = (TH2D *)fRecMCTrackHist->Projection(0,1);\r
632 h2D->SetName("nClust_vs_chi2PerClust");\r
633 aFolderObj->Add(h2D);\r
634\r
635 h2D = (TH2D *)fRecMCTrackHist->Projection(0,2);\r
636 h2D->SetName("nClust_vs_ratio_nClust_nFindableClust");\r
637 aFolderObj->Add(h2D);\r
638\r
639 //\r
640 // DCAy cuts\r
641 //\r
642 fRecMCTrackHist->GetAxis(0)->SetRange(50,160); // nClust/track > 50\r
643 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,3.9999); // chi2/cluster < 4.0\r
644 fRecMCTrackHist->GetAxis(3)->SetRange(1,fRecMCTrackHist->GetAxis(3)->GetNbins());\r
645 //fRecMCTrackHist->GetAxis(4)->SetRangeUser(-1.0,1.0);\r
646 fRecMCTrackHist->GetAxis(4)->SetRange(1,fRecMCTrackHist->GetAxis(4)->GetNbins());\r
647\r
648 // sec\r
649 fRecMCTrackHist->GetAxis(9)->SetRange(1,1);\r
650 h1D = (TH1D *)fRecMCTrackHist->Projection(3);\r
651 h1D->SetName("dcay_sec");\r
652 aFolderObj->Add(h1D);\r
653\r
654 // prim\r
655 fRecMCTrackHist->GetAxis(9)->SetRange(2,2);\r
656 h1D = (TH1D *)fRecMCTrackHist->Projection(3);\r
657 h1D->SetName("dcay_prim");\r
658 aFolderObj->Add(h1D);\r
659\r
660 // DCAz cuts\r
661 //fRecMCTrackHist->GetAxis(3)->SetRangeUser(-1.0,1.0);\r
662 fRecMCTrackHist->GetAxis(4)->SetRange(1,fRecMCTrackHist->GetAxis(4)->GetNbins());\r
663\r
664 // sec\r
665 fRecMCTrackHist->GetAxis(9)->SetRange(1,1);\r
666 h1D = (TH1D *)fRecMCTrackHist->Projection(4);\r
667 h1D->SetName("dcaz_sec");\r
668 aFolderObj->Add(h1D);\r
669\r
670 // prim\r
671 fRecMCTrackHist->GetAxis(9)->SetRange(2,2);\r
672 h1D = (TH1D *)fRecMCTrackHist->Projection(4);\r
673 h1D->SetName("dcaz_prim");\r
674 aFolderObj->Add(h1D);\r
675\r
676\r
677 // export objects to analysis folder\r
678 fAnalysisFolder = ExportToFolder(aFolderObj);\r
679\r
680 // delete only TObjArray\r
681 if(aFolderObj) delete aFolderObj;\r
682}\r
683\r
684//_____________________________________________________________________________\r
685TFolder* AlidNdPtCutAnalysisPbPb::ExportToFolder(TObjArray * const array) \r
686{\r
687 // recreate folder avery time and export objects to new one\r
688 //\r
689 AlidNdPtCutAnalysisPbPb * comp=this;\r
690 TFolder *folder = comp->GetAnalysisFolder();\r
691\r
692 TString name, title;\r
693 TFolder *newFolder = 0;\r
694 Int_t i = 0;\r
695 Int_t size = array->GetSize();\r
696\r
697 if(folder) { \r
698 // get name and title from old folder\r
699 name = folder->GetName(); \r
700 title = folder->GetTitle(); \r
701\r
702 // delete old one\r
703 delete folder;\r
704\r
705 // create new one\r
706 newFolder = CreateFolder(name.Data(),title.Data());\r
707 newFolder->SetOwner();\r
708\r
709 // add objects to folder\r
710 while(i < size) {\r
711 newFolder->Add(array->At(i));\r
712 i++;\r
713 }\r
714 }\r
715\r
716return newFolder;\r
717}\r
718\r
719//_____________________________________________________________________________\r
720TFolder* AlidNdPtCutAnalysisPbPb::CreateFolder(TString name,TString title) { \r
721// create folder for analysed histograms\r
722//\r
723TFolder *folder = 0;\r
724 folder = new TFolder(name.Data(),title.Data());\r
725\r
726 return folder;\r
727}\r