1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Friederike Bock *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 #include "TParticle.h"
21 #include "TMCProcess.h"
22 #include "TDatabasePDG.h"
25 #include "TDirectory.h"
29 #include "THnSparse.h"
32 #include "AliAnalysisManager.h"
33 #include "AliESDInputHandler.h"
34 #include "AliESDtrack.h"
35 #include "AliMCEvent.h"
37 #include "AliMCEventHandler.h"
40 #include "AliESDtrackCuts.h"
41 #include "AliESDpidCuts.h"
42 #include "AliMCEvent.h"
44 #include "AliESDEvent.h"
45 #include "AliESDpid.h"
46 #include "AliKFParticle.h"
47 #include "AliMCEventHandler.h"
48 #include "AliKFVertex.h"
49 #include "AliTriggerAnalysis.h"
50 #include "AliCentrality.h"
51 #include "AliMultiplicity.h"
52 #include "AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.h"
55 ClassImp( AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero )
57 //-----------------------------------------------------------------------------------------------
58 AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero():
73 fSelectorNegPionIndex(0),
74 fSelectorPosPionIndex(0),
75 fGoodConvGammas(NULL),
76 fClusterCandidates(NULL),
77 fNeutralPionCandidates(NULL),
78 fGoodVirtualParticles(NULL),
81 fClusterCutArray(NULL),
83 fNeutralPionMesonCutArray(NULL),
86 fConversionCuts(NULL),
88 fHistoConvGammaPt(NULL),
89 fHistoConvGammaEta(NULL),
90 fHistoClusterGammaPt(NULL),
91 fHistoClusterGammaEta(NULL),
92 fHistoNegPionPt(NULL),
93 fHistoPosPionPt(NULL),
94 fHistoNegPionPhi(NULL),
95 fHistoPosPionPhi(NULL),
96 fHistoNegPionEta(NULL),
97 fHistoPosPionEta(NULL),
98 fHistoNegPionClsTPC(NULL),
99 fHistoPosPionClsTPC(NULL),
100 fHistoPionDCAxy(NULL),
101 fHistoPionDCAz(NULL),
102 fHistoPionTPCdEdxNSigma(NULL),
103 fHistoPionTPCdEdx(NULL),
104 fHistoPionPionInvMassPt(NULL),
105 fHistoGammaGammaInvMassPt(NULL),
106 fHistoMotherInvMassPt(NULL),
107 fTHnSparseMotherInvMassPtZM(NULL),
108 fHistoMotherBackInvMassPt(NULL),
109 fTHnSparseMotherBackInvMassPtZM(NULL),
110 fHistoMCAllGammaPt(NULL),
111 fHistoMCConvGammaPt(NULL),
112 fHistoMCAllPosPionsPt(NULL),
113 fHistoMCAllNegPionsPt(NULL),
114 fHistoMCGammaFromNeutralMesonPt(NULL),
115 fHistoMCPosPionsFromNeutralMesonPt(NULL),
116 fHistoMCNegPionsFromNeutralMesonPt(NULL),
117 fHistoMCEtaPiPlPiMiPiZeroPt(NULL),
118 fHistoMCEtaPiPlPiMiPiZeroInAccPt(NULL),
119 fHistoMCOmegaPiPlPiMiPiZeroPt(NULL),
120 fHistoMCOmegaPiPlPiMiPiZeroInAccPt(NULL),
121 fHistoTrueMotherPiPlPiMiPiZeroInvMassPt(NULL),
122 fHistoTrueMotherGammaGammaInvMassPt(NULL),
123 fHistoTrueMotherGammaGammaFromEtaInvMassPt(NULL),
124 fHistoTrueMotherGammaGammaFromOmegaInvMassPt(NULL),
125 fHistoTrueConvGammaPt(NULL),
126 fHistoTrueConvGammaFromNeutralMesonPt(NULL),
127 fHistoTrueClusterGammaPt(NULL),
128 fHistoTrueClusterGammaFromNeutralMesonPt(NULL),
129 fHistoTruePosPionPt(NULL),
130 fHistoTruePosPionFromNeutralMesonPt(NULL),
131 fHistoTrueNegPionPt(NULL),
132 fHistoTrueNegPionFromNeutralMesonPt(NULL),
133 fHistoTruePionPionInvMassPt(NULL),
134 fHistoTruePionPionFromSameMotherInvMassPt(NULL),
135 fHistoTruePionPionFromEtaInvMassPt(NULL),
136 fHistoTruePionPionFromOmegaInvMassPt(NULL),
138 fHistoNGoodESDTracks(NULL),
139 fProfileEtaShift(NULL),
143 fNumberOfESDTracks(0),
144 fMoveParticleAccordingToVertex(kFALSE),
146 fDoMesonAnalysis(kTRUE),
148 fIsFromMBHeader(kTRUE),
155 //-----------------------------------------------------------------------------------------------
156 AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero( const char* name ):
157 AliAnalysisTaskSE(name),
172 fSelectorNegPionIndex(0),
173 fSelectorPosPionIndex(0),
174 fGoodConvGammas(NULL),
175 fClusterCandidates(NULL),
176 fNeutralPionCandidates(NULL),
177 fGoodVirtualParticles(NULL),
178 fEventCutArray(NULL),
179 fGammaCutArray(NULL),
180 fClusterCutArray(NULL),
182 fNeutralPionMesonCutArray(NULL),
183 fMesonCutArray(NULL),
185 fConversionCuts(NULL),
187 fHistoConvGammaPt(NULL),
188 fHistoConvGammaEta(NULL),
189 fHistoClusterGammaPt(NULL),
190 fHistoClusterGammaEta(NULL),
191 fHistoNegPionPt(NULL),
192 fHistoPosPionPt(NULL),
193 fHistoNegPionPhi(NULL),
194 fHistoPosPionPhi(NULL),
195 fHistoNegPionEta(NULL),
196 fHistoPosPionEta(NULL),
197 fHistoNegPionClsTPC(NULL),
198 fHistoPosPionClsTPC(NULL),
199 fHistoPionDCAxy(NULL),
200 fHistoPionDCAz(NULL),
201 fHistoPionTPCdEdxNSigma(NULL),
202 fHistoPionTPCdEdx(NULL),
203 fHistoPionPionInvMassPt(NULL),
204 fHistoGammaGammaInvMassPt(NULL),
205 fHistoMotherInvMassPt(NULL),
206 fTHnSparseMotherInvMassPtZM(NULL),
207 fHistoMotherBackInvMassPt(NULL),
208 fTHnSparseMotherBackInvMassPtZM(NULL),
209 fHistoMCAllGammaPt(NULL),
210 fHistoMCConvGammaPt(NULL),
211 fHistoMCAllPosPionsPt(NULL),
212 fHistoMCAllNegPionsPt(NULL),
213 fHistoMCGammaFromNeutralMesonPt(NULL),
214 fHistoMCPosPionsFromNeutralMesonPt(NULL),
215 fHistoMCNegPionsFromNeutralMesonPt(NULL),
216 fHistoMCEtaPiPlPiMiPiZeroPt(NULL),
217 fHistoMCEtaPiPlPiMiPiZeroInAccPt(NULL),
218 fHistoMCOmegaPiPlPiMiPiZeroPt(NULL),
219 fHistoMCOmegaPiPlPiMiPiZeroInAccPt(NULL),
220 fHistoTrueMotherPiPlPiMiPiZeroInvMassPt(NULL),
221 fHistoTrueMotherGammaGammaInvMassPt(NULL),
222 fHistoTrueMotherGammaGammaFromEtaInvMassPt(NULL),
223 fHistoTrueMotherGammaGammaFromOmegaInvMassPt(NULL),
224 fHistoTrueConvGammaPt(NULL),
225 fHistoTrueConvGammaFromNeutralMesonPt(NULL),
226 fHistoTrueClusterGammaPt(NULL),
227 fHistoTrueClusterGammaFromNeutralMesonPt(NULL),
228 fHistoTruePosPionPt(NULL),
229 fHistoTruePosPionFromNeutralMesonPt(NULL),
230 fHistoTrueNegPionPt(NULL),
231 fHistoTrueNegPionFromNeutralMesonPt(NULL),
232 fHistoTruePionPionInvMassPt(NULL),
233 fHistoTruePionPionFromSameMotherInvMassPt(NULL),
234 fHistoTruePionPionFromEtaInvMassPt(NULL),
235 fHistoTruePionPionFromOmegaInvMassPt(NULL),
237 fHistoNGoodESDTracks(NULL),
238 fProfileEtaShift(NULL),
242 fNumberOfESDTracks(0),
243 fMoveParticleAccordingToVertex(kFALSE),
245 fDoMesonAnalysis(kTRUE),
247 fIsFromMBHeader(kTRUE),
251 DefineOutput(1, TList::Class());
254 //-----------------------------------------------------------------------------------------------
255 AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::~AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero()
258 // virtual destructor
260 cout<<"Destructor"<<endl;
262 delete fGoodConvGammas;
263 fGoodConvGammas = 0x0;
265 if(fClusterCandidates){
266 delete fClusterCandidates;
267 fClusterCandidates = 0x0;
270 if(fNeutralPionCandidates){
271 delete fNeutralPionCandidates;
272 fNeutralPionCandidates = 0x0;
275 if(fGoodVirtualParticles){
276 delete fGoodVirtualParticles;
277 fGoodVirtualParticles = 0x0;
284 //___________________________________________________________
285 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::InitBack(){
287 const Int_t nDim = 4;
288 Int_t nBins[nDim] = {500,250,7,4};
289 Double_t xMin[nDim] = {0.4,0, 0,0};
290 Double_t xMax[nDim] = {0.9,25,7,4};
292 fTHnSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
293 fTHnSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
295 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
297 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
299 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
300 TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
301 TString cutstringConvGamma = "";
302 if (fNeutralPionMode < 2) cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
303 TString cutstringCaloGamma = "";
304 if (fNeutralPionMode > 0) cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
305 TString cutstringNeutralPion= ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutNumber();
306 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
308 TString fullCutString = "";
309 if (fNeutralPionMode == 0) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
310 else if (fNeutralPionMode == 1) fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
311 else if (fNeutralPionMode == 2) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
313 TString nameBackList = Form("%s Back histograms",fullCutString.Data());
314 TString nameMotherList = Form("%s Mother histograms",fullCutString.Data());
316 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
317 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
318 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
320 if(collisionSystem == 1 || collisionSystem == 2 ||
321 collisionSystem == 5 || collisionSystem == 8 ||
322 collisionSystem == 9){
323 centMin = centMin*10;
324 centMax = centMax*10;
326 else if(collisionSystem == 3 || collisionSystem == 6){
330 else if(collisionSystem == 4 || collisionSystem == 7){
331 centMin = ((centMin*5)+45);
332 centMax = ((centMax*5)+45);
336 fBackList[iCut] = new TList();
338 fBackList[iCut]->SetName(nameBackList.Data());
339 fBackList[iCut]->SetOwner(kTRUE);
340 fCutFolder[iCut]->Add(fBackList[iCut]);
342 fTHnSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
343 fBackList[iCut]->Add(fTHnSparseMotherBackInvMassPtZM[iCut]);
345 fMotherList[iCut] = new TList();
346 fMotherList[iCut]->SetName(nameMotherList.Data());
347 fMotherList[iCut]->SetOwner(kTRUE);
348 fCutFolder[iCut]->Add(fMotherList[iCut]);
350 fTHnSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
351 fMotherList[iCut]->Add(fTHnSparseMotherInvMassPtZM[iCut]);
354 fBGHandler[iCut] = new AliGammaConversionAODBGHandler( collisionSystem,centMin,centMax,
355 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents(),
356 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity());
360 //______________________________________________________________________
361 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::UserCreateOutputObjects()
364 // Create ouput objects
367 // Create the output container
368 if(fOutputContainer != NULL){
369 delete fOutputContainer;
370 fOutputContainer = NULL;
372 if(fOutputContainer == NULL){
373 fOutputContainer = new TList();
374 fOutputContainer->SetOwner(kTRUE);
377 fGoodConvGammas = new TList();
378 fClusterCandidates = new TList();
379 fNeutralPionCandidates = new TList();
380 fGoodVirtualParticles = new TList();
382 fCutFolder = new TList*[fnCuts];
383 fESDList = new TList*[fnCuts];
384 fBackList = new TList*[fnCuts];
385 fMotherList = new TList*[fnCuts];
386 fHistoNEvents = new TH1I*[fnCuts];
387 fHistoNGoodESDTracks = new TH1I*[fnCuts];
388 fProfileEtaShift = new TProfile*[fnCuts];
389 if (fNeutralPionMode < 2){
390 fHistoConvGammaPt = new TH1F*[fnCuts];
391 fHistoConvGammaEta = new TH1F*[fnCuts];
393 if (fNeutralPionMode > 0){
394 fHistoClusterGammaPt = new TH1F*[fnCuts];
395 fHistoClusterGammaEta = new TH1F*[fnCuts];
397 fHistoNegPionPt = new TH1F*[fnCuts];
398 fHistoPosPionPt = new TH1F*[fnCuts];
399 fHistoNegPionPhi = new TH1F*[fnCuts];
400 fHistoPosPionPhi = new TH1F*[fnCuts];
401 fHistoPionPionInvMassPt = new TH2F*[fnCuts];
404 fHistoNegPionEta = new TH1F*[fnCuts];
405 fHistoPosPionEta = new TH1F*[fnCuts];
406 fHistoNegPionClsTPC = new TH2F*[fnCuts];
407 fHistoPosPionClsTPC = new TH2F*[fnCuts];
408 fHistoPionDCAxy = new TH2F*[fnCuts];
409 fHistoPionDCAz = new TH2F*[fnCuts];
410 fHistoPionTPCdEdxNSigma = new TH2F*[fnCuts];
411 fHistoPionTPCdEdx = new TH2F*[fnCuts];
413 fHistoGammaGammaInvMassPt = new TH2F*[fnCuts];
414 fHistoMotherInvMassPt = new TH2F*[fnCuts];
415 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
417 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
418 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
419 TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
420 TString cutstringConvGamma = "";
421 if (fNeutralPionMode < 2) cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
422 TString cutstringCaloGamma = "";
423 if (fNeutralPionMode > 0) cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
424 TString cutstringNeutralPion= ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutNumber();
425 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
427 TString fullCutString = "";
428 if (fNeutralPionMode == 0) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
429 else if (fNeutralPionMode == 1) fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
430 else if (fNeutralPionMode == 2) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
431 TString nameCutFolder = Form("Cut Number %s", fullCutString.Data());
432 TString nameESDList = Form("%s ESD histograms", fullCutString.Data());
435 fCutFolder[iCut] = new TList();
436 fCutFolder[iCut]->SetName(nameCutFolder.Data());
437 fCutFolder[iCut]->SetOwner(kTRUE);
438 fOutputContainer->Add(fCutFolder[iCut]);
440 fESDList[iCut] = new TList();
441 fESDList[iCut]->SetName(nameESDList.Data());
442 fESDList[iCut]->SetOwner(kTRUE);
444 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
445 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
446 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
447 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
448 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
449 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
450 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
451 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
452 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
453 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
454 fESDList[iCut]->Add(fHistoNEvents[iCut]);
456 if(fIsHeavyIon>0) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
457 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
458 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
460 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
461 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
462 if (fNeutralPionMode < 2){
463 fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
464 fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
465 fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",600,-1.5,1.5);
466 fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
468 if (fNeutralPionMode > 0){
469 fHistoClusterGammaPt[iCut] = new TH1F("ESD_ClusterGamma_Pt","ESD_ClusterGamma_Pt",250,0,25);
470 fESDList[iCut]->Add(fHistoClusterGammaPt[iCut]);
471 fHistoClusterGammaEta[iCut] = new TH1F("ESD_ClusterGamma_Eta","ESD_ClusterGamma_Eta",600,-1.5,1.5);
472 fESDList[iCut]->Add(fHistoClusterGammaEta[iCut]);
474 fHistoNegPionPt[iCut] = new TH1F("ESD_PrimaryNegPions_Pt","ESD_PrimaryNegPions_Pt",1000,0,25);
475 fESDList[iCut]->Add(fHistoNegPionPt[iCut]);
476 fHistoPosPionPt[iCut] = new TH1F("ESD_PrimaryPosPions_Pt","ESD_PrimaryPosPions_Pt",1000,0,25);
477 fESDList[iCut]->Add(fHistoPosPionPt[iCut]);
478 fHistoNegPionPhi[iCut] = new TH1F("ESD_PrimaryNegPions_Phi","ESD_PrimaryNegPions_Phi",360,0,2*TMath::Pi());
479 fESDList[iCut]->Add(fHistoNegPionPhi[iCut]);
480 fHistoPosPionPhi[iCut] = new TH1F("ESD_PrimaryPosPions_Phi","ESD_PrimaryPosPions_Phi",360,0,2*TMath::Pi());
481 fESDList[iCut]->Add(fHistoPosPionPhi[iCut]);
482 fHistoPionPionInvMassPt[iCut] = new TH2F("ESD_PiPlusPiNeg_InvMassPt","ESD_PiPlusPiNeg_InvMassPt",2000,0.,2.,200,0.,20.);
483 fESDList[iCut]->Add(fHistoPionPionInvMassPt[iCut]);
486 fHistoNegPionEta[iCut] = new TH1F("ESD_PrimaryNegPions_Eta","ESD_PrimaryNegPions_Eta",600,-1.5,1.5);
487 fESDList[iCut]->Add(fHistoNegPionEta[iCut]);
488 fHistoPosPionEta[iCut] = new TH1F("ESD_PrimaryPosPions_Eta","ESD_PrimaryPosPions_Eta",600,-1.5,1.5);
489 fESDList[iCut]->Add(fHistoPosPionEta[iCut]);
490 fHistoNegPionClsTPC[iCut] = new TH2F("ESD_PrimaryNegPions_ClsTPC","ESD_PrimaryNegPions_ClsTPC",100,0,1,400,0.,10.);
491 fESDList[iCut]->Add(fHistoNegPionClsTPC[iCut]);
492 fHistoPosPionClsTPC[iCut] = new TH2F("ESD_PrimaryPosPions_ClsTPC","ESD_PrimaryPosPions_ClsTPC",100,0,1,400,0.,10.);
493 fESDList[iCut]->Add(fHistoPosPionClsTPC[iCut]);
494 fHistoPionDCAxy[iCut] = new TH2F("ESD_PrimaryPions_DCAxy","ESD_PrimaryPions_DCAxy",800,-4.0,4.0,400,0.,10.);
495 fESDList[iCut]->Add(fHistoPionDCAxy[iCut]);
496 fHistoPionDCAz[iCut] = new TH2F("ESD_PrimaryPions_DCAz","ESD_PrimaryPions_DCAz",800,-4.0,4.0,400,0.,10.);
497 fESDList[iCut]->Add(fHistoPionDCAz[iCut]);
498 fHistoPionTPCdEdxNSigma[iCut] = new TH2F("ESD_PrimaryPions_TPCdEdx","ESD_PrimaryPions_TPCdEdx",150,0.05,20,400,-10,10);
499 fESDList[iCut]->Add(fHistoPionTPCdEdxNSigma[iCut]);
500 fHistoPionTPCdEdx[iCut] =new TH2F("ESD_PrimaryPions_TPCdEdxSignal","ESD_PrimaryPions_TPCdEdxSignal" ,150,0.05,20.0,800,0.0,200);
501 fESDList[iCut]->Add(fHistoPionTPCdEdx[iCut]);
503 fHistoGammaGammaInvMassPt[iCut] = new TH2F("ESD_GammaGamma_InvMass_Pt","ESD_GammaGamma_InvMass_Pt",450,0.,0.45,250,0,25);
504 fESDList[iCut]->Add(fHistoGammaGammaInvMassPt[iCut]);
505 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",500,0.4,0.9,250,0,25);
506 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
507 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",500,0.4,0.9,250,0,25);
508 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
511 TAxis *AxisAfter = fHistoPionTPCdEdxNSigma[iCut]->GetXaxis();
512 Int_t bins = AxisAfter->GetNbins();
513 Double_t from = AxisAfter->GetXmin();
514 Double_t to = AxisAfter->GetXmax();
515 Double_t *newBins = new Double_t[bins+1];
517 Double_t factor = TMath::Power(to/from, 1./bins);
518 for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
520 AxisAfter->Set(bins, newBins);
521 AxisAfter = fHistoPionTPCdEdx[iCut]->GetXaxis();
522 AxisAfter->Set(bins, newBins);
527 fCutFolder[iCut]->Add(fESDList[iCut]);
533 fMCList = new TList*[fnCuts];
535 fTrueList = new TList*[fnCuts];
536 if (fNeutralPionMode < 2){
537 fHistoTrueConvGammaPt = new TH1F*[fnCuts];
538 fHistoTrueConvGammaFromNeutralMesonPt = new TH1F*[fnCuts];
540 if (fNeutralPionMode > 0){
541 fHistoTrueClusterGammaPt = new TH1F*[fnCuts];
542 fHistoTrueClusterGammaFromNeutralMesonPt = new TH1F*[fnCuts];
544 fHistoTruePosPionPt = new TH1F*[fnCuts];
545 fHistoTrueNegPionPt = new TH1F*[fnCuts];
546 fHistoTruePosPionFromNeutralMesonPt = new TH1F*[fnCuts];
547 fHistoTrueNegPionFromNeutralMesonPt = new TH1F*[fnCuts];
550 fHistoMCAllGammaPt = new TH1F*[fnCuts];
551 if (fNeutralPionMode < 2){
552 fHistoMCConvGammaPt = new TH1F*[fnCuts];
554 fHistoMCAllPosPionsPt = new TH1F*[fnCuts];
555 fHistoMCAllNegPionsPt = new TH1F*[fnCuts];
556 fHistoMCGammaFromNeutralMesonPt = new TH1F*[fnCuts];
557 fHistoMCPosPionsFromNeutralMesonPt = new TH1F*[fnCuts];
558 fHistoMCNegPionsFromNeutralMesonPt = new TH1F*[fnCuts];
560 // hMCPi0DalitzGammaPt = new TH1F*[fnCuts];
561 // hMCPi0DalitzElectronPt = new TH1F*[fnCuts];
562 // hMCPi0DalitzPositronPt = new TH1F*[fnCuts];
564 fHistoMCEtaPiPlPiMiPiZeroPt = new TH1F*[fnCuts];
565 fHistoMCEtaPiPlPiMiPiZeroInAccPt = new TH1F*[fnCuts];
566 fHistoMCOmegaPiPlPiMiPiZeroPt = new TH1F*[fnCuts];
567 fHistoMCOmegaPiPlPiMiPiZeroInAccPt = new TH1F*[fnCuts];
569 fHistoTrueMotherPiPlPiMiPiZeroInvMassPt = new TH2F*[fnCuts];
570 fHistoTrueMotherGammaGammaInvMassPt = new TH2F*[fnCuts];
571 fHistoTrueMotherGammaGammaFromEtaInvMassPt = new TH2F*[fnCuts];
572 fHistoTrueMotherGammaGammaFromOmegaInvMassPt = new TH2F*[fnCuts];
574 fHistoTruePionPionInvMassPt = new TH2F*[fnCuts];
575 fHistoTruePionPionFromSameMotherInvMassPt = new TH2F*[fnCuts];
576 fHistoTruePionPionFromEtaInvMassPt = new TH2F*[fnCuts];
577 fHistoTruePionPionFromOmegaInvMassPt = new TH2F*[fnCuts];
580 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
581 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
582 TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
583 TString cutstringConvGamma = "";
584 if (fNeutralPionMode < 2) cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
585 TString cutstringCaloGamma = "";
586 if (fNeutralPionMode > 0) cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
587 TString cutstringNeutralPion= ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutNumber();
588 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
590 TString fullCutString = "";
591 if (fNeutralPionMode == 0) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
592 else if (fNeutralPionMode == 1) fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
593 else if (fNeutralPionMode == 2) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
594 TString nameMCList = Form("%s MC histograms", fullCutString.Data());
595 TString nameTrueRecList = Form("%s True histograms", fullCutString.Data());
597 fMCList[iCut] = new TList();
598 fMCList[iCut]->SetName(nameMCList.Data());
599 fMCList[iCut]->SetOwner(kTRUE);
600 fCutFolder[iCut]->Add(fMCList[iCut]);
602 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
603 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
604 if (fNeutralPionMode < 2){
605 fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
606 fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
609 fHistoMCAllPosPionsPt[iCut] = new TH1F("MC_AllPosPions_Pt","MC_AllPosPions_Pt",1000,0,25);
610 fMCList[iCut]->Add(fHistoMCAllPosPionsPt[iCut]);
611 fHistoMCAllNegPionsPt[iCut] = new TH1F("MC_AllNegPions_Pt","MC_AllNegPions_Pt",1000,0,25);
612 fMCList[iCut]->Add(fHistoMCAllNegPionsPt[iCut]);
613 fHistoMCGammaFromNeutralMesonPt[iCut] = new TH1F("MC_GammaFromNeutralMeson_Pt","MC_GammaFromNeutralMeson_Pt",250,0,25);
614 fMCList[iCut]->Add(fHistoMCGammaFromNeutralMesonPt[iCut]);
615 fHistoMCPosPionsFromNeutralMesonPt[iCut] = new TH1F("MC_PosPionsFromNeutralMeson_Pt","MC_PosPionsFromNeutralMeson_Pt",1000,0,25);
616 fMCList[iCut]->Add(fHistoMCPosPionsFromNeutralMesonPt[iCut]);
617 fHistoMCNegPionsFromNeutralMesonPt[iCut] = new TH1F("MC_NegPionsFromNeutralMeson_Pt","MC_NegPionsFromNeutralMeson_Pt",1000,0,25);
618 fMCList[iCut]->Add(fHistoMCNegPionsFromNeutralMesonPt[iCut]);
620 fHistoMCEtaPiPlPiMiPiZeroPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
621 fHistoMCEtaPiPlPiMiPiZeroPt[iCut]->Sumw2();
622 fMCList[iCut]->Add(fHistoMCEtaPiPlPiMiPiZeroPt[iCut]);
624 fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
625 fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut]->Sumw2();
626 fMCList[iCut]->Add(fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut]);
628 fHistoMCOmegaPiPlPiMiPiZeroPt[iCut] = new TH1F("MC_Omega_Pt","MC_Omega_Pt",250,0,25);
629 fHistoMCOmegaPiPlPiMiPiZeroPt[iCut]->Sumw2();
630 fMCList[iCut]->Add(fHistoMCOmegaPiPlPiMiPiZeroPt[iCut]);
632 fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut] = new TH1F("MC_OmegaInAcc_Pt","MC_OmegaInAcc_Pt",250,0,25);
633 fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut]->Sumw2();
634 fMCList[iCut]->Add(fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut]);
636 fTrueList[iCut] = new TList();
637 fTrueList[iCut]->SetName(nameTrueRecList.Data());
638 fTrueList[iCut]->SetOwner(kTRUE);
639 fCutFolder[iCut]->Add(fTrueList[iCut]);
641 if (fNeutralPionMode < 2){
642 fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
643 fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
644 fHistoTrueConvGammaFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueConvGammaFromNeutralMeson_Pt","ESD_TrueConvGammaFromNeutralMeson_Pt",250,0,25);
645 fTrueList[iCut]->Add(fHistoTrueConvGammaFromNeutralMesonPt[iCut]);
647 if (fNeutralPionMode > 0){
648 fHistoTrueClusterGammaPt[iCut] = new TH1F("ESD_TrueClusterGamma_Pt","ESD_TrueClusterGamma_Pt",250,0,25);
649 fTrueList[iCut]->Add(fHistoTrueClusterGammaPt[iCut]);
650 fHistoTrueClusterGammaFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueClusterGammaFromNeutralMeson_Pt","ESD_TrueClusterGammaFromNeutralMeson_Pt",250,0,25);
651 fTrueList[iCut]->Add(fHistoTrueClusterGammaFromNeutralMesonPt[iCut]);
653 fHistoTruePosPionPt[iCut] = new TH1F("ESD_TruePosPion_Pt","ESD_TruePosPion_Pt",1000,0,25);
654 fTrueList[iCut]->Add(fHistoTruePosPionPt[iCut]);
655 fHistoTrueNegPionPt[iCut] = new TH1F("ESD_TrueNegPion_Pt","ESD_TrueNegPion_Pt",1000,0,25);
656 fTrueList[iCut]->Add(fHistoTrueNegPionPt[iCut]);
658 fHistoTrueNegPionFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueNegPionFromNeutralMeson_Pt","ESD_TrueNegPionFromNeutralMeson_Pt",1000,0,25);
659 fTrueList[iCut]->Add(fHistoTrueNegPionFromNeutralMesonPt[iCut]);
660 fHistoTruePosPionFromNeutralMesonPt[iCut] = new TH1F("ESD_TruePosPionFromNeutralMeson_Pt","ESD_TruePosPionFromNeutralMeson_Pt",1000,0,25);
661 fTrueList[iCut]->Add(fHistoTruePosPionFromNeutralMesonPt[iCut]);
663 fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiPiZero_InvMass_Pt","ESD_TrueMotherPiPlPiMiPiZero_InvMass_Pt",500,0.4,0.9,250,0,25);
664 fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[iCut]->Sumw2();
665 fTrueList[iCut]->Add(fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[iCut]);
667 fHistoTrueMotherGammaGammaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGG_InvMass_Pt","ESD_TrueMotherGG_InvMass_Pt",450,0.,0.45,250,0,25);
668 fTrueList[iCut]->Add(fHistoTrueMotherGammaGammaInvMassPt[iCut]);
669 fHistoTrueMotherGammaGammaFromEtaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGGFromEta_InvMass_Pt","ESD_TrueMotherGGFromEta_InvMass_Pt",450,0.,0.45,250,0,25);
670 fTrueList[iCut]->Add(fHistoTrueMotherGammaGammaFromEtaInvMassPt[iCut]);
671 fHistoTrueMotherGammaGammaFromOmegaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGGFromOmega_InvMass_Pt","ESD_TrueMotherGGFromOmega_InvMass_Pt",450,0.,0.45,250,0,25);
672 fTrueList[iCut]->Add(fHistoTrueMotherGammaGammaFromOmegaInvMassPt[iCut]);
676 fHistoTruePionPionInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNeg_InvMassPt","ESD_TruePiPlusPiNeg_InvMassPt",2000,0.,2.,200,0.,20.);
677 fTrueList[iCut]->Add(fHistoTruePionPionInvMassPt[iCut]);
678 fHistoTruePionPionFromSameMotherInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromSameMother_InvMassPt","ESD_TruePiPlusPiNegFromSameMother_InvMassPt",2000,0.,2.,200,0.,20.);
679 fTrueList[iCut]->Add(fHistoTruePionPionFromSameMotherInvMassPt[iCut]);
680 fHistoTruePionPionFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromEta_InvMassPt","ESD_TruePiPlusPiNegFromEta_InvMassPt",2000,0.,2.,200,0.,20.);
681 fTrueList[iCut]->Add(fHistoTruePionPionFromEtaInvMassPt[iCut]);
682 fHistoTruePionPionFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromOmega_InvMassPt","ESD_TruePiPlusPiNegFromOmega_InvMassPt",2000,0.,2.,200,0.,20.);
683 fTrueList[iCut]->Add(fHistoTruePionPionFromOmegaInvMassPt[iCut]);
691 InitBack(); // Init Background Handler
693 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
694 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
697 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
698 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
699 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
703 fPionSelector=(AliPrimaryPionSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("PionSelector");
704 if(!fPionSelector){printf("Error: No PionSelector");return;} // GetV0Reader
707 if ( ((AliPrimaryPionCuts*)fPionSelector->GetPrimaryPionCuts())->GetCutHistograms() ){
708 fOutputContainer->Add( ((AliPrimaryPionCuts*)fPionSelector->GetPrimaryPionCuts())->GetCutHistograms() );
712 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
714 if( ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutHistograms() ) {
715 fCutFolder[iCut]->Add( ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutHistograms() );
718 if (fNeutralPionMode < 2){
719 if( fGammaCutArray ) {
720 if( ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms() ) {
721 fCutFolder[iCut]->Add( ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms() );
725 if (fNeutralPionMode > 0){
726 if( fClusterCutArray ) {
727 if( ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms() ) {
728 fCutFolder[iCut]->Add( ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms() );
732 if( fNeutralPionMesonCutArray ) {
733 if( ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutHistograms() ) {
734 fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutHistograms());
737 if( fMesonCutArray ) {
738 if( ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms() ) {
739 fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
744 PostData(1, fOutputContainer);
748 //______________________________________________________________________
749 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::UserExec(Option_t *){
752 // Execute analysis for current event
755 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
756 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
758 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
760 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
761 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
762 fHistoNEvents[iCut]->Fill(eventQuality);
767 fPionSelector=(AliPrimaryPionSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("PionSelector");
768 if(!fPionSelector){printf("Error: No PionSelector");return;} // GetV0Reader
770 if(fIsMC) fMCEvent = MCEvent();
771 fESDEvent = (AliESDEvent*)InputEvent();
772 fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
773 fSelectorNegPionIndex = fPionSelector->GetReconstructedNegPionIndex(); // Electrons from default Cut
774 fSelectorPosPionIndex = fPionSelector->GetReconstructedPosPionIndex(); // Positrons from default Cut
776 fNumberOfESDTracks = fV0Reader->GetNumberOfPrimaryTracks();
777 //AddTaskContainers(); //Add conatiner
779 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
781 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
783 if(eventNotAccepted){
784 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
785 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
789 if(eventQuality != 0){// Event Not Accepted
790 // cout << "event rejected due to: " <<eventQuality << endl;
791 fHistoNEvents[iCut]->Fill(eventQuality);
795 fHistoNEvents[iCut]->Fill(eventQuality);
796 fHistoNGoodESDTracks[iCut]->Fill(fNumberOfESDTracks);
798 if(fMCEvent){ // Process MC Particle
799 fMCStack = fMCEvent->Stack();
800 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
801 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
802 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
805 ProcessMCParticles();
808 if (fNeutralPionMode < 2){
809 ProcessConversionPhotonCandidates(); // Process this cuts conversion gammas
811 if (fNeutralPionMode > 0){
812 ProcessCaloPhotonCandidates(); // Process this cuts calo gammas
815 if (fNeutralPionMode == 0 ){
816 ProcessNeutralPionCandidatesPureConversions(); // Process neutral pion candidates purely from conversions
818 if (fNeutralPionMode == 1){
819 ProcessNeutralPionCandidatesMixedConvCalo(); // Process neutral pion candidates mixed conv and calo
821 if (fNeutralPionMode == 2){
822 ProcessNeutralPionCandidatesPureCalo(); // Process neutral pion candidates purely from calo
825 ProcessPionCandidates(); // Process this cuts gammas
827 CalculateMesonCandidates();
828 CalculateBackground();
829 UpdateEventByEventData();
832 if (fGoodConvGammas->GetEntries()>0) fGoodConvGammas->Clear();
833 if (fClusterCandidates->GetEntries()>0) fClusterCandidates->Clear();
834 if (fNeutralPionCandidates->GetEntries()>0) fNeutralPionCandidates->Clear();
835 fGoodVirtualParticles->Clear(); // delete this cuts good gammas
838 fSelectorNegPionIndex.clear();
839 fSelectorPosPionIndex.clear();
841 PostData( 1, fOutputContainer );
844 Bool_t AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::Notify(){
845 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
846 if( !((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift() ){
847 fProfileEtaShift[iCut]->Fill(0.,0.);
848 continue; // No Eta Shift requested, continue
850 if( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
851 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
852 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
853 ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->SetEtaShift( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() );
854 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
857 printf(" Eta t PiPlusPiMinus Gamma Task %s :: Eta Shift Manually Set to %f \n\n",
858 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
859 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
860 ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->SetEtaShift( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() );
861 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
868 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::Terminate(const Option_t *){
873 //________________________________________________________________________
874 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessCaloPhotonCandidates()
878 nclus = fInputEvent->GetNumberOfCaloClusters();
880 // cout << nclus << endl;
882 if(nclus == 0) return;
885 Double_t vertex[3] = {0};
886 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
888 // Loop over EMCal clusters
889 for(Long_t i = 0; i < nclus; i++){
891 AliVCluster* clus = NULL;
892 clus = fInputEvent->GetCaloCluster(i);
894 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
895 // TLorentzvector with cluster
896 TLorentzVector clusterVector;
897 clus->GetMomentum(clusterVector,vertex);
899 TLorentzVector* tmpvec = new TLorentzVector();
900 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
902 // convert to AODConversionPhoton
903 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
904 if(!PhotonCandidate) continue;
906 // Flag Photon as CaloPhoton
907 PhotonCandidate->SetIsCaloPhoton();
908 PhotonCandidate->SetCaloClusterRef(i);
911 Int_t* mclabelsCluster = clus->GetLabels();
912 PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
913 // cout << clus->GetNLabels() << endl;
914 if (clus->GetNLabels()>0){
915 for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
916 if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
917 // Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
918 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
923 fIsFromMBHeader = kTRUE;
924 // test whether largest contribution to cluster orginates in added signals
925 if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
927 if (fIsFromMBHeader){
928 fHistoClusterGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
929 fHistoClusterGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
931 fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
934 // if(fInputEvent->IsA()==AliESDEvent::Class()){
935 ProcessTrueCaloPhotonCandidates(PhotonCandidate);
937 // ProcessTrueClusterCandidatesAOD(PhotonCandidate);
946 //________________________________________________________________________
947 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueCaloPhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
949 TParticle *Photon = NULL;
950 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
951 // fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
953 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
957 // cout << "no photon" << endl;
961 // Int_t pdgCodeParticle = Photon->GetPdgCode();
962 TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
966 if(TruePhotonCandidate->GetCaloPhotonMCLabel(0) <= fMCStack->GetNprimary()){
967 if (TruePhotonCandidate->IsLargestComponentPhoton()){
968 fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
969 if (GammaIsNeutralMesonPiPlPiMiPiZeroDaughter(TruePhotonCandidate->GetCaloPhotonMCLabel(0))){
970 fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt());
973 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
974 fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
975 if (GammaIsNeutralMesonPiPlPiMiPiZeroDaughter(TruePhotonCandidate->GetCaloPhotonMCLabel(0))){
976 fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt());
986 //________________________________________________________________________
987 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessConversionPhotonCandidates(){
989 TList *GoodGammasStepOne = new TList();
990 TList *GoodGammasStepTwo = new TList();
991 // Loop over Photon Candidates allocated by ReaderV1
993 for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
994 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
995 if(!PhotonCandidate) continue;
997 fIsFromMBHeader = kTRUE;
999 if( fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0 ){
1000 Int_t isPosFromMBHeader
1001 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1002 if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1003 Int_t isNegFromMBHeader
1004 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack,fInputEvent);
1005 if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1006 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1009 if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fESDEvent)) continue;
1011 if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
1012 !((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // if no post reader loop is required add to events good gammas
1014 fGoodConvGammas->Add(PhotonCandidate);
1016 if(fIsFromMBHeader){
1017 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1018 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1022 ProcessTrueConversionPhotonCandidates(PhotonCandidate);
1024 } else if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1025 ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
1027 GoodGammasStepOne->Add(PhotonCandidate);
1028 } else if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
1029 ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
1030 GoodGammasStepTwo->Add(PhotonCandidate);
1035 if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){
1036 for(Int_t i = 0;i<GoodGammasStepOne->GetEntries();i++){
1037 AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GoodGammasStepOne->At(i);
1038 if(!PhotonCandidate) continue;
1039 fIsFromMBHeader = kTRUE;
1040 if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1041 Int_t isPosFromMBHeader
1042 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack,fInputEvent);
1043 Int_t isNegFromMBHeader
1044 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack,fInputEvent);
1045 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1047 if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GoodGammasStepOne->GetEntries())) continue;
1048 if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1049 fGoodConvGammas->Add(PhotonCandidate);
1050 if(fIsFromMBHeader){
1051 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1052 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1055 ProcessTrueConversionPhotonCandidates(PhotonCandidate);
1058 else GoodGammasStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1061 if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){
1062 for(Int_t i = 0;i<GoodGammasStepTwo->GetEntries();i++){
1063 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GoodGammasStepTwo->At(i);
1064 if(!PhotonCandidate) continue;
1066 if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1067 Int_t isPosFromMBHeader
1068 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack,fInputEvent);
1069 Int_t isNegFromMBHeader
1070 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack,fInputEvent);
1071 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1074 if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GoodGammasStepTwo,i)) continue;
1075 fGoodConvGammas->Add(PhotonCandidate); // Add gamma to current cut TList
1077 if(fIsFromMBHeader){
1078 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt()); // Differences to old V0Reader in p_t due to conversion KF->TLorentzVector
1079 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1083 ProcessTrueConversionPhotonCandidates(PhotonCandidate);
1088 delete GoodGammasStepOne;
1089 GoodGammasStepOne = 0x0;
1090 delete GoodGammasStepTwo;
1091 GoodGammasStepTwo = 0x0;
1094 //________________________________________________________________________
1095 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueConversionPhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1097 // Process True Photons
1098 AliStack *MCStack = fMCEvent->Stack();
1099 TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(MCStack);
1100 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(MCStack);
1102 if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1103 if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){ // Not Same Mother == Combinatorial Bck
1107 else if (posDaughter->GetMother(0) == -1){
1111 if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11) return; //One Particle is not electron
1112 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
1113 if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
1115 TParticle *Photon = TruePhotonCandidate->GetMCParticle(MCStack);
1116 if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
1120 Int_t labelGamma = TruePhotonCandidate->GetMCParticleLabel(MCStack);
1122 if( labelGamma < MCStack->GetNprimary() ){
1123 if( fIsFromMBHeader ){
1124 fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1125 if (GammaIsNeutralMesonPiPlPiMiPiZeroDaughter(labelGamma)){
1126 fHistoTrueConvGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1132 //________________________________________________________________________
1133 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessNeutralPionCandidatesPureConversions(){
1134 // Conversion Gammas
1135 if(fGoodConvGammas->GetEntries()>1){
1136 for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodConvGammas->GetEntries()-1;firstGammaIndex++){
1137 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(firstGammaIndex));
1138 if (gamma0==NULL) continue;
1139 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGoodConvGammas->GetEntries();secondGammaIndex++){
1140 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(secondGammaIndex));
1141 //Check for same Electron ID
1142 if (gamma1==NULL) continue;
1143 if(gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelPositive() ||
1144 gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelNegative() ||
1145 gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelPositive() ||
1146 gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelNegative() ) continue;
1148 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1149 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1151 pi0cand->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
1152 if((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1153 fHistoGammaGammaInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1154 if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->GetSelectionLow() && pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->GetSelectionHigh()){
1155 fNeutralPionCandidates->Add(pi0cand);
1156 // cout << "Pi0 candidate " << pi0cand->M() << "\t" << pi0cand->Pt() << endl;
1160 if(fInputEvent->IsA()==AliESDEvent::Class())
1161 ProcessTrueNeutralPionCandidatesPureConversions(pi0cand,gamma0,gamma1);
1162 if(fInputEvent->IsA()==AliAODEvent::Class())
1163 ProcessTrueNeutralPionCandidatesPureConversionsAOD(pi0cand,gamma0,gamma1);
1174 //________________________________________________________________________
1175 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessNeutralPionCandidatesPureCalo(){
1177 // Conversion Gammas
1178 if(fClusterCandidates->GetEntries()>0){
1181 Double_t vertex[3] = {0};
1182 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1184 for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
1185 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
1186 if (gamma0==NULL) continue;
1188 for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
1189 if (firstGammaIndex == secondGammaIndex) continue;
1190 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
1191 if (gamma1==NULL) continue;
1193 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1194 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1196 if((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1197 fHistoGammaGammaInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1198 if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->GetSelectionLow() && pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->GetSelectionHigh()){
1199 fNeutralPionCandidates->Add(pi0cand);
1200 // cout << "Pi0 candidate " << pi0cand->M() << "\t" << pi0cand->Pt() << endl;
1204 // if(fInputEvent->IsA()==AliESDEvent::Class())
1205 ProcessTrueNeutralPionCandidatesPureCalo(pi0cand,gamma0,gamma1);
1206 // if(fInputEvent->IsA()==AliAODEvent::Class())
1207 // ProcessTrueNeutralPionCandidatesPureConversionsAOD(pi0cand,gamma0,gamma1);
1215 //______________________________________________________________________
1216 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueNeutralPionCandidatesPureCalo( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1218 // Process True Mesons
1219 AliStack *MCStack = fMCEvent->Stack();
1221 Bool_t isTruePi0 = kFALSE;
1222 Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
1223 Int_t gamma0MotherLabel = -1;
1224 Int_t motherRealLabel = -1;
1226 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1227 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
1228 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
1229 // get mother of interest (pi0 or eta)
1230 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
1231 gamma0MotherLabel=gammaMC0->GetMother(0);
1232 motherRealLabel=gammaMC0->GetFirstMother();
1233 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1234 if (TrueGammaCandidate0->IsConversion()){
1235 gamma0MotherLabel=MCStack->Particle(gammaMC0->GetMother(0))->GetMother(0);
1236 motherRealLabel=MCStack->Particle(gammaMC0->GetMother(0))->GetMother(0);
1238 gamma0MotherLabel=gammaMC0->GetMother(0);
1239 motherRealLabel=gammaMC0->GetMother(0);
1245 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
1247 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1248 Int_t gamma1MotherLabel = -1;
1250 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1251 // Daughters Gamma 1
1252 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
1253 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1254 // get mother of interest (pi0 or eta)
1255 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1256 gamma1MotherLabel=gammaMC1->GetMother(0);
1257 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1258 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
1259 else gamma1MotherLabel=gammaMC1->GetMother(0);
1264 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1265 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1270 if(isTruePi0){// True Pion
1271 Pi0Candidate->SetTrueMesonValue(1);
1272 Pi0Candidate->SetMCLabel(motherRealLabel);
1273 fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1274 if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1275 fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1277 if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1278 fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1285 //______________________________________________________________________
1286 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueNeutralPionCandidatesPureConversions(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1288 // Process True Mesons
1289 AliStack *MCStack = fMCEvent->Stack();
1290 if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
1291 Bool_t isTruePi0 = kFALSE;
1292 Bool_t isTruePi0Dalitz = kFALSE;
1293 Bool_t gamma0DalitzCand = kFALSE;
1294 Bool_t gamma1DalitzCand = kFALSE;
1295 Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
1296 Int_t gamma0MotherLabel = -1;
1297 Int_t motherRealLabel = -1;
1298 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1299 // Daughters Gamma 0
1300 TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
1301 TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
1302 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
1303 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
1304 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
1305 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
1306 gamma0MotherLabel=gammaMC0->GetFirstMother();
1307 motherRealLabel=gammaMC0->GetFirstMother();
1310 if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
1311 gamma0DalitzCand = kTRUE;
1312 gamma0MotherLabel=-111;
1313 motherRealLabel=gamma0MCLabel;
1317 if(TrueGammaCandidate1->GetV0Index()<fInputEvent->GetNumberOfV0s()){
1318 Int_t gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(MCStack);
1319 Int_t gamma1MotherLabel = -1;
1320 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1321 // Daughters Gamma 1
1322 TParticle * negativeMC = (TParticle*)TrueGammaCandidate1->GetNegativeMCDaughter(MCStack);
1323 TParticle * positiveMC = (TParticle*)TrueGammaCandidate1->GetPositiveMCDaughter(MCStack);
1324 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
1325 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
1326 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
1327 if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
1328 gamma1MotherLabel=gammaMC1->GetFirstMother();
1331 if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
1332 gamma1DalitzCand = kTRUE;
1333 gamma1MotherLabel=-111;
1337 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1338 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1343 //Identify Dalitz candidate
1344 if (gamma1DalitzCand || gamma0DalitzCand){
1345 if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
1346 if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
1348 if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
1349 if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
1354 if(isTruePi0 || isTruePi0Dalitz){// True Pion
1355 Pi0Candidate->SetTrueMesonValue(1);
1356 Pi0Candidate->SetMCLabel(motherRealLabel);
1357 fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1358 if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1359 fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1361 if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1362 fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1369 //______________________________________________________________________
1370 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueNeutralPionCandidatesPureConversionsAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1373 // Process True Mesons
1374 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1375 Bool_t isTruePi0 = kFALSE;
1376 Bool_t isTruePi0Dalitz = kFALSE;
1377 Bool_t gamma0DalitzCand = kFALSE;
1378 Bool_t gamma1DalitzCand = kFALSE;
1379 Int_t motherRealLabel = -1;
1381 if (AODMCTrackArray!=NULL && TrueGammaCandidate0 != NULL){
1382 AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
1383 AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
1385 Int_t gamma0MCLabel = -1;
1386 Int_t gamma0MotherLabel = -1;
1387 if(!positiveMC||!negativeMC)
1390 if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
1391 gamma0MCLabel = positiveMC->GetMother();
1394 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1395 // Daughters Gamma 0
1396 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
1397 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
1398 if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
1399 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
1400 gamma0MotherLabel=gammaMC0->GetMother();
1401 motherRealLabel=gammaMC0->GetMother();
1404 if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
1405 gamma0DalitzCand = kTRUE;
1406 gamma0MotherLabel=-111;
1407 motherRealLabel=gamma0MCLabel;
1411 positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
1412 negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
1414 Int_t gamma1MCLabel = -1;
1415 Int_t gamma1MotherLabel = -1;
1416 if(!positiveMC||!negativeMC)
1419 if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
1420 gamma1MCLabel = positiveMC->GetMother();
1422 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1423 // Daughters Gamma 1
1424 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
1425 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
1426 if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
1427 if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
1428 gamma1MotherLabel=gammaMC1->GetMother();
1431 if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
1432 gamma1DalitzCand = kTRUE;
1433 gamma1MotherLabel=-111;
1437 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1438 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
1443 //Identify Dalitz candidate
1444 if (gamma1DalitzCand || gamma0DalitzCand){
1445 if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
1446 if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
1448 if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
1449 if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
1453 if(isTruePi0 || isTruePi0Dalitz){// True Pion
1454 Pi0Candidate->SetTrueMesonValue(1);
1455 Pi0Candidate->SetMCLabel(motherRealLabel);
1456 fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1457 if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1458 fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1460 if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1461 fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1469 //________________________________________________________________________
1470 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessNeutralPionCandidatesMixedConvCalo(){
1472 // Conversion Gammas
1473 if(fGoodConvGammas->GetEntries()>0){
1475 Double_t vertex[3] = {0};
1476 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1478 for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodConvGammas->GetEntries();firstGammaIndex++){
1479 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(firstGammaIndex));
1480 if (gamma0==NULL) continue;
1482 for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
1483 Bool_t matched = kFALSE;
1484 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
1485 if (gamma1==NULL) continue;
1487 if (gamma1->GetIsCaloPhoton()){
1488 AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
1489 matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent );
1492 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1493 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1495 if((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1497 fHistoGammaGammaInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1498 if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->GetSelectionLow() && pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->GetSelectionHigh()){
1499 fNeutralPionCandidates->Add(pi0cand);
1500 // cout << "Pi0 candidate " << pi0cand->M() << "\t" << pi0cand->Pt() << endl;
1504 // if(fInputEvent->IsA()==AliESDEvent::Class())
1505 ProcessTrueNeutralPionCandidatesMixedConvCalo(pi0cand,gamma0,gamma1);
1506 // if(fInputEvent->IsA()==AliAODEvent::Class())
1507 // ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1, matched);
1516 //______________________________________________________________________
1517 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueNeutralPionCandidatesMixedConvCalo( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1519 // Process True Mesons
1520 AliStack *MCStack = fMCEvent->Stack();
1521 if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
1522 Bool_t isTruePi0 = kFALSE;
1523 Bool_t isTruePi0Dalitz = kFALSE;
1524 Bool_t gamma0DalitzCand = kFALSE;
1526 Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
1527 Int_t gamma0MotherLabel = -1;
1528 Int_t motherRealLabel = -1;
1529 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1530 // Daughters Gamma 0
1531 TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
1532 TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
1533 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
1534 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
1535 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
1536 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
1537 gamma0MotherLabel=gammaMC0->GetFirstMother();
1538 motherRealLabel=gammaMC0->GetFirstMother();
1541 if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
1542 gamma0DalitzCand = kTRUE;
1543 gamma0MotherLabel=-111;
1544 motherRealLabel=gamma0MCLabel;
1550 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
1552 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1553 Int_t gamma1MotherLabel = -1;
1556 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1557 // Daughters Gamma 1
1558 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
1559 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1560 // get mother of interest (pi0 or eta)
1561 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1562 gamma1MotherLabel=gammaMC1->GetMother(0);
1563 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1564 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
1565 else gamma1MotherLabel=gammaMC1->GetMother(0);
1570 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1571 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1576 if (gamma0DalitzCand ){
1577 if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
1578 if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
1582 if(isTruePi0 || isTruePi0Dalitz ){
1583 Pi0Candidate->SetTrueMesonValue(1);
1584 Pi0Candidate->SetMCLabel(motherRealLabel);
1585 fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1586 if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1587 fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1589 if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1590 fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1598 //________________________________________________________________________
1599 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessPionCandidates(){
1601 Double_t magField = fInputEvent->GetMagneticField();
1602 if( magField < 0.0 ){
1608 vector<Int_t> lGoodNegPionIndexPrev(0);
1609 vector<Int_t> lGoodPosPionIndexPrev(0);
1611 for(UInt_t i = 0; i < fSelectorNegPionIndex.size(); i++){
1612 AliESDtrack* negPionCandidate = fESDEvent->GetTrack(fSelectorNegPionIndex[i]);
1613 if(! ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelected(negPionCandidate) ) continue;
1614 lGoodNegPionIndexPrev.push_back( fSelectorNegPionIndex[i] );
1615 fHistoNegPionPt[fiCut]->Fill(negPionCandidate->Pt());
1616 fHistoNegPionPhi[fiCut]->Fill(negPionCandidate->Phi());
1618 Int_t labelNegPion = TMath::Abs( negPionCandidate->GetLabel() );
1619 if( labelNegPion < fMCStack->GetNtrack() ){
1620 TParticle* negPion = fMCStack->Particle(labelNegPion);
1621 if( negPion->GetPdgCode() == -211 ){
1622 if( labelNegPion < fMCStack->GetNprimary() ){
1623 fHistoTrueNegPionPt[fiCut]->Fill(negPionCandidate->Pt()); //primary negPion
1625 if( IsEtaPiPlPiMiPiZeroDaughter(labelNegPion) || IsOmegaPiPlPiMiPiZeroDaughter(labelNegPion) ) {
1626 if( labelNegPion < fMCStack->GetNprimary() ) {
1627 fHistoTrueNegPionFromNeutralMesonPt[fiCut]->Fill(negPionCandidate->Pt());
1635 for(UInt_t i = 0; i < fSelectorPosPionIndex.size(); i++){
1636 AliESDtrack* posPionCandidate = fESDEvent->GetTrack( fSelectorPosPionIndex[i] );
1637 if(! ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelected(posPionCandidate) ) continue;
1638 lGoodPosPionIndexPrev.push_back( fSelectorPosPionIndex[i] );
1639 fHistoPosPionPt[fiCut]->Fill( posPionCandidate->Pt() );
1640 fHistoPosPionPhi[fiCut]->Fill( posPionCandidate->Phi() );
1643 Int_t labelPosPion = TMath::Abs( posPionCandidate->GetLabel() );
1644 if( labelPosPion < fMCStack->GetNtrack() ) {
1645 TParticle* posPion = fMCStack->Particle(labelPosPion);
1646 if( posPion->GetPdgCode() == 211 ){
1647 if( labelPosPion < fMCStack->GetNprimary() ){
1648 fHistoTruePosPionPt[fiCut]->Fill(posPionCandidate->Pt());
1650 if( IsEtaPiPlPiMiPiZeroDaughter(labelPosPion) || IsOmegaPiPlPiMiPiZeroDaughter(labelPosPion) ) {
1651 if( labelPosPion < fMCStack->GetNprimary() ){
1652 fHistoTruePosPionFromNeutralMesonPt[fiCut]->Fill(posPionCandidate->Pt());
1661 for(UInt_t i = 0; i < lGoodNegPionIndexPrev.size(); i++){
1663 AliESDtrack *negPionCandidate = fESDEvent->GetTrack(lGoodNegPionIndexPrev[i]);
1664 AliKFParticle negPionCandidateKF( *negPionCandidate->GetConstrainedParam(), 211 );
1666 for(UInt_t j = 0; j < lGoodPosPionIndexPrev.size(); j++){
1668 AliESDtrack *posPionCandidate = fESDEvent->GetTrack(lGoodPosPionIndexPrev[j]);
1669 AliKFParticle posPionCandidateKF( *posPionCandidate->GetConstrainedParam(), 211 );
1671 AliKFConversionPhoton* virtualPhoton = NULL;
1672 virtualPhoton = new AliKFConversionPhoton(negPionCandidateKF,posPionCandidateKF);
1673 AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
1674 // primaryVertexImproved+=*virtualPhoton;
1675 virtualPhoton->SetProductionVertex(primaryVertexImproved);
1676 virtualPhoton->SetTrackLabels( lGoodPosPionIndexPrev[j], lGoodNegPionIndexPrev[i]);
1680 Int_t motherlabelp = 0;
1681 Int_t motherlabeln = 0;
1682 TParticle *fNegativeMCParticle =NULL;
1683 TParticle *fPositiveMCParticle =NULL;
1685 labeln=TMath::Abs(negPionCandidate->GetLabel());
1686 labelp=TMath::Abs(posPionCandidate->GetLabel());
1687 fNegativeMCParticle = fMCStack->Particle(labeln);
1688 fPositiveMCParticle = fMCStack->Particle(labelp);
1689 motherlabeln = fNegativeMCParticle->GetMother(0);
1690 motherlabelp = fPositiveMCParticle->GetMother(0);
1691 if( fPositiveMCParticle && fNegativeMCParticle) {
1692 virtualPhoton->SetMCLabelPositive(labelp);
1693 virtualPhoton->SetMCLabelNegative(labeln);
1697 AliAODConversionPhoton *vParticle = new AliAODConversionPhoton(virtualPhoton); //To apply mass 2 pion mass cut
1698 if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
1699 if (vParticle->GetMass() < ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
1700 fGoodVirtualParticles->Add( vParticle );
1701 fHistoPionPionInvMassPt[fiCut]->Fill( vParticle->GetMass(),vParticle->Pt());
1704 fGoodVirtualParticles->Add( vParticle );
1705 fHistoPionPionInvMassPt[fiCut]->Fill( vParticle->GetMass(),vParticle->Pt());
1708 Double_t clsToFPos = -1.0;
1709 Double_t clsToFNeg = -1.0;
1711 Float_t dcaToVertexXYPos = -1.0;
1712 Float_t dcaToVertexZPos = -1.0;
1713 Float_t dcaToVertexXYNeg = -1.0;
1714 Float_t dcaToVertexZNeg = -1.0;
1719 clsToFPos = ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetNFindableClustersTPC(posPionCandidate);
1720 clsToFNeg = ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetNFindableClustersTPC(negPionCandidate);
1724 posPionCandidate->GetImpactParameters(bPos,bCovPos);
1725 if (bCovPos[0]<=0 || bCovPos[2]<=0) {
1726 AliDebug(1, "Estimated b resolution lower or equal zero!");
1727 bCovPos[0]=0; bCovPos[2]=0;
1732 posPionCandidate->GetImpactParameters(bNeg,bCovNeg);
1733 if (bCovNeg[0]<=0 || bCovNeg[2]<=0) {
1734 AliDebug(1, "Estimated b resolution lower or equal zero!");
1735 bCovNeg[0]=0; bCovNeg[2]=0;
1738 dcaToVertexXYPos = bPos[0];
1739 dcaToVertexZPos = bPos[1];
1740 dcaToVertexXYNeg = bNeg[0];
1741 dcaToVertexZNeg = bNeg[1];
1743 fHistoNegPionEta[fiCut]->Fill( negPionCandidate->Eta() );
1744 fHistoPosPionEta[fiCut]->Fill( posPionCandidate->Eta() );
1746 fHistoNegPionClsTPC[fiCut]->Fill(clsToFNeg,negPionCandidate->Pt());
1747 fHistoPosPionClsTPC[fiCut]->Fill(clsToFPos,posPionCandidate->Pt());
1749 fHistoPionDCAxy[fiCut]->Fill( dcaToVertexXYNeg, negPionCandidate->Pt() );
1750 fHistoPionDCAz[fiCut]->Fill( dcaToVertexZNeg, negPionCandidate->Pt() );
1751 fHistoPionDCAxy[fiCut]->Fill( dcaToVertexXYPos, posPionCandidate->Pt() );
1752 fHistoPionDCAz[fiCut]->Fill( dcaToVertexZPos, posPionCandidate->Pt() );
1754 fHistoPionTPCdEdxNSigma[fiCut]->Fill( posPionCandidate->P(),((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(posPionCandidate, AliPID::kPion) );
1755 fHistoPionTPCdEdxNSigma[fiCut]->Fill( negPionCandidate->P(),((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(negPionCandidate, AliPID::kPion) );
1757 fHistoPionTPCdEdx[fiCut]->Fill( posPionCandidate->P(), TMath::Abs(posPionCandidate->GetTPCsignal()));
1758 fHistoPionTPCdEdx[fiCut]->Fill( negPionCandidate->P(), TMath::Abs(negPionCandidate->GetTPCsignal()));
1762 if (fPositiveMCParticle && fNegativeMCParticle ) {
1763 if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
1764 if (vParticle->GetMass() < ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
1765 if(TMath::Abs(fNegativeMCParticle->GetPdgCode())==211 && TMath::Abs(fPositiveMCParticle->GetPdgCode())==211){ // Pions ...
1766 fHistoTruePionPionInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1767 if (motherlabeln == motherlabelp){
1768 fHistoTruePionPionFromSameMotherInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1769 if( IsEtaPiPlPiMiPiZeroDaughter(labeln) ) { //|| IsOmegaPiPlPiMiPiZeroDaughter(labeln)
1770 fHistoTruePionPionFromEtaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1772 if( IsOmegaPiPlPiMiPiZeroDaughter(labeln) ) { //||
1773 fHistoTruePionPionFromOmegaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1779 if(TMath::Abs(fNegativeMCParticle->GetPdgCode())==211 && TMath::Abs(fPositiveMCParticle->GetPdgCode())==211){ // Pions ...
1780 fHistoTruePionPionInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1781 if (motherlabeln == motherlabelp){
1782 fHistoTruePionPionFromSameMotherInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1783 if( IsEtaPiPlPiMiPiZeroDaughter(labeln) ) { //|| IsOmegaPiPlPiMiPiZeroDaughter(labeln)
1784 fHistoTruePionPionFromEtaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1786 if( IsOmegaPiPlPiMiPiZeroDaughter(labeln) ) { //||
1787 fHistoTruePionPionFromOmegaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
1795 delete virtualPhoton;
1802 //_____________________________________________________________________________
1803 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessMCParticles(){
1805 // Loop over all primary MC particle
1807 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
1809 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1810 if (!particle) continue;
1812 Int_t isMCFromMBHeader = -1;
1813 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1815 = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1816 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1819 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack,fInputEvent)){
1821 if (fNeutralPionMode < 2){
1822 if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
1823 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1824 if(particle->GetMother(0) >-1){
1825 if (fMCStack->Particle(particle->GetMother(0))->GetPdgCode() ==111){
1826 if (fMCStack->Particle(particle->GetMother(0))->GetMother(0) > -1){
1827 if ( fMCStack->Particle((fMCStack->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 221 ||
1828 fMCStack->Particle((fMCStack->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 223 ){
1829 if ( fMCStack->Particle(particle->GetMother(0))->GetNDaughters()==3 )
1830 fHistoMCGammaFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All photons from eta or omega via pi0
1836 } else if (fNeutralPionMode == 2){
1837 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCStack)){
1838 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1839 if(particle->GetMother(0) >-1){
1840 if (fMCStack->Particle(particle->GetMother(0))->GetPdgCode() ==111){
1841 if (fMCStack->Particle(particle->GetMother(0))->GetMother(0) > -1){
1842 if ( fMCStack->Particle((fMCStack->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 221 ||
1843 fMCStack->Particle((fMCStack->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 223 ){
1844 if ( fMCStack->Particle(particle->GetMother(0))->GetNDaughters()==3 )
1845 fHistoMCGammaFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All photons from eta or omega via pi0
1852 if (fNeutralPionMode < 2){
1853 if (((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
1854 fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
1855 } // Converted MC Gamma
1857 if(((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(i,fMCStack)){
1858 if( particle->GetPdgCode() == 211){
1859 fHistoMCAllPosPionsPt[fiCut]->Fill(particle->Pt()); // All pos pions
1860 if(particle->GetMother(0) >-1){
1861 if (fMCStack->Particle(particle->GetMother(0))->GetPdgCode() ==221 || fMCStack->Particle(particle->GetMother(0))->GetPdgCode() ==223)
1862 fHistoMCPosPionsFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All pos from eta or omega
1865 if( particle->GetPdgCode() == -211){
1866 fHistoMCAllNegPionsPt[fiCut]->Fill(particle->Pt()); // All neg pions
1867 if(particle->GetMother(0) >-1){
1868 if (fMCStack->Particle(particle->GetMother(0))->GetPdgCode() ==221 || fMCStack->Particle(particle->GetMother(0))->GetPdgCode() ==223 )
1869 fHistoMCNegPionsFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All pos from eta or omega
1875 // \eta -> pi+ pi- \gamma
1876 Int_t labelNeutPion = -1;
1877 Int_t labelNegPion = -1;
1878 Int_t labelPosPion = -1;
1880 if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMCPiPlPiMiPiZero(particle,fMCStack,labelNegPion,labelPosPion,labelNeutPion,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1881 Float_t weighted= 1;
1882 if( ((AliPrimaryPionCuts*) fPionCutArray->At(fiCut))->DoWeights() ) {
1883 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack,fInputEvent)){
1884 if (particle->Pt()>0.005){
1885 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack,fInputEvent);
1889 if(particle->GetPdgCode() == 221)fHistoMCEtaPiPlPiMiPiZeroPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Eta in respective decay channel
1890 if(particle->GetPdgCode() == 223)fHistoMCOmegaPiPlPiMiPiZeroPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Omega in respective decay channel
1892 TParticle *neutPion = fMCStack->Particle(labelNeutPion);
1893 TParticle *gamma1 = fMCStack->Particle(neutPion->GetDaughter(0));
1894 TParticle *gamma2 = fMCStack->Particle(neutPion->GetDaughter(1));
1895 if (fNeutralPionMode < 2){
1897 ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCStack,kFALSE) && // test first daugther of pi0
1898 ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(gamma2,fMCStack,kFALSE) && // test second daughter of pi0
1899 ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelNegPion,fMCStack) && // test negative pion
1900 ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelPosPion,fMCStack) // test positive pion
1902 if(particle->GetPdgCode() == 221) fHistoMCEtaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Eta pi+ pi- pi0 with gamma's and e+e- in acc
1903 if(particle->GetPdgCode() == 223) fHistoMCOmegaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Omega pi+ pi- pi0 with gamma's and e+e- in acc
1905 } else if (fNeutralPionMode == 2){
1907 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCStack) && // test first daugther of pi0
1908 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma2,fMCStack) && // test second daughter of pi0
1909 ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelNegPion,fMCStack) && // test negative pion
1910 ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelPosPion,fMCStack) // test positive pion
1912 if(particle->GetPdgCode() == 221) fHistoMCEtaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Eta pi+ pi- pi0 with gamma's and e+e- in acc
1913 if(particle->GetPdgCode() == 223) fHistoMCOmegaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Omega pi+ pi- pi0 with gamma's and e+e- in acc
1923 //________________________________________________________________________
1924 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateMesonCandidates(){
1926 // Conversion Gammas
1927 if( fNeutralPionCandidates->GetEntries() > 0 && fGoodVirtualParticles->GetEntries() > 0 ){
1929 for(Int_t mesonIndex=0; mesonIndex<fNeutralPionCandidates->GetEntries(); mesonIndex++){
1930 AliAODConversionMother *neutralPion=dynamic_cast<AliAODConversionMother*>(fNeutralPionCandidates->At(mesonIndex));
1931 if (neutralPion==NULL) continue;
1932 for(Int_t virtualParticleIndex=0;virtualParticleIndex<fGoodVirtualParticles->GetEntries();virtualParticleIndex++){
1934 AliAODConversionPhoton *vParticle=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualParticles->At(virtualParticleIndex));
1935 if (vParticle==NULL) continue;
1936 //Check for same Electron ID
1938 AliAODConversionMother *mesoncand = new AliAODConversionMother(neutralPion,vParticle);
1939 mesoncand->SetLabels(mesonIndex,virtualParticleIndex);
1941 if( ( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(mesoncand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())) ){
1943 // cout<< "Meson Accepted "<<endl;
1945 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
1947 if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1948 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
1950 if (fNeutralPionMode < 2) mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodConvGammas->GetEntries());
1951 else mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
1954 fHistoMotherInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt());
1955 Double_t sparesFill[4] = {mesoncand->M(),mesoncand->Pt(),(Double_t)zbin,(Double_t)mbin};
1956 fTHnSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
1959 ProcessTrueMesonCandidates(mesoncand,neutralPion,vParticle);
1969 //________________________________________________________________________
1970 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::CalculateBackground(){
1972 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
1976 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1977 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fNumberOfESDTracks);
1979 if (fNeutralPionMode < 2) mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodConvGammas->GetEntries());
1980 else mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
1984 AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
1985 if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity() ) {
1986 for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
1987 AliGammaConversionMotherAODVector *previousEventMesons = fBGHandler[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBG);
1988 if(fMoveParticleAccordingToVertex == kTRUE && method == 1){
1989 bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
1992 for(Int_t iCurrent=0;iCurrent<fGoodVirtualParticles->GetEntries();iCurrent++){
1993 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualParticles->At(iCurrent));
1995 for(UInt_t iPrevious=0;iPrevious<previousEventMesons->size();iPrevious++){
1996 AliAODConversionMother previousGoodMeson = (AliAODConversionMother)(*(previousEventMesons->at(iPrevious)));
1998 if(fMoveParticleAccordingToVertex == kTRUE && method == 1 ){
1999 MoveParticleAccordingToVertex(&previousGoodMeson,bgEventVertex);
2002 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&previousGoodMeson,¤tEventGoodV0);
2005 if( ( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2006 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2007 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2008 fTHnSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2010 delete backgroundCandidate;
2011 backgroundCandidate = 0x0;
2016 for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2017 AliGammaConversionMotherAODVector *previousEventMesons = fBGHandler[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBG);
2018 if(previousEventMesons){
2019 if(fMoveParticleAccordingToVertex == kTRUE && method == 1){
2020 bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2022 for(Int_t iCurrent=0;iCurrent<fGoodVirtualParticles->GetEntries();iCurrent++){
2024 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualParticles->At(iCurrent));
2026 for(UInt_t iPrevious=0;iPrevious<previousEventMesons->size();iPrevious++){
2028 AliAODConversionMother previousGoodMeson = (AliAODConversionMother)(*(previousEventMesons->at(iPrevious)));
2030 if(fMoveParticleAccordingToVertex == kTRUE && method ==1){
2031 MoveParticleAccordingToVertex(&previousGoodMeson,bgEventVertex);
2034 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&previousGoodMeson,¤tEventGoodV0);
2036 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2037 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2038 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2039 fTHnSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2041 delete backgroundCandidate;
2042 backgroundCandidate = 0x0;
2050 //______________________________________________________________________
2051 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::ProcessTrueMesonCandidates(AliAODConversionMother *mesoncand, AliAODConversionMother *TrueNeutralPionCandidate, AliAODConversionPhoton *TrueVirtualParticleCandidate){
2053 // Process True Mesons
2054 AliStack *MCStack = fMCEvent->Stack();
2056 Bool_t isTrueEta = kFALSE;
2057 Bool_t isTrueOmega = kFALSE;
2058 Int_t trueMesonFlag = TrueNeutralPionCandidate->GetTrueMesonValue();
2059 Int_t pi0MCLabel= TrueNeutralPionCandidate->GetMCLabel();
2062 if ( !(trueMesonFlag == 1 && pi0MCLabel != -1)) return;
2063 // cout << trueMesonFlag << "\t" << pi0MCLabel << endl;
2066 Int_t virtualParticleMCLabel = TrueVirtualParticleCandidate->GetMCParticleLabel(MCStack);
2067 Int_t virtualParticleMotherLabel = -1;
2068 Bool_t isPiPiDecay = kFALSE;
2071 TParticle * negativeMC = (TParticle*)TrueVirtualParticleCandidate->GetNegativeMCDaughter(MCStack);
2072 TParticle * positiveMC = (TParticle*)TrueVirtualParticleCandidate->GetPositiveMCDaughter(MCStack);
2075 if(virtualParticleMCLabel != -1){ // if virtualParticleMCLabel==-1 particles don't have same mother
2076 // TParticle * negativeMC = (TParticle*)TrueVirtualParticleCandidate->GetNegativeMCDaughter(MCStack);
2077 // TParticle * positiveMC = (TParticle*)TrueVirtualParticleCandidate->GetPositiveMCDaughter(MCStack);
2078 // TParticle * virtualParticleMotherMC = (TParticle*)MCStack->Particle(virtualParticleMCLabel);
2079 // cout << "pdg code same mother - " << virtualParticleMotherMC->GetPdgCode() << endl;
2081 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){ // Pions ...
2082 virtualParticleMotherLabel=virtualParticleMCLabel;
2084 // } else if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2085 // if( virtualParticleMotherMC->GetPdgCode() != 22 ){
2086 // virtualParticleMotherLabel=virtualParticleMCLabel;
2087 // isDalitz = kTRUE;
2088 // } else if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2089 // virtualParticleMotherLabel=virtualParticleMotherMC->GetFirstMother();
2090 // isRealGamma = kTRUE; //no virtual gamma
2094 if (IsEtaPiPlPiMiPiZeroDaughter(pi0MCLabel) || IsOmegaPiPlPiMiPiZeroDaughter(pi0MCLabel)){
2095 Int_t pi0MotherMCLabel = ((TParticle*)MCStack->Particle(pi0MCLabel))->GetMother(0);
2096 if(virtualParticleMCLabel != -1){
2097 // cout << "pi+pi- mother: "<< virtualParticleMCLabel << endl;
2098 // cout << "pi0 mother: "<< pi0MotherMCLabel << endl;
2100 // TParticle * virtualParticleMotherMC = (TParticle*)MCStack->Particle(virtualParticleMCLabel);
2101 // cout << "pdg code same mother - " << virtualParticleMotherMC->GetPdgCode() << endl;
2103 if( pi0MotherMCLabel == virtualParticleMotherLabel ){
2104 if(((TParticle*)MCStack->Particle(virtualParticleMotherLabel))->GetPdgCode() == 221){
2105 // cout << "found eta" << endl;
2108 if(((TParticle*)MCStack->Particle(virtualParticleMotherLabel))->GetPdgCode() == 223){
2109 // cout << "found omega" << endl;
2116 if( isTrueEta || isTrueOmega ){ // True Eta or Omega
2117 if ( isPiPiDecay) { //real eta -> Pi+ Pi- Pi0
2118 Float_t weighted= 1;
2119 // if( ((AliPrimaryPionCuts*) fPionCutArray->At(fiCut))->DoWeights() ) {
2120 // if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCStack,fInputEvent)){
2121 // if (((TParticle*)MCStack->Particle(gammaMotherLabel))->Pt()>0.005){
2122 // weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gammaMotherLabel,fMCStack,fInputEvent);
2126 fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
2133 //________________________________________________________________________
2134 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::UpdateEventByEventData(){
2135 //see header file for documentation
2139 if(fNeutralPionCandidates->GetEntries() >0 ){
2140 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2141 fBGHandler[fiCut]->AddMesonEvent(fNeutralPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
2142 } else { // means we use #V0s for multiplicity
2143 if (fNeutralPionMode < 2) fBGHandler[fiCut]->AddMesonEvent(fNeutralPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodConvGammas->GetEntries(),0);
2144 else fBGHandler[fiCut]->AddMesonEvent(fNeutralPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),0);
2147 } else if ( method == 2 ){
2148 if(fGoodVirtualParticles->GetEntries() > 0 ){
2149 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2150 fBGHandler[fiCut]->AddEvent(fGoodVirtualParticles,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
2151 } else{ // means we use #V0s for multiplicity
2152 fBGHandler[fiCut]->AddEvent(fGoodVirtualParticles,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodVirtualParticles->GetEntries(),0);
2158 //________________________________________________________________________
2159 void AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::MoveParticleAccordingToVertex(AliAODConversionMother* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex){
2160 //see header file for documentation
2162 Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
2163 Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
2164 Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
2166 Double_t movedPlace[3] = {particle->GetProductionX() - dx,particle->GetProductionY() - dy,particle->GetProductionZ() - dz};
2167 particle->SetProductionPoint(movedPlace);
2170 //_____________________________________________________________________________________
2171 Bool_t AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::IsEtaPiPlPiMiPiZeroDaughter( Int_t label ) const {
2173 // Returns true if the particle comes from eta -> pi+ pi- gamma
2175 Int_t motherLabel = fMCStack->Particle( label )->GetMother(0);
2176 if( motherLabel < 0 || motherLabel >= fMCStack->GetNtrack() ) return kFALSE;
2178 TParticle* mother = fMCStack->Particle( motherLabel );
2179 // cout << "found eta? " << endl;
2180 if( mother->GetPdgCode() != 221 ) return kFALSE;
2181 // else cout << "YES" << endl;
2182 if( IsPiPlPiMiPiZeroDecay( mother ) ) return kTRUE;
2186 //_____________________________________________________________________________________
2187 Bool_t AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::IsOmegaPiPlPiMiPiZeroDaughter( Int_t label ) const {
2189 // Returns true if the particle comes from eta -> pi+ pi- gamma
2191 Int_t motherLabel = fMCStack->Particle( label )->GetMother(0);
2192 if( motherLabel < 0 || motherLabel >= fMCStack->GetNtrack() ) return kFALSE;
2194 TParticle* mother = fMCStack->Particle( motherLabel );
2195 // cout << "found omega? " << endl;
2196 if( mother->GetPdgCode() != 223 ) return kFALSE;
2197 // else cout << "YES" << endl;
2198 if( IsPiPlPiMiPiZeroDecay( mother ) ) return kTRUE;
2203 //_____________________________________________________________________________
2204 Bool_t AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::IsPiPlPiMiPiZeroDecay(TParticle *fMCMother) const
2206 // cout << fMCMother->GetNDaughters() << endl;
2207 if( fMCMother->GetNDaughters() != 3 ) return kFALSE;
2208 // cout << fMCMother->GetPdgCode() << endl;
2209 if( !(fMCMother->GetPdgCode() == 221 || fMCMother->GetPdgCode() == 223) ) return kFALSE;
2210 // cout << "made it til here" << endl;
2212 TParticle *posPion = 0x0;
2213 TParticle *negPion = 0x0;
2214 TParticle *neutPion = 0x0;
2216 for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
2217 TParticle* temp = (TParticle*)fMCStack->Particle( index );
2219 switch( temp->GetPdgCode() ) {
2231 if( posPion && negPion && neutPion) return kTRUE;
2236 //_____________________________________________________________________________________
2237 Bool_t AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero::GammaIsNeutralMesonPiPlPiMiPiZeroDaughter( Int_t label ) const {
2239 // Returns true if the particle comes from eta -> pi+ pi- gamma
2241 Int_t motherLabel = fMCStack->Particle( label )->GetMother(0);
2242 if( motherLabel < 0 || motherLabel >= fMCStack->GetNtrack() ) return kFALSE;
2244 TParticle* mother = fMCStack->Particle( motherLabel );
2245 // cout << "found omega? " << endl;
2246 if( mother->GetPdgCode() != 111 ) return kFALSE;
2247 // else cout << "YES" << endl;
2248 Int_t grandMotherLabel = mother->GetMother(0);
2249 if( grandMotherLabel < 0 || grandMotherLabel >= fMCStack->GetNtrack() ) return kFALSE;
2250 TParticle* grandmother = fMCStack->Particle( grandMotherLabel );
2252 if( IsPiPlPiMiPiZeroDecay( grandmother ) ) return kTRUE;