PWGUD/dNdPt -> PWGLF/SPECTRA/ChargedHadrons/dNdPt
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / 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
eb63d47d 33#include "AliInputEventHandler.h" \r
0aaa8b91 34#include "AliStack.h" \r
35#include "AliESDEvent.h" \r
36#include "AliMCEvent.h" \r
37#include "AliESDtrackCuts.h" \r
38#include "AliLog.h" \r
7f7dd416 39#include "AliTracker.h" \r
0aaa8b91 40\r
41#include "AlidNdPtEventCuts.h"\r
42#include "AlidNdPtAcceptanceCuts.h"\r
7f7dd416 43#include "AlidNdPtBackgroundCuts.h"\r
17e8c701 44#include "AlidNdPtAnalysis.h"\r
d269b0e6 45#include "AliPhysicsSelection.h"\r
0aaa8b91 46\r
bad4ba69 47#include "AliPWG0Helper.h"\r
48#include "AlidNdPtHelper.h"\r
0aaa8b91 49#include "AlidNdPtCutAnalysis.h"\r
50\r
51using namespace std;\r
52\r
53ClassImp(AlidNdPtCutAnalysis)\r
54\r
55//_____________________________________________________________________________\r
56 AlidNdPtCutAnalysis::AlidNdPtCutAnalysis(): AlidNdPt(),\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 // default constructor\r
65 Init();\r
66}\r
67\r
68//_____________________________________________________________________________\r
69AlidNdPtCutAnalysis::AlidNdPtCutAnalysis(Char_t* name, Char_t* title): AlidNdPt(name,title),\r
70 fAnalysisFolder(0),\r
985bdfd5 71 fEventCount(0),\r
0aaa8b91 72 fRecEventHist(0),\r
73 fMCEventHist(0),\r
74 fRecMCEventHist(0),\r
75 fRecMCTrackHist(0)\r
76{\r
77 // constructor\r
78 Init();\r
79}\r
80\r
81//_____________________________________________________________________________\r
82AlidNdPtCutAnalysis::~AlidNdPtCutAnalysis() {\r
83 // \r
985bdfd5 84 if(fEventCount) delete fEventCount; fEventCount=0;\r
0aaa8b91 85 if(fRecEventHist) delete fRecEventHist; fRecEventHist=0;\r
86 if(fMCEventHist) delete fMCEventHist; fMCEventHist=0;\r
87 if(fRecMCEventHist) delete fRecMCEventHist; fRecMCEventHist=0;\r
88 if(fRecMCTrackHist) delete fRecMCTrackHist; fRecMCTrackHist=0;\r
89\r
90 if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;\r
91}\r
92\r
93//_____________________________________________________________________________\r
94void AlidNdPtCutAnalysis::Init(){\r
95 //\r
96 // Init histograms\r
97 //\r
eb63d47d 98 /*\r
0aaa8b91 99 const Int_t ptNbins = 56; \r
100 const Double_t ptMin = 0.; \r
101 const Double_t ptMax = 16.; \r
0aaa8b91 102 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
eb63d47d 103 */\r
104 // set pt bins\r
105 const Int_t ptNbins = 50;\r
106 const Double_t ptMin = 1.e-2, ptMax = 50.;\r
107 Double_t *binsPt = CreateLogAxis(ptNbins,ptMin,ptMax);\r
0aaa8b91 108\r
985bdfd5 109 // \r
110 Int_t binsEventCount[2]={2,2};\r
111 Double_t minEventCount[2]={0,0}; \r
112 Double_t maxEventCount[2]={2,2}; \r
113 fEventCount = new THnSparseF("fEventCount","trig vs trig+vertex",2,binsEventCount,minEventCount,maxEventCount);\r
114 fEventCount->GetAxis(0)->SetTitle("trig");\r
115 fEventCount->GetAxis(1)->SetTitle("trig+vert");\r
116 fEventCount->Sumw2();\r
117\r
0aaa8b91 118 //Xv:Yv:Zv:ResZv:Mult\r
a8ac5525 119 Double_t kFact = 1.0;\r
00b81913 120\r
f537848a 121 Int_t binsRecEventHist[5]={80,80,100,80,150};\r
00b81913 122 Double_t minRecEventHist[5]={-3.*kFact,-3.*kFact,-35.,0.,0.}; \r
123 Double_t maxRecEventHist[5]={3.*kFact,3.*kFact,35.,10.,150.}; \r
0aaa8b91 124 fRecEventHist = new THnSparseF("fRecEventHist","Xv:Yv:Zv:ResZv:Mult",5,binsRecEventHist,minRecEventHist,maxRecEventHist);\r
125 fRecEventHist->GetAxis(0)->SetTitle("Xv (cm)");\r
126 fRecEventHist->GetAxis(1)->SetTitle("Yv (cm)");\r
127 fRecEventHist->GetAxis(2)->SetTitle("Zv (cm)");\r
128 fRecEventHist->GetAxis(3)->SetTitle("ResZv (cm)");\r
129 fRecEventHist->GetAxis(4)->SetTitle("Mult");\r
130 fRecEventHist->Sumw2();\r
131\r
132 //Xv:Yv:Zv\r
f537848a 133 Int_t binsMCEventHist[3]={80,80,100};\r
0aaa8b91 134 Double_t minMCEventHist[3]={-0.1,-0.1,-35.}; \r
135 Double_t maxMCEventHist[3]={0.1,0.1,35.}; \r
136 fMCEventHist = new THnSparseF("fMCEventHist","mcXv:mcYv:mcZv",3,binsMCEventHist,minMCEventHist,maxMCEventHist);\r
137 fMCEventHist->GetAxis(0)->SetTitle("mcXv (cm)");\r
138 fMCEventHist->GetAxis(1)->SetTitle("mcYv (cm)");\r
139 fMCEventHist->GetAxis(2)->SetTitle("mcZv (cm)");\r
140 fMCEventHist->Sumw2();\r
141\r
142 //Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult\r
143 Int_t binsRecMCEventHist[4]={100,100,100,150};\r
a8ac5525 144 Double_t minRecMCEventHist[4]={-1.0*kFact,-1.0*kFact,-1.0*kFact,0.}; \r
145 Double_t maxRecMCEventHist[4]={1.0*kFact,1.0*kFact,1.0*kFact,150.}; \r
7f7dd416 146 fRecMCEventHist = new THnSparseF("fRecMCEventHist","Xv-mcXv:Yv-mcYv:Zv-mcZv:Mult",4,binsRecMCEventHist,minRecMCEventHist,maxRecMCEventHist);\r
147 fRecMCEventHist->GetAxis(0)->SetTitle("Xv-mcXv (cm)");\r
148 fRecMCEventHist->GetAxis(1)->SetTitle("Yv-mcYv (cm)");\r
149 fRecMCEventHist->GetAxis(2)->SetTitle("Zv-mcZv (cm)");\r
0aaa8b91 150 fRecMCEventHist->GetAxis(3)->SetTitle("Mult");\r
151 fRecMCEventHist->Sumw2();\r
152\r
153 //\r
154 // THnSparse track histograms\r
155 //\r
156\r
eb63d47d 157 //nCrossRows:chi2PerClust:nCrossRows/nFindableClust:fracSharedClust:DCAy:DCAz:eta:phi:pt:hasStrangeMother:isFromMaterial:isPrim:charge\r
62e3b4b6 158 Int_t binsRecMCTrackHist[13]= { 160, 10, 20, 20, 50, 50, 20, 90, ptNbins, 2, 2, 2, 3 };\r
159 Double_t minRecMCTrackHist[13]={ 0., 0., 0., 0., -0.5,-0.5,-1.0, 0., ptMin, 0., 0., 0.,-1. };\r
160 Double_t maxRecMCTrackHist[13]={ 160., 10., 1., 1., 0.5, 0.5, 1.0, 2.*TMath::Pi(), ptMax, 2., 2., 2., 2. };\r
eb63d47d 161\r
162 fRecMCTrackHist = new THnSparseF("fRecMCTrackHist","nCrossRows:chi2PerClust:nCrossRows/nFindableClust:fracSharedClust:DCAy:DCAz:eta:phi:pt:hasStrangeMother:isFromMaterial:isPrim:charge",13,binsRecMCTrackHist,minRecMCTrackHist,maxRecMCTrackHist);\r
163 fRecMCTrackHist->SetBinEdges(8,binsPt);\r
164 fRecMCTrackHist->GetAxis(0)->SetTitle("nCrossRows");\r
165 fRecMCTrackHist->GetAxis(1)->SetTitle("chi2PerClust");\r
166 fRecMCTrackHist->GetAxis(2)->SetTitle("nCrossRows/nFindableClust");\r
167 fRecMCTrackHist->GetAxis(3)->SetTitle("fracSharedClust");\r
168 fRecMCTrackHist->GetAxis(4)->SetTitle("DCAy (cm)");\r
169 fRecMCTrackHist->GetAxis(5)->SetTitle("DCAz (cm)");\r
170 fRecMCTrackHist->GetAxis(6)->SetTitle("#eta");\r
171 fRecMCTrackHist->GetAxis(7)->SetTitle("#phi (rad)");\r
172 fRecMCTrackHist->GetAxis(8)->SetTitle("p_{T} (GeV/c)");\r
173 fRecMCTrackHist->GetAxis(9)->SetTitle("hasStrangeMother");\r
174 fRecMCTrackHist->GetAxis(10)->SetTitle("isFromMaterial");\r
175 fRecMCTrackHist->GetAxis(11)->SetTitle("isPrim");\r
176 fRecMCTrackHist->GetAxis(12)->SetTitle("charge");\r
177 fRecMCTrackHist->Sumw2();\r
178\r
7a761ceb 179 //nClust:chi2PerClust:nClust/nFindableClust:DCAy:DCAz:eta:phi:pt:kinkIdx:isPrim:polarity\r
eb63d47d 180 /*\r
de93884d 181 Int_t binsRecMCTrackHist[11]={160,80,80,100,100,90,90,ptNbins, 3, 2, 2};\r
182 Double_t minRecMCTrackHist[11]={0., 0., 0., -1.,-1.,-1.5, 0., ptMin, -1., 0., 0.};\r
183 Double_t maxRecMCTrackHist[11]={160.,10.,1.2, 1.,1.,1.5, 2.*TMath::Pi(), ptMax, 2., 2., 2.};\r
0aaa8b91 184\r
7a761ceb 185 fRecMCTrackHist = new THnSparseF("fRecMCTrackHist","nClust:chi2PerClust:nClust/nFindableClust:DCAy:DCAz:eta:phi:pt:kinkIdx:isPrim:polarity",11,binsRecMCTrackHist,minRecMCTrackHist,maxRecMCTrackHist);\r
0aaa8b91 186 fRecMCTrackHist->SetBinEdges(7,binsPt);\r
187\r
188 fRecMCTrackHist->GetAxis(0)->SetTitle("nClust");\r
189 fRecMCTrackHist->GetAxis(1)->SetTitle("chi2PerClust");\r
190 fRecMCTrackHist->GetAxis(2)->SetTitle("nClust/nFindableClust");\r
191 fRecMCTrackHist->GetAxis(3)->SetTitle("DCAy (cm)");\r
192 fRecMCTrackHist->GetAxis(4)->SetTitle("DCAz (cm)");\r
193 fRecMCTrackHist->GetAxis(5)->SetTitle("#eta");\r
194 fRecMCTrackHist->GetAxis(6)->SetTitle("#phi (rad)");\r
195 fRecMCTrackHist->GetAxis(7)->SetTitle("p_{T} (GeV/c)");\r
7a761ceb 196 fRecMCTrackHist->GetAxis(8)->SetTitle("kinkIdx"); // 0 - no kink, -1 - kink mother, 1 - kink daugther \r
0aaa8b91 197 fRecMCTrackHist->GetAxis(9)->SetTitle("isPrim");\r
d269b0e6 198 fRecMCTrackHist->GetAxis(10)->SetTitle("polarity");\r
0aaa8b91 199 fRecMCTrackHist->Sumw2();\r
eb63d47d 200 */\r
0aaa8b91 201\r
202 // init output folder\r
203 fAnalysisFolder = CreateFolder("folderdNdPt","Analysis dNdPt Folder");\r
204\r
205}\r
206\r
207//_____________________________________________________________________________\r
208void AlidNdPtCutAnalysis::Process(AliESDEvent *const esdEvent, AliMCEvent * const mcEvent)\r
209{\r
210 //\r
211 // Process real and/or simulated events\r
212 //\r
213 if(!esdEvent) {\r
214 AliDebug(AliLog::kError, "esdEvent not available");\r
215 return;\r
216 }\r
217\r
bad4ba69 218 // get selection cuts\r
0aaa8b91 219 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
220 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
221 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
222\r
bad4ba69 223 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
0aaa8b91 224 AliDebug(AliLog::kError, "cuts not available");\r
225 return;\r
226 }\r
227\r
bad4ba69 228 // trigger selection\r
eb63d47d 229\r
bad4ba69 230 Bool_t isEventTriggered = kTRUE;\r
eb63d47d 231 AliPhysicsSelection *physicsSelection = NULL;\r
232 AliTriggerAnalysis* triggerAnalysis = NULL;\r
17e8c701 233\r
eb63d47d 234 // \r
235 AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();\r
236 if (!inputHandler)\r
7f7dd416 237 {\r
eb63d47d 238 Printf("ERROR: Could not receive input handler");\r
239 return;\r
240 }\r
17e8c701 241\r
eb63d47d 242 if(evtCuts->IsTriggerRequired()) \r
243 {\r
244 // always MB\r
245 isEventTriggered = inputHandler->IsEventSelected() & AliVEvent::kMB;\r
246\r
247 physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection());\r
248 if(!physicsSelection) return;\r
249 //SetPhysicsTriggerSelection(physicsSelection);\r
250\r
251 if (isEventTriggered && (GetTrigger() == AliTriggerAnalysis::kV0AND)) {\r
252 // set trigger (V0AND)\r
253 triggerAnalysis = physicsSelection->GetTriggerAnalysis();\r
254 if(!triggerAnalysis) return;\r
255 isEventTriggered = triggerAnalysis->IsOfflineTriggerFired(esdEvent, GetTrigger());\r
f537848a 256 }\r
bad4ba69 257 }\r
258\r
0aaa8b91 259 // use MC information\r
260 AliHeader* header = 0;\r
261 AliGenEventHeader* genHeader = 0;\r
262 AliStack* stack = 0;\r
263 TArrayF vtxMC(3);\r
bad4ba69 264 AliPWG0Helper::MCProcessType evtType = AliPWG0Helper::kInvalidProcess;\r
0aaa8b91 265\r
266 if(IsUseMCInfo())\r
267 {\r
268 if(!mcEvent) {\r
269 AliDebug(AliLog::kError, "mcEvent not available");\r
270 return;\r
271 }\r
272\r
273 // get MC event header\r
274 header = mcEvent->Header();\r
275 if (!header) {\r
276 AliDebug(AliLog::kError, "Header not available");\r
277 return;\r
278 }\r
279\r
280 // MC particle stack\r
281 stack = mcEvent->Stack();\r
282 if (!stack) {\r
283 AliDebug(AliLog::kError, "Stack not available");\r
284 return;\r
285 }\r
286\r
287 // get event type (ND=0x1, DD=0x2, SD=0x4)\r
bad4ba69 288 evtType = AliPWG0Helper::GetEventProcessType(header);\r
0aaa8b91 289 AliDebug(AliLog::kDebug+1, Form("Found process type %d", evtType));\r
290\r
291 // get MC vertex\r
292 genHeader = header->GenEventHeader();\r
293 if (!genHeader) {\r
294 AliDebug(AliLog::kError, "Could not retrieve genHeader from Header");\r
295 return;\r
296 }\r
297 genHeader->PrimaryVertex(vtxMC);\r
298\r
299 // Fill MC event histogram\r
300 Double_t vMCEventHist[3]={vtxMC[0],vtxMC[1],vtxMC[2]};\r
301 fMCEventHist->Fill(vMCEventHist);\r
302\r
303 } // end bUseMC\r
304\r
305 // get reconstructed vertex \r
bad4ba69 306 Bool_t bRedoTPCVertex = evtCuts->IsRedoTPCVertex();\r
307 Bool_t bUseConstraints = evtCuts->IsUseBeamSpotConstraint();\r
308 const AliESDVertex* vtxESD = AlidNdPtHelper::GetVertex(esdEvent,evtCuts,accCuts,esdTrackCuts,GetAnalysisMode(),kFALSE,bRedoTPCVertex,bUseConstraints); \r
791aaf54 309 Bool_t isRecVertex = AlidNdPtHelper::TestRecVertex(vtxESD, esdEvent->GetPrimaryVertexSPD(), GetAnalysisMode(), kFALSE);\r
0aaa8b91 310 Bool_t isEventOK = evtCuts->AcceptEvent(esdEvent,mcEvent,vtxESD) && isRecVertex;\r
311\r
312 TObjArray *allChargedTracks=0;\r
313 Int_t multAll=0;\r
985bdfd5 314 \r
315 //\r
316 // event counter\r
317 // \r
318 //printf("isEventOK %d, isEventTriggered %d \n",isEventOK,isEventTriggered);\r
319\r
320 Bool_t isTrigAndVertex = isEventTriggered && isEventOK;\r
321 Double_t vEventCount[2] = { isEventTriggered, isTrigAndVertex};\r
322 fEventCount->Fill(vEventCount);\r
0aaa8b91 323\r
7f7dd416 324 //\r
325 // cosmic background and splitted tracks\r
326 //\r
327 if(GetParticleMode() == AlidNdPtHelper::kBackgroundTrack) \r
328 {\r
329 AlidNdPtBackgroundCuts *backCuts = GetBackgroundCuts(); \r
330 if(!backCuts) return;\r
331\r
332 for (Int_t iTrack = 0; iTrack < esdEvent->GetNumberOfTracks(); iTrack++) \r
333 {\r
334 AliESDtrack *track1 = esdEvent->GetTrack(iTrack);\r
335 if(!track1) continue; \r
336 if(track1->Charge()==0) continue; \r
337\r
338 for (Int_t jTrack = iTrack+1; jTrack < esdEvent->GetNumberOfTracks(); jTrack++) \r
339 {\r
340 AliESDtrack *track2 = esdEvent->GetTrack(jTrack);\r
341 if(!track2) continue; \r
342 if(track2->Charge()==0) continue; \r
343\r
344 //printf("track2->Charge() %d\n",track2->Charge());\r
345\r
346 backCuts->IsBackgroundTrack(track1, track2);\r
347 }\r
348 }\r
349 }\r
350\r
0aaa8b91 351 // check event cuts\r
352 if(isEventOK && isEventTriggered)\r
353 {\r
354 // get all charged tracks\r
bad4ba69 355 allChargedTracks = AlidNdPtHelper::GetAllChargedTracks(esdEvent,GetAnalysisMode());\r
0aaa8b91 356 if(!allChargedTracks) return;\r
357\r
358 Int_t entries = allChargedTracks->GetEntries();\r
359 for(Int_t i=0; i<entries;++i) \r
360 {\r
361 AliESDtrack *track = (AliESDtrack*)allChargedTracks->At(i);\r
362 if(!track) continue;\r
363\r
7a761ceb 364 if(!esdTrackCuts->AcceptTrack(track)) continue;\r
365\r
847e74b2 366 //\r
7f7dd416 367 Bool_t isOK = kFALSE;\r
368 Double_t x[3]; track->GetXYZ(x);\r
369 Double_t b[3]; AliTracker::GetBxByBz(x,b);\r
370\r
371 //\r
372 // if TPC-ITS hybrid tracking (kTPCITSHybrid)\r
373 // replace track parameters with TPC-ony track parameters\r
374 //\r
791aaf54 375 if( GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybrid || GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtx || GetAnalysisMode() == AlidNdPtHelper::kTPCITSHybridTrackSPDvtxDCArPt) \r
7f7dd416 376 {\r
377 // Relate TPC-only tracks to SPD vertex\r
791aaf54 378 isOK = track->RelateToVertexTPCBxByBz(vtxESD, b, kVeryBig);\r
7f7dd416 379 if(!isOK) continue;\r
380\r
381 // replace esd track parameters with TPCinner\r
382 AliExternalTrackParam *tpcTrack = new AliExternalTrackParam(*(track->GetTPCInnerParam()));\r
383 if (!tpcTrack) return;\r
384 track->Set(tpcTrack->GetX(),tpcTrack->GetAlpha(),tpcTrack->GetParameter(),tpcTrack->GetCovariance());\r
385\r
386 if(tpcTrack) delete tpcTrack; \r
387 } \r
388\r
389 //\r
791aaf54 390 if (GetAnalysisMode()==AlidNdPtHelper::kTPCSPDvtxUpdate || GetAnalysisMode() == AlidNdPtHelper::kTPCTrackSPDvtxUpdate) \r
847e74b2 391 {\r
392 //\r
393 // update track parameters\r
394 //\r
7f7dd416 395 AliExternalTrackParam cParam;\r
791aaf54 396 isOK = track->RelateToVertexTPCBxByBz(vtxESD, b, kVeryBig, &cParam);\r
7f7dd416 397 if(!isOK) continue;\r
398\r
399 track->Set(cParam.GetX(),cParam.GetAlpha(),cParam.GetParameter(),cParam.GetCovariance());\r
847e74b2 400 }\r
401\r
0aaa8b91 402 FillHistograms(track, stack);\r
403 multAll++;\r
404 }\r
0aaa8b91 405\r
7f7dd416 406 Double_t vRecEventHist[5] = {vtxESD->GetXv(),vtxESD->GetYv(),vtxESD->GetZv(),vtxESD->GetZRes(),multAll};\r
407 fRecEventHist->Fill(vRecEventHist);\r
0aaa8b91 408\r
7f7dd416 409 if(IsUseMCInfo()) {\r
410 Double_t vRecMCEventHist[5] = {vtxESD->GetXv()-vtxMC[0],vtxESD->GetYv()-vtxMC[1],vtxESD->GetZv()-vtxMC[2],multAll};\r
411 fRecMCEventHist->Fill(vRecMCEventHist);\r
412 }\r
bad4ba69 413 }\r
0aaa8b91 414\r
415 if(allChargedTracks) delete allChargedTracks; allChargedTracks = 0;\r
f537848a 416\r
0aaa8b91 417}\r
418\r
419//_____________________________________________________________________________\r
00b81913 420void AlidNdPtCutAnalysis::FillHistograms(AliESDtrack *const esdTrack, AliStack *const stack) const\r
0aaa8b91 421{\r
422 //\r
423 // Fill ESD track and MC histograms \r
424 //\r
425 if(!esdTrack) return;\r
bad4ba69 426 if(esdTrack->Charge() == 0.) return;\r
0aaa8b91 427\r
0aaa8b91 428 Float_t pt = esdTrack->Pt();\r
429 Float_t eta = esdTrack->Eta();\r
430 Float_t phi = esdTrack->Phi();\r
eb63d47d 431\r
432\r
433 Int_t nClust = 0;\r
434 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) { \r
435 nClust = esdTrack->GetTPCNclsIter1();\r
436 } else {\r
437 nClust = esdTrack->GetTPCclusters(0);\r
438 }\r
0aaa8b91 439\r
440 Float_t chi2PerCluster = 0.;\r
eb63d47d 441 if(GetAnalysisMode() == AlidNdPtHelper::kTPC) { \r
442 if(nClust>0.) chi2PerCluster = esdTrack->GetTPCchi2Iter1()/Float_t(nClust);\r
443 } else {\r
444 chi2PerCluster = esdTrack->GetTPCchi2()/Float_t(nClust);\r
445 }\r
0aaa8b91 446\r
eb63d47d 447 Int_t nFindableClust = esdTrack->GetTPCNclsF();\r
448\r
449 \r
0aaa8b91 450 Float_t clustPerFindClust = 0.;\r
451 if(nFindableClust>0.) clustPerFindClust = Float_t(nClust)/nFindableClust;\r
452\r
453 Float_t b[2], bCov[3];\r
454 esdTrack->GetImpactParameters(b,bCov);\r
455\r
eb63d47d 456 // \r
457 Float_t nCrossedRowsTPC = esdTrack->GetTPCClusterInfo(2,1);\r
458\r
459 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
460 if (esdTrack->GetTPCNclsF()>0) {\r
461 ratioCrossedRowsOverFindableClustersTPC = esdTrack->GetTPCClusterInfo(2,1)/esdTrack->GetTPCNclsF();\r
462 }\r
463\r
464 //\r
465 Int_t nClustersTPCShared = esdTrack->GetTPCnclsS();\r
466 Float_t fracClustersTPCShared = -1.;\r
467 fracClustersTPCShared = Float_t(nClustersTPCShared)/Float_t(nClust);\r
468\r
469\r
7a761ceb 470 // kink idx\r
471 Int_t kinkIdx = 0;\r
472 //if(esdTrack->GetKinkIndex(0) > 0.) isKink = kTRUE;\r
473 if(esdTrack->GetKinkIndex(0) > 0) kinkIdx = 1; // kink daughter\r
474 else if(esdTrack->GetKinkIndex(0) < 0) kinkIdx = -1; // kink mother\r
475 else kinkIdx = 0; // not kink\r
476\r
477 //printf("esdTrack->GetKinkIndex(0) %d \n", esdTrack->GetKinkIndex(0));\r
478 //printf("esdTrack->GetKinkIndex(1) %d \n", esdTrack->GetKinkIndex(1));\r
479 //printf("esdTrack->GetKinkIndex(2) %d \n", esdTrack->GetKinkIndex(2));\r
480 //printf("kinkIdx %d \n", kinkIdx);\r
0aaa8b91 481\r
482 //\r
483 // Fill rec vs MC information\r
484 //\r
bad4ba69 485 Bool_t isPrim = kTRUE;\r
eb63d47d 486 Bool_t hasStrangeMother = kFALSE;\r
487 Bool_t isFromMaterial = kFALSE;\r
bad4ba69 488\r
489 if(IsUseMCInfo()) {\r
490 if(!stack) return;\r
491 Int_t label = TMath::Abs(esdTrack->GetLabel()); \r
492 TParticle* particle = stack->Particle(label);\r
493 if(!particle) return;\r
494 if(particle->GetPDG() && particle->GetPDG()->Charge()==0.) return;\r
495 isPrim = stack->IsPhysicalPrimary(label);\r
0aaa8b91 496\r
eb63d47d 497 // check whether has stange mother\r
498 //\r
499 Int_t motherPdg = -1; \r
500 TParticle* mother = 0; \r
501 \r
502 Int_t motherLabel = particle->GetMother(0); \r
503 if(motherLabel>0) mother = stack->Particle(motherLabel); \r
504 if(mother) motherPdg = TMath::Abs(mother->GetPdgCode()); // take abs for visualisation only \r
505 Int_t mech = particle->GetUniqueID(); // production mechanism \r
506\r
507 if( (motherPdg == 3122) || (motherPdg == -3122) || (motherPdg == 310)) // lambda, antilambda, k0s\r
508 {\r
509 if( (mech == 4) || (mech == 5) ) hasStrangeMother = kTRUE;\r
510 } \r
511 else {\r
512 //if(isPrim==0 && mech == 13) \r
513 //printf("mech %d \n", mech);\r
514 if(!isPrim) isFromMaterial = kTRUE; \r
515 }\r
516\r
7a761ceb 517 //if(isPrim && pt > 1.5 && kinkIdx == -1) printf("nClust %d \n", nClust);\r
518 }\r
519 \r
0aaa8b91 520 // fill histo\r
eb63d47d 521 Int_t charge = esdTrack->Charge(); \r
522\r
523 //Double_t vRecMCTrackHist[11] = { nClust,chi2PerCluster,clustPerFindClust,b[0],b[1],eta,phi,pt,kinkIdx,isPrim, polarity }; \r
524 //fRecMCTrackHist->Fill(vRecMCTrackHist);\r
525\r
526 Double_t vRecMCTrackHist[13] = { nCrossedRowsTPC, chi2PerCluster, ratioCrossedRowsOverFindableClustersTPC, fracClustersTPCShared , b[0], b[1], eta, phi, pt, hasStrangeMother, isFromMaterial, isPrim, charge }; \r
0aaa8b91 527 fRecMCTrackHist->Fill(vRecMCTrackHist);\r
eb63d47d 528\r
0aaa8b91 529}\r
530\r
531//_____________________________________________________________________________\r
00b81913 532Long64_t AlidNdPtCutAnalysis::Merge(TCollection* const list) \r
0aaa8b91 533{\r
534 // Merge list of objects (needed by PROOF)\r
535\r
536 if (!list)\r
537 return 0;\r
538\r
539 if (list->IsEmpty())\r
540 return 1;\r
541\r
542 TIterator* iter = list->MakeIterator();\r
543 TObject* obj = 0;\r
544\r
7f7dd416 545 //TList *collPhysSelection = new TList;\r
546\r
0aaa8b91 547 // collection of generated histograms\r
548 Int_t count=0;\r
549 while((obj = iter->Next()) != 0) {\r
550 AlidNdPtCutAnalysis* entry = dynamic_cast<AlidNdPtCutAnalysis*>(obj);\r
551 if (entry == 0) continue; \r
552 \r
553 // event histo\r
985bdfd5 554 fEventCount->Add(entry->fEventCount);\r
0aaa8b91 555 fRecEventHist->Add(entry->fRecEventHist);\r
556 fRecMCEventHist->Add(entry->fRecMCEventHist);\r
557 fMCEventHist->Add(entry->fMCEventHist);\r
558\r
559 // track histo\r
560 fRecMCTrackHist->Add(entry->fRecMCTrackHist);\r
7f7dd416 561\r
562 // physics selection\r
563 //collPhysSelection->Add(entry->GetPhysicsTriggerSelection());\r
0aaa8b91 564 \r
565 count++;\r
566 }\r
567\r
7f7dd416 568 //AliPhysicsSelection *trigSelection = GetPhysicsTriggerSelection();\r
569 //trigSelection->Merge(collPhysSelection);\r
570\r
571 //if(collPhysSelection) delete collPhysSelection;\r
572\r
0aaa8b91 573return count;\r
574}\r
575\r
576//_____________________________________________________________________________\r
577void AlidNdPtCutAnalysis::Analyse() \r
578{\r
579 //\r
580 // Analyse histograms\r
581 //\r
582 TH1::AddDirectory(kFALSE);\r
583 TObjArray *aFolderObj = new TObjArray;\r
62e3b4b6 584 if(!aFolderObj) return;\r
585\r
0aaa8b91 586 TH1D *h1D = 0; \r
587 TH2D *h2D = 0; \r
588\r
589\r
590 //\r
591 // get cuts\r
592 //\r
593 AlidNdPtEventCuts *evtCuts = GetEventCuts(); \r
594 AlidNdPtAcceptanceCuts *accCuts = GetAcceptanceCuts(); \r
595 AliESDtrackCuts *esdTrackCuts = GetTrackCuts(); \r
596\r
597 if(!evtCuts || !accCuts || !esdTrackCuts) {\r
598 Error("AlidNdPtCutAnalysis::Analyse()", "cuts not available");\r
599 return;\r
600 }\r
601\r
602 //\r
603 // set min and max values\r
604 //\r
605 Double_t minPt = accCuts->GetMinPt();\r
606 Double_t maxPt = accCuts->GetMaxPt();\r
607 Double_t minEta = accCuts->GetMinEta();\r
608 Double_t maxEta = accCuts->GetMaxEta()-0.00001;\r
609\r
bad4ba69 610 Double_t maxDCAr = accCuts->GetMaxDCAr();\r
611\r
0aaa8b91 612 //\r
985bdfd5 613 // Event counters\r
614 //\r
615 h2D = (TH2D*)fEventCount->Projection(0,1);\r
62e3b4b6 616 if(!h2D) return;\r
985bdfd5 617 h2D->SetName("trig_vs_trigANDvertex");\r
618 aFolderObj->Add(h2D);\r
619\r
314e9442 620 fEventCount->GetAxis(0)->SetRange(2,2); // triggered\r
70a34bda 621 h1D = (TH1D*)fEventCount->Projection(1);\r
62e3b4b6 622 if(!h1D) return;\r
985bdfd5 623 h1D->SetTitle("rec. vertex for triggered events");\r
624 h1D->SetName("trigANDvertex");\r
625 aFolderObj->Add(h1D);\r
626\r
627 //\r
0aaa8b91 628 // Create rec. event histograms\r
629 //\r
985bdfd5 630 h1D = (TH1D *)fRecEventHist->Projection(0);\r
62e3b4b6 631 if(!h1D) return;\r
985bdfd5 632 h1D->SetName("rec_xv");\r
633 aFolderObj->Add(h1D);\r
634\r
635 h1D = (TH1D *)fRecEventHist->Projection(1);\r
62e3b4b6 636 if(!h1D) return;\r
985bdfd5 637 h1D->SetName("rec_yv");\r
638 aFolderObj->Add(h1D);\r
639\r
640 h1D = (TH1D *)fRecEventHist->Projection(2);\r
62e3b4b6 641 if(!h1D) return;\r
985bdfd5 642 h1D->SetName("rec_zv");\r
643 aFolderObj->Add(h1D);\r
644\r
645 h2D = (TH2D *)fRecEventHist->Projection(3,4);\r
62e3b4b6 646 if(!h2D) return;\r
985bdfd5 647 h2D->SetName("rec_resZv_vs_Mult");\r
648 aFolderObj->Add(h2D);\r
649\r
0aaa8b91 650 h2D = (TH2D *)fRecEventHist->Projection(0,1);\r
62e3b4b6 651 if(!h2D) return;\r
0aaa8b91 652 h2D->SetName("rec_xv_vs_yv");\r
653 aFolderObj->Add(h2D);\r
654\r
655 h2D = (TH2D *)fRecEventHist->Projection(0,2);\r
62e3b4b6 656 if(!h2D) return;\r
0aaa8b91 657 h2D->SetName("rec_xv_vs_zv");\r
658 aFolderObj->Add(h2D);\r
659\r
bad4ba69 660 h2D = (TH2D *)fRecEventHist->Projection(3,4);\r
62e3b4b6 661 if(!h2D) return;\r
0aaa8b91 662 h2D->SetName("rec_resZv_vs_Mult");\r
663 aFolderObj->Add(h2D);\r
664\r
bad4ba69 665 //\r
666 // MC available\r
667 //\r
668 if(IsUseMCInfo()) {\r
669\r
0aaa8b91 670 //\r
671 // Create mc event histograms\r
672 //\r
673 h2D = (TH2D *)fMCEventHist->Projection(0,1);\r
62e3b4b6 674 if(!h2D) return;\r
0aaa8b91 675 h2D->SetName("mc_xv_vs_yv");\r
676 aFolderObj->Add(h2D);\r
677\r
678 h2D = (TH2D *)fMCEventHist->Projection(0,2);\r
62e3b4b6 679 if(!h2D) return;\r
0aaa8b91 680 h2D->SetName("mc_xv_vs_zv");\r
681 aFolderObj->Add(h2D);\r
682\r
683 //\r
684 // Create rec-mc event histograms\r
685 //\r
686 h2D = (TH2D *)fRecMCEventHist->Projection(0,3);\r
62e3b4b6 687 if(!h2D) return;\r
0aaa8b91 688 h2D->SetName("rec_mc_deltaXv_vs_mult");\r
689 aFolderObj->Add(h2D);\r
690\r
691 h2D = (TH2D *)fRecMCEventHist->Projection(1,3);\r
62e3b4b6 692 if(!h2D) return;\r
0aaa8b91 693 h2D->SetName("rec_mc_deltaYv_vs_mult");\r
694 aFolderObj->Add(h2D);\r
695\r
696 h2D = (TH2D *)fRecMCEventHist->Projection(2,3);\r
62e3b4b6 697 if(!h2D) return;\r
0aaa8b91 698 h2D->SetName("rec_mc_deltaZv_vs_mult");\r
699 aFolderObj->Add(h2D);\r
700\r
bad4ba69 701 } // end use MC info \r
702\r
703\r
704\r
0aaa8b91 705 //\r
706 // Create rec-mc track track histograms \r
707 //\r
708\r
709 // DCA cuts\r
bad4ba69 710 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-maxDCAr,maxDCAr);\r
711 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-maxDCAr,maxDCAr);\r
712\r
713 h2D = (TH2D *)fRecMCTrackHist->Projection(7,5);\r
62e3b4b6 714 if(!h2D) return;\r
bad4ba69 715 h2D->SetName("pt_vs_eta");\r
716 aFolderObj->Add(h2D);\r
717\r
0aaa8b91 718 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minPt,maxPt); \r
719\r
720 h2D = (TH2D *)fRecMCTrackHist->Projection(0,5);\r
62e3b4b6 721 if(!h2D) return;\r
0aaa8b91 722 h2D->SetName("nClust_vs_eta");\r
723 aFolderObj->Add(h2D);\r
724\r
725 h2D = (TH2D *)fRecMCTrackHist->Projection(1,5);\r
62e3b4b6 726 if(!h2D) return;\r
0aaa8b91 727 h2D->SetName("chi2PerClust_vs_eta");\r
728 aFolderObj->Add(h2D);\r
729\r
730 h2D = (TH2D *)fRecMCTrackHist->Projection(2,5);\r
62e3b4b6 731 if(!h2D) return;\r
0aaa8b91 732 h2D->SetName("ratio_nClust_nFindableClust_vs_eta");\r
733 aFolderObj->Add(h2D);\r
734\r
985bdfd5 735 h2D = (TH2D *)fRecMCTrackHist->Projection(5,6);\r
62e3b4b6 736 if(!h2D) return;\r
985bdfd5 737 h2D->SetName("eta_vs_phi");\r
738 aFolderObj->Add(h2D);\r
739\r
0aaa8b91 740 //\r
985bdfd5 741 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minEta,maxEta); \r
bad4ba69 742\r
0aaa8b91 743 h2D = (TH2D *)fRecMCTrackHist->Projection(0,6);\r
62e3b4b6 744 if(!h2D) return;\r
0aaa8b91 745 h2D->SetName("nClust_vs_phi");\r
746 aFolderObj->Add(h2D);\r
747\r
748 h2D = (TH2D *)fRecMCTrackHist->Projection(1,6);\r
62e3b4b6 749 if(!h2D) return;\r
0aaa8b91 750 h2D->SetName("chi2PerClust_vs_phi");\r
751 aFolderObj->Add(h2D);\r
752\r
753 h2D = (TH2D *)fRecMCTrackHist->Projection(2,6);\r
62e3b4b6 754 if(!h2D) return;\r
0aaa8b91 755 h2D->SetName("ratio_nClust_nFindableClust_vs_phi");\r
756 aFolderObj->Add(h2D);\r
757\r
758 //\r
759 fRecMCTrackHist->GetAxis(7)->SetRangeUser(0.0,maxPt); \r
760\r
761 h2D = (TH2D *)fRecMCTrackHist->Projection(0,7);\r
62e3b4b6 762 if(!h2D) return;\r
0aaa8b91 763 h2D->SetName("nClust_vs_pt");\r
764 aFolderObj->Add(h2D);\r
765\r
766 h2D = (TH2D *)fRecMCTrackHist->Projection(1,7);\r
62e3b4b6 767 if(!h2D) return;\r
0aaa8b91 768 h2D->SetName("chi2PerClust_vs_pt");\r
769 aFolderObj->Add(h2D);\r
770\r
771 h2D = (TH2D *)fRecMCTrackHist->Projection(2,7);\r
62e3b4b6 772 if(!h2D) return;\r
0aaa8b91 773 h2D->SetName("ratio_nClust_nFindableClust_vs_pt");\r
774 aFolderObj->Add(h2D);\r
775\r
bad4ba69 776 h2D = (TH2D *)fRecMCTrackHist->Projection(6,7);\r
62e3b4b6 777 if(!h2D) return;\r
bad4ba69 778 h2D->SetName("phi_vs_pt");\r
779 aFolderObj->Add(h2D);\r
780\r
781\r
0aaa8b91 782 // fiducial volume\r
783 fRecMCTrackHist->GetAxis(5)->SetRangeUser(minEta,maxEta); \r
784 fRecMCTrackHist->GetAxis(7)->SetRangeUser(minPt,maxPt); \r
785\r
786 // DCA cuts\r
bad4ba69 787 fRecMCTrackHist->GetAxis(3)->SetRangeUser(-maxDCAr,maxDCAr);\r
788 fRecMCTrackHist->GetAxis(4)->SetRangeUser(-maxDCAr,maxDCAr);\r
0aaa8b91 789\r
790 h2D = (TH2D *)fRecMCTrackHist->Projection(0,1);\r
62e3b4b6 791 if(!h2D) return;\r
0aaa8b91 792 h2D->SetName("nClust_vs_chi2PerClust");\r
793 aFolderObj->Add(h2D);\r
794\r
795 h2D = (TH2D *)fRecMCTrackHist->Projection(0,2);\r
62e3b4b6 796 if(!h2D) return;\r
0aaa8b91 797 h2D->SetName("nClust_vs_ratio_nClust_nFindableClust");\r
798 aFolderObj->Add(h2D);\r
799\r
985bdfd5 800 //\r
0aaa8b91 801 // DCAy cuts\r
985bdfd5 802 //\r
803 fRecMCTrackHist->GetAxis(0)->SetRange(50,160); // nClust/track > 50\r
804 fRecMCTrackHist->GetAxis(1)->SetRangeUser(0.,3.9999); // chi2/cluster < 4.0\r
bad4ba69 805 fRecMCTrackHist->GetAxis(3)->SetRange(1,fRecMCTrackHist->GetAxis(3)->GetNbins());\r
985bdfd5 806 //fRecMCTrackHist->GetAxis(4)->SetRangeUser(-1.0,1.0);\r
807 fRecMCTrackHist->GetAxis(4)->SetRange(1,fRecMCTrackHist->GetAxis(4)->GetNbins());\r
0aaa8b91 808\r
809 // sec\r
810 fRecMCTrackHist->GetAxis(9)->SetRange(1,1);\r
811 h1D = (TH1D *)fRecMCTrackHist->Projection(3);\r
62e3b4b6 812 if(!h1D) return;\r
0aaa8b91 813 h1D->SetName("dcay_sec");\r
814 aFolderObj->Add(h1D);\r
815\r
816 // prim\r
817 fRecMCTrackHist->GetAxis(9)->SetRange(2,2);\r
818 h1D = (TH1D *)fRecMCTrackHist->Projection(3);\r
62e3b4b6 819 if(!h1D) return;\r
0aaa8b91 820 h1D->SetName("dcay_prim");\r
821 aFolderObj->Add(h1D);\r
822\r
823 // DCAz cuts\r
985bdfd5 824 //fRecMCTrackHist->GetAxis(3)->SetRangeUser(-1.0,1.0);\r
bad4ba69 825 fRecMCTrackHist->GetAxis(4)->SetRange(1,fRecMCTrackHist->GetAxis(4)->GetNbins());\r
0aaa8b91 826\r
827 // sec\r
828 fRecMCTrackHist->GetAxis(9)->SetRange(1,1);\r
829 h1D = (TH1D *)fRecMCTrackHist->Projection(4);\r
62e3b4b6 830 if(!h1D) return;\r
0aaa8b91 831 h1D->SetName("dcaz_sec");\r
832 aFolderObj->Add(h1D);\r
833\r
834 // prim\r
835 fRecMCTrackHist->GetAxis(9)->SetRange(2,2);\r
836 h1D = (TH1D *)fRecMCTrackHist->Projection(4);\r
62e3b4b6 837 if(!h1D) return;\r
0aaa8b91 838 h1D->SetName("dcaz_prim");\r
839 aFolderObj->Add(h1D);\r
840\r
841\r
842 // export objects to analysis folder\r
843 fAnalysisFolder = ExportToFolder(aFolderObj);\r
62e3b4b6 844 if(!fAnalysisFolder) {\r
845 if(aFolderObj) delete aFolderObj;\r
846 return;\r
847 }\r
0aaa8b91 848\r
849 // delete only TObjArray\r
850 if(aFolderObj) delete aFolderObj;\r
851}\r
852\r
853//_____________________________________________________________________________\r
c931948b 854TFolder* AlidNdPtCutAnalysis::ExportToFolder(TObjArray * const array) \r
0aaa8b91 855{\r
856 // recreate folder avery time and export objects to new one\r
857 //\r
858 AlidNdPtCutAnalysis * comp=this;\r
859 TFolder *folder = comp->GetAnalysisFolder();\r
860\r
861 TString name, title;\r
862 TFolder *newFolder = 0;\r
863 Int_t i = 0;\r
864 Int_t size = array->GetSize();\r
865\r
866 if(folder) { \r
867 // get name and title from old folder\r
868 name = folder->GetName(); \r
869 title = folder->GetTitle(); \r
870\r
871 // delete old one\r
872 delete folder;\r
873\r
874 // create new one\r
875 newFolder = CreateFolder(name.Data(),title.Data());\r
876 newFolder->SetOwner();\r
877\r
878 // add objects to folder\r
879 while(i < size) {\r
880 newFolder->Add(array->At(i));\r
881 i++;\r
882 }\r
883 }\r
884\r
885return newFolder;\r
886}\r
887\r
888//_____________________________________________________________________________\r
889TFolder* AlidNdPtCutAnalysis::CreateFolder(TString name,TString title) { \r
890// create folder for analysed histograms\r
891//\r
892TFolder *folder = 0;\r
893 folder = new TFolder(name.Data(),title.Data());\r
894\r
895 return folder;\r
896}\r