changed Resolution, Material, and PhotonQA task to be able to run on the grid
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskConversionQA.cxx
CommitLineData
2bb2434e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
e5b6e8a6 3 * *
4 * Authors: Svein Lindal, Daniel Lohner *
5 * Version 1.0 *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
2bb2434e 14 **************************************************************************/
15
16////////////////////////////////////////////////
17//---------------------------------------------
18// QA Task for V0 Reader V1
19//---------------------------------------------
20////////////////////////////////////////////////
21
22#include "AliAnalysisTaskConversionQA.h"
23#include "TChain.h"
24#include "AliAnalysisManager.h"
25#include "TParticle.h"
26#include "TVectorF.h"
27#include "AliPIDResponse.h"
28#include "TFile.h"
e5b6e8a6 29#include "AliESDtrackCuts.h"
ae947965 30#include "AliAODMCParticle.h"
31#include "AliAODMCHeader.h"
32
2bb2434e 33
34class iostream;
35
36using namespace std;
37
38ClassImp(AliAnalysisTaskConversionQA)
39
40//________________________________________________________________________
ae947965 41AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA() : AliAnalysisTaskSE(),
42 fV0Reader(NULL),
43 fConversionGammas(NULL),
44 fConversionCuts(NULL),
45 fInputEvent(NULL),
46 fNumberOfESDTracks(0),
47 fMCEvent(NULL),
48 fMCStack(NULL),
72395bd9 49 fTreeQA(NULL),
ae947965 50 fIsHeavyIon(kFALSE),
51 ffillTree(kFALSE),
52 ffillHistograms(kFALSE),
53 fOutputList(NULL),
72395bd9 54 fTreeList(NULL),
ae947965 55 fESDList(NULL),
56 hVertexZ(NULL),
57 hNGoodESDTracks(NULL),
58 hNV0Tracks(NULL),
59 hNContributorsVertex(NULL),
60 hITSClusterPhi(NULL),
61 hGammaPt(NULL),
62 hGammaPhi(NULL),
63 hGammaEta(NULL),
64 hGammaChi2perNDF(NULL),
65 hGammaPsiPair(NULL),
66 hGammaQt(NULL),
67 hGammaCosinePointingAngle(NULL),
68 hGammaXY(NULL),
69 hGammaZR(NULL),
70 hElecPt(NULL),
71 hElecEta(NULL),
72 hElecPhi(NULL),
73 hElecNfindableClsTPC(NULL),
74 hPosiNfindableClsTPC(NULL),
4803eb1f 75 hElecAsymP(NULL),
ae947965 76 fTrueList(NULL),
77 hTrueResolutionR(NULL),
78 hTrueResolutionZ(NULL),
79 hTrueResolutionPhi(NULL),
80 hTrueGammaPt(NULL),
81 hTrueGammaPhi(NULL),
82 hTrueGammaEta(NULL),
83 hTrueGammaMass(NULL),
84 hTrueGammaChi2perNDF(NULL),
85 hTrueGammaPsiPair(NULL),
86 hTrueGammaQt(NULL),
87 hTrueGammaCosinePointingAngle(NULL),
88 hTrueGammaXY(NULL),
89 hTrueGammaZR(NULL),
90 hTrueElecPt(NULL),
91 hTrueElecEta(NULL),
92 hTrueElecPhi(NULL),
93 hTrueElecNfindableClsTPC(NULL),
94 hTruePosiNfindableClsTPC(NULL),
4803eb1f 95 hTrueElecAsymP(NULL),
72395bd9 96 fGammaPt(0),
97 fGammaTheta(0),
98 fGammaChi2NDF(0),
99// fGammaPhotonProp(NULL),
100// fGammaConvCoord(NULL),
101// fDaughterProp(NULL),
102 fKind(0),
ae947965 103 fIsMC(kFALSE),
104 fnGammaCandidates(1),
105 fMCStackPos(NULL),
106 fMCStackNeg(NULL)
107{
108
109}
72395bd9 110
2bb2434e 111AliAnalysisTaskConversionQA::AliAnalysisTaskConversionQA(const char *name) : AliAnalysisTaskSE(name),
e5b6e8a6 112 fV0Reader(NULL),
2bb2434e 113 fConversionGammas(NULL),
114 fConversionCuts(NULL),
e5b6e8a6 115 fInputEvent(NULL),
116 fNumberOfESDTracks(0),
117 fMCEvent(NULL),
118 fMCStack(NULL),
72395bd9 119 fTreeQA(NULL),
2bb2434e 120 fIsHeavyIon(kFALSE),
e5b6e8a6 121 ffillTree(kFALSE),
122 ffillHistograms(kFALSE),
123 fOutputList(NULL),
72395bd9 124 fTreeList(NULL),
e5b6e8a6 125 fESDList(NULL),
126 hVertexZ(NULL),
127 hNGoodESDTracks(NULL),
128 hNV0Tracks(NULL),
129 hNContributorsVertex(NULL),
130 hITSClusterPhi(NULL),
131 hGammaPt(NULL),
132 hGammaPhi(NULL),
133 hGammaEta(NULL),
134 hGammaChi2perNDF(NULL),
135 hGammaPsiPair(NULL),
136 hGammaQt(NULL),
137 hGammaCosinePointingAngle(NULL),
138 hGammaXY(NULL),
139 hGammaZR(NULL),
140 hElecPt(NULL),
141 hElecEta(NULL),
142 hElecPhi(NULL),
143 hElecNfindableClsTPC(NULL),
144 hPosiNfindableClsTPC(NULL),
4803eb1f 145 hElecAsymP(NULL),
e5b6e8a6 146 fTrueList(NULL),
ae947965 147 hTrueResolutionR(NULL),
148 hTrueResolutionZ(NULL),
149 hTrueResolutionPhi(NULL),
e5b6e8a6 150 hTrueGammaPt(NULL),
151 hTrueGammaPhi(NULL),
152 hTrueGammaEta(NULL),
153 hTrueGammaMass(NULL),
154 hTrueGammaChi2perNDF(NULL),
155 hTrueGammaPsiPair(NULL),
156 hTrueGammaQt(NULL),
157 hTrueGammaCosinePointingAngle(NULL),
158 hTrueGammaXY(NULL),
159 hTrueGammaZR(NULL),
160 hTrueElecPt(NULL),
161 hTrueElecEta(NULL),
162 hTrueElecPhi(NULL),
163 hTrueElecNfindableClsTPC(NULL),
ae947965 164 hTruePosiNfindableClsTPC(NULL),
4803eb1f 165 hTrueElecAsymP(NULL),
72395bd9 166 fGammaPt(0),
167 fGammaTheta(0),
168 fGammaChi2NDF(0),
169// fGammaPhotonProp(NULL),
170// fGammaConvCoord(NULL),
171// fDaughterProp(NULL),
172 fKind(0),
ae947965 173 fIsMC(kFALSE),
174 fnGammaCandidates(1),
175 fMCStackPos(NULL),
176 fMCStackNeg(NULL)
2bb2434e 177{
178 // Default constructor
179
180 DefineInput(0, TChain::Class());
181 DefineOutput(1, TList::Class());
182}
183
184//________________________________________________________________________
185AliAnalysisTaskConversionQA::~AliAnalysisTaskConversionQA()
186{
187 // default deconstructor
72395bd9 188
2bb2434e 189}
190//________________________________________________________________________
191void AliAnalysisTaskConversionQA::UserCreateOutputObjects()
192{
193 // Create User Output Objects
194
195 if(fOutputList != NULL){
196 delete fOutputList;
197 fOutputList = NULL;
198 }
199 if(fOutputList == NULL){
200 fOutputList = new TList();
201 fOutputList->SetOwner(kTRUE);
202 }
a280ac15 203
e5b6e8a6 204 if(ffillHistograms){
11c1e680 205
e5b6e8a6 206 fESDList = new TList();
207 fESDList->SetOwner(kTRUE);
208 fESDList->SetName("ESD QA");
209 fOutputList->Add(fESDList);
2bb2434e 210
e5b6e8a6 211 hVertexZ = new TH1F("Vertex_Z","Vertex_Z",300,-15,15);
212 fESDList->Add(hVertexZ);
213 hNContributorsVertex = new TH1I("ContrVertex_Z","ContrVertex_Z",3000,0,3000);
214 fESDList->Add(hNContributorsVertex);
a280ac15 215 if(fIsHeavyIon) hNGoodESDTracks = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
e5b6e8a6 216 else hNGoodESDTracks = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
217 fESDList->Add(hNGoodESDTracks);
218 if(fIsHeavyIon) hNV0Tracks = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
219 else hNV0Tracks = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
220 fESDList->Add(hNV0Tracks);
221
222 hITSClusterPhi = new TH2F("ITSClusterPhi","hITSClusterPhi",72,0,2*TMath::Pi(),7,0,7);
223 fESDList->Add(hITSClusterPhi);
224 hGammaPt = new TH1F("Gamma_Pt","Gamma_Pt",250,0,25);
225 fESDList->Add(hGammaPt);
226 hGammaPhi = new TH1F("Gamma_Phi","Gamma_Phi",360,0,2*TMath::Pi());
227 fESDList->Add(hGammaPhi);
11c1e680 228 hGammaEta = new TH1F("Gamma_Eta","Gamma_Eta",600,-1.5,1.5);
e5b6e8a6 229 fESDList->Add(hGammaEta);
230 hGammaChi2perNDF = new TH1F("Gamma_Chi2perNDF","Gamma_Chi2perNDF",500,0,100);
231 fESDList->Add(hGammaChi2perNDF);
232 hGammaPsiPair = new TH1F("Gamma_PsiPair","Gamma_PsiPair",500,0,2);
233 fESDList->Add(hGammaPsiPair);
234 hGammaQt = new TH1F("Gamma_Qt","Gamma_Qt",400,0,0.1);
235 fESDList->Add(hGammaQt);
236 hGammaCosinePointingAngle = new TH1F("Gamma_CosinePointingAngle","Gamma_CosinePointingAngle",900,0.7,1.);
237 fESDList->Add(hGammaCosinePointingAngle);
238 hGammaXY = new TH2F("Gamma_ConversionPoint_XY","Gamma_ConversionPoint_XY",960,-120,120,960,-120,120);
239 fESDList->Add(hGammaXY);
240 hGammaZR= new TH2F("Gamma_ConversionPoint_ZR","Gamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
241 fESDList->Add(hGammaZR);
242
243 hElecPt = new TH2F("Electron_Positron_Pt","Electron_Positron_Pt",250,0,25,250,0,25);
244 fESDList->Add(hElecPt);
11c1e680 245 hElecEta = new TH2F("Electron_Positron_Eta","Electron_Positron_Eta",600,-1.5,1.5,600,-1.5,1.5);
e5b6e8a6 246 fESDList->Add(hElecEta);
247 hElecPhi = new TH2F("Electron_Positron_Phi","Electron_Positron_Phi",360,0,2*TMath::Pi(),360,0,2*TMath::Pi());
248 fESDList->Add(hElecPhi);
249 hElecNfindableClsTPC = new TH1F("Electron_findableClusterTPC","Electron_findableClusterTPC",100,0,1);
250 fESDList->Add(hElecNfindableClsTPC);
251 hPosiNfindableClsTPC = new TH1F("Positron_findableClusterTPC","Positron_findableClusterTPC",100,0,1);
252 fESDList->Add(hPosiNfindableClsTPC);
4803eb1f 253 hElecAsymP = new TH2F("Electron_Asym_vs_P", "Electron_Asym_vs_P",200,0.,20.,200,0.,1.);
254 fESDList->Add(hElecAsymP);
e5b6e8a6 255
ae947965 256 if(fIsMC){
e5b6e8a6 257 fTrueList = new TList();
258 fTrueList->SetOwner(kTRUE);
259 fTrueList->SetName("True QA");
260 fOutputList->Add(fTrueList);
2bb2434e 261
ae947965 262 hTrueResolutionR = new TH2F("True_ConversionPointResolution_R","True_ConversionPointResolution_R",240,0,120,200,-20,20);
263 fTrueList->Add(hTrueResolutionR);
264 hTrueResolutionZ = new TH2F("True_ConversionPointResolution_Z","True_ConversionPointResolution_Z",480,-120,120,200,-20,20);
265 fTrueList->Add(hTrueResolutionZ);
266 hTrueResolutionPhi = new TH2F("True_ConversionPointResolution_Phi","True_ConversionPointResolution_Phi",360,0,2*TMath::Pi(),200,-TMath::Pi()/30., TMath::Pi()/30.);
267 fTrueList->Add(hTrueResolutionPhi);
e5b6e8a6 268
269 hTrueGammaPt = new TH1F("True_Gamma_Pt","True_Gamma_Pt",250,0,25);
270 fTrueList->Add(hTrueGammaPt);
271 hTrueGammaPhi = new TH1F("True_Gamma_Phi","True_Gamma_Phi",360,0,2*TMath::Pi());
272 fTrueList->Add(hTrueGammaPhi);
11c1e680 273 hTrueGammaEta = new TH1F("True_Gamma_Eta","True_Gamma_Eta",600,-1.5,1.5);
e5b6e8a6 274 fTrueList->Add(hTrueGammaEta);
275 hTrueGammaMass = new TH1F("True_Gamma_Mass","True_Gamma_Mass",1000,0,0.3);
276 fTrueList->Add(hTrueGammaMass);
277 hTrueGammaChi2perNDF = new TH1F("True_Gamma_Chi2perNDF","True_Gamma_Chi2perNDF",500,0,100);
278 fTrueList->Add(hTrueGammaChi2perNDF);
279 hTrueGammaPsiPair = new TH1F("True_Gamma_PsiPair","True_Gamma_PsiPair",500,0,2);
280 fTrueList->Add(hTrueGammaPsiPair);
281 hTrueGammaQt = new TH1F("True_Gamma_Qt","True_Gamma_Qt",400,0,0.1);
282 fTrueList->Add(hTrueGammaQt);
283 hTrueGammaCosinePointingAngle = new TH1F("True_Gamma_CosinePointingAngle","True_Gamma_CosinePointingAngle",900,0.7,1.);
284 fTrueList->Add(hTrueGammaCosinePointingAngle);
285 hTrueGammaXY = new TH2F("True_Gamma_ConversionPoint_XY","True_Gamma_ConversionPoint_XY",960,-120,120,960,-120,120);
286 fTrueList->Add(hTrueGammaXY);
287 hTrueGammaZR= new TH2F("TrueGamma_ConversionPoint_ZR","TrueGamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
288 fTrueList->Add(hTrueGammaZR);
289
290 hTrueElecPt = new TH2F("True_Electron_Positron_Pt","True_Electron_Positron_Pt",250,0,25,250,0,25);
291 fTrueList->Add(hTrueElecPt);
11c1e680 292 hTrueElecEta = new TH2F("True_Electron_Positron_Eta","True_Electron_Positron_Eta",600,-1.5,1.5,600,-1.5,1.5);
e5b6e8a6 293 fTrueList->Add(hTrueElecEta);
294 hTrueElecPhi = new TH2F("True_Electron_Positron_Phi","True_Electron_Positron_Phi",360,0,2*TMath::Pi(),360,0,2*TMath::Pi());
295 fTrueList->Add(hTrueElecPhi);
296 hTrueElecNfindableClsTPC = new TH1F("True_Electron_findableClusterTPC","True_Electron_findableClusterTPC",100,0,1);
297 fTrueList->Add(hTrueElecNfindableClsTPC);
298 hTruePosiNfindableClsTPC = new TH1F("True_Positron_findableClusterTPC","True_Positron_findableClusterTPC",100,0,1);
299 fTrueList->Add(hTruePosiNfindableClsTPC);
4803eb1f 300 hTrueElecAsymP = new TH2F("True_Electron_Asym_vs_P", "True_Electron_Asym_vs_P",200,0.,20.,200,0.,1.);
301 fTrueList->Add(hTrueElecAsymP);
e5b6e8a6 302 }
a280ac15 303 if(fConversionCuts->GetCutHistograms()){
304 fOutputList->Add(fConversionCuts->GetCutHistograms());
305 }
e5b6e8a6 306 }
a280ac15 307
e5b6e8a6 308 if(ffillTree){
72395bd9 309 fTreeList = new TList();
310 fTreeList->SetOwner(kTRUE);
311 fTreeList->SetName("TreeList");
312 fOutputList->Add(fTreeList);
313
314 fTreeQA = new TTree("PhotonQA","PhotonQA");
315
316// fGammaPhotonProp = new Float_t[5]; // 5: fGammaQt, fGammaAlpha, fGammaPsiPair, fGammaCosPoint, fGammaMass;
317// fGammaConvCoord = new Float_t[5]; // 5
318// fDaughterProp = new Float_t[20]; // 5
319
320 fTreeQA->Branch("pt",&fGammaPt,"fGammaPt/F");
321 fTreeQA->Branch("theta",&fGammaTheta,"fGammaTheta/F");
322 fTreeQA->Branch("chi2ndf",&fGammaChi2NDF,"fGammaChi2NDF/F");
323 fTreeQA->Branch("photonProp",fGammaPhotonProp,"fGammaPhotonProp[5]/F");
324 fTreeQA->Branch("recCords",fGammaConvCoord,"fGammaConvCoord[5]/F");
325 fTreeQA->Branch("daughterProp",fDaughterProp,"fDaughterProp[20]/F");
326 if (fIsMC) {
327 fTreeQA->Branch("kind",&fKind,"fKind/b");
328 }
329 fTreeList->Add(fTreeQA);
330
e5b6e8a6 331 }
a280ac15 332
11c1e680 333 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
334
e5b6e8a6 335 PostData(1, fOutputList);
2bb2434e 336}
11c1e680 337//_____________________________________________________________________________
338Bool_t AliAnalysisTaskConversionQA::Notify()
339{
ccfa8c0d 340 if(!fConversionCuts->GetDoEtaShift()) return kTRUE;; // No Eta Shift requested, continue
341
342 if(fConversionCuts->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
343 fConversionCuts->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
344 fConversionCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
345 return kTRUE;
11c1e680 346 }
ccfa8c0d 347 else{
348 printf(" Gamma Conversion QA Task %s :: Eta Shift Manually Set to %f \n\n",
349 (fConversionCuts->GetCutNumber()).Data(),fConversionCuts->GetEtaShift());
350 fConversionCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
351 }
352
11c1e680 353 return kTRUE;
354}
2bb2434e 355//________________________________________________________________________
356void AliAnalysisTaskConversionQA::UserExec(Option_t *){
a280ac15 357
11c1e680 358
2bb2434e 359
360 Int_t eventQuality = ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetEventQuality();
361 if(eventQuality != 0){// Event Not Accepted
362 return;
363 }
e5b6e8a6 364 fInputEvent = InputEvent();
ae947965 365 if(fIsMC) fMCEvent = MCEvent();
366 if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){ fMCStack = fMCEvent->Stack(); }
e5b6e8a6 367
368 Int_t eventNotAccepted =
369 fConversionCuts->IsEventAcceptedByConversionCut(fV0Reader->GetConversionCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
370 if(eventNotAccepted) return; // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2bb2434e 371
372 fConversionGammas=fV0Reader->GetReconstructedGammas();
373
e5b6e8a6 374 if(fMCEvent){
375 if(fConversionCuts->GetSignalRejection() != 0){
ae947965 376 if(fInputEvent->IsA()==AliESDEvent::Class()){
377 fConversionCuts->GetNotRejectedParticles(fConversionCuts->GetSignalRejection(),
378 fConversionCuts->GetAcceptedHeader(),
379 fMCEvent);
380 }
381 else if(fInputEvent->IsA()==AliAODEvent::Class()){
382 fConversionCuts->GetNotRejectedParticles(fConversionCuts->GetSignalRejection(),
383 fConversionCuts->GetAcceptedHeader(),
384 fInputEvent);
385 }
e5b6e8a6 386 }
387 }
388
e5b6e8a6 389 if(ffillHistograms){
ae947965 390 CountTracks();
a280ac15 391 hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
392 hNContributorsVertex->Fill(fConversionCuts->GetNumberOfContributorsVtx(fInputEvent));
393 hNGoodESDTracks->Fill(fNumberOfESDTracks);
394 hNV0Tracks->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
e5b6e8a6 395 }
2bb2434e 396
ae947965 397 if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class())
398 RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
399
2bb2434e 400 for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
401 AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
0a2b2b4b 402 if (gamma==NULL) continue;
e5b6e8a6 403 if(fMCEvent && fConversionCuts->GetSignalRejection() != 0){
ae947965 404 if(!fConversionCuts->IsParticleFromBGEvent(gamma->GetMCLabelPositive(), fMCStack, fInputEvent))
e5b6e8a6 405 continue;
ae947965 406 if(!fConversionCuts->IsParticleFromBGEvent(gamma->GetMCLabelNegative(), fMCStack, fInputEvent))
e5b6e8a6 407 continue;
408 }
a280ac15 409 if(!fConversionCuts->PhotonIsSelected(gamma,fInputEvent)){
410 continue;
e5b6e8a6 411 }
412
a280ac15 413 if(ffillTree) ProcessQATree(gamma);
414 if(ffillHistograms) ProcessQA(gamma);
415 }
ae947965 416 if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class())
417 RelabelAODPhotonCandidates(kFALSE); // In case of AODMC relabeling MC
418
a280ac15 419 PostData(1, fOutputList);
420}
421
422
423///________________________________________________________________________
424void AliAnalysisTaskConversionQA::ProcessQATree(AliAODConversionPhoton *gamma){
425
426 // Fill Histograms for QA and MC
ae947965 427 AliVEvent* event = (AliVEvent*) InputEvent();
4803eb1f 428
429
430
a280ac15 431 AliPIDResponse* pidResonse = ((AliConversionCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
432
72395bd9 433 fGammaPt = gamma->GetPhotonPt();
434
435 fGammaTheta = gamma->Theta();
436 fGammaChi2NDF = gamma->GetChi2perNDF();
437
438 fGammaPhotonProp[0] = gamma->GetArmenterosQt();
439 fGammaPhotonProp[1] = gamma->GetArmenterosAlpha();
440 fGammaPhotonProp[2] = gamma->GetPsiPair();
441 fGammaPhotonProp[3] = fConversionCuts->GetCosineOfPointingAngle(gamma,event);
442 fGammaPhotonProp[4] = gamma->GetMass();
443
444 fGammaConvCoord[0] = gamma->GetConversionX();
445 fGammaConvCoord[1] = gamma->GetConversionY();
446 fGammaConvCoord[2] = gamma->GetConversionZ();
447 fGammaConvCoord[3] = gamma->GetConversionRadius();
448 fGammaConvCoord[4] = gamma->GetPhotonPhi();
449
ae947965 450 AliVTrack * negTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelNegative());
451 AliVTrack * posTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelPositive());
a280ac15 452
4803eb1f 453
a280ac15 454 if(!negTrack||!posTrack)return;
455
72395bd9 456 fKind = 9;
4803eb1f 457 if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
72395bd9 458 fKind = IsTruePhotonESD(gamma);
ae947965 459 } else if (fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
72395bd9 460 fKind = IsTruePhotonAOD(gamma);
a280ac15 461 }
462
72395bd9 463 fDaughterProp[0] = posTrack->Pt();
464 fDaughterProp[7] = negTrack->Pt();
465 fDaughterProp[1] = posTrack->Theta();
466 fDaughterProp[8] = negTrack->Theta();
a280ac15 467 Double32_t signalPos[4] = {0,0,0,0};
468 Char_t nclPos[3];
469 Char_t nrowsPos[3];
470 if (posTrack->GetTPCdEdxInfo()) {
471 posTrack->GetTPCdEdxInfo()->GetTPCSignalRegionInfo(signalPos,nclPos,nrowsPos);
72395bd9 472 fDaughterProp[2] = signalPos[0];
473 fDaughterProp[14] = signalPos[1];
474 fDaughterProp[16] = signalPos[2];
a280ac15 475 } else {
72395bd9 476 fDaughterProp[2] = posTrack->GetTPCsignal();
477 fDaughterProp[14] = 0;
478 fDaughterProp[16] = 0;
a280ac15 479 }
480 Double32_t signalNeg[4] = {0,0,0,0};
481 Char_t nclNeg[3];
482 Char_t nrowsNeg[3];
483 if (negTrack->GetTPCdEdxInfo()) {
484 negTrack->GetTPCdEdxInfo()->GetTPCSignalRegionInfo(signalNeg,nclNeg,nrowsNeg);
72395bd9 485 fDaughterProp[9] = signalNeg[0];
486 fDaughterProp[15] = signalNeg[1];
487 fDaughterProp[17] = signalNeg[2];
a280ac15 488 } else {
72395bd9 489 fDaughterProp[9] = negTrack->GetTPCsignal();
490 fDaughterProp[15] = 0;
491 fDaughterProp[17] = 0;
a280ac15 492 }
72395bd9 493 fDaughterProp[3] = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
494 fDaughterProp[10] = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
a280ac15 495 if((posTrack->GetStatus() & AliESDtrack::kTOFpid) && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
496 Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
497 Double_t timesPos[5];
498 posTrack->GetIntegratedTimes(timesPos);
499 Double_t TOFsignalPos = posTrack->GetTOFsignal();
500 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
72395bd9 501 fDaughterProp[4] = dTpos;
502 fDaughterProp[5] = pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron);
a280ac15 503 } else {
72395bd9 504 fDaughterProp[4] = 20000;
505 fDaughterProp[5] = -20;
a280ac15 506 }
507 if((negTrack->GetStatus() & AliESDtrack::kTOFpid) && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
508 Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
509 Double_t timesNeg[5];
510 negTrack->GetIntegratedTimes(timesNeg);
511 Double_t TOFsignalNeg = negTrack->GetTOFsignal();
512 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
72395bd9 513 fDaughterProp[11] = dTneg;
514 fDaughterProp[12] = pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron);
a280ac15 515 } else {
72395bd9 516 fDaughterProp[11] = 20000;
517 fDaughterProp[12] = -20;
a280ac15 518 }
519
72395bd9 520 fDaughterProp[6] = (Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
521 fDaughterProp[18] = posTrack->GetNcls(1);
522 fDaughterProp[13] = (Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
523 fDaughterProp[19] = negTrack->GetNcls(1);
ae947965 524
72395bd9 525 if (fTreeQA){
526 fTreeQA->Fill();
2bb2434e 527 }
528}
a280ac15 529
e5b6e8a6 530//_____________________________________________________________________________________________________
a280ac15 531void AliAnalysisTaskConversionQA::ProcessQA(AliAODConversionPhoton *gamma){
e5b6e8a6 532
2bb2434e 533
e5b6e8a6 534 // Fill Histograms for QA and MC
a280ac15 535 hGammaPt->Fill(gamma->GetPhotonPt());
536 hGammaPhi->Fill(gamma->GetPhotonPhi());
537 hGammaEta->Fill(gamma->Eta());
538 hGammaChi2perNDF->Fill(gamma->GetChi2perNDF());
539 hGammaPsiPair->Fill(gamma->GetPsiPair());
540 hGammaQt->Fill(gamma->GetArmenterosQt());
541 hGammaCosinePointingAngle->Fill(fConversionCuts->GetCosineOfPointingAngle(gamma,fInputEvent));
542 hGammaXY->Fill(gamma->GetConversionX(),gamma->GetConversionY());
543 hGammaZR->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
544
ae947965 545 AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelNegative());
546 AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelPositive());
a280ac15 547 if(!negTrack||!posTrack)return;
548
549 Double_t negtrackPhi = negTrack->Phi();
550 Double_t postrackPhi = posTrack->Phi();
551 hITSClusterPhi->Fill(negtrackPhi,6);
552 hITSClusterPhi->Fill(postrackPhi,6);
553 for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
554 if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
555 hITSClusterPhi->Fill(negtrackPhi,itsLayer);
e5b6e8a6 556 }
a280ac15 557 if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
558 hITSClusterPhi->Fill(postrackPhi,itsLayer);
e5b6e8a6 559 }
a280ac15 560 }
e5b6e8a6 561
a280ac15 562 hElecPt->Fill(negTrack->Pt(),posTrack->Pt());
563 hElecEta->Fill(negTrack->Eta(),posTrack->Eta());
564 hElecPhi->Fill(negTrack->Phi(),posTrack->Phi());
e5b6e8a6 565
a280ac15 566 hElecNfindableClsTPC->Fill((Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
567 hPosiNfindableClsTPC->Fill((Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
4803eb1f 568 if(gamma->P()!=0){
569 hElecAsymP->Fill(gamma->P(),negTrack->P()/gamma->P());
570 }
a280ac15 571 // hElecNfindableClsTPC->Fill((Float_t)negTrack->GetNcls(1)/(Float_t)negTrack->GetTPCNclsF());
572 // hPosiNfindableClsTPC->Fill((Float_t)posTrack->GetNcls(1)/(Float_t)posTrack->GetTPCNclsF());
ae947965 573 if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
574 ProcessTrueQAESD(gamma,(AliESDtrack*)negTrack,(AliESDtrack*)posTrack);
575 } else if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
576 ProcessTrueQAAOD(gamma,(AliAODTrack*)negTrack,(AliAODTrack*)posTrack);
577 }
e5b6e8a6 578}
a280ac15 579
e5b6e8a6 580//________________________________________________________________________
ae947965 581void AliAnalysisTaskConversionQA::ProcessTrueQAESD(AliAODConversionPhoton *TruePhotonCandidate, AliESDtrack *elec, AliESDtrack *posi)
e5b6e8a6 582{
4803eb1f 583
584 if(IsTruePhotonESD(TruePhotonCandidate)!=0 && IsTruePhotonESD(TruePhotonCandidate)!=5 ) return;
585
e5b6e8a6 586 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
587 TParticle *mcPhoton = TruePhotonCandidate->GetMCParticle(fMCStack);
e5b6e8a6 588 // True Photon
ae947965 589 hTrueResolutionR->Fill(TruePhotonCandidate->GetConversionRadius(),
e5b6e8a6 590 TruePhotonCandidate->GetConversionRadius()-negDaughter->R());
ae947965 591 hTrueResolutionZ->Fill(TruePhotonCandidate->GetConversionZ(),
e5b6e8a6 592 TruePhotonCandidate->GetConversionZ()-negDaughter->Vz());
ae947965 593 hTrueResolutionPhi->Fill(TruePhotonCandidate->Phi(),
a280ac15 594 TruePhotonCandidate->Phi()-mcPhoton->Phi());
e5b6e8a6 595 hTrueGammaPt->Fill(TruePhotonCandidate->Pt());
596 hTrueGammaPhi->Fill(TruePhotonCandidate->Phi());
597 hTrueGammaEta->Fill(TruePhotonCandidate->Eta());
598 hTrueGammaMass->Fill(TruePhotonCandidate->GetMass());
599 hTrueGammaChi2perNDF->Fill(TruePhotonCandidate->GetChi2perNDF());
600 hTrueGammaPsiPair->Fill(TruePhotonCandidate->GetPsiPair());
601 hTrueGammaQt->Fill(TruePhotonCandidate->GetArmenterosQt());
602 hTrueGammaCosinePointingAngle->Fill(fConversionCuts->GetCosineOfPointingAngle(TruePhotonCandidate,fInputEvent));
603 hTrueGammaXY->Fill(TruePhotonCandidate->GetConversionX(),TruePhotonCandidate->GetConversionY());
604 hTrueGammaZR->Fill(TruePhotonCandidate->GetConversionZ(),TruePhotonCandidate->GetConversionRadius());
e5b6e8a6 605 hTrueElecPt->Fill(elec->Pt(),posi->Pt());
606 hTrueElecEta->Fill(elec->Eta(),posi->Eta());
607 hTrueElecPhi->Fill(elec->Phi(),posi->Phi());
608 hTrueElecNfindableClsTPC
609 ->Fill((Float_t)elec->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(TruePhotonCandidate->GetConversionRadius())));
610 hTruePosiNfindableClsTPC
611 ->Fill((Float_t)posi->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(TruePhotonCandidate->GetConversionRadius())));
4803eb1f 612 if(TruePhotonCandidate->P()!=0){
613 hTrueElecAsymP->Fill(TruePhotonCandidate->P(),elec->P()/TruePhotonCandidate->P());
614 }
615
e5b6e8a6 616 // hTrueElecNfindableClsTPC->Fill((Float_t)elec->GetNcls(1)/(Float_t)elec->GetTPCNclsF());
617 // hTruePosiNfindableClsTPC->Fill((Float_t)posi->GetNcls(1)/(Float_t)posi->GetTPCNclsF());
ae947965 618}
619
620//________________________________________________________________________
621void AliAnalysisTaskConversionQA::ProcessTrueQAAOD(AliAODConversionPhoton *TruePhotonCandidate, AliAODTrack *elec, AliAODTrack *posi)
622{
4803eb1f 623
624 if(IsTruePhotonAOD(TruePhotonCandidate)!=0 && IsTruePhotonESD(TruePhotonCandidate)!=5 ) return;
a280ac15 625
ae947965 626 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
627 AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
628 AliAODMCParticle *mcPhoton = (AliAODMCParticle*) AODMCTrackArray->At(negDaughter->GetMother());
629 // True Photon
630 hTrueResolutionR->Fill(TruePhotonCandidate->GetConversionRadius(),
631 TruePhotonCandidate->GetConversionRadius()-(TMath::Sqrt(negDaughter->Xv()*negDaughter->Xv()+negDaughter->Yv()*negDaughter->Yv())));
632 hTrueResolutionZ->Fill(TruePhotonCandidate->GetConversionZ(),
633 TruePhotonCandidate->GetConversionZ()-negDaughter->Zv());
634 hTrueResolutionPhi->Fill(TruePhotonCandidate->Phi(),
635 TruePhotonCandidate->Phi()-mcPhoton->Phi());
636 hTrueGammaPt->Fill(TruePhotonCandidate->Pt());
637 hTrueGammaPhi->Fill(TruePhotonCandidate->Phi());
638 hTrueGammaEta->Fill(TruePhotonCandidate->Eta());
639 hTrueGammaMass->Fill(TruePhotonCandidate->GetMass());
640 hTrueGammaChi2perNDF->Fill(TruePhotonCandidate->GetChi2perNDF());
641 hTrueGammaPsiPair->Fill(TruePhotonCandidate->GetPsiPair());
642 hTrueGammaQt->Fill(TruePhotonCandidate->GetArmenterosQt());
643 hTrueGammaCosinePointingAngle->Fill(fConversionCuts->GetCosineOfPointingAngle(TruePhotonCandidate,fInputEvent));
644 hTrueGammaXY->Fill(TruePhotonCandidate->GetConversionX(),TruePhotonCandidate->GetConversionY());
645 hTrueGammaZR->Fill(TruePhotonCandidate->GetConversionZ(),TruePhotonCandidate->GetConversionRadius());
646 hTrueElecPt->Fill(elec->Pt(),posi->Pt());
647 hTrueElecEta->Fill(elec->Eta(),posi->Eta());
648 hTrueElecPhi->Fill(elec->Phi(),posi->Phi());
649 hTrueElecNfindableClsTPC
650 ->Fill((Float_t)elec->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(TruePhotonCandidate->GetConversionRadius())));
651 hTruePosiNfindableClsTPC
652 ->Fill((Float_t)posi->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(TruePhotonCandidate->GetConversionRadius())));
653 // hTrueElecNfindableClsTPC->Fill((Float_t)elec->GetNcls(1)/(Float_t)elec->GetTPCNclsF());
654 // hTruePosiNfindableClsTPC->Fill((Float_t)posi->GetNcls(1)/(Float_t)posi->GetTPCNclsF());
e5b6e8a6 655}
ae947965 656
e5b6e8a6 657//________________________________________________________________________
ae947965 658void AliAnalysisTaskConversionQA::CountTracks(){
e5b6e8a6 659
ae947965 660 if(fInputEvent->IsA()==AliESDEvent::Class()){
e5b6e8a6 661 // Using standard function for setting Cuts
662 Bool_t selectPrimaries=kTRUE;
0a2b2b4b 663 AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
e5b6e8a6 664 EsdTrackCuts->SetMaxDCAToVertexZ(2);
665 EsdTrackCuts->SetEtaRange(-0.8, 0.8);
666 EsdTrackCuts->SetPtRange(0.15);
ae947965 667 fNumberOfESDTracks = 0;
668 for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
669 AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
670 if(!curTrack) continue;
671 // if(fMCEvent && ((AliConversionCuts*)fCutArray->At(fiCut))->GetSignalRejection() != 0){
672 // if(!((AliConversionCuts*)fCutArray->At(fiCut))->IsParticleFromBGEvent(abs(curTrack->GetLabel()), fMCStack)) continue;
673 // }
674 if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTracks++;
675 }
676 delete EsdTrackCuts;
677 EsdTrackCuts=0x0;
e5b6e8a6 678 }
ae947965 679 else if(fInputEvent->IsA()==AliAODEvent::Class()){
680 fNumberOfESDTracks = 0;
681 for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
682 AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
683 if(!curTrack->IsPrimaryCandidate()) continue;
684 if(abs(curTrack->Eta())>0.8) continue;
685 if(curTrack->Pt()<0.15) continue;
686 if(abs(curTrack->ZAtDCA())>2) continue;
687 fNumberOfESDTracks++;
688 }
689 }
690
e5b6e8a6 691 return;
692}
693//________________________________________________________________________
4803eb1f 694/*
ae947965 695Bool_t AliAnalysisTaskConversionQA::IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate)
e5b6e8a6 696{
697 TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
698 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
a280ac15 699
e5b6e8a6 700 if(posDaughter == NULL || negDaughter == NULL) return kFALSE; // One particle does not exist
701 Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
702 if(posDaughter->GetMother(0) != negDaughter->GetMother(0)) return kFALSE;
703 else if(posDaughter->GetMother(0) == -1) return kFALSE;
704
705 if(pdgCode[0]!=11 || pdgCode[1]!=11) return kFALSE; //One Particle is not electron
706 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return kFALSE; // Same Charge
707 if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return kFALSE;// check if the daughters come from a conversion
a280ac15 708
e5b6e8a6 709 TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
710 if(Photon->GetPdgCode() != 22) return kFALSE; // Mother is no Photon
711
712 return kTRUE;
713}
4803eb1f 714*/
715UInt_t AliAnalysisTaskConversionQA::IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate)
716{
717
718
719 UInt_t kind = 9;
720 TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
721 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
722 TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
723 Int_t motherLabelPhoton;
72395bd9 724 Int_t pdgCodePos = 0;
725 Int_t pdgCodeNeg = 0;
726 Int_t pdgCode = 0;
4803eb1f 727
728
729 if(posDaughter == NULL || negDaughter == NULL) {
730 kind = 9;
731 // return kFALSE; // One particle does not exist
732
733 } else if( posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) {
734 // kind = 1;
735 return 1;
736 pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
737 pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
738 if(pdgCodePos==11 && pdgCodeNeg==11) return 10; //Electron Combinatorial
739 if(pdgCodePos==11 && pdgCodeNeg==11 &&
740 (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) return 15; //direct Electron Combinatorial
741
742 if(pdgCodePos==211 && pdgCodeNeg==211) return 11; //Pion Combinatorial
743 if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) return 12; //Pion, Proton Combinatorics
744 if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) return 13; //Pion, Electron Combinatorics
745 if(pdgCodePos==321 || pdgCodeNeg==321) return 14; //Kaon combinatorics
746 }else{
747
748 pdgCodePos=posDaughter->GetPdgCode();
749 pdgCodeNeg=negDaughter->GetPdgCode();
750 motherLabelPhoton= Photon->GetMother(0);
751 if ( TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode()) pdgCode = TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode();
752
753 if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) return 2; // true from hadronic decays
754 else if ( !(pdgCodeNeg==pdgCodePos)){
755 if(pdgCode == 111) return 3; // pi0 Dalitz
756 else if (pdgCode == 221) return 4; // eta Dalitz
757 else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
758 if(pdgCode == 22 && motherLabelPhoton < fMCStack->GetNprimary()){
759 return 0; // primary photons
760 } else if (pdgCode == 22){
761 return 5; //secondary photons
762 }
763 }
764 }
765 }
766
767 return kind;
768}
2bb2434e 769
770//________________________________________________________________________
4803eb1f 771UInt_t AliAnalysisTaskConversionQA::IsTruePhotonAOD(AliAODConversionPhoton *TruePhotonCandidate)
ae947965 772{
ae947965 773
4803eb1f 774 UInt_t kind = 9;
775
776 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
777 AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
778 AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
779 AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
780 Int_t motherLabelPhoton = Photon->GetMother();
72395bd9 781 Int_t pdgCodePos = 0;
782 Int_t pdgCodeNeg = 0;
783 Int_t pdgCode = 0;
ae947965 784
4803eb1f 785 if(posDaughter == NULL || negDaughter == NULL) {
786 kind = 9;
787 // return kFALSE; // One particle does not exist
ae947965 788
4803eb1f 789 } else if( posDaughter->GetMother() != negDaughter->GetMother() || (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1)) {
790 kind = 1;
791
792 pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
793 pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
794 if(pdgCodePos==11 && pdgCodeNeg==11) kind = 10; //Electron Combinatorial
795 if(pdgCodePos==11 && pdgCodeNeg==11 &&
796 (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1))kind = 15; //direct Electron Combinatorial
797
798 if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
799 if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
800 if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
801 if(pdgCodePos==321 || pdgCodeNeg==321) kind = 14; //Kaon combinatorics
802 }else{
803
804 pdgCodePos=posDaughter->GetPdgCode();
805 pdgCodeNeg=negDaughter->GetPdgCode();
806
807 if ( TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode())
808 pdgCode = TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode();
809 if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) kind = 2; // true from hadronic decays
810 else if ( !(pdgCodeNeg==pdgCodePos)){
811 if(pdgCode == 111) kind = 3; // pi0 Dalitz
812 else if (pdgCode == 221) kind = 4; // eta Dalitz
813 else if (!(negDaughter->GetMCProcessCode() != 5 || posDaughter->GetMCProcessCode() !=5)){
814 if(pdgCode == 22 && motherLabelPhoton < fMCStack->GetNprimary()){
815 kind = 0; // primary photons
816 } else if (pdgCode == 22){
817 kind = 5; //secondary photons
818 }
819 }
820 }
821 }
822
823
824 return kind;
825
ae947965 826
ae947965 827}
828
829//________________________________________________________________________
830void AliAnalysisTaskConversionQA::RelabelAODPhotonCandidates(Bool_t mode){
831
832 // Relabeling For AOD Event
833 // ESDiD -> AODiD
834 // MCLabel -> AODMCLabel
835
836 if(mode){
837 fMCStackPos = new Int_t[fConversionGammas->GetEntries()];
838 fMCStackNeg = new Int_t[fConversionGammas->GetEntries()];
839 }
840
841 for(Int_t iGamma = 0;iGamma<fConversionGammas->GetEntries();iGamma++){
842 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fConversionGammas->At(iGamma);
843 if(!PhotonCandidate) continue;
844 if(!mode){// Back to ESD Labels
845 PhotonCandidate->SetMCLabelPositive(fMCStackPos[iGamma]);
846 PhotonCandidate->SetMCLabelNegative(fMCStackNeg[iGamma]);
847 //PhotonCandidate->IsAODMCLabel(kFALSE);
848 continue;
849 }
850 fMCStackPos[iGamma] = PhotonCandidate->GetMCLabelPositive();
851 fMCStackNeg[iGamma] = PhotonCandidate->GetMCLabelNegative();
852
853 Bool_t AODLabelPos = kFALSE;
854 Bool_t AODLabelNeg = kFALSE;
855
856 for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
857 AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
858 if(!AODLabelPos){
859 if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
860 PhotonCandidate->SetMCLabelPositive(abs(tempDaughter->GetLabel()));
861 AODLabelPos = kTRUE;
862 }
863 }
864 if(!AODLabelNeg){
865 if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
866 PhotonCandidate->SetMCLabelNegative(abs(tempDaughter->GetLabel()));
867 AODLabelNeg = kTRUE;
868 }
869 }
870 if(AODLabelNeg && AODLabelPos){
871 break;
872 }
873 } // Both ESD Tracks have AOD Tracks with Positive IDs
874 if(!AODLabelPos || !AODLabelNeg){
875 for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
876 AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
877 if(tempDaughter->GetID()<0){
878 if(!AODLabelPos){
879 if( (abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelPositive()){
880 PhotonCandidate->SetMCLabelPositive(abs(tempDaughter->GetLabel()));
881 AODLabelPos = kTRUE;
882 }
883 }
884 if(!AODLabelNeg){
885 if( (abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelNegative()){
886 PhotonCandidate->SetMCLabelNegative(abs(tempDaughter->GetLabel()));
887 AODLabelNeg = kTRUE;
888 }
889 }
890 }
891 if(AODLabelNeg && AODLabelPos){
892 break;
893 }
894 }
895 if(!AODLabelPos || !AODLabelNeg){
896 cout<<"WARNING!!! AOD TRACKS NOT FOUND FOR"<<endl;
897 }
898 }
899 }
900
901 if(!mode){
902 delete[] fMCStackPos;
903 delete[] fMCStackNeg;
904 }
905}
906
907//________________________________________________________________________
2bb2434e 908void AliAnalysisTaskConversionQA::Terminate(Option_t *)
909{
a280ac15 910
2bb2434e 911}