Add mcIsFromMB to the gamma from MB
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConvDalitzV1.cxx
CommitLineData
2bb2434e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4803eb1f 4 * Author: Pedro Gonz??lez, Pedro Ladr??n de Guevara, Ernesto L??pez Torres, *
0f8c33c1 5 * Eulogio Serradilla, Ana Marin, Friederike Bock *
6 * Version 2 *
2bb2434e 7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17// Analysis task for pi0->e+e-gamma (Dalitz decay)
0f8c33c1 18// Analysis task for chic->JPsi+gamma
2bb2434e 19
20#include <vector>
21
22#include "TParticle.h"
23#include "TPDGCode.h"
24#include "TMCProcess.h"
25#include "TDatabasePDG.h"
26#include "TList.h"
27#include "TChain.h"
28#include "TDirectory.h"
0a2b2b4b 29#include "TTree.h"
30#include "TH1.h"
31#include "TH1F.h"
32#include "THnSparse.h"
33#include "TH2F.h"
2bb2434e 34#include "AliStack.h"
35#include "AliAnalysisManager.h"
36#include "AliESDInputHandler.h"
37#include "AliESDtrack.h"
38#include "AliMCEvent.h"
39#include "AliStack.h"
40#include "AliMCEventHandler.h"
41#include "AliPID.h"
42#include "AliLog.h"
43#include "AliESDtrackCuts.h"
44#include "AliESDpidCuts.h"
45#include "AliMCEvent.h"
46#include "AliESDv0.h"
47#include "AliESDEvent.h"
48#include "AliESDpid.h"
49#include "AliKFParticle.h"
50#include "AliMCEventHandler.h"
51#include "AliKFVertex.h"
52#include "AliTriggerAnalysis.h"
53#include "AliCentrality.h"
54#include "AliMultiplicity.h"
55#include "AliAnalysisTaskGammaConvDalitzV1.h"
0a2b2b4b 56
2bb2434e 57
58ClassImp( AliAnalysisTaskGammaConvDalitzV1 )
59
60//-----------------------------------------------------------------------------------------------
61AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1():
344100c4 62 fV0Reader(NULL),
63 fElecSelector(NULL),
64 fBGHandler(NULL),
65 fESDEvent(NULL),
66 fMCEvent(NULL),
67 fMCStack(NULL),
68 fCutFolder(NULL),
69 fESDList(NULL),
70 fBackList(NULL),
71 fMotherList(NULL),
72 fTrueList(NULL),
73 fMCList(NULL),
74 fQAFolder(NULL),
75 fOutputContainer(0),
76 fReaderGammas(NULL),
77 fSelectorElectronIndex(0),
78 fSelectorPositronIndex(0),
79 fGoodGammas(NULL),
80 fGoodVirtualGammas(NULL),
81 fGoodElectrons(NULL),
82 fGoodPositrons(NULL),
83 fCutEventArray(NULL),
84 fCutGammaArray(NULL),
85 fCutElectronArray(NULL),
86 fCutMesonArray(NULL),
87 fGammasPool(NULL),
88 fEventCuts(NULL),
89 fConversionCuts(NULL),
90 hESDConvGammaPt(NULL),
91 hESDConvGammaEta(NULL),
92 hESDConvGammaZR(NULL),
93 hESDDalitzElectronPt(NULL),
94 hESDDalitzPositronPt(NULL),
95 hESDDalitzElectronPhi(NULL),
96 hESDDalitzPositronPhi(NULL),
97 hESDDalitzElectronAfterPt(NULL),
98 hESDDalitzPositronAfterPt(NULL),
99 hESDDalitzElectronAfterEta(NULL),
100 hESDDalitzElectronAfterEtaPCut(NULL),
101 hESDDalitzPositronAfterEta(NULL),
102 hESDDalitzPositronAfterEtaPCut(NULL),
103 hESDDalitzElectronAfterPhi(NULL),
104 hESDDalitzPositronAfterPhi(NULL),
105 hESDDalitzElectronAfterNClsITS(NULL),
106 hESDDalitzPositronAfterNClsITS(NULL),
107 hESDDalitzElectronAfterNFindClsTPC(NULL),
108 hESDDalitzPositronAfterNFindClsTPC(NULL),
109 hESDDalitzElectronAfterNClsTPC(NULL),
110 hESDDalitzPositronAfterNClsTPC(NULL),
111 hESDDalitzElectronAfterNCrossedRowsTPC(NULL),
112 hESDDalitzPositronAfterNCrossedRowsTPC(NULL),
113 hESDDalitzPosEleAfterDCAxy(NULL),
114 hESDDalitzPosEleAfterDCAz(NULL),
115 hESDDalitzElectronAfterTPCdEdxVsP(NULL),
116 hESDDalitzPositronAfterTPCdEdxVsP(NULL),
117 hESDDalitzElectronAfterTPCdEdxSignalVsP(NULL),
118 hESDDalitzPositronAfterTPCdEdxSignalVsP(NULL),
119 hESDDalitzElectronAfterTPCdEdxVsEta(NULL),
120 hESDDalitzPositronAfterTPCdEdxVsEta(NULL),
121 hESDDalitzElectronAfterTPCdEdxVsPhi(NULL),
122 hESDDalitzPositronAfterTPCdEdxVsPhi(NULL),
123 hESDMotherPhi(NULL),
124 hESDEposEnegPsiPairDPhi(NULL),
125 hESDEposEnegInvMassPt(NULL),
126 hESDEposEnegAfterMassCutInvMassPi0Pt(NULL),
127 hESDEposEnegInvMassPi0Pt(NULL),
128 hESDEposEnegLikeSignBackInvMassPt(NULL),
129 hESDMotherInvMassPt(NULL),
130 hESDPi0MotherInvMassPt(NULL),
131 hESDPi0MotherDiffInvMassPt(NULL),
132 hESDPi0MotherDiffLimInvMassPt(NULL),
133 sESDMotherInvMassPtZM(NULL),
134 hESDMotherBackInvMassPt(NULL),
135 sESDMotherBackInvMassPtZM(NULL),
136 hMCAllGammaPt(NULL),
137 hMCConvGammaPt(NULL),
138 hMCConvGammaRSPt(NULL),
139 hMCAllPositronsPt(NULL),
140 hMCAllElectronsPt(NULL),
141 hMCConvGammaEta(NULL),
5950ee43 142 hMCConvGammaR(NULL),
344100c4 143 hMCAllPositronsEta(NULL),
144 hMCAllElectronsEta(NULL),
145 hMCPi0DalitzGammaPt(NULL),
146 hMCPi0DalitzElectronPt(NULL),
147 hMCPi0DalitzPositronPt(NULL),
148 hMCPi0Pt(NULL),
149 hMCPi0GGPt(NULL),
150 hMCEtaPt(NULL),
151 hMCEtaGGPt(NULL),
152 hMCPi0InAccPt(NULL),
153 hMCEtaInAccPt(NULL),
154 hMCChiCPt(NULL),
155 hMCChiCInAccPt(NULL),
156 hMCPi0EposEnegInvMassPt(NULL),
157 hMCEtaEposEnegInvMassPt(NULL),
158 hESDEposEnegTruePi0DalitzInvMassPt(NULL),
159 hESDEposEnegTruePrimPi0DalitzInvMass(NULL),
160 hESDEposEnegTruePi0DalitzPsiPairDPhi(NULL),
161 hESDEposEnegTrueEtaDalitzInvMassPt(NULL),
162 hESDEposEnegTruePrimEtaDalitzInvMass(NULL),
163 hESDEposEnegTrueEtaDalitzPsiPairDPhi(NULL),
164 hESDEposEnegTruePhotonInvMassPt(NULL),
165 hESDEposEnegTrueInvMassPt(NULL),
166 hESDEposEnegTruePhotonPsiPairDPhi(NULL),
167 hESDEposEnegTruePhotonPsiPairDPhiPtCut(NULL),
168 hESDEposEnegTrueJPsiInvMassPt(NULL),
169 hESDTrueMotherChiCInvMassPt(NULL),
170 hESDTrueMotherChiCDiffInvMassPt(NULL),
171 hESDTrueMotherInvMassPt(NULL),
172 hESDTrueMotherDalitzInvMassPt(NULL),
173 hESDTrueMotherPi0GGInvMassPt(NULL),
174 hESDTruePrimaryMotherPi0GGInvMassPt(NULL),
175 hESDTrueSecondaryMotherPi0GGInvMassPt(NULL),
176 hESDTruePrimaryMotherInvMassMCPt(NULL),
177 hESDTruePrimaryMotherInvMassPt(NULL),
178 hESDTruePrimaryMotherW0WeightingInvMassPt(NULL),
179 hESDTruePrimaryPi0DalitzESDPtMCPt(NULL),
180 hESDTrueSecondaryMotherInvMassPt(NULL),
181 hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
182 hESDTrueBckGGInvMassPt(NULL),
183 hESDTrueBckContInvMassPt(NULL),
184 hESDTrueMotherGGInvMassPt(NULL),
185 hESDTrueConvGammaPt(NULL),
5950ee43 186 hESDTrueConvGammaR(NULL),
01d3a373 187 hESDTrueConvGammaRMC(NULL),
344100c4 188 hESDTruePositronPt(NULL),
189 hESDTrueElectronPt(NULL),
190 hESDTrueSecConvGammaPt(NULL),
191 hESDTrueSecPositronPt(NULL),
192 hESDTrueSecElectronPt(NULL),
193 hESDTruePi0DalitzConvGammaPt(NULL),
194 hESDTruePi0DalitzPositronPt(NULL),
195 hESDTruePi0DalitzElectronPt(NULL),
196 hESDTruePi0DalitzSecConvGammaPt(NULL),
197 hESDTruePi0DalitzSecPositronPt(NULL),
198 hESDTruePi0DalitzSecElectronPt(NULL),
199 hNEvents(NULL),
200 hNGoodESDTracks(NULL),
201 hNGoodESDTracksVsNGoodGammas(NULL),
202 hNGoodESDTracksVsNGoodVGammas(NULL),
203 hNV0Tracks(NULL),
204 hEtaShift(NULL),
205 fRandom(0),
206 fUnsmearedPx(NULL),
207 fUnsmearedPy(NULL),
208 fUnsmearedPz(NULL),
209 fUnsmearedE(NULL),
210 fUnsmearedVPx(NULL),
211 fUnsmearedVPy(NULL),
212 fUnsmearedVPz(NULL),
213 fUnsmearedVE(NULL),
214 fnCuts(0),
215 fiCut(0),
216 fNumberOfESDTracks(0),
217 fNumberOfESDTrackskBoth(0),
218 fNVirtualGammas(0),
219 fMoveParticleAccordingToVertex(kFALSE),
d964fbfc 220 fIsHeavyIon(0),
344100c4 221 fDoMesonAnalysis(kTRUE),
222 fDoChicAnalysis(kFALSE),
223 fDoMesonQA(kFALSE),
224 fSetProductionVertextoVGamma(kTRUE),
225 fIsFromMBHeader(kTRUE),
226 fIsMC(kFALSE)
2bb2434e 227{
a280ac15 228
2bb2434e 229}
230
231//-----------------------------------------------------------------------------------------------
232AliAnalysisTaskGammaConvDalitzV1::AliAnalysisTaskGammaConvDalitzV1( const char* name ):
344100c4 233 AliAnalysisTaskSE(name),
234 fV0Reader(NULL),
235 fElecSelector(NULL),
236 fBGHandler(NULL),
237 fESDEvent(NULL),
238 fMCEvent(NULL),
239 fMCStack(NULL),
240 fCutFolder(NULL),
241 fESDList(NULL),
242 fBackList(NULL),
243 fMotherList(NULL),
244 fTrueList(NULL),
245 fMCList(NULL),
246 fQAFolder(NULL),
247 fOutputContainer(0),
248 fReaderGammas(NULL),
249 fSelectorElectronIndex(0),
250 fSelectorPositronIndex(0),
251 fGoodGammas(NULL),
252 fGoodVirtualGammas(NULL),
253 fGoodElectrons(NULL),
254 fGoodPositrons(NULL),
255 fCutEventArray(NULL),
256 fCutGammaArray(NULL),
257 fCutElectronArray(NULL),
258 fCutMesonArray(NULL),
259 fGammasPool(NULL),
260 fEventCuts(NULL),
261 fConversionCuts(NULL),
262 hESDConvGammaPt(NULL),
263 hESDConvGammaEta(NULL),
264 hESDConvGammaZR(NULL),
265 hESDDalitzElectronPt(NULL),
266 hESDDalitzPositronPt(NULL),
267 hESDDalitzElectronPhi(NULL),
268 hESDDalitzPositronPhi(NULL),
269 hESDDalitzElectronAfterPt(NULL),
270 hESDDalitzPositronAfterPt(NULL),
271 hESDDalitzElectronAfterEta(NULL),
272 hESDDalitzElectronAfterEtaPCut(NULL),
273 hESDDalitzPositronAfterEta(NULL),
274 hESDDalitzPositronAfterEtaPCut(NULL),
275 hESDDalitzElectronAfterPhi(NULL),
276 hESDDalitzPositronAfterPhi(NULL),
277 hESDDalitzElectronAfterNClsITS(NULL),
278 hESDDalitzPositronAfterNClsITS(NULL),
279 hESDDalitzElectronAfterNFindClsTPC(NULL),
280 hESDDalitzPositronAfterNFindClsTPC(NULL),
281 hESDDalitzElectronAfterNClsTPC(NULL),
282 hESDDalitzPositronAfterNClsTPC(NULL),
283 hESDDalitzElectronAfterNCrossedRowsTPC(NULL),
284 hESDDalitzPositronAfterNCrossedRowsTPC(NULL),
285 hESDDalitzPosEleAfterDCAxy(NULL),
286 hESDDalitzPosEleAfterDCAz(NULL),
287 hESDDalitzElectronAfterTPCdEdxVsP(NULL),
288 hESDDalitzPositronAfterTPCdEdxVsP(NULL),
289 hESDDalitzElectronAfterTPCdEdxSignalVsP(NULL),
290 hESDDalitzPositronAfterTPCdEdxSignalVsP(NULL),
291 hESDDalitzElectronAfterTPCdEdxVsEta(NULL),
292 hESDDalitzPositronAfterTPCdEdxVsEta(NULL),
293 hESDDalitzElectronAfterTPCdEdxVsPhi(NULL),
294 hESDDalitzPositronAfterTPCdEdxVsPhi(NULL),
295 hESDMotherPhi(NULL),
296 hESDEposEnegPsiPairDPhi(NULL),
297 hESDEposEnegInvMassPt(NULL),
298 hESDEposEnegAfterMassCutInvMassPi0Pt(NULL),
299 hESDEposEnegInvMassPi0Pt(NULL),
300 hESDEposEnegLikeSignBackInvMassPt(NULL),
301 hESDMotherInvMassPt(NULL),
302 hESDPi0MotherInvMassPt(NULL),
303 hESDPi0MotherDiffInvMassPt(NULL),
304 hESDPi0MotherDiffLimInvMassPt(NULL),
305 sESDMotherInvMassPtZM(NULL),
306 hESDMotherBackInvMassPt(NULL),
307 sESDMotherBackInvMassPtZM(NULL),
308 hMCAllGammaPt(NULL),
309 hMCConvGammaPt(NULL),
310 hMCConvGammaRSPt(NULL),
311 hMCAllPositronsPt(NULL),
312 hMCAllElectronsPt(NULL),
313 hMCConvGammaEta(NULL),
5950ee43 314 hMCConvGammaR(NULL),
344100c4 315 hMCAllPositronsEta(NULL),
316 hMCAllElectronsEta(NULL),
317 hMCPi0DalitzGammaPt(NULL),
318 hMCPi0DalitzElectronPt(NULL),
319 hMCPi0DalitzPositronPt(NULL),
320 hMCPi0Pt(NULL),
321 hMCPi0GGPt(NULL),
322 hMCEtaPt(NULL),
323 hMCEtaGGPt(NULL),
324 hMCPi0InAccPt(NULL),
325 hMCEtaInAccPt(NULL),
326 hMCChiCPt(NULL),
327 hMCChiCInAccPt(NULL),
328 hMCPi0EposEnegInvMassPt(NULL),
329 hMCEtaEposEnegInvMassPt(NULL),
330 hESDEposEnegTruePi0DalitzInvMassPt(NULL),
331 hESDEposEnegTruePrimPi0DalitzInvMass(NULL),
332 hESDEposEnegTruePi0DalitzPsiPairDPhi(NULL),
333 hESDEposEnegTrueEtaDalitzInvMassPt(NULL),
334 hESDEposEnegTruePrimEtaDalitzInvMass(NULL),
335 hESDEposEnegTrueEtaDalitzPsiPairDPhi(NULL),
336 hESDEposEnegTruePhotonInvMassPt(NULL),
337 hESDEposEnegTrueInvMassPt(NULL),
338 hESDEposEnegTruePhotonPsiPairDPhi(NULL),
339 hESDEposEnegTruePhotonPsiPairDPhiPtCut(NULL),
340 hESDEposEnegTrueJPsiInvMassPt(NULL),
341 hESDTrueMotherChiCInvMassPt(NULL),
342 hESDTrueMotherChiCDiffInvMassPt(NULL),
343 hESDTrueMotherInvMassPt(NULL),
344 hESDTrueMotherDalitzInvMassPt(NULL),
345 hESDTrueMotherPi0GGInvMassPt(NULL),
346 hESDTruePrimaryMotherPi0GGInvMassPt(NULL),
347 hESDTrueSecondaryMotherPi0GGInvMassPt(NULL),
348 hESDTruePrimaryMotherInvMassMCPt(NULL),
349 hESDTruePrimaryMotherInvMassPt(NULL),
350 hESDTruePrimaryMotherW0WeightingInvMassPt(NULL),
351 hESDTruePrimaryPi0DalitzESDPtMCPt(NULL),
352 hESDTrueSecondaryMotherInvMassPt(NULL),
353 hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
354 hESDTrueBckGGInvMassPt(NULL),
355 hESDTrueBckContInvMassPt(NULL),
356 hESDTrueMotherGGInvMassPt(NULL),
357 hESDTrueConvGammaPt(NULL),
5950ee43 358 hESDTrueConvGammaR(NULL),
01d3a373 359 hESDTrueConvGammaRMC(NULL),
344100c4 360 hESDTruePositronPt(NULL),
361 hESDTrueElectronPt(NULL),
362 hESDTrueSecConvGammaPt(NULL),
363 hESDTrueSecPositronPt(NULL),
364 hESDTrueSecElectronPt(NULL),
365 hESDTruePi0DalitzConvGammaPt(NULL),
366 hESDTruePi0DalitzPositronPt(NULL),
367 hESDTruePi0DalitzElectronPt(NULL),
368 hESDTruePi0DalitzSecConvGammaPt(NULL),
369 hESDTruePi0DalitzSecPositronPt(NULL),
370 hESDTruePi0DalitzSecElectronPt(NULL),
371 hNEvents(NULL),
372 hNGoodESDTracks(NULL),
373 hNGoodESDTracksVsNGoodGammas(NULL),
374 hNGoodESDTracksVsNGoodVGammas(NULL),
375 hNV0Tracks(NULL),
376 hEtaShift(NULL),
377 fRandom(0),
378 fUnsmearedPx(NULL),
379 fUnsmearedPy(NULL),
380 fUnsmearedPz(NULL),
381 fUnsmearedE(NULL),
382 fUnsmearedVPx(NULL),
383 fUnsmearedVPy(NULL),
384 fUnsmearedVPz(NULL),
385 fUnsmearedVE(NULL),
386 fnCuts(0),
387 fiCut(0),
388 fNumberOfESDTracks(0),
389 fNumberOfESDTrackskBoth(0),
390 fNVirtualGammas(0),
391 fMoveParticleAccordingToVertex(kFALSE),
d964fbfc 392 fIsHeavyIon(0),
344100c4 393 fDoMesonAnalysis(kTRUE),
394 fDoChicAnalysis(kFALSE),
395 fDoMesonQA(kFALSE),
396 fSetProductionVertextoVGamma(kTRUE),
397 fIsFromMBHeader(kTRUE),
398 fIsMC(kFALSE)
2bb2434e 399{
344100c4 400 DefineOutput(1, TList::Class());
2bb2434e 401}
402
403//-----------------------------------------------------------------------------------------------
404AliAnalysisTaskGammaConvDalitzV1::~AliAnalysisTaskGammaConvDalitzV1()
405{
344100c4 406 //
407 // virtual destructor
408 //
409
410 cout<<"Destructor"<<endl;
411
412 if(fGoodGammas){
413 delete fGoodGammas;
414 fGoodGammas = 0x0;
415 }
416 if(fGoodVirtualGammas){
417 delete fGoodVirtualGammas;
418 fGoodVirtualGammas = 0x0;
419 }
420 if(fGoodElectrons){
421 delete fGoodElectrons;
422 fGoodElectrons = 0x0;
423 }
424 if(fGoodPositrons){
425 delete fGoodPositrons;
426 fGoodPositrons = 0x0;
427 }
428 if(fBGHandler){
429 delete[] fBGHandler;
430 fBGHandler = 0x0;
431 }
432 if( fGammasPool ){
433 delete[] fGammasPool;
434 fGammasPool = 0x0;
435 }
2bb2434e 436}
344100c4 437
2bb2434e 438//___________________________________________________________
439void AliAnalysisTaskGammaConvDalitzV1::InitBack(){
440
344100c4 441 const Int_t nDim = 4;
442 Int_t nBins[nDim] = {800,250,7,4};
443 Double_t xMin[nDim] = {0,0, 0,0};
444 Double_t xMax[nDim] = {0.8,25,7,4};
445
446 sESDMotherInvMassPtZM = new THnSparseF*[fnCuts];
447 sESDMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
2bb2434e 448
344100c4 449 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
450
451 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
452
453 TString cutstringEvent = ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber();
454 TString cutstringElectron = ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutNumber();
455 TString cutstringMeson = ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutNumber();
456 TString cutstringGamma = ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutNumber();
457
458 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber())(0,1));
459 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber())(1,1));
460 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber())(2,1));
461
462 if(collisionSystem == 1 || collisionSystem == 2 ||
463 collisionSystem == 5 || collisionSystem == 8 ||
464 collisionSystem == 9){
465 centMin = centMin*10;
466 centMax = centMax*10;
467 }
468 else if(collisionSystem == 3 || collisionSystem == 6){
469 centMin = centMin*5;
470 centMax = centMax*5;
471 }
472 else if(collisionSystem == 4 || collisionSystem == 7){
473 centMin = ((centMin*5)+45);
474 centMax = ((centMax*5)+45);
475 }
476
477
478 fBackList[iCut] = new TList();
479 fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
480 fBackList[iCut]->SetOwner(kTRUE);
481 fCutFolder[iCut]->Add(fBackList[iCut]);
482
483 sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
484 fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
485
486 fMotherList[iCut] = new TList();
487 fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
488 fMotherList[iCut]->SetOwner(kTRUE);
489 fCutFolder[iCut]->Add(fMotherList[iCut]);
490
491 sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
492 fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
493
494
495 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
496 collisionSystem,centMin,centMax,
497 ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->NumberOfRotationEvents(),
cfd87ccd 498 ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->UseTrackMultiplicity(),
499 1,8,5);
344100c4 500
501 if( ( (AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetBKGMethod() == 3 ){
502 fGammasPool[iCut] = new TList();
503 }
504
505 }
2bb2434e 506}
507
508//______________________________________________________________________
509void AliAnalysisTaskGammaConvDalitzV1::UserCreateOutputObjects()
510{
344100c4 511 //
512 // Create ouput objects
513 //
514
515 // Create the output container
516 if(fOutputContainer != NULL){
517 delete fOutputContainer;
518 fOutputContainer = NULL;
519 }
520 if(fOutputContainer == NULL){
521 fOutputContainer = new TList();
522 fOutputContainer->SetOwner(kTRUE);
523 }
524
525 fGoodGammas = new TList();
526 //fGoodGammas->SetOwner(kTRUE);
527
528 fGoodVirtualGammas = new TList();
529 fGoodVirtualGammas->SetOwner(kTRUE);
530
531 fGammasPool = new TList*[fnCuts];
532 fCutFolder = new TList*[fnCuts];
533 fESDList = new TList*[fnCuts];
534 fBackList = new TList*[fnCuts];
535 fMotherList = new TList*[fnCuts];
536 hNEvents = new TH1I*[fnCuts];
537 hNGoodESDTracks = new TH1I*[fnCuts];
538 hNV0Tracks = new TH1I*[fnCuts];
539 hEtaShift = new TProfile*[fnCuts];
540 hESDConvGammaPt = new TH1F*[fnCuts];
541 hESDConvGammaEta = new TH1F*[fnCuts];
fcc79cf5 542
344100c4 543 hESDDalitzElectronPt = new TH1F*[fnCuts];
544 hESDDalitzPositronPt = new TH1F*[fnCuts];
545 hESDDalitzElectronPhi = new TH1F*[fnCuts];
546 hESDDalitzPositronPhi = new TH1F*[fnCuts];
547
548 if( fDoMesonQA ) {
549 fQAFolder = new TList*[fnCuts];
550 hNGoodESDTracksVsNGoodGammas = new TH2F*[fnCuts];
551 hNGoodESDTracksVsNGoodVGammas = new TH2F*[fnCuts];
552 hESDDalitzElectronAfterPt = new TH1F*[fnCuts];
553 hESDDalitzPositronAfterPt = new TH1F*[fnCuts];
554 hESDDalitzElectronAfterEta = new TH1F*[fnCuts];
555 hESDDalitzElectronAfterEtaPCut = new TH1F*[fnCuts];
556 hESDDalitzPositronAfterEta = new TH1F*[fnCuts];
557 hESDDalitzPositronAfterEtaPCut = new TH1F*[fnCuts];
558 hESDDalitzElectronAfterPhi = new TH1F*[fnCuts];
559 hESDDalitzPositronAfterPhi = new TH1F*[fnCuts];
560 hESDDalitzElectronAfterNClsITS = new TH1F*[fnCuts];
561 hESDDalitzPositronAfterNClsITS = new TH1F*[fnCuts];
562 hESDDalitzElectronAfterNFindClsTPC = new TH2F*[fnCuts];
563 hESDDalitzPositronAfterNFindClsTPC = new TH2F*[fnCuts];
564 hESDDalitzElectronAfterNClsTPC = new TH2F*[fnCuts];
565 hESDDalitzPositronAfterNClsTPC = new TH2F*[fnCuts];
566 hESDDalitzElectronAfterNCrossedRowsTPC = new TH2F*[fnCuts];
567 hESDDalitzPositronAfterNCrossedRowsTPC = new TH2F*[fnCuts];
568 hESDDalitzPosEleAfterDCAxy = new TH2F*[fnCuts];
569 hESDDalitzPosEleAfterDCAz = new TH2F*[fnCuts];
570 hESDDalitzElectronAfterTPCdEdxVsP = new TH2F*[fnCuts];
571 hESDDalitzPositronAfterTPCdEdxVsP = new TH2F*[fnCuts];
572 hESDDalitzElectronAfterTPCdEdxSignalVsP = new TH2F*[fnCuts];
573 hESDDalitzPositronAfterTPCdEdxSignalVsP = new TH2F*[fnCuts];
574 hESDDalitzElectronAfterTPCdEdxVsEta = new TH2F*[fnCuts];
575 hESDDalitzPositronAfterTPCdEdxVsEta = new TH2F*[fnCuts];
576 hESDDalitzElectronAfterTPCdEdxVsPhi = new TH2F*[fnCuts];
577 hESDDalitzPositronAfterTPCdEdxVsPhi = new TH2F*[fnCuts];
578 hESDMotherPhi = new TH1F*[fnCuts];
579 hESDEposEnegPsiPairDPhi = new TH2F*[fnCuts];
580 hESDEposEnegInvMassPt = new TH2F*[fnCuts];
581 hESDEposEnegAfterMassCutInvMassPi0Pt = new TH2F*[fnCuts];
582 hESDEposEnegInvMassPi0Pt = new TH2F*[fnCuts];
583 hESDEposEnegLikeSignBackInvMassPt = new TH2F*[fnCuts];
584 hESDConvGammaZR = new TH2F*[fnCuts];
d9d6352b 585 }
344100c4 586
587
588
589 hESDMotherInvMassPt = new TH2F*[fnCuts];
590 if(fDoChicAnalysis) {
591 hESDPi0MotherInvMassPt = new TH2F*[fnCuts];
592 hESDPi0MotherDiffInvMassPt = new TH2F*[fnCuts];
593 hESDPi0MotherDiffLimInvMassPt = new TH2F*[fnCuts];
594 }
595 hESDMotherBackInvMassPt = new TH2F*[fnCuts];
0f8c33c1 596
2bb2434e 597
344100c4 598 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2bb2434e 599
344100c4 600 TString cutstringEvent = ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber();
601 TString cutstringElectron = ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutNumber();
602 TString cutstringMeson = ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutNumber();
603 TString cutstringGamma = ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutNumber();
a280ac15 604
344100c4 605 fCutFolder[iCut] = new TList();
606 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
607 fCutFolder[iCut]->SetOwner(kTRUE);
608 fOutputContainer->Add(fCutFolder[iCut]);
2bb2434e 609
344100c4 610 fESDList[iCut] = new TList();
611 fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
612 fESDList[iCut]->SetOwner(kTRUE);
613
7f070437 614 hNEvents[iCut] = new TH1I("NEvents","NEvents",10,-0.5,9.5);
344100c4 615 hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
616 hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
617 hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
618 hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
619 hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
620 hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
621 hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
622 hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
623 hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
7f070437 624 hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
344100c4 625 fESDList[iCut]->Add(hNEvents[iCut]);
626
d964fbfc 627 if(fIsHeavyIon == 1 || fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
344100c4 628 else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
629 fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
630
631
632 if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
633 else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
634 else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
635 fESDList[iCut]->Add(hNV0Tracks[iCut]);
636
637 hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
638 fESDList[iCut]->Add(hEtaShift[iCut]);
ae947965 639
344100c4 640 hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
641 fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
642
643 hESDConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",600,-1.5,1.5);
644 fESDList[iCut]->Add(hESDConvGammaEta[iCut]);
645
646 hESDDalitzElectronPt[iCut] = new TH1F("ESD_DalitzElectron_Pt","ESD_DalitzElectron_Pt",1000,0,25);
647 fESDList[iCut]->Add(hESDDalitzElectronPt[iCut]);
ae947965 648
344100c4 649 hESDDalitzPositronPt[iCut] = new TH1F("ESD_DalitzPositron_Pt","ESD_DalitzPositron_Pt",1000,0,25);
650 fESDList[iCut]->Add(hESDDalitzPositronPt[iCut]);
651
652
653 hESDDalitzElectronPhi[iCut] = new TH1F("ESD_DalitzElectron_Phi","ESD_DalitzElectron_Phi",360,0,2*TMath::Pi());
654 fESDList[iCut]->Add(hESDDalitzElectronPhi[iCut]);
2bb2434e 655
344100c4 656 hESDDalitzPositronPhi[iCut] = new TH1F("ESD_DalitzPositron_Phi","ESD_DalitzPositron_Phi",360,0,2*TMath::Pi());
657 fESDList[iCut]->Add(hESDDalitzPositronPhi[iCut]);
658
659
660
661 if ( fDoMesonQA ) {
2bb2434e 662
344100c4 663 fQAFolder[iCut] = new TList();
664 fQAFolder[iCut]->SetName(Form("%s_%s_%s_%s QA histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
665 fQAFolder[iCut]->SetOwner(kTRUE);
666
667 const Int_t kPtBins=110;
668 Double_t binsPtDummy[kPtBins+1];
669 const Int_t kPBins = 109;
670 Double_t binsPDummy[kPBins+1];
671 binsPtDummy[0]=0.0;
672 binsPDummy[0]=0.05;
673
674 for(Int_t i=1;i<kPtBins+1;i++){
675 if(binsPtDummy[i-1]+0.05<1.01)
676 binsPtDummy[i]=binsPtDummy[i-1]+0.05;
677 else
678 binsPtDummy[i]=binsPtDummy[i-1]+0.1;
679 }
680 for(Int_t i=1; i<kPBins+1;i++){
681 if( binsPDummy[i-1]+0.05<1.01)
682 binsPDummy[i] = binsPDummy[i-1]+0.05;
683 else
684 binsPDummy[i] = binsPDummy[i-1]+0.1;
685 }
686
687 hNGoodESDTracksVsNGoodGammas[iCut] = new TH2F("hNGoodESDTracksVsNGoodGammas","hNGoodESDTracksVsNGoodGammas",200,-0.5,199.5,100,-0.5,99.5);
688 fQAFolder[iCut]->Add(hNGoodESDTracksVsNGoodGammas[iCut]);
689
690 hNGoodESDTracksVsNGoodVGammas[iCut] = new TH2F("hNGoodESDTracksVsNVGoodVGammas","hNGoodESDTracksVsNGoodVGammas",200,-0.5,199.5,100,-0.5,99.5);
691 fQAFolder[iCut]->Add(hNGoodESDTracksVsNGoodVGammas[iCut]);
692
693 hESDConvGammaZR[iCut]= new TH2F("ESD_ConvGamma_ConversionPoint_ZR","ESD_ConvGamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
694 fQAFolder[iCut]->Add(hESDConvGammaZR[iCut]);
695
696 hESDDalitzElectronAfterPt[iCut] = new TH1F("ESD_DalitzElectron_After_Pt","ESD_DalitzElectron_After_Pt",1000,0,25);
697 fQAFolder[iCut]->Add(hESDDalitzElectronAfterPt[iCut]);
2bb2434e 698
344100c4 699 hESDDalitzPositronAfterPt[iCut] = new TH1F("ESD_DalitzPositron_After_Pt","ESD_DalitzPositron_After_Pt",1000,0,25);
700 fQAFolder[iCut]->Add(hESDDalitzPositronAfterPt[iCut]);
701
702 hESDDalitzElectronAfterEta[iCut] = new TH1F("ESD_DalitzElectron_After_Eta","ESD_DalitzElectron_After_Eta",600,-1.5,1.5);
703 fQAFolder[iCut]->Add(hESDDalitzElectronAfterEta[iCut]);
704
705 hESDDalitzElectronAfterEtaPCut[iCut] = new TH1F("ESD_DalitzElectron_After_Eta_PCut","ESD_DalitzElectron_After_Eta_PCut",600,-1.5,1.5);
706 fQAFolder[iCut]->Add(hESDDalitzElectronAfterEtaPCut[iCut]);
707
708 hESDDalitzPositronAfterEta[iCut] = new TH1F("ESD_DalitzPositron_After_Eta","ESD_DalitzElectron_After_Eta",600,-1.5,1.5);
709 fQAFolder[iCut]->Add(hESDDalitzPositronAfterEta[iCut]);
710
711 hESDDalitzPositronAfterEtaPCut[iCut] = new TH1F("ESD_DalitzPositron_After_Eta_PCut","ESD_DalitzElectron_After_Eta_PCut",600,-1.5,1.5);
712 fQAFolder[iCut]->Add(hESDDalitzPositronAfterEtaPCut[iCut]);
713
714 hESDDalitzElectronAfterPhi[iCut] = new TH1F("ESD_DalitzElectron_After_Phi","ESD_DalitzElectron_After_Phi",360,0,2*TMath::Pi());
715 fQAFolder[iCut]->Add(hESDDalitzElectronAfterPhi[iCut]);
2bb2434e 716
344100c4 717 hESDDalitzPositronAfterPhi[iCut] = new TH1F("ESD_DalitzPositron_After_Phi","ESD_DalitzPositron_After_Phi",360,0,2*TMath::Pi());
718 fQAFolder[iCut]->Add(hESDDalitzPositronAfterPhi[iCut]);
719
720 hESDDalitzElectronAfterNClsITS[iCut] = new TH1F("ESD_DalitzElectron_After_NClsITS","ESD_DalitzElectron_After_NClsITS",7,0.,7.);
721 fQAFolder[iCut]->Add(hESDDalitzElectronAfterNClsITS[iCut]);
722
723 hESDDalitzPositronAfterNClsITS[iCut] = new TH1F("ESD_DalitzPositron_After_NClsITS","ESD_DalitzPositron_After_NClsITS",7,0.,7.);
724 fQAFolder[iCut]->Add(hESDDalitzPositronAfterNClsITS[iCut]);
725
726 hESDDalitzElectronAfterNFindClsTPC[iCut] = new TH2F("ESD_DalitzElectron_After_NFindClsTPC","ESD_DalitzElectron_After_NFindClsTPC",60,0,1.5,kPtBins,binsPtDummy);
727 fQAFolder[iCut]->Add(hESDDalitzElectronAfterNFindClsTPC[iCut]);
728
729 hESDDalitzPositronAfterNFindClsTPC[iCut] = new TH2F("ESD_DalitzPositron_After_NFindClsTPC","ESD_DalitzPositron_After_NFindClsTPC",60,0,1.5,kPtBins,binsPtDummy);
730 fQAFolder[iCut]->Add(hESDDalitzPositronAfterNFindClsTPC[iCut]);
731
732 hESDDalitzElectronAfterNClsTPC[iCut] = new TH2F("ESD_DalitzElectron_After_NClsTPC","ESD_DalitzElectron_After_NClsTPC",200,0,200,kPtBins,binsPtDummy);
733 fQAFolder[iCut]->Add(hESDDalitzElectronAfterNClsTPC[iCut]);
734
735 hESDDalitzPositronAfterNClsTPC[iCut] = new TH2F("ESD_DalitzPositron_After_NClsTPC","ESD_DalitzPositron_After_NClsTPC",200,0,200,kPtBins,binsPtDummy);
736 fQAFolder[iCut]->Add(hESDDalitzPositronAfterNClsTPC[iCut]);
737
738 hESDDalitzPositronAfterNCrossedRowsTPC[iCut] = new TH2F("ESD_DalitzPositron_After_NCrossedRowsTPC","ESD_DalitzPositron_After_NCrossedRowsTPC",165,-0.5,164.5,kPtBins,binsPtDummy);
739 fQAFolder[iCut]->Add(hESDDalitzPositronAfterNCrossedRowsTPC[iCut]);
740
741 hESDDalitzElectronAfterNCrossedRowsTPC[iCut] = new TH2F("ESD_DalitzElectron_After_NCrossedRowsTPC","ESD_DalitzElectron_After_NCrossedRowsTPC",165,-0.5,164.5,kPtBins,binsPtDummy);
742 fQAFolder[iCut]->Add(hESDDalitzElectronAfterNCrossedRowsTPC[iCut]);
743
744 hESDDalitzPosEleAfterDCAxy[iCut] = new TH2F("ESD_DalitzPosEle_After_DCAxy","ESD_DalitzPosEle_After_DCAxy",124,-0.62,0.62,kPtBins,binsPtDummy);
745 fQAFolder[iCut]->Add(hESDDalitzPosEleAfterDCAxy[iCut]);
746
747 hESDDalitzPosEleAfterDCAz[iCut] = new TH2F("ESD_DalitzPosEle_After_DCAz","ESD_DalitzPosEle_After_DCAz",200,-1.0,1.0,kPtBins,binsPtDummy);
748 fQAFolder[iCut]->Add(hESDDalitzPosEleAfterDCAz[iCut]);
749
750 hESDDalitzElectronAfterTPCdEdxVsP[iCut] = new TH2F("ESD_DalitzElectron_After_TPCdEdxVsP","ESD_DalitzElectron_After_TPCdEdxVsP_After_TPCdEdx",kPBins,binsPDummy,200,-10,10);
751 fQAFolder[iCut]->Add(hESDDalitzElectronAfterTPCdEdxVsP[iCut]);
752
753 hESDDalitzPositronAfterTPCdEdxVsP[iCut] = new TH2F("ESD_DalitzPositron_After_TPCdEdxVsP","ESD_DalitzPositron_After_TPCdEdxVsP",kPBins,binsPDummy,200,-10,10);
754 fQAFolder[iCut]->Add(hESDDalitzPositronAfterTPCdEdxVsP[iCut]);
755
756 hESDDalitzElectronAfterTPCdEdxSignalVsP[iCut] =new TH2F("ESD_DalitzElectron_After_TPCdEdxSignalVsP","ESD_DalitzElectron_After_TPCdEdxSignalVsP" ,kPBins,binsPDummy,200,0.0,200);
757 fQAFolder[iCut]->Add(hESDDalitzElectronAfterTPCdEdxSignalVsP[iCut]);
758
759 hESDDalitzPositronAfterTPCdEdxSignalVsP[iCut] =new TH2F("ESD_DalitzPositron_After_TPCdEdxSignalVsP","ESD_DalitzPositron_After_TPCdEdxSignalVsP" ,kPBins,binsPDummy,200,0.0,200);
760 fQAFolder[iCut]->Add(hESDDalitzPositronAfterTPCdEdxSignalVsP[iCut]);
761
762 hESDDalitzElectronAfterTPCdEdxVsEta[iCut] = new TH2F("ESD_DalitzElectron_After_TPCdEdxVsEta","ESD_DalitzElectron_After_TPCdEdxVsEta",140,-1.4,1.4,200,-10,10);
763 fQAFolder[iCut]->Add(hESDDalitzElectronAfterTPCdEdxVsEta[iCut]);
764
765 hESDDalitzPositronAfterTPCdEdxVsEta[iCut] = new TH2F("ESD_DalitzPositron_After_TPCdEdxVsEta","ESD_DalitzPositron_After_TPCdEdxVsEta",140,-1.4,1.4,200,-10,10);
766 fQAFolder[iCut]->Add(hESDDalitzPositronAfterTPCdEdxVsEta[iCut]);
767
768 hESDDalitzElectronAfterTPCdEdxVsPhi[iCut] = new TH2F("ESD_DalitzElectron_After_TPCdEdxVsPhi","ESD_DalitzElectron_After_TPCdEdxVsPhi",180,0,2*TMath::Pi(),200,-10,10);
769 fQAFolder[iCut]->Add(hESDDalitzElectronAfterTPCdEdxVsPhi[iCut]);
770
771 hESDDalitzPositronAfterTPCdEdxVsPhi[iCut] = new TH2F("ESD_DalitzPositron_After_TPCdEdxVsPhi","ESD_DalitzPositron_After_TPCdEdxVsPhi",180,0,2*TMath::Pi(),200,-10,10);
772 fQAFolder[iCut]->Add(hESDDalitzPositronAfterTPCdEdxVsPhi[iCut]);
773
774 hESDMotherPhi[iCut] = new TH1F("ESD_DalitzMother_Phi","ESD_DalitzMother_Phi",360,0,2*TMath::Pi());
775 fQAFolder[iCut]->Add(hESDMotherPhi[iCut]);
776
777 hESDEposEnegPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_PsiPair_DPhi","ESD_EposEneg_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
778 fQAFolder[iCut]->Add(hESDEposEnegPsiPairDPhi[iCut]);
2bb2434e 779
344100c4 780 hESDEposEnegInvMassPt[iCut] = new TH2F("ESD_EposEneg_InvMassPt","ESD_EposEneg_InvMassPt",4000,0.0,2.0,100,0.,10.);
781 fQAFolder[iCut]->Add(hESDEposEnegInvMassPt[iCut]);
782
783 hESDEposEnegAfterMassCutInvMassPi0Pt[iCut] = new TH2F("ESD_EposEneg_AfterMassCut_InvMassPi0Pt","ESD_EposEneg_AfterMassCut_InvMassPi0Pt",4000,0.0,2.0,100,0.,10.);
784 fQAFolder[iCut]->Add(hESDEposEnegAfterMassCutInvMassPi0Pt[iCut]);
785
786 hESDEposEnegInvMassPi0Pt[iCut] = new TH2F("ESD_EposEneg_InvMassPi0Pt","ESD_EposEneg_InvMassPi0Pt",1000,0.0,0.5,100,0.,10.);
787 fQAFolder[iCut]->Add(hESDEposEnegInvMassPi0Pt[iCut]);
788
789 hESDEposEnegLikeSignBackInvMassPt[iCut] = new TH2F("ESD_EposEneg_LikeSignBack_InvMassPt","ESD_EposEneg_LikeSignBack_InvMassPt",4000,0.0,2.,100,0.,10.);
790 fQAFolder[iCut]->Add(hESDEposEnegLikeSignBackInvMassPt[iCut]);
791
792 TAxis *AxisAfter = hESDDalitzElectronAfterTPCdEdxVsP[iCut]->GetXaxis();
793 Int_t bins = AxisAfter->GetNbins();
794 Double_t from = AxisAfter->GetXmin();
795 Double_t to = AxisAfter->GetXmax();
796 Double_t *newBins = new Double_t[bins+1];
797 newBins[0] = from;
798 Double_t factor = TMath::Power(to/from, 1./bins);
799 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
800
801 AxisAfter->Set(bins, newBins);
802 AxisAfter = hESDDalitzElectronAfterTPCdEdxSignalVsP[iCut]->GetXaxis();
803 AxisAfter->Set(bins, newBins);
804
805 AxisAfter = hESDDalitzPositronAfterTPCdEdxVsP[iCut]->GetXaxis();
806 AxisAfter->Set(bins, newBins);
807
808 AxisAfter = hESDDalitzPositronAfterTPCdEdxSignalVsP[iCut]->GetXaxis();
809 AxisAfter->Set(bins,newBins);
810
811 delete [] newBins;
812
813 fCutFolder[iCut]->Add(fQAFolder[iCut]);
814 }
815
816 hESDMotherInvMassPt[iCut] = new TH2F("ESD_DalitzMother_InvMass_Pt","ESD_DalitzMother_InvMass_Pt",800,0,0.8,250,0,25);
817 fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
818
819
820 if( fDoChicAnalysis) {
821 hESDPi0MotherInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_InvMass_Pt","ESD_Pi0Mother_InvMass_Pt",4000,0,4,250,0,25);
822 fESDList[iCut]->Add(hESDPi0MotherInvMassPt[iCut]);
823 hESDPi0MotherDiffInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_DiffInvMass_Pt","ESD_Pi0Mother_DiffInvMass_Pt",2000,0,2,250,0,25);
824 fESDList[iCut]->Add(hESDPi0MotherDiffInvMassPt[iCut]);
825 hESDPi0MotherDiffLimInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_DiffLimInvMass_Pt","ESD_Pi0Mother_DiffLimInvMass_Pt",2000,0,2,250,0,25);
826 fESDList[iCut]->Add(hESDPi0MotherDiffLimInvMassPt[iCut]);
827 }
828
829 hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_DalitzBackground_InvMass_Pt","ESD_DalitzBackground_InvMass_Pt",800,0,0.8,250,0,25);
830 fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
831
832 fCutFolder[iCut]->Add(fESDList[iCut]);
ae947965 833 }
30b9a400 834
835
344100c4 836 InitBack(); // Init Background Handler
837
838
839 if( fIsMC ){
840 // MC Histogramms
841 fMCList = new TList*[fnCuts];
842 // True Histogramms
843 fTrueList = new TList*[fnCuts];
844 hESDTrueConvGammaPt = new TH1F*[fnCuts];
845 hESDTruePositronPt = new TH1F*[fnCuts];
846 hESDTrueElectronPt = new TH1F*[fnCuts];
847 hESDTrueSecConvGammaPt = new TH1F*[fnCuts];
848 hESDTrueSecPositronPt = new TH1F*[fnCuts];
849 hESDTrueSecElectronPt = new TH1F*[fnCuts];
850 hESDTruePi0DalitzConvGammaPt = new TH1F*[fnCuts];
851 hESDTruePi0DalitzPositronPt = new TH1F*[fnCuts];
852 hESDTruePi0DalitzElectronPt = new TH1F*[fnCuts];
853 hESDTruePi0DalitzSecConvGammaPt = new TH1F*[fnCuts];
854 hESDTruePi0DalitzSecPositronPt = new TH1F*[fnCuts];
855 hESDTruePi0DalitzSecElectronPt = new TH1F*[fnCuts];
856 //if(fDoMesonAnalysis){
857 hMCAllGammaPt = new TH1F*[fnCuts];
858 hMCConvGammaPt = new TH1F*[fnCuts];
859 hMCConvGammaRSPt = new TH1F*[fnCuts];
860 hMCAllPositronsPt = new TH1F*[fnCuts];
861 hMCAllElectronsPt = new TH1F*[fnCuts];
862
863 if( fDoMesonQA ) {
2bb2434e 864
344100c4 865 hMCConvGammaEta = new TH1F*[fnCuts];
5950ee43 866 hMCConvGammaR = new TH1F*[fnCuts];
344100c4 867 hMCAllPositronsEta = new TH1F*[fnCuts];
868 hMCAllElectronsEta = new TH1F*[fnCuts];
869
5950ee43 870
344100c4 871 }
872 hMCPi0DalitzGammaPt = new TH1F*[fnCuts];
873 hMCPi0DalitzElectronPt = new TH1F*[fnCuts];
874 hMCPi0DalitzPositronPt = new TH1F*[fnCuts];
875
876 hMCPi0Pt = new TH1F*[fnCuts];
877 hMCPi0GGPt = new TH1F*[fnCuts];
878 hMCEtaPt = new TH1F*[fnCuts];
879 hMCEtaGGPt = new TH1F*[fnCuts];
880 hMCPi0InAccPt = new TH1F*[fnCuts];
881 hMCEtaInAccPt = new TH1F*[fnCuts];
5950ee43 882 hMCChiCPt = new TH1F*[fnCuts];
883 hMCChiCInAccPt = new TH1F*[fnCuts];
344100c4 884
885
886 if ( fDoMesonQA ) {
887
888 hMCPi0EposEnegInvMassPt = new TH2F*[fnCuts];
5950ee43 889 hMCEtaEposEnegInvMassPt = new TH2F*[fnCuts];
344100c4 890 hESDEposEnegTruePi0DalitzInvMassPt = new TH2F*[fnCuts];
891 hESDEposEnegTruePrimPi0DalitzInvMass = new TH1F*[fnCuts];
5950ee43 892 hESDEposEnegTruePi0DalitzPsiPairDPhi = new TH2F*[fnCuts];
344100c4 893 hESDEposEnegTrueEtaDalitzInvMassPt = new TH2F*[fnCuts];
894 hESDEposEnegTruePrimEtaDalitzInvMass = new TH1F*[fnCuts];
5950ee43 895 hESDEposEnegTrueEtaDalitzPsiPairDPhi = new TH2F*[fnCuts];
344100c4 896 hESDEposEnegTruePhotonInvMassPt = new TH2F*[fnCuts];
897 hESDEposEnegTrueInvMassPt = new TH2F*[fnCuts];
5950ee43 898 hESDEposEnegTruePhotonPsiPairDPhi = new TH2F*[fnCuts];
344100c4 899 hESDEposEnegTruePhotonPsiPairDPhiPtCut = new TH2F*[fnCuts];
900 hESDEposEnegTrueJPsiInvMassPt = new TH2F*[fnCuts];
5950ee43 901 hESDTrueConvGammaR = new TH1F*[fnCuts];
01d3a373 902 hESDTrueConvGammaRMC = new TH1F*[fnCuts];
344100c4 903 }
904
905
906 if( fDoChicAnalysis ){
907 hESDTrueMotherChiCInvMassPt = new TH2F*[fnCuts];
908 hESDTrueMotherChiCDiffInvMassPt = new TH2F*[fnCuts];
909 }
910
911
912 hESDTrueMotherInvMassPt = new TH2F*[fnCuts];
913 hESDTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
914 hESDTrueMotherPi0GGInvMassPt = new TH2F*[fnCuts];
915 hESDTruePrimaryMotherPi0GGInvMassPt = new TH2F*[fnCuts];
916 hESDTrueSecondaryMotherPi0GGInvMassPt = new TH2F*[fnCuts];
917 hESDTruePrimaryPi0DalitzESDPtMCPt = new TH2F*[fnCuts];
918 hESDTruePrimaryMotherInvMassMCPt = new TH2F*[fnCuts];
919 hESDTruePrimaryMotherInvMassPt = new TH2F*[fnCuts];
920 hESDTruePrimaryMotherW0WeightingInvMassPt = new TH2F*[fnCuts];
921 hESDTrueSecondaryMotherInvMassPt = new TH2F*[fnCuts];
922 hESDTrueSecondaryMotherFromK0sInvMassPt = new TH2F*[fnCuts];
923 hESDTrueBckGGInvMassPt = new TH2F*[fnCuts];
924 hESDTrueBckContInvMassPt = new TH2F*[fnCuts];
925 hESDTrueMotherGGInvMassPt = new TH2F*[fnCuts];
926 //}
927
928 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
929 TString cutstringEvent = ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber();
930 TString cutstringElectron = ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutNumber();
931 TString cutstringMeson = ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutNumber();
932 TString cutstringGamma = ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutNumber();
933
934 fMCList[iCut] = new TList();
935 fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
936 fMCList[iCut]->SetOwner(kTRUE);
937 fCutFolder[iCut]->Add(fMCList[iCut]);
938
939 hMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
940 fMCList[iCut]->Add(hMCAllGammaPt[iCut]);
941
942 hMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
943 fMCList[iCut]->Add(hMCConvGammaPt[iCut]);
944
945 hMCConvGammaRSPt[iCut] = new TH1F("MC_ConvGamma_RS_Pt","MC_ConvGamma_RS_Pt",250,0,25);
946 fMCList[iCut]->Add(hMCConvGammaRSPt[iCut]);
947
948 hMCAllPositronsPt[iCut] = new TH1F("MC_AllPositrons_Pt","MC_AllPositrons_Pt",1000,0,25);
949 fMCList[iCut]->Add(hMCAllPositronsPt[iCut]);
950
951 hMCAllElectronsPt[iCut] = new TH1F("MC_AllElectrons_Pt","MC_AllElectrons_Pt",1000,0,25);
952 fMCList[iCut]->Add(hMCAllElectronsPt[iCut]);
953
954 hMCPi0DalitzGammaPt[iCut] = new TH1F("MC_Pi0DalitzGamma_Pt","MC_Pi0DalitzGamma_Pt",250,0,25);
955 hMCPi0DalitzGammaPt[iCut]->Sumw2();
956 fMCList[iCut]->Add(hMCPi0DalitzGammaPt[iCut]);
957
958 if ( fDoMesonQA ){
959 hMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",600,-1.5,1.5);
960 fMCList[iCut]->Add(hMCConvGammaEta[iCut]);
5950ee43 961 hMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
962 fMCList[iCut]->Add(hMCConvGammaR[iCut]);
344100c4 963 hMCAllPositronsEta[iCut] = new TH1F("MC_AllPositrons_Eta","MC_AllPositrons_Eta",600,-1.5,1.5);
964 fMCList[iCut]->Add(hMCAllPositronsEta[iCut]);
965 hMCAllElectronsEta[iCut] = new TH1F("MC_AllElectrons_Eta","MC_AllElectrons_Eta",600,-1.5,1.5);
966 fMCList[iCut]->Add(hMCAllElectronsEta[iCut]);
967 }
968
969 hMCPi0DalitzPositronPt[iCut] = new TH1F("MC_Pi0DalitzPositron_Pt","MC_Pi0DalitzPositron_Pt",1000,0,25);
970 hMCPi0DalitzPositronPt[iCut]->Sumw2();
971 fMCList[iCut]->Add(hMCPi0DalitzPositronPt[iCut]);
972
973 hMCPi0DalitzElectronPt[iCut] = new TH1F("MC_Pi0DalitzElectron_Pt","MC_Pi0DalitzElectron_Pt",1000,0,25);
974 hMCPi0DalitzElectronPt[iCut]->Sumw2();
975 fMCList[iCut]->Add(hMCPi0DalitzElectronPt[iCut]);
976
977 hMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
978 hMCPi0Pt[iCut]->Sumw2();
979 fMCList[iCut]->Add(hMCPi0Pt[iCut]);
980
981 hMCPi0GGPt[iCut] = new TH1F("MC_Pi0_GG_Pt","MC_Pi0_GG_Pt",250,0,25);
982 hMCPi0GGPt[iCut]->Sumw2();
983 fMCList[iCut]->Add(hMCPi0GGPt[iCut]);
984
985 hMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
986 hMCEtaPt[iCut]->Sumw2();
987 fMCList[iCut]->Add(hMCEtaPt[iCut]);
2bb2434e 988
344100c4 989 hMCEtaGGPt[iCut] = new TH1F("MC_Eta_GG_Pt","MC_Eta_GG_Pt",250,0,25);
990 hMCEtaGGPt[iCut]->Sumw2();
991 fMCList[iCut]->Add(hMCEtaGGPt[iCut]);
992
993 hMCPi0InAccPt[iCut] = new TH1F("MC_Pi0DalitzInAcc_Pt","MC_Pi0DalitzInAcc_Pt",250,0,25);
994 hMCPi0InAccPt[iCut]->Sumw2();
995 fMCList[iCut]->Add(hMCPi0InAccPt[iCut]);
2bb2434e 996
344100c4 997 hMCEtaInAccPt[iCut] = new TH1F("MC_EtaDalitzInAcc_Pt","MC_EtaDalitzInAcc_Pt",250,0,25);
998 hMCEtaInAccPt[iCut]->Sumw2();
999 fMCList[iCut]->Add(hMCEtaInAccPt[iCut]);
1000
1001 hMCChiCPt[iCut] = new TH1F("MC_ChiC_Pt","MC_ChiC_Pt",250,0,25);
1002 fMCList[iCut]->Add(hMCChiCPt[iCut]);
2bb2434e 1003
344100c4 1004 hMCChiCInAccPt[iCut] = new TH1F("MC_ChiCInAcc_Pt","MC_ChiCInAcc_Pt",250,0,25);
1005 fMCList[iCut]->Add(hMCChiCInAccPt[iCut]);
1006
1007 if ( fDoMesonQA ) {
1008 hMCPi0EposEnegInvMassPt[iCut] = new TH2F("MC_Pi0EposEneg_InvMassPt","MC_Pi0EposEneg_InvMassPt",1000,0.0,0.5,100,0.,10.);
1009 fMCList[iCut]->Add(hMCPi0EposEnegInvMassPt[iCut]);
1010 hMCEtaEposEnegInvMassPt[iCut] = new TH2F("MC_EtaEposEneg_InvMassPt","MC_EtaEposEneg_InvMassPt",1400,0.,0.7,100,0.,10.);
1011 fMCList[iCut]->Add(hMCEtaEposEnegInvMassPt[iCut]);
1012 }
1013
1014 fTrueList[iCut] = new TList();
1015 fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
1016 fTrueList[iCut]->SetOwner(kTRUE);
1017 fCutFolder[iCut]->Add(fTrueList[iCut]);
1018
1019 if ( fDoMesonQA ) {
1020 hESDEposEnegTruePi0DalitzInvMassPt[iCut] = new TH2F("ESD_EposEneg_TruePi0Dalitz_InvMassPt","ESD_EposEneg_TruePi0Dalitz_InvMassPt",1000,0.0,0.5,100,0.,10.);
1021 fTrueList[iCut]->Add(hESDEposEnegTruePi0DalitzInvMassPt[iCut]);
1022
1023 hESDEposEnegTruePrimPi0DalitzInvMass[iCut] = new TH1F("ESD_EposEneg_TruePrimPi0Dalitz_InvMass","ESD_EposEneg_TruePrimPi0Dalitz_InvMass",500,0.,0.5);
1024 fTrueList[iCut]->Add(hESDEposEnegTruePrimPi0DalitzInvMass[iCut]);
2bb2434e 1025
344100c4 1026 hESDEposEnegTruePi0DalitzPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_TruePi0Dalitz_PsiPair_DPhi","ESD_EposEneg_TruePi0Dalitz_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
1027 fTrueList[iCut]->Add(hESDEposEnegTruePi0DalitzPsiPairDPhi[iCut]);
1028
1029 hESDEposEnegTrueEtaDalitzInvMassPt[iCut] = new TH2F("ESD_EposEneg_TrueEtaDalitz_InvMassPt","ESD_EposEneg_TrueEtaDalitz_InvMassPt",700,0.,0.7,100,0.,10.);
1030 fTrueList[iCut]->Add(hESDEposEnegTrueEtaDalitzInvMassPt[iCut]);
1031
1032 hESDEposEnegTruePrimEtaDalitzInvMass[iCut] = new TH1F("ESD_EposEneg_TruePrimEtaDalitz_InvMass","ESD_EposEneg_TruePrimEtaDalitz_InvMass",700,0.,0.7);
1033 fTrueList[iCut]->Add(hESDEposEnegTruePrimEtaDalitzInvMass[iCut]);
2bb2434e 1034
344100c4 1035 hESDEposEnegTrueEtaDalitzPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_TrueEtaDalitz_PsiPair_DPhi","ESD_EposEneg_TrueEtaDalitz_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
1036 fTrueList[iCut]->Add(hESDEposEnegTrueEtaDalitzPsiPairDPhi[iCut]);
1037
1038 hESDEposEnegTruePhotonInvMassPt[iCut] = new TH2F("ESD_EposEneg_TruePhoton_InvMassPt","ESD_EposEneg_TruePhoton_InvMassPt",500,0.,0.5,100,0.,10.);
1039 fTrueList[iCut]->Add(hESDEposEnegTruePhotonInvMassPt[iCut]);
1040
1041 hESDEposEnegTrueInvMassPt[iCut] = new TH2F("ESD_EposEneg_True_InvMassPt","ESD_EposEneg_True_InvMassPt",5000,0.,5.,100,0.,10.);
1042 fTrueList[iCut]->Add(hESDEposEnegTrueInvMassPt[iCut]);
1043
1044 hESDEposEnegTruePhotonPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_TruePhoton_PsiPair_DPhi","ESD_EposEneg_TruePhoton_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
1045 fTrueList[iCut]->Add(hESDEposEnegTruePhotonPsiPairDPhi[iCut]);
1046
1047 hESDEposEnegTruePhotonPsiPairDPhiPtCut[iCut] = new TH2F("ESD_EposEneg_TruePhoton_PsiPair_DPhi_PtCut","ESD_EposEneg_TruePhoton_PsiPair_DPhi_PtCut", 100, -1.0,1.0,100,-1.0,1.0 );
1048 fTrueList[iCut]->Add(hESDEposEnegTruePhotonPsiPairDPhiPtCut[iCut]);
1049
1050 hESDEposEnegTrueJPsiInvMassPt[iCut] = new TH2F("ESD_EposEneg_TrueJPsi_InvMassPt","ESD_EposEneg_TrueJPsi_InvMassPt",5000,0.,5.,100,0.,10.);
1051 fTrueList[iCut]->Add(hESDEposEnegTrueJPsiInvMassPt[iCut]);
5950ee43 1052
1053 hESDTrueConvGammaR[iCut] = new TH1F("ESD_TrueConvGamma_R","ESD_TrueConvGamma_R",800,0,200);
1054 fTrueList[iCut]->Add(hESDTrueConvGammaR[iCut]);
01d3a373 1055
1056 hESDTrueConvGammaRMC[iCut] = new TH1F("ESD_TrueConvGamma_R_MC","ESD_TrueConvGamma_R_MC",800,0,200);
1057 fTrueList[iCut]->Add(hESDTrueConvGammaRMC[iCut]);
1058
ae947965 1059 }
344100c4 1060
1061 hESDTruePositronPt[iCut] = new TH1F("ESD_TruePositron_Pt","ESD_TruePositron_Pt",1000,0,25);
1062 fTrueList[iCut]->Add(hESDTruePositronPt[iCut]);
1063
1064 hESDTrueElectronPt[iCut] = new TH1F("ESD_TrueElectron_Pt","ESD_TrueElectron_Pt",1000,0,25);
1065 fTrueList[iCut]->Add(hESDTrueElectronPt[iCut]);
1066
1067 hESDTrueSecPositronPt[iCut] = new TH1F("ESD_TrueSecPositron_Pt","ESD_TrueSecPositron_Pt",1000,0,25);
1068 fTrueList[iCut]->Add(hESDTrueSecPositronPt[iCut]);
1069
1070 hESDTrueSecElectronPt[iCut] = new TH1F("ESD_TrueSecElectron_Pt","ESD_TrueSecElectron_Pt",1000,0,25);
1071 fTrueList[iCut]->Add(hESDTrueSecElectronPt[iCut]);
1072
1073 hESDTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1074 fTrueList[iCut]->Add(hESDTrueConvGammaPt[iCut]);
1075
1076 hESDTrueSecConvGammaPt[iCut] = new TH1F("ESD_TrueSecConvGamma_Pt","ESD_TrueSecConvGamma_Pt",250,0,25);
1077 fTrueList[iCut]->Add(hESDTrueSecConvGammaPt[iCut]);
1078
1079 hESDTruePi0DalitzConvGammaPt[iCut] = new TH1F("ESD_TruePi0DalitzConvGamma_Pt","ESD_TruePi0DalitzConvGamma_Pt",250,0,25);
1080 fTrueList[iCut]->Add(hESDTruePi0DalitzConvGammaPt[iCut]);
1081
1082 hESDTruePi0DalitzElectronPt[iCut] = new TH1F("ESD_TruePi0DalitzElectron_Pt","ESD_TruePi0DalitzElectron_Pt",1000,0,25);
1083 fTrueList[iCut]->Add(hESDTruePi0DalitzElectronPt[iCut]);
1084
1085 hESDTruePi0DalitzPositronPt[iCut] = new TH1F("ESD_TruePi0DalitzPositron_Pt","ESD_TruePi0DalitzPositron_Pt",1000,0,25);
1086 fTrueList[iCut]->Add(hESDTruePi0DalitzPositronPt[iCut]);
1087
1088 hESDTruePi0DalitzSecConvGammaPt[iCut] = new TH1F("ESD_TruePi0DalitzSecConvGamma_Pt","ESD_TruePi0DalitzSecConvGamma_Pt",250,0,25);
1089 fTrueList[iCut]->Add(hESDTruePi0DalitzSecConvGammaPt[iCut]);
1090
1091 hESDTruePi0DalitzSecElectronPt[iCut] = new TH1F("ESD_TruePi0DalitzSecElectron_Pt","ESD_TruePi0DalitzSecElectron_Pt",1000,0,25);
1092 fTrueList[iCut]->Add(hESDTruePi0DalitzSecElectronPt[iCut]);
1093
1094 hESDTruePi0DalitzSecPositronPt[iCut] = new TH1F("ESD_TruePi0DalitzSecPositron_Pt","ESD_TruePi0DalitzSecPositron_Pt",1000,0,25);
1095 fTrueList[iCut]->Add(hESDTruePi0DalitzSecPositronPt[iCut]);
1096
1097 if( fDoChicAnalysis) {
1098 hESDTrueMotherChiCInvMassPt[iCut] = new TH2F("ESD_TrueMotherChiC_InvMass_Pt","ESD_TrueMotherChiC_InvMass_Pt",4000,0,4,250,0,25);
1099 fTrueList[iCut]->Add(hESDTrueMotherChiCInvMassPt[iCut]);
1100 hESDTrueMotherChiCDiffInvMassPt[iCut] = new TH2F("ESD_TrueMotherChiCDiff_InvMass_Pt","ESD_TrueMotherChiCDiff_InvMass_Pt",2000,0,2,250,0,25);
1101 fTrueList[iCut]->Add(hESDTrueMotherChiCDiffInvMassPt[iCut]);
ae947965 1102 }
344100c4 1103
1104 hESDTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
1105 hESDTrueMotherInvMassPt[iCut]->Sumw2();
1106 fTrueList[iCut]->Add(hESDTrueMotherInvMassPt[iCut]);
1107
1108 hESDTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueMother_Dalitz_InvMass_Pt","ESD_TrueMother_Dalitz_InvMass_Pt",800,0,0.8,250,0,25);
1109 hESDTrueMotherDalitzInvMassPt[iCut]->Sumw2();
1110 fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPt[iCut]);
1111
1112
1113
1114
1115
1116 hESDTrueMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TrueMotherPi0GG_InvMass_Pt","ESD_TrueMotherPi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1117 hESDTrueMotherPi0GGInvMassPt[iCut]->Sumw2();
1118 fTrueList[iCut]->Add(hESDTrueMotherPi0GGInvMassPt[iCut]);
1119
1120 hESDTruePrimaryMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMotherPi0GG_InvMass_Pt","ESD_TruePrimaryMotherPi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1121 hESDTruePrimaryMotherPi0GGInvMassPt[iCut]->Sumw2();
1122 fTrueList[iCut]->Add(hESDTruePrimaryMotherPi0GGInvMassPt[iCut]);
1123
1124 hESDTrueSecondaryMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherPi0GG_InvMass_Pt","ESD_TrueSecondaryMotherPi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1125 hESDTrueSecondaryMotherPi0GGInvMassPt[iCut]->Sumw2();
1126 fTrueList[iCut]->Add(hESDTrueSecondaryMotherPi0GGInvMassPt[iCut]);
1127
1128 hESDTruePrimaryPi0DalitzESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryPi0Dalitz_ESDPt_MCPt","ESD_TruePrimaryPi0Dalitz_ESDPt_MCPt",250,0,25,250,0,25);
1129 hESDTruePrimaryPi0DalitzESDPtMCPt[iCut]->Sumw2();
1130 fTrueList[iCut]->Add(hESDTruePrimaryPi0DalitzESDPtMCPt[iCut]);
1131 hESDTruePrimaryMotherInvMassMCPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_MCPt","ESD_TrueDalitzPrimaryMother_InvMass_MCPt",800,0,0.8,250,0,25);
1132 hESDTruePrimaryMotherInvMassMCPt[iCut]->Sumw2();
1133 fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassMCPt[iCut]);
1134 hESDTruePrimaryMotherInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_Pt","ESD_TruePrimaryMother_InvMass_Pt",800,0,0.8,250,0,25);
1135 hESDTruePrimaryMotherInvMassPt[iCut]->Sumw2();
1136 fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassPt[iCut]);
1137 hESDTruePrimaryMotherW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMotherW0Weighting_InvMass_Pt","ESD_TruePrimaryMotherW0Weighting_InvMass_Pt",800,0,0.8,250,0,25);
1138 hESDTruePrimaryMotherW0WeightingInvMassPt[iCut]->Sumw2();
1139 fTrueList[iCut]->Add(hESDTruePrimaryMotherW0WeightingInvMassPt[iCut]);
1140
1141 hESDTrueSecondaryMotherInvMassPt[iCut] = new TH2F("ESD_TrueDalitzSecondaryMother_InvMass_Pt","ESD_TrueDalitzSecondaryMother_InvMass_Pt",800,0,0.8,250,0,25);
1142 hESDTrueSecondaryMotherInvMassPt[iCut]->Sumw2();
1143 fTrueList[iCut]->Add(hESDTrueSecondaryMotherInvMassPt[iCut]);
1144 // hESDTrueSecondaryMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TrueDalitzSecondaryMotherFromK0s_InvMass_Pt","ESD_TrueDalitzSecondaryMotherFromK0s_InvMass_Pt",1000,0,1,250,0,25);
1145 // fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromK0sInvMassPt[iCut]);
1146 hESDTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueDalitzBckGG_InvMass_Pt","ESD_TrueDalitzBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1147 fTrueList[iCut]->Add(hESDTrueBckGGInvMassPt[iCut]);
1148 hESDTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueDalitzBckCont_InvMass_Pt","ESD_TrueDalitzBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1149 fTrueList[iCut]->Add(hESDTrueBckContInvMassPt[iCut]);
1150 // hESDTrueMotherGGInvMassPt[iCut] = new TH2F("ESD_TrueGammaGamma_InvMass_Pt","ESD_TrueGammaGamma_InvMass_Pt",1000,0,1,250,0,25);
1151 // fTrueList[iCut]->Add(hESDTrueMotherGGInvMassPt[iCut]);
1152
ae947965 1153 }
ae947965 1154 }
344100c4 1155
1156 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1157 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
9897e2f5 1158
344100c4 1159 if(fV0Reader)
1160 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
1161 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1162 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
9897e2f5 1163
344100c4 1164
1165
1166 fElecSelector=(AliDalitzElectronSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("ElectronSelector");
1167 if(!fElecSelector){printf("Error: No ElectronSelector");return;} // GetV0Reader
1168
1169 if( fElecSelector ){
1170 if ( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() ){
1171 fOutputContainer->Add( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() );
1172 }
1173 }
a280ac15 1174
344100c4 1175 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
a280ac15 1176
344100c4 1177 if( fCutElectronArray ){
1178 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutHistograms() ) {
1179 fCutFolder[iCut]->Add( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutHistograms() );
1180 }
ae947965 1181 }
344100c4 1182
1183 if( fCutMesonArray ) {
1184 if( ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutHistograms() ) {
1185 fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutHistograms());
1186 }
ae947965 1187 }
a280ac15 1188
344100c4 1189 if( fCutGammaArray ) {
1190 if( ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutHistograms() ) {
1191 fCutFolder[iCut]->Add( ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutHistograms() );
1192 }
1193 }
4fac3e9a 1194
1195 if( fCutEventArray )
1196 if( ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutHistograms()){
1197 fCutFolder[iCut]->Add(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutHistograms());
1198 }
344100c4 1199 }
a280ac15 1200
344100c4 1201 PostData(1, fOutputContainer);
1202
1203}
a280ac15 1204
344100c4 1205//______________________________________________________________________
1206void AliAnalysisTaskGammaConvDalitzV1::UserExec(Option_t *)
1207{
a280ac15 1208
344100c4 1209 //
1210 // Execute analysis for current event
1211 //
a280ac15 1212
344100c4 1213 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1214 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
a280ac15 1215
a280ac15 1216
344100c4 1217 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
a280ac15 1218
344100c4 1219 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1220 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1221 hNEvents[iCut]->Fill(eventQuality);
1222 }
1223 return;
1224 }
2bb2434e 1225
344100c4 1226 fElecSelector=(AliDalitzElectronSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("ElectronSelector");
1227 if(!fElecSelector){printf("Error: No ElectronSelector");return;} // GetV0Reader
2bb2434e 1228
fcc79cf5 1229
344100c4 1230 if(fIsMC) fMCEvent = MCEvent();
1231 fESDEvent = (AliESDEvent*)InputEvent();
1232 fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1233 fSelectorElectronIndex = fElecSelector->GetReconstructedElectronsIndex(); // Electrons from default Cut
1234 fSelectorPositronIndex = fElecSelector->GetReconstructedPositronsIndex(); // Positrons from default Cut
fcc79cf5 1235
344100c4 1236 CountESDTracks(); // Estimate Event Multiplicity
1237 fNumberOfESDTracks = fV0Reader->GetNumberOfPrimaryTracks();
1238 //AddTaskContainers(); //Add conatiner
fcc79cf5 1239
344100c4 1240 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1241 fiCut = iCut;
1242 fNVirtualGammas = 0;
fcc79cf5 1243
4fac3e9a 1244 Int_t eventNotAccepted =
1245 ((AliConvEventCuts*)fCutEventArray->At(iCut))
7f070437 1246 ->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
4fac3e9a 1247
1248
7f070437 1249 //Int_t eventNotAccepted = ((AliConvEventCuts*)fCutGammaArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
344100c4 1250
1251 if(eventNotAccepted){
1252 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1253 hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1254 continue;
1255 }
fcc79cf5 1256
344100c4 1257 if(eventQuality != 0){// Event Not Accepted
1258 // cout << "event rejected due to: " <<eventQuality << endl;
1259 hNEvents[iCut]->Fill(eventQuality);
1260 continue;
1261 }
2bb2434e 1262
344100c4 1263 hNEvents[iCut]->Fill(eventQuality);
1264 hNGoodESDTracks[iCut]->Fill(fNumberOfESDTracks);
1265
1266 if(((AliConvEventCuts*)fCutEventArray->At(iCut))->IsHeavyIon() == 2) hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
1267 else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1268
1269 if(fMCEvent){ // Process MC Particle
1270 fMCStack = fMCEvent->Stack();
1271 if(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetSignalRejection() != 0){
1272 ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetNotRejectedParticles( ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetSignalRejection(),
1273 ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetAcceptedHeader(),
1274 fMCEvent);
1275 }
1276 ProcessMCParticles();
1277 }
2bb2434e 1278
344100c4 1279 ProcessPhotonCandidates(); // Process this cuts gammas
1280 ProcessElectronCandidates(); // Process this cuts gammas
1281
1282 if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1283
1284 fUnsmearedPx = new Double_t[fGoodGammas->GetEntries()]; // Store unsmeared Momenta
1285 fUnsmearedPy = new Double_t[fGoodGammas->GetEntries()];
1286 fUnsmearedPz = new Double_t[fGoodGammas->GetEntries()];
1287 fUnsmearedE = new Double_t[fGoodGammas->GetEntries()];
1288
1289 for(Int_t gamma=0;gamma<fGoodGammas->GetEntries();gamma++){ // Smear the AODPhotons in MC
1290 fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Px();
1291 fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Py();
1292 fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Pz();
1293 fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->E();
1294 ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(gamma)));
1295 }
1296 }
1297
1298 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetUseVPhotonMCPmearing() && ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1299 // cout<<"Entro virtual photon smearing"<<endl;
1300 fUnsmearedVPx = new Double_t[fGoodVirtualGammas->GetEntries()]; // Store unsmeared Momenta
1301 fUnsmearedVPy = new Double_t[fGoodVirtualGammas->GetEntries()];
1302 fUnsmearedVPz = new Double_t[fGoodVirtualGammas->GetEntries()];
1303 fUnsmearedVE = new Double_t[fGoodVirtualGammas->GetEntries()];
1304
1305 for(Int_t Vgamma=0;Vgamma<fGoodVirtualGammas->GetEntries();Vgamma++){ // Smear the AODPhotons in MC
1306 fUnsmearedVPx[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->Px();
1307 fUnsmearedVPy[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->Py();
1308 fUnsmearedVPz[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->Pz();
1309 fUnsmearedVE[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->E();
1310 ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->SmearVirtualPhoton(dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(Vgamma)));
1311 }
1312 }
1313
1314 ProcessVirtualGammasCandidates();
1315 CalculatePi0DalitzCandidates();
1316 CalculateBackground();
1317 UpdateEventByEventData();
1318
1319 if ( fDoMesonQA ) {
1320 hNGoodESDTracksVsNGoodGammas[iCut]->Fill(fNumberOfESDTrackskBoth,fGoodGammas->GetEntries());
1321 hNGoodESDTracksVsNGoodVGammas[iCut]->Fill(fNumberOfESDTrackskBoth,fNVirtualGammas);
1322 }
1323
1324
1325 if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1326
1327 for(Int_t gamma=0;gamma<fGoodGammas->GetEntries();gamma++){ // Smear the AODPhotons in MC
1328 ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
1329 ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPy(fUnsmearedPy[gamma]);
1330 ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPz(fUnsmearedPz[gamma]);
1331 ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetE(fUnsmearedE[gamma]);
1332 }
1333 delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
1334 delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
1335 delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
1336 delete[] fUnsmearedE; fUnsmearedE = 0x0;
1337 }
1338
1339 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetUseVPhotonMCPmearing() && ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1340
1341 for(Int_t Vgamma=0;Vgamma<fGoodVirtualGammas->GetEntries();Vgamma++){ // Smear the AODPhotons in MC
1342 ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetPx(fUnsmearedVPx[Vgamma]); // Reset Unsmeared Momenta
1343 ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetPy(fUnsmearedVPy[Vgamma]);
1344 ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetPz(fUnsmearedVPz[Vgamma]);
1345 ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetE(fUnsmearedVE[Vgamma]);
1346 }
1347 delete[] fUnsmearedVPx; fUnsmearedVPx = 0x0;
1348 delete[] fUnsmearedVPy; fUnsmearedVPy = 0x0;
1349 delete[] fUnsmearedVPz; fUnsmearedVPz = 0x0;
1350 delete[] fUnsmearedVE; fUnsmearedVE = 0x0;
1351 }
1352 fGoodGammas->Clear(); // delete this cuts good gammas
1353 fGoodVirtualGammas->Clear(); // delete this cuts good gammas
1354 }
2bb2434e 1355
344100c4 1356 fSelectorElectronIndex.clear();
1357 fSelectorPositronIndex.clear();
2bb2434e 1358
344100c4 1359 PostData( 1, fOutputContainer );
1360}
7ab8e97e 1361
344100c4 1362Bool_t AliAnalysisTaskGammaConvDalitzV1::Notify()
1363{
1364 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
e3dbd03c 1365
344100c4 1366 if( !((AliConvEventCuts*)fCutEventArray->At(iCut))->GetDoEtaShift() ){
1367
344100c4 1368 hEtaShift[iCut]->Fill(0.,0.);
1369 continue; // No Eta Shift requested, continue
7ab8e97e 1370 }
344100c4 1371
1372
1373 if( ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1374 ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
1375 ((AliConvEventCuts*)fCutEventArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
e3dbd03c 1376 hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift()));
344100c4 1377 continue;
1378 } else {
1379 printf(" Gamma Conversion Dalitz Task %s :: Eta Shift Manually Set to %f \n\n",
1380 (((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift());
1381 ((AliConvEventCuts*)fCutEventArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
344100c4 1382 hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift()));
1383 }
1384 }
1385
1386 return kTRUE;
1387}
a280ac15 1388
344100c4 1389//________________________________________________________________________
1390void AliAnalysisTaskGammaConvDalitzV1::Terminate(const Option_t *)
1391{
1392 ///Grid
2bb2434e 1393}
1394
1395//________________________________________________________________________
344100c4 1396void AliAnalysisTaskGammaConvDalitzV1::ProcessPhotonCandidates()
1397{
1398 Int_t nV0 = 0;
1399 TList *GoodGammasStepOne = new TList();
1400 TList *GoodGammasStepTwo = new TList();
1401 // Loop over Photon Candidates allocated by ReaderV1
1402
1403 for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
1404 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
1405 if(!PhotonCandidate) continue;
1406 fIsFromMBHeader = kTRUE;
1407 if( fMCEvent && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0 ){
1408 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1409 if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
1410 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack,fInputEvent);
1411 if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
1412 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1413 }
1414
1415 if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fESDEvent)) continue;
2bb2434e 1416
344100c4 1417 if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut() &&
1418 !((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){ // if no post reader loop is required add to events good gammas
1419
1420 fGoodGammas->Add(PhotonCandidate);
1421 if(fIsFromMBHeader){
1422 hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1423 hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1424 if( fDoMesonQA ) hESDConvGammaZR[fiCut]->Fill(PhotonCandidate->GetConversionZ(),PhotonCandidate->GetConversionRadius());
1425 }
1426 if(fMCEvent){
1427 ProcessTruePhotonCandidates(PhotonCandidate);
1428 }
1429 } else if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1430 ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
1431 nV0++;
1432 GoodGammasStepOne->Add(PhotonCandidate);
1433 } else if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut() &&
1434 ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
1435 GoodGammasStepTwo->Add(PhotonCandidate);
ae947965 1436 }
344100c4 1437 }
1438
1439
1440 if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut()){
1441 for(Int_t i = 0;i<GoodGammasStepOne->GetEntries();i++){
1442 AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GoodGammasStepOne->At(i);
1443 if(!PhotonCandidate) continue;
1444 fIsFromMBHeader = kTRUE;
1445 if(fMCEvent && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0){
1446 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack,fInputEvent);
1447 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack,fInputEvent);
1448 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1449 }
1450
1451 if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GoodGammasStepOne->GetEntries())) continue;
1452 if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1453 fGoodGammas->Add(PhotonCandidate);
1454
1455 if(fIsFromMBHeader){
1456 hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1457 hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1458 if( fDoMesonQA )hESDConvGammaZR[fiCut]->Fill(PhotonCandidate->GetConversionZ(),PhotonCandidate->GetConversionRadius());
1459 }
1460
1461 if(fMCEvent){
1462 ProcessTruePhotonCandidates(PhotonCandidate);
1463 }
1464 } else GoodGammasStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
fcc79cf5 1465 }
344100c4 1466 }
1467 if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){
1468 for(Int_t i = 0;i<GoodGammasStepTwo->GetEntries();i++){
1469 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GoodGammasStepTwo->At(i);
1470 if(!PhotonCandidate) continue;
1471 if(fMCEvent && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0){
1472 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack,fInputEvent);
1473 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack,fInputEvent);
1474 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1475 }
1476 if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GoodGammasStepTwo,i)) continue;
1477 fGoodGammas->Add(PhotonCandidate); // Add gamma to current cut TList
1478
1479 if(fIsFromMBHeader){
1480 hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt()); // Differences to old V0Reader in p_t due to conversion KF->TLorentzVector
1481 hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1482 if(fDoMesonQA)hESDConvGammaZR[fiCut]->Fill(PhotonCandidate->GetConversionZ(),PhotonCandidate->GetConversionRadius());
1483 }
1484
1485 if(fMCEvent){
1486 ProcessTruePhotonCandidates(PhotonCandidate);
1487 }
1488 }
1489 }
1490
1491 delete GoodGammasStepOne;
1492 GoodGammasStepOne = 0x0;
1493 delete GoodGammasStepTwo;
1494 GoodGammasStepTwo = 0x0;
2bb2434e 1495}
1496
1497//________________________________________________________________________
344100c4 1498void AliAnalysisTaskGammaConvDalitzV1::ProcessTruePhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1499{
1500 // Process True Photons
1501 AliStack *MCStack = fMCEvent->Stack();
1502 TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(MCStack);
1503 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(MCStack);
1504
1505 if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1506 if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){ // Not Same Mother == Combinatorial Bck
1507 return;
1508 } else if (posDaughter->GetMother(0) == -1){
1509 return;
1510 }
1511
1512 if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11) return; //One Particle is not electron
1513 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
1514 if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
a280ac15 1515
344100c4 1516 TParticle *Photon = TruePhotonCandidate->GetMCParticle(MCStack);
1517 if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
2bb2434e 1518
344100c4 1519 // True Photon
1520
1521 Int_t labelGamma = TruePhotonCandidate->GetMCParticleLabel(MCStack);
1522
1523 if( labelGamma < MCStack->GetNprimary() ){
1524 if( fIsFromMBHeader ){
1525 hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
01d3a373 1526 if(fDoMesonQA){
1527 hESDTrueConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
1528 hESDTrueConvGammaRMC[fiCut]->Fill( posDaughter->R() );
1529 }
344100c4 1530 }
1531 } else {
1532 if( fIsFromMBHeader){
1533 hESDTrueSecConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1534 }
1535 }
1536
1537 if( IsPi0DalitzDaughter(labelGamma) == kTRUE ) {
1538 if( labelGamma < MCStack->GetNprimary() ) {
1539 if( fIsFromMBHeader ){
1540 hESDTruePi0DalitzConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1541 }
1542 } else {
1543 if( fIsFromMBHeader ) {
1544 hESDTruePi0DalitzSecConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1545 }
1546 }
1547 }
1548
1549
1550}
1551//________________________________________________________________________
1552void AliAnalysisTaskGammaConvDalitzV1::ProcessVirtualGammasCandidates(){
1553
1554 Double_t magField = fInputEvent->GetMagneticField();
2bb2434e 1555
1556
344100c4 1557 if( magField < 0.0 ){
1558 magField = 1.0;
1559 }
1560 else {
1561 magField = -1.0;
1562 }
1563
1564 AliStack *MCStack = 0x0;
1565
1566 if( fMCEvent ){
1567 MCStack = fMCEvent->Stack();
1568 }
1569
1570
1571 for(Int_t virtualGammaIndex=0; virtualGammaIndex < fGoodVirtualGammas->GetEntries(); virtualGammaIndex++ ){
1572 AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(virtualGammaIndex));
1573
1574 AliESDtrack* positronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
1575 AliESDtrack* electronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
1576
1577 Bool_t isPhoton = kFALSE;
1578 Bool_t isPi0Dalitz = kFALSE;
1579 Bool_t isEtaDalitz = kFALSE;
1580 Bool_t isJPsi = kFALSE;
1581 Bool_t isTrueEposENeg = kFALSE;
1582 Bool_t isMotherPrimary = kFALSE;
1583
1584 Double_t psiPair = GetPsiPair(positronVgamma,electronVgamma);
1585 Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronVgamma->GetConstrainedParam()->Phi()-positronVgamma->GetConstrainedParam()->Phi());
1586
1587 if ( fDoMesonQA ) {
1588
1589 hESDEposEnegPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
1590 hESDEposEnegInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
1591
1592 //cout<<"GetMass() "<<Vgamma->GetMass()<<" M "<<Vgamma->M()<<endl;
1593 if( fMCEvent ) {
2bb2434e 1594
344100c4 1595 Int_t virtualGammaMCLabel = Vgamma->GetMCParticleLabel(MCStack);
1596
1597 TParticle * negativeMC = 0x0;
1598 TParticle * positiveMC = 0x0;
1599 TParticle * mcVgamma = 0x0;
1600
1601 if( virtualGammaMCLabel != -1 ){
1602 mcVgamma = (TParticle*)MCStack->Particle(virtualGammaMCLabel);
1603 }
1604
1605 negativeMC = (TParticle*)Vgamma->GetNegativeMCDaughter(MCStack);
1606 positiveMC = (TParticle*)Vgamma->GetPositiveMCDaughter(MCStack);
1607
1608
1609 if( negativeMC && positiveMC ) {
1610 if( positiveMC->GetPdgCode() == ::kPositron && negativeMC->GetPdgCode() == ::kElectron )
1611 isTrueEposENeg = kTRUE;
1612 if( positiveMC->GetMother(0) > -1 && positiveMC->GetMother(0) < fMCStack->GetNprimary() )
1613 isMotherPrimary = kTRUE;
1614 }
1615 if(mcVgamma){
1616 // Check if it is a true photon
1617 if(mcVgamma->GetPdgCode() == 22){
1618 isPhoton = kTRUE;
1619 } else if(mcVgamma->GetPdgCode() == 443){
1620 isJPsi = kTRUE;
1621 } else if( IsDalitz( mcVgamma ) ){
1622 if ( mcVgamma->GetPdgCode() == 111 ) isPi0Dalitz = kTRUE;
1623 else if( mcVgamma->GetPdgCode() == 221 ) isEtaDalitz = kTRUE;
1624 }
1625 }
2bb2434e 1626
344100c4 1627 if(isPhoton){
1628 hESDEposEnegTruePhotonInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
1629 hESDEposEnegTruePhotonPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
1630 if( Vgamma->Pt() > 1.5 ){
1631 hESDEposEnegTruePhotonPsiPairDPhiPtCut[fiCut]->Fill(deltaPhi,psiPair);
1632 }
1633 } else if(isJPsi){
1634 hESDEposEnegTrueJPsiInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
1635 } else if(isPi0Dalitz){
1636 hESDEposEnegTruePi0DalitzInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
1637 hESDEposEnegTruePi0DalitzPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
1638 if( isMotherPrimary ) hESDEposEnegTruePrimPi0DalitzInvMass[fiCut]->Fill( Vgamma->M() );
1639 } else if(isEtaDalitz){
1640 hESDEposEnegTrueEtaDalitzInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
1641 hESDEposEnegTrueEtaDalitzPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
1642 if( isMotherPrimary ) hESDEposEnegTruePrimEtaDalitzInvMass[fiCut]->Fill( Vgamma->M() );
1643 }
1644
1645 if( isTrueEposENeg ) hESDEposEnegTrueInvMassPt[fiCut]->Fill(Vgamma->M(), Vgamma->Pt());
1646
1647 }
1648 }
1649 }
1650}
1651
1652//________________________________________________________________________
1653void AliAnalysisTaskGammaConvDalitzV1::ProcessElectronCandidates(){
2bb2434e 1654
344100c4 1655 Double_t magField = fInputEvent->GetMagneticField();
2bb2434e 1656
344100c4 1657 if( magField < 0.0 ){
1658 magField = 1.0;
1659 } else {
1660 magField = -1.0;
1661 }
2bb2434e 1662
344100c4 1663 vector<Int_t> lGoodElectronIndexPrev(0);
1664 vector<Int_t> lGoodPositronIndexPrev(0);
1665
1666 for(UInt_t i = 0; i < fSelectorElectronIndex.size(); i++){
1667
1668 AliESDtrack* electronCandidate = fESDEvent->GetTrack(fSelectorElectronIndex[i]);
1669
1670 if( fMCEvent ) {
1671 Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
1672 Int_t isMCFromMBHeader = -1;
1673 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0) {
1674 isMCFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(labelelectron,fMCStack,fInputEvent);
1675 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
1676 }
1677 }
1678
1679 if(! ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelected(electronCandidate) ) continue;
1680
1681 lGoodElectronIndexPrev.push_back( fSelectorElectronIndex[i] );
1682 hESDDalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
1683 hESDDalitzElectronPhi[fiCut]->Fill(electronCandidate->Phi());
1684
1685
1686 if( fMCEvent ) {
1687
1688 Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
1689 if( labelelectron < fMCStack->GetNtrack() ){
1690 TParticle* electron = fMCStack->Particle(labelelectron);
1691 if( electron->GetPdgCode() == 11 ){
1692 if( labelelectron < fMCStack->GetNprimary() ){
1693 hESDTrueElectronPt[fiCut]->Fill(electronCandidate->Pt()); //primary electron
1694 } else {
1695 hESDTrueSecElectronPt[fiCut]->Fill(electronCandidate->Pt()); //secondary electron
1696 }
1697 if( IsPi0DalitzDaughter(labelelectron) == kTRUE ) {
1698 if( labelelectron < fMCStack->GetNprimary() ) {
1699 hESDTruePi0DalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
1700 } else {
1701 hESDTruePi0DalitzSecElectronPt[fiCut]->Fill(electronCandidate->Pt());
1702 }
1703 }
1704 }
1705 }
1706 }
1707 }
2bb2434e 1708
344100c4 1709 for(UInt_t i = 0; i < fSelectorPositronIndex.size(); i++){
2bb2434e 1710
344100c4 1711 AliESDtrack* positronCandidate = fESDEvent->GetTrack( fSelectorPositronIndex[i] );
1712
1713 if( fMCEvent ) {
1714
1715 Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
1716 Int_t isMCFromMBHeader = -1;
1717
1718 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0) {
1719 isMCFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(labelpositron,fMCStack,fInputEvent);
1720 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
1721 }
1722 }
1723
1724 if(! ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelected(positronCandidate) ) continue;
1725
1726 lGoodPositronIndexPrev.push_back( fSelectorPositronIndex[i] );
1727 hESDDalitzPositronPt[fiCut]->Fill( positronCandidate->Pt() );
1728 hESDDalitzPositronPhi[fiCut]->Fill( positronCandidate->Phi() );
1729
1730 if( fMCEvent ) {
1731 Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
1732
1733 if( labelpositron < fMCStack->GetNtrack() ) {
1734 TParticle* positron = fMCStack->Particle(labelpositron);
1735 if( positron->GetPdgCode() == -11 ){
1736 if( labelpositron < fMCStack->GetNprimary() ){
1737 hESDTruePositronPt[fiCut]->Fill(positronCandidate->Pt());
1738 } else {
1739 hESDTrueSecPositronPt[fiCut]->Fill(positronCandidate->Pt());
1740 }
1741 if( IsPi0DalitzDaughter(labelpositron) == kTRUE ) {
1742 if( labelpositron < fMCStack->GetNprimary() ){
1743 hESDTruePi0DalitzPositronPt[fiCut]->Fill(positronCandidate->Pt());
1744 } else {
1745 hESDTruePi0DalitzSecPositronPt[fiCut]->Fill(positronCandidate->Pt());
1746 }
1747 }
1748 }
1749 }
1750 }
1751 }
a280ac15 1752
344100c4 1753 vector<Bool_t> lElectronPsiIndex(lGoodElectronIndexPrev.size(), kTRUE);
1754 vector<Bool_t> lPositronPsiIndex(lGoodPositronIndexPrev.size(), kTRUE);
2bb2434e 1755
344100c4 1756 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->DoPsiPairCut() == kTRUE ){
1757 for( UInt_t i = 0; i < lGoodElectronIndexPrev.size(); i++ ) {
1758 AliESDtrack *electronCandidate = fESDEvent->GetTrack(lGoodElectronIndexPrev[i]);
1759 for(UInt_t j = 0; j < lGoodPositronIndexPrev.size(); j++){
1760 AliESDtrack *positronCandidate = fESDEvent->GetTrack(lGoodPositronIndexPrev[j]);
1761 Double_t psiPair = GetPsiPair(positronCandidate,electronCandidate);
1762 Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->GetConstrainedParam()->Phi()-positronCandidate->GetConstrainedParam()->Phi());
2bb2434e 1763
344100c4 1764 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->IsFromGammaConversion(psiPair,deltaPhi ) ){
1765 lElectronPsiIndex[i] = kFALSE;
1766 lPositronPsiIndex[j] = kFALSE;
1767 }
1768 }
1769 }
1770 }
8a52eed5 1771
344100c4 1772 vector<Int_t> lGoodElectronIndex(0);
1773 vector<Int_t> lGoodPositronIndex(0);
1774
1775 for( UInt_t i = 0; i < lGoodElectronIndexPrev.size(); i++ ) {
1776 if( lElectronPsiIndex[i] == kTRUE )
1777 lGoodElectronIndex.push_back( lGoodElectronIndexPrev[i] );
1778 }
a280ac15 1779
344100c4 1780 for( UInt_t i = 0; i < lGoodPositronIndexPrev.size(); i++ ) {
1781 if( lPositronPsiIndex[i] == kTRUE )
1782 lGoodPositronIndex.push_back( lGoodPositronIndexPrev[i] );
1783 }
a280ac15 1784
344100c4 1785 for(UInt_t i = 0; i < lGoodElectronIndex.size(); i++){
1786 AliESDtrack *electronCandidate = fESDEvent->GetTrack(lGoodElectronIndex[i]);
1787 AliKFParticle electronCandidateKF( *electronCandidate->GetConstrainedParam(), ::kElectron );
1788 TLorentzVector electronCandidateTLV;
1789 electronCandidateTLV.SetXYZM(electronCandidate->GetConstrainedParam()->Px(),electronCandidate->GetConstrainedParam()->Py(),electronCandidate->GetConstrainedParam()->Pz(),TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass());
1790
2bb2434e 1791
344100c4 1792 for(UInt_t j = 0; j < lGoodPositronIndex.size(); j++){
2bb2434e 1793
344100c4 1794 AliESDtrack *positronCandidate = fESDEvent->GetTrack(lGoodPositronIndex[j]);
1795 AliKFParticle positronCandidateKF( *positronCandidate->GetConstrainedParam(), ::kPositron );
1796 TLorentzVector positronCandidateTLV;
1797
1798 positronCandidateTLV.SetXYZM(positronCandidate->GetConstrainedParam()->Px(),positronCandidate->GetConstrainedParam()->Py(),positronCandidate->GetConstrainedParam()->Pz(),TDatabasePDG::Instance()->GetParticle( ::kPositron )->Mass());
1799 TLorentzVector *virtualPhotonTLV = 0;
1800 AliKFConversionPhoton* virtualPhoton = NULL;
1801 AliAODConversionPhoton *vphoton;
1802
1803 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetUseElectronMCSmearing() && ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseMCPSmearing() && fMCEvent){
1804 TLorentzVector smearelectronCandidateTLV = ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->SmearElectron(electronCandidateTLV);
1805 TLorentzVector smearpositronCandidateTLV = ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->SmearElectron(positronCandidateTLV);
1806 virtualPhotonTLV = new TLorentzVector( smearelectronCandidateTLV + smearpositronCandidateTLV );
1807 //TLorentzVector temp = electronCandidateTLV + positronCandidateTLV;
1808 //cout<<"Mass: "<<"NoSmearElectrons "<<temp.M() <<" SmearElectrons "<<virtualPhotonTLV->M()<<endl;
1809 vphoton= new AliAODConversionPhoton(virtualPhotonTLV);
1810 vphoton->SetMass(virtualPhotonTLV->M());
1811 } else {
1812 virtualPhoton = new AliKFConversionPhoton(electronCandidateKF,positronCandidateKF);
1813 if( fSetProductionVertextoVGamma == kTRUE ){
1814 AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
1815 primaryVertexImproved+=*virtualPhoton;
1816 virtualPhoton->SetProductionVertex(primaryVertexImproved);
1817 }
2bb2434e 1818
344100c4 1819 vphoton= new AliAODConversionPhoton(virtualPhoton);
1820 }
1821 //virtualPhoton->SetTrackLabels( lGoodPositronIndex[j], lGoodElectronIndex[i]);
1822 vphoton->SetTrackLabels( lGoodPositronIndex[j], lGoodElectronIndex[i]);
4803eb1f 1823
344100c4 1824 if( fMCEvent ) {
1825 Int_t labeln=TMath::Abs(electronCandidate->GetLabel());
1826 Int_t labelp=TMath::Abs(positronCandidate->GetLabel());
1827 TParticle *fNegativeMCParticle = fMCStack->Particle(labeln);
1828 TParticle *fPositiveMCParticle = fMCStack->Particle(labelp);
1829 if( fPositiveMCParticle && fNegativeMCParticle) {
1830 //virtualPhoton->SetMCLabelPositive(labelp);
1831 //virtualPhoton->SetMCLabelNegative(labeln);
1832 vphoton->SetMCLabelPositive(labelp);
1833 vphoton->SetMCLabelNegative(labeln);
1834
1835 }
ae947965 1836 }
344100c4 1837
1838
1839 fGoodVirtualGammas->Add( vphoton );
1840
1841 if( virtualPhoton ){
1842 delete virtualPhoton;
1843 virtualPhoton=NULL;
1844 }
1845 if ( virtualPhotonTLV ){
1846 delete virtualPhotonTLV;
1847 virtualPhotonTLV=NULL;
1848 }
1849
1850 }
1851 }
1852
1853 //Computing mixing event
1854 if( fDoMesonQA ) {
1855 for(UInt_t i = 0; i < lGoodElectronIndex.size(); i++){
1856 AliESDtrack *electronCandidate1 = fESDEvent->GetTrack(lGoodElectronIndex[i]);
1857 AliKFParticle electronCandidate1KF( *electronCandidate1->GetConstrainedParam(), ::kElectron );
1858
1859 for(UInt_t j = i+1; j < lGoodElectronIndex.size(); j++){
1860
1861 AliESDtrack *electronCandidate2 = fESDEvent->GetTrack(lGoodElectronIndex[j]);
1862 AliKFParticle electronCandidate2KF( *electronCandidate2->GetConstrainedParam(), ::kElectron );
1863 AliKFConversionPhoton* virtualPhoton = new AliKFConversionPhoton(electronCandidate1KF,electronCandidate2KF);
1864
1865 //AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
1866 //primaryVertexImproved+=*virtualPhoton;
1867 //virtualPhoton->SetProductionVertex(primaryVertexImproved);
1868
1869 AliAODConversionPhoton *vphoton = new AliAODConversionPhoton(virtualPhoton);
1870 hESDEposEnegLikeSignBackInvMassPt[fiCut]->Fill(vphoton->M(),vphoton->Pt());
1871 delete vphoton;
1872 delete virtualPhoton;
1873 vphoton = 0x0;
1874 virtualPhoton = 0x0;
1875 }
1876 }
1877
1878
1879 for(UInt_t i = 0; i < lGoodPositronIndex.size(); i++){
1880 AliESDtrack *positronCandidate1 = fESDEvent->GetTrack(lGoodPositronIndex[i]);
1881 AliKFParticle positronCandidate1KF( *positronCandidate1->GetConstrainedParam(), ::kPositron );
1882
1883 for(UInt_t j = i+1; j < lGoodPositronIndex.size(); j++){
1884
1885 AliESDtrack *positronCandidate2 = fESDEvent->GetTrack(lGoodPositronIndex[j]);
1886 AliKFParticle positronCandidate2KF( *positronCandidate2->GetConstrainedParam(), ::kPositron );
1887 AliKFConversionPhoton* virtualPhoton = new AliKFConversionPhoton(positronCandidate1KF,positronCandidate2KF);
1888 //AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
1889 //primaryVertexImproved+=*virtualPhoton;
1890 //virtualPhoton->SetProductionVertex(primaryVertexImproved);
1891
1892 AliAODConversionPhoton *vphoton = new AliAODConversionPhoton(virtualPhoton);
1893 hESDEposEnegLikeSignBackInvMassPt[fiCut]->Fill(vphoton->M(),vphoton->Pt());
1894 delete vphoton;
1895 delete virtualPhoton;
1896 vphoton = 0x0;
1897 virtualPhoton = 0x0;
1898
1899 }
1900 }
1901 }
2bb2434e 1902}
a280ac15 1903
344100c4 1904//________________________________________________________________________
1905void AliAnalysisTaskGammaConvDalitzV1::CalculatePi0DalitzCandidates(){
2bb2434e 1906
344100c4 1907 // Conversion Gammas
1908 if( fGoodGammas->GetEntries() > 0 && fGoodVirtualGammas->GetEntries() > 0 ){
1909 vector<Bool_t> lGoodVirtualGamma(fGoodVirtualGammas->GetEntries(), kFALSE);
1910
1911 for(Int_t GammaIndex=0; GammaIndex<fGoodGammas->GetEntries(); GammaIndex++){
1912 AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(GammaIndex));
1913 if (gamma==NULL) continue;
1914 for(Int_t virtualGammaIndex=0;virtualGammaIndex<fGoodVirtualGammas->GetEntries();virtualGammaIndex++){
1915 AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(virtualGammaIndex));
1916 if (Vgamma==NULL) continue;
1917 //Check for same Electron ID
d734058d 1918 if(gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelPositive() ||
1919 gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelNegative() ||
1920 gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelPositive() ||
1921 gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelNegative() ) continue;
344100c4 1922
1923 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma,Vgamma);
1924 pi0cand->SetLabels(GammaIndex,virtualGammaIndex);
1925
2bb2434e 1926
344100c4 1927 if( ( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift())) ){
1928
1929 //cout<< "Meson Accepted "<<endl;
1930
1931 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
1932 Int_t mbin = 0;
1933 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->UseTrackMultiplicity() ){
1934 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
1935 } else {
1936 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
1937 }
1938
1939 if ( fDoMesonQA ) {
1940 hESDEposEnegInvMassPi0Pt[fiCut]->Fill( Vgamma->M(), pi0cand->Pt() );
1941 if( pi0cand->M() > 0.1 && pi0cand->M() < 0.145 ){
1942 hESDEposEnegAfterMassCutInvMassPi0Pt[fiCut]->Fill(Vgamma->M(),pi0cand->Pt());
1943 }
1944 }
1945
1946 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
1947 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( pi0cand->Pt() , Vgamma->M() ) == kTRUE ){
a280ac15 1948
344100c4 1949 hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1950 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
1951 sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
d734058d 1952
1953 if(fMCEvent){
1954 ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
1955 }
344100c4 1956
1957 if ( fDoMesonQA ) {
1958 hESDMotherPhi[fiCut]->Fill(pi0cand->Phi());
1959 if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
1960
1961 FillElectronQAHistos(Vgamma);
1962
1963 lGoodVirtualGamma[virtualGammaIndex] = kTRUE;
1964 fNVirtualGammas++;
1965 }
1966 }
1967 }
1968 } else {
1969 hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1970 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
1971 sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
1972
d734058d 1973 if(fMCEvent){
1974 ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
1975 }
1976
344100c4 1977 if ( fDoMesonQA ) {
1978 hESDMotherPhi[fiCut]->Fill(pi0cand->Phi());
1979 if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
1980 FillElectronQAHistos(Vgamma);
1981 lGoodVirtualGamma[virtualGammaIndex] = kTRUE;
1982 fNVirtualGammas++;
1983 }
1984 }
1985 }
1986
1987 if( fDoChicAnalysis) {
1988
1989 hESDPi0MotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1990 Double_t diffMass = pi0cand->M() - Vgamma->M();
1991 hESDPi0MotherDiffInvMassPt[fiCut]->Fill( diffMass , pi0cand->Pt() );
1992
1993 if( Vgamma->M() > 2.5 && Vgamma->M() < 3.4){
1994 hESDPi0MotherDiffLimInvMassPt[fiCut]->Fill( diffMass , pi0cand->Pt() );
1995 }
d734058d 1996
1997 if(fMCEvent){
1998 ProcessTrueChicCandidates(pi0cand,gamma,Vgamma);
1999 }
2000
2001
344100c4 2002 }
2003
d734058d 2004
344100c4 2005 }
2006 delete pi0cand;
2007 pi0cand=0x0;
2008 }
2009 }
2010 }
2011}
a280ac15 2012
344100c4 2013//________________________________________________________________________
2014void AliAnalysisTaskGammaConvDalitzV1::CalculateBackground(){
a280ac15 2015
344100c4 2016 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
2017 Int_t mbin = 0;
a280ac15 2018
344100c4 2019 Int_t method = 0;
a280ac15 2020
344100c4 2021 method = ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->GetBKGMethod();
a280ac15 2022
344100c4 2023 if(((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->UseTrackMultiplicity()){
2024 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
2025 } else {
2026 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
2027 }
2bb2434e 2028
344100c4 2029 if( method == 1 || method == 2 ) {
2bb2434e 2030
344100c4 2031 AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
2bb2434e 2032
344100c4 2033 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->UseTrackMultiplicity() ) {
2034 for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2bb2434e 2035
344100c4 2036 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2037 if(fMoveParticleAccordingToVertex == kTRUE && method == 1){
2038 bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2039 }
2bb2434e 2040
344100c4 2041 for(Int_t iCurrent=0;iCurrent<fGoodVirtualGammas->GetEntries();iCurrent++){
2042 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualGammas->At(iCurrent));
2bb2434e 2043
344100c4 2044 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2045 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2bb2434e 2046
344100c4 2047 if(fMoveParticleAccordingToVertex == kTRUE && method == 1 ){
2048 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2049 }
2bb2434e 2050
344100c4 2051 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2052
2053 if( ( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE, ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift()))){
2054 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
2055
2056 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
2057
2058 hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2059 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2060 sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2061 }
2062 } else {
2063 hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2064 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2065 sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2066 }
2067 }
2068 delete backgroundCandidate;
2069 backgroundCandidate = 0x0;
2070 }
2071 }
2072 }
2073 } else {
2074 for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2075 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2076 if(previousEventV0s){
2077 if(fMoveParticleAccordingToVertex == kTRUE && method == 1){
2078 bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2079 }
2080 for(Int_t iCurrent=0;iCurrent<fGoodVirtualGammas->GetEntries();iCurrent++){
2081 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualGammas->At(iCurrent));
2082 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2083 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2084 if(fMoveParticleAccordingToVertex == kTRUE && method ==1){
2085 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2086 }
2087
2088 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2089 if((((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift()))){
2090 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
2091 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
2092 hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2093 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2094 sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2095 }
2096 } else {
2097 hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2098 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2099 sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2100 }
2101 }
2102 delete backgroundCandidate;
2103 backgroundCandidate = 0x0;
2104 }
2105 }
2106 }
2107 }
2108 }
2109 } else if( method == 3 ){
2110 for(Int_t iCurrent=0;iCurrent<fGoodVirtualGammas->GetEntries();iCurrent++){
2111 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualGammas->At(iCurrent));
2bb2434e 2112
344100c4 2113 for(Int_t iPrevious=0;iPrevious<fGammasPool[fiCut]->GetEntries();iPrevious++){
2114 AliAODConversionPhoton previousGoodV0 = *(AliAODConversionPhoton*)((fGammasPool[fiCut]->At(iPrevious) ));
2115 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2116
2117 if((((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE, ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift()))){
2118 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
2119 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
2120 hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2121 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2122 sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2123 }
2124 } else {
2125 hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2126 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2127 sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2128 }
2129 }
2130 delete backgroundCandidate;
2131 backgroundCandidate = 0x0;
2132 }
2133 }
2134 }
2135}
2bb2434e 2136
344100c4 2137//________________________________________________________________________
2138void AliAnalysisTaskGammaConvDalitzV1::UpdateEventByEventData(){
2139 //see header file for documentation
2bb2434e 2140
344100c4 2141 Int_t method = 0;
2bb2434e 2142
344100c4 2143 method = ( (AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetBKGMethod();
2144
2145 if( method == 1 ) {
2146 if(fGoodGammas->GetEntries() > 0 ){
2147 if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->UseTrackMultiplicity() ){
2148 fBGHandler[fiCut]->AddEvent(fGoodGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfESDTracks);
2149 } else { // means we use #V0s for multiplicity
2150 fBGHandler[fiCut]->AddEvent(fGoodGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fGoodGammas->GetEntries());
2151 }
2152 }
2153 } else if ( method == 2 ){
2154 if(fGoodVirtualGammas->GetEntries() > 0 ){
2155 if(((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->UseTrackMultiplicity()){
2156 fBGHandler[fiCut]->AddEvent(fGoodVirtualGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfESDTracks);
2157 } else { // means we use #V0s for multiplicity
2158 fBGHandler[fiCut]->AddEvent(fGoodVirtualGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fGoodVirtualGammas->GetEntries());
2159 }
2160 }
2161 } else if ( method == 3 ) {
2162 for(Int_t index = 0; index < fGoodGammas->GetEntries(); index++){
2163 if ( fGammasPool[fiCut]->GetEntries() > ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->NumberOfRotationEvents() ){
2164 fGammasPool[fiCut]->RemoveLast();
2165 }
2166 fGammasPool[fiCut]->AddFirst( new AliAODConversionPhoton(*(AliAODConversionPhoton*)(fGoodGammas->At(index)) ) );
2167 }
2168 }
2169}
2bb2434e 2170
344100c4 2171//______________________________________________________________________
2172void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TrueVirtualGammaCandidate)
2173{
2bb2434e 2174
344100c4 2175 // Process True Mesons
2176 AliStack *MCStack = fMCEvent->Stack();
d734058d 2177
2178 if( TrueGammaCandidate->GetV0Index() < fESDEvent->GetNumberOfV0s() ){
2179
2180
344100c4 2181
2182 Bool_t isTruePi0 = kFALSE;
2183 Bool_t isTrueEta = kFALSE;
d734058d 2184
2185 Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(MCStack);
344100c4 2186 Int_t gammaMotherLabel = -1;
d734058d 2187
2188
344100c4 2189
d734058d 2190
2191
2192 //Checking if the gamma candidate is a real gamma
2193
344100c4 2194
2195 if(gammaMCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2196 // Daughters Gamma 0
2197 TParticle * negativeMC = (TParticle*)TrueGammaCandidate->GetNegativeMCDaughter(MCStack);
2198 TParticle * positiveMC = (TParticle*)TrueGammaCandidate->GetPositiveMCDaughter(MCStack);
2199 TParticle * gammaMC = (TParticle*)MCStack->Particle(gammaMCLabel);
2200
2201 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2202 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2203 if(gammaMC->GetPdgCode() == 22){ // ... with Gamma Mother
2204 gammaMotherLabel=gammaMC->GetFirstMother();
2205 }
2206 }
2207 }
2208 }
2bb2434e 2209
2bb2434e 2210
d734058d 2211
2212 //Checking if the virtual gamma is a real virtual gamma
2213
344100c4 2214 Int_t virtualGammaMCLabel = TrueVirtualGammaCandidate->GetMCParticleLabel(MCStack);
2215 Int_t virtualGammaMotherLabel = -1;
d734058d 2216 Int_t virtualGamma = -1;
2217
a280ac15 2218
2219
d734058d 2220 if( virtualGammaMCLabel != -1 ){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
344100c4 2221 // Daughters Gamma 1
2222 TParticle * negativeMC = (TParticle*)TrueVirtualGammaCandidate->GetNegativeMCDaughter(MCStack);
2223 TParticle * positiveMC = (TParticle*)TrueVirtualGammaCandidate->GetPositiveMCDaughter(MCStack);
2224 TParticle * virtualGammaMotherMC = (TParticle*)MCStack->Particle(virtualGammaMCLabel);
ae947965 2225
344100c4 2226 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2bb2434e 2227
344100c4 2228 if( virtualGammaMotherMC->GetPdgCode() != 22 ){
2229 virtualGammaMotherLabel=virtualGammaMCLabel;
d734058d 2230 virtualGamma = 1;
2231
344100c4 2232 } else if (negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2233 virtualGammaMotherLabel=virtualGammaMotherMC->GetFirstMother();
2234 virtualGamma = 0; //no virtual gamma
2235 }
2236 }
2237 }
2bb2434e 2238
d734058d 2239
2240 //Checking if both gamma and virtual gamma comming from Pi0 or Eta
2241
2bb2434e 2242
d734058d 2243 if( gammaMotherLabel >= 0 && ( gammaMotherLabel == virtualGammaMotherLabel) ){
344100c4 2244 if(((TParticle*)MCStack->Particle(virtualGammaMotherLabel))->GetPdgCode() == 111){
2245 isTruePi0=kTRUE;
2246 }
2247 if(((TParticle*)MCStack->Particle(virtualGammaMotherLabel))->GetPdgCode() == 221){
2248 isTrueEta=kTRUE;
2249 }
2250 }
2bb2434e 2251
d734058d 2252
a280ac15 2253
d734058d 2254 if( isTruePi0 || isTrueEta ){ // True Pion or Eta
344100c4 2255 if ( virtualGamma == 1 ) { //True Dalitz
2256 Float_t weighted= 1;
2257
2258 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2259 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCStack,fInputEvent)){
2260 if (((TParticle*)MCStack->Particle(gammaMotherLabel))->Pt()>0.005){
2261 weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gammaMotherLabel,fMCStack,fInputEvent);
2262 }
2263 }
2264 }
a280ac15 2265
344100c4 2266 hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2267 hESDTrueMotherDalitzInvMassPt[fiCut]->Fill( TrueVirtualGammaCandidate->M(),Pi0Candidate->Pt(),weighted);
2bb2434e 2268
344100c4 2269 if(gammaMotherLabel < MCStack->GetNprimary()){ // Only primary pi0 for efficiency calculation
2270 hESDTruePrimaryMotherInvMassPt[fiCut]->Fill( Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2271 hESDTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill( Pi0Candidate->M(), Pi0Candidate->Pt() );
2272
2273 hESDTruePrimaryMotherInvMassMCPt[fiCut]->Fill(Pi0Candidate->M(),((TParticle*)MCStack->Particle(virtualGammaMotherLabel))->Pt(),weighted);
2274 if(isTruePi0){ // Only primaries for unfolding
2275 hESDTruePrimaryPi0DalitzESDPtMCPt[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)MCStack->Particle(virtualGammaMotherLabel))->Pt(),weighted);
2276 }
2277 } else { // Secondary Meson
2278 Float_t weightedSec= 1;
2279 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2280 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gammaMotherLabel))->GetMother(0);
2281 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(gammaMotherLabel)->GetPdgCode()==310){
2282 weightedSec= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2283 }
2284 }
2285 hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2286 }
2287 } else if ( virtualGamma == 0 ){
2288 Float_t weighted= 1;
2289 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2290 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCStack,fInputEvent)){
2291 if (((TParticle*)MCStack->Particle(gammaMotherLabel))->Pt()>0.005){
2292 weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gammaMotherLabel,fMCStack,fInputEvent);
2293 }
2294 }
2295 }
2296 hESDTrueMotherPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted); // Pi0 from GG
2297 if( gammaMotherLabel < MCStack->GetNprimary() ){
2298 hESDTruePrimaryMotherPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2299 } else {
2300 Float_t weightedSec= 1;
2301 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2302 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gammaMotherLabel))->GetMother(0);
2303 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(gammaMotherLabel)->GetPdgCode()==310){
2304 weightedSec= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2305 }
2306 }
2307 hESDTrueSecondaryMotherPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2308 }
2309 }
2310 }
2bb2434e 2311
d734058d 2312 if( !isTruePi0 && !isTrueEta ){ // Background
2313 if( gammaMotherLabel > -1 && virtualGammaMotherLabel > -1 && virtualGamma == 0 ){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
344100c4 2314 hESDTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2315 } else { // No photon or without mother
2316 hESDTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2317 }
2318 }
ae947965 2319 }
2bb2434e 2320}
0f8c33c1 2321
d734058d 2322//______________________________________________________________________
2323void AliAnalysisTaskGammaConvDalitzV1::ProcessTrueChicCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TruejpsiCandidate)
2324{
2325
2326
2327 AliStack *MCStack = fMCEvent->Stack();
2328
2329
2330 if( TrueGammaCandidate->GetV0Index() < fESDEvent->GetNumberOfV0s() ){
2331
2332
2333
2334 //Checking gamma
2335
2336 Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(MCStack);
2337 Int_t gammaMotherLabel = -1;
2338
2339
2340
2341 if( gammaMCLabel != -1){// Gamma is Combinatorial; MC Particles don't belong to the same Mother
2342 // Daughters Gamma 0
2343
2344 TParticle * negativeMC = (TParticle*)TrueGammaCandidate->GetNegativeMCDaughter(MCStack);
2345 TParticle * positiveMC = (TParticle*)TrueGammaCandidate->GetPositiveMCDaughter(MCStack);
2346 TParticle * gammaMC = (TParticle*)MCStack->Particle(gammaMCLabel);
2347
2348 if( TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11 ){ // Electrons ...
2349 if( negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() == 5 ){ // ... From Conversion ...
2350 if(gammaMC->GetPdgCode() == 22){ // ... with Gamma Mother
2351 gammaMotherLabel=gammaMC->GetFirstMother();
2352 }
2353 }
2354 }
2355 }
2356
2357
2358
2359 //Checking jpsi
2360
2361 Int_t jpsiMCLabel = TruejpsiCandidate->GetMCParticleLabel(MCStack);
2362 Int_t jpsiMotherLabel = -1;
2363
2364
2365
2366 if( jpsiMCLabel != -1 ){
2367
2368 TParticle * negativeMC = (TParticle*)TruejpsiCandidate->GetNegativeMCDaughter(MCStack);
2369 TParticle * positiveMC = (TParticle*)TruejpsiCandidate->GetPositiveMCDaughter(MCStack);
2370 TParticle * jpsiMC = (TParticle*)MCStack->Particle(jpsiMCLabel);
2371
2372 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2373
2374
2375 if(jpsiMC->GetPdgCode() == 443){
2376
2377 jpsiMotherLabel=jpsiMC->GetFirstMother();
2378
2379 }
2380
2381
2382 }
2383 }
2384
2385
2386 if( gammaMotherLabel>=0 && ( gammaMotherLabel == jpsiMotherLabel) ){
2387 if( ((TParticle*)MCStack->Particle(jpsiMotherLabel))->GetPdgCode() == 445 ||
2388 ((TParticle*)MCStack->Particle(jpsiMotherLabel))->GetPdgCode() == 10443 ||
2389 ((TParticle*)MCStack->Particle(jpsiMotherLabel))->GetPdgCode() == 20443 ){
2390
2391 hESDTrueMotherChiCInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2392 hESDTrueMotherChiCDiffInvMassPt[fiCut]->Fill(Pi0Candidate->M()-TruejpsiCandidate->M(),Pi0Candidate->Pt());
2393 }
2394 }
2395
2396 }
2397}
2398
2399
2400
2401
0f8c33c1 2402
2bb2434e 2403//________________________________________________________________________
2404void AliAnalysisTaskGammaConvDalitzV1::MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex){
2405 //see header file for documentation
2406
344100c4 2407 Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
2408 Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
2409 Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
2bb2434e 2410
344100c4 2411 Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
2412 particle->SetConversionPoint(movedPlace);
2bb2434e 2413}
2414
2415
2416//________________________________________________________________________
2417void AliAnalysisTaskGammaConvDalitzV1::CountESDTracks(){
2418
344100c4 2419 // Using standard function for setting Cuts
2420 Bool_t selectPrimaries=kTRUE;
2421 AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
2422 EsdTrackCuts->SetMaxDCAToVertexZ(2);
2423 EsdTrackCuts->SetEtaRange(-0.8, 0.8);
2424 EsdTrackCuts->SetPtRange(0.15);
2425 EsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kBoth);
2426
2427 fNumberOfESDTrackskBoth = 0;
2428 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
2429 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
2430 if(!curTrack) continue;
2431 if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTrackskBoth++;
2432 }
2433 delete EsdTrackCuts;
2434 EsdTrackCuts=0x0;
2435
2436 return;
2bb2434e 2437}
2438
2439//_____________________________________________________________________________
2440void AliAnalysisTaskGammaConvDalitzV1::ProcessMCParticles()
2441{
2442
344100c4 2443// Loop over all primary MC particle
2444
2445 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
2446
2447 TParticle* particle = (TParticle *)fMCStack->Particle(i);
2448 if (!particle) continue;
2449
2450 Bool_t mcIsFromMB = kTRUE;
2451 Int_t isMCFromMBHeader = -1;
2452
2453 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0) {
2454 isMCFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(i,fMCStack,fInputEvent);
2455 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
2456 if(isMCFromMBHeader != 2) mcIsFromMB = kFALSE;
2457 }
2458
2459 if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
2460 hMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
2461 }
2462
2463 if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
5950ee43 2464
344100c4 2465 hMCConvGammaPt[fiCut]->Fill(particle->Pt());
5950ee43 2466
2467 if(fDoMesonQA) {
2468 hMCConvGammaEta[fiCut]->Fill( particle->Eta());
4e3a3a54 2469 if(mcIsFromMB) hMCConvGammaR[fiCut]->Fill( ((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R() );
5950ee43 2470 }
344100c4 2471
2472 if(mcIsFromMB){
2473 hMCConvGammaRSPt[fiCut]->Fill(particle->Pt());
2474 }
2475 } // Converted MC Gamma
2476
2477 if(((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(i,fMCStack)){
2d49ea4c 2478 if( particle->GetPdgCode() == -11) {
344100c4 2479 hMCAllPositronsPt[fiCut]->Fill(particle->Pt()); // All positrons
2480 if(fDoMesonQA) hMCAllPositronsEta[fiCut]->Fill( particle->Eta() );
2d49ea4c 2481 }
2482 if( particle->GetPdgCode() == 11){
344100c4 2483 hMCAllElectronsPt[fiCut]->Fill(particle->Pt()); // All electrons
2484 if (fDoMesonQA) hMCAllElectronsEta[fiCut]->Fill(particle->Eta()); // All electrons
2485 }
2486 }
2487
2488 if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelectedMC( particle,fMCStack,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift() ) ){
2489 Float_t weighted= 1;
2490 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2491 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
2492 if (particle->Pt()>0.005){
2493 weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack,fInputEvent);
2494 }
2495 }
ae947965 2496 }
ae947965 2497 if(particle->GetPdgCode() == 111)hMCPi0GGPt[fiCut]->Fill( particle->Pt() , weighted); // All MC Pi0 GG decay
2498 if(particle->GetPdgCode() == 221)hMCEtaGGPt[fiCut]->Fill( particle->Pt() , weighted); // All MC Eta GG decay
344100c4 2499 }
2500
2501
2502 Int_t labelgamma = -1;
2503 Int_t labelelectron = -1;
2504 Int_t labelpositron = -1;
ae947965 2505
a280ac15 2506
344100c4 2507 if( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelectedMCDalitz(particle,fMCStack,labelelectron,labelpositron,labelgamma,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift())){
2508 Float_t weighted= 1;
2509 if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2510 if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack,fInputEvent)){
2511 if (particle->Pt()>0.005){
2512 weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack,fInputEvent);
2513 }
2514 }
ae947965 2515 }
ae947965 2516 if(particle->GetPdgCode() == 111)hMCPi0Pt[fiCut]->Fill(particle->Pt(), weighted); // All MC Pi0
2517 if(particle->GetPdgCode() == 221)hMCEtaPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Eta
0f8c33c1 2518
2519 // Check the acceptance for gamma and electrons
2520
344100c4 2521 TParticle *gamma = fMCStack->Particle(labelgamma);
2522 TParticle *electron = fMCStack->Particle(labelelectron);
2523 TParticle *positron = fMCStack->Particle(labelpositron);
2524
2525
2526 if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(gamma,fMCStack,kFALSE) &&
2527 ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelelectron,fMCStack) &&
2528 ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelpositron,fMCStack) ) {
0f8c33c1 2529
344100c4 2530 Double_t massDalitz = -1;
2531 if( fDoMesonQA){
2532 TLorentzVector TLVEpos,TLVEneg,TLVDalitz;
2533 Double_t electronMass = TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass();
f4d5bd23 2534 TLVEpos.SetXYZM(positron->Px(),positron->Py(),positron->Pz(),electronMass);
2535 TLVEneg.SetXYZM(electron->Px(),electron->Py(),electron->Pz(),electronMass);
2536 TLVDalitz = TLVEpos + TLVEneg ;
2537 massDalitz = TLVDalitz.M();
0f8c33c1 2538 }
ae947965 2539
344100c4 2540 if(particle->GetPdgCode() == 111){
2541 hMCPi0InAccPt[fiCut]->Fill(particle->Pt() , weighted); // MC Pi0Dalitz with gamma and e+e- in acc
2542 hMCPi0DalitzGammaPt[fiCut]->Fill( gamma->Pt() );
2543 hMCPi0DalitzPositronPt[fiCut]->Fill( positron->Pt() );
2544 hMCPi0DalitzElectronPt[fiCut]->Fill( electron->Pt() );
2545 if ( fDoMesonQA )hMCPi0EposEnegInvMassPt[fiCut]->Fill(massDalitz,particle->Pt());
2546 }
2547 if(particle->GetPdgCode() == 221){
2548 hMCEtaInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC EtaDalitz with gamma and e+e- in acc
2549 if( fDoMesonQA ) hMCEtaEposEnegInvMassPt[fiCut]->Fill( massDalitz, particle->Pt());
2550 }
2551 }
2552 }
2553
0f8c33c1 2554 Int_t labelgammaChiC=-1;
2555 Int_t labelpositronChiC=-1;
2556 Int_t labelelectronChiC=-1;
2557
344100c4 2558 if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelectedMCChiC(particle,fMCStack,labelelectronChiC,labelpositronChiC,labelgammaChiC,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift())){
2559
0f8c33c1 2560 hMCChiCPt[fiCut]->Fill(particle->Pt()); // All MC ChiC
2561 TParticle * gammaChiC =fMCStack->Particle(labelgammaChiC);
2562
344100c4 2563 if( ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC( gammaChiC,fMCStack,kFALSE) &&
2564 ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelelectronChiC,fMCStack) &&
2565 ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelpositronChiC,fMCStack) ){
0f8c33c1 2566 hMCChiCInAccPt[fiCut]->Fill(particle->Pt()); // All MC ChiC
2567 }
2568 }
2569 }
ccfa8c0d 2570}
344100c4 2571
ccfa8c0d 2572//_____________________________________________________________________________
ae947965 2573Bool_t AliAnalysisTaskGammaConvDalitzV1::IsDalitz(TParticle *fMCMother) const
ccfa8c0d 2574{
2575
0f8c33c1 2576 if( fMCMother->GetNDaughters() != 3 ) return kFALSE;
2577 if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
2578
ae947965 2579
0f8c33c1 2580 TParticle *positron = 0x0;
2581 TParticle *electron = 0x0;
ae947965 2582 TParticle *gamma = 0x0;
0f8c33c1 2583
2584 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
0f8c33c1 2585 TParticle* temp = (TParticle*)fMCStack->Particle( index );
0f8c33c1 2586 switch( temp->GetPdgCode() ) {
344100c4 2587 case ::kPositron:
2588 positron = temp;
2589 break;
2590 case ::kElectron:
2591 electron = temp;
2592 break;
2593 case ::kGamma:
2594 gamma = temp;
2595 break;
0f8c33c1 2596 }
2597 }
2598
2599 if( positron && electron && gamma) return kTRUE;
2600
2601 return kFALSE;
a280ac15 2602}
344100c4 2603
ccfa8c0d 2604//_____________________________________________________________________________________
2605Bool_t AliAnalysisTaskGammaConvDalitzV1::IsPi0DalitzDaughter( Int_t label ) const
2606{
2607//
2608// Returns true if the particle comes from Pi0 -> e+ e- gamma
344100c4 2609//
2610 Int_t motherLabel = fMCStack->Particle( label )->GetMother(0);
ae947965 2611
344100c4 2612 if( motherLabel < 0 || motherLabel >= fMCStack->GetNtrack() ) return kFALSE;
2613
2614 TParticle* mother = fMCStack->Particle( motherLabel );
2615
ae947965 2616 if( mother->GetPdgCode() != 111 ) return kFALSE;
2617
2618 if( IsDalitz( mother ) ) return kTRUE;
344100c4 2619
ae947965 2620 return kFALSE;
344100c4 2621
ccfa8c0d 2622}
2623
a1c2f90c 2624void AliAnalysisTaskGammaConvDalitzV1::FillElectronQAHistos(AliAODConversionPhoton *Vgamma) const
d9d6352b 2625{
d9d6352b 2626
344100c4 2627 AliESDtrack *positronVgamma = 0;
2628 AliESDtrack *electronVgamma = 0;
2629
2630 Double_t clsToFPos = -1.0;
2631 Double_t clsToFNeg = -1.0;
2632
2633 Double_t NumClsITSPos = -1.0;
2634 Double_t NumClsITSNeg = -1.0;
2635 Double_t NumClsTPCPos = -1.0;
2636 Double_t NumClsTPCNeg = -1.0;
2637 Double_t nCrossedRowsTPCPos = -1.0;
2638 Double_t nCrossedRowsTPCNeg = -1.0;
2639
2640 Float_t dcaToVertexXYPos = -1.0;
2641 Float_t dcaToVertexZPos = -1.0;
2642 Float_t dcaToVertexXYNeg = -1.0;
2643 Float_t dcaToVertexZNeg = -1.0;
2644
2645 Double_t nSigmaPosTPC = -999.;
2646 Double_t nSigmaNegTPC = -999.;
2647
2648 positronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
2649 electronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
2650 clsToFPos = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetNFindableClustersTPC(positronVgamma);
2651 clsToFNeg = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetNFindableClustersTPC(electronVgamma);
2652
2653 nSigmaPosTPC = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(positronVgamma, AliPID::kElectron) ;
2654 nSigmaNegTPC = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(electronVgamma, AliPID::kElectron) ;
2655
2656 NumClsITSPos = positronVgamma->GetNcls(0); //Get number of ITS clusters
2657 NumClsITSNeg = electronVgamma->GetNcls(0);
2658 NumClsTPCPos = positronVgamma->GetNcls(1); //Get number of TPC clusters
2659 NumClsTPCNeg = electronVgamma->GetNcls(1);
2660
2661 nCrossedRowsTPCPos = positronVgamma->GetTPCCrossedRows();
2662 nCrossedRowsTPCNeg = electronVgamma->GetTPCCrossedRows();
2663
2664 Float_t bPos[2];
2665 Float_t bCovPos[3];
2666 positronVgamma->GetImpactParameters(bPos,bCovPos);
2667
2668 if (bCovPos[0]<=0 || bCovPos[2]<=0) {
2669 AliDebug(1, "Estimated b resolution lower or equal zero!");
2670 bCovPos[0]=0; bCovPos[2]=0;
2671 }
2672
2673 Float_t bNeg[2];
2674 Float_t bCovNeg[3];
2675 positronVgamma->GetImpactParameters(bNeg,bCovNeg);
2676
2677 if (bCovNeg[0]<=0 || bCovNeg[2]<=0) {
2678 AliDebug(1, "Estimated b resolution lower or equal zero!");
2679 bCovNeg[0]=0; bCovNeg[2]=0;
2680 }
2681
2682 dcaToVertexXYPos = bPos[0];
2683 dcaToVertexZPos = bPos[1];
2684 dcaToVertexXYNeg = bNeg[0];
2685 dcaToVertexZNeg = bNeg[1];
2686
2687 if( electronVgamma->P() > 0.3 && electronVgamma->P() < 0.45 ){
2688 hESDDalitzElectronAfterEtaPCut[fiCut]->Fill( electronVgamma->Eta() );
2689 }
2690 if( positronVgamma->P() > 0.3 && positronVgamma->P() < 0.45 ){
2691 hESDDalitzPositronAfterEtaPCut[fiCut]->Fill( positronVgamma->Eta() );
2692 }
2693
2694 hESDDalitzElectronAfterPt[fiCut]->Fill( electronVgamma->Pt() );
2695 hESDDalitzPositronAfterPt[fiCut]->Fill( positronVgamma->Pt() );
2696
2697 hESDDalitzElectronAfterEta[fiCut]->Fill( electronVgamma->Eta() );
2698 hESDDalitzPositronAfterEta[fiCut]->Fill( positronVgamma->Eta() );
2699
2700 hESDDalitzElectronAfterPhi[fiCut]->Fill( electronVgamma->Phi() );
2701 hESDDalitzPositronAfterPhi[fiCut]->Fill( positronVgamma->Phi() );
2702
2703 hESDDalitzElectronAfterNFindClsTPC[fiCut]->Fill(clsToFNeg,electronVgamma->Pt());
2704 hESDDalitzPositronAfterNFindClsTPC[fiCut]->Fill(clsToFPos,positronVgamma->Pt());
2705
2706 hESDDalitzElectronAfterNClsTPC[fiCut]->Fill( NumClsTPCNeg,electronVgamma->Pt());
2707 hESDDalitzPositronAfterNClsTPC[fiCut]->Fill( NumClsTPCPos,positronVgamma->Pt());
2708
2709 hESDDalitzElectronAfterNCrossedRowsTPC[fiCut]->Fill( nCrossedRowsTPCNeg, electronVgamma->Pt() );
2710 hESDDalitzPositronAfterNCrossedRowsTPC[fiCut]->Fill( nCrossedRowsTPCPos, positronVgamma->Pt() );
2711
2712 hESDDalitzElectronAfterNClsITS[fiCut]->Fill( NumClsITSNeg);
2713 hESDDalitzPositronAfterNClsITS[fiCut]->Fill( NumClsITSPos);
2714
2715 hESDDalitzPosEleAfterDCAxy[fiCut]->Fill( dcaToVertexXYNeg, electronVgamma->Pt() );
2716 hESDDalitzPosEleAfterDCAz[fiCut]->Fill( dcaToVertexZNeg, electronVgamma->Pt() );
2717 hESDDalitzPosEleAfterDCAxy[fiCut]->Fill( dcaToVertexXYPos, positronVgamma->Pt() );
2718 hESDDalitzPosEleAfterDCAz[fiCut]->Fill( dcaToVertexZPos, positronVgamma->Pt() );
2719
2720 hESDDalitzElectronAfterTPCdEdxVsP[fiCut]->Fill( electronVgamma->P(),nSigmaNegTPC);
2721 hESDDalitzPositronAfterTPCdEdxVsP[fiCut]->Fill( positronVgamma->P(), nSigmaPosTPC);
2722
2723 hESDDalitzElectronAfterTPCdEdxVsEta[fiCut]->Fill( electronVgamma->Eta(),nSigmaNegTPC);
2724 hESDDalitzPositronAfterTPCdEdxVsEta[fiCut]->Fill( positronVgamma->Eta(),nSigmaPosTPC);
2725
2726 hESDDalitzElectronAfterTPCdEdxVsPhi[fiCut]->Fill( electronVgamma->Phi(),nSigmaNegTPC);
2727 hESDDalitzPositronAfterTPCdEdxVsPhi[fiCut]->Fill( positronVgamma->Phi(),nSigmaPosTPC);
2728
2729 hESDDalitzElectronAfterTPCdEdxSignalVsP[fiCut]->Fill( electronVgamma->P(), TMath::Abs(electronVgamma->GetTPCsignal()));
2730 hESDDalitzPositronAfterTPCdEdxSignalVsP[fiCut]->Fill( positronVgamma->P(), TMath::Abs(positronVgamma->GetTPCsignal()));
2731
d9d6352b 2732}
2733
ccfa8c0d 2734
a280ac15 2735//_____________________________________________________________________________
2736Double_t AliAnalysisTaskGammaConvDalitzV1::GetPsiPair( const AliESDtrack *trackPos, const AliESDtrack *trackNeg ) const
2737{
344100c4 2738 //
2739 // This angle is a measure for the contribution of the opening in polar
2740 // direction ?0 to the opening angle ? Pair
2741 //
2742 // Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC
2743 // Mas ter Thesis. Thorsten Dahms. 2005
2744 // https://twiki.cern.ch/twiki/pub/ALICE/GammaPhysicsPublications/tdahms_thesis.pdf
2745 //
2746 Double_t momPos[3];
2747 Double_t momNeg[3];
2748 if( trackPos->GetConstrainedPxPyPz(momPos) == 0 ) trackPos->GetPxPyPz( momPos );
2749 if( trackNeg->GetConstrainedPxPyPz(momNeg) == 0 ) trackNeg->GetPxPyPz( momNeg );
a280ac15 2750
344100c4 2751 TVector3 posDaughter;
2752 TVector3 negDaughter;
a280ac15 2753
344100c4 2754 posDaughter.SetXYZ( momPos[0], momPos[1], momPos[2] );
2755 negDaughter.SetXYZ( momNeg[0], momNeg[1], momNeg[2] );
a280ac15 2756
344100c4 2757 Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();
2758 Double_t openingAngle = posDaughter.Angle( negDaughter ); //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );
a280ac15 2759
344100c4 2760 if( openingAngle < 1e-20 ) return 0.;
a280ac15 2761
344100c4 2762 Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
a280ac15 2763
344100c4 2764 return psiAngle;
4803eb1f 2765}