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