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