end-of-line normalization
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / AlidNdPtCutAnalysisPbPb.cxx
CommitLineData
a65a7e70 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15//------------------------------------------------------------------------------
16// AlidNdPtCutAnalysisPbPb class.
17//
18// a. functionality:
19// - fills generic cut histograms
20// - generates cuts (selection criteria)
21//
22// b. data members:
23// - generic cut histograms
24// - control histograms
25//
26// Author: J.Otwinowski 04/11/2008
27//------------------------------------------------------------------------------
28#include "TH1.h"
29#include "TH2.h"
30#include "TH3.h"
31#include "TMatrixD.h"
32
33#include <TPDGCode.h>
34
35#include "AliHeader.h"
36#include "AliGenEventHeader.h"
37#include "AliInputEventHandler.h"
38#include "AliCentrality.h"
39#include "AliStack.h"
40#include "AliESDEvent.h"
41#include "AliMCEvent.h"
42#include "AliESDtrackCuts.h"
43#include "AliLog.h"
44#include "AliTracker.h"
45
46#include "AlidNdPtEventCuts.h"
47#include "AlidNdPtAcceptanceCuts.h"
48#include "AlidNdPtBackgroundCuts.h"
49#include "AlidNdPtAnalysis.h"
50#include "AliPhysicsSelection.h"
51
52#include "AliPWG0Helper.h"
53#include "AlidNdPtHelper.h"
54#include "AlidNdPtCutAnalysisPbPb.h"
55
56using namespace std;
57
58ClassImp(AlidNdPtCutAnalysisPbPb)
59
60//_____________________________________________________________________________
61 AlidNdPtCutAnalysisPbPb::AlidNdPtCutAnalysisPbPb(): AlidNdPt(),
62 fAnalysisFolder(0),
63 fEventCount(0),
64 fRecEventHist(0),
65 fMCEventHist(0),
66 fRecMCEventHist(0),
67 fRecMCTrackHist(0),
68 fCentralityEstimator(0),
69 fFolderObj(0)
70{
71 // default constructor
72 Init();
73}
74
75//_____________________________________________________________________________
76AlidNdPtCutAnalysisPbPb::AlidNdPtCutAnalysisPbPb(Char_t* name, Char_t* title): AlidNdPt(name,title),
77 fAnalysisFolder(0),
78 fEventCount(0),
79 fRecEventHist(0),
80 fMCEventHist(0),
81 fRecMCEventHist(0),
82 fRecMCTrackHist(0),
83 fCentralityEstimator(0),
84 fFolderObj(0)
85{
86 // constructor
87 Init();
88}
89
90//_____________________________________________________________________________
91AlidNdPtCutAnalysisPbPb::~AlidNdPtCutAnalysisPbPb() {
92 //
93 if(fEventCount) delete fEventCount; fEventCount=0;
94 if(fRecEventHist) delete fRecEventHist; fRecEventHist=0;
95 if(fMCEventHist) delete fMCEventHist; fMCEventHist=0;
96 if(fRecMCEventHist) delete fRecMCEventHist; fRecMCEventHist=0;
97 if(fRecMCTrackHist) delete fRecMCTrackHist; fRecMCTrackHist=0;
98
99 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
100 if(fFolderObj) delete fFolderObj; fFolderObj=0;
101}
102
103//_____________________________________________________________________________
104void AlidNdPtCutAnalysisPbPb::Init(){
105 //
106 // Init histograms
107 //
108 //const Int_t ptNbins = 58;
109 //const Double_t ptMin = 0.;
110 //const Double_t ptMax = 20.;
111 /*
112 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,18.0, 20.};
113 */
114
115 // set pt bins
116 const Int_t ptNbins = 50;
117 const Double_t ptMin = 1.e-2, ptMax = 100.;
118 Double_t *binsPt = CreateLogAxis(ptNbins,ptMin,ptMax);
119
120 // centrality bins
121 const Int_t centrNbins = 3;
122 const Double_t centrMin = 0, centrMax = 1;
123 Double_t binsCentr[centrNbins+1] = {0.0, 20., 50., 100.};
124
125 //
126 Int_t binsEventCount[2]={2,2};
127 Double_t minEventCount[2]={0,0};
128 Double_t maxEventCount[2]={2,2};
129 fEventCount = new THnSparseF("fEventCount","trig vs trig+vertex",2,binsEventCount,minEventCount,maxEventCount);
130 fEventCount->GetAxis(0)->SetTitle("trig");
131 fEventCount->GetAxis(1)->SetTitle("trig+vert");
132 fEventCount->Sumw2();
133
134 //Xv:Yv:Zv:ResZv:Mult
135 Double_t kFact = 0.1;
136
137 Int_t binsRecEventHist[5]={80,80,100,80,150};
138 Double_t minRecEventHist[5]={-1.*kFact,-1.*kFact,-35.,0.,0.};
139 Double_t maxRecEventHist[5]={1.*kFact,1.*kFact,35.,10.,3000.};
140 fRecEventHist = new THnSparseF("fRecEventHist","Xv:Yv:Zv:ResZv:Mult",5,binsRecEventHist,minRecEventHist,maxRecEventHist);
141 fRecEventHist->GetAxis(0)->SetTitle("Xv (cm)");
142 fRecEventHist->GetAxis(1)->SetTitle("Yv (cm)");
143 fRecEventHist->GetAxis(2)->SetTitle("Zv (cm)");
144 fRecEventHist->GetAxis(3)->SetTitle("ResZv (cm)");
145 fRecEventHist->GetAxis(4)->SetTitle("Mult");
146 fRecEventHist->Sumw2();
147
148 //Xv:Yv:Zv
149 Int_t binsMCEventHist[3]={80,80,100};
150 Double_t minMCEventHist[3]={-0.1,-0.1,-35.};
151 Double_t maxMCEventHist[3]={0.1,0.1,35.};
152 fMCEventHist = new THnSparseF("fMCEventHist","mcXv:mcYv:mcZv",3,binsMCEventHist,minMCEventHist,maxMCEventHist);
153 fMCEventHist->GetAxis(0)->SetTitle("mcXv (cm)");
154 fMCEventHist->GetAxis(1)->SetTitle("mcYv (cm)");
155 fMCEventHist->GetAxis(2)->SetTitle("mcZv (cm)");
156 fMCEventHist->Sumw2();
157
158 //Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult
159 Int_t binsRecMCEventHist[4]={100,100,100,150};
160 Double_t minRecMCEventHist[4]={-1.0*kFact,-1.0*kFact,-1.0*kFact,0.};
161 Double_t maxRecMCEventHist[4]={1.0*kFact,1.0*kFact,1.0*kFact,3000.};
162 fRecMCEventHist = new THnSparseF("fRecMCEventHist","Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult",4,binsRecMCEventHist,minRecMCEventHist,maxRecMCEventHist);
163 fRecMCEventHist->GetAxis(0)->SetTitle("Xv-mcXv (cm)");
164 fRecMCEventHist->GetAxis(1)->SetTitle("Yv-mcYv (cm)");
165 fRecMCEventHist->GetAxis(2)->SetTitle("Zv-mcZv (cm)");
166 fRecMCEventHist->GetAxis(3)->SetTitle("Mult");
167 fRecMCEventHist->Sumw2();
168
169 //
170 // THnSparse track histograms
171 //
172 //
173 //
174 //nCrossRows:chi2PerClust:chi2PerClustITS:nCrossRows/nFindableClust:fracSharedClust:DCAy:DCAz:eta:phi:pt:hasStrangeMother:isFromConversion:isFromMaterial:isPrim:charge:centr:chi2ToTPCc
175 Int_t binsRecMCTrackHist[17]= {160, 10, 70, 30, 20, 50, 50, 20, 90, ptNbins, 2, 2, 2, 2, 3, centrNbins,100};
176 Double_t minRecMCTrackHist[17]={0., 0., 0., 0., 0.,-0.5,-2.5,-1.0, 0., ptMin, 0., 0., 0., 0.,-1., centrMin, 0.};
177 Double_t maxRecMCTrackHist[17]={160.,10.,70.,1.5, 1., 0.5, 2.5, 1.0, 2.*TMath::Pi(), ptMax, 2., 2., 2., 2., 2., centrMax, 100.};
178
179 fRecMCTrackHist = new THnSparseF("fRecMCTrackHist","nCrossRows:chi2PerClust:chi2PerClustITS:nCrossRows/nFindableClust:fracSharedClust:DCAy:DCAz:eta:phi:pt:hasStrangeMother:isFromConversion:isFromMaterial:isPrim:charge:centr:chi2ToTPCc",17,binsRecMCTrackHist,minRecMCTrackHist,maxRecMCTrackHist);
180 fRecMCTrackHist->SetBinEdges(9,binsPt);
181 fRecMCTrackHist->SetBinEdges(15,binsCentr);
182
183 fRecMCTrackHist->GetAxis(0)->SetTitle("nCrossRows");
184 fRecMCTrackHist->GetAxis(1)->SetTitle("chi2PerClust");
185 fRecMCTrackHist->GetAxis(2)->SetTitle("chi2PerClustITS");
186 fRecMCTrackHist->GetAxis(3)->SetTitle("nCrossRows/nFindableClust");
187 fRecMCTrackHist->GetAxis(4)->SetTitle("fracSharedClust");
188 fRecMCTrackHist->GetAxis(5)->SetTitle("DCAy (cm)");
189 fRecMCTrackHist->GetAxis(6)->SetTitle("DCAz (cm)");
190 fRecMCTrackHist->GetAxis(7)->SetTitle("#eta");
191 fRecMCTrackHist->GetAxis(8)->SetTitle("#phi (rad)");
192 fRecMCTrackHist->GetAxis(9)->SetTitle("p_{T} (GeV/c)");
193 fRecMCTrackHist->GetAxis(10)->SetTitle("hasStrangeMother");
194 fRecMCTrackHist->GetAxis(11)->SetTitle("isFromConversion");
195 fRecMCTrackHist->GetAxis(12)->SetTitle("isFromMaterial");
196 fRecMCTrackHist->GetAxis(13)->SetTitle("isPrim");
197 fRecMCTrackHist->GetAxis(14)->SetTitle("charge");
198 fRecMCTrackHist->GetAxis(15)->SetTitle("centrality");
199 fRecMCTrackHist->GetAxis(16)->SetTitle("chi2ToTPCc");
200 fRecMCTrackHist->Sumw2();
201
202 // init output folder
203 fAnalysisFolder = CreateFolder("folderdNdPt","Analysis dNdPt Folder");
204
205}
206
207//_____________________________________________________________________________
208void AlidNdPtCutAnalysisPbPb::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent)
209{
210 //
211 // Process real and/or simulated events
212 //
213 if(!esdEvent) {
214 AliDebug(AliLog::kError, "esdEvent not available");
215 return;
216 }
217
218 // get selection cuts
219 AlidNdPtEventCuts *evtCuts = GetEventCuts();
220 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts();
221 AliESDtrackCuts *esdTrackCuts = GetTrackCuts();
222
223 if(!evtCuts || !accCuts || !esdTrackCuts) {
224 AliDebug(AliLog::kError, "cuts not available");
225 return;
226 }
227
228 // trigger selection
229
230 Bool_t isEventTriggered = kTRUE;
231 AliPhysicsSelection *physicsSelection = NULL;
232 AliTriggerAnalysis* triggerAnalysis = NULL;
233
234 //
235 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
236 if (!inputHandler)
237 {
238 Printf("ERROR: Could not receive input handler");
239 return;
240 }
241
242 if(evtCuts->IsTriggerRequired())
243 {
244 // always MB
245 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;
246
247 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());
248 if(!physicsSelection) return;
249 //SetPhysicsTriggerSelection(physicsSelection);
250
251 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {
252 // set trigger (V0AND)
253 triggerAnalysis = physicsSelection->GetTriggerAnalysis();
254 if(!triggerAnalysis) return;
255 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());
256 }
257 }
258
259 // centrality determination
260 Float_t centralityF = -1;
261 AliCentrality *esdCentrality = esdEvent->GetCentrality();
262 centralityF = esdCentrality->GetCentralityPercentile(fCentralityEstimator.Data());
263
264 // use MC information
265 AliHeader* header = 0;
266 AliGenEventHeader* genHeader = 0;
267 AliStack* stack = 0;
268 TArrayF vtxMC(3);
269
270 Int_t multMCTrueTracks = 0;
271 if(IsUseMCInfo())
272 {
273 //
274 if(!mcEvent) {
275 AliDebug(AliLog::kError, "mcEvent not available");
276 return;
277 }
278 // get MC event header
279 header = mcEvent->Header();
280 if (!header) {
281 AliDebug(AliLog::kError, "Header not available");
282 return;
283 }
284 // MC particle stack
285 stack = mcEvent->Stack();
286 if (!stack) {
287 AliDebug(AliLog::kError, "Stack not available");
288 return;
289 }
290
291 // get MC vertex
292 genHeader = header->GenEventHeader();
293 if (!genHeader) {
294 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");
295 return;
296 }
297 genHeader->PrimaryVertex(vtxMC);
298
299 Double_t vMCEventHist[3]={vtxMC[0],vtxMC[1],vtxMC[2]};
300 fMCEventHist->Fill(vMCEventHist);
301
302 // multipliticy of all MC primary tracks
303 // in Zv, pt and eta ranges)
304 multMCTrueTracks = AlidNdPtHelper::GetMCTrueTrackMult(mcEvent,evtCuts,accCuts);
305
306 } // end bUseMC
307
308 // get reconstructed vertex
309 const AliESDVertex* vtxESD = 0;
310 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
311 vtxESD = esdEvent->GetPrimaryVertexTPC();
312 }
313 else if(GetAnalysisMode() == AlidNdPtHelper::kTPCITS) {
314 vtxESD = esdEvent->GetPrimaryVertexTracks();
315 }
316 else {
317 return;
318 }
319
320 if(!vtxESD) return;
321
322 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD);
323 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK, isEventTriggered);
324 //printf("GetAnalysisMode() %d \n",GetAnalysisMode());
325
326 TObjArray *allChargedTracks=0;
327 Int_t multAll=0;
328
329 //
330 // event counter
331 //
332 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK,isEventTriggered);
333
334 Bool_t isTrigAndVertex = isEventTriggered && isEventOK;
335 Double_t vEventCount[2] = { isEventTriggered, isTrigAndVertex};
336 fEventCount->Fill(vEventCount);
337
338 // check event cuts
339 if(isEventOK && isEventTriggered)
340 {
341 // get all charged tracks
342 allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());
343 if(!allChargedTracks) return;
344
345 Int_t entries = allChargedTracks->GetEntries();
346 for(Int_t i=0; i<entries;++i)
347 {
348 AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);
349 if(!track) continue;
350
351 if(!esdTrackCuts->AcceptTrack(track)) continue;
352 if(!accCuts->AcceptTrack(track)) continue;
353
354 FillHistograms(esdEvent, track, stack, centralityF);
355 multAll++;
356
357 }
358
359 Double_t vRecEventHist[5] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv(),vtxESD->GetZRes(),multAll};
360 fRecEventHist->Fill(vRecEventHist);
361
362 if(IsUseMCInfo()) {
363 Double_t vRecMCEventHist[5] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2],multAll};
364 fRecMCEventHist->Fill(vRecMCEventHist);
365 }
366 }
367
368 if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;
369
370}
371
372//_____________________________________________________________________________
373void AlidNdPtCutAnalysisPbPb::FillHistograms(AliESDEvent *const esdEvent, AliESDtrack *const esdTrack, AliStack *const stack, Float_t centralityF) const
374{
375 //
376 // Fill ESD track and MC histograms
377 //
378 if(!esdTrack) return;
379 if(esdTrack->Charge() == 0.) return;
380
381 Float_t pt = esdTrack->Pt();
382 Float_t eta = esdTrack->Eta();
383 Float_t phi = esdTrack->Phi();
384
385 Int_t nClust = 0;
386 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
387 nClust = esdTrack->GetTPCNclsIter1();
388 } else {
389 nClust = esdTrack->GetTPCclusters(0);
390 }
391
392 Float_t chi2PerCluster = 0.;
393 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) {
394 if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2Iter1()/Float_t(nClust);
395 } else {
396 chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust);
397 }
398
399 Int_t nClustersITS = esdTrack->GetITSclusters(0);
400 Float_t chi2PerClusterITS = -1;
401 if (nClustersITS!=0) {
402 chi2PerClusterITS = esdTrack->GetITSchi2()/Float_t(nClustersITS);
403 }
404
405 Float_t clustPerFindClust = 0.;
406 Int_t nFindableClust = esdTrack->GetTPCNclsF();
407 if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust;
408
409 Float_t b[2], bCov[3];
410 esdTrack->GetImpactParameters(b,bCov);
411
412 //
413 Float_t nCrossedRowsTPC = esdTrack->GetTPCClusterInfo(2,1);
414
415 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
416 if (esdTrack->GetTPCNclsF()>0) {
417 ratioCrossedRowsOverFindableClustersTPC = esdTrack->GetTPCClusterInfo(2,1)/esdTrack->GetTPCNclsF();
418 }
419
420 //
421 Int_t nClustersTPCShared = esdTrack->GetTPCnclsS();
422 Float_t fracClustersTPCShared = -1.;
423 fracClustersTPCShared = Float_t(nClustersTPCShared)/Float_t(nClust);
424
425 //
426 // kink idx
427 Int_t kinkIdx = 0;
428 //if(esdTrack->GetKinkIndex(0) > 0.) isKink = kTRUE;
429 if(esdTrack->GetKinkIndex(0) > 0) kinkIdx = 1; // kink daughter
430 else if(esdTrack->GetKinkIndex(0) < 0) kinkIdx = -1; // kink mother
431 else kinkIdx = 0; // not kink
432
433 //printf("esdTrack->GetKinkIndex(0) %d \n", esdTrack->GetKinkIndex(0));
434 //printf("esdTrack->GetKinkIndex(1) %d \n", esdTrack->GetKinkIndex(1));
435 //printf("esdTrack->GetKinkIndex(2) %d \n", esdTrack->GetKinkIndex(2));
436 //printf("kinkIdx %d \n", kinkIdx);
437
438 Bool_t isOK = kTRUE;
439 AliExternalTrackParam * tpcInner = (AliExternalTrackParam *)(esdTrack->GetTPCInnerParam());
440 if (!tpcInner) return;
441 tpcInner->Rotate(esdTrack->GetAlpha());
442 tpcInner->PropagateTo(esdTrack->GetX(),esdEvent->GetMagneticField());
443
444 // tpc constrained
445 AliExternalTrackParam * tpcInnerC = (AliExternalTrackParam *)(esdTrack->GetTPCInnerParam()->Clone());
446 if (!tpcInnerC) return;
447 tpcInnerC->Rotate(esdTrack->GetAlpha());
448 tpcInnerC->PropagateTo(esdTrack->GetX(),esdEvent->GetMagneticField());
449 Double_t dz[2],cov[3];
450 AliESDVertex *vtx= (AliESDVertex *)esdEvent->GetPrimaryVertex();
451
452 if (!tpcInnerC->PropagateToDCA(vtx, esdEvent->GetMagneticField(), 3, dz, cov))
453 {
454 if(tpcInnerC) delete tpcInnerC;
455 return;
456 }
457 Double_t covar[6]; vtx->GetCovMatrix(covar);
458 Double_t p[2]={tpcInnerC->GetParameter()[0]-dz[0],tpcInnerC->GetParameter()[1]-dz[1]};
459 Double_t c[3]={covar[2],0.,covar[5]};
460 Double_t chi2C=tpcInnerC->GetPredictedChi2(p,c);
461 isOK = tpcInnerC->Update(p,c);
462 isOK = tpcInnerC->Rotate(esdTrack->GetAlpha());
463 isOK = tpcInnerC->Propagate(esdTrack->GetAlpha(),esdTrack->GetX(),esdEvent->GetMagneticField());
464
465 if(!isOK || chi2C>kVeryBig) {
466 if(tpcInnerC) delete tpcInnerC;
467 return;
468 }
469
470 //
471 // calculate chi2 between vi and vj vectors
472 // with covi and covj covariance matrices
473 // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj)
474 //
475 TMatrixD deltaT(5,1);
476 TMatrixD delta(1,5);
477 TMatrixD covarM(5,5);
478
479 for (Int_t ipar=0; ipar<5; ipar++) deltaT(ipar,0)=tpcInnerC->GetParameter()[ipar]-esdTrack->GetParameter()[ipar];
480 for (Int_t ipar=0; ipar<5; ipar++) delta(0,ipar)=tpcInnerC->GetParameter()[ipar]-esdTrack->GetParameter()[ipar];
481
482 for (Int_t ipar=0; ipar<5; ipar++) {
483 for (Int_t jpar=0; jpar<5; jpar++) {
484 Int_t index=esdTrack->GetIndex(ipar,jpar);
485 covarM(ipar,jpar)=esdTrack->GetCovariance()[index]+tpcInnerC->GetCovariance()[index];
486 }
487 }
488 TMatrixD covarMInv = covarM.Invert();
489 TMatrixD mat2 = covarMInv*deltaT;
490 TMatrixD chi2 = delta*mat2;
491
492 //
493 // Fill rec vs MC information
494 //
495 Bool_t isPrim = kTRUE;
496 Bool_t hasStrangeMother = kFALSE;
497 Bool_t isFromMaterial = kFALSE;
498 Bool_t isFromConversion = kFALSE;
499
500 if(IsUseMCInfo())
501 {
502 if(!stack) return;
503 Int_t label = TMath::Abs(esdTrack->GetLabel());
504 TParticle* particle = stack->Particle(label);
505 if(!particle) return;
506 if(particle->GetPDG() && particle->GetPDG()->Charge()==0.) return;
507 isPrim = stack->IsPhysicalPrimary(label);
508
509 // check whether has stange mother
510 //
511 Int_t motherPdg = -1;
512 TParticle* mother = 0;
513
514 Int_t motherLabel = particle->GetMother(0);
515 if(motherLabel>0) mother = stack->Particle(motherLabel);
516 if(mother) motherPdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only
517 Int_t mech = particle->GetUniqueID(); // production mechanism
518
519 // K+-, lambda, antilambda, K0s decays
520 if(!isPrim && mech==4 &&
521 (TMath::Abs(motherPdg)==kKPlus || TMath::Abs(motherPdg)==kLambda0 || motherPdg==kK0Short))
522 {
523 hasStrangeMother = kTRUE;
524 }
525
526 if(!isPrim && mech==5 && motherPdg==kGamma) {
527 isFromConversion=kTRUE;
528 }
529
530 if(!isPrim && mech==13) {
531 isFromMaterial=kTRUE;
532 }
533 }
534
535 // fill histo
536 Int_t charge = esdTrack->Charge();
537 Double_t vRecMCTrackHist[17] = { nCrossedRowsTPC, chi2PerCluster, chi2PerClusterITS,ratioCrossedRowsOverFindableClustersTPC, fracClustersTPCShared, b[0], b[1], eta, phi, pt, hasStrangeMother, isFromConversion, isFromMaterial, isPrim, charge, centralityF, chi2(0,0) };
538 fRecMCTrackHist->Fill(vRecMCTrackHist);
539
540 if(tpcInnerC) delete tpcInnerC;
541}
542
543//_____________________________________________________________________________
544Long64_t AlidNdPtCutAnalysisPbPb::Merge(TCollection* const list)
545{
546 // Merge list of objects (needed by PROOF)
547
548 if (!list)
549 return 0;
550
551 if (list->IsEmpty())
552 return 1;
553
554 TIterator* iter = list->MakeIterator();
555 TObject* obj = 0;
556 TObjArray* objArrayList = 0;
557 objArrayList = new TObjArray();
558
559 //TList *collPhysSelection = new TList;
560
561 // collection of generated histograms
562 Int_t count=0;
563 while((obj = iter->Next()) != 0) {
564 AlidNdPtCutAnalysisPbPb* entry = dynamic_cast<AlidNdPtCutAnalysisPbPb*>(obj);
565 if (entry == 0) continue;
566
567 // event histo
568 if(GetMergeTHnSparse())
569 {
570 fEventCount->Add(entry->fEventCount);
571 fRecEventHist->Add(entry->fRecEventHist);
572 fRecMCEventHist->Add(entry->fRecMCEventHist);
573 fMCEventHist->Add(entry->fMCEventHist);
574
575 // track histo
576 fRecMCTrackHist->Add(entry->fRecMCTrackHist);
577 }
578
579 if (entry->fFolderObj) { objArrayList->Add(entry->fFolderObj); }
580
581 count++;
582 }
583 if (fFolderObj) { fFolderObj->Merge(objArrayList); }
584
585 // to signal that track histos were not merged: reset
586 if (!GetMergeTHnSparse())
587 {
588 // reset content
589 // save memory
590 fEventCount->Reset();
591 fRecEventHist->Reset();
592 fRecMCEventHist->Reset();
593 fMCEventHist->Reset();
594
595 // track histo
596 fRecMCTrackHist->Reset();
597 }
598
599 // delete
600 if (objArrayList) delete objArrayList; objArrayList=0;
601
602return count;
603}
604
605//_____________________________________________________________________________
606void AlidNdPtCutAnalysisPbPb::Analyse()
607{
608 //
609 // Analyse histograms
610 //
611 TH1::AddDirectory(kFALSE);
612 TObjArray *aFolderObj = new TObjArray;
613 if(!aFolderObj) return;
614
615 TH1D *h1D = 0;
616 TH2D *h2D = 0;
617 TH3D *h3D = 0;
618
619 //
620 // make event level projection
621 //
622 //THnSparseF *fEventCount; //-> trig, trig + vertex
623 //THnSparseF *fRecEventHist; //-> Xv:Yv:Zv:ResZv:Mult
624 //THnSparseF *fMCEventHist; //-> mcXv:mcYv:mcZv
625 //THnSparseF *fRecMCEventHist; //-> Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult
626
627 //
628 // Event counters
629 //
630 h2D = (TH2D*)fEventCount->Projection(0,1);
631 h2D->SetName("trig_vs_trigANDvertex");
632 h2D->SetTitle("trig_vs_trigANDvertex");
633 aFolderObj->Add(h2D);
634
635 fEventCount->GetAxis(0)->SetRange(2,2); // triggered
636 h1D = (TH1D*)fEventCount->Projection(1);
637 h1D->SetTitle("rec. vertex for triggered events");
638 h1D->SetName("trigANDvertex");
639 h1D->SetTitle("trigANDvertex");
640 aFolderObj->Add(h1D);
641
642 //
643 // Create rec. event histograms
644 //
645 h1D = (TH1D *)fRecEventHist->Projection(0);
646 h1D->SetName("rec_xv");
647 h1D->SetTitle("rec_xv");
648 aFolderObj->Add(h1D);
649
650 h1D = (TH1D *)fRecEventHist->Projection(1);
651 h1D->SetName("rec_yv");
652 h1D->SetTitle("rec_yv");
653 aFolderObj->Add(h1D);
654
655 h1D = (TH1D *)fRecEventHist->Projection(2);
656 h1D->SetName("rec_zv");
657 h1D->SetTitle("rec_zv");
658 aFolderObj->Add(h1D);
659
660 h2D = (TH2D *)fRecEventHist->Projection(0,1);
661 h2D->SetName("rec_xv_vs_yv");
662 h2D->SetTitle("rec_xv_vs_yv");
663 aFolderObj->Add(h2D);
664
665 h2D = (TH2D *)fRecEventHist->Projection(1,2);
666 h2D->SetName("rec_yv_vs_zv");
667 h2D->SetTitle("rec_yv_vs_zv");
668 aFolderObj->Add(h2D);
669
670 h2D = (TH2D *)fRecEventHist->Projection(0,2);
671 h2D->SetName("rec_xv_vs_zv");
672 h2D->SetTitle("rec_xv_vs_zv");
673 aFolderObj->Add(h2D);
674
675 h2D = (TH2D *)fRecEventHist->Projection(3,4);
676 h2D->SetName("rec_resZv_vs_Mult");
677 h2D->SetTitle("rec_resZv_vs_Mult");
678 aFolderObj->Add(h2D);
679
680 //
681 // MC available
682 //
683 if(IsUseMCInfo()) {
684
685 //
686 // Create mc event histograms
687 //
688
689 h1D = (TH1D *)fMCEventHist->Projection(0);
690 h1D->SetName("mc_xv");
691 h1D->SetTitle("mc_xv");
692 aFolderObj->Add(h1D);
693
694 h1D = (TH1D *)fMCEventHist->Projection(1);
695 h1D->SetName("mc_yv");
696 h1D->SetTitle("mc_yv");
697 aFolderObj->Add(h1D);
698
699 h1D = (TH1D *)fMCEventHist->Projection(2);
700 h1D->SetName("mc_zv");
701 h1D->SetTitle("mc_zv");
702 aFolderObj->Add(h1D);
703
704
705 h2D = (TH2D *)fMCEventHist->Projection(0,1);
706 h2D->SetName("mc_xv_vs_yv");
707 h2D->SetTitle("mc_xv_vs_yv");
708 aFolderObj->Add(h2D);
709
710 h2D = (TH2D *)fMCEventHist->Projection(1,2);
711 h2D->SetName("mc_yv_vs_zv");
712 h2D->SetTitle("mc_yv_vs_zv");
713 aFolderObj->Add(h2D);
714
715 h2D = (TH2D *)fMCEventHist->Projection(0,2);
716 h2D->SetName("mc_xv_vs_zv");
717 h2D->SetTitle("mc_xv_vs_zv");
718 aFolderObj->Add(h2D);
719
720 //
721 // Create rec-mc event histograms
722 //
723 h2D = (TH2D *)fRecMCEventHist->Projection(0,3);
724 h2D->SetName("rec_mc_deltaXv_vs_mult");
725 h2D->SetTitle("rec_mc_deltaXv_vs_mult");
726 aFolderObj->Add(h2D);
727
728 h2D = (TH2D *)fRecMCEventHist->Projection(1,3);
729 h2D->SetName("rec_mc_deltaYv_vs_mult");
730 h2D->SetTitle("rec_mc_deltaYv_vs_mult");
731 aFolderObj->Add(h2D);
732
733 h2D = (TH2D *)fRecMCEventHist->Projection(2,3);
734 h2D->SetName("rec_mc_deltaZv_vs_mult");
735 h2D->SetTitle("rec_mc_deltaZv_vs_mult");
736 aFolderObj->Add(h2D);
737
738 } // end use MC info
739
740 //
741 // make track level projection
742 //
743 // THnSparse track histograms
744 // nCrossRows:chi2PerClust:chi2PerClustITS:nCrossRows/nFindableClust:fracSharedClust:DCAy:DCAz:eta:phi:pt:hasStrangeMother:isFromConversion:isFromMaterial:isPrim:charge:centr:chi2ToTPCc
745 //
746
747 // only TH3 histograms
748 // x : pT : centr
749 Double_t minNCrossRows = 120.;
750 Double_t maxChi2PerClust = 4.;
751 Double_t maxChi2PerClustITS = 36.;
752 Double_t minNCrossRowsOverFindable = 0.8;
753 Double_t maxFracSharedClust = 0.4;
754 Double_t minDCAr = -0.2, maxDCAr = 0.2;
755 Double_t minDCAz = -2., maxDCAz = 2.;
756 Double_t minEta = -0.8, maxEta = 0.8;
757 Double_t maxChi2ToTPCc = 50;
758
759 // only TH3 histograms
760 // x : pT : centr
761
762 // set all cuts
763 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
764 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
765 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
766 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
767 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
768 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
769 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
770 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minEta,maxEta-0.0001);
771 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0.,maxChi2ToTPCc-0.0001);
772
773 // nCrossRows
774 fRecMCTrackHist->GetAxis(0)->SetRangeUser(0,160);
775
776 h3D = (TH3D *)fRecMCTrackHist->Projection(0,9,15);
777 h3D->SetName("rec_nCrossRows_pT_centr");
778 h3D->SetTitle("rec_nCrossRows_pT_centr");
779 aFolderObj->Add(h3D);
780
781
782 // Chi2PerClust
783 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
784 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,10);
785
786 h3D = (TH3D *)fRecMCTrackHist->Projection(1,9,15);
787 h3D->SetName("rec_Chi2PerClust_pT_centr");
788 h3D->SetTitle("rec_Chi2PerClust_pT_centr");
789 aFolderObj->Add(h3D);
790
791
792 // Chi2PerClustITS
793 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
794 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,100);
795
796 h3D = (TH3D *)fRecMCTrackHist->Projection(2,9,15);
797 h3D->SetName("rec_Chi2PerClustITS_pT_centr");
798 h3D->SetTitle("rec_Chi2PerClustITS_pT_centr");
799 aFolderObj->Add(h3D);
800
801
802 // NCrossRowsOverFindable
803 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
804 fRecMCTrackHist->GetAxis(3)->SetRangeUser(0,1.4999);
805
806 h3D = (TH3D *)fRecMCTrackHist->Projection(3,9,15);
807 h3D->SetName("rec_NCrossRowsOverFindable_pT_centr");
808 h3D->SetTitle("rec_NCrossRowsOverFindable_pT_centr");
809 aFolderObj->Add(h3D);
810
811
812 // FracSharedClust
813 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
814 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,0.9999);
815
816 h3D = (TH3D *)fRecMCTrackHist->Projection(4,9,15);
817 h3D->SetName("rec_FracSharedClust_pT_centr");
818 h3D->SetTitle("rec_FracSharedClust_pT_centr");
819 aFolderObj->Add(h3D);
820
821
822 // DCAr
823 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
824 fRecMCTrackHist->GetAxis(5)->SetRangeUser(-10.,9.9999);
825
826 h3D = (TH3D *)fRecMCTrackHist->Projection(5,9,15);
827 h3D->SetName("rec_DCAr_pT_centr");
828 h3D->SetTitle("rec_DCAr_pT_centr");
829 aFolderObj->Add(h3D);
830
831 // DCAz
832 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
833 fRecMCTrackHist->GetAxis(6)->SetRangeUser(-10.,9.9999);
834
835 h3D = (TH3D *)fRecMCTrackHist->Projection(6,9,15);
836 h3D->SetName("rec_DCAz_pT_centr");
837 h3D->SetTitle("rec_DCAz_pT_centr");
838 aFolderObj->Add(h3D);
839
840 // chi2ToTPCc
841 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
842 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0,100);
843
844 h3D = (TH3D *)fRecMCTrackHist->Projection(16,9,15);
845 h3D->SetName("rec_chi2ToTPCc_pT_centr");
846 h3D->SetTitle("rec_chi2ToTPCc_pT_centr");
847 aFolderObj->Add(h3D);
848
849
850 //
851 // MC available
852 //
853 // nCrossRows:chi2PerClust:chi2PerClustITS:nCrossRows/nFindableClust:fracSharedClust:DCAy:DCAz:eta:phi:pt:hasStrangeMother:isFromConversion:isFromMaterial:isPrim:charge:centr:chi2ToTPCc
854 //
855
856 if(IsUseMCInfo()) {
857 //
858 // only TH3 histograms
859 // x : pT : centr
860 //
861 // comes from week decays
862 //
863 fRecMCTrackHist->GetAxis(10)->SetRange(2,2);
864
865 // set all cuts
866 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
867 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
868 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
869 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
870 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
871 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
872 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
873 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minEta,maxEta-0.0001);
874 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0.,maxChi2ToTPCc-0.0001);
875
876 // nCrossRows
877 fRecMCTrackHist->GetAxis(0)->SetRangeUser(0,160);
878
879 h3D = (TH3D *)fRecMCTrackHist->Projection(0,9,15);
880 h3D->SetName("rec_sec_strange_nCrossRows_pT_centr");
881 h3D->SetTitle("rec_sec_strange_nCrossRows_pT_centr");
882 aFolderObj->Add(h3D);
883
884 // Chi2PerClust
885 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
886 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,10);
887
888 h3D = (TH3D *)fRecMCTrackHist->Projection(1,9,15);
889 h3D->SetName("rec_sec_strange_Chi2PerClust_pT_centr");
890 h3D->SetTitle("rec_sec_strange_Chi2PerClust_pT_centr");
891 aFolderObj->Add(h3D);
892
893 // Chi2PerClustITS
894 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
895 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,100);
896
897 h3D = (TH3D *)fRecMCTrackHist->Projection(2,9,15);
898 h3D->SetName("rec_sec_strange_Chi2PerClustITS_pT_centr");
899 h3D->SetTitle("rec_sec_strange_Chi2PerClustITS_pT_centr");
900 aFolderObj->Add(h3D);
901
902
903 // NCrossRowsOverFindable
904 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
905 fRecMCTrackHist->GetAxis(3)->SetRangeUser(0,1.4999);
906
907 h3D = (TH3D *)fRecMCTrackHist->Projection(3,9,15);
908 h3D->SetName("rec_sec_strange_NCrossRowsOverFindable_pT_centr");
909 h3D->SetTitle("rec_sec_strange_NCrossRowsOverFindable_pT_centr");
910 aFolderObj->Add(h3D);
911
912
913 // FracSharedClust
914 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
915 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,0.9999);
916
917 h3D = (TH3D *)fRecMCTrackHist->Projection(4,9,15);
918 h3D->SetName("rec_sec_strange_FracSharedClust_pT_centr");
919 h3D->SetTitle("rec_sec_strange_FracSharedClust_pT_centr");
920 aFolderObj->Add(h3D);
921
922
923 // DCAr
924 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
925 fRecMCTrackHist->GetAxis(5)->SetRangeUser(-10.,9.9999);
926
927 h3D = (TH3D *)fRecMCTrackHist->Projection(5,9,15);
928 h3D->SetName("rec_sec_strange_DCAr_pT_centr");
929 h3D->SetTitle("rec_sec_strange_DCAr_pT_centr");
930 aFolderObj->Add(h3D);
931
932
933 // DCAz
934 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
935 fRecMCTrackHist->GetAxis(6)->SetRangeUser(-10.,9.9999);
936
937 h3D = (TH3D *)fRecMCTrackHist->Projection(6,9,15);
938 h3D->SetName("rec_sec_strange_DCAz_pT_centr");
939 h3D->SetTitle("rec_sec_strange_DCAz_pT_centr");
940 aFolderObj->Add(h3D);
941
942 // chi2ToTPCc
943 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
944 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0,100);
945
946 h3D = (TH3D *)fRecMCTrackHist->Projection(16,9,15);
947 h3D->SetName("rec_sec_strange_chi2ToTPCc_pT_centr");
948 h3D->SetTitle("rec_sec_strange_chi2ToTPCc_pT_centr");
949 aFolderObj->Add(h3D);
950
951
952 // only TH3 histograms
953 // x : pT : centr
954 //
955
956 // comes from conversion
957 //
958 fRecMCTrackHist->GetAxis(10)->SetRange(1,2);
959 fRecMCTrackHist->GetAxis(11)->SetRange(2,2);
960
961 // set all cuts
962 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
963 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
964 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
965 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
966 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
967 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
968 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
969 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minEta,maxEta-0.0001);
970 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0.,maxChi2ToTPCc-0.0001);
971
972 // nCrossRows
973 fRecMCTrackHist->GetAxis(0)->SetRangeUser(0,160);
974
975 h3D = (TH3D *)fRecMCTrackHist->Projection(0,9,15);
976 h3D->SetName("rec_sec_conversion_nCrossRows_pT_centr");
977 h3D->SetTitle("rec_sec_conversion_nCrossRows_pT_centr");
978 aFolderObj->Add(h3D);
979
980 // Chi2PerClust
981 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
982 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,10);
983
984 h3D = (TH3D *)fRecMCTrackHist->Projection(1,9,15);
985 h3D->SetName("rec_sec_conversion_Chi2PerClust_pT_centr");
986 h3D->SetTitle("rec_sec_conversion_Chi2PerClust_pT_centr");
987 aFolderObj->Add(h3D);
988
989 // Chi2PerClustITS
990 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
991 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,100);
992
993 h3D = (TH3D *)fRecMCTrackHist->Projection(2,9,15);
994 h3D->SetName("rec_sec_conversion_Chi2PerClustITS_pT_centr");
995 h3D->SetTitle("rec_sec_conversion_Chi2PerClustITS_pT_centr");
996 aFolderObj->Add(h3D);
997
998
999 // NCrossRowsOverFindable
1000 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1001 fRecMCTrackHist->GetAxis(3)->SetRangeUser(0,1.4999);
1002
1003 h3D = (TH3D *)fRecMCTrackHist->Projection(3,9,15);
1004 h3D->SetName("rec_sec_conversion_NCrossRowsOverFindable_pT_centr");
1005 h3D->SetTitle("rec_sec_conversion_NCrossRowsOverFindable_pT_centr");
1006 aFolderObj->Add(h3D);
1007
1008
1009 // FracSharedClust
1010 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1011 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,0.9999);
1012
1013 h3D = (TH3D *)fRecMCTrackHist->Projection(4,9,15);
1014 h3D->SetName("rec_sec_conversion_FracSharedClust_pT_centr");
1015 h3D->SetTitle("rec_sec_conversion_FracSharedClust_pT_centr");
1016 aFolderObj->Add(h3D);
1017
1018
1019 // DCAr
1020 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1021 fRecMCTrackHist->GetAxis(5)->SetRangeUser(-10.,9.9999);
1022
1023 h3D = (TH3D *)fRecMCTrackHist->Projection(5,9,15);
1024 h3D->SetName("rec_sec_conversion_DCAr_pT_centr");
1025 h3D->SetTitle("rec_sec_conversion_DCAr_pT_centr");
1026 aFolderObj->Add(h3D);
1027
1028
1029 // DCAz
1030 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1031 fRecMCTrackHist->GetAxis(6)->SetRangeUser(-10.,9.9999);
1032
1033 h3D = (TH3D *)fRecMCTrackHist->Projection(6,9,15);
1034 h3D->SetName("rec_sec_conversion_DCAz_pT_centr");
1035 h3D->SetTitle("rec_sec_conversion_DCAz_pT_centr");
1036 aFolderObj->Add(h3D);
1037
1038 // chi2ToTPCc
1039 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1040 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0,100);
1041
1042 h3D = (TH3D *)fRecMCTrackHist->Projection(16,9,15);
1043 h3D->SetName("rec_sec_conversion_chi2ToTPCc_pT_centr");
1044 h3D->SetTitle("rec_sec_conversion_chi2ToTPCc_pT_centr");
1045 aFolderObj->Add(h3D);
1046
1047
1048
1049
1050
1051 // comes from interaction with material
1052 //
1053 fRecMCTrackHist->GetAxis(11)->SetRange(1,2);
1054 fRecMCTrackHist->GetAxis(12)->SetRange(2,2);
1055
1056 // set all cuts
1057 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
1058 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
1059 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1060 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1061 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1062 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1063 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1064 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minEta,maxEta-0.0001);
1065 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0.,maxChi2ToTPCc-0.0001);
1066
1067 // nCrossRows
1068 fRecMCTrackHist->GetAxis(0)->SetRangeUser(0,160);
1069
1070 h3D = (TH3D *)fRecMCTrackHist->Projection(0,9,15);
1071 h3D->SetName("rec_sec_material_nCrossRows_pT_centr");
1072 h3D->SetTitle("rec_sec_material_nCrossRows_pT_centr");
1073 aFolderObj->Add(h3D);
1074
1075 // Chi2PerClust
1076 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
1077 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,10);
1078
1079 h3D = (TH3D *)fRecMCTrackHist->Projection(1,9,15);
1080 h3D->SetName("rec_sec_material_Chi2PerClust_pT_centr");
1081 h3D->SetTitle("rec_sec_material_Chi2PerClust_pT_centr");
1082 aFolderObj->Add(h3D);
1083
1084 // Chi2PerClustITS
1085 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
1086 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,100);
1087
1088 h3D = (TH3D *)fRecMCTrackHist->Projection(2,9,15);
1089 h3D->SetName("rec_sec_material_Chi2PerClustITS_pT_centr");
1090 h3D->SetTitle("rec_sec_material_Chi2PerClustITS_pT_centr");
1091 aFolderObj->Add(h3D);
1092
1093
1094 // NCrossRowsOverFindable
1095 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1096 fRecMCTrackHist->GetAxis(3)->SetRangeUser(0,1.4999);
1097
1098 h3D = (TH3D *)fRecMCTrackHist->Projection(3,9,15);
1099 h3D->SetName("rec_sec_material_NCrossRowsOverFindable_pT_centr");
1100 h3D->SetTitle("rec_sec_material_NCrossRowsOverFindable_pT_centr");
1101 aFolderObj->Add(h3D);
1102
1103
1104 // FracSharedClust
1105 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1106 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,0.9999);
1107
1108 h3D = (TH3D *)fRecMCTrackHist->Projection(4,9,15);
1109 h3D->SetName("rec_sec_material_FracSharedClust_pT_centr");
1110 h3D->SetTitle("rec_sec_material_FracSharedClust_pT_centr");
1111 aFolderObj->Add(h3D);
1112
1113
1114 // DCAr
1115 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1116 fRecMCTrackHist->GetAxis(5)->SetRangeUser(-10.,9.9999);
1117
1118 h3D = (TH3D *)fRecMCTrackHist->Projection(5,9,15);
1119 h3D->SetName("rec_sec_material_DCAr_pT_centr");
1120 h3D->SetTitle("rec_sec_material_DCAr_pT_centr");
1121 aFolderObj->Add(h3D);
1122
1123
1124 // DCAz
1125 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1126 fRecMCTrackHist->GetAxis(6)->SetRangeUser(-10.,9.9999);
1127
1128 h3D = (TH3D *)fRecMCTrackHist->Projection(6,9,15);
1129 h3D->SetName("rec_sec_material_DCAz_pT_centr");
1130 h3D->SetTitle("rec_sec_material_DCAz_pT_centr");
1131 aFolderObj->Add(h3D);
1132
1133 // chi2ToTPCc
1134 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1135 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0,100);
1136
1137 h3D = (TH3D *)fRecMCTrackHist->Projection(16,9,15);
1138 h3D->SetName("rec_sec_material_chi2ToTPCc_pT_centr");
1139 h3D->SetTitle("rec_sec_material_chi2ToTPCc_pT_centr");
1140 aFolderObj->Add(h3D);
1141
1142
1143
1144 //
1145 // only TH3 histograms
1146 // x : pT : centr
1147 //
1148 // secondaries defined as AliStack::IsPhysicalPrimary()
1149 //
1150 fRecMCTrackHist->GetAxis(12)->SetRange(1,2);
1151 fRecMCTrackHist->GetAxis(13)->SetRange(1,1);
1152
1153 // set all cuts
1154 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
1155 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
1156 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1157 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1158 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1159 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1160 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1161 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minEta,maxEta-0.0001);
1162 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0.,maxChi2ToTPCc-0.0001);
1163
1164 // nCrossRows
1165 fRecMCTrackHist->GetAxis(0)->SetRangeUser(0,160);
1166
1167 h3D = (TH3D *)fRecMCTrackHist->Projection(0,9,15);
1168 h3D->SetName("rec_sec_nCrossRows_pT_centr");
1169 h3D->SetTitle("rec_sec_nCrossRows_pT_centr");
1170 aFolderObj->Add(h3D);
1171
1172 // Chi2PerClust
1173 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
1174 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,10);
1175
1176 h3D = (TH3D *)fRecMCTrackHist->Projection(1,9,15);
1177 h3D->SetName("rec_sec_Chi2PerClust_pT_centr");
1178 h3D->SetTitle("rec_sec_Chi2PerClust_pT_centr");
1179 aFolderObj->Add(h3D);
1180
1181 // Chi2PerClustITS
1182 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
1183 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,100);
1184
1185 h3D = (TH3D *)fRecMCTrackHist->Projection(2,9,15);
1186 h3D->SetName("rec_sec_Chi2PerClustITS_pT_centr");
1187 h3D->SetTitle("rec_sec_Chi2PerClustITS_pT_centr");
1188 aFolderObj->Add(h3D);
1189
1190
1191 // NCrossRowsOverFindable
1192 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1193 fRecMCTrackHist->GetAxis(3)->SetRangeUser(0,1.4999);
1194
1195 h3D = (TH3D *)fRecMCTrackHist->Projection(3,9,15);
1196 h3D->SetName("rec_sec_NCrossRowsOverFindable_pT_centr");
1197 h3D->SetTitle("rec_sec_NCrossRowsOverFindable_pT_centr");
1198 aFolderObj->Add(h3D);
1199
1200
1201 // FracSharedClust
1202 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1203 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,0.9999);
1204
1205 h3D = (TH3D *)fRecMCTrackHist->Projection(4,9,15);
1206 h3D->SetName("rec_sec_FracSharedClust_pT_centr");
1207 h3D->SetTitle("rec_sec_FracSharedClust_pT_centr");
1208 aFolderObj->Add(h3D);
1209
1210
1211 // DCAr
1212 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1213 fRecMCTrackHist->GetAxis(5)->SetRangeUser(-10.,9.9999);
1214
1215 h3D = (TH3D *)fRecMCTrackHist->Projection(5,9,15);
1216 h3D->SetName("rec_sec_DCAr_pT_centr");
1217 h3D->SetTitle("rec_sec_DCAr_pT_centr");
1218 aFolderObj->Add(h3D);
1219
1220
1221 // DCAz
1222 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1223 fRecMCTrackHist->GetAxis(6)->SetRangeUser(-10.,9.9999);
1224
1225 h3D = (TH3D *)fRecMCTrackHist->Projection(6,9,15);
1226 h3D->SetName("rec_sec_DCAz_pT_centr");
1227 h3D->SetTitle("rec_sec_DCAz_pT_centr");
1228 aFolderObj->Add(h3D);
1229
1230 // chi2ToTPCc
1231 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1232 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0,100);
1233
1234 h3D = (TH3D *)fRecMCTrackHist->Projection(16,9,15);
1235 h3D->SetName("rec_sec_chi2ToTPCc_pT_centr");
1236 h3D->SetTitle("rec_sec_chi2ToTPCc_pT_centr");
1237 aFolderObj->Add(h3D);
1238
1239 //
1240 // only TH3 histograms
1241 // x : pT : centr
1242 //
1243 // primaries defined as AliStack::IsPhysicalPrimary()
1244 //
1245 fRecMCTrackHist->GetAxis(12)->SetRange(1,2);
1246 fRecMCTrackHist->GetAxis(13)->SetRange(2,2);
1247
1248 // set all cuts
1249 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
1250 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
1251 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1252 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1253 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1254 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1255 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1256 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minEta,maxEta-0.0001);
1257 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0.,maxChi2ToTPCc-0.0001);
1258
1259 // nCrossRows
1260 fRecMCTrackHist->GetAxis(0)->SetRangeUser(0,160);
1261
1262 h3D = (TH3D *)fRecMCTrackHist->Projection(0,9,15);
1263 h3D->SetName("rec_prim_nCrossRows_pT_centr");
1264 h3D->SetTitle("rec_prim_nCrossRows_pT_centr");
1265 aFolderObj->Add(h3D);
1266
1267 // Chi2PerClust
1268 fRecMCTrackHist->GetAxis(0)->SetRangeUser(minNCrossRows,160);
1269 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,10);
1270
1271 h3D = (TH3D *)fRecMCTrackHist->Projection(1,9,15);
1272 h3D->SetName("rec_prim_Chi2PerClust_pT_centr");
1273 h3D->SetTitle("rec_prim_Chi2PerClust_pT_centr");
1274 aFolderObj->Add(h3D);
1275
1276 // Chi2PerClustITS
1277 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,maxChi2PerClust-0.0001);
1278 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,100);
1279
1280 h3D = (TH3D *)fRecMCTrackHist->Projection(2,9,15);
1281 h3D->SetName("rec_prim_Chi2PerClustITS_pT_centr");
1282 h3D->SetTitle("rec_prim_Chi2PerClustITS_pT_centr");
1283 aFolderObj->Add(h3D);
1284
1285
1286 // NCrossRowsOverFindable
1287 fRecMCTrackHist->GetAxis(2)->SetRangeUser(0.,maxChi2PerClustITS-0.0001);
1288 fRecMCTrackHist->GetAxis(3)->SetRangeUser(0,1.4999);
1289
1290 h3D = (TH3D *)fRecMCTrackHist->Projection(3,9,15);
1291 h3D->SetName("rec_prim_NCrossRowsOverFindable_pT_centr");
1292 h3D->SetTitle("rec_prim_NCrossRowsOverFindable_pT_centr");
1293 aFolderObj->Add(h3D);
1294
1295
1296 // FracSharedClust
1297 fRecMCTrackHist->GetAxis(3)->SetRangeUser(minNCrossRowsOverFindable,1.4999);
1298 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,0.9999);
1299
1300 h3D = (TH3D *)fRecMCTrackHist->Projection(4,9,15);
1301 h3D->SetName("rec_prim_FracSharedClust_pT_centr");
1302 h3D->SetTitle("rec_prim_FracSharedClust_pT_centr");
1303 aFolderObj->Add(h3D);
1304
1305
1306 // DCAr
1307 fRecMCTrackHist->GetAxis(4)->SetRangeUser(0.,maxFracSharedClust-0.0001);
1308 fRecMCTrackHist->GetAxis(5)->SetRangeUser(-10.,9.9999);
1309
1310 h3D = (TH3D *)fRecMCTrackHist->Projection(5,9,15);
1311 h3D->SetName("rec_prim_DCAr_pT_centr");
1312 h3D->SetTitle("rec_prim_DCAr_pT_centr");
1313 aFolderObj->Add(h3D);
1314
1315
1316 // DCAz
1317 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minDCAr,maxDCAr-0.0001);
1318 fRecMCTrackHist->GetAxis(6)->SetRangeUser(-10.,9.9999);
1319
1320 h3D = (TH3D *)fRecMCTrackHist->Projection(6,9,15);
1321 h3D->SetName("rec_prim_DCAz_pT_centr");
1322 h3D->SetTitle("rec_prim_DCAz_pT_centr");
1323 aFolderObj->Add(h3D);
1324
1325 // chi2ToTPCc
1326 fRecMCTrackHist->GetAxis(6)->SetRangeUser(minDCAz,maxDCAz-0.0001);
1327 fRecMCTrackHist->GetAxis(16)->SetRangeUser(0,100);
1328
1329 h3D = (TH3D *)fRecMCTrackHist->Projection(16,9,15);
1330 h3D->SetName("rec_prim_chi2ToTPCc_pT_centr");
1331 h3D->SetTitle("rec_prim_chi2ToTPCc_pT_centr");
1332 aFolderObj->Add(h3D);
1333
1334 }
1335
1336 // export objects to analysis folder
1337 fAnalysisFolder = ExportToFolder(aFolderObj);
1338 if(!fAnalysisFolder) {
1339 if(aFolderObj) delete aFolderObj;
1340 return;
1341 }
1342
1343 // Reset setings
1344
1345 for(Int_t ndim = 0; ndim < fEventCount->GetNdimensions(); ndim++) {
1346 fEventCount->GetAxis(ndim)->SetRange(1,fEventCount->GetAxis(ndim)->GetNbins());
1347 }
1348
1349 for(Int_t ndim = 0; ndim < fMCEventHist->GetNdimensions(); ndim++) {
1350 fMCEventHist->GetAxis(ndim)->SetRange(1,fMCEventHist->GetAxis(ndim)->GetNbins());
1351 }
1352
1353 for(Int_t ndim = 0; ndim < fRecMCEventHist->GetNdimensions(); ndim++) {
1354 fRecMCEventHist->GetAxis(ndim)->SetRange(1,fRecMCEventHist->GetAxis(ndim)->GetNbins());
1355 }
1356
1357 for(Int_t ndim = 0; ndim < fRecMCTrackHist->GetNdimensions(); ndim++)
1358 {
1359 fRecMCTrackHist->GetAxis(ndim)->SetRange(1,fRecMCTrackHist->GetAxis(ndim)->GetNbins());
1360 }
1361
1362 // delete only TObjArray
1363 //if(aFolderObj) delete aFolderObj;
1364
1365 if (fFolderObj) delete fFolderObj;
1366 fFolderObj = aFolderObj;
1367 aFolderObj=0;
1368}
1369
1370//_____________________________________________________________________________
1371TFolder* AlidNdPtCutAnalysisPbPb::ExportToFolder(TObjArray * const array)
1372{
1373 // recreate folder avery time and export objects to new one
1374 //
1375 AlidNdPtCutAnalysisPbPb * comp=this;
1376 TFolder *folder = comp->GetAnalysisFolder();
1377
1378 TString name, title;
1379 TFolder *newFolder = 0;
1380 Int_t i = 0;
1381 Int_t size = array->GetSize();
1382
1383 if(folder) {
1384 // get name and title from old folder
1385 name = folder->GetName();
1386 title = folder->GetTitle();
1387
1388 // delete old one
1389 delete folder;
1390
1391 // create new one
1392 newFolder = CreateFolder(name.Data(),title.Data());
1393 newFolder->SetOwner();
1394
1395 // add objects to folder
1396 while(i < size) {
1397 newFolder->Add(array->At(i));
1398 i++;
1399 }
1400 }
1401
1402return newFolder;
1403}
1404
1405//_____________________________________________________________________________
1406TFolder* AlidNdPtCutAnalysisPbPb::CreateFolder(TString name,TString title) {
1407// create folder for analysed histograms
1408//
1409TFolder *folder = 0;
1410 folder = new TFolder(name.Data(),title.Data());
1411
1412 return folder;
1413}