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