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