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